]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/StatusCode/RuntimeDxe/StatusCodeRuntimeDxe.c
FatPkg: Clean up source files
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / StatusCode / RuntimeDxe / StatusCodeRuntimeDxe.c
index eb193c8e6ed711ce29778c6f5f0159a6421537b9..6435e1f727d0dcefd4e7ce7559436f26316ad6a9 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   Status code driver for IA32/X64/EBC architecture.\r
 \r
-  Copyright (c) 2006 - 2009, Intel Corporation\r
-  All rights reserved. This program and the accompanying materials\r
+  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   http://opensource.org/licenses/bsd-license.php\r
@@ -205,9 +205,8 @@ InitializationDispatcherWorker (
   EFI_STATUS                        Status;\r
   MEMORY_STATUSCODE_PACKET_HEADER   *PacketHeader;\r
   MEMORY_STATUSCODE_RECORD          *Record;\r
-  UINTN                             ExpectedPacketIndex;\r
   UINTN                             Index;\r
-  VOID                              *HobStart;\r
+  UINTN                             MaxRecordNumber;\r
 \r
   //\r
   // If enable UseSerial, then initialize serial port.\r
@@ -226,8 +225,7 @@ InitializationDispatcherWorker (
     ASSERT_EFI_ERROR (Status);\r
   }\r
   if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {\r
-    Status = DataHubStatusCodeInitializeWorker ();\r
-    ASSERT_EFI_ERROR (Status);\r
+    DataHubStatusCodeInitializeWorker ();\r
   }\r
   if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
     //\r
@@ -245,73 +243,59 @@ InitializationDispatcherWorker (
     // Journal GUID'ed HOBs to find all record entry, if found, \r
     // then output record to support replay device.\r
     //\r
-    ExpectedPacketIndex = 0;\r
     Hob.Raw   = GetFirstGuidHob (&gMemoryStatusCodeRecordGuid);\r
-    HobStart  = Hob.Raw;\r
-    while (Hob.Raw != NULL) {\r
+    if (Hob.Raw != NULL) {\r
       PacketHeader = (MEMORY_STATUSCODE_PACKET_HEADER *) GET_GUID_HOB_DATA (Hob.Guid);\r
-      if (PacketHeader->PacketIndex == ExpectedPacketIndex) {\r
-        Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1);\r
-        for (Index = 0; Index < PacketHeader->RecordIndex; Index++) {\r
-          //\r
-          // Dispatch records to devices based on feature flag.\r
-          //\r
-          if (FeaturePcdGet (PcdStatusCodeUseSerial)) {\r
-            SerialStatusCodeReportWorker (\r
-              Record[Index].CodeType,\r
-              Record[Index].Value,\r
-              Record[Index].Instance,\r
-              NULL,\r
-              NULL\r
-              );\r
-          }\r
-          if (FeaturePcdGet (PcdStatusCodeUseMemory)) {\r
-            RtMemoryStatusCodeReportWorker (\r
-              Record[Index].CodeType,\r
-              Record[Index].Value,\r
-              Record[Index].Instance\r
-              );\r
-          }\r
-          if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {\r
-            DataHubStatusCodeReportWorker (\r
-              Record[Index].CodeType,\r
-              Record[Index].Value,\r
-              Record[Index].Instance,\r
-              NULL,\r
-              NULL\r
-              );\r
-          }\r
-          if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
-            //\r
-            // Call OEM hook status code library API to report status code to OEM device\r
-            //\r
-            OemHookStatusCodeReport (\r
-              Record[Index].CodeType,\r
-              Record[Index].Value,\r
-              Record[Index].Instance,\r
-              NULL,\r
-              NULL\r
-              );\r
-          }\r
-        }\r
-        ExpectedPacketIndex++;\r
-  \r
+      Record = (MEMORY_STATUSCODE_RECORD *) (PacketHeader + 1);\r
+      MaxRecordNumber = (UINTN) PacketHeader->RecordIndex;\r
+      if (PacketHeader->PacketIndex > 0) {\r
         //\r
-        // See whether there is gap of packet or not\r
+        // Record has been wrapped around. So, record number has arrived at max number.\r
         //\r
-        if (HobStart != NULL) {\r
-          HobStart  = NULL;\r
-          Hob.Raw   = HobStart;\r
-          continue;\r
-        }\r
-      } else if (HobStart != NULL) {\r
+        MaxRecordNumber = (UINTN) PacketHeader->MaxRecordsNumber;\r
+      }\r
+      for (Index = 0; Index < MaxRecordNumber; Index++) {\r
         //\r
-        // Cache the found packet for improve the performance\r
+        // Dispatch records to devices based on feature flag.\r
         //\r
-        HobStart = Hob.Raw;\r
+        if (FeaturePcdGet (PcdStatusCodeUseSerial)) {\r
+          SerialStatusCodeReportWorker (\r
+            Record[Index].CodeType,\r
+            Record[Index].Value,\r
+            Record[Index].Instance,\r
+            NULL,\r
+            NULL\r
+            );\r
+        }\r
+        if (FeaturePcdGet (PcdStatusCodeUseMemory)) {\r
+          RtMemoryStatusCodeReportWorker (\r
+            Record[Index].CodeType,\r
+            Record[Index].Value,\r
+            Record[Index].Instance\r
+            );\r
+        }\r
+        if (FeaturePcdGet (PcdStatusCodeUseDataHub)) {\r
+          DataHubStatusCodeReportWorker (\r
+            Record[Index].CodeType,\r
+            Record[Index].Value,\r
+            Record[Index].Instance,\r
+            NULL,\r
+            NULL\r
+            );\r
+        }\r
+        if (FeaturePcdGet (PcdStatusCodeUseOEM)) {\r
+          //\r
+          // Call OEM hook status code library API to report status code to OEM device\r
+          //\r
+          OemHookStatusCodeReport (\r
+            Record[Index].CodeType,\r
+            Record[Index].Value,\r
+            Record[Index].Instance,\r
+            NULL,\r
+            NULL\r
+            );\r
+        }\r
       }\r
-  \r
-      Hob.Raw = GetNextGuidHob (&gMemoryStatusCodeRecordGuid, Hob.Raw);\r
     }\r
   }\r
 }\r