blob: 2d23f9a9cf4e250d01c6657223ec65c63b57d166 [file] [log] [blame]
Andrew F. Davisa513b2a2018-05-04 19:06:09 +00001/*
2 * Texas Instruments System Control Interface (TISCI) Protocol
3 *
4 * Communication protocol with TI SCI hardware
5 * The system works in a message response protocol
6 * See: http://processors.wiki.ti.com/index.php/TISCI for details
7 *
8 * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
9 *
10 * SPDX-License-Identifier: BSD-3-Clause
11 */
12
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000013#ifndef TI_SCI_PROTOCOL_H
14#define TI_SCI_PROTOCOL_H
Andrew F. Davisa513b2a2018-05-04 19:06:09 +000015
16#include <stdint.h>
17
18/* Generic Messages */
19#define TI_SCI_MSG_ENABLE_WDT 0x0000
20#define TI_SCI_MSG_WAKE_RESET 0x0001
21#define TI_SCI_MSG_VERSION 0x0002
22#define TI_SCI_MSG_WAKE_REASON 0x0003
23#define TI_SCI_MSG_GOODBYE 0x0004
24#define TI_SCI_MSG_SYS_RESET 0x0005
25
26/* Device requests */
27#define TI_SCI_MSG_SET_DEVICE_STATE 0x0200
28#define TI_SCI_MSG_GET_DEVICE_STATE 0x0201
29#define TI_SCI_MSG_SET_DEVICE_RESETS 0x0202
30
31/* Clock requests */
32#define TI_SCI_MSG_SET_CLOCK_STATE 0x0100
33#define TI_SCI_MSG_GET_CLOCK_STATE 0x0101
34#define TI_SCI_MSG_SET_CLOCK_PARENT 0x0102
35#define TI_SCI_MSG_GET_CLOCK_PARENT 0x0103
36#define TI_SCI_MSG_GET_NUM_CLOCK_PARENTS 0x0104
37#define TI_SCI_MSG_SET_CLOCK_FREQ 0x010c
38#define TI_SCI_MSG_QUERY_CLOCK_FREQ 0x010d
39#define TI_SCI_MSG_GET_CLOCK_FREQ 0x010e
40
41/* Processor Control Messages */
42#define TISCI_MSG_PROC_REQUEST 0xc000
43#define TISCI_MSG_PROC_RELEASE 0xc001
44#define TISCI_MSG_PROC_HANDOVER 0xc005
45#define TISCI_MSG_SET_PROC_BOOT_CONFIG 0xc100
46#define TISCI_MSG_SET_PROC_BOOT_CTRL 0xc101
47#define TISCI_MSG_PROC_AUTH_BOOT_IMIAGE 0xc120
48#define TISCI_MSG_GET_PROC_BOOT_STATUS 0xc400
Andrew F. Davisb62cc1e2018-12-18 13:21:12 -060049#define TISCI_MSG_WAIT_PROC_BOOT_STATUS 0xc401
Andrew F. Davisa513b2a2018-05-04 19:06:09 +000050
51/**
52 * struct ti_sci_msg_hdr - Generic Message Header for All messages and responses
53 * @type: Type of messages: One of TI_SCI_MSG* values
54 * @host: Host of the message
55 * @seq: Message identifier indicating a transfer sequence
56 * @flags: Flag for the message
57 */
58struct ti_sci_msg_hdr {
59 uint16_t type;
60 uint8_t host;
61 uint8_t seq;
62#define TI_SCI_MSG_FLAG(val) (1 << (val))
63#define TI_SCI_FLAG_REQ_GENERIC_NORESPONSE 0x0
64#define TI_SCI_FLAG_REQ_ACK_ON_RECEIVED TI_SCI_MSG_FLAG(0)
65#define TI_SCI_FLAG_REQ_ACK_ON_PROCESSED TI_SCI_MSG_FLAG(1)
66#define TI_SCI_FLAG_RESP_GENERIC_NACK 0x0
67#define TI_SCI_FLAG_RESP_GENERIC_ACK TI_SCI_MSG_FLAG(1)
68 /* Additional Flags */
69 uint32_t flags;
70} __packed;
71
72/**
73 * struct ti_sci_msg_resp_version - Response for a message
74 * @hdr: Generic header
75 * @firmware_description: String describing the firmware
76 * @firmware_revision: Firmware revision
77 * @abi_major: Major version of the ABI that firmware supports
78 * @abi_minor: Minor version of the ABI that firmware supports
79 *
80 * In general, ABI version changes follow the rule that minor version increments
81 * are backward compatible. Major revision changes in ABI may not be
82 * backward compatible.
83 *
84 * Response to a generic message with message type TI_SCI_MSG_VERSION
85 */
86struct ti_sci_msg_resp_version {
87 struct ti_sci_msg_hdr hdr;
88#define FIRMWARE_DESCRIPTION_LENGTH 32
89 char firmware_description[FIRMWARE_DESCRIPTION_LENGTH];
90 uint16_t firmware_revision;
91 uint8_t abi_major;
92 uint8_t abi_minor;
93} __packed;
94
95/**
96 * struct ti_sci_msg_req_reboot - Reboot the SoC
97 * @hdr: Generic Header
98 *
99 * Request type is TI_SCI_MSG_SYS_RESET, responded with a generic
100 * ACK/NACK message.
101 */
102struct ti_sci_msg_req_reboot {
103 struct ti_sci_msg_hdr hdr;
104} __packed;
105
106/**
107 * struct ti_sci_msg_req_set_device_state - Set the desired state of the device
108 * @hdr: Generic header
109 * @id: Indicates which device to modify
110 * @reserved: Reserved space in message, must be 0 for backward compatibility
111 * @state: The desired state of the device.
112 *
113 * Certain flags can also be set to alter the device state:
114 * + MSG_FLAG_DEVICE_WAKE_ENABLED - Configure the device to be a wake source.
115 * The meaning of this flag will vary slightly from device to device and from
116 * SoC to SoC but it generally allows the device to wake the SoC out of deep
117 * suspend states.
118 * + MSG_FLAG_DEVICE_RESET_ISO - Enable reset isolation for this device.
119 * + MSG_FLAG_DEVICE_EXCLUSIVE - Claim this device exclusively. When passed
120 * with STATE_RETENTION or STATE_ON, it will claim the device exclusively.
121 * If another host already has this device set to STATE_RETENTION or STATE_ON,
122 * the message will fail. Once successful, other hosts attempting to set
123 * STATE_RETENTION or STATE_ON will fail.
124 *
125 * Request type is TI_SCI_MSG_SET_DEVICE_STATE, responded with a generic
126 * ACK/NACK message.
127 */
128struct ti_sci_msg_req_set_device_state {
129 /* Additional hdr->flags options */
130#define MSG_FLAG_DEVICE_WAKE_ENABLED TI_SCI_MSG_FLAG(8)
131#define MSG_FLAG_DEVICE_RESET_ISO TI_SCI_MSG_FLAG(9)
132#define MSG_FLAG_DEVICE_EXCLUSIVE TI_SCI_MSG_FLAG(10)
133 struct ti_sci_msg_hdr hdr;
134 uint32_t id;
135 uint32_t reserved;
136
137#define MSG_DEVICE_SW_STATE_AUTO_OFF 0
138#define MSG_DEVICE_SW_STATE_RETENTION 1
139#define MSG_DEVICE_SW_STATE_ON 2
140 uint8_t state;
141} __packed;
142
143/**
144 * struct ti_sci_msg_req_get_device_state - Request to get device.
145 * @hdr: Generic header
146 * @id: Device Identifier
147 *
148 * Request type is TI_SCI_MSG_GET_DEVICE_STATE, responded device state
149 * information
150 */
151struct ti_sci_msg_req_get_device_state {
152 struct ti_sci_msg_hdr hdr;
153 uint32_t id;
154} __packed;
155
156/**
157 * struct ti_sci_msg_resp_get_device_state - Response to get device request.
158 * @hdr: Generic header
159 * @context_loss_count: Indicates how many times the device has lost context. A
160 * driver can use this monotonic counter to determine if the device has
161 * lost context since the last time this message was exchanged.
162 * @resets: Programmed state of the reset lines.
163 * @programmed_state: The state as programmed by set_device.
164 * - Uses the MSG_DEVICE_SW_* macros
165 * @current_state: The actual state of the hardware.
166 *
167 * Response to request TI_SCI_MSG_GET_DEVICE_STATE.
168 */
169struct ti_sci_msg_resp_get_device_state {
170 struct ti_sci_msg_hdr hdr;
171 uint32_t context_loss_count;
172 uint32_t resets;
173 uint8_t programmed_state;
174#define MSG_DEVICE_HW_STATE_OFF 0
175#define MSG_DEVICE_HW_STATE_ON 1
176#define MSG_DEVICE_HW_STATE_TRANS 2
177 uint8_t current_state;
178} __packed;
179
180/**
181 * struct ti_sci_msg_req_set_device_resets - Set the desired resets
182 * configuration of the device
183 * @hdr: Generic header
184 * @id: Indicates which device to modify
185 * @resets: A bit field of resets for the device. The meaning, behavior,
186 * and usage of the reset flags are device specific. 0 for a bit
187 * indicates releasing the reset represented by that bit while 1
188 * indicates keeping it held.
189 *
190 * Request type is TI_SCI_MSG_SET_DEVICE_RESETS, responded with a generic
191 * ACK/NACK message.
192 */
193struct ti_sci_msg_req_set_device_resets {
194 struct ti_sci_msg_hdr hdr;
195 uint32_t id;
196 uint32_t resets;
197} __packed;
198
199/**
200 * struct ti_sci_msg_req_set_clock_state - Request to setup a Clock state
201 * @hdr: Generic Header, Certain flags can be set specific to the clocks:
202 * MSG_FLAG_CLOCK_ALLOW_SSC: Allow this clock to be modified
203 * via spread spectrum clocking.
204 * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE: Allow this clock's
205 * frequency to be changed while it is running so long as it
206 * is within the min/max limits.
207 * MSG_FLAG_CLOCK_INPUT_TERM: Enable input termination, this
208 * is only applicable to clock inputs on the SoC pseudo-device.
209 * @dev_id: Device identifier this request is for
210 * @clk_id: Clock identifier for the device for this request.
211 * Each device has it's own set of clock inputs. This indexes
212 * which clock input to modify.
213 * @request_state: Request the state for the clock to be set to.
214 * MSG_CLOCK_SW_STATE_UNREQ: The IP does not require this clock,
215 * it can be disabled, regardless of the state of the device
216 * MSG_CLOCK_SW_STATE_AUTO: Allow the System Controller to
217 * automatically manage the state of this clock. If the device
218 * is enabled, then the clock is enabled. If the device is set
219 * to off or retention, then the clock is internally set as not
220 * being required by the device.(default)
221 * MSG_CLOCK_SW_STATE_REQ: Configure the clock to be enabled,
222 * regardless of the state of the device.
223 *
224 * Normally, all required clocks are managed by TISCI entity, this is used
225 * only for specific control *IF* required. Auto managed state is
226 * MSG_CLOCK_SW_STATE_AUTO, in other states, TISCI entity assume remote
227 * will explicitly control.
228 *
229 * Request type is TI_SCI_MSG_SET_CLOCK_STATE, response is a generic
230 * ACK or NACK message.
231 */
232struct ti_sci_msg_req_set_clock_state {
233 /* Additional hdr->flags options */
234#define MSG_FLAG_CLOCK_ALLOW_SSC TI_SCI_MSG_FLAG(8)
235#define MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE TI_SCI_MSG_FLAG(9)
236#define MSG_FLAG_CLOCK_INPUT_TERM TI_SCI_MSG_FLAG(10)
237 struct ti_sci_msg_hdr hdr;
238 uint32_t dev_id;
239 uint8_t clk_id;
240#define MSG_CLOCK_SW_STATE_UNREQ 0
241#define MSG_CLOCK_SW_STATE_AUTO 1
242#define MSG_CLOCK_SW_STATE_REQ 2
243 uint8_t request_state;
244} __packed;
245
246/**
247 * struct ti_sci_msg_req_get_clock_state - Request for clock state
248 * @hdr: Generic Header
249 * @dev_id: Device identifier this request is for
250 * @clk_id: Clock identifier for the device for this request.
251 * Each device has it's own set of clock inputs. This indexes
252 * which clock input to get state of.
253 *
254 * Request type is TI_SCI_MSG_GET_CLOCK_STATE, response is state
255 * of the clock
256 */
257struct ti_sci_msg_req_get_clock_state {
258 struct ti_sci_msg_hdr hdr;
259 uint32_t dev_id;
260 uint8_t clk_id;
261} __packed;
262
263/**
264 * struct ti_sci_msg_resp_get_clock_state - Response to get clock state
265 * @hdr: Generic Header
266 * @programmed_state: Any programmed state of the clock. This is one of
267 * MSG_CLOCK_SW_STATE* values.
268 * @current_state: Current state of the clock. This is one of:
269 * MSG_CLOCK_HW_STATE_NOT_READY: Clock is not ready
270 * MSG_CLOCK_HW_STATE_READY: Clock is ready
271 *
272 * Response to TI_SCI_MSG_GET_CLOCK_STATE.
273 */
274struct ti_sci_msg_resp_get_clock_state {
275 struct ti_sci_msg_hdr hdr;
276 uint8_t programmed_state;
277#define MSG_CLOCK_HW_STATE_NOT_READY 0
278#define MSG_CLOCK_HW_STATE_READY 1
279 uint8_t current_state;
280} __packed;
281
282/**
283 * struct ti_sci_msg_req_set_clock_parent - Set the clock parent
284 * @hdr: Generic Header
285 * @dev_id: Device identifier this request is for
286 * @clk_id: Clock identifier for the device for this request.
287 * Each device has it's own set of clock inputs. This indexes
288 * which clock input to modify.
289 * @parent_id: The new clock parent is selectable by an index via this
290 * parameter.
291 *
292 * Request type is TI_SCI_MSG_SET_CLOCK_PARENT, response is generic
293 * ACK / NACK message.
294 */
295struct ti_sci_msg_req_set_clock_parent {
296 struct ti_sci_msg_hdr hdr;
297 uint32_t dev_id;
298 uint8_t clk_id;
299 uint8_t parent_id;
300} __packed;
301
302/**
303 * struct ti_sci_msg_req_get_clock_parent - Get the clock parent
304 * @hdr: Generic Header
305 * @dev_id: Device identifier this request is for
306 * @clk_id: Clock identifier for the device for this request.
307 * Each device has it's own set of clock inputs. This indexes
308 * which clock input to get the parent for.
309 *
310 * Request type is TI_SCI_MSG_GET_CLOCK_PARENT, response is parent information
311 */
312struct ti_sci_msg_req_get_clock_parent {
313 struct ti_sci_msg_hdr hdr;
314 uint32_t dev_id;
315 uint8_t clk_id;
316} __packed;
317
318/**
319 * struct ti_sci_msg_resp_get_clock_parent - Response with clock parent
320 * @hdr: Generic Header
321 * @parent_id: The current clock parent
322 *
323 * Response to TI_SCI_MSG_GET_CLOCK_PARENT.
324 */
325struct ti_sci_msg_resp_get_clock_parent {
326 struct ti_sci_msg_hdr hdr;
327 uint8_t parent_id;
328} __packed;
329
330/**
331 * struct ti_sci_msg_req_get_clock_num_parents - Request to get clock parents
332 * @hdr: Generic header
333 * @dev_id: Device identifier this request is for
334 * @clk_id: Clock identifier for the device for this request.
335 *
336 * This request provides information about how many clock parent options
337 * are available for a given clock to a device. This is typically used
338 * for input clocks.
339 *
340 * Request type is TI_SCI_MSG_GET_NUM_CLOCK_PARENTS, response is appropriate
341 * message, or NACK in case of inability to satisfy request.
342 */
343struct ti_sci_msg_req_get_clock_num_parents {
344 struct ti_sci_msg_hdr hdr;
345 uint32_t dev_id;
346 uint8_t clk_id;
347} __packed;
348
349/**
350 * struct ti_sci_msg_resp_get_clock_num_parents - Response for get clk parents
351 * @hdr: Generic header
352 * @num_parents: Number of clock parents
353 *
354 * Response to TI_SCI_MSG_GET_NUM_CLOCK_PARENTS
355 */
356struct ti_sci_msg_resp_get_clock_num_parents {
357 struct ti_sci_msg_hdr hdr;
358 uint8_t num_parents;
359} __packed;
360
361/**
362 * struct ti_sci_msg_req_query_clock_freq - Request to query a frequency
363 * @hdr: Generic Header
364 * @dev_id: Device identifier this request is for
365 * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum
366 * allowable programmed frequency and does not account for clock
367 * tolerances and jitter.
368 * @target_freq_hz: The target clock frequency. A frequency will be found
369 * as close to this target frequency as possible.
370 * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum
371 * allowable programmed frequency and does not account for clock
372 * tolerances and jitter.
373 * @clk_id: Clock identifier for the device for this request.
374 *
375 * NOTE: Normally clock frequency management is automatically done by TISCI
376 * entity. In case of specific requests, TISCI evaluates capability to achieve
377 * requested frequency within provided range and responds with
378 * result message.
379 *
380 * Request type is TI_SCI_MSG_QUERY_CLOCK_FREQ, response is appropriate message,
381 * or NACK in case of inability to satisfy request.
382 */
383struct ti_sci_msg_req_query_clock_freq {
384 struct ti_sci_msg_hdr hdr;
385 uint32_t dev_id;
386 uint64_t min_freq_hz;
387 uint64_t target_freq_hz;
388 uint64_t max_freq_hz;
389 uint8_t clk_id;
390} __packed;
391
392/**
393 * struct ti_sci_msg_resp_query_clock_freq - Response to a clock frequency query
394 * @hdr: Generic Header
395 * @freq_hz: Frequency that is the best match in Hz.
396 *
397 * Response to request type TI_SCI_MSG_QUERY_CLOCK_FREQ. NOTE: if the request
398 * cannot be satisfied, the message will be of type NACK.
399 */
400struct ti_sci_msg_resp_query_clock_freq {
401 struct ti_sci_msg_hdr hdr;
402 uint64_t freq_hz;
403} __packed;
404
405/**
406 * struct ti_sci_msg_req_set_clock_freq - Request to setup a clock frequency
407 * @hdr: Generic Header
408 * @dev_id: Device identifier this request is for
409 * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum
410 * allowable programmed frequency and does not account for clock
411 * tolerances and jitter.
412 * @target_freq_hz: The target clock frequency. The clock will be programmed
413 * at a rate as close to this target frequency as possible.
414 * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum
415 * allowable programmed frequency and does not account for clock
416 * tolerances and jitter.
417 * @clk_id: Clock identifier for the device for this request.
418 *
419 * NOTE: Normally clock frequency management is automatically done by TISCI
420 * entity. In case of specific requests, TISCI evaluates capability to achieve
421 * requested range and responds with success/failure message.
422 *
423 * This sets the desired frequency for a clock within an allowable
424 * range. This message will fail on an enabled clock unless
425 * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE is set for the clock. Additionally,
426 * if other clocks have their frequency modified due to this message,
427 * they also must have the MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE or be disabled.
428 *
429 * Calling set frequency on a clock input to the SoC pseudo-device will
430 * inform the PMMC of that clock's frequency. Setting a frequency of
431 * zero will indicate the clock is disabled.
432 *
433 * Calling set frequency on clock outputs from the SoC pseudo-device will
434 * function similarly to setting the clock frequency on a device.
435 *
436 * Request type is TI_SCI_MSG_SET_CLOCK_FREQ, response is a generic ACK/NACK
437 * message.
438 */
439struct ti_sci_msg_req_set_clock_freq {
440 struct ti_sci_msg_hdr hdr;
441 uint32_t dev_id;
442 uint64_t min_freq_hz;
443 uint64_t target_freq_hz;
444 uint64_t max_freq_hz;
445 uint8_t clk_id;
446} __packed;
447
448/**
449 * struct ti_sci_msg_req_get_clock_freq - Request to get the clock frequency
450 * @hdr: Generic Header
451 * @dev_id: Device identifier this request is for
452 * @clk_id: Clock identifier for the device for this request.
453 *
454 * NOTE: Normally clock frequency management is automatically done by TISCI
455 * entity. In some cases, clock frequencies are configured by host.
456 *
457 * Request type is TI_SCI_MSG_GET_CLOCK_FREQ, responded with clock frequency
458 * that the clock is currently at.
459 */
460struct ti_sci_msg_req_get_clock_freq {
461 struct ti_sci_msg_hdr hdr;
462 uint32_t dev_id;
463 uint8_t clk_id;
464} __packed;
465
466/**
467 * struct ti_sci_msg_resp_get_clock_freq - Response of clock frequency request
468 * @hdr: Generic Header
469 * @freq_hz: Frequency that the clock is currently on, in Hz.
470 *
471 * Response to request type TI_SCI_MSG_GET_CLOCK_FREQ.
472 */
473struct ti_sci_msg_resp_get_clock_freq {
474 struct ti_sci_msg_hdr hdr;
475 uint64_t freq_hz;
476} __packed;
477
478#define TISCI_ADDR_LOW_MASK 0x00000000ffffffff
479#define TISCI_ADDR_HIGH_MASK 0xffffffff00000000
480#define TISCI_ADDR_HIGH_SHIFT 32
481
482/**
483 * struct ti_sci_msg_req_proc_request - Request a processor
484 *
485 * @hdr: Generic Header
486 * @processor_id: ID of processor
487 *
488 * Request type is TISCI_MSG_PROC_REQUEST, response is a generic ACK/NACK
489 * message.
490 */
491struct ti_sci_msg_req_proc_request {
492 struct ti_sci_msg_hdr hdr;
493 uint8_t processor_id;
494} __packed;
495
496/**
497 * struct ti_sci_msg_req_proc_release - Release a processor
498 *
499 * @hdr: Generic Header
500 * @processor_id: ID of processor
501 *
502 * Request type is TISCI_MSG_PROC_RELEASE, response is a generic ACK/NACK
503 * message.
504 */
505struct ti_sci_msg_req_proc_release {
506 struct ti_sci_msg_hdr hdr;
507 uint8_t processor_id;
508} __packed;
509
510/**
511 * struct ti_sci_msg_req_proc_handover - Handover a processor to a host
512 *
513 * @hdr: Generic Header
514 * @processor_id: ID of processor
515 * @host_id: New Host we want to give control to
516 *
517 * Request type is TISCI_MSG_PROC_HANDOVER, response is a generic ACK/NACK
518 * message.
519 */
520struct ti_sci_msg_req_proc_handover {
521 struct ti_sci_msg_hdr hdr;
522 uint8_t processor_id;
523 uint8_t host_id;
524} __packed;
525
526/* A53 Config Flags */
527#define PROC_BOOT_CFG_FLAG_ARMV8_DBG_EN 0x00000001
528#define PROC_BOOT_CFG_FLAG_ARMV8_DBG_NIDEN 0x00000002
529#define PROC_BOOT_CFG_FLAG_ARMV8_DBG_SPIDEN 0x00000004
530#define PROC_BOOT_CFG_FLAG_ARMV8_DBG_SPNIDEN 0x00000008
531#define PROC_BOOT_CFG_FLAG_ARMV8_AARCH32 0x00000100
532
533/* R5 Config Flags */
534#define PROC_BOOT_CFG_FLAG_R5_DBG_EN 0x00000001
535#define PROC_BOOT_CFG_FLAG_R5_DBG_NIDEN 0x00000002
536#define PROC_BOOT_CFG_FLAG_R5_LOCKSTEP 0x00000100
537#define PROC_BOOT_CFG_FLAG_R5_TEINIT 0x00000200
538#define PROC_BOOT_CFG_FLAG_R5_NMFI_EN 0x00000400
539#define PROC_BOOT_CFG_FLAG_R5_TCM_RSTBASE 0x00000800
540#define PROC_BOOT_CFG_FLAG_R5_BTCM_EN 0x00001000
541#define PROC_BOOT_CFG_FLAG_R5_ATCM_EN 0x00002000
542
543/**
544 * struct ti_sci_msg_req_set_proc_boot_config - Set Processor boot configuration
545 * @hdr: Generic Header
546 * @processor_id: ID of processor
547 * @bootvector_low: Lower 32bit (Little Endian) of boot vector
548 * @bootvector_high: Higher 32bit (Little Endian) of boot vector
549 * @config_flags_set: Optional Processor specific Config Flags to set.
550 * Setting a bit here implies required bit sets to 1.
551 * @config_flags_clear: Optional Processor specific Config Flags to clear.
552 * Setting a bit here implies required bit gets cleared.
553 *
554 * Request type is TISCI_MSG_SET_PROC_BOOT_CONFIG, response is a generic
555 * ACK/NACK message.
556 */
557struct ti_sci_msg_req_set_proc_boot_config {
558 struct ti_sci_msg_hdr hdr;
559 uint8_t processor_id;
560 uint32_t bootvector_low;
561 uint32_t bootvector_high;
562 uint32_t config_flags_set;
563 uint32_t config_flags_clear;
564} __packed;
565
Andrew F. Davisf6f33c22019-02-11 16:12:31 -0600566/* ARMV8 Control Flags */
567#define PROC_BOOT_CTRL_FLAG_ARMV8_ACINACTM 0x00000001
568#define PROC_BOOT_CTRL_FLAG_ARMV8_AINACTS 0x00000002
569#define PROC_BOOT_CTRL_FLAG_ARMV8_L2FLUSHREQ 0x00000100
570
Andrew F. Davisa513b2a2018-05-04 19:06:09 +0000571/* R5 Control Flags */
Andrew F. Davisf6f33c22019-02-11 16:12:31 -0600572#define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT 0x00000001
Andrew F. Davisa513b2a2018-05-04 19:06:09 +0000573
574/**
575 * struct ti_sci_msg_req_set_proc_boot_ctrl - Set Processor boot control flags
576 * @hdr: Generic Header
577 * @processor_id: ID of processor
578 * @config_flags_set: Optional Processor specific Config Flags to set.
579 * Setting a bit here implies required bit sets to 1.
580 * @config_flags_clear: Optional Processor specific Config Flags to clear.
581 * Setting a bit here implies required bit gets cleared.
582 *
583 * Request type is TISCI_MSG_SET_PROC_BOOT_CTRL, response is a generic ACK/NACK
584 * message.
585 */
586struct ti_sci_msg_req_set_proc_boot_ctrl {
587 struct ti_sci_msg_hdr hdr;
588 uint8_t processor_id;
589 uint32_t control_flags_set;
590 uint32_t control_flags_clear;
591} __packed;
592
593/**
594 * struct ti_sci_msg_req_proc_auth_start_image - Authenticate and start image
595 * @hdr: Generic Header
596 * @processor_id: ID of processor
597 * @cert_addr_low: Lower 32bit (Little Endian) of certificate
598 * @cert_addr_high: Higher 32bit (Little Endian) of certificate
599 *
600 * Request type is TISCI_MSG_PROC_AUTH_BOOT_IMAGE, response is a generic
601 * ACK/NACK message.
602 */
603struct ti_sci_msg_req_proc_auth_boot_image {
604 struct ti_sci_msg_hdr hdr;
605 uint8_t processor_id;
606 uint32_t cert_addr_low;
607 uint32_t cert_addr_high;
608} __packed;
609
610/**
611 * struct ti_sci_msg_req_get_proc_boot_status - Get processor boot status
612 * @hdr: Generic Header
613 * @processor_id: ID of processor
614 *
615 * Request type is TISCI_MSG_GET_PROC_BOOT_STATUS, response is appropriate
616 * message, or NACK in case of inability to satisfy request.
617 */
618struct ti_sci_msg_req_get_proc_boot_status {
619 struct ti_sci_msg_hdr hdr;
620 uint8_t processor_id;
621} __packed;
622
623/* ARMv8 Status Flags */
624#define PROC_BOOT_STATUS_FLAG_ARMV8_WFE 0x00000001
625#define PROC_BOOT_STATUS_FLAG_ARMV8_WFI 0x00000002
Andrew F. Davisf6f33c22019-02-11 16:12:31 -0600626#define PROC_BOOT_STATUS_FLAG_ARMV8_L2F_DONE 0x00000010
627#define PROC_BOOT_STATUS_FLAG_ARMV8_STANDBYWFIL2 0x00000020
Andrew F. Davisa513b2a2018-05-04 19:06:09 +0000628
629/* R5 Status Flags */
630#define PROC_BOOT_STATUS_FLAG_R5_WFE 0x00000001
631#define PROC_BOOT_STATUS_FLAG_R5_WFI 0x00000002
632#define PROC_BOOT_STATUS_FLAG_R5_CLK_GATED 0x00000004
633#define PROC_BOOT_STATUS_FLAG_R5_LOCKSTEP_PERMITTED 0x00000100
634
635/**
636 * \brief Processor Status Response
637 * struct ti_sci_msg_resp_get_proc_boot_status - Processor boot status response
638 * @hdr: Generic Header
639 * @processor_id: ID of processor
640 * @bootvector_low: Lower 32bit (Little Endian) of boot vector
641 * @bootvector_high: Higher 32bit (Little Endian) of boot vector
642 * @config_flags: Optional Processor specific Config Flags set.
643 * @control_flags: Optional Processor specific Control Flags.
644 * @status_flags: Optional Processor specific Status Flags set.
645 *
646 * Response to TISCI_MSG_GET_PROC_BOOT_STATUS.
647 */
648struct ti_sci_msg_resp_get_proc_boot_status {
649 struct ti_sci_msg_hdr hdr;
650 uint8_t processor_id;
651 uint32_t bootvector_low;
652 uint32_t bootvector_high;
653 uint32_t config_flags;
654 uint32_t control_flags;
655 uint32_t status_flags;
656} __packed;
657
Andrew F. Davisb62cc1e2018-12-18 13:21:12 -0600658/**
659 * struct ti_sci_msg_req_wait_proc_boot_status - Wait for a processor boot status
660 * @hdr: Generic Header
661 * @processor_id: ID of processor
662 * @num_wait_iterations Total number of iterations we will check before
663 * we will timeout and give up
664 * @num_match_iterations How many iterations should we have continued
665 * status to account for status bits glitching.
666 * This is to make sure that match occurs for
667 * consecutive checks. This implies that the
668 * worst case should consider that the stable
669 * time should at the worst be num_wait_iterations
670 * num_match_iterations to prevent timeout.
671 * @delay_per_iteration_us Specifies how long to wait (in micro seconds)
672 * between each status checks. This is the minimum
673 * duration, and overhead of register reads and
674 * checks are on top of this and can vary based on
675 * varied conditions.
676 * @delay_before_iterations_us Specifies how long to wait (in micro seconds)
677 * before the very first check in the first
678 * iteration of status check loop. This is the
679 * minimum duration, and overhead of register
680 * reads and checks are.
681 * @status_flags_1_set_all_wait If non-zero, Specifies that all bits of the
682 * status matching this field requested MUST be 1.
683 * @status_flags_1_set_any_wait If non-zero, Specifies that at least one of the
684 * bits matching this field requested MUST be 1.
685 * @status_flags_1_clr_all_wait If non-zero, Specifies that all bits of the
686 * status matching this field requested MUST be 0.
687 * @status_flags_1_clr_any_wait If non-zero, Specifies that at least one of the
688 * bits matching this field requested MUST be 0.
689 *
690 * Request type is TISCI_MSG_WAIT_PROC_BOOT_STATUS, response is appropriate
691 * message, or NACK in case of inability to satisfy request.
692 */
693struct ti_sci_msg_req_wait_proc_boot_status {
694 struct ti_sci_msg_hdr hdr;
695 uint8_t processor_id;
696 uint8_t num_wait_iterations;
697 uint8_t num_match_iterations;
698 uint8_t delay_per_iteration_us;
699 uint8_t delay_before_iterations_us;
700 uint32_t status_flags_1_set_all_wait;
701 uint32_t status_flags_1_set_any_wait;
702 uint32_t status_flags_1_clr_all_wait;
703 uint32_t status_flags_1_clr_any_wait;
704} __packed;
705
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +0000706#endif /* TI_SCI_PROTOCOL_H */