[Concept,18/18] sysreset: Add -c flag for explicit cold reset

Message ID 20250902152158.2285264-19-sjg@u-boot.org
State New
Headers
Series efi: Improve integration of the app with a Shim environment |

Commit Message

Simon Glass Sept. 2, 2025, 3:21 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

Add support for reset -c flag to explicitly request cold reset.
This provides symmetry with -w (warm) and -u (firmware UI) flags.

For EFI apps, this performs EFI_RESET_COLD which does a full system
reboot without going to firmware setup interface.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 doc/usage/cmd/reset.rst  | 2 +-
 lib/efi_client/efi_app.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
  

Patch

diff --git a/doc/usage/cmd/reset.rst b/doc/usage/cmd/reset.rst
index 190f3281d78..d3923c3e8a9 100644
--- a/doc/usage/cmd/reset.rst
+++ b/doc/usage/cmd/reset.rst
@@ -11,7 +11,7 @@  Synopsis
 
 ::
 
-    reset [-w] [-u]
+    reset [-c] [-w] [-u]
 
 Description
 -----------
diff --git a/lib/efi_client/efi_app.c b/lib/efi_client/efi_app.c
index 1afccc8c8c7..25fc2e9cade 100644
--- a/lib/efi_client/efi_app.c
+++ b/lib/efi_client/efi_app.c
@@ -254,6 +254,10 @@  static int efi_sysreset_request(struct udevice *dev, enum sysreset_t type)
 	struct efi_priv *priv = efi_get_priv();
 
 	switch (type) {
+	case SYSRESET_COLD:
+		/* Perform a cold reset */
+		priv->run->reset_system(EFI_RESET_COLD, EFI_SUCCESS, 0, NULL);
+		break;
 	case SYSRESET_TO_FIRMWARE_UI: {
 		efi_status_t ret;
 		u64 osind;