fix(xilinx): add API to get powerdown request status
The pwrdwn_req_received variable is used across multiple platforms
through extern keyword. Instead of using the extern, add getter
API to access this variable across the platforms, and restrict the
scope of variable to the particular file by defining it as static
variable. This prevents unintended access of variable from other
files and increase safety.
Change-Id: I758466ea7f6be2a90ec249dc3e4fa56cdbe11e57
Signed-off-by: Devanshi Chauhan <devanshi.chauhanalpeshbhai@amd.com>
diff --git a/plat/amd/versal2/plat_psci_pm.c b/plat/amd/versal2/plat_psci_pm.c
index 3cc6b95..ab71043 100644
--- a/plat/amd/versal2/plat_psci_pm.c
+++ b/plat/amd/versal2/plat_psci_pm.c
@@ -110,7 +110,7 @@
* Send the system reset request to the firmware if power down request
* is not received from firmware.
*/
- if (pwrdwn_req_received == false) {
+ if (pm_pwrdwn_req_status() == false) {
/*
* TODO: shutdown scope for this reset needs be revised once
* we have a clearer understanding of the overall reset scoping
diff --git a/plat/amd/versal2/pm_service/pm_svc_main.c b/plat/amd/versal2/pm_service/pm_svc_main.c
index 55fd963..ae26d6b 100644
--- a/plat/amd/versal2/pm_service/pm_svc_main.c
+++ b/plat/amd/versal2/pm_service/pm_svc_main.c
@@ -68,7 +68,12 @@
/* pm_up = true - UP, pm_up = false - DOWN */
static bool pm_up;
static uint32_t sgi = (uint32_t)INVALID_SGI;
-bool pwrdwn_req_received;
+static bool pwrdwn_req_received;
+
+bool pm_pwrdwn_req_status(void)
+{
+ return pwrdwn_req_received;
+}
static void notify_os(void)
{
@@ -269,6 +274,7 @@
pm_ipi_init(primary_proc);
pm_up = true;
+ pwrdwn_req_received = false;
/* register SGI handler for CPU power down request */
ret = request_intr_type_el3(CPU_PWR_DOWN_REQ_INTR, cpu_pwrdwn_req_handler);