public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Mike Maslenkin" <mike.maslenkin@gmail.com>
To: devel@edk2.groups.io
Cc: abner.chang@amd.com, nicklew@nvidia.com, igork@ami.com
Subject: [edk2-devel] [PATCH 3/3] RedfishClientPkg: warn user about reboot if allowed.
Date: Fri,  1 Dec 2023 02:18:44 +0300	[thread overview]
Message-ID: <20231130231844.22397-4-mike.maslenkin@gmail.com> (raw)
In-Reply-To: <20231130231844.22397-1-mike.maslenkin@gmail.com>

Warn user about system reboot only if it has not been rejected by
callbacks executed as result of EdkiiRedfishPhaseBeforeReboot notification

Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
---
 .../RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c      | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
index 51d0387ce867..f3188ddfde2c 100644
--- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
+++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
@@ -296,9 +296,6 @@ RedfishFeatureDriverStartup (
   // If system configuration is changed, reboot system.
   //
   if (PcdGetBool (PcdRedfishSystemRebootRequired)) {
-    Print (L"System configuration is changed from RESTful interface. Reboot system in %d seconds...\n", RebootTimeout);
-    gBS->Stall (RebootTimeout * 1000000U);
-
     //
     // Call override protocol to notify platform that Redfish is processed
     // and about to reboot system.
@@ -312,9 +309,14 @@ RedfishFeatureDriverStartup (
       Status = RedfishOverride->NotifyPhase (RedfishOverride, EdkiiRedfishPhaseBeforeReboot);
       if (EFI_ERROR (Status)) {
         DEBUG ((DEBUG_ERROR, "%a: abort the reboot because NotifyPhase() returns failure: %r\n", __func__, Status));
-        return;
+        PcdSetBoolS (PcdRedfishSystemRebootRequired, FALSE);
       }
     }
+  }
+
+  if (PcdGetBool (PcdRedfishSystemRebootRequired)) {
+    Print (L"System configuration is changed from RESTful interface. Reboot system in %d seconds...\n", RebootTimeout);
+    gBS->Stall (RebootTimeout * 1000000U);
 
     gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
     CpuDeadLoop ();
-- 
2.32.0 (Apple Git-132)


  parent reply	other threads:[~2023-11-30 23:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30 23:18 [edk2-devel] [edk2-redfish-client][PATCH 0/3] RedfishClientPkg: fix traces Mike Maslenkin
2023-11-30 23:18 ` [edk2-devel] [PATCH 1/3] RedfishClientPkg: fix misleading texts in debug traces Mike Maslenkin
2023-12-04  7:03   ` Nickle Wang via groups.io
2023-11-30 23:18 ` [edk2-devel] [PATCH 2/3] RedfishClientPkg: fix format specifier in DEBUG macro Mike Maslenkin
2023-12-04  7:03   ` Nickle Wang via groups.io
2023-11-30 23:18 ` Mike Maslenkin [this message]
2023-12-04  7:05   ` [edk2-devel] [PATCH 3/3] RedfishClientPkg: warn user about reboot if allowed Nickle Wang via groups.io

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=20231130231844.22397-4-mike.maslenkin@gmail.com \
    --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