From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org, Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH] ArmPkg/ArmSmcPsciResetSystemLib: add support for warm reboot
Date: Fri, 6 Oct 2017 21:41:52 +0100 [thread overview]
Message-ID: <20171006204152.19376-1-ard.biesheuvel@linaro.org> (raw)
PSCI SYSTEM_RESET is specified as a cold reboot, which does not
preserve the contents of DRAM. In version 1.1, a new reset method
was introduced that allows a warm reboot to be requested.
This is especially relevant for capsule update, given that it will
invoke a warm reboot before processing the capsule, under the
assumption that the capsule will still be in memory when the PEI
phase is reentered.
So wire up the [rather inaccurately named] EnterS3WithImmediateWake()
entry point that the capsule update runtime uses to the new PSCI 1.1
warm reboot. Note that many PSCI implementations will not support this
yet, so fall back to a cold reboot if warm reboot fails.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
I don't actually need this code for Synquacer, but given that I had
already wrote it, we may just as well merge it.
ArmPkg/Include/IndustryStandard/ArmStdSmc.h | 10 +++++++---
ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c | 14 ++++++++++++--
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
index 593a3ce729ce..41b086947eaa 100644
--- a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
+++ b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h
@@ -57,10 +57,12 @@
#define ARM_SMC_ID_PSCI_MIGRATE_AARCH32 0x84000005
#define ARM_SMC_ID_PSCI_SYSTEM_OFF 0x84000008
#define ARM_SMC_ID_PSCI_SYSTEM_RESET 0x84000009
+#define ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64 0xc4000012
+#define ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH32 0x84000012
-/* The current PSCI version is: 0.2 */
-#define ARM_SMC_PSCI_VERSION_MAJOR 0
-#define ARM_SMC_PSCI_VERSION_MINOR 2
+/* The current PSCI version is: 1.1 */
+#define ARM_SMC_PSCI_VERSION_MAJOR 1
+#define ARM_SMC_PSCI_VERSION_MINOR 1
#define ARM_SMC_PSCI_VERSION \
((ARM_SMC_PSCI_VERSION_MAJOR << 16) | ARM_SMC_PSCI_VERSION_MINOR)
@@ -93,4 +95,6 @@
#define ARM_SMC_ID_PSCI_AFFINITY_INFO_OFF 1
#define ARM_SMC_ID_PSCI_AFFINITY_INFO_ON_PENDING 2
+#define ARM_SMC_ID_PSCI_SYSTEM_RESET2_WARM 0
+
#endif
diff --git a/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c b/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c
index d6d26bce5009..ffd726554c0f 100644
--- a/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c
+++ b/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c
@@ -55,7 +55,17 @@ ResetWarm (
VOID
)
{
- // Map a warm reset into a cold reset
+ ARM_SMC_ARGS ArmSmcArgs;
+
+#if defined(MDE_CPU_AARCH64)
+ ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH64;
+#else
+ ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_AARCH32;
+#endif
+ ArmSmcArgs.Arg1 = ARM_SMC_ID_PSCI_SYSTEM_RESET2_WARM;
+ ArmCallSmc (&ArmSmcArgs);
+
+ // Fall back to cold reset if unsupported
ResetCold ();
}
@@ -89,7 +99,7 @@ EnterS3WithImmediateWake (
VOID
)
{
- // Not implemented
+ ResetWarm ();
}
/**
--
2.11.0
next reply other threads:[~2017-10-06 20:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-06 20:41 Ard Biesheuvel [this message]
2017-10-09 18:22 ` [PATCH] ArmPkg/ArmSmcPsciResetSystemLib: add support for warm reboot Leif Lindholm
2017-10-09 18:22 ` Ard Biesheuvel
2017-12-14 15:49 ` Leif Lindholm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171006204152.19376-1-ard.biesheuvel@linaro.org \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox