Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
e84ca571
Commit
e84ca571
authored
Mar 19, 2021
by
Madhukar Pappireddy
Committed by
TrustedFirmware Code Review
Mar 19, 2021
Browse files
Merge "plat: xilinx: versal: Mark IPI calls secure/non-secure" into integration
parents
2e0e51f4
4697164a
Changes
6
Show whitespace changes
Inline
Side-by-side
plat/xilinx/versal/include/plat_pm_common.h
View file @
e84ca571
...
@@ -19,6 +19,9 @@
...
@@ -19,6 +19,9 @@
#define PAYLOAD_ARG_CNT 6U
#define PAYLOAD_ARG_CNT 6U
#define PAYLOAD_ARG_SIZE 4U
/* size in bytes */
#define PAYLOAD_ARG_SIZE 4U
/* size in bytes */
#define NON_SECURE_FLAG 1U
#define SECURE_FLAG 0U
#define VERSAL_TZ_VERSION_MAJOR 1
#define VERSAL_TZ_VERSION_MAJOR 1
#define VERSAL_TZ_VERSION_MINOR 0
#define VERSAL_TZ_VERSION_MINOR 0
#define VERSAL_TZ_VERSION ((VERSAL_TZ_VERSION_MAJOR << 16) | \
#define VERSAL_TZ_VERSION ((VERSAL_TZ_VERSION_MAJOR << 16) | \
...
...
plat/xilinx/versal/plat_psci.c
View file @
e84ca571
...
@@ -33,7 +33,7 @@ static int versal_pwr_domain_on(u_register_t mpidr)
...
@@ -33,7 +33,7 @@ static int versal_pwr_domain_on(u_register_t mpidr)
/* Send request to PMC to wake up selected ACPU core */
/* Send request to PMC to wake up selected ACPU core */
pm_req_wakeup
(
proc
->
node_id
,
(
versal_sec_entry
&
0xFFFFFFFF
)
|
0x1
,
pm_req_wakeup
(
proc
->
node_id
,
(
versal_sec_entry
&
0xFFFFFFFF
)
|
0x1
,
versal_sec_entry
>>
32
,
0
);
versal_sec_entry
>>
32
,
0
,
SECURE_FLAG
);
/* Clear power down request */
/* Clear power down request */
pm_client_wakeup
(
proc
);
pm_client_wakeup
(
proc
);
...
@@ -67,7 +67,8 @@ static void versal_pwr_domain_suspend(const psci_power_state_t *target_state)
...
@@ -67,7 +67,8 @@ static void versal_pwr_domain_suspend(const psci_power_state_t *target_state)
PM_STATE_SUSPEND_TO_RAM
:
PM_STATE_CPU_IDLE
;
PM_STATE_SUSPEND_TO_RAM
:
PM_STATE_CPU_IDLE
;
/* Send request to PMC to suspend this core */
/* Send request to PMC to suspend this core */
pm_self_suspend
(
proc
->
node_id
,
MAX_LATENCY
,
state
,
versal_sec_entry
);
pm_self_suspend
(
proc
->
node_id
,
MAX_LATENCY
,
state
,
versal_sec_entry
,
SECURE_FLAG
);
/* APU is to be turned off */
/* APU is to be turned off */
if
(
target_state
->
pwr_domain_state
[
1
]
>
PLAT_MAX_RET_STATE
)
{
if
(
target_state
->
pwr_domain_state
[
1
]
>
PLAT_MAX_RET_STATE
)
{
...
@@ -123,7 +124,7 @@ static void __dead2 versal_system_off(void)
...
@@ -123,7 +124,7 @@ static void __dead2 versal_system_off(void)
{
{
/* Send the power down request to the PMC */
/* Send the power down request to the PMC */
pm_system_shutdown
(
XPM_SHUTDOWN_TYPE_SHUTDOWN
,
pm_system_shutdown
(
XPM_SHUTDOWN_TYPE_SHUTDOWN
,
pm_get_shutdown_scope
());
pm_get_shutdown_scope
()
,
SECURE_FLAG
);
while
(
1
)
while
(
1
)
wfi
();
wfi
();
...
@@ -137,7 +138,7 @@ static void __dead2 versal_system_reset(void)
...
@@ -137,7 +138,7 @@ static void __dead2 versal_system_reset(void)
{
{
/* Send the system reset request to the PMC */
/* Send the system reset request to the PMC */
pm_system_shutdown
(
XPM_SHUTDOWN_TYPE_RESET
,
pm_system_shutdown
(
XPM_SHUTDOWN_TYPE_RESET
,
pm_get_shutdown_scope
());
pm_get_shutdown_scope
()
,
SECURE_FLAG
);
while
(
1
)
while
(
1
)
wfi
();
wfi
();
...
@@ -168,7 +169,8 @@ static void versal_pwr_domain_off(const psci_power_state_t *target_state)
...
@@ -168,7 +169,8 @@ static void versal_pwr_domain_off(const psci_power_state_t *target_state)
* invoking CPU_on function, during which resume address will
* invoking CPU_on function, during which resume address will
* be set.
* be set.
*/
*/
pm_self_suspend
(
proc
->
node_id
,
MAX_LATENCY
,
PM_STATE_CPU_IDLE
,
0
);
pm_self_suspend
(
proc
->
node_id
,
MAX_LATENCY
,
PM_STATE_CPU_IDLE
,
0
,
SECURE_FLAG
);
}
}
/**
/**
...
...
plat/xilinx/versal/pm_service/pm_api_sys.c
View file @
e84ca571
...
@@ -38,33 +38,33 @@ unsigned int pm_get_shutdown_scope(void)
...
@@ -38,33 +38,33 @@ unsigned int pm_get_shutdown_scope(void)
/**
/**
* Assigning of argument values into array elements.
* Assigning of argument values into array elements.
*/
*/
#define PM_PACK_PAYLOAD1(pl, mid, arg0) { \
#define PM_PACK_PAYLOAD1(pl, mid,
flag,
arg0) { \
pl[0] = (uint32_t)((uint32_t)((arg0) & 0xFF) | (mid << 8)); \
pl[0] = (uint32_t)((uint32_t)((arg0) & 0xFF) | (mid << 8)
| ((flag) << 24)
); \
}
}
#define PM_PACK_PAYLOAD2(pl, mid, arg0, arg1) { \
#define PM_PACK_PAYLOAD2(pl, mid,
flag,
arg0, arg1) { \
pl[1] = (uint32_t)(arg1); \
pl[1] = (uint32_t)(arg1); \
PM_PACK_PAYLOAD1(pl, mid, arg0); \
PM_PACK_PAYLOAD1(pl, mid,
flag,
arg0);
\
}
}
#define PM_PACK_PAYLOAD3(pl, mid, arg0, arg1, arg2) { \
#define PM_PACK_PAYLOAD3(pl, mid,
flag,
arg0, arg1, arg2) { \
pl[2] = (uint32_t)(arg2); \
pl[2] = (uint32_t)(arg2); \
PM_PACK_PAYLOAD2(pl, mid, arg0, arg1); \
PM_PACK_PAYLOAD2(pl, mid,
flag,
arg0, arg1); \
}
}
#define PM_PACK_PAYLOAD4(pl, mid, arg0, arg1, arg2, arg3) { \
#define PM_PACK_PAYLOAD4(pl, mid,
flag,
arg0, arg1, arg2, arg3) { \
pl[3] = (uint32_t)(arg3); \
pl[3] = (uint32_t)(arg3); \
PM_PACK_PAYLOAD3(pl, mid, arg0, arg1, arg2); \
PM_PACK_PAYLOAD3(pl, mid,
flag,
arg0, arg1, arg2); \
}
}
#define PM_PACK_PAYLOAD5(pl, mid, arg0, arg1, arg2, arg3, arg4) { \
#define PM_PACK_PAYLOAD5(pl, mid,
flag,
arg0, arg1, arg2, arg3, arg4) { \
pl[4] = (uint32_t)(arg4); \
pl[4] = (uint32_t)(arg4); \
PM_PACK_PAYLOAD4(pl, mid, arg0, arg1, arg2, arg3);
\
PM_PACK_PAYLOAD4(pl, mid,
flag,
arg0, arg1, arg2, arg3); \
}
}
#define PM_PACK_PAYLOAD6(pl, mid, arg0, arg1, arg2, arg3, arg4, arg5) { \
#define PM_PACK_PAYLOAD6(pl, mid,
flag,
arg0, arg1, arg2, arg3, arg4, arg5) { \
pl[5] = (uint32_t)(arg5); \
pl[5] = (uint32_t)(arg5); \
PM_PACK_PAYLOAD5(pl, mid, arg0, arg1, arg2, arg3, arg4); \
PM_PACK_PAYLOAD5(pl, mid,
flag,
arg0, arg1, arg2, arg3, arg4);
\
}
}
/* PM API functions */
/* PM API functions */
...
@@ -72,15 +72,17 @@ unsigned int pm_get_shutdown_scope(void)
...
@@ -72,15 +72,17 @@ unsigned int pm_get_shutdown_scope(void)
/**
/**
* pm_get_api_version() - Get version number of PMC PM firmware
* pm_get_api_version() - Get version number of PMC PM firmware
* @version Returns 32-bit version number of PMC Power Management Firmware
* @version Returns 32-bit version number of PMC Power Management Firmware
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_get_api_version
(
unsigned
int
*
version
)
enum
pm_ret_status
pm_get_api_version
(
unsigned
int
*
version
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD1
(
payload
,
LIBPM_MODULE_ID
,
PM_GET_API_VERSION
);
PM_PACK_PAYLOAD1
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_GET_API_VERSION
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
version
,
1
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
version
,
1
);
}
}
...
@@ -88,15 +90,17 @@ enum pm_ret_status pm_get_api_version(unsigned int *version)
...
@@ -88,15 +90,17 @@ enum pm_ret_status pm_get_api_version(unsigned int *version)
* pm_init_finalize() - Call to notify PMC PM firmware that master has power
* pm_init_finalize() - Call to notify PMC PM firmware that master has power
* management enabled and that it has finished its
* management enabled and that it has finished its
* initialization
* initialization
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Status returned by the PMU firmware
* @return Status returned by the PMU firmware
*/
*/
enum
pm_ret_status
pm_init_finalize
(
void
)
enum
pm_ret_status
pm_init_finalize
(
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMU */
/* Send request to the PMU */
PM_PACK_PAYLOAD1
(
payload
,
LIBPM_MODULE_ID
,
PM_INIT_FINALIZE
);
PM_PACK_PAYLOAD1
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_INIT_FINALIZE
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
}
}
...
@@ -106,6 +110,8 @@ enum pm_ret_status pm_init_finalize(void)
...
@@ -106,6 +110,8 @@ enum pm_ret_status pm_init_finalize(void)
* @latency Requested maximum wakeup latency (not supported)
* @latency Requested maximum wakeup latency (not supported)
* @state Requested state
* @state Requested state
* @address Resume address
* @address Resume address
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* This is a blocking call, it will return only once PMU has responded.
* This is a blocking call, it will return only once PMU has responded.
* On a wakeup, resume address will be automatically set by PMU.
* On a wakeup, resume address will be automatically set by PMU.
...
@@ -115,7 +121,7 @@ enum pm_ret_status pm_init_finalize(void)
...
@@ -115,7 +121,7 @@ enum pm_ret_status pm_init_finalize(void)
enum
pm_ret_status
pm_self_suspend
(
uint32_t
nid
,
enum
pm_ret_status
pm_self_suspend
(
uint32_t
nid
,
unsigned
int
latency
,
unsigned
int
latency
,
unsigned
int
state
,
unsigned
int
state
,
uintptr_t
address
)
uintptr_t
address
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
unsigned
int
cpuid
=
plat_my_core_pos
();
unsigned
int
cpuid
=
plat_my_core_pos
();
...
@@ -133,7 +139,7 @@ enum pm_ret_status pm_self_suspend(uint32_t nid,
...
@@ -133,7 +139,7 @@ enum pm_ret_status pm_self_suspend(uint32_t nid,
pm_client_suspend
(
proc
,
state
);
pm_client_suspend
(
proc
,
state
);
/* Send request to the PLM */
/* Send request to the PLM */
PM_PACK_PAYLOAD6
(
payload
,
LIBPM_MODULE_ID
,
PM_SELF_SUSPEND
,
PM_PACK_PAYLOAD6
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_SELF_SUSPEND
,
proc
->
node_id
,
latency
,
state
,
address
,
proc
->
node_id
,
latency
,
state
,
address
,
(
address
>>
32
));
(
address
>>
32
));
return
pm_ipi_send_sync
(
proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
proc
,
payload
,
NULL
,
0
);
...
@@ -143,13 +149,15 @@ enum pm_ret_status pm_self_suspend(uint32_t nid,
...
@@ -143,13 +149,15 @@ enum pm_ret_status pm_self_suspend(uint32_t nid,
* pm_abort_suspend() - PM call to announce that a prior suspend request
* pm_abort_suspend() - PM call to announce that a prior suspend request
* is to be aborted.
* is to be aborted.
* @reason Reason for the abort
* @reason Reason for the abort
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* Calling PU expects the PMU to abort the initiated suspend procedure.
* Calling PU expects the PMU to abort the initiated suspend procedure.
* This is a non-blocking call without any acknowledge.
* This is a non-blocking call without any acknowledge.
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_abort_suspend
(
enum
pm_abort_reason
reason
)
enum
pm_ret_status
pm_abort_suspend
(
enum
pm_abort_reason
reason
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
...
@@ -160,8 +168,8 @@ enum pm_ret_status pm_abort_suspend(enum pm_abort_reason reason)
...
@@ -160,8 +168,8 @@ enum pm_ret_status pm_abort_suspend(enum pm_abort_reason reason)
pm_client_abort_suspend
();
pm_client_abort_suspend
();
/* Send request to the PLM */
/* Send request to the PLM */
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
PM_ABORT_SUSPEND
,
reason
,
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_ABORT_SUSPEND
,
primary_proc
->
node_id
);
reason
,
primary_proc
->
node_id
);
return
pm_ipi_send
(
primary_proc
,
payload
);
return
pm_ipi_send
(
primary_proc
,
payload
);
}
}
...
@@ -172,16 +180,19 @@ enum pm_ret_status pm_abort_suspend(enum pm_abort_reason reason)
...
@@ -172,16 +180,19 @@ enum pm_ret_status pm_abort_suspend(enum pm_abort_reason reason)
* @ack Flag to specify whether acknowledge is requested
* @ack Flag to specify whether acknowledge is requested
* @latency Requested wakeup latency (not supported)
* @latency Requested wakeup latency (not supported)
* @state Requested state (not supported)
* @state Requested state (not supported)
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_req_suspend
(
uint32_t
target
,
uint8_t
ack
,
enum
pm_ret_status
pm_req_suspend
(
uint32_t
target
,
uint8_t
ack
,
unsigned
int
latency
,
unsigned
int
state
)
unsigned
int
latency
,
unsigned
int
state
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMU */
/* Send request to the PMU */
PM_PACK_PAYLOAD4
(
payload
,
LIBPM_MODULE_ID
,
PM_REQ_SUSPEND
,
target
,
PM_PACK_PAYLOAD4
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_REQ_SUSPEND
,
target
,
latency
,
state
);
latency
,
state
);
if
(
ack
==
IPI_BLOCKING
)
if
(
ack
==
IPI_BLOCKING
)
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
...
@@ -197,6 +208,8 @@ enum pm_ret_status pm_req_suspend(uint32_t target, uint8_t ack,
...
@@ -197,6 +208,8 @@ enum pm_ret_status pm_req_suspend(uint32_t target, uint8_t ack,
* 1 - resume address specified, 0 - otherwise
* 1 - resume address specified, 0 - otherwise
* @address Resume address
* @address Resume address
* @ack Flag to specify whether acknowledge requested
* @ack Flag to specify whether acknowledge requested
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* This API function is either used to power up another APU core for SMP
* This API function is either used to power up another APU core for SMP
* (by PSCI) or to power up an entirely different PU or subsystem, such
* (by PSCI) or to power up an entirely different PU or subsystem, such
...
@@ -206,12 +219,12 @@ enum pm_ret_status pm_req_suspend(uint32_t target, uint8_t ack,
...
@@ -206,12 +219,12 @@ enum pm_ret_status pm_req_suspend(uint32_t target, uint8_t ack,
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_req_wakeup
(
uint32_t
target
,
uint32_t
set_address
,
enum
pm_ret_status
pm_req_wakeup
(
uint32_t
target
,
uint32_t
set_address
,
uintptr_t
address
,
uint8_t
ack
)
uintptr_t
address
,
uint8_t
ack
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC to perform the wake of the PU */
/* Send request to the PMC to perform the wake of the PU */
PM_PACK_PAYLOAD5
(
payload
,
LIBPM_MODULE_ID
,
PM_REQ_WAKEUP
,
target
,
PM_PACK_PAYLOAD5
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_REQ_WAKEUP
,
target
,
set_address
,
address
,
ack
);
set_address
,
address
,
ack
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
...
@@ -223,16 +236,18 @@ enum pm_ret_status pm_req_wakeup(uint32_t target, uint32_t set_address,
...
@@ -223,16 +236,18 @@ enum pm_ret_status pm_req_wakeup(uint32_t target, uint32_t set_address,
* @capabilities Requested capabilities for the device
* @capabilities Requested capabilities for the device
* @qos Required Quality of Service
* @qos Required Quality of Service
* @ack Flag to specify whether acknowledge requested
* @ack Flag to specify whether acknowledge requested
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_request_device
(
uint32_t
device_id
,
uint32_t
capabilities
,
enum
pm_ret_status
pm_request_device
(
uint32_t
device_id
,
uint32_t
capabilities
,
uint32_t
qos
,
uint32_t
ack
)
uint32_t
qos
,
uint32_t
ack
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD5
(
payload
,
LIBPM_MODULE_ID
,
PM_REQUEST_DEVICE
,
PM_PACK_PAYLOAD5
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_REQUEST_DEVICE
,
device_id
,
capabilities
,
qos
,
ack
);
device_id
,
capabilities
,
qos
,
ack
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
...
@@ -241,15 +256,17 @@ enum pm_ret_status pm_request_device(uint32_t device_id, uint32_t capabilities,
...
@@ -241,15 +256,17 @@ enum pm_ret_status pm_request_device(uint32_t device_id, uint32_t capabilities,
/**
/**
* pm_release_device() - Release a device
* pm_release_device() - Release a device
* @device_id Device ID
* @device_id Device ID
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_release_device
(
uint32_t
device_id
)
enum
pm_ret_status
pm_release_device
(
uint32_t
device_id
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
PM_RELEASE_DEVICE
,
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_RELEASE_DEVICE
,
device_id
);
device_id
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
...
@@ -261,16 +278,19 @@ enum pm_ret_status pm_release_device(uint32_t device_id)
...
@@ -261,16 +278,19 @@ enum pm_ret_status pm_release_device(uint32_t device_id)
* @capabilities Requested capabilities for the device
* @capabilities Requested capabilities for the device
* @latency Requested maximum latency
* @latency Requested maximum latency
* @qos Required Quality of Service
* @qos Required Quality of Service
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_set_requirement
(
uint32_t
device_id
,
uint32_t
capabilities
,
enum
pm_ret_status
pm_set_requirement
(
uint32_t
device_id
,
uint32_t
capabilities
,
uint32_t
latency
,
uint32_t
qos
)
uint32_t
latency
,
uint32_t
qos
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD5
(
payload
,
LIBPM_MODULE_ID
,
PM_SET_REQUIREMENT
,
PM_PACK_PAYLOAD5
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_SET_REQUIREMENT
,
device_id
,
capabilities
,
latency
,
qos
);
device_id
,
capabilities
,
latency
,
qos
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
...
@@ -280,15 +300,18 @@ enum pm_ret_status pm_set_requirement(uint32_t device_id, uint32_t capabilities,
...
@@ -280,15 +300,18 @@ enum pm_ret_status pm_set_requirement(uint32_t device_id, uint32_t capabilities,
* pm_get_device_status() - Get device's status
* pm_get_device_status() - Get device's status
* @device_id Device ID
* @device_id Device ID
* @response Buffer to store device status response
* @response Buffer to store device status response
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_get_device_status
(
uint32_t
device_id
,
uint32_t
*
response
)
enum
pm_ret_status
pm_get_device_status
(
uint32_t
device_id
,
uint32_t
*
response
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
PM_GET_DEVICE_STATUS
,
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_GET_DEVICE_STATUS
,
device_id
);
device_id
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
response
,
3
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
response
,
3
);
...
@@ -298,15 +321,17 @@ enum pm_ret_status pm_get_device_status(uint32_t device_id, uint32_t *response)
...
@@ -298,15 +321,17 @@ enum pm_ret_status pm_get_device_status(uint32_t device_id, uint32_t *response)
* pm_reset_assert() - Assert/De-assert reset
* pm_reset_assert() - Assert/De-assert reset
* @reset Reset ID
* @reset Reset ID
* @assert Assert (1) or de-assert (0)
* @assert Assert (1) or de-assert (0)
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_reset_assert
(
uint32_t
reset
,
bool
assert
)
enum
pm_ret_status
pm_reset_assert
(
uint32_t
reset
,
bool
assert
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
PM_RESET_ASSERT
,
reset
,
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_RESET_ASSERT
,
reset
,
assert
);
assert
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
...
@@ -316,15 +341,19 @@ enum pm_ret_status pm_reset_assert(uint32_t reset, bool assert)
...
@@ -316,15 +341,19 @@ enum pm_ret_status pm_reset_assert(uint32_t reset, bool assert)
* pm_reset_get_status() - Get current status of a reset line
* pm_reset_get_status() - Get current status of a reset line
* @reset Reset ID
* @reset Reset ID
* @status Returns current status of selected reset ID
* @status Returns current status of selected reset ID
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_reset_get_status
(
uint32_t
reset
,
uint32_t
*
status
)
enum
pm_ret_status
pm_reset_get_status
(
uint32_t
reset
,
uint32_t
*
status
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
PM_RESET_ASSERT
,
reset
);
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_RESET_ASSERT
,
reset
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
status
,
1
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
status
,
1
);
}
}
...
@@ -332,10 +361,12 @@ enum pm_ret_status pm_reset_get_status(uint32_t reset, uint32_t *status)
...
@@ -332,10 +361,12 @@ enum pm_ret_status pm_reset_get_status(uint32_t reset, uint32_t *status)
/**
/**
* pm_get_callbackdata() - Read from IPI response buffer
* pm_get_callbackdata() - Read from IPI response buffer
* @data - array of PAYLOAD_ARG_CNT elements
* @data - array of PAYLOAD_ARG_CNT elements
* @flag - 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* Read value from ipi buffer response buffer.
* Read value from ipi buffer response buffer.
*/
*/
void
pm_get_callbackdata
(
uint32_t
*
data
,
size_t
count
)
void
pm_get_callbackdata
(
uint32_t
*
data
,
size_t
count
,
uint32_t
flag
)
{
{
/* Return if interrupt is not from PMU */
/* Return if interrupt is not from PMU */
if
(
!
pm_ipi_irq_status
(
primary_proc
))
if
(
!
pm_ipi_irq_status
(
primary_proc
))
...
@@ -348,15 +379,18 @@ void pm_get_callbackdata(uint32_t *data, size_t count)
...
@@ -348,15 +379,18 @@ void pm_get_callbackdata(uint32_t *data, size_t count)
/**
/**
* pm_pinctrl_request() - Request a pin
* pm_pinctrl_request() - Request a pin
* @pin Pin ID
* @pin Pin ID
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_pinctrl_request
(
uint32_t
pin
)
enum
pm_ret_status
pm_pinctrl_request
(
uint32_t
pin
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
PM_PINCTRL_REQUEST
,
pin
);
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_PINCTRL_REQUEST
,
pin
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
}
}
...
@@ -364,15 +398,18 @@ enum pm_ret_status pm_pinctrl_request(uint32_t pin)
...
@@ -364,15 +398,18 @@ enum pm_ret_status pm_pinctrl_request(uint32_t pin)
/**
/**
* pm_pinctrl_release() - Release a pin
* pm_pinctrl_release() - Release a pin
* @pin Pin ID
* @pin Pin ID
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_pinctrl_release
(
uint32_t
pin
)
enum
pm_ret_status
pm_pinctrl_release
(
uint32_t
pin
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
PM_PINCTRL_RELEASE
,
pin
);
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_PINCTRL_RELEASE
,
pin
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
}
}
...
@@ -381,16 +418,19 @@ enum pm_ret_status pm_pinctrl_release(uint32_t pin)
...
@@ -381,16 +418,19 @@ enum pm_ret_status pm_pinctrl_release(uint32_t pin)
* pm_pinctrl_set_function() - Set pin function
* pm_pinctrl_set_function() - Set pin function
* @pin Pin ID
* @pin Pin ID
* @function Function ID
* @function Function ID
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_pinctrl_set_function
(
uint32_t
pin
,
uint32_t
function
)
enum
pm_ret_status
pm_pinctrl_set_function
(
uint32_t
pin
,
uint32_t
function
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
PM_PINCTRL_SET_FUNCTION
,
pin
,
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
flag
,
function
)
PM_PINCTRL_SET_FUNCTION
,
pin
,
function
)
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
}
}
...
@@ -399,16 +439,19 @@ enum pm_ret_status pm_pinctrl_set_function(uint32_t pin, uint32_t function)
...
@@ -399,16 +439,19 @@ enum pm_ret_status pm_pinctrl_set_function(uint32_t pin, uint32_t function)
* pm_pinctrl_get_function() - Get function set on the pin
* pm_pinctrl_get_function() - Get function set on the pin
* @pin Pin ID
* @pin Pin ID
* @function Function set on the pin
* @function Function set on the pin
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_pinctrl_get_function
(
uint32_t
pin
,
uint32_t
*
function
)
enum
pm_ret_status
pm_pinctrl_get_function
(
uint32_t
pin
,
uint32_t
*
function
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
PM_PINCTRL_SET_FUNCTION
,
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
flag
,
pin
);
PM_PINCTRL_SET_FUNCTION
,
pin
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
function
,
1
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
function
,
1
);
}
}
...
@@ -418,17 +461,19 @@ enum pm_ret_status pm_pinctrl_get_function(uint32_t pin, uint32_t *function)
...
@@ -418,17 +461,19 @@ enum pm_ret_status pm_pinctrl_get_function(uint32_t pin, uint32_t *function)
* @pin Pin ID
* @pin Pin ID
* @param Parameter ID
* @param Parameter ID
* @value Parameter value
* @value Parameter value
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_pinctrl_set_pin_param
(
uint32_t
pin
,
uint32_t
param
,
enum
pm_ret_status
pm_pinctrl_set_pin_param
(
uint32_t
pin
,
uint32_t
param
,
uint32_t
value
)
uint32_t
value
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD4
(
payload
,
LIBPM_MODULE_ID
,
PM_PINCTRL_CONFIG_PARAM_SET
,
PM_PACK_PAYLOAD4
(
payload
,
LIBPM_MODULE_ID
,
flag
,
pin
,
param
,
value
);
PM_PINCTRL_CONFIG_PARAM_SET
,
pin
,
param
,
value
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
}
}
...
@@ -438,17 +483,19 @@ enum pm_ret_status pm_pinctrl_set_pin_param(uint32_t pin, uint32_t param,
...
@@ -438,17 +483,19 @@ enum pm_ret_status pm_pinctrl_set_pin_param(uint32_t pin, uint32_t param,
* @pin Pin ID
* @pin Pin ID
* @param Parameter ID
* @param Parameter ID
* @value Buffer to store parameter value
* @value Buffer to store parameter value
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_pinctrl_get_pin_param
(
uint32_t
pin
,
uint32_t
param
,
enum
pm_ret_status
pm_pinctrl_get_pin_param
(
uint32_t
pin
,
uint32_t
param
,
uint32_t
*
value
)
uint32_t
*
value
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
PM_PINCTRL_CONFIG_PARAM_GET
,
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
flag
,
pin
,
param
);
PM_PINCTRL_CONFIG_PARAM_GET
,
pin
,
param
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
value
,
1
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
value
,
1
);
}
}
...
@@ -456,15 +503,18 @@ enum pm_ret_status pm_pinctrl_get_pin_param(uint32_t pin, uint32_t param,
...
@@ -456,15 +503,18 @@ enum pm_ret_status pm_pinctrl_get_pin_param(uint32_t pin, uint32_t param,
/**
/**
* pm_clock_enable() - Enable the clock
* pm_clock_enable() - Enable the clock
* @clk_id Clock ID
* @clk_id Clock ID
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_clock_enable
(
uint32_t
clk_id
)
enum
pm_ret_status
pm_clock_enable
(
uint32_t
clk_id
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
PM_CLOCK_ENABLE
,
clk_id
);
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_CLOCK_ENABLE
,
clk_id
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
}
}
...
@@ -472,15 +522,18 @@ enum pm_ret_status pm_clock_enable(uint32_t clk_id)
...
@@ -472,15 +522,18 @@ enum pm_ret_status pm_clock_enable(uint32_t clk_id)
/**
/**
* pm_clock_disable() - Disable the clock
* pm_clock_disable() - Disable the clock
* @clk_id Clock ID
* @clk_id Clock ID
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_clock_disable
(
uint32_t
clk_id
)
enum
pm_ret_status
pm_clock_disable
(
uint32_t
clk_id
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
PM_CLOCK_DISABLE
,
clk_id
);
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_CLOCK_DISABLE
,
clk_id
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
}
}
...
@@ -489,15 +542,19 @@ enum pm_ret_status pm_clock_disable(uint32_t clk_id)
...
@@ -489,15 +542,19 @@ enum pm_ret_status pm_clock_disable(uint32_t clk_id)
* pm_clock_get_state() - Get clock status
* pm_clock_get_state() - Get clock status
* @clk_id Clock ID
* @clk_id Clock ID
* @state: Buffer to store clock status (1: Enabled, 0:Disabled)
* @state: Buffer to store clock status (1: Enabled, 0:Disabled)
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_clock_get_state
(
uint32_t
clk_id
,
uint32_t
*
state
)
enum
pm_ret_status
pm_clock_get_state
(
uint32_t
clk_id
,
uint32_t
*
state
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
PM_CLOCK_GETSTATE
,
clk_id
);
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_CLOCK_GETSTATE
,
clk_id
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
state
,
1
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
state
,
1
);
}
}
...
@@ -506,16 +563,19 @@ enum pm_ret_status pm_clock_get_state(uint32_t clk_id, uint32_t *state)
...
@@ -506,16 +563,19 @@ enum pm_ret_status pm_clock_get_state(uint32_t clk_id, uint32_t *state)
* pm_clock_set_divider() - Set divider for the clock
* pm_clock_set_divider() - Set divider for the clock
* @clk_id Clock ID
* @clk_id Clock ID
* @divider Divider value
* @divider Divider value
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_clock_set_divider
(
uint32_t
clk_id
,
uint32_t
divider
)
enum
pm_ret_status
pm_clock_set_divider
(
uint32_t
clk_id
,
uint32_t
divider
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
PM_CLOCK_SETDIVIDER
,
clk_id
,
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_CLOCK_SETDIVIDER
,
divider
);
clk_id
,
divider
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
}
}
...
@@ -524,15 +584,19 @@ enum pm_ret_status pm_clock_set_divider(uint32_t clk_id, uint32_t divider)
...
@@ -524,15 +584,19 @@ enum pm_ret_status pm_clock_set_divider(uint32_t clk_id, uint32_t divider)
* pm_clock_get_divider() - Get divider value for the clock
* pm_clock_get_divider() - Get divider value for the clock
* @clk_id Clock ID
* @clk_id Clock ID
* @divider: Buffer to store clock divider value
* @divider: Buffer to store clock divider value
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_clock_get_divider
(
uint32_t
clk_id
,
uint32_t
*
divider
)
enum
pm_ret_status
pm_clock_get_divider
(
uint32_t
clk_id
,
uint32_t
*
divider
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
PM_CLOCK_GETDIVIDER
,
clk_id
);
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_CLOCK_GETDIVIDER
,
clk_id
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
divider
,
1
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
divider
,
1
);
}
}
...
@@ -541,16 +605,19 @@ enum pm_ret_status pm_clock_get_divider(uint32_t clk_id, uint32_t *divider)
...
@@ -541,16 +605,19 @@ enum pm_ret_status pm_clock_get_divider(uint32_t clk_id, uint32_t *divider)
* pm_clock_set_parent() - Set parent for the clock
* pm_clock_set_parent() - Set parent for the clock
* @clk_id Clock ID
* @clk_id Clock ID
* @parent Parent ID
* @parent Parent ID
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_clock_set_parent
(
uint32_t
clk_id
,
uint32_t
parent
)
enum
pm_ret_status
pm_clock_set_parent
(
uint32_t
clk_id
,
uint32_t
parent
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
PM_CLOCK_SETPARENT
,
clk_id
,
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_CLOCK_SETPARENT
,
parent
);
clk_id
,
parent
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
}
}
...
@@ -559,15 +626,19 @@ enum pm_ret_status pm_clock_set_parent(uint32_t clk_id, uint32_t parent)
...
@@ -559,15 +626,19 @@ enum pm_ret_status pm_clock_set_parent(uint32_t clk_id, uint32_t parent)
* pm_clock_get_parent() - Get parent value for the clock
* pm_clock_get_parent() - Get parent value for the clock
* @clk_id Clock ID
* @clk_id Clock ID
* @parent: Buffer to store clock parent value
* @parent: Buffer to store clock parent value
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_clock_get_parent
(
uint32_t
clk_id
,
uint32_t
*
parent
)
enum
pm_ret_status
pm_clock_get_parent
(
uint32_t
clk_id
,
uint32_t
*
parent
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
PM_CLOCK_GETPARENT
,
clk_id
);
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_CLOCK_GETPARENT
,
clk_id
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
parent
,
1
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
parent
,
1
);
}
}
...
@@ -575,15 +646,19 @@ enum pm_ret_status pm_clock_get_parent(uint32_t clk_id, uint32_t *parent)
...
@@ -575,15 +646,19 @@ enum pm_ret_status pm_clock_get_parent(uint32_t clk_id, uint32_t *parent)
* pm_clock_get_rate() - Get the rate value for the clock
* pm_clock_get_rate() - Get the rate value for the clock
* @clk_id Clock ID
* @clk_id Clock ID
* @rate: Buffer to store clock rate value
* @rate: Buffer to store clock rate value
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_clock_get_rate
(
uint32_t
clk_id
,
uint32_t
*
clk_rate
)
enum
pm_ret_status
pm_clock_get_rate
(
uint32_t
clk_id
,
uint32_t
*
clk_rate
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
PM_CLOCK_GETRATE
,
clk_id
);
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_CLOCK_GETRATE
,
clk_id
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
clk_rate
,
2
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
clk_rate
,
2
);
}
}
...
@@ -593,17 +668,19 @@ enum pm_ret_status pm_clock_get_rate(uint32_t clk_id, uint32_t *clk_rate)
...
@@ -593,17 +668,19 @@ enum pm_ret_status pm_clock_get_rate(uint32_t clk_id, uint32_t *clk_rate)
* @clk_id PLL clock ID
* @clk_id PLL clock ID
* @param PLL parameter ID
* @param PLL parameter ID
* @value Value to set for PLL parameter
* @value Value to set for PLL parameter
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_pll_set_param
(
uint32_t
clk_id
,
uint32_t
param
,
enum
pm_ret_status
pm_pll_set_param
(
uint32_t
clk_id
,
uint32_t
param
,
uint32_t
value
)
uint32_t
value
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD4
(
payload
,
LIBPM_MODULE_ID
,
PM_PLL_SET_PARAMETER
,
clk_id
,
PM_PACK_PAYLOAD4
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_PLL_SET_PARAMETER
,
param
,
value
);
clk_id
,
param
,
value
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
}
}
...
@@ -613,17 +690,19 @@ enum pm_ret_status pm_pll_set_param(uint32_t clk_id, uint32_t param,
...
@@ -613,17 +690,19 @@ enum pm_ret_status pm_pll_set_param(uint32_t clk_id, uint32_t param,
* @clk_id PLL clock ID
* @clk_id PLL clock ID
* @param PLL parameter ID
* @param PLL parameter ID
* @value: Buffer to store PLL parameter value
* @value: Buffer to store PLL parameter value
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_pll_get_param
(
uint32_t
clk_id
,
uint32_t
param
,
enum
pm_ret_status
pm_pll_get_param
(
uint32_t
clk_id
,
uint32_t
param
,
uint32_t
*
value
)
uint32_t
*
value
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
PM_PLL_GET_PARAMETER
,
clk_id
,
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_PLL_GET_PARAMETER
,
param
);
clk_id
,
param
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
value
,
1
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
value
,
1
);
}
}
...
@@ -632,16 +711,19 @@ enum pm_ret_status pm_pll_get_param(uint32_t clk_id, uint32_t param,
...
@@ -632,16 +711,19 @@ enum pm_ret_status pm_pll_get_param(uint32_t clk_id, uint32_t param,
* pm_pll_set_mode() - Set PLL mode
* pm_pll_set_mode() - Set PLL mode
* @clk_id PLL clock ID
* @clk_id PLL clock ID
* @mode PLL mode
* @mode PLL mode
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_pll_set_mode
(
uint32_t
clk_id
,
uint32_t
mode
)
enum
pm_ret_status
pm_pll_set_mode
(
uint32_t
clk_id
,
uint32_t
mode
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
PM_PLL_SET_MODE
,
clk_id
,
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_PLL_SET_MODE
,
mode
);
clk_id
,
mode
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
}
}
...
@@ -650,15 +732,19 @@ enum pm_ret_status pm_pll_set_mode(uint32_t clk_id, uint32_t mode)
...
@@ -650,15 +732,19 @@ enum pm_ret_status pm_pll_set_mode(uint32_t clk_id, uint32_t mode)
* pm_pll_get_mode() - Get PLL mode
* pm_pll_get_mode() - Get PLL mode
* @clk_id PLL clock ID
* @clk_id PLL clock ID
* @mode: Buffer to store PLL mode
* @mode: Buffer to store PLL mode
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_pll_get_mode
(
uint32_t
clk_id
,
uint32_t
*
mode
)
enum
pm_ret_status
pm_pll_get_mode
(
uint32_t
clk_id
,
uint32_t
*
mode
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
PM_PLL_GET_MODE
,
clk_id
);
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_PLL_GET_MODE
,
clk_id
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
mode
,
1
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
mode
,
1
);
}
}
...
@@ -668,16 +754,19 @@ enum pm_ret_status pm_pll_get_mode(uint32_t clk_id, uint32_t *mode)
...
@@ -668,16 +754,19 @@ enum pm_ret_status pm_pll_get_mode(uint32_t clk_id, uint32_t *mode)
* be powered down forcefully
* be powered down forcefully
* @target Device ID of the PU node to be forced powered down.
* @target Device ID of the PU node to be forced powered down.
* @ack Flag to specify whether acknowledge is requested
* @ack Flag to specify whether acknowledge is requested
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_force_powerdown
(
uint32_t
target
,
uint8_t
ack
)
enum
pm_ret_status
pm_force_powerdown
(
uint32_t
target
,
uint8_t
ack
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
PM_FORCE_POWERDOWN
,
target
,
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_FORCE_POWERDOWN
,
ack
);
target
,
ack
);
if
(
ack
==
IPI_BLOCKING
)
if
(
ack
==
IPI_BLOCKING
)
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
...
@@ -689,10 +778,13 @@ enum pm_ret_status pm_force_powerdown(uint32_t target, uint8_t ack)
...
@@ -689,10 +778,13 @@ enum pm_ret_status pm_force_powerdown(uint32_t target, uint8_t ack)
* pm_system_shutdown() - PM call to request a system shutdown or restart
* pm_system_shutdown() - PM call to request a system shutdown or restart
* @type Shutdown or restart? 0=shutdown, 1=restart, 2=setscope
* @type Shutdown or restart? 0=shutdown, 1=restart, 2=setscope
* @subtype Scope: 0=APU-subsystem, 1=PS, 2=system
* @subtype Scope: 0=APU-subsystem, 1=PS, 2=system
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_system_shutdown
(
uint32_t
type
,
uint32_t
subtype
)
enum
pm_ret_status
pm_system_shutdown
(
uint32_t
type
,
uint32_t
subtype
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
...
@@ -703,8 +795,8 @@ enum pm_ret_status pm_system_shutdown(uint32_t type, uint32_t subtype)
...
@@ -703,8 +795,8 @@ enum pm_ret_status pm_system_shutdown(uint32_t type, uint32_t subtype)
}
}
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
PM_SYSTEM_SHUTDOWN
,
type
,
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_SYSTEM_SHUTDOWN
,
subtype
);
type
,
subtype
);
return
pm_ipi_send_non_blocking
(
primary_proc
,
payload
);
return
pm_ipi_send_non_blocking
(
primary_proc
,
payload
);
}
}
...
@@ -716,11 +808,13 @@ enum pm_ret_status pm_system_shutdown(uint32_t type, uint32_t subtype)
...
@@ -716,11 +808,13 @@ enum pm_ret_status pm_system_shutdown(uint32_t type, uint32_t subtype)
* @arg2 Argument 2 to requested query data call
* @arg2 Argument 2 to requested query data call
* @arg3 Argument 3 to requested query data call
* @arg3 Argument 3 to requested query data call
* @data Returned output data
* @data Returned output data
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* This function returns requested data.
* This function returns requested data.
*/
*/
enum
pm_ret_status
pm_query_data
(
uint32_t
qid
,
uint32_t
arg1
,
uint32_t
arg2
,
enum
pm_ret_status
pm_query_data
(
uint32_t
qid
,
uint32_t
arg1
,
uint32_t
arg2
,
uint32_t
arg3
,
uint32_t
*
data
)
uint32_t
arg3
,
uint32_t
*
data
,
uint32_t
flag
)
{
{
uint32_t
ret
;
uint32_t
ret
;
uint32_t
version
;
uint32_t
version
;
...
@@ -728,10 +822,10 @@ enum pm_ret_status pm_query_data(uint32_t qid, uint32_t arg1, uint32_t arg2,
...
@@ -728,10 +822,10 @@ enum pm_ret_status pm_query_data(uint32_t qid, uint32_t arg1, uint32_t arg2,
uint32_t
fw_api_version
;
uint32_t
fw_api_version
;
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD5
(
payload
,
LIBPM_MODULE_ID
,
PM_QUERY_DATA
,
qid
,
arg1
,
PM_PACK_PAYLOAD5
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_QUERY_DATA
,
qid
,
arg2
,
arg3
);
arg1
,
arg2
,
arg3
);
ret
=
pm_feature_check
(
PM_QUERY_DATA
,
&
version
);
ret
=
pm_feature_check
(
PM_QUERY_DATA
,
&
version
,
flag
);
if
(
PM_RET_SUCCESS
==
ret
)
{
if
(
PM_RET_SUCCESS
==
ret
)
{
fw_api_version
=
version
&
0xFFFF
;
fw_api_version
=
version
&
0xFFFF
;
if
((
2U
==
fw_api_version
)
&&
if
((
2U
==
fw_api_version
)
&&
...
@@ -755,29 +849,32 @@ enum pm_ret_status pm_query_data(uint32_t qid, uint32_t arg1, uint32_t arg2,
...
@@ -755,29 +849,32 @@ enum pm_ret_status pm_query_data(uint32_t qid, uint32_t arg1, uint32_t arg2,
* @arg1 Argument 1 to requested IOCTL call
* @arg1 Argument 1 to requested IOCTL call
* @arg2 Argument 2 to requested IOCTL call
* @arg2 Argument 2 to requested IOCTL call
* @value Returned output value
* @value Returned output value
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* This function calls IOCTL to firmware for device control and configuration.
* This function calls IOCTL to firmware for device control and configuration.
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_api_ioctl
(
uint32_t
device_id
,
uint32_t
ioctl_id
,
enum
pm_ret_status
pm_api_ioctl
(
uint32_t
device_id
,
uint32_t
ioctl_id
,
uint32_t
arg1
,
uint32_t
arg2
,
uint32_t
*
value
)
uint32_t
arg1
,
uint32_t
arg2
,
uint32_t
*
value
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
switch
(
ioctl_id
)
{
switch
(
ioctl_id
)
{
case
IOCTL_SET_PLL_FRAC_MODE
:
case
IOCTL_SET_PLL_FRAC_MODE
:
return
pm_pll_set_mode
(
arg1
,
arg2
);
return
pm_pll_set_mode
(
arg1
,
arg2
,
flag
);
case
IOCTL_GET_PLL_FRAC_MODE
:
case
IOCTL_GET_PLL_FRAC_MODE
:
return
pm_pll_get_mode
(
arg1
,
value
);
return
pm_pll_get_mode
(
arg1
,
value
,
flag
);
case
IOCTL_SET_PLL_FRAC_DATA
:
case
IOCTL_SET_PLL_FRAC_DATA
:
return
pm_pll_set_param
(
arg1
,
PM_PLL_PARAM_DATA
,
arg2
);
return
pm_pll_set_param
(
arg1
,
PM_PLL_PARAM_DATA
,
arg2
,
flag
);
case
IOCTL_GET_PLL_FRAC_DATA
:
case
IOCTL_GET_PLL_FRAC_DATA
:
return
pm_pll_get_param
(
arg1
,
PM_PLL_PARAM_DATA
,
value
);
return
pm_pll_get_param
(
arg1
,
PM_PLL_PARAM_DATA
,
value
,
flag
);
default:
default:
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD5
(
payload
,
LIBPM_MODULE_ID
,
PM_IOCTL
,
device_id
,
PM_PACK_PAYLOAD5
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_IOCTL
,
ioctl_id
,
arg1
,
arg2
);
device_id
,
ioctl_id
,
arg1
,
arg2
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
value
,
1
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
value
,
1
);
}
}
}
}
...
@@ -787,16 +884,18 @@ enum pm_ret_status pm_api_ioctl(uint32_t device_id, uint32_t ioctl_id,
...
@@ -787,16 +884,18 @@ enum pm_ret_status pm_api_ioctl(uint32_t device_id, uint32_t ioctl_id,
* @target Device id of the targeted PU or subsystem
* @target Device id of the targeted PU or subsystem
* @wkup_node Device id of the wakeup peripheral
* @wkup_node Device id of the wakeup peripheral
* @enable Enable or disable the specified peripheral as wake source
* @enable Enable or disable the specified peripheral as wake source
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_set_wakeup_source
(
uint32_t
target
,
uint32_t
wkup_device
,
enum
pm_ret_status
pm_set_wakeup_source
(
uint32_t
target
,
uint32_t
wkup_device
,
uint8_t
enable
)
uint8_t
enable
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
PM_PACK_PAYLOAD4
(
payload
,
LIBPM_MODULE_ID
,
PM_SET_WAKEUP_SOURCE
,
target
,
PM_PACK_PAYLOAD4
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_SET_WAKEUP_SOURCE
,
wkup_device
,
enable
);
target
,
wkup_device
,
enable
);
return
pm_ipi_send
(
primary_proc
,
payload
);
return
pm_ipi_send
(
primary_proc
,
payload
);
}
}
...
@@ -804,15 +903,17 @@ enum pm_ret_status pm_set_wakeup_source(uint32_t target, uint32_t wkup_device,
...
@@ -804,15 +903,17 @@ enum pm_ret_status pm_set_wakeup_source(uint32_t target, uint32_t wkup_device,
* pm_get_chipid() - Read silicon ID registers
* pm_get_chipid() - Read silicon ID registers
* @value Buffer for return values. Must be large enough
* @value Buffer for return values. Must be large enough
* to hold 8 bytes.
* to hold 8 bytes.
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns silicon ID registers
* @return Returns silicon ID registers
*/
*/
enum
pm_ret_status
pm_get_chipid
(
uint32_t
*
value
)
enum
pm_ret_status
pm_get_chipid
(
uint32_t
*
value
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD1
(
payload
,
LIBPM_MODULE_ID
,
PM_GET_CHIPID
);
PM_PACK_PAYLOAD1
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_GET_CHIPID
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
value
,
2
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
value
,
2
);
}
}
...
@@ -821,10 +922,13 @@ enum pm_ret_status pm_get_chipid(uint32_t *value)
...
@@ -821,10 +922,13 @@ enum pm_ret_status pm_get_chipid(uint32_t *value)
* pm_feature_check() - Returns the supported API version if supported
* pm_feature_check() - Returns the supported API version if supported
* @api_id API ID to check
* @api_id API ID to check
* @value Returned supported API version
* @value Returned supported API version
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_feature_check
(
uint32_t
api_id
,
unsigned
int
*
version
)
enum
pm_ret_status
pm_feature_check
(
uint32_t
api_id
,
unsigned
int
*
version
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
],
fw_api_version
;
uint32_t
payload
[
PAYLOAD_ARG_CNT
],
fw_api_version
;
uint32_t
status
;
uint32_t
status
;
...
@@ -884,7 +988,8 @@ enum pm_ret_status pm_feature_check(uint32_t api_id, unsigned int *version)
...
@@ -884,7 +988,8 @@ enum pm_ret_status pm_feature_check(uint32_t api_id, unsigned int *version)
return
PM_RET_ERROR_NOFEATURE
;
return
PM_RET_ERROR_NOFEATURE
;
}
}
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
PM_FEATURE_CHECK
,
api_id
);
PM_PACK_PAYLOAD2
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_FEATURE_CHECK
,
api_id
);
status
=
pm_ipi_send_sync
(
primary_proc
,
payload
,
&
fw_api_version
,
1
);
status
=
pm_ipi_send_sync
(
primary_proc
,
payload
,
&
fw_api_version
,
1
);
if
(
status
!=
PM_RET_SUCCESS
)
if
(
status
!=
PM_RET_SUCCESS
)
...
@@ -903,16 +1008,18 @@ enum pm_ret_status pm_feature_check(uint32_t api_id, unsigned int *version)
...
@@ -903,16 +1008,18 @@ enum pm_ret_status pm_feature_check(uint32_t api_id, unsigned int *version)
* src: Source device of pdi(DDR, OCM, SD etc)
* src: Source device of pdi(DDR, OCM, SD etc)
* address_low: lower 32-bit Linear memory space address
* address_low: lower 32-bit Linear memory space address
* address_high: higher 32-bit Linear memory space address
* address_high: higher 32-bit Linear memory space address
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_load_pdi
(
uint32_t
src
,
enum
pm_ret_status
pm_load_pdi
(
uint32_t
src
,
uint32_t
address_low
,
uint32_t
address_
low
,
uint32_t
address_high
)
uint32_t
address_
high
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMU */
/* Send request to the PMU */
PM_PACK_PAYLOAD4
(
payload
,
LOADER_MODULE_ID
,
PM_LOAD_PDI
,
src
,
PM_PACK_PAYLOAD4
(
payload
,
LOADER_MODULE_ID
,
flag
,
PM_LOAD_PDI
,
src
,
address_high
,
address_low
);
address_high
,
address_low
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
}
}
...
@@ -925,18 +1032,20 @@ enum pm_ret_status pm_load_pdi(uint32_t src,
...
@@ -925,18 +1032,20 @@ enum pm_ret_status pm_load_pdi(uint32_t src,
* (power, temperature and latency)
* (power, temperature and latency)
* @result Returns the operating characteristic for the requested device,
* @result Returns the operating characteristic for the requested device,
* specified by the type
* specified by the type
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_get_op_characteristic
(
uint32_t
device_id
,
enum
pm_ret_status
pm_get_op_characteristic
(
uint32_t
device_id
,
enum
pm_opchar_type
type
,
enum
pm_opchar_type
type
,
uint32_t
*
result
)
uint32_t
*
result
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
PM_GET_OP_CHARACTERISTIC
,
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
flag
,
device_id
,
type
);
PM_GET_OP_CHARACTERISTIC
,
device_id
,
type
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
result
,
1
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
result
,
1
);
}
}
...
@@ -946,15 +1055,18 @@ enum pm_ret_status pm_get_op_characteristic(uint32_t device_id,
...
@@ -946,15 +1055,18 @@ enum pm_ret_status pm_get_op_characteristic(uint32_t device_id,
* used by that CPU.
* used by that CPU.
* @device_id Device ID
* @device_id Device ID
* @latency Latency value
* @latency Latency value
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_set_max_latency
(
uint32_t
device_id
,
uint32_t
latency
)
enum
pm_ret_status
pm_set_max_latency
(
uint32_t
device_id
,
uint32_t
latency
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
PM_SET_MAX_LATENCY
,
PM_PACK_PAYLOAD3
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_SET_MAX_LATENCY
,
device_id
,
latency
);
device_id
,
latency
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
...
@@ -967,16 +1079,19 @@ enum pm_ret_status pm_set_max_latency(uint32_t device_id, uint32_t latency)
...
@@ -967,16 +1079,19 @@ enum pm_ret_status pm_set_max_latency(uint32_t device_id, uint32_t latency)
* @event Event in question
* @event Event in question
* @wake Wake subsystem upon capturing the event if value 1
* @wake Wake subsystem upon capturing the event if value 1
* @enable Enable the registration for value 1, disable for value 0
* @enable Enable the registration for value 1, disable for value 0
* @flag 0 - Call from secure source
* 1 - Call from non-secure source
*
*
* @return Returns status, either success or error+reason
* @return Returns status, either success or error+reason
*/
*/
enum
pm_ret_status
pm_register_notifier
(
uint32_t
device_id
,
uint32_t
event
,
enum
pm_ret_status
pm_register_notifier
(
uint32_t
device_id
,
uint32_t
event
,
uint32_t
wake
,
uint32_t
enable
)
uint32_t
wake
,
uint32_t
enable
,
uint32_t
flag
)
{
{
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
uint32_t
payload
[
PAYLOAD_ARG_CNT
];
/* Send request to the PMC */
/* Send request to the PMC */
PM_PACK_PAYLOAD5
(
payload
,
LIBPM_MODULE_ID
,
PM_REGISTER_NOTIFIER
,
PM_PACK_PAYLOAD5
(
payload
,
LIBPM_MODULE_ID
,
flag
,
PM_REGISTER_NOTIFIER
,
device_id
,
event
,
wake
,
enable
);
device_id
,
event
,
wake
,
enable
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
return
pm_ipi_send_sync
(
primary_proc
,
payload
,
NULL
,
0
);
...
...
plat/xilinx/versal/pm_service/pm_api_sys.h
View file @
e84ca571
...
@@ -14,67 +14,86 @@
...
@@ -14,67 +14,86 @@
* PM API function declarations
* PM API function declarations
**********************************************************/
**********************************************************/
enum
pm_ret_status
pm_get_api_version
(
unsigned
int
*
version
);
enum
pm_ret_status
pm_get_api_version
(
unsigned
int
*
version
,
uint32_t
flag
);
enum
pm_ret_status
pm_init_finalize
(
void
);
enum
pm_ret_status
pm_init_finalize
(
uint32_t
flag
);
enum
pm_ret_status
pm_self_suspend
(
uint32_t
nid
,
enum
pm_ret_status
pm_self_suspend
(
uint32_t
nid
,
unsigned
int
latency
,
unsigned
int
latency
,
unsigned
int
state
,
unsigned
int
state
,
uintptr_t
address
);
uintptr_t
address
,
uint32_t
flag
);
enum
pm_ret_status
pm_abort_suspend
(
enum
pm_abort_reason
reason
);
enum
pm_ret_status
pm_abort_suspend
(
enum
pm_abort_reason
reason
,
uint32_t
flag
);
enum
pm_ret_status
pm_req_suspend
(
uint32_t
target
,
enum
pm_ret_status
pm_req_suspend
(
uint32_t
target
,
uint8_t
ack
,
uint8_t
ack
,
unsigned
int
latency
,
unsigned
int
latency
,
unsigned
int
state
);
unsigned
int
state
,
uint32_t
flag
);
enum
pm_ret_status
pm_req_wakeup
(
uint32_t
target
,
uint32_t
set_address
,
enum
pm_ret_status
pm_req_wakeup
(
uint32_t
target
,
uint32_t
set_address
,
uintptr_t
address
,
uint8_t
ack
);
uintptr_t
address
,
uint8_t
ack
,
uint32_t
flag
);
enum
pm_ret_status
pm_set_wakeup_source
(
uint32_t
target
,
uint32_t
device_id
,
enum
pm_ret_status
pm_set_wakeup_source
(
uint32_t
target
,
uint32_t
device_id
,
uint8_t
enable
);
uint8_t
enable
,
uint32_t
flag
);
enum
pm_ret_status
pm_request_device
(
uint32_t
device_id
,
uint32_t
capabilities
,
enum
pm_ret_status
pm_request_device
(
uint32_t
device_id
,
uint32_t
capabilities
,
uint32_t
qos
,
uint32_t
ack
);
uint32_t
qos
,
uint32_t
ack
,
uint32_t
flag
);
enum
pm_ret_status
pm_release_device
(
uint32_t
device_id
);
enum
pm_ret_status
pm_release_device
(
uint32_t
device_id
,
uint32_t
flag
);
enum
pm_ret_status
pm_set_requirement
(
uint32_t
device_id
,
uint32_t
capabilities
,
enum
pm_ret_status
pm_set_requirement
(
uint32_t
device_id
,
uint32_t
capabilities
,
uint32_t
latency
,
uint32_t
qos
);
uint32_t
latency
,
uint32_t
qos
,
enum
pm_ret_status
pm_get_device_status
(
uint32_t
device_id
,
uint32_t
*
response
);
uint32_t
flag
);
enum
pm_ret_status
pm_reset_assert
(
uint32_t
reset
,
bool
assert
);
enum
pm_ret_status
pm_get_device_status
(
uint32_t
device_id
,
uint32_t
*
response
,
enum
pm_ret_status
pm_reset_get_status
(
uint32_t
reset
,
uint32_t
*
status
);
uint32_t
flag
);
void
pm_get_callbackdata
(
uint32_t
*
data
,
size_t
count
);
enum
pm_ret_status
pm_reset_assert
(
uint32_t
reset
,
bool
assert
,
uint32_t
flag
);
enum
pm_ret_status
pm_pinctrl_request
(
uint32_t
pin
);
enum
pm_ret_status
pm_reset_get_status
(
uint32_t
reset
,
uint32_t
*
status
,
enum
pm_ret_status
pm_pinctrl_release
(
uint32_t
pin
);
uint32_t
flag
);
enum
pm_ret_status
pm_pinctrl_set_function
(
uint32_t
pin
,
uint32_t
function
);
void
pm_get_callbackdata
(
uint32_t
*
data
,
size_t
count
,
uint32_t
flag
);
enum
pm_ret_status
pm_pinctrl_get_function
(
uint32_t
pin
,
uint32_t
*
function
);
enum
pm_ret_status
pm_pinctrl_request
(
uint32_t
pin
,
uint32_t
flag
);
enum
pm_ret_status
pm_pinctrl_release
(
uint32_t
pin
,
uint32_t
flag
);
enum
pm_ret_status
pm_pinctrl_set_function
(
uint32_t
pin
,
uint32_t
function
,
uint32_t
flag
);
enum
pm_ret_status
pm_pinctrl_get_function
(
uint32_t
pin
,
uint32_t
*
function
,
uint32_t
flag
);
enum
pm_ret_status
pm_pinctrl_set_pin_param
(
uint32_t
pin
,
uint32_t
param
,
enum
pm_ret_status
pm_pinctrl_set_pin_param
(
uint32_t
pin
,
uint32_t
param
,
uint32_t
value
);
uint32_t
value
,
uint32_t
flag
);
enum
pm_ret_status
pm_pinctrl_get_pin_param
(
uint32_t
pin
,
uint32_t
param
,
enum
pm_ret_status
pm_pinctrl_get_pin_param
(
uint32_t
pin
,
uint32_t
param
,
uint32_t
*
value
);
uint32_t
*
value
,
uint32_t
flag
);
enum
pm_ret_status
pm_clock_enable
(
uint32_t
clk_id
);
enum
pm_ret_status
pm_clock_enable
(
uint32_t
clk_id
,
uint32_t
flag
);
enum
pm_ret_status
pm_clock_disable
(
uint32_t
clk_id
);
enum
pm_ret_status
pm_clock_disable
(
uint32_t
clk_id
,
uint32_t
flag
);
enum
pm_ret_status
pm_clock_get_state
(
uint32_t
clk_id
,
uint32_t
*
state
);
enum
pm_ret_status
pm_clock_get_state
(
uint32_t
clk_id
,
uint32_t
*
state
,
enum
pm_ret_status
pm_clock_set_divider
(
uint32_t
clk_id
,
uint32_t
divider
);
uint32_t
flag
);
enum
pm_ret_status
pm_clock_get_divider
(
uint32_t
clk_id
,
uint32_t
*
divider
);
enum
pm_ret_status
pm_clock_set_divider
(
uint32_t
clk_id
,
uint32_t
divider
,
enum
pm_ret_status
pm_clock_set_parent
(
uint32_t
clk_id
,
uint32_t
parent
);
uint32_t
flag
);
enum
pm_ret_status
pm_clock_get_parent
(
uint32_t
clk_id
,
uint32_t
*
parent
);
enum
pm_ret_status
pm_clock_get_divider
(
uint32_t
clk_id
,
uint32_t
*
divider
,
enum
pm_ret_status
pm_clock_get_rate
(
uint32_t
clk_id
,
uint32_t
*
clk_rate
);
uint32_t
flag
);
enum
pm_ret_status
pm_clock_set_parent
(
uint32_t
clk_id
,
uint32_t
parent
,
uint32_t
flag
);
enum
pm_ret_status
pm_clock_get_parent
(
uint32_t
clk_id
,
uint32_t
*
parent
,
uint32_t
flag
);
enum
pm_ret_status
pm_clock_get_rate
(
uint32_t
clk_id
,
uint32_t
*
clk_rate
,
uint32_t
flag
);
enum
pm_ret_status
pm_pll_set_param
(
uint32_t
clk_id
,
uint32_t
param
,
enum
pm_ret_status
pm_pll_set_param
(
uint32_t
clk_id
,
uint32_t
param
,
uint32_t
value
);
uint32_t
value
,
uint32_t
flag
);
enum
pm_ret_status
pm_pll_get_param
(
uint32_t
clk_id
,
uint32_t
param
,
enum
pm_ret_status
pm_pll_get_param
(
uint32_t
clk_id
,
uint32_t
param
,
uint32_t
*
value
);
uint32_t
*
value
,
uint32_t
flag
);
enum
pm_ret_status
pm_pll_set_mode
(
uint32_t
clk_id
,
uint32_t
mode
);
enum
pm_ret_status
pm_pll_set_mode
(
uint32_t
clk_id
,
uint32_t
mode
,
enum
pm_ret_status
pm_pll_get_mode
(
uint32_t
clk_id
,
uint32_t
*
mode
);
uint32_t
flag
);
enum
pm_ret_status
pm_force_powerdown
(
uint32_t
target
,
uint8_t
ack
);
enum
pm_ret_status
pm_pll_get_mode
(
uint32_t
clk_id
,
uint32_t
*
mode
,
enum
pm_ret_status
pm_system_shutdown
(
uint32_t
type
,
uint32_t
subtype
);
uint32_t
flag
);
enum
pm_ret_status
pm_force_powerdown
(
uint32_t
target
,
uint8_t
ack
,
uint32_t
flag
);
enum
pm_ret_status
pm_system_shutdown
(
uint32_t
type
,
uint32_t
subtype
,
uint32_t
flag
);
enum
pm_ret_status
pm_api_ioctl
(
uint32_t
device_id
,
uint32_t
ioctl_id
,
enum
pm_ret_status
pm_api_ioctl
(
uint32_t
device_id
,
uint32_t
ioctl_id
,
uint32_t
arg1
,
uint32_t
arg2
,
uint32_t
*
value
);
uint32_t
arg1
,
uint32_t
arg2
,
uint32_t
*
value
,
uint32_t
flag
);
enum
pm_ret_status
pm_query_data
(
uint32_t
qid
,
uint32_t
arg1
,
uint32_t
arg2
,
enum
pm_ret_status
pm_query_data
(
uint32_t
qid
,
uint32_t
arg1
,
uint32_t
arg2
,
uint32_t
arg3
,
uint32_t
*
data
);
uint32_t
arg3
,
uint32_t
*
data
,
uint32_t
flag
);
unsigned
int
pm_get_shutdown_scope
(
void
);
unsigned
int
pm_get_shutdown_scope
(
void
);
enum
pm_ret_status
pm_get_chipid
(
uint32_t
*
value
);
enum
pm_ret_status
pm_get_chipid
(
uint32_t
*
value
,
uint32_t
flag
);
enum
pm_ret_status
pm_feature_check
(
uint32_t
api_id
,
unsigned
int
*
version
);
enum
pm_ret_status
pm_feature_check
(
uint32_t
api_id
,
unsigned
int
*
version
,
uint32_t
flag
);
enum
pm_ret_status
pm_load_pdi
(
uint32_t
src
,
uint32_t
address_low
,
enum
pm_ret_status
pm_load_pdi
(
uint32_t
src
,
uint32_t
address_low
,
uint32_t
address_high
);
uint32_t
address_high
,
uint32_t
flag
);
enum
pm_ret_status
pm_get_op_characteristic
(
uint32_t
device_id
,
enum
pm_ret_status
pm_get_op_characteristic
(
uint32_t
device_id
,
enum
pm_opchar_type
type
,
enum
pm_opchar_type
type
,
uint32_t
*
result
);
uint32_t
*
result
,
uint32_t
flag
);
enum
pm_ret_status
pm_set_max_latency
(
uint32_t
device_id
,
uint32_t
latency
);
enum
pm_ret_status
pm_set_max_latency
(
uint32_t
device_id
,
uint32_t
latency
,
uint32_t
flag
);
enum
pm_ret_status
pm_register_notifier
(
uint32_t
device_id
,
uint32_t
event
,
enum
pm_ret_status
pm_register_notifier
(
uint32_t
device_id
,
uint32_t
event
,
uint32_t
wake
,
uint32_t
enable
);
uint32_t
wake
,
uint32_t
enable
,
uint32_t
flag
);
#endif
/* PM_API_SYS_H */
#endif
/* PM_API_SYS_H */
plat/xilinx/versal/pm_service/pm_client.c
View file @
e84ca571
...
@@ -149,7 +149,8 @@ static void pm_client_set_wakeup_sources(uint32_t node_id)
...
@@ -149,7 +149,8 @@ static void pm_client_set_wakeup_sources(uint32_t node_id)
/* Get device ID from node index */
/* Get device ID from node index */
device_id
=
PERIPH_DEVID
(
node_idx
);
device_id
=
PERIPH_DEVID
(
node_idx
);
ret
=
pm_set_wakeup_source
(
node_id
,
ret
=
pm_set_wakeup_source
(
node_id
,
device_id
,
1
);
device_id
,
1
,
SECURE_FLAG
);
pm_wakeup_nodes_set
[
node_idx
]
=
!
ret
;
pm_wakeup_nodes_set
[
node_idx
]
=
!
ret
;
}
}
}
}
...
...
plat/xilinx/versal/pm_service/pm_svc_main.c
View file @
e84ca571
...
@@ -71,6 +71,7 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
...
@@ -71,6 +71,7 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
enum
pm_ret_status
ret
;
enum
pm_ret_status
ret
;
uint32_t
pm_arg
[
4
];
uint32_t
pm_arg
[
4
];
uint32_t
security_flag
=
SECURE_FLAG
;
/* Handle case where PM wasn't initialized properly */
/* Handle case where PM wasn't initialized properly */
if
(
!
pm_up
)
if
(
!
pm_up
)
...
@@ -81,57 +82,67 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
...
@@ -81,57 +82,67 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
pm_arg
[
2
]
=
(
uint32_t
)
x2
;
pm_arg
[
2
]
=
(
uint32_t
)
x2
;
pm_arg
[
3
]
=
(
uint32_t
)(
x2
>>
32
);
pm_arg
[
3
]
=
(
uint32_t
)(
x2
>>
32
);
/*
* Mark BIT24 payload (i.e 1st bit of pm_arg[3] ) as non-secure (1)
* if smc called is non secure
*/
if
(
is_caller_non_secure
(
flags
))
{
security_flag
=
NON_SECURE_FLAG
;
}
switch
(
smc_fid
&
FUNCID_NUM_MASK
)
{
switch
(
smc_fid
&
FUNCID_NUM_MASK
)
{
/* PM API Functions */
/* PM API Functions */
case
PM_SELF_SUSPEND
:
case
PM_SELF_SUSPEND
:
ret
=
pm_self_suspend
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
ret
=
pm_self_suspend
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
pm_arg
[
3
]);
pm_arg
[
3
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_FORCE_POWERDOWN
:
case
PM_FORCE_POWERDOWN
:
ret
=
pm_force_powerdown
(
pm_arg
[
0
],
pm_arg
[
1
]);
ret
=
pm_force_powerdown
(
pm_arg
[
0
],
pm_arg
[
1
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_REQ_SUSPEND
:
case
PM_REQ_SUSPEND
:
ret
=
pm_req_suspend
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
ret
=
pm_req_suspend
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
pm_arg
[
3
]);
pm_arg
[
3
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_ABORT_SUSPEND
:
case
PM_ABORT_SUSPEND
:
ret
=
pm_abort_suspend
(
pm_arg
[
0
]);
ret
=
pm_abort_suspend
(
pm_arg
[
0
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_SYSTEM_SHUTDOWN
:
case
PM_SYSTEM_SHUTDOWN
:
ret
=
pm_system_shutdown
(
pm_arg
[
0
],
pm_arg
[
1
]);
ret
=
pm_system_shutdown
(
pm_arg
[
0
],
pm_arg
[
1
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_REQ_WAKEUP
:
case
PM_REQ_WAKEUP
:
ret
=
pm_req_wakeup
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
pm_arg
[
3
]);
ret
=
pm_req_wakeup
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
pm_arg
[
3
],
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_SET_WAKEUP_SOURCE
:
case
PM_SET_WAKEUP_SOURCE
:
ret
=
pm_set_wakeup_source
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
]);
ret
=
pm_set_wakeup_source
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_REQUEST_DEVICE
:
case
PM_REQUEST_DEVICE
:
ret
=
pm_request_device
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
ret
=
pm_request_device
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
pm_arg
[
3
]);
pm_arg
[
3
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_RELEASE_DEVICE
:
case
PM_RELEASE_DEVICE
:
ret
=
pm_release_device
(
pm_arg
[
0
]);
ret
=
pm_release_device
(
pm_arg
[
0
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_SET_REQUIREMENT
:
case
PM_SET_REQUIREMENT
:
ret
=
pm_set_requirement
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
ret
=
pm_set_requirement
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
pm_arg
[
3
]);
pm_arg
[
3
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_GET_API_VERSION
:
case
PM_GET_API_VERSION
:
{
{
uint32_t
api_version
;
uint32_t
api_version
;
ret
=
pm_get_api_version
(
&
api_version
);
ret
=
pm_get_api_version
(
&
api_version
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
PM_RET_SUCCESS
|
SMC_RET1
(
handle
,
(
uint64_t
)
PM_RET_SUCCESS
|
((
uint64_t
)
api_version
<<
32
));
((
uint64_t
)
api_version
<<
32
));
}
}
...
@@ -140,68 +151,72 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
...
@@ -140,68 +151,72 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
{
{
uint32_t
buff
[
3
];
uint32_t
buff
[
3
];
ret
=
pm_get_device_status
(
pm_arg
[
0
],
buff
);
ret
=
pm_get_device_status
(
pm_arg
[
0
],
buff
,
security_flag
);
SMC_RET2
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
buff
[
0
]
<<
32
),
SMC_RET2
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
buff
[
0
]
<<
32
),
(
uint64_t
)
buff
[
1
]
|
((
uint64_t
)
buff
[
2
]
<<
32
));
(
uint64_t
)
buff
[
1
]
|
((
uint64_t
)
buff
[
2
]
<<
32
));
}
}
case
PM_RESET_ASSERT
:
case
PM_RESET_ASSERT
:
ret
=
pm_reset_assert
(
pm_arg
[
0
],
pm_arg
[
1
]);
ret
=
pm_reset_assert
(
pm_arg
[
0
],
pm_arg
[
1
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_RESET_GET_STATUS
:
case
PM_RESET_GET_STATUS
:
{
{
uint32_t
reset_status
;
uint32_t
reset_status
;
ret
=
pm_reset_get_status
(
pm_arg
[
0
],
&
reset_status
);
ret
=
pm_reset_get_status
(
pm_arg
[
0
],
&
reset_status
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
reset_status
<<
32
));
((
uint64_t
)
reset_status
<<
32
));
}
}
case
PM_INIT_FINALIZE
:
case
PM_INIT_FINALIZE
:
ret
=
pm_init_finalize
();
ret
=
pm_init_finalize
(
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_GET_CALLBACK_DATA
:
case
PM_GET_CALLBACK_DATA
:
{
{
uint32_t
result
[
4
]
=
{
0
};
uint32_t
result
[
4
]
=
{
0
};
pm_get_callbackdata
(
result
,
ARRAY_SIZE
(
result
));
pm_get_callbackdata
(
result
,
ARRAY_SIZE
(
result
)
,
security_flag
);
SMC_RET2
(
handle
,
SMC_RET2
(
handle
,
(
uint64_t
)
result
[
0
]
|
((
uint64_t
)
result
[
1
]
<<
32
),
(
uint64_t
)
result
[
0
]
|
((
uint64_t
)
result
[
1
]
<<
32
),
(
uint64_t
)
result
[
2
]
|
((
uint64_t
)
result
[
3
]
<<
32
));
(
uint64_t
)
result
[
2
]
|
((
uint64_t
)
result
[
3
]
<<
32
));
}
}
case
PM_PINCTRL_REQUEST
:
case
PM_PINCTRL_REQUEST
:
ret
=
pm_pinctrl_request
(
pm_arg
[
0
]);
ret
=
pm_pinctrl_request
(
pm_arg
[
0
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_PINCTRL_RELEASE
:
case
PM_PINCTRL_RELEASE
:
ret
=
pm_pinctrl_release
(
pm_arg
[
0
]);
ret
=
pm_pinctrl_release
(
pm_arg
[
0
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_PINCTRL_GET_FUNCTION
:
case
PM_PINCTRL_GET_FUNCTION
:
{
{
uint32_t
value
=
0
;
uint32_t
value
=
0
;
ret
=
pm_pinctrl_get_function
(
pm_arg
[
0
],
&
value
);
ret
=
pm_pinctrl_get_function
(
pm_arg
[
0
],
&
value
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
value
)
<<
32
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
value
)
<<
32
);
}
}
case
PM_PINCTRL_SET_FUNCTION
:
case
PM_PINCTRL_SET_FUNCTION
:
ret
=
pm_pinctrl_set_function
(
pm_arg
[
0
],
pm_arg
[
1
]);
ret
=
pm_pinctrl_set_function
(
pm_arg
[
0
],
pm_arg
[
1
],
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_PINCTRL_CONFIG_PARAM_GET
:
case
PM_PINCTRL_CONFIG_PARAM_GET
:
{
{
uint32_t
value
;
uint32_t
value
;
ret
=
pm_pinctrl_get_pin_param
(
pm_arg
[
0
],
pm_arg
[
1
],
&
value
);
ret
=
pm_pinctrl_get_pin_param
(
pm_arg
[
0
],
pm_arg
[
1
],
&
value
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
value
)
<<
32
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
value
)
<<
32
);
}
}
case
PM_PINCTRL_CONFIG_PARAM_SET
:
case
PM_PINCTRL_CONFIG_PARAM_SET
:
ret
=
pm_pinctrl_set_pin_param
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
]);
ret
=
pm_pinctrl_set_pin_param
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_IOCTL
:
case
PM_IOCTL
:
...
@@ -209,7 +224,7 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
...
@@ -209,7 +224,7 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
uint32_t
value
;
uint32_t
value
;
ret
=
pm_api_ioctl
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
ret
=
pm_api_ioctl
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
pm_arg
[
3
],
&
value
);
pm_arg
[
3
],
&
value
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
value
)
<<
32
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
value
)
<<
32
);
}
}
...
@@ -218,49 +233,49 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
...
@@ -218,49 +233,49 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
uint32_t
data
[
8
]
=
{
0
};
uint32_t
data
[
8
]
=
{
0
};
ret
=
pm_query_data
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
ret
=
pm_query_data
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
pm_arg
[
3
],
data
);
pm_arg
[
3
],
data
,
security_flag
);
SMC_RET2
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
data
[
0
]
<<
32
),
SMC_RET2
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
data
[
0
]
<<
32
),
(
uint64_t
)
data
[
1
]
|
((
uint64_t
)
data
[
2
]
<<
32
));
(
uint64_t
)
data
[
1
]
|
((
uint64_t
)
data
[
2
]
<<
32
));
}
}
case
PM_CLOCK_ENABLE
:
case
PM_CLOCK_ENABLE
:
ret
=
pm_clock_enable
(
pm_arg
[
0
]);
ret
=
pm_clock_enable
(
pm_arg
[
0
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_CLOCK_DISABLE
:
case
PM_CLOCK_DISABLE
:
ret
=
pm_clock_disable
(
pm_arg
[
0
]);
ret
=
pm_clock_disable
(
pm_arg
[
0
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_CLOCK_GETSTATE
:
case
PM_CLOCK_GETSTATE
:
{
{
uint32_t
value
;
uint32_t
value
;
ret
=
pm_clock_get_state
(
pm_arg
[
0
],
&
value
);
ret
=
pm_clock_get_state
(
pm_arg
[
0
],
&
value
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
value
)
<<
32
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
value
)
<<
32
);
}
}
case
PM_CLOCK_SETDIVIDER
:
case
PM_CLOCK_SETDIVIDER
:
ret
=
pm_clock_set_divider
(
pm_arg
[
0
],
pm_arg
[
1
]);
ret
=
pm_clock_set_divider
(
pm_arg
[
0
],
pm_arg
[
1
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_CLOCK_GETDIVIDER
:
case
PM_CLOCK_GETDIVIDER
:
{
{
uint32_t
value
;
uint32_t
value
;
ret
=
pm_clock_get_divider
(
pm_arg
[
0
],
&
value
);
ret
=
pm_clock_get_divider
(
pm_arg
[
0
],
&
value
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
value
)
<<
32
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
value
)
<<
32
);
}
}
case
PM_CLOCK_SETPARENT
:
case
PM_CLOCK_SETPARENT
:
ret
=
pm_clock_set_parent
(
pm_arg
[
0
],
pm_arg
[
1
]);
ret
=
pm_clock_set_parent
(
pm_arg
[
0
],
pm_arg
[
1
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_CLOCK_GETPARENT
:
case
PM_CLOCK_GETPARENT
:
{
{
uint32_t
value
;
uint32_t
value
;
ret
=
pm_clock_get_parent
(
pm_arg
[
0
],
&
value
);
ret
=
pm_clock_get_parent
(
pm_arg
[
0
],
&
value
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
value
)
<<
32
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
value
)
<<
32
);
}
}
...
@@ -268,32 +283,34 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
...
@@ -268,32 +283,34 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
{
{
uint32_t
rate
[
2
]
=
{
0
};
uint32_t
rate
[
2
]
=
{
0
};
ret
=
pm_clock_get_rate
(
pm_arg
[
0
],
rate
);
ret
=
pm_clock_get_rate
(
pm_arg
[
0
],
rate
,
security_flag
);
SMC_RET2
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
rate
[
0
]
<<
32
),
SMC_RET2
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
rate
[
0
]
<<
32
),
rate
[
1
]);
rate
[
1
]);
}
}
case
PM_PLL_SET_PARAMETER
:
case
PM_PLL_SET_PARAMETER
:
ret
=
pm_pll_set_param
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
]);
ret
=
pm_pll_set_param
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_PLL_GET_PARAMETER
:
case
PM_PLL_GET_PARAMETER
:
{
{
uint32_t
value
;
uint32_t
value
;
ret
=
pm_pll_get_param
(
pm_arg
[
0
],
pm_arg
[
1
],
&
value
);
ret
=
pm_pll_get_param
(
pm_arg
[
0
],
pm_arg
[
1
],
&
value
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
value
<<
32
));
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
value
<<
32
));
}
}
case
PM_PLL_SET_MODE
:
case
PM_PLL_SET_MODE
:
ret
=
pm_pll_set_mode
(
pm_arg
[
0
],
pm_arg
[
1
]);
ret
=
pm_pll_set_mode
(
pm_arg
[
0
],
pm_arg
[
1
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
case
PM_PLL_GET_MODE
:
case
PM_PLL_GET_MODE
:
{
{
uint32_t
mode
;
uint32_t
mode
;
ret
=
pm_pll_get_mode
(
pm_arg
[
0
],
&
mode
);
ret
=
pm_pll_get_mode
(
pm_arg
[
0
],
&
mode
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
mode
<<
32
));
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
mode
<<
32
));
}
}
...
@@ -305,7 +322,7 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
...
@@ -305,7 +322,7 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
{
{
uint32_t
result
[
2
];
uint32_t
result
[
2
];
ret
=
pm_get_chipid
(
result
);
ret
=
pm_get_chipid
(
result
,
security_flag
);
SMC_RET2
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
result
[
0
]
<<
32
),
SMC_RET2
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
result
[
0
]
<<
32
),
result
[
1
]);
result
[
1
]);
}
}
...
@@ -314,13 +331,14 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
...
@@ -314,13 +331,14 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
{
{
uint32_t
version
;
uint32_t
version
;
ret
=
pm_feature_check
(
pm_arg
[
0
],
&
version
);
ret
=
pm_feature_check
(
pm_arg
[
0
],
&
version
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
version
<<
32
));
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
version
<<
32
));
}
}
case
PM_LOAD_PDI
:
case
PM_LOAD_PDI
:
{
{
ret
=
pm_load_pdi
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
]);
ret
=
pm_load_pdi
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
}
}
...
@@ -328,19 +346,21 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
...
@@ -328,19 +346,21 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
{
{
uint32_t
result
;
uint32_t
result
;
ret
=
pm_get_op_characteristic
(
pm_arg
[
0
],
pm_arg
[
1
],
&
result
);
ret
=
pm_get_op_characteristic
(
pm_arg
[
0
],
pm_arg
[
1
],
&
result
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
result
<<
32
));
SMC_RET1
(
handle
,
(
uint64_t
)
ret
|
((
uint64_t
)
result
<<
32
));
}
}
case
PM_SET_MAX_LATENCY
:
case
PM_SET_MAX_LATENCY
:
{
{
ret
=
pm_set_max_latency
(
pm_arg
[
0
],
pm_arg
[
1
]);
ret
=
pm_set_max_latency
(
pm_arg
[
0
],
pm_arg
[
1
]
,
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
}
}
case
PM_REGISTER_NOTIFIER
:
case
PM_REGISTER_NOTIFIER
:
{
{
ret
=
pm_register_notifier
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
pm_arg
[
3
]);
ret
=
pm_register_notifier
(
pm_arg
[
0
],
pm_arg
[
1
],
pm_arg
[
2
],
pm_arg
[
3
],
security_flag
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
SMC_RET1
(
handle
,
(
uint64_t
)
ret
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment