sci_pm_api.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. /*
  2. * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. /*!
  7. * Header file containing the public API for the System Controller (SC)
  8. * Power Management (PM) function. This includes functions for power state
  9. * control, clock control, reset control, and wake-up event control.
  10. *
  11. * @addtogroup PM_SVC (SVC) Power Management Service
  12. *
  13. * Module for the Power Management (PM) service.
  14. *
  15. * @{
  16. */
  17. #ifndef SCI_PM_API_H
  18. #define SCI_PM_API_H
  19. /* Includes */
  20. #include <sci/sci_types.h>
  21. #include <sci/svc/rm/sci_rm_api.h>
  22. /* Defines */
  23. /*!
  24. * @name Defines for type widths
  25. */
  26. /*@{*/
  27. #define SC_PM_POWER_MODE_W 2 /* Width of sc_pm_power_mode_t */
  28. #define SC_PM_CLOCK_MODE_W 3 /* Width of sc_pm_clock_mode_t */
  29. #define SC_PM_RESET_TYPE_W 2 /* Width of sc_pm_reset_type_t */
  30. #define SC_PM_RESET_REASON_W 3 /* Width of sc_pm_reset_reason_t */
  31. /*@}*/
  32. /*!
  33. * @name Defines for clock indexes (sc_pm_clk_t)
  34. */
  35. /*@{*/
  36. /*@}*/
  37. /*!
  38. * @name Defines for ALL parameters
  39. */
  40. /*@{*/
  41. #define SC_PM_CLK_ALL UINT8_MAX /* All clocks */
  42. /*@}*/
  43. /*!
  44. * @name Defines for sc_pm_power_mode_t
  45. */
  46. /*@{*/
  47. #define SC_PM_PW_MODE_OFF 0U /* Power off */
  48. #define SC_PM_PW_MODE_STBY 1U /* Power in standby */
  49. #define SC_PM_PW_MODE_LP 2U /* Power in low-power */
  50. #define SC_PM_PW_MODE_ON 3U /* Power on */
  51. /*@}*/
  52. /*!
  53. * @name Defines for sc_pm_clk_t
  54. */
  55. /*@{*/
  56. #define SC_PM_CLK_SLV_BUS 0U /* Slave bus clock */
  57. #define SC_PM_CLK_MST_BUS 1U /* Master bus clock */
  58. #define SC_PM_CLK_PER 2U /* Peripheral clock */
  59. #define SC_PM_CLK_PHY 3U /* Phy clock */
  60. #define SC_PM_CLK_MISC 4U /* Misc clock */
  61. #define SC_PM_CLK_MISC0 0U /* Misc 0 clock */
  62. #define SC_PM_CLK_MISC1 1U /* Misc 1 clock */
  63. #define SC_PM_CLK_MISC2 2U /* Misc 2 clock */
  64. #define SC_PM_CLK_MISC3 3U /* Misc 3 clock */
  65. #define SC_PM_CLK_MISC4 4U /* Misc 4 clock */
  66. #define SC_PM_CLK_CPU 2U /* CPU clock */
  67. #define SC_PM_CLK_PLL 4U /* PLL */
  68. #define SC_PM_CLK_BYPASS 4U /* Bypass clock */
  69. /*@}*/
  70. /*!
  71. * @name Defines for sc_pm_clk_mode_t
  72. */
  73. /*@{*/
  74. #define SC_PM_CLK_MODE_ROM_INIT 0U /* Clock is initialized by ROM. */
  75. #define SC_PM_CLK_MODE_OFF 1U /* Clock is disabled */
  76. #define SC_PM_CLK_MODE_ON 2U /* Clock is enabled. */
  77. #define SC_PM_CLK_MODE_AUTOGATE_SW 3U /* Clock is in SW autogate mode */
  78. #define SC_PM_CLK_MODE_AUTOGATE_HW 4U /* Clock is in HW autogate mode */
  79. #define SC_PM_CLK_MODE_AUTOGATE_SW_HW 5U /* Clock is in SW-HW autogate mode */
  80. /*@}*/
  81. /*!
  82. * @name Defines for sc_pm_clk_parent_t
  83. */
  84. /*@{*/
  85. #define SC_PM_PARENT_XTAL 0U /* Parent is XTAL. */
  86. #define SC_PM_PARENT_PLL0 1U /* Parent is PLL0 */
  87. #define SC_PM_PARENT_PLL1 2U /* Parent is PLL1 or PLL0/2 */
  88. #define SC_PM_PARENT_PLL2 3U /* Parent in PLL2 or PLL0/4 */
  89. #define SC_PM_PARENT_BYPS 4U /* Parent is a bypass clock. */
  90. /*@}*/
  91. /*!
  92. * @name Defines for sc_pm_reset_type_t
  93. */
  94. /*@{*/
  95. #define SC_PM_RESET_TYPE_COLD 0U /* Cold reset */
  96. #define SC_PM_RESET_TYPE_WARM 1U /* Warm reset */
  97. #define SC_PM_RESET_TYPE_BOARD 2U /* Board reset */
  98. /*@}*/
  99. /*!
  100. * @name Defines for sc_pm_reset_cause_t
  101. */
  102. /*@{*/
  103. #define SC_PM_RESET_CAUSE_TEMP 0U /* Reset due to temp panic alarm */
  104. #define SC_PM_RESET_CAUSE_FAULT 1U /* Reset due to fault exception */
  105. #define SC_PM_RESET_CAUSE_IRQ 2U /* Reset due to SCU reset IRQ */
  106. #define SC_PM_RESET_CAUSE_WDOG 3U /* Reset due to SW WDOG */
  107. #define SC_PM_RESET_CAUSE_API 4U /* Reset due to pm_reset() or monitor */
  108. /*@}*/
  109. /*!
  110. * @name Defines for sc_pm_reset_reason_t
  111. */
  112. /*@{*/
  113. #define SC_PM_RESET_REASON_POR 0U /* Power on reset */
  114. #define SC_PM_RESET_REASON_WARM 1U /* Warm reset */
  115. #define SC_PM_RESET_REASON_SW 2U /* Software reset */
  116. #define SC_PM_RESET_REASON_WDOG 3U /* Watchdog reset */
  117. #define SC_PM_RESET_REASON_LOCKUP 4U /* Lockup reset */
  118. #define SC_PM_RESET_REASON_TAMPER 5U /* Tamper reset */
  119. #define SC_PM_RESET_REASON_TEMP 6U /* Temp reset */
  120. #define SC_PM_RESET_REASON_LOW_VOLT 7U /* Low voltage reset */
  121. /*@}*/
  122. /*!
  123. * @name Defines for sc_pm_sys_if_t
  124. */
  125. /*@{*/
  126. #define SC_PM_SYS_IF_INTERCONNECT 0U /* System interconnect */
  127. #define SC_PM_SYS_IF_MU 1U /* AP -> SCU message units */
  128. #define SC_PM_SYS_IF_OCMEM 2U /* On-chip memory (ROM/OCRAM) */
  129. #define SC_PM_SYS_IF_DDR 3U /* DDR memory */
  130. /*@}*/
  131. /*!
  132. * @name Defines for sc_pm_wake_src_t
  133. */
  134. /*@{*/
  135. #define SC_PM_WAKE_SRC_NONE 0U /* No wake source, used for self-kill */
  136. #define SC_PM_WAKE_SRC_SCU 1U /* Wakeup from SCU to resume CPU (IRQSTEER & GIC powered down) */
  137. #define SC_PM_WAKE_SRC_IRQSTEER 2U /* Wakeup from IRQSTEER to resume CPU (GIC powered down) */
  138. #define SC_PM_WAKE_SRC_IRQSTEER_GIC 3U /* Wakeup from IRQSTEER+GIC to wake CPU (GIC clock gated) */
  139. #define SC_PM_WAKE_SRC_GIC 4U /* Wakeup from GIC to wake CPU */
  140. /*@}*/
  141. /* Types */
  142. /*!
  143. * This type is used to declare a power mode. Note resources only use
  144. * SC_PM_PW_MODE_OFF and SC_PM_PW_MODE_ON. The other modes are used only
  145. * as system power modes.
  146. */
  147. typedef uint8_t sc_pm_power_mode_t;
  148. /*!
  149. * This type is used to declare a clock.
  150. */
  151. typedef uint8_t sc_pm_clk_t;
  152. /*!
  153. * This type is used to declare a clock mode.
  154. */
  155. typedef uint8_t sc_pm_clk_mode_t;
  156. /*!
  157. * This type is used to declare the clock parent.
  158. */
  159. typedef uint8_t sc_pm_clk_parent_t;
  160. /*!
  161. * This type is used to declare clock rates.
  162. */
  163. typedef uint32_t sc_pm_clock_rate_t;
  164. /*!
  165. * This type is used to declare a desired reset type.
  166. */
  167. typedef uint8_t sc_pm_reset_type_t;
  168. /*!
  169. * This type is used to declare a desired reset type.
  170. */
  171. typedef uint8_t sc_pm_reset_cause;
  172. /*!
  173. * This type is used to declare a reason for a reset.
  174. */
  175. typedef uint8_t sc_pm_reset_reason_t;
  176. /*!
  177. * This type is used to specify a system-level interface to be power managed.
  178. */
  179. typedef uint8_t sc_pm_sys_if_t;
  180. /*!
  181. * This type is used to specify a wake source for CPU resources.
  182. */
  183. typedef uint8_t sc_pm_wake_src_t;
  184. /* Functions */
  185. /*!
  186. * @name Power Functions
  187. * @{
  188. */
  189. /*!
  190. * This function sets the system power mode. Only the owner of the
  191. * SC_R_SYSTEM resource can do this.
  192. *
  193. * @param[in] ipc IPC handle
  194. * @param[in] mode power mode to apply
  195. *
  196. * @return Returns an error code (SC_ERR_NONE = success).
  197. *
  198. * Return errors:
  199. * - SC_ERR_PARM if invalid mode,
  200. * - SC_ERR_NOACCESS if caller not the owner of SC_R_SYSTEM
  201. *
  202. * @see sc_pm_set_sys_power_mode().
  203. */
  204. sc_err_t sc_pm_set_sys_power_mode(sc_ipc_t ipc, sc_pm_power_mode_t mode);
  205. /*!
  206. * This function sets the power mode of a partition.
  207. *
  208. * @param[in] ipc IPC handle
  209. * @param[in] pt handle of partition
  210. * @param[in] mode power mode to apply
  211. *
  212. * @return Returns an error code (SC_ERR_NONE = success).
  213. *
  214. * Return errors:
  215. * - SC_ERR_PARM if invalid partition or mode,
  216. * - SC_ERR_NOACCESS if caller's partition is not the owner or
  217. * parent of \a pt
  218. *
  219. * The power mode of the partitions is a max power any resource will
  220. * be set to. Calling this will result in all resources owned
  221. * by \a pt to have their power changed to the lower of \a mode or the
  222. * individual resource mode set using sc_pm_set_resource_power_mode().
  223. */
  224. sc_err_t sc_pm_set_partition_power_mode(sc_ipc_t ipc, sc_rm_pt_t pt,
  225. sc_pm_power_mode_t mode);
  226. /*!
  227. * This function gets the power mode of a partition.
  228. *
  229. * @param[in] ipc IPC handle
  230. * @param[in] pt handle of partition
  231. * @param[out] mode pointer to return power mode
  232. *
  233. * @return Returns an error code (SC_ERR_NONE = success).
  234. *
  235. * Return errors:
  236. * - SC_ERR_PARM if invalid partition
  237. */
  238. sc_err_t sc_pm_get_sys_power_mode(sc_ipc_t ipc, sc_rm_pt_t pt,
  239. sc_pm_power_mode_t *mode);
  240. /*!
  241. * This function sets the power mode of a resource.
  242. *
  243. * @param[in] ipc IPC handle
  244. * @param[in] resource ID of the resource
  245. * @param[in] mode power mode to apply
  246. *
  247. * @return Returns an error code (SC_ERR_NONE = success).
  248. *
  249. * Return errors:
  250. * - SC_ERR_PARM if invalid resource or mode,
  251. * - SC_ERR_NOACCESS if caller's partition is not the resource owner
  252. * or parent of the owner
  253. *
  254. * This function will record the individual resource power mode
  255. * and change it if the requested mode is lower than or equal to the
  256. * partition power mode set with sc_pm_set_partition_power_mode().
  257. * In other words, the power mode of the resource will be the minimum
  258. * of the resource power mode and the partition power mode.
  259. *
  260. * Note some resources are still not accessible even when powered up if bus
  261. * transactions go through a fabric not powered up. Examples of this are
  262. * resources in display and capture subsystems which require the display
  263. * controller or the imaging subsystem to be powered up first.
  264. *
  265. * Not that resources are grouped into power domains by the underlying
  266. * hardware. If any resource in the domain is on, the entire power domain
  267. * will be on. Other power domains required to access the resource will
  268. * also be turned on. Clocks required to access the peripheral will be
  269. * turned on. Refer to the SoC RM for more info on power domains and access
  270. * infrastructure (bus fabrics, clock domains, etc.).
  271. */
  272. sc_err_t sc_pm_set_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
  273. sc_pm_power_mode_t mode);
  274. /*!
  275. * This function gets the power mode of a resource.
  276. *
  277. * @param[in] ipc IPC handle
  278. * @param[in] resource ID of the resource
  279. * @param[out] mode pointer to return power mode
  280. *
  281. * @return Returns an error code (SC_ERR_NONE = success).
  282. *
  283. * Note only SC_PM_PW_MODE_OFF and SC_PM_PW_MODE_ON are valid. The value
  284. * returned does not reflect the power mode of the partition..
  285. */
  286. sc_err_t sc_pm_get_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
  287. sc_pm_power_mode_t *mode);
  288. /*!
  289. * This function requests the low power mode some of the resources
  290. * can enter based on their state. This API is only valid for the
  291. * following resources : SC_R_A53, SC_R_A53_0, SC_R_A53_1, SC_A53_2,
  292. * SC_A53_3, SC_R_A72, SC_R_A72_0, SC_R_A72_1, SC_R_CC1, SC_R_A35,
  293. * SC_R_A35_0, SC_R_A35_1, SC_R_A35_2, SC_R_A35_3.
  294. * For all other resources it will return SC_ERR_PARAM.
  295. * This function will set the low power mode the cores, cluster
  296. * and cluster associated resources will enter when all the cores
  297. * in a given cluster execute WFI
  298. *
  299. * @param[in] ipc IPC handle
  300. * @param[in] resource ID of the resource
  301. * @param[in] mode power mode to apply
  302. *
  303. * @return Returns an error code (SC_ERR_NONE = success).
  304. *
  305. */
  306. sc_err_t sc_pm_req_low_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
  307. sc_pm_power_mode_t mode);
  308. /*!
  309. * This function requests low-power mode entry for CPU/cluster
  310. * resources. This API is only valid for the following resources:
  311. * SC_R_A53, SC_R_A53_x, SC_R_A72, SC_R_A72_x, SC_R_A35, SC_R_A35_x,
  312. * SC_R_CCI. For all other resources it will return SC_ERR_PARAM.
  313. * For individual core resources, the specified power mode
  314. * and wake source will be applied after the core has entered
  315. * WFI. For cluster resources, the specified power mode is
  316. * applied after all cores in the cluster have entered low-power mode.
  317. * For multicluster resources, the specified power mode is applied
  318. * after all clusters have reached low-power mode.
  319. *
  320. * @param[in] ipc IPC handle
  321. * @param[in] resource ID of the resource
  322. * @param[in] mode power mode to apply
  323. * @param[in] wake_src wake source for low-power exit
  324. *
  325. * @return Returns an error code (SC_ERR_NONE = success).
  326. *
  327. */
  328. sc_err_t sc_pm_req_cpu_low_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
  329. sc_pm_power_mode_t mode,
  330. sc_pm_wake_src_t wake_src);
  331. /*!
  332. * This function is used to set the resume address of a CPU.
  333. *
  334. * @param[in] ipc IPC handle
  335. * @param[in] resource ID of the CPU resource
  336. * @param[in] address 64-bit resume address
  337. *
  338. * @return Returns an error code (SC_ERR_NONE = success).
  339. *
  340. * Return errors:
  341. * - SC_ERR_PARM if invalid resource or address,
  342. * - SC_ERR_NOACCESS if caller's partition is not the parent of the
  343. * resource (CPU) owner
  344. */
  345. sc_err_t sc_pm_set_cpu_resume_addr(sc_ipc_t ipc, sc_rsrc_t resource,
  346. sc_faddr_t address);
  347. /*!
  348. * This function is used to set parameters for CPU resume from
  349. * low-power mode.
  350. *
  351. * @param[in] ipc IPC handle
  352. * @param[in] resource ID of the CPU resource
  353. * @param[in] isPrimary set SC_TRUE if primary wake CPU
  354. * @param[in] address 64-bit resume address
  355. *
  356. * @return Returns an error code (SC_ERR_NONE = success).
  357. *
  358. * Return errors:
  359. * - SC_ERR_PARM if invalid resource or address,
  360. * - SC_ERR_NOACCESS if caller's partition is not the parent of the
  361. * resource (CPU) owner
  362. */
  363. sc_err_t sc_pm_set_cpu_resume(sc_ipc_t ipc, sc_rsrc_t resource,
  364. sc_bool_t isPrimary, sc_faddr_t address);
  365. /*!
  366. * This function requests the power mode configuration for system-level
  367. * interfaces including messaging units, interconnect, and memories. This API
  368. * is only valid for the following resources : SC_R_A53, SC_R_A72, and
  369. * SC_R_M4_x_PID_y. For all other resources, it will return SC_ERR_PARAM.
  370. * The requested power mode will be captured and applied to system-level
  371. * resources as system conditions allow.
  372. *
  373. * @param[in] ipc IPC handle
  374. * @param[in] resource ID of the resource
  375. * @param[in] sys_if system-level interface to be configured
  376. * @param[in] hpm high-power mode for the system interface
  377. * @param[in] lpm low-power mode for the system interface
  378. *
  379. * @return Returns an error code (SC_ERR_NONE = success).
  380. *
  381. */
  382. sc_err_t sc_pm_req_sys_if_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,
  383. sc_pm_sys_if_t sys_if,
  384. sc_pm_power_mode_t hpm,
  385. sc_pm_power_mode_t lpm);
  386. /* @} */
  387. /*!
  388. * @name Clock/PLL Functions
  389. * @{
  390. */
  391. /*!
  392. * This function sets the rate of a resource's clock/PLL.
  393. *
  394. * @param[in] ipc IPC handle
  395. * @param[in] resource ID of the resource
  396. * @param[in] clk clock/PLL to affect
  397. * @param[in,out] rate pointer to rate to set,
  398. * return actual rate
  399. * @return Returns an error code (SC_ERR_NONE = success).
  400. *
  401. * Return errors:
  402. * - SC_ERR_PARM if invalid resource or clock/PLL,
  403. * - SC_ERR_NOACCESS if caller's partition is not the resource owner
  404. * or parent of the owner,
  405. * - SC_ERR_UNAVAILABLE if clock/PLL not applicable to this resource,
  406. * - SC_ERR_LOCKED if rate locked (usually because shared clock/PLL)
  407. *
  408. * Refer to the [Clock List](@ref CLOCKS) for valid clock/PLL values.
  409. */
  410. sc_err_t sc_pm_set_clock_rate(sc_ipc_t ipc, sc_rsrc_t resource,
  411. sc_pm_clk_t clk, sc_pm_clock_rate_t *rate);
  412. /*!
  413. * This function gets the rate of a resource's clock/PLL.
  414. *
  415. * @param[in] ipc IPC handle
  416. * @param[in] resource ID of the resource
  417. * @param[in] clk clock/PLL to affect
  418. * @param[out] rate pointer to return rate
  419. *
  420. * @return Returns an error code (SC_ERR_NONE = success).
  421. *
  422. * Return errors:
  423. * - SC_ERR_PARM if invalid resource or clock/PLL,
  424. * - SC_ERR_NOACCESS if caller's partition is not the resource owner
  425. * or parent of the owner,
  426. * - SC_ERR_UNAVAILABLE if clock/PLL not applicable to this resource
  427. *
  428. * Refer to the [Clock List](@ref CLOCKS) for valid clock/PLL values.
  429. */
  430. sc_err_t sc_pm_get_clock_rate(sc_ipc_t ipc, sc_rsrc_t resource,
  431. sc_pm_clk_t clk, sc_pm_clock_rate_t *rate);
  432. /*!
  433. * This function enables/disables a resource's clock.
  434. *
  435. * @param[in] ipc IPC handle
  436. * @param[in] resource ID of the resource
  437. * @param[in] clk clock to affect
  438. * @param[in] enable enable if SC_TRUE; otherwise disabled
  439. * @param[in] autog HW auto clock gating
  440. *
  441. * If \a resource is SC_R_ALL then all resources owned will be affected.
  442. * No error will be returned.
  443. *
  444. * If \a clk is SC_PM_CLK_ALL, then an error will be returned if any
  445. * of the available clocks returns an error.
  446. *
  447. * @return Returns an error code (SC_ERR_NONE = success).
  448. *
  449. * Return errors:
  450. * - SC_ERR_PARM if invalid resource or clock,
  451. * - SC_ERR_NOACCESS if caller's partition is not the resource owner
  452. * or parent of the owner,
  453. * - SC_ERR_UNAVAILABLE if clock not applicable to this resource
  454. *
  455. * Refer to the [Clock List](@ref CLOCKS) for valid clock values.
  456. */
  457. sc_err_t sc_pm_clock_enable(sc_ipc_t ipc, sc_rsrc_t resource,
  458. sc_pm_clk_t clk, sc_bool_t enable, sc_bool_t autog);
  459. /*!
  460. * This function sets the parent of a resource's clock.
  461. * This function should only be called when the clock is disabled.
  462. *
  463. * @param[in] ipc IPC handle
  464. * @param[in] resource ID of the resource
  465. * @param[in] clk clock to affect
  466. * @param[in] parent New parent of the clock.
  467. *
  468. * @return Returns an error code (SC_ERR_NONE = success).
  469. *
  470. * Return errors:
  471. * - SC_ERR_PARM if invalid resource or clock,
  472. * - SC_ERR_NOACCESS if caller's partition is not the resource owner
  473. * or parent of the owner,
  474. * - SC_ERR_UNAVAILABLE if clock not applicable to this resource
  475. * - SC_ERR_BUSY if clock is currently enabled.
  476. * - SC_ERR_NOPOWER if resource not powered
  477. *
  478. * Refer to the [Clock List](@ref CLOCKS) for valid clock values.
  479. */
  480. sc_err_t sc_pm_set_clock_parent(sc_ipc_t ipc, sc_rsrc_t resource,
  481. sc_pm_clk_t clk, sc_pm_clk_parent_t parent);
  482. /*!
  483. * This function gets the parent of a resource's clock.
  484. *
  485. * @param[in] ipc IPC handle
  486. * @param[in] resource ID of the resource
  487. * @param[in] clk clock to affect
  488. * @param[out] parent pointer to return parent of clock.
  489. *
  490. * @return Returns an error code (SC_ERR_NONE = success).
  491. *
  492. * Return errors:
  493. * - SC_ERR_PARM if invalid resource or clock,
  494. * - SC_ERR_NOACCESS if caller's partition is not the resource owner
  495. * or parent of the owner,
  496. * - SC_ERR_UNAVAILABLE if clock not applicable to this resource
  497. *
  498. * Refer to the [Clock List](@ref CLOCKS) for valid clock values.
  499. */
  500. sc_err_t sc_pm_get_clock_parent(sc_ipc_t ipc, sc_rsrc_t resource,
  501. sc_pm_clk_t clk, sc_pm_clk_parent_t *parent);
  502. /* @} */
  503. /*!
  504. * @name Reset Functions
  505. * @{
  506. */
  507. /*!
  508. * This function is used to reset the system. Only the owner of the
  509. * SC_R_SYSTEM resource can do this.
  510. *
  511. * @param[in] ipc IPC handle
  512. * @param[in] type reset type
  513. *
  514. * @return Returns an error code (SC_ERR_NONE = success).
  515. *
  516. * Return errors:
  517. * - SC_ERR_PARM if invalid type,
  518. * - SC_ERR_NOACCESS if caller not the owner of SC_R_SYSTEM
  519. *
  520. * If this function returns, then the reset did not occur due to an
  521. * invalid parameter.
  522. */
  523. sc_err_t sc_pm_reset(sc_ipc_t ipc, sc_pm_reset_type_t type);
  524. /*!
  525. * This function gets a caller's reset reason.
  526. *
  527. * @param[in] ipc IPC handle
  528. * @param[out] reason pointer to return reset reason
  529. *
  530. * @return Returns an error code (SC_ERR_NONE = success).
  531. */
  532. sc_err_t sc_pm_reset_reason(sc_ipc_t ipc, sc_pm_reset_reason_t *reason);
  533. /*!
  534. * This function is used to boot a partition.
  535. *
  536. * @param[in] ipc IPC handle
  537. * @param[in] pt handle of partition to boot
  538. * @param[in] resource_cpu ID of the CPU resource to start
  539. * @param[in] boot_addr 64-bit boot address
  540. * @param[in] resource_mu ID of the MU that must be powered
  541. * @param[in] resource_dev ID of the boot device that must be powered
  542. *
  543. * @return Returns an error code (SC_ERR_NONE = success).
  544. *
  545. * Return errors:
  546. * - SC_ERR_PARM if invalid partition, resource, or addr,
  547. * - SC_ERR_NOACCESS if caller's partition is not the parent of the
  548. * partition to boot
  549. */
  550. sc_err_t sc_pm_boot(sc_ipc_t ipc, sc_rm_pt_t pt,
  551. sc_rsrc_t resource_cpu, sc_faddr_t boot_addr,
  552. sc_rsrc_t resource_mu, sc_rsrc_t resource_dev);
  553. /*!
  554. * This function is used to reboot the caller's partition.
  555. *
  556. * @param[in] ipc IPC handle
  557. * @param[in] type reset type
  558. *
  559. * If \a type is SC_PM_RESET_TYPE_COLD, then most peripherals owned by
  560. * the calling partition will be reset if possible. SC state (partitions,
  561. * power, clocks, etc.) is reset. The boot SW of the booting CPU must be
  562. * able to handle peripherals that that are not reset.
  563. *
  564. * If \a type is SC_PM_RESET_TYPE_WARM, then only the boot CPU is reset.
  565. * SC state (partitions, power, clocks, etc.) are NOT reset. The boot SW
  566. * of the booting CPU must be able to handle peripherals and SC state that
  567. * that are not reset.
  568. *
  569. * If \a type is SC_PM_RESET_TYPE_BOARD, then return with no action.
  570. *
  571. * If this function returns, then the reset did not occur due to an
  572. * invalid parameter.
  573. */
  574. void sc_pm_reboot(sc_ipc_t ipc, sc_pm_reset_type_t type);
  575. /*!
  576. * This function is used to reboot a partition.
  577. *
  578. * @param[in] ipc IPC handle
  579. * @param[in] pt handle of partition to reboot
  580. * @param[in] type reset type
  581. *
  582. * If \a type is SC_PM_RESET_TYPE_COLD, then most peripherals owned by
  583. * the calling partition will be reset if possible. SC state (partitions,
  584. * power, clocks, etc.) is reset. The boot SW of the booting CPU must be
  585. * able to handle peripherals that that are not reset.
  586. *
  587. * If \a type is SC_PM_RESET_TYPE_WARM, then only the boot CPU is reset.
  588. * SC state (partitions, power, clocks, etc.) are NOT reset. The boot SW
  589. * of the booting CPU must be able to handle peripherals and SC state that
  590. * that are not reset.
  591. *
  592. * If \a type is SC_PM_RESET_TYPE_BOARD, then return with no action.
  593. *
  594. * @return Returns an error code (SC_ERR_NONE = success).
  595. *
  596. * Return errors:
  597. * - SC_ERR_PARM if invalid partition or type
  598. * - SC_ERR_NOACCESS if caller's partition is not the parent of \a pt,
  599. *
  600. * Most peripherals owned by the partition will be reset if
  601. * possible. SC state (partitions, power, clocks, etc.) is reset. The
  602. * boot SW of the booting CPU must be able to handle peripherals that
  603. * that are not reset.
  604. */
  605. sc_err_t sc_pm_reboot_partition(sc_ipc_t ipc, sc_rm_pt_t pt,
  606. sc_pm_reset_type_t type);
  607. /*!
  608. * This function is used to start/stop a CPU.
  609. *
  610. * @param[in] ipc IPC handle
  611. * @param[in] resource ID of the CPU resource
  612. * @param[in] enable start if SC_TRUE; otherwise stop
  613. * @param[in] address 64-bit boot address
  614. *
  615. * @return Returns an error code (SC_ERR_NONE = success).
  616. *
  617. * Return errors:
  618. * - SC_ERR_PARM if invalid resource or address,
  619. * - SC_ERR_NOACCESS if caller's partition is not the parent of the
  620. * resource (CPU) owner
  621. */
  622. sc_err_t sc_pm_cpu_start(sc_ipc_t ipc, sc_rsrc_t resource, sc_bool_t enable,
  623. sc_faddr_t address);
  624. /* @} */
  625. #endif /* SCI_PM_API_H */
  626. /**@}*/