1b601ff01bbe4ad200517ab58b2f14f26bfbf73a
[oweals/u-boot.git] / drivers / firmware / ti_sci.h
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3  * Texas Instruments System Control Interface (TISCI) Protocol
4  *
5  * Communication protocol with TI SCI hardware
6  * The system works in a message response protocol
7  * See: http://processors.wiki.ti.com/index.php/TISCI for details
8  *
9  * Copyright (C)  2018 Texas Instruments Incorporated - http://www.ti.com/
10  * Based on drivers/firmware/ti_sci.h from Linux.
11  *
12  */
13
14 #ifndef __TI_SCI_H
15 #define __TI_SCI_H
16
17 /* Generic Messages */
18 #define TI_SCI_MSG_ENABLE_WDT           0x0000
19 #define TI_SCI_MSG_WAKE_RESET           0x0001
20 #define TI_SCI_MSG_VERSION              0x0002
21 #define TI_SCI_MSG_WAKE_REASON          0x0003
22 #define TI_SCI_MSG_GOODBYE              0x0004
23 #define TI_SCI_MSG_SYS_RESET            0x0005
24 #define TI_SCI_MSG_BOARD_CONFIG         0x000b
25 #define TI_SCI_MSG_BOARD_CONFIG_RM      0x000c
26 #define TI_SCI_MSG_BOARD_CONFIG_SECURITY  0x000d
27 #define TI_SCI_MSG_BOARD_CONFIG_PM      0x000e
28 #define TISCI_MSG_QUERY_MSMC            0x0020
29
30 /* Device requests */
31 #define TI_SCI_MSG_SET_DEVICE_STATE     0x0200
32 #define TI_SCI_MSG_GET_DEVICE_STATE     0x0201
33 #define TI_SCI_MSG_SET_DEVICE_RESETS    0x0202
34
35 /* Clock requests */
36 #define TI_SCI_MSG_SET_CLOCK_STATE      0x0100
37 #define TI_SCI_MSG_GET_CLOCK_STATE      0x0101
38 #define TI_SCI_MSG_SET_CLOCK_PARENT     0x0102
39 #define TI_SCI_MSG_GET_CLOCK_PARENT     0x0103
40 #define TI_SCI_MSG_GET_NUM_CLOCK_PARENTS 0x0104
41 #define TI_SCI_MSG_SET_CLOCK_FREQ       0x010c
42 #define TI_SCI_MSG_QUERY_CLOCK_FREQ     0x010d
43 #define TI_SCI_MSG_GET_CLOCK_FREQ       0x010e
44
45 /* Processor Control Messages */
46 #define TISCI_MSG_PROC_REQUEST          0xc000
47 #define TISCI_MSG_PROC_RELEASE          0xc001
48 #define TISCI_MSG_PROC_HANDOVER         0xc005
49 #define TISCI_MSG_SET_PROC_BOOT_CONFIG  0xc100
50 #define TISCI_MSG_SET_PROC_BOOT_CTRL    0xc101
51 #define TISCI_MSG_PROC_AUTH_BOOT_IMIAGE 0xc120
52 #define TISCI_MSG_GET_PROC_BOOT_STATUS  0xc400
53
54 /* Resource Management Requests */
55 #define TI_SCI_MSG_GET_RESOURCE_RANGE   0x1500
56
57 /* NAVSS resource management */
58 /* Ringacc requests */
59 #define TI_SCI_MSG_RM_RING_CFG                  0x1110
60 #define TI_SCI_MSG_RM_RING_GET_CFG              0x1111
61
62 /* PSI-L requests */
63 #define TI_SCI_MSG_RM_PSIL_PAIR                 0x1280
64 #define TI_SCI_MSG_RM_PSIL_UNPAIR               0x1281
65
66 #define TI_SCI_MSG_RM_UDMAP_TX_ALLOC            0x1200
67 #define TI_SCI_MSG_RM_UDMAP_TX_FREE             0x1201
68 #define TI_SCI_MSG_RM_UDMAP_RX_ALLOC            0x1210
69 #define TI_SCI_MSG_RM_UDMAP_RX_FREE             0x1211
70 #define TI_SCI_MSG_RM_UDMAP_FLOW_CFG            0x1220
71 #define TI_SCI_MSG_RM_UDMAP_OPT_FLOW_CFG        0x1221
72
73 #define TISCI_MSG_RM_UDMAP_TX_CH_CFG            0x1205
74 #define TISCI_MSG_RM_UDMAP_TX_CH_GET_CFG        0x1206
75 #define TISCI_MSG_RM_UDMAP_RX_CH_CFG            0x1215
76 #define TISCI_MSG_RM_UDMAP_RX_CH_GET_CFG        0x1216
77 #define TISCI_MSG_RM_UDMAP_FLOW_CFG             0x1230
78 #define TISCI_MSG_RM_UDMAP_FLOW_SIZE_THRESH_CFG 0x1231
79 #define TISCI_MSG_RM_UDMAP_FLOW_GET_CFG         0x1232
80 #define TISCI_MSG_RM_UDMAP_FLOW_SIZE_THRESH_GET_CFG     0x1233
81
82 #define TISCI_MSG_FWL_SET               0x9000
83 #define TISCI_MSG_FWL_GET               0x9001
84 #define TISCI_MSG_FWL_CHANGE_OWNER      0x9002
85
86 /**
87  * struct ti_sci_msg_hdr - Generic Message Header for All messages and responses
88  * @type:       Type of messages: One of TI_SCI_MSG* values
89  * @host:       Host of the message
90  * @seq:        Message identifier indicating a transfer sequence
91  * @flags:      Flag for the message
92  */
93 struct ti_sci_msg_hdr {
94         u16 type;
95         u8 host;
96         u8 seq;
97 #define TI_SCI_MSG_FLAG(val)                    (1 << (val))
98 #define TI_SCI_FLAG_REQ_GENERIC_NORESPONSE      0x0
99 #define TI_SCI_FLAG_REQ_ACK_ON_RECEIVED         TI_SCI_MSG_FLAG(0)
100 #define TI_SCI_FLAG_REQ_ACK_ON_PROCESSED        TI_SCI_MSG_FLAG(1)
101 #define TI_SCI_FLAG_RESP_GENERIC_NACK           0x0
102 #define TI_SCI_FLAG_RESP_GENERIC_ACK            TI_SCI_MSG_FLAG(1)
103         /* Additional Flags */
104         u32 flags;
105 } __packed;
106
107 /**
108  * struct ti_sci_secure_msg_hdr - Header that prefixes all TISCI messages sent
109  *                                via secure transport.
110  * @checksum:   crc16 checksum for the entire message
111  * @reserved:   Reserved for future use.
112  */
113 struct ti_sci_secure_msg_hdr {
114         u16 checksum;
115         u16 reserved;
116 } __packed;
117
118 /**
119  * struct ti_sci_msg_resp_version - Response for a message
120  * @hdr:                Generic header
121  * @firmware_description: String describing the firmware
122  * @firmware_revision:  Firmware revision
123  * @abi_major:          Major version of the ABI that firmware supports
124  * @abi_minor:          Minor version of the ABI that firmware supports
125  *
126  * In general, ABI version changes follow the rule that minor version increments
127  * are backward compatible. Major revision changes in ABI may not be
128  * backward compatible.
129  *
130  * Response to a generic message with message type TI_SCI_MSG_VERSION
131  */
132 struct ti_sci_msg_resp_version {
133         struct ti_sci_msg_hdr hdr;
134         char firmware_description[32];
135         u16 firmware_revision;
136         u8 abi_major;
137         u8 abi_minor;
138 } __packed;
139
140 /**
141  * struct ti_sci_msg_req_reboot - Reboot the SoC
142  * @hdr:        Generic Header
143  *
144  * Request type is TI_SCI_MSG_SYS_RESET, responded with a generic
145  * ACK/NACK message.
146  */
147 struct ti_sci_msg_req_reboot {
148         struct ti_sci_msg_hdr hdr;
149 } __packed;
150
151 /**
152  * struct ti_sci_msg_board_config - Board configuration message
153  * @hdr:                Generic Header
154  * @boardcfgp_low:      Lower 32 bit of the pointer pointing to the board
155  *                      configuration data
156  * @boardcfgp_high:     Upper 32 bit of the pointer pointing to the board
157  *                      configuration data
158  * @boardcfg_size:      Size of board configuration data object
159  * Request type is TI_SCI_MSG_BOARD_CONFIG, responded with a generic
160  * ACK/NACK message.
161  */
162 struct ti_sci_msg_board_config {
163         struct ti_sci_msg_hdr hdr;
164         u32 boardcfgp_low;
165         u32 boardcfgp_high;
166         u16 boardcfg_size;
167 } __packed;
168
169 /**
170  * struct ti_sci_msg_resp_query_msmc - Query msmc message response structure
171  * @hdr:                Generic Header
172  * @msmc_start_low:     Lower 32 bit of msmc start
173  * @msmc_start_high:    Upper 32 bit of msmc start
174  * @msmc_end_low:       Lower 32 bit of msmc end
175  * @msmc_end_high:      Upper 32 bit of msmc end
176  *
177  * Response to a generic message with message type TISCI_MSG_QUERY_MSMC
178  */
179 struct ti_sci_msg_resp_query_msmc {
180         struct ti_sci_msg_hdr hdr;
181         u32 msmc_start_low;
182         u32 msmc_start_high;
183         u32 msmc_end_low;
184         u32 msmc_end_high;
185 } __packed;
186
187 /**
188  * struct ti_sci_msg_req_set_device_state - Set the desired state of the device
189  * @hdr:                Generic header
190  * @id: Indicates which device to modify
191  * @reserved: Reserved space in message, must be 0 for backward compatibility
192  * @state: The desired state of the device.
193  *
194  * Certain flags can also be set to alter the device state:
195  * + MSG_FLAG_DEVICE_WAKE_ENABLED - Configure the device to be a wake source.
196  * The meaning of this flag will vary slightly from device to device and from
197  * SoC to SoC but it generally allows the device to wake the SoC out of deep
198  * suspend states.
199  * + MSG_FLAG_DEVICE_RESET_ISO - Enable reset isolation for this device.
200  * + MSG_FLAG_DEVICE_EXCLUSIVE - Claim this device exclusively. When passed
201  * with STATE_RETENTION or STATE_ON, it will claim the device exclusively.
202  * If another host already has this device set to STATE_RETENTION or STATE_ON,
203  * the message will fail. Once successful, other hosts attempting to set
204  * STATE_RETENTION or STATE_ON will fail.
205  *
206  * Request type is TI_SCI_MSG_SET_DEVICE_STATE, responded with a generic
207  * ACK/NACK message.
208  */
209 struct ti_sci_msg_req_set_device_state {
210         /* Additional hdr->flags options */
211 #define MSG_FLAG_DEVICE_WAKE_ENABLED    TI_SCI_MSG_FLAG(8)
212 #define MSG_FLAG_DEVICE_RESET_ISO       TI_SCI_MSG_FLAG(9)
213 #define MSG_FLAG_DEVICE_EXCLUSIVE       TI_SCI_MSG_FLAG(10)
214         struct ti_sci_msg_hdr hdr;
215         u32 id;
216         u32 reserved;
217
218 #define MSG_DEVICE_SW_STATE_AUTO_OFF    0
219 #define MSG_DEVICE_SW_STATE_RETENTION   1
220 #define MSG_DEVICE_SW_STATE_ON          2
221         u8 state;
222 } __packed;
223
224 /**
225  * struct ti_sci_msg_req_get_device_state - Request to get device.
226  * @hdr:                Generic header
227  * @id:         Device Identifier
228  *
229  * Request type is TI_SCI_MSG_GET_DEVICE_STATE, responded device state
230  * information
231  */
232 struct ti_sci_msg_req_get_device_state {
233         struct ti_sci_msg_hdr hdr;
234         u32 id;
235 } __packed;
236
237 /**
238  * struct ti_sci_msg_resp_get_device_state - Response to get device request.
239  * @hdr:                Generic header
240  * @context_loss_count: Indicates how many times the device has lost context. A
241  *      driver can use this monotonic counter to determine if the device has
242  *      lost context since the last time this message was exchanged.
243  * @resets: Programmed state of the reset lines.
244  * @programmed_state:   The state as programmed by set_device.
245  *                      - Uses the MSG_DEVICE_SW_* macros
246  * @current_state:      The actual state of the hardware.
247  *
248  * Response to request TI_SCI_MSG_GET_DEVICE_STATE.
249  */
250 struct ti_sci_msg_resp_get_device_state {
251         struct ti_sci_msg_hdr hdr;
252         u32 context_loss_count;
253         u32 resets;
254         u8 programmed_state;
255 #define MSG_DEVICE_HW_STATE_OFF         0
256 #define MSG_DEVICE_HW_STATE_ON          1
257 #define MSG_DEVICE_HW_STATE_TRANS       2
258         u8 current_state;
259 } __packed;
260
261 /**
262  * struct ti_sci_msg_req_set_device_resets - Set the desired resets
263  *                              configuration of the device
264  * @hdr:                Generic header
265  * @id: Indicates which device to modify
266  * @resets: A bit field of resets for the device. The meaning, behavior,
267  *      and usage of the reset flags are device specific. 0 for a bit
268  *      indicates releasing the reset represented by that bit while 1
269  *      indicates keeping it held.
270  *
271  * Request type is TI_SCI_MSG_SET_DEVICE_RESETS, responded with a generic
272  * ACK/NACK message.
273  */
274 struct ti_sci_msg_req_set_device_resets {
275         struct ti_sci_msg_hdr hdr;
276         u32 id;
277         u32 resets;
278 } __packed;
279
280 /**
281  * struct ti_sci_msg_req_set_clock_state - Request to setup a Clock state
282  * @hdr:        Generic Header, Certain flags can be set specific to the clocks:
283  *              MSG_FLAG_CLOCK_ALLOW_SSC: Allow this clock to be modified
284  *              via spread spectrum clocking.
285  *              MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE: Allow this clock's
286  *              frequency to be changed while it is running so long as it
287  *              is within the min/max limits.
288  *              MSG_FLAG_CLOCK_INPUT_TERM: Enable input termination, this
289  *              is only applicable to clock inputs on the SoC pseudo-device.
290  * @dev_id:     Device identifier this request is for
291  * @clk_id:     Clock identifier for the device for this request.
292  *              Each device has it's own set of clock inputs. This indexes
293  *              which clock input to modify.
294  * @request_state: Request the state for the clock to be set to.
295  *              MSG_CLOCK_SW_STATE_UNREQ: The IP does not require this clock,
296  *              it can be disabled, regardless of the state of the device
297  *              MSG_CLOCK_SW_STATE_AUTO: Allow the System Controller to
298  *              automatically manage the state of this clock. If the device
299  *              is enabled, then the clock is enabled. If the device is set
300  *              to off or retention, then the clock is internally set as not
301  *              being required by the device.(default)
302  *              MSG_CLOCK_SW_STATE_REQ:  Configure the clock to be enabled,
303  *              regardless of the state of the device.
304  *
305  * Normally, all required clocks are managed by TISCI entity, this is used
306  * only for specific control *IF* required. Auto managed state is
307  * MSG_CLOCK_SW_STATE_AUTO, in other states, TISCI entity assume remote
308  * will explicitly control.
309  *
310  * Request type is TI_SCI_MSG_SET_CLOCK_STATE, response is a generic
311  * ACK or NACK message.
312  */
313 struct ti_sci_msg_req_set_clock_state {
314         /* Additional hdr->flags options */
315 #define MSG_FLAG_CLOCK_ALLOW_SSC                TI_SCI_MSG_FLAG(8)
316 #define MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE        TI_SCI_MSG_FLAG(9)
317 #define MSG_FLAG_CLOCK_INPUT_TERM               TI_SCI_MSG_FLAG(10)
318         struct ti_sci_msg_hdr hdr;
319         u32 dev_id;
320         u8 clk_id;
321 #define MSG_CLOCK_SW_STATE_UNREQ        0
322 #define MSG_CLOCK_SW_STATE_AUTO         1
323 #define MSG_CLOCK_SW_STATE_REQ          2
324         u8 request_state;
325 } __packed;
326
327 /**
328  * struct ti_sci_msg_req_get_clock_state - Request for clock state
329  * @hdr:        Generic Header
330  * @dev_id:     Device identifier this request is for
331  * @clk_id:     Clock identifier for the device for this request.
332  *              Each device has it's own set of clock inputs. This indexes
333  *              which clock input to get state of.
334  *
335  * Request type is TI_SCI_MSG_GET_CLOCK_STATE, response is state
336  * of the clock
337  */
338 struct ti_sci_msg_req_get_clock_state {
339         struct ti_sci_msg_hdr hdr;
340         u32 dev_id;
341         u8 clk_id;
342 } __packed;
343
344 /**
345  * struct ti_sci_msg_resp_get_clock_state - Response to get clock state
346  * @hdr:        Generic Header
347  * @programmed_state: Any programmed state of the clock. This is one of
348  *              MSG_CLOCK_SW_STATE* values.
349  * @current_state: Current state of the clock. This is one of:
350  *              MSG_CLOCK_HW_STATE_NOT_READY: Clock is not ready
351  *              MSG_CLOCK_HW_STATE_READY: Clock is ready
352  *
353  * Response to TI_SCI_MSG_GET_CLOCK_STATE.
354  */
355 struct ti_sci_msg_resp_get_clock_state {
356         struct ti_sci_msg_hdr hdr;
357         u8 programmed_state;
358 #define MSG_CLOCK_HW_STATE_NOT_READY    0
359 #define MSG_CLOCK_HW_STATE_READY        1
360         u8 current_state;
361 } __packed;
362
363 /**
364  * struct ti_sci_msg_req_set_clock_parent - Set the clock parent
365  * @hdr:        Generic Header
366  * @dev_id:     Device identifier this request is for
367  * @clk_id:     Clock identifier for the device for this request.
368  *              Each device has it's own set of clock inputs. This indexes
369  *              which clock input to modify.
370  * @parent_id:  The new clock parent is selectable by an index via this
371  *              parameter.
372  *
373  * Request type is TI_SCI_MSG_SET_CLOCK_PARENT, response is generic
374  * ACK / NACK message.
375  */
376 struct ti_sci_msg_req_set_clock_parent {
377         struct ti_sci_msg_hdr hdr;
378         u32 dev_id;
379         u8 clk_id;
380         u8 parent_id;
381 } __packed;
382
383 /**
384  * struct ti_sci_msg_req_get_clock_parent - Get the clock parent
385  * @hdr:        Generic Header
386  * @dev_id:     Device identifier this request is for
387  * @clk_id:     Clock identifier for the device for this request.
388  *              Each device has it's own set of clock inputs. This indexes
389  *              which clock input to get the parent for.
390  *
391  * Request type is TI_SCI_MSG_GET_CLOCK_PARENT, response is parent information
392  */
393 struct ti_sci_msg_req_get_clock_parent {
394         struct ti_sci_msg_hdr hdr;
395         u32 dev_id;
396         u8 clk_id;
397 } __packed;
398
399 /**
400  * struct ti_sci_msg_resp_get_clock_parent - Response with clock parent
401  * @hdr:        Generic Header
402  * @parent_id:  The current clock parent
403  *
404  * Response to TI_SCI_MSG_GET_CLOCK_PARENT.
405  */
406 struct ti_sci_msg_resp_get_clock_parent {
407         struct ti_sci_msg_hdr hdr;
408         u8 parent_id;
409 } __packed;
410
411 /**
412  * struct ti_sci_msg_req_get_clock_num_parents - Request to get clock parents
413  * @hdr:        Generic header
414  * @dev_id:     Device identifier this request is for
415  * @clk_id:     Clock identifier for the device for this request.
416  *
417  * This request provides information about how many clock parent options
418  * are available for a given clock to a device. This is typically used
419  * for input clocks.
420  *
421  * Request type is TI_SCI_MSG_GET_NUM_CLOCK_PARENTS, response is appropriate
422  * message, or NACK in case of inability to satisfy request.
423  */
424 struct ti_sci_msg_req_get_clock_num_parents {
425         struct ti_sci_msg_hdr hdr;
426         u32 dev_id;
427         u8 clk_id;
428 } __packed;
429
430 /**
431  * struct ti_sci_msg_resp_get_clock_num_parents - Response for get clk parents
432  * @hdr:                Generic header
433  * @num_parents:        Number of clock parents
434  *
435  * Response to TI_SCI_MSG_GET_NUM_CLOCK_PARENTS
436  */
437 struct ti_sci_msg_resp_get_clock_num_parents {
438         struct ti_sci_msg_hdr hdr;
439         u8 num_parents;
440 } __packed;
441
442 /**
443  * struct ti_sci_msg_req_query_clock_freq - Request to query a frequency
444  * @hdr:        Generic Header
445  * @dev_id:     Device identifier this request is for
446  * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum
447  *              allowable programmed frequency and does not account for clock
448  *              tolerances and jitter.
449  * @target_freq_hz: The target clock frequency. A frequency will be found
450  *              as close to this target frequency as possible.
451  * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum
452  *              allowable programmed frequency and does not account for clock
453  *              tolerances and jitter.
454  * @clk_id:     Clock identifier for the device for this request.
455  *
456  * NOTE: Normally clock frequency management is automatically done by TISCI
457  * entity. In case of specific requests, TISCI evaluates capability to achieve
458  * requested frequency within provided range and responds with
459  * result message.
460  *
461  * Request type is TI_SCI_MSG_QUERY_CLOCK_FREQ, response is appropriate message,
462  * or NACK in case of inability to satisfy request.
463  */
464 struct ti_sci_msg_req_query_clock_freq {
465         struct ti_sci_msg_hdr hdr;
466         u32 dev_id;
467         u64 min_freq_hz;
468         u64 target_freq_hz;
469         u64 max_freq_hz;
470         u8 clk_id;
471 } __packed;
472
473 /**
474  * struct ti_sci_msg_resp_query_clock_freq - Response to a clock frequency query
475  * @hdr:        Generic Header
476  * @freq_hz:    Frequency that is the best match in Hz.
477  *
478  * Response to request type TI_SCI_MSG_QUERY_CLOCK_FREQ. NOTE: if the request
479  * cannot be satisfied, the message will be of type NACK.
480  */
481 struct ti_sci_msg_resp_query_clock_freq {
482         struct ti_sci_msg_hdr hdr;
483         u64 freq_hz;
484 } __packed;
485
486 /**
487  * struct ti_sci_msg_req_set_clock_freq - Request to setup a clock frequency
488  * @hdr:        Generic Header
489  * @dev_id:     Device identifier this request is for
490  * @min_freq_hz: The minimum allowable frequency in Hz. This is the minimum
491  *              allowable programmed frequency and does not account for clock
492  *              tolerances and jitter.
493  * @target_freq_hz: The target clock frequency. The clock will be programmed
494  *              at a rate as close to this target frequency as possible.
495  * @max_freq_hz: The maximum allowable frequency in Hz. This is the maximum
496  *              allowable programmed frequency and does not account for clock
497  *              tolerances and jitter.
498  * @clk_id:     Clock identifier for the device for this request.
499  *
500  * NOTE: Normally clock frequency management is automatically done by TISCI
501  * entity. In case of specific requests, TISCI evaluates capability to achieve
502  * requested range and responds with success/failure message.
503  *
504  * This sets the desired frequency for a clock within an allowable
505  * range. This message will fail on an enabled clock unless
506  * MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE is set for the clock. Additionally,
507  * if other clocks have their frequency modified due to this message,
508  * they also must have the MSG_FLAG_CLOCK_ALLOW_FREQ_CHANGE or be disabled.
509  *
510  * Calling set frequency on a clock input to the SoC pseudo-device will
511  * inform the PMMC of that clock's frequency. Setting a frequency of
512  * zero will indicate the clock is disabled.
513  *
514  * Calling set frequency on clock outputs from the SoC pseudo-device will
515  * function similarly to setting the clock frequency on a device.
516  *
517  * Request type is TI_SCI_MSG_SET_CLOCK_FREQ, response is a generic ACK/NACK
518  * message.
519  */
520 struct ti_sci_msg_req_set_clock_freq {
521         struct ti_sci_msg_hdr hdr;
522         u32 dev_id;
523         u64 min_freq_hz;
524         u64 target_freq_hz;
525         u64 max_freq_hz;
526         u8 clk_id;
527 } __packed;
528
529 /**
530  * struct ti_sci_msg_req_get_clock_freq - Request to get the clock frequency
531  * @hdr:        Generic Header
532  * @dev_id:     Device identifier this request is for
533  * @clk_id:     Clock identifier for the device for this request.
534  *
535  * NOTE: Normally clock frequency management is automatically done by TISCI
536  * entity. In some cases, clock frequencies are configured by host.
537  *
538  * Request type is TI_SCI_MSG_GET_CLOCK_FREQ, responded with clock frequency
539  * that the clock is currently at.
540  */
541 struct ti_sci_msg_req_get_clock_freq {
542         struct ti_sci_msg_hdr hdr;
543         u32 dev_id;
544         u8 clk_id;
545 } __packed;
546
547 /**
548  * struct ti_sci_msg_resp_get_clock_freq - Response of clock frequency request
549  * @hdr:        Generic Header
550  * @freq_hz:    Frequency that the clock is currently on, in Hz.
551  *
552  * Response to request type TI_SCI_MSG_GET_CLOCK_FREQ.
553  */
554 struct ti_sci_msg_resp_get_clock_freq {
555         struct ti_sci_msg_hdr hdr;
556         u64 freq_hz;
557 } __packed;
558
559 #define TI_SCI_IRQ_SECONDARY_HOST_INVALID       0xff
560
561 /**
562  * struct ti_sci_msg_req_get_resource_range - Request to get a host's assigned
563  *                                            range of resources.
564  * @hdr:                Generic Header
565  * @type:               Unique resource assignment type
566  * @subtype:            Resource assignment subtype within the resource type.
567  * @secondary_host:     Host processing entity to which the resources are
568  *                      allocated. This is required only when the destination
569  *                      host id id different from ti sci interface host id,
570  *                      else TI_SCI_IRQ_SECONDARY_HOST_INVALID can be passed.
571  *
572  * Request type is TI_SCI_MSG_GET_RESOURCE_RANGE. Responded with requested
573  * resource range which is of type TI_SCI_MSG_GET_RESOURCE_RANGE.
574  */
575 struct ti_sci_msg_req_get_resource_range {
576         struct ti_sci_msg_hdr hdr;
577 #define MSG_RM_RESOURCE_TYPE_MASK       GENMASK(9, 0)
578 #define MSG_RM_RESOURCE_SUBTYPE_MASK    GENMASK(5, 0)
579         u16 type;
580         u8 subtype;
581         u8 secondary_host;
582 } __packed;
583
584 /**
585  * struct ti_sci_msg_resp_get_resource_range - Response to resource get range.
586  * @hdr:                Generic Header
587  * @range_start:        Start index of the resource range.
588  * @range_num:          Number of resources in the range.
589  *
590  * Response to request TI_SCI_MSG_GET_RESOURCE_RANGE.
591  */
592 struct ti_sci_msg_resp_get_resource_range {
593         struct ti_sci_msg_hdr hdr;
594         u16 range_start;
595         u16 range_num;
596 } __packed;
597
598 #define TISCI_ADDR_LOW_MASK             GENMASK_ULL(31, 0)
599 #define TISCI_ADDR_HIGH_MASK            GENMASK_ULL(63, 32)
600 #define TISCI_ADDR_HIGH_SHIFT           32
601
602 /**
603  * struct ti_sci_msg_req_proc_request - Request a processor
604  *
605  * @hdr:                Generic Header
606  * @processor_id:       ID of processor
607  *
608  * Request type is TISCI_MSG_PROC_REQUEST, response is a generic ACK/NACK
609  * message.
610  */
611 struct ti_sci_msg_req_proc_request {
612         struct ti_sci_msg_hdr hdr;
613         u8 processor_id;
614 } __packed;
615
616 /**
617  * struct ti_sci_msg_req_proc_release - Release a processor
618  *
619  * @hdr:                Generic Header
620  * @processor_id:       ID of processor
621  *
622  * Request type is TISCI_MSG_PROC_RELEASE, response is a generic ACK/NACK
623  * message.
624  */
625 struct ti_sci_msg_req_proc_release {
626         struct ti_sci_msg_hdr hdr;
627         u8 processor_id;
628 } __packed;
629
630 /**
631  * struct ti_sci_msg_req_proc_handover - Handover a processor to a host
632  *
633  * @hdr:                Generic Header
634  * @processor_id:       ID of processor
635  * @host_id:            New Host we want to give control to
636  *
637  * Request type is TISCI_MSG_PROC_HANDOVER, response is a generic ACK/NACK
638  * message.
639  */
640 struct ti_sci_msg_req_proc_handover {
641         struct ti_sci_msg_hdr hdr;
642         u8 processor_id;
643         u8 host_id;
644 } __packed;
645
646 /* A53 Config Flags */
647 #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_EN         0x00000001
648 #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_NIDEN      0x00000002
649 #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_SPIDEN     0x00000004
650 #define PROC_BOOT_CFG_FLAG_ARMV8_DBG_SPNIDEN    0x00000008
651 #define PROC_BOOT_CFG_FLAG_ARMV8_AARCH32        0x00000100
652
653 /* R5 Config Flags */
654 #define PROC_BOOT_CFG_FLAG_R5_DBG_EN            0x00000001
655 #define PROC_BOOT_CFG_FLAG_R5_DBG_NIDEN         0x00000002
656 #define PROC_BOOT_CFG_FLAG_R5_LOCKSTEP          0x00000100
657 #define PROC_BOOT_CFG_FLAG_R5_TEINIT            0x00000200
658 #define PROC_BOOT_CFG_FLAG_R5_NMFI_EN           0x00000400
659 #define PROC_BOOT_CFG_FLAG_R5_TCM_RSTBASE       0x00000800
660 #define PROC_BOOT_CFG_FLAG_R5_BTCM_EN           0x00001000
661 #define PROC_BOOT_CFG_FLAG_R5_ATCM_EN           0x00002000
662
663 /**
664  * struct ti_sci_msg_req_set_proc_boot_config - Set Processor boot configuration
665  * @hdr:                Generic Header
666  * @processor_id:       ID of processor
667  * @bootvector_low:     Lower 32bit (Little Endian) of boot vector
668  * @bootvector_high:    Higher 32bit (Little Endian) of boot vector
669  * @config_flags_set:   Optional Processor specific Config Flags to set.
670  *                      Setting a bit here implies required bit sets to 1.
671  * @config_flags_clear: Optional Processor specific Config Flags to clear.
672  *                      Setting a bit here implies required bit gets cleared.
673  *
674  * Request type is TISCI_MSG_SET_PROC_BOOT_CONFIG, response is a generic
675  * ACK/NACK message.
676  */
677 struct ti_sci_msg_req_set_proc_boot_config {
678         struct ti_sci_msg_hdr hdr;
679         u8 processor_id;
680         u32 bootvector_low;
681         u32 bootvector_high;
682         u32 config_flags_set;
683         u32 config_flags_clear;
684 } __packed;
685
686 /* R5 Control Flags */
687 #define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT                0x00000001
688
689 /**
690  * struct ti_sci_msg_req_set_proc_boot_ctrl - Set Processor boot control flags
691  * @hdr:                Generic Header
692  * @processor_id:       ID of processor
693  * @control_flags_set:  Optional Processor specific Control Flags to set.
694  *                      Setting a bit here implies required bit sets to 1.
695  * @control_flags_clear:Optional Processor specific Control Flags to clear.
696  *                      Setting a bit here implies required bit gets cleared.
697  *
698  * Request type is TISCI_MSG_SET_PROC_BOOT_CTRL, response is a generic ACK/NACK
699  * message.
700  */
701 struct ti_sci_msg_req_set_proc_boot_ctrl {
702         struct ti_sci_msg_hdr hdr;
703         u8 processor_id;
704         u32 control_flags_set;
705         u32 control_flags_clear;
706 } __packed;
707
708 /**
709  * struct ti_sci_msg_req_proc_auth_start_image - Authenticate and start image
710  * @hdr:                Generic Header
711  * @processor_id:       ID of processor
712  * @cert_addr_low:      Lower 32bit (Little Endian) of certificate
713  * @cert_addr_high:     Higher 32bit (Little Endian) of certificate
714  *
715  * Request type is TISCI_MSG_PROC_AUTH_BOOT_IMAGE, response is a generic
716  * ACK/NACK message.
717  */
718 struct ti_sci_msg_req_proc_auth_boot_image {
719         struct ti_sci_msg_hdr hdr;
720         u8 processor_id;
721         u32 cert_addr_low;
722         u32 cert_addr_high;
723 } __packed;
724
725 /**
726  * struct ti_sci_msg_req_get_proc_boot_status - Get processor boot status
727  * @hdr:                Generic Header
728  * @processor_id:       ID of processor
729  *
730  * Request type is TISCI_MSG_GET_PROC_BOOT_STATUS, response is appropriate
731  * message, or NACK in case of inability to satisfy request.
732  */
733 struct ti_sci_msg_req_get_proc_boot_status {
734         struct ti_sci_msg_hdr hdr;
735         u8 processor_id;
736 } __packed;
737
738 /* ARMv8 Status Flags */
739 #define PROC_BOOT_STATUS_FLAG_ARMV8_WFE                 0x00000001
740 #define PROC_BOOT_STATUS_FLAG_ARMV8_WFI                 0x00000002
741
742 /* R5 Status Flags */
743 #define PROC_BOOT_STATUS_FLAG_R5_WFE                    0x00000001
744 #define PROC_BOOT_STATUS_FLAG_R5_WFI                    0x00000002
745 #define PROC_BOOT_STATUS_FLAG_R5_CLK_GATED              0x00000004
746 #define PROC_BOOT_STATUS_FLAG_R5_LOCKSTEP_PERMITTED     0x00000100
747
748 /**
749  * struct ti_sci_msg_resp_get_proc_boot_status - Processor boot status response
750  * @hdr:                Generic Header
751  * @processor_id:       ID of processor
752  * @bootvector_low:     Lower 32bit (Little Endian) of boot vector
753  * @bootvector_high:    Higher 32bit (Little Endian) of boot vector
754  * @config_flags:       Optional Processor specific Config Flags set.
755  * @control_flags:      Optional Processor specific Control Flags.
756  * @status_flags:       Optional Processor specific Status Flags set.
757  *
758  * Response to TISCI_MSG_GET_PROC_BOOT_STATUS.
759  */
760 struct ti_sci_msg_resp_get_proc_boot_status {
761         struct ti_sci_msg_hdr hdr;
762         u8 processor_id;
763         u32 bootvector_low;
764         u32 bootvector_high;
765         u32 config_flags;
766         u32 control_flags;
767         u32 status_flags;
768 } __packed;
769
770 /**
771  * struct ti_sci_msg_rm_ring_cfg_req - Configure a Navigator Subsystem ring
772  *
773  * Configures the non-real-time registers of a Navigator Subsystem ring.
774  * @hdr:        Generic Header
775  * @valid_params: Bitfield defining validity of ring configuration parameters.
776  *      The ring configuration fields are not valid, and will not be used for
777  *      ring configuration, if their corresponding valid bit is zero.
778  *      Valid bit usage:
779  *      0 - Valid bit for @tisci_msg_rm_ring_cfg_req addr_lo
780  *      1 - Valid bit for @tisci_msg_rm_ring_cfg_req addr_hi
781  *      2 - Valid bit for @tisci_msg_rm_ring_cfg_req count
782  *      3 - Valid bit for @tisci_msg_rm_ring_cfg_req mode
783  *      4 - Valid bit for @tisci_msg_rm_ring_cfg_req size
784  *      5 - Valid bit for @tisci_msg_rm_ring_cfg_req order_id
785  * @nav_id: Device ID of Navigator Subsystem from which the ring is allocated
786  * @index: ring index to be configured.
787  * @addr_lo: 32 LSBs of ring base address to be programmed into the ring's
788  *      RING_BA_LO register
789  * @addr_hi: 16 MSBs of ring base address to be programmed into the ring's
790  *      RING_BA_HI register.
791  * @count: Number of ring elements. Must be even if mode is CREDENTIALS or QM
792  *      modes.
793  * @mode: Specifies the mode the ring is to be configured.
794  * @size: Specifies encoded ring element size. To calculate the encoded size use
795  *      the formula (log2(size_bytes) - 2), where size_bytes cannot be
796  *      greater than 256.
797  * @order_id: Specifies the ring's bus order ID.
798  */
799 struct ti_sci_msg_rm_ring_cfg_req {
800         struct ti_sci_msg_hdr hdr;
801         u32 valid_params;
802         u16 nav_id;
803         u16 index;
804         u32 addr_lo;
805         u32 addr_hi;
806         u32 count;
807         u8 mode;
808         u8 size;
809         u8 order_id;
810 } __packed;
811
812 /**
813  * struct ti_sci_msg_rm_ring_cfg_resp - Response to configuring a ring.
814  *
815  * @hdr:        Generic Header
816  */
817 struct ti_sci_msg_rm_ring_cfg_resp {
818         struct ti_sci_msg_hdr hdr;
819 } __packed;
820
821 /**
822  * struct ti_sci_msg_rm_ring_get_cfg_req - Get RA ring's configuration
823  *
824  * Gets the configuration of the non-real-time register fields of a ring.  The
825  * host, or a supervisor of the host, who owns the ring must be the requesting
826  * host.  The values of the non-real-time registers are returned in
827  * @ti_sci_msg_rm_ring_get_cfg_resp.
828  *
829  * @hdr: Generic Header
830  * @nav_id: Device ID of Navigator Subsystem from which the ring is allocated
831  * @index: ring index.
832  */
833 struct ti_sci_msg_rm_ring_get_cfg_req {
834         struct ti_sci_msg_hdr hdr;
835         u16 nav_id;
836         u16 index;
837 } __packed;
838
839 /**
840  * struct ti_sci_msg_rm_ring_get_cfg_resp -  Ring get configuration response
841  *
842  * Response received by host processor after RM has handled
843  * @ti_sci_msg_rm_ring_get_cfg_req. The response contains the ring's
844  * non-real-time register values.
845  *
846  * @hdr: Generic Header
847  * @addr_lo: Ring 32 LSBs of base address
848  * @addr_hi: Ring 16 MSBs of base address.
849  * @count: Ring number of elements.
850  * @mode: Ring mode.
851  * @size: encoded Ring element size
852  * @order_id: ing order ID.
853  */
854 struct ti_sci_msg_rm_ring_get_cfg_resp {
855         struct ti_sci_msg_hdr hdr;
856         u32 addr_lo;
857         u32 addr_hi;
858         u32 count;
859         u8 mode;
860         u8 size;
861         u8 order_id;
862 } __packed;
863
864 /**
865  * struct ti_sci_msg_psil_pair - Pairs a PSI-L source thread to a destination
866  *                               thread
867  * @hdr:        Generic Header
868  * @nav_id:     SoC Navigator Subsystem device ID whose PSI-L config proxy is
869  *              used to pair the source and destination threads.
870  * @src_thread: PSI-L source thread ID within the PSI-L System thread map.
871  *
872  * UDMAP transmit channels mapped to source threads will have their
873  * TCHAN_THRD_ID register programmed with the destination thread if the pairing
874  * is successful.
875
876  * @dst_thread: PSI-L destination thread ID within the PSI-L System thread map.
877  * PSI-L destination threads start at index 0x8000.  The request is NACK'd if
878  * the destination thread is not greater than or equal to 0x8000.
879  *
880  * UDMAP receive channels mapped to destination threads will have their
881  * RCHAN_THRD_ID register programmed with the source thread if the pairing
882  * is successful.
883  *
884  * Request type is TI_SCI_MSG_RM_PSIL_PAIR, response is a generic ACK or NACK
885  * message.
886  */
887 struct ti_sci_msg_psil_pair {
888         struct ti_sci_msg_hdr hdr;
889         u32 nav_id;
890         u32 src_thread;
891         u32 dst_thread;
892 } __packed;
893
894 /**
895  * struct ti_sci_msg_psil_unpair - Unpairs a PSI-L source thread from a
896  *                                 destination thread
897  * @hdr:        Generic Header
898  * @nav_id:     SoC Navigator Subsystem device ID whose PSI-L config proxy is
899  *              used to unpair the source and destination threads.
900  * @src_thread: PSI-L source thread ID within the PSI-L System thread map.
901  *
902  * UDMAP transmit channels mapped to source threads will have their
903  * TCHAN_THRD_ID register cleared if the unpairing is successful.
904  *
905  * @dst_thread: PSI-L destination thread ID within the PSI-L System thread map.
906  * PSI-L destination threads start at index 0x8000.  The request is NACK'd if
907  * the destination thread is not greater than or equal to 0x8000.
908  *
909  * UDMAP receive channels mapped to destination threads will have their
910  * RCHAN_THRD_ID register cleared if the unpairing is successful.
911  *
912  * Request type is TI_SCI_MSG_RM_PSIL_UNPAIR, response is a generic ACK or NACK
913  * message.
914  */
915 struct ti_sci_msg_psil_unpair {
916         struct ti_sci_msg_hdr hdr;
917         u32 nav_id;
918         u32 src_thread;
919         u32 dst_thread;
920 } __packed;
921
922 /**
923  * Configures a Navigator Subsystem UDMAP transmit channel
924  *
925  * Configures the non-real-time registers of a Navigator Subsystem UDMAP
926  * transmit channel.  The channel index must be assigned to the host defined
927  * in the TISCI header via the RM board configuration resource assignment
928  * range list.
929  *
930  * @hdr: Generic Header
931  *
932  * @valid_params: Bitfield defining validity of tx channel configuration
933  * parameters. The tx channel configuration fields are not valid, and will not
934  * be used for ch configuration, if their corresponding valid bit is zero.
935  * Valid bit usage:
936  *    0 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_pause_on_err
937  *    1 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_atype
938  *    2 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_chan_type
939  *    3 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_fetch_size
940  *    4 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::txcq_qnum
941  *    5 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_priority
942  *    6 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_qos
943  *    7 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_orderid
944  *    8 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_sched_priority
945  *    9 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_filt_einfo
946  *   10 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_filt_pswords
947  *   11 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_supr_tdpkt
948  *   12 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::tx_credit_count
949  *   13 - Valid bit for @ref ti_sci_msg_rm_udmap_tx_ch_cfg::fdepth
950  *
951  * @nav_id: SoC device ID of Navigator Subsystem where tx channel is located
952  *
953  * @index: UDMAP transmit channel index.
954  *
955  * @tx_pause_on_err: UDMAP transmit channel pause on error configuration to
956  * be programmed into the tx_pause_on_err field of the channel's TCHAN_TCFG
957  * register.
958  *
959  * @tx_filt_einfo: UDMAP transmit channel extended packet information passing
960  * configuration to be programmed into the tx_filt_einfo field of the
961  * channel's TCHAN_TCFG register.
962  *
963  * @tx_filt_pswords: UDMAP transmit channel protocol specific word passing
964  * configuration to be programmed into the tx_filt_pswords field of the
965  * channel's TCHAN_TCFG register.
966  *
967  * @tx_atype: UDMAP transmit channel non Ring Accelerator access pointer
968  * interpretation configuration to be programmed into the tx_atype field of
969  * the channel's TCHAN_TCFG register.
970  *
971  * @tx_chan_type: UDMAP transmit channel functional channel type and work
972  * passing mechanism configuration to be programmed into the tx_chan_type
973  * field of the channel's TCHAN_TCFG register.
974  *
975  * @tx_supr_tdpkt: UDMAP transmit channel teardown packet generation suppression
976  * configuration to be programmed into the tx_supr_tdpkt field of the channel's
977  * TCHAN_TCFG register.
978  *
979  * @tx_fetch_size: UDMAP transmit channel number of 32-bit descriptor words to
980  * fetch configuration to be programmed into the tx_fetch_size field of the
981  * channel's TCHAN_TCFG register.  The user must make sure to set the maximum
982  * word count that can pass through the channel for any allowed descriptor type.
983  *
984  * @tx_credit_count: UDMAP transmit channel transfer request credit count
985  * configuration to be programmed into the count field of the TCHAN_TCREDIT
986  * register.  Specifies how many credits for complete TRs are available.
987  *
988  * @txcq_qnum: UDMAP transmit channel completion queue configuration to be
989  * programmed into the txcq_qnum field of the TCHAN_TCQ register. The specified
990  * completion queue must be assigned to the host, or a subordinate of the host,
991  * requesting configuration of the transmit channel.
992  *
993  * @tx_priority: UDMAP transmit channel transmit priority value to be programmed
994  * into the priority field of the channel's TCHAN_TPRI_CTRL register.
995  *
996  * @tx_qos: UDMAP transmit channel transmit qos value to be programmed into the
997  * qos field of the channel's TCHAN_TPRI_CTRL register.
998  *
999  * @tx_orderid: UDMAP transmit channel bus order id value to be programmed into
1000  * the orderid field of the channel's TCHAN_TPRI_CTRL register.
1001  *
1002  * @fdepth: UDMAP transmit channel FIFO depth configuration to be programmed
1003  * into the fdepth field of the TCHAN_TFIFO_DEPTH register. Sets the number of
1004  * Tx FIFO bytes which are allowed to be stored for the channel. Check the UDMAP
1005  * section of the TRM for restrictions regarding this parameter.
1006  *
1007  * @tx_sched_priority: UDMAP transmit channel tx scheduling priority
1008  * configuration to be programmed into the priority field of the channel's
1009  * TCHAN_TST_SCHED register.
1010  */
1011 struct ti_sci_msg_rm_udmap_tx_ch_cfg_req {
1012         struct ti_sci_msg_hdr hdr;
1013         u32 valid_params;
1014         u16 nav_id;
1015         u16 index;
1016         u8 tx_pause_on_err;
1017         u8 tx_filt_einfo;
1018         u8 tx_filt_pswords;
1019         u8 tx_atype;
1020         u8 tx_chan_type;
1021         u8 tx_supr_tdpkt;
1022         u16 tx_fetch_size;
1023         u8 tx_credit_count;
1024         u16 txcq_qnum;
1025         u8 tx_priority;
1026         u8 tx_qos;
1027         u8 tx_orderid;
1028         u16 fdepth;
1029         u8 tx_sched_priority;
1030 } __packed;
1031
1032 /**
1033  *  Response to configuring a UDMAP transmit channel.
1034  *
1035  * @hdr: Standard TISCI header
1036  */
1037 struct ti_sci_msg_rm_udmap_tx_ch_cfg_resp {
1038         struct ti_sci_msg_hdr hdr;
1039 } __packed;
1040
1041 /**
1042  * Configures a Navigator Subsystem UDMAP receive channel
1043  *
1044  * Configures the non-real-time registers of a Navigator Subsystem UDMAP
1045  * receive channel.  The channel index must be assigned to the host defined
1046  * in the TISCI header via the RM board configuration resource assignment
1047  * range list.
1048  *
1049  * @hdr: Generic Header
1050  *
1051  * @valid_params: Bitfield defining validity of rx channel configuration
1052  * parameters.
1053  * The rx channel configuration fields are not valid, and will not be used for
1054  * ch configuration, if their corresponding valid bit is zero.
1055  * Valid bit usage:
1056  *    0 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_pause_on_err
1057  *    1 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_atype
1058  *    2 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_chan_type
1059  *    3 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_fetch_size
1060  *    4 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rxcq_qnum
1061  *    5 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_priority
1062  *    6 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_qos
1063  *    7 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_orderid
1064  *    8 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_sched_priority
1065  *    9 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::flowid_start
1066  *   10 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::flowid_cnt
1067  *   11 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_ignore_short
1068  *   12 - Valid bit for @ti_sci_msg_rm_udmap_rx_ch_cfg_req::rx_ignore_long
1069  *
1070  * @nav_id: SoC device ID of Navigator Subsystem where rx channel is located
1071  *
1072  * @index: UDMAP receive channel index.
1073  *
1074  * @rx_fetch_size: UDMAP receive channel number of 32-bit descriptor words to
1075  * fetch configuration to be programmed into the rx_fetch_size field of the
1076  * channel's RCHAN_RCFG register.
1077  *
1078  * @rxcq_qnum: UDMAP receive channel completion queue configuration to be
1079  * programmed into the rxcq_qnum field of the RCHAN_RCQ register.
1080  * The specified completion queue must be assigned to the host, or a subordinate
1081  * of the host, requesting configuration of the receive channel.
1082  *
1083  * @rx_priority: UDMAP receive channel receive priority value to be programmed
1084  * into the priority field of the channel's RCHAN_RPRI_CTRL register.
1085  *
1086  * @rx_qos: UDMAP receive channel receive qos value to be programmed into the
1087  * qos field of the channel's RCHAN_RPRI_CTRL register.
1088  *
1089  * @rx_orderid: UDMAP receive channel bus order id value to be programmed into
1090  * the orderid field of the channel's RCHAN_RPRI_CTRL register.
1091  *
1092  * @rx_sched_priority: UDMAP receive channel rx scheduling priority
1093  * configuration to be programmed into the priority field of the channel's
1094  * RCHAN_RST_SCHED register.
1095  *
1096  * @flowid_start: UDMAP receive channel additional flows starting index
1097  * configuration to program into the flow_start field of the RCHAN_RFLOW_RNG
1098  * register. Specifies the starting index for flow IDs the receive channel is to
1099  * make use of beyond the default flow. flowid_start and @ref flowid_cnt must be
1100  * set as valid and configured together. The starting flow ID set by
1101  * @ref flowid_cnt must be a flow index within the Navigator Subsystem's subset
1102  * of flows beyond the default flows statically mapped to receive channels.
1103  * The additional flows must be assigned to the host, or a subordinate of the
1104  * host, requesting configuration of the receive channel.
1105  *
1106  * @flowid_cnt: UDMAP receive channel additional flows count configuration to
1107  * program into the flowid_cnt field of the RCHAN_RFLOW_RNG register.
1108  * This field specifies how many flow IDs are in the additional contiguous range
1109  * of legal flow IDs for the channel.  @ref flowid_start and flowid_cnt must be
1110  * set as valid and configured together. Disabling the valid_params field bit
1111  * for flowid_cnt indicates no flow IDs other than the default are to be
1112  * allocated and used by the receive channel. @ref flowid_start plus flowid_cnt
1113  * cannot be greater than the number of receive flows in the receive channel's
1114  * Navigator Subsystem.  The additional flows must be assigned to the host, or a
1115  * subordinate of the host, requesting configuration of the receive channel.
1116  *
1117  * @rx_pause_on_err: UDMAP receive channel pause on error configuration to be
1118  * programmed into the rx_pause_on_err field of the channel's RCHAN_RCFG
1119  * register.
1120  *
1121  * @rx_atype: UDMAP receive channel non Ring Accelerator access pointer
1122  * interpretation configuration to be programmed into the rx_atype field of the
1123  * channel's RCHAN_RCFG register.
1124  *
1125  * @rx_chan_type: UDMAP receive channel functional channel type and work passing
1126  * mechanism configuration to be programmed into the rx_chan_type field of the
1127  * channel's RCHAN_RCFG register.
1128  *
1129  * @rx_ignore_short: UDMAP receive channel short packet treatment configuration
1130  * to be programmed into the rx_ignore_short field of the RCHAN_RCFG register.
1131  *
1132  * @rx_ignore_long: UDMAP receive channel long packet treatment configuration to
1133  * be programmed into the rx_ignore_long field of the RCHAN_RCFG register.
1134  */
1135 struct ti_sci_msg_rm_udmap_rx_ch_cfg_req {
1136         struct ti_sci_msg_hdr hdr;
1137         u32 valid_params;
1138         u16 nav_id;
1139         u16 index;
1140         u16 rx_fetch_size;
1141         u16 rxcq_qnum;
1142         u8 rx_priority;
1143         u8 rx_qos;
1144         u8 rx_orderid;
1145         u8 rx_sched_priority;
1146         u16 flowid_start;
1147         u16 flowid_cnt;
1148         u8 rx_pause_on_err;
1149         u8 rx_atype;
1150         u8 rx_chan_type;
1151         u8 rx_ignore_short;
1152         u8 rx_ignore_long;
1153 } __packed;
1154
1155 /**
1156  * Response to configuring a UDMAP receive channel.
1157  *
1158  * @hdr: Standard TISCI header
1159  */
1160 struct ti_sci_msg_rm_udmap_rx_ch_cfg_resp {
1161         struct ti_sci_msg_hdr hdr;
1162 } __packed;
1163
1164 /**
1165  * Configures a Navigator Subsystem UDMAP receive flow
1166  *
1167  * Configures a Navigator Subsystem UDMAP receive flow's registers.
1168  * Configuration does not include the flow registers which handle size-based
1169  * free descriptor queue routing.
1170  *
1171  * The flow index must be assigned to the host defined in the TISCI header via
1172  * the RM board configuration resource assignment range list.
1173  *
1174  * @hdr: Standard TISCI header
1175  *
1176  * @valid_params
1177  * Bitfield defining validity of rx flow configuration parameters.  The
1178  * rx flow configuration fields are not valid, and will not be used for flow
1179  * configuration, if their corresponding valid bit is zero.  Valid bit usage:
1180  *     0 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_einfo_present
1181  *     1 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_psinfo_present
1182  *     2 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_error_handling
1183  *     3 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_desc_type
1184  *     4 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_sop_offset
1185  *     5 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_dest_qnum
1186  *     6 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_hi
1187  *     7 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_lo
1188  *     8 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_hi
1189  *     9 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_lo
1190  *    10 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_hi_sel
1191  *    11 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_src_tag_lo_sel
1192  *    12 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_hi_sel
1193  *    13 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_dest_tag_lo_sel
1194  *    14 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_fdq0_sz0_qnum
1195  *    15 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_fdq1_sz0_qnum
1196  *    16 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_fdq2_sz0_qnum
1197  *    17 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_fdq3_sz0_qnum
1198  *    18 - Valid bit for @tisci_msg_rm_udmap_flow_cfg_req::rx_ps_location
1199  *
1200  * @nav_id: SoC device ID of Navigator Subsystem from which the receive flow is
1201  * allocated
1202  *
1203  * @flow_index: UDMAP receive flow index for non-optional configuration.
1204  *
1205  * @rx_einfo_present:
1206  * UDMAP receive flow extended packet info present configuration to be
1207  * programmed into the rx_einfo_present field of the flow's RFLOW_RFA register.
1208  *
1209  * @rx_psinfo_present:
1210  * UDMAP receive flow PS words present configuration to be programmed into the
1211  * rx_psinfo_present field of the flow's RFLOW_RFA register.
1212  *
1213  * @rx_error_handling:
1214  * UDMAP receive flow error handling configuration to be programmed into the
1215  * rx_error_handling field of the flow's RFLOW_RFA register.
1216  *
1217  * @rx_desc_type:
1218  * UDMAP receive flow descriptor type configuration to be programmed into the
1219  * rx_desc_type field field of the flow's RFLOW_RFA register.
1220  *
1221  * @rx_sop_offset:
1222  * UDMAP receive flow start of packet offset configuration to be programmed
1223  * into the rx_sop_offset field of the RFLOW_RFA register.  See the UDMAP
1224  * section of the TRM for more information on this setting.  Valid values for
1225  * this field are 0-255 bytes.
1226  *
1227  * @rx_dest_qnum:
1228  * UDMAP receive flow destination queue configuration to be programmed into the
1229  * rx_dest_qnum field of the flow's RFLOW_RFA register.  The specified
1230  * destination queue must be valid within the Navigator Subsystem and must be
1231  * owned by the host, or a subordinate of the host, requesting allocation and
1232  * configuration of the receive flow.
1233  *
1234  * @rx_src_tag_hi:
1235  * UDMAP receive flow source tag high byte constant configuration to be
1236  * programmed into the rx_src_tag_hi field of the flow's RFLOW_RFB register.
1237  * See the UDMAP section of the TRM for more information on this setting.
1238  *
1239  * @rx_src_tag_lo:
1240  * UDMAP receive flow source tag low byte constant configuration to be
1241  * programmed into the rx_src_tag_lo field of the flow's RFLOW_RFB register.
1242  * See the UDMAP section of the TRM for more information on this setting.
1243  *
1244  * @rx_dest_tag_hi:
1245  * UDMAP receive flow destination tag high byte constant configuration to be
1246  * programmed into the rx_dest_tag_hi field of the flow's RFLOW_RFB register.
1247  * See the UDMAP section of the TRM for more information on this setting.
1248  *
1249  * @rx_dest_tag_lo:
1250  * UDMAP receive flow destination tag low byte constant configuration to be
1251  * programmed into the rx_dest_tag_lo field of the flow's RFLOW_RFB register.
1252  * See the UDMAP section of the TRM for more information on this setting.
1253  *
1254  * @rx_src_tag_hi_sel:
1255  * UDMAP receive flow source tag high byte selector configuration to be
1256  * programmed into the rx_src_tag_hi_sel field of the RFLOW_RFC register.  See
1257  * the UDMAP section of the TRM for more information on this setting.
1258  *
1259  * @rx_src_tag_lo_sel:
1260  * UDMAP receive flow source tag low byte selector configuration to be
1261  * programmed into the rx_src_tag_lo_sel field of the RFLOW_RFC register.  See
1262  * the UDMAP section of the TRM for more information on this setting.
1263  *
1264  * @rx_dest_tag_hi_sel:
1265  * UDMAP receive flow destination tag high byte selector configuration to be
1266  * programmed into the rx_dest_tag_hi_sel field of the RFLOW_RFC register.  See
1267  * the UDMAP section of the TRM for more information on this setting.
1268  *
1269  * @rx_dest_tag_lo_sel:
1270  * UDMAP receive flow destination tag low byte selector configuration to be
1271  * programmed into the rx_dest_tag_lo_sel field of the RFLOW_RFC register.  See
1272  * the UDMAP section of the TRM for more information on this setting.
1273  *
1274  * @rx_fdq0_sz0_qnum:
1275  * UDMAP receive flow free descriptor queue 0 configuration to be programmed
1276  * into the rx_fdq0_sz0_qnum field of the flow's RFLOW_RFD register.  See the
1277  * UDMAP section of the TRM for more information on this setting. The specified
1278  * free queue must be valid within the Navigator Subsystem and must be owned
1279  * by the host, or a subordinate of the host, requesting allocation and
1280  * configuration of the receive flow.
1281  *
1282  * @rx_fdq1_qnum:
1283  * UDMAP receive flow free descriptor queue 1 configuration to be programmed
1284  * into the rx_fdq1_qnum field of the flow's RFLOW_RFD register.  See the
1285  * UDMAP section of the TRM for more information on this setting.  The specified
1286  * free queue must be valid within the Navigator Subsystem and must be owned
1287  * by the host, or a subordinate of the host, requesting allocation and
1288  * configuration of the receive flow.
1289  *
1290  * @rx_fdq2_qnum:
1291  * UDMAP receive flow free descriptor queue 2 configuration to be programmed
1292  * into the rx_fdq2_qnum field of the flow's RFLOW_RFE register.  See the
1293  * UDMAP section of the TRM for more information on this setting.  The specified
1294  * free queue must be valid within the Navigator Subsystem and must be owned
1295  * by the host, or a subordinate of the host, requesting allocation and
1296  * configuration of the receive flow.
1297  *
1298  * @rx_fdq3_qnum:
1299  * UDMAP receive flow free descriptor queue 3 configuration to be programmed
1300  * into the rx_fdq3_qnum field of the flow's RFLOW_RFE register.  See the
1301  * UDMAP section of the TRM for more information on this setting.  The specified
1302  * free queue must be valid within the Navigator Subsystem and must be owned
1303  * by the host, or a subordinate of the host, requesting allocation and
1304  * configuration of the receive flow.
1305  *
1306  * @rx_ps_location:
1307  * UDMAP receive flow PS words location configuration to be programmed into the
1308  * rx_ps_location field of the flow's RFLOW_RFA register.
1309  */
1310 struct ti_sci_msg_rm_udmap_flow_cfg_req {
1311         struct ti_sci_msg_hdr hdr;
1312         u32 valid_params;
1313         u16 nav_id;
1314         u16 flow_index;
1315         u8 rx_einfo_present;
1316         u8 rx_psinfo_present;
1317         u8 rx_error_handling;
1318         u8 rx_desc_type;
1319         u16 rx_sop_offset;
1320         u16 rx_dest_qnum;
1321         u8 rx_src_tag_hi;
1322         u8 rx_src_tag_lo;
1323         u8 rx_dest_tag_hi;
1324         u8 rx_dest_tag_lo;
1325         u8 rx_src_tag_hi_sel;
1326         u8 rx_src_tag_lo_sel;
1327         u8 rx_dest_tag_hi_sel;
1328         u8 rx_dest_tag_lo_sel;
1329         u16 rx_fdq0_sz0_qnum;
1330         u16 rx_fdq1_qnum;
1331         u16 rx_fdq2_qnum;
1332         u16 rx_fdq3_qnum;
1333         u8 rx_ps_location;
1334 } __packed;
1335
1336 /**
1337  *  Response to configuring a Navigator Subsystem UDMAP receive flow
1338  *
1339  * @hdr: Standard TISCI header
1340  */
1341 struct ti_sci_msg_rm_udmap_flow_cfg_resp {
1342         struct ti_sci_msg_hdr hdr;
1343 } __packed;
1344
1345 #define FWL_MAX_PRIVID_SLOTS 3U
1346
1347 /**
1348  * struct ti_sci_msg_fwl_set_firewall_region_req - Request for configuring the firewall permissions.
1349  *
1350  * @hdr:                Generic Header
1351  *
1352  * @fwl_id:             Firewall ID in question
1353  * @region:             Region or channel number to set config info
1354  *                      This field is unused in case of a simple firewall  and must be initialized
1355  *                      to zero.  In case of a region based firewall, this field indicates the
1356  *                      region in question. (index starting from 0) In case of a channel based
1357  *                      firewall, this field indicates the channel in question (index starting
1358  *                      from 0)
1359  * @n_permission_regs:  Number of permission registers to set
1360  * @control:            Contents of the firewall CONTROL register to set
1361  * @permissions:        Contents of the firewall PERMISSION register to set
1362  * @start_address:      Contents of the firewall START_ADDRESS register to set
1363  * @end_address:        Contents of the firewall END_ADDRESS register to set
1364  */
1365
1366 struct ti_sci_msg_fwl_set_firewall_region_req {
1367         struct ti_sci_msg_hdr   hdr;
1368         u16                     fwl_id;
1369         u16                     region;
1370         u32                     n_permission_regs;
1371         u32                     control;
1372         u32                     permissions[FWL_MAX_PRIVID_SLOTS];
1373         u64                     start_address;
1374         u64                     end_address;
1375 } __packed;
1376
1377 /**
1378  * struct ti_sci_msg_fwl_get_firewall_region_req - Request for retrieving the firewall permissions
1379  *
1380  * @hdr:                Generic Header
1381  *
1382  * @fwl_id:             Firewall ID in question
1383  * @region:             Region or channel number to get config info
1384  *                      This field is unused in case of a simple firewall and must be initialized
1385  *                      to zero.  In case of a region based firewall, this field indicates the
1386  *                      region in question (index starting from 0). In case of a channel based
1387  *                      firewall, this field indicates the channel in question (index starting
1388  *                      from 0).
1389  * @n_permission_regs:  Number of permission registers to retrieve
1390  */
1391 struct ti_sci_msg_fwl_get_firewall_region_req {
1392         struct ti_sci_msg_hdr   hdr;
1393         u16                     fwl_id;
1394         u16                     region;
1395         u32                     n_permission_regs;
1396 } __packed;
1397
1398 /**
1399  * struct ti_sci_msg_fwl_get_firewall_region_resp - Response for retrieving the firewall permissions
1400  *
1401  * @hdr:                Generic Header
1402  *
1403  * @fwl_id:             Firewall ID in question
1404  * @region:             Region or channel number to set config info This field is
1405  *                      unused in case of a simple firewall  and must be initialized to zero.  In
1406  *                      case of a region based firewall, this field indicates the region in
1407  *                      question. (index starting from 0) In case of a channel based firewall, this
1408  *                      field indicates the channel in question (index starting from 0)
1409  * @n_permission_regs:  Number of permission registers retrieved
1410  * @control:            Contents of the firewall CONTROL register
1411  * @permissions:        Contents of the firewall PERMISSION registers
1412  * @start_address:      Contents of the firewall START_ADDRESS register This is not applicable for channelized firewalls.
1413  * @end_address:        Contents of the firewall END_ADDRESS register This is not applicable for channelized firewalls.
1414  */
1415 struct ti_sci_msg_fwl_get_firewall_region_resp {
1416         struct ti_sci_msg_hdr   hdr;
1417         u16                     fwl_id;
1418         u16                     region;
1419         u32                     n_permission_regs;
1420         u32                     control;
1421         u32                     permissions[FWL_MAX_PRIVID_SLOTS];
1422         u64                     start_address;
1423         u64                     end_address;
1424 } __packed;
1425
1426 /**
1427  * struct ti_sci_msg_fwl_change_owner_info_req - Request for a firewall owner change
1428  *
1429  * @hdr:                Generic Header
1430  *
1431  * @fwl_id:             Firewall ID in question
1432  * @region:             Region or channel number if applicable
1433  * @owner_index:        New owner index to transfer ownership to
1434  */
1435 struct ti_sci_msg_fwl_change_owner_info_req {
1436         struct ti_sci_msg_hdr   hdr;
1437         u16                     fwl_id;
1438         u16                     region;
1439         u8                      owner_index;
1440 } __packed;
1441
1442 /**
1443  * struct ti_sci_msg_fwl_change_owner_info_resp - Response for a firewall owner change
1444  *
1445  * @hdr:                Generic Header
1446  *
1447  * @fwl_id:             Firewall ID specified in request
1448  * @region:             Region or channel number specified in request
1449  * @owner_index:        Owner index specified in request
1450  * @owner_privid:       New owner priv-ID returned by DMSC.
1451  * @owner_permission_bits:      New owner permission bits returned by DMSC.
1452  */
1453 struct ti_sci_msg_fwl_change_owner_info_resp {
1454         struct ti_sci_msg_hdr   hdr;
1455         u16                     fwl_id;
1456         u16                     region;
1457         u8                      owner_index;
1458         u8                      owner_privid;
1459         u16                     owner_permission_bits;
1460 } __packed;
1461
1462 #endif /* __TI_SCI_H */