feat(xilinx): add wrapper to handle cpu power down req

Firmware sends CPU power down request to TF-A through NOTIFY_CB
callback. It indicates CPU needs to power down.

Add wrapper to handle CPU power down request from firmware
through IPI callback.

Signed-off-by: Jay Buddhabhatti <jay.buddhabhatti@amd.com>
Change-Id: Ic4aff874dd29da057c5ffde1899c7f0e5cdf6733
This commit is contained in:
Jay Buddhabhatti 2023-04-25 04:15:51 -07:00
parent b225926181
commit 3dd118cf9d

View file

@ -31,11 +31,13 @@
#define INVALID_SGI 0xFFU
#define PM_INIT_SUSPEND_CB (30U)
#define PM_NOTIFY_CB (32U)
#define EVENT_CPU_PWRDWN (4U)
DEFINE_RENAME_SYSREG_RW_FUNCS(icc_asgi1r_el1, S3_0_C12_C11_6)
/* pm_up = true - UP, pm_up = false - DOWN */
static bool pm_up;
static uint32_t sgi = (uint32_t)INVALID_SGI;
static bool pwrdwn_req_received;
static void notify_os(void)
{
@ -48,6 +50,12 @@ static void notify_os(void)
write_icc_asgi1r_el1(reg);
}
static void request_cpu_pwrdwn(void)
{
VERBOSE("CPU power down request received\n");
pm_ipi_irq_clear(primary_proc);
}
static uint64_t ipi_fiq_handler(uint32_t id, uint32_t flags, void *handle,
void *cookie)
{
@ -65,8 +73,21 @@ static uint64_t ipi_fiq_handler(uint32_t id, uint32_t flags, void *handle,
switch (payload[0]) {
case PM_INIT_SUSPEND_CB:
if (sgi != INVALID_SGI) {
notify_os();
}
break;
case PM_NOTIFY_CB:
if (sgi != INVALID_SGI) {
if (payload[2] == EVENT_CPU_PWRDWN) {
if (pwrdwn_req_received) {
pwrdwn_req_received = false;
request_cpu_pwrdwn();
break;
} else {
pwrdwn_req_received = true;
}
}
notify_os();
}
break;