ti_sci.h 23 KB

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