]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/ResetSystemRuntimeDxe: Add more debug message
authorRuiyu Ni <ruiyu.ni@intel.com>
Tue, 5 Sep 2017 03:29:00 +0000 (11:29 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Fri, 9 Feb 2018 07:29:57 +0000 (15:29 +0800)
The patch adds more debug message in ResetSystem().
It also removes unnecessary check of mResetNotifyDepth.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c

index fed527fac2dbca7f9dfd1e50fbe82b90c504cbcc..2c795426f51475348199e5763a45f0892986ba22 100644 (file)
 \r
 #include "ResetSystem.h"\r
 \r
 \r
 #include "ResetSystem.h"\r
 \r
+GLOBAL_REMOVE_IF_UNREFERENCED CHAR16 *mResetTypeStr[] = {\r
+  L"Cold", L"Warm", L"Shutdown", L"PlatformSpecific"\r
+};\r
+\r
 //\r
 // The current ResetSystem() notification recursion depth\r
 //\r
 //\r
 // The current ResetSystem() notification recursion depth\r
 //\r
@@ -251,16 +255,6 @@ ResetSystem (
   LIST_ENTRY          *Link;\r
   RESET_NOTIFY_ENTRY  *Entry;\r
 \r
   LIST_ENTRY          *Link;\r
   RESET_NOTIFY_ENTRY  *Entry;\r
 \r
-  //\r
-  // Above the maximum recursion depth, so do the smallest amount of\r
-  // work to perform a cold reset.\r
-  //\r
-  if (mResetNotifyDepth >= MAX_RESET_NOTIFY_DEPTH) {\r
-    ResetCold ();\r
-    ASSERT (FALSE);\r
-    return;\r
-  }\r
-\r
   //\r
   // Only do REPORT_STATUS_CODE() on first call to ResetSystem()\r
   //\r
   //\r
   // Only do REPORT_STATUS_CODE() on first call to ResetSystem()\r
   //\r
@@ -272,40 +266,47 @@ ResetSystem (
   }\r
 \r
   mResetNotifyDepth++;\r
   }\r
 \r
   mResetNotifyDepth++;\r
-  if (!EfiAtRuntime () && mResetNotifyDepth < MAX_RESET_NOTIFY_DEPTH) {\r
-    //\r
-    // Call reset notification functions registered through the\r
-    // EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PROTOCOL.\r
-    //\r
-    for ( Link = GetFirstNode (&mPlatformSpecificResetFilter.ResetNotifies)\r
-        ; !IsNull (&mPlatformSpecificResetFilter.ResetNotifies, Link)\r
-        ; Link = GetNextNode (&mPlatformSpecificResetFilter.ResetNotifies, Link)\r
-        ) {\r
-      Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);\r
-      Entry->ResetNotify (ResetType, ResetStatus, DataSize, ResetData);\r
-    }\r
-    //\r
-    // Call reset notification functions registered through the\r
-    // EFI_RESET_NOTIFICATION_PROTOCOL.\r
-    //\r
-    for ( Link = GetFirstNode (&mResetNotification.ResetNotifies)\r
-        ; !IsNull (&mResetNotification.ResetNotifies, Link)\r
-        ; Link = GetNextNode (&mResetNotification.ResetNotifies, Link)\r
-        ) {\r
-      Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);\r
-      Entry->ResetNotify (ResetType, ResetStatus, DataSize, ResetData);\r
-    }\r
-    //\r
-    // call reset notification functions registered through the \r
-    // EDKII_PLATFORM_SPECIFIC_RESET_HANDLER_PROTOCOL.\r
-    //\r
-    for ( Link = GetFirstNode (&mPlatformSpecificResetHandler.ResetNotifies)\r
-        ; !IsNull (&mPlatformSpecificResetHandler.ResetNotifies, Link)\r
-        ; Link = GetNextNode (&mPlatformSpecificResetHandler.ResetNotifies, Link)\r
-        ) {\r
-      Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);\r
-      Entry->ResetNotify (ResetType, ResetStatus, DataSize, ResetData);\r
+  DEBUG ((DEBUG_INFO, "DXE ResetSystem2: Reset call depth = %d.\n", mResetNotifyDepth));\r
+\r
+  if (mResetNotifyDepth <= MAX_RESET_NOTIFY_DEPTH) {\r
+    if (!EfiAtRuntime ()) {\r
+      //\r
+      // Call reset notification functions registered through the\r
+      // EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PROTOCOL.\r
+      //\r
+      for ( Link = GetFirstNode (&mPlatformSpecificResetFilter.ResetNotifies)\r
+          ; !IsNull (&mPlatformSpecificResetFilter.ResetNotifies, Link)\r
+          ; Link = GetNextNode (&mPlatformSpecificResetFilter.ResetNotifies, Link)\r
+          ) {\r
+        Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);\r
+        Entry->ResetNotify (ResetType, ResetStatus, DataSize, ResetData);\r
+      }\r
+      //\r
+      // Call reset notification functions registered through the\r
+      // EFI_RESET_NOTIFICATION_PROTOCOL.\r
+      //\r
+      for ( Link = GetFirstNode (&mResetNotification.ResetNotifies)\r
+          ; !IsNull (&mResetNotification.ResetNotifies, Link)\r
+          ; Link = GetNextNode (&mResetNotification.ResetNotifies, Link)\r
+          ) {\r
+        Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);\r
+        Entry->ResetNotify (ResetType, ResetStatus, DataSize, ResetData);\r
+      }\r
+      //\r
+      // call reset notification functions registered through the \r
+      // EDKII_PLATFORM_SPECIFIC_RESET_HANDLER_PROTOCOL.\r
+      //\r
+      for ( Link = GetFirstNode (&mPlatformSpecificResetHandler.ResetNotifies)\r
+          ; !IsNull (&mPlatformSpecificResetHandler.ResetNotifies, Link)\r
+          ; Link = GetNextNode (&mPlatformSpecificResetHandler.ResetNotifies, Link)\r
+          ) {\r
+        Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link);\r
+        Entry->ResetNotify (ResetType, ResetStatus, DataSize, ResetData);\r
+      }\r
     }\r
     }\r
+  } else {\r
+    ASSERT (ResetType < ARRAY_SIZE (mResetTypeStr));\r
+    DEBUG ((DEBUG_ERROR, "DXE ResetSystem2: Maximum reset call depth is met. Use the current reset type: %s!\n", mResetTypeStr[ResetType]));\r
   }\r
 \r
   switch (ResetType) {\r
   }\r
 \r
   switch (ResetType) {\r
@@ -331,7 +332,6 @@ ResetSystem (
     }\r
 \r
     ResetWarm ();\r
     }\r
 \r
     ResetWarm ();\r
-\r
     break;\r
 \r
  case EfiResetCold:\r
     break;\r
 \r
  case EfiResetCold:\r