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.maslen...@gmail.com>
Cc: Abner Chang <abner.ch...@amd.com>
Cc: Nickle Wang <nick...@nvidia.com>
Cc: Igor Kulchytskyy <ig...@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)

Reply via email to