]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg: Handle warm reboot request correctly
authorPranav Madhu <pranav.madhu@arm.com>
Wed, 24 Aug 2022 16:44:21 +0000 (22:14 +0530)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 5 Sep 2022 13:52:51 +0000 (13:52 +0000)
The warm reboot requests from OSPM are mapped to cold reboot. To handle
the warm reboot separately from a cold reboot, update
ArmSmcPsciResetSystemLib and to invoke the PSCI call with parameters
for warm reboot.

Signed-off-by: Pranav Madhu <pranav.madhu@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
ArmPkg/Include/IndustryStandard/ArmStdSmc.h
ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c

index 655edc21b2057ab73bfd85690f2d3a38cd2a8ae9..78ce77cd734d2bbc0db9e90afb29dc6d78ef171e 100644 (file)
@@ -93,6 +93,8 @@
 #define ARM_SMC_ID_PSCI_MIGRATE_AARCH32        0x84000005\r
 #define ARM_SMC_ID_PSCI_SYSTEM_OFF             0x84000008\r
 #define ARM_SMC_ID_PSCI_SYSTEM_RESET           0x84000009\r
+#define ARM_SMC_ID_PSCI_FEATURES               0x8400000A\r
+#define ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64  0xC4000012\r
 \r
 /* The current PSCI version is:  0.2 */\r
 #define ARM_SMC_PSCI_VERSION_MAJOR  0\r
index af6738459e43d690583df4602322ed64f5a45804..dc7b9fd01951f94cbd36773884b875b887d63a56 100644 (file)
@@ -3,6 +3,7 @@
 \r
   Copyright (c) 2017 - 2018, Linaro Ltd. All rights reserved.<BR>\r
   Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2022, Arm Limited. All rights reserved.<BR>\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -47,8 +48,24 @@ ResetWarm (
   VOID\r
   )\r
 {\r
-  // Map a warm reset into a cold reset\r
-  ResetCold ();\r
+  UINTN  Arg1;\r
+  UINTN  Ret;\r
+\r
+  Arg1 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64;\r
+\r
+  // Is SYSTEM_RESET2 supported?\r
+  Ret = ArmCallSmc0 (ARM_SMC_ID_PSCI_FEATURES, &Arg1, NULL, NULL);\r
+  if (Ret == ARM_SMC_PSCI_RET_SUCCESS) {\r
+    // Send PSCI SYSTEM_RESET2 command\r
+    ArmCallSmc0 (Arg1, NULL, NULL, NULL);\r
+  } else {\r
+    // Map a warm reset into a cold reset\r
+    DEBUG ((\r
+      DEBUG_INFO,\r
+      "Warm reboot not supported by platform, issuing cold reboot\n"\r
+      ));\r
+    ResetCold ();\r
+  }\r
 }\r
 \r
 /**\r