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