]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / Dispatcher / Dispatcher.c
index 3605605e9131217d43560b57e15b806d05e88615..fb9ae3ce78dacacead90ed30f2fcc3c527f26670 100644 (file)
@@ -55,7 +55,6 @@ LIST_ENTRY  mFvHandleList = INITIALIZE_LIST_HEAD_VARIABLE (mFvHandleList);
 //\r
 EFI_LOCK  mDispatcherLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);\r
 \r
-\r
 //\r
 // Flag for the DXE Dispacher.  TRUE if dispatcher is execuing.\r
 //\r
@@ -64,13 +63,13 @@ BOOLEAN  gDispatcherRunning = FALSE;
 //\r
 // Module globals to manage the FwVol registration notification event\r
 //\r
-EFI_EVENT       mFwVolEvent;\r
-VOID            *mFwVolEventRegistration;\r
+EFI_EVENT  mFwVolEvent;\r
+VOID       *mFwVolEventRegistration;\r
 \r
 //\r
 // List of file types supported by dispatcher\r
 //\r
-EFI_FV_FILETYPE mDxeFileTypes[] = {\r
+EFI_FV_FILETYPE  mDxeFileTypes[] = {\r
   EFI_FV_FILETYPE_DRIVER,\r
   EFI_FV_FILETYPE_COMBINED_SMM_DXE,\r
   EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER,\r
@@ -79,15 +78,16 @@ EFI_FV_FILETYPE mDxeFileTypes[] = {
 };\r
 \r
 typedef struct {\r
-  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH   File;\r
-  EFI_DEVICE_PATH_PROTOCOL            End;\r
+  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH    File;\r
+  EFI_DEVICE_PATH_PROTOCOL             End;\r
 } FV_FILEPATH_DEVICE_PATH;\r
 \r
-FV_FILEPATH_DEVICE_PATH mFvDevicePath;\r
+FV_FILEPATH_DEVICE_PATH  mFvDevicePath;\r
 \r
 //\r
 // Function Prototypes\r
 //\r
+\r
 /**\r
   Insert InsertedDriverEntry onto the mScheduledQueue. To do this you\r
   must add any driver with a before dependency on InsertedDriverEntry first.\r
@@ -101,7 +101,7 @@ FV_FILEPATH_DEVICE_PATH mFvDevicePath;
 **/\r
 VOID\r
 CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (\r
-  IN  EFI_CORE_DRIVER_ENTRY   *InsertedDriverEntry\r
+  IN  EFI_CORE_DRIVER_ENTRY  *InsertedDriverEntry\r
   );\r
 \r
 /**\r
@@ -124,8 +124,8 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
 VOID\r
 EFIAPI\r
 CoreFwVolEventProtocolNotify (\r
-  IN  EFI_EVENT       Event,\r
-  IN  VOID            *Context\r
+  IN  EFI_EVENT  Event,\r
+  IN  VOID       *Context\r
   );\r
 \r
 /**\r
@@ -143,9 +143,9 @@ CoreFwVolEventProtocolNotify (
 **/\r
 EFI_DEVICE_PATH_PROTOCOL *\r
 CoreFvToDevicePath (\r
-  IN  EFI_FIRMWARE_VOLUME2_PROTOCOL   *Fv,\r
-  IN  EFI_HANDLE                      FvHandle,\r
-  IN  EFI_GUID                        *DriverName\r
+  IN  EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv,\r
+  IN  EFI_HANDLE                     FvHandle,\r
+  IN  EFI_GUID                       *DriverName\r
   );\r
 \r
 /**\r
@@ -171,10 +171,10 @@ CoreFvToDevicePath (
 **/\r
 EFI_STATUS\r
 CoreAddToDriverList (\r
-  IN  EFI_FIRMWARE_VOLUME2_PROTOCOL   *Fv,\r
-  IN  EFI_HANDLE                      FvHandle,\r
-  IN  EFI_GUID                        *DriverName,\r
-  IN  EFI_FV_FILETYPE                 Type\r
+  IN  EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv,\r
+  IN  EFI_HANDLE                     FvHandle,\r
+  IN  EFI_GUID                       *DriverName,\r
+  IN  EFI_FV_FILETYPE                Type\r
   );\r
 \r
 /**\r
@@ -190,12 +190,11 @@ CoreAddToDriverList (
 **/\r
 EFI_STATUS\r
 CoreProcessFvImageFile (\r
-  IN  EFI_FIRMWARE_VOLUME2_PROTOCOL   *Fv,\r
-  IN  EFI_HANDLE                      FvHandle,\r
-  IN  EFI_GUID                        *FileName\r
+  IN  EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv,\r
+  IN  EFI_HANDLE                     FvHandle,\r
+  IN  EFI_GUID                       *FileName\r
   );\r
 \r
-\r
 /**\r
   Enter critical section by gaining lock on mDispatcherLock.\r
 \r
@@ -208,7 +207,6 @@ CoreAcquireDispatcherLock (
   CoreAcquireLock (&mDispatcherLock);\r
 }\r
 \r
-\r
 /**\r
   Exit critical section by releasing lock on mDispatcherLock.\r
 \r
@@ -221,7 +219,6 @@ CoreReleaseDispatcherLock (
   CoreReleaseLock (&mDispatcherLock);\r
 }\r
 \r
-\r
 /**\r
   Read Depex and pre-process the Depex for Before and After. If Section Extraction\r
   protocol returns an error via ReadSection defer the reading of the Depex.\r
@@ -236,30 +233,29 @@ CoreReleaseDispatcherLock (
 **/\r
 EFI_STATUS\r
 CoreGetDepexSectionAndPreProccess (\r
-  IN  EFI_CORE_DRIVER_ENTRY   *DriverEntry\r
+  IN  EFI_CORE_DRIVER_ENTRY  *DriverEntry\r
   )\r
 {\r
-  EFI_STATUS                    Status;\r
-  EFI_SECTION_TYPE              SectionType;\r
-  UINT32                        AuthenticationStatus;\r
-  EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;\r
-\r
+  EFI_STATUS                     Status;\r
+  EFI_SECTION_TYPE               SectionType;\r
+  UINT32                         AuthenticationStatus;\r
+  EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv;\r
 \r
   Fv = DriverEntry->Fv;\r
 \r
   //\r
   // Grab Depex info, it will never be free'ed.\r
   //\r
-  SectionType         = EFI_SECTION_DXE_DEPEX;\r
-  Status = Fv->ReadSection (\r
-                DriverEntry->Fv,\r
-                &DriverEntry->FileName,\r
-                SectionType,\r
-                0,\r
-                &DriverEntry->Depex,\r
-                (UINTN *)&DriverEntry->DepexSize,\r
-                &AuthenticationStatus\r
-                );\r
+  SectionType = EFI_SECTION_DXE_DEPEX;\r
+  Status      = Fv->ReadSection (\r
+                      DriverEntry->Fv,\r
+                      &DriverEntry->FileName,\r
+                      SectionType,\r
+                      0,\r
+                      &DriverEntry->Depex,\r
+                      (UINTN *)&DriverEntry->DepexSize,\r
+                      &AuthenticationStatus\r
+                      );\r
   if (EFI_ERROR (Status)) {\r
     if (Status == EFI_PROTOCOL_ERROR) {\r
       //\r
@@ -270,8 +266,8 @@ CoreGetDepexSectionAndPreProccess (
       //\r
       // If no Depex assume UEFI 2.0 driver model\r
       //\r
-      DriverEntry->Depex = NULL;\r
-      DriverEntry->Dependent = TRUE;\r
+      DriverEntry->Depex              = NULL;\r
+      DriverEntry->Dependent          = TRUE;\r
       DriverEntry->DepexProtocolError = FALSE;\r
     }\r
   } else {\r
@@ -286,7 +282,6 @@ CoreGetDepexSectionAndPreProccess (
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Check every driver and locate a matching one. If the driver is found, the Unrequested\r
   state flag is cleared.\r
@@ -308,23 +303,24 @@ CoreSchedule (
   IN  EFI_GUID    *DriverName\r
   )\r
 {\r
-  LIST_ENTRY            *Link;\r
-  EFI_CORE_DRIVER_ENTRY *DriverEntry;\r
+  LIST_ENTRY             *Link;\r
+  EFI_CORE_DRIVER_ENTRY  *DriverEntry;\r
 \r
   //\r
   // Check every driver\r
   //\r
   for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {\r
-    DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);\r
-    if (DriverEntry->FvHandle == FirmwareVolumeHandle &&\r
+    DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);\r
+    if ((DriverEntry->FvHandle == FirmwareVolumeHandle) &&\r
         DriverEntry->Unrequested &&\r
-        CompareGuid (DriverName, &DriverEntry->FileName)) {\r
+        CompareGuid (DriverName, &DriverEntry->FileName))\r
+    {\r
       //\r
       // Move the driver from the Unrequested to the Dependent state\r
       //\r
       CoreAcquireDispatcherLock ();\r
-      DriverEntry->Unrequested  = FALSE;\r
-      DriverEntry->Dependent    = TRUE;\r
+      DriverEntry->Unrequested = FALSE;\r
+      DriverEntry->Dependent   = TRUE;\r
       CoreReleaseDispatcherLock ();\r
 \r
       DEBUG ((DEBUG_DISPATCH, "Schedule FFS(%g) - EFI_SUCCESS\n", DriverName));\r
@@ -338,8 +334,6 @@ CoreSchedule (
   return EFI_NOT_FOUND;\r
 }\r
 \r
-\r
-\r
 /**\r
   Convert a driver from the Untrused back to the Scheduled state.\r
 \r
@@ -359,17 +353,18 @@ CoreTrust (
   IN  EFI_GUID    *DriverName\r
   )\r
 {\r
-  LIST_ENTRY            *Link;\r
-  EFI_CORE_DRIVER_ENTRY *DriverEntry;\r
+  LIST_ENTRY             *Link;\r
+  EFI_CORE_DRIVER_ENTRY  *DriverEntry;\r
 \r
   //\r
   // Check every driver\r
   //\r
   for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {\r
-    DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);\r
-    if (DriverEntry->FvHandle == FirmwareVolumeHandle &&\r
+    DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);\r
+    if ((DriverEntry->FvHandle == FirmwareVolumeHandle) &&\r
         DriverEntry->Untrusted &&\r
-        CompareGuid (DriverName, &DriverEntry->FileName)) {\r
+        CompareGuid (DriverName, &DriverEntry->FileName))\r
+    {\r
       //\r
       // Transition driver from Untrusted to Scheduled state.\r
       //\r
@@ -382,6 +377,7 @@ CoreTrust (
       return EFI_SUCCESS;\r
     }\r
   }\r
+\r
   return EFI_NOT_FOUND;\r
 }\r
 \r
@@ -405,12 +401,12 @@ CoreDispatcher (
   VOID\r
   )\r
 {\r
-  EFI_STATUS                      Status;\r
-  EFI_STATUS                      ReturnStatus;\r
-  LIST_ENTRY                      *Link;\r
-  EFI_CORE_DRIVER_ENTRY           *DriverEntry;\r
-  BOOLEAN                         ReadyToRun;\r
-  EFI_EVENT                       DxeDispatchEvent;\r
+  EFI_STATUS             Status;\r
+  EFI_STATUS             ReturnStatus;\r
+  LIST_ENTRY             *Link;\r
+  EFI_CORE_DRIVER_ENTRY  *DriverEntry;\r
+  BOOLEAN                ReadyToRun;\r
+  EFI_EVENT              DxeDispatchEvent;\r
 \r
   PERF_FUNCTION_BEGIN ();\r
 \r
@@ -453,16 +449,16 @@ CoreDispatcher (
       // Untrused to Scheduled it would have already been loaded so we may need to\r
       // skip the LoadImage\r
       //\r
-      if (DriverEntry->ImageHandle == NULL && !DriverEntry->IsFvImage) {\r
+      if ((DriverEntry->ImageHandle == NULL) && !DriverEntry->IsFvImage) {\r
         DEBUG ((DEBUG_INFO, "Loading driver %g\n", &DriverEntry->FileName));\r
         Status = CoreLoadImage (\r
-                        FALSE,\r
-                        gDxeCoreImageHandle,\r
-                        DriverEntry->FvFileDevicePath,\r
-                        NULL,\r
-                        0,\r
-                        &DriverEntry->ImageHandle\r
-                        );\r
+                   FALSE,\r
+                   gDxeCoreImageHandle,\r
+                   DriverEntry->FvFileDevicePath,\r
+                   NULL,\r
+                   0,\r
+                   &DriverEntry->ImageHandle\r
+                   );\r
 \r
         //\r
         // Update the driver state to reflect that it's been loaded\r
@@ -482,7 +478,7 @@ CoreDispatcher (
             //\r
             // This case include the Never Trusted state if EFI_ACCESS_DENIED is returned\r
             //\r
-            DriverEntry->Initialized  = TRUE;\r
+            DriverEntry->Initialized = TRUE;\r
           }\r
 \r
           DriverEntry->Scheduled = FALSE;\r
@@ -499,13 +495,12 @@ CoreDispatcher (
 \r
       CoreAcquireDispatcherLock ();\r
 \r
-      DriverEntry->Scheduled    = FALSE;\r
-      DriverEntry->Initialized  = TRUE;\r
+      DriverEntry->Scheduled   = FALSE;\r
+      DriverEntry->Initialized = TRUE;\r
       RemoveEntryList (&DriverEntry->ScheduledLink);\r
 \r
       CoreReleaseDispatcherLock ();\r
 \r
-\r
       if (DriverEntry->IsFvImage) {\r
         //\r
         // Produce a firmware volume block protocol for FvImage so it gets dispatched from.\r
@@ -549,7 +544,7 @@ CoreDispatcher (
     for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {\r
       DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);\r
 \r
-      if (DriverEntry->DepexProtocolError){\r
+      if (DriverEntry->DepexProtocolError) {\r
         //\r
         // If Section Extraction Protocol did not let the Depex be read before retry the read\r
         //\r
@@ -583,7 +578,6 @@ CoreDispatcher (
   return ReturnStatus;\r
 }\r
 \r
-\r
 /**\r
   Insert InsertedDriverEntry onto the mScheduledQueue. To do this you\r
   must add any driver with a before dependency on InsertedDriverEntry first.\r
@@ -597,18 +591,18 @@ CoreDispatcher (
 **/\r
 VOID\r
 CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (\r
-  IN  EFI_CORE_DRIVER_ENTRY   *InsertedDriverEntry\r
+  IN  EFI_CORE_DRIVER_ENTRY  *InsertedDriverEntry\r
   )\r
 {\r
-  LIST_ENTRY            *Link;\r
-  EFI_CORE_DRIVER_ENTRY *DriverEntry;\r
+  LIST_ENTRY             *Link;\r
+  EFI_CORE_DRIVER_ENTRY  *DriverEntry;\r
 \r
   //\r
   // Process Before Dependency\r
   //\r
   for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {\r
-    DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);\r
-    if (DriverEntry->Before && DriverEntry->Dependent && DriverEntry != InsertedDriverEntry) {\r
+    DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);\r
+    if (DriverEntry->Before && DriverEntry->Dependent && (DriverEntry != InsertedDriverEntry)) {\r
       DEBUG ((DEBUG_DISPATCH, "Evaluate DXE DEPEX for FFS(%g)\n", &DriverEntry->FileName));\r
       DEBUG ((DEBUG_DISPATCH, "  BEFORE FFS(%g) = ", &DriverEntry->BeforeAfterGuid));\r
       if (CompareGuid (&InsertedDriverEntry->FileName, &DriverEntry->BeforeAfterGuid)) {\r
@@ -638,8 +632,8 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
   // Process After Dependency\r
   //\r
   for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {\r
-    DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);\r
-    if (DriverEntry->After && DriverEntry->Dependent && DriverEntry != InsertedDriverEntry) {\r
+    DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);\r
+    if (DriverEntry->After && DriverEntry->Dependent && (DriverEntry != InsertedDriverEntry)) {\r
       DEBUG ((DEBUG_DISPATCH, "Evaluate DXE DEPEX for FFS(%g)\n", &DriverEntry->FileName));\r
       DEBUG ((DEBUG_DISPATCH, "  AFTER FFS(%g) = ", &DriverEntry->BeforeAfterGuid));\r
       if (CompareGuid (&InsertedDriverEntry->FileName, &DriverEntry->BeforeAfterGuid)) {\r
@@ -655,7 +649,6 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
   }\r
 }\r
 \r
-\r
 /**\r
   Return TRUE if the Fv has been processed, FALSE if not.\r
 \r
@@ -667,22 +660,22 @@ CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter (
 **/\r
 BOOLEAN\r
 FvHasBeenProcessed (\r
-  IN  EFI_HANDLE      FvHandle\r
+  IN  EFI_HANDLE  FvHandle\r
   )\r
 {\r
-  LIST_ENTRY      *Link;\r
-  KNOWN_HANDLE    *KnownHandle;\r
+  LIST_ENTRY    *Link;\r
+  KNOWN_HANDLE  *KnownHandle;\r
 \r
   for (Link = mFvHandleList.ForwardLink; Link != &mFvHandleList; Link = Link->ForwardLink) {\r
-    KnownHandle = CR(Link, KNOWN_HANDLE, Link, KNOWN_HANDLE_SIGNATURE);\r
+    KnownHandle = CR (Link, KNOWN_HANDLE, Link, KNOWN_HANDLE_SIGNATURE);\r
     if (KnownHandle->Handle == FvHandle) {\r
       return TRUE;\r
     }\r
   }\r
+\r
   return FALSE;\r
 }\r
 \r
-\r
 /**\r
   Remember that Fv protocol on FvHandle has had it's drivers placed on the\r
   mDiscoveredList. This fucntion adds entries on the mFvHandleList if new\r
@@ -697,21 +690,21 @@ FvHasBeenProcessed (
 **/\r
 KNOWN_HANDLE *\r
 FvIsBeingProcessed (\r
-  IN  EFI_HANDLE    FvHandle\r
+  IN  EFI_HANDLE  FvHandle\r
   )\r
 {\r
-  EFI_STATUS                            Status;\r
-  EFI_GUID                              FvNameGuid;\r
-  BOOLEAN                               FvNameGuidIsFound;\r
-  UINT32                                ExtHeaderOffset;\r
-  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL    *Fvb;\r
-  EFI_FIRMWARE_VOLUME_HEADER            *FwVolHeader;\r
-  EFI_FV_BLOCK_MAP_ENTRY                *BlockMap;\r
-  UINTN                                 LbaOffset;\r
-  UINTN                                 Index;\r
-  EFI_LBA                               LbaIndex;\r
-  LIST_ENTRY                            *Link;\r
-  KNOWN_HANDLE                          *KnownHandle;\r
+  EFI_STATUS                          Status;\r
+  EFI_GUID                            FvNameGuid;\r
+  BOOLEAN                             FvNameGuidIsFound;\r
+  UINT32                              ExtHeaderOffset;\r
+  EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL  *Fvb;\r
+  EFI_FIRMWARE_VOLUME_HEADER          *FwVolHeader;\r
+  EFI_FV_BLOCK_MAP_ENTRY              *BlockMap;\r
+  UINTN                               LbaOffset;\r
+  UINTN                               Index;\r
+  EFI_LBA                             LbaIndex;\r
+  LIST_ENTRY                          *Link;\r
+  KNOWN_HANDLE                        *KnownHandle;\r
 \r
   FwVolHeader = NULL;\r
 \r
@@ -719,7 +712,7 @@ FvIsBeingProcessed (
   // Get the FirmwareVolumeBlock protocol on that handle\r
   //\r
   FvNameGuidIsFound = FALSE;\r
-  Status = CoreHandleProtocol (FvHandle, &gEfiFirmwareVolumeBlockProtocolGuid, (VOID **)&Fvb);\r
+  Status            = CoreHandleProtocol (FvHandle, &gEfiFirmwareVolumeBlockProtocolGuid, (VOID **)&Fvb);\r
   if (!EFI_ERROR (Status)) {\r
     //\r
     // Get the full FV header based on FVB protocol.\r
@@ -728,19 +721,20 @@ FvIsBeingProcessed (
     Status = GetFwVolHeader (Fvb, &FwVolHeader);\r
     if (!EFI_ERROR (Status)) {\r
       ASSERT (FwVolHeader != NULL);\r
-      if (VerifyFvHeaderChecksum (FwVolHeader) && FwVolHeader->ExtHeaderOffset != 0) {\r
-        ExtHeaderOffset = (UINT32) FwVolHeader->ExtHeaderOffset;\r
-        BlockMap  = FwVolHeader->BlockMap;\r
-        LbaIndex  = 0;\r
-        LbaOffset = 0;\r
+      if (VerifyFvHeaderChecksum (FwVolHeader) && (FwVolHeader->ExtHeaderOffset != 0)) {\r
+        ExtHeaderOffset = (UINT32)FwVolHeader->ExtHeaderOffset;\r
+        BlockMap        = FwVolHeader->BlockMap;\r
+        LbaIndex        = 0;\r
+        LbaOffset       = 0;\r
         //\r
         // Find LbaIndex and LbaOffset for FV extension header based on BlockMap.\r
         //\r
         while ((BlockMap->NumBlocks != 0) || (BlockMap->Length != 0)) {\r
-          for (Index = 0; Index < BlockMap->NumBlocks && ExtHeaderOffset >= BlockMap->Length; Index ++) {\r
+          for (Index = 0; Index < BlockMap->NumBlocks && ExtHeaderOffset >= BlockMap->Length; Index++) {\r
             ExtHeaderOffset -= BlockMap->Length;\r
-            LbaIndex ++;\r
+            LbaIndex++;\r
           }\r
+\r
           //\r
           // Check whether FvExtHeader is crossing the multi block range.\r
           //\r
@@ -748,16 +742,19 @@ FvIsBeingProcessed (
             LbaOffset = ExtHeaderOffset;\r
             break;\r
           }\r
+\r
           BlockMap++;\r
         }\r
+\r
         //\r
         // Read FvNameGuid from FV extension header.\r
         //\r
-        Status = ReadFvbData (Fvb, &LbaIndex, &LbaOffset, sizeof (FvNameGuid), (UINT8 *) &FvNameGuid);\r
+        Status = ReadFvbData (Fvb, &LbaIndex, &LbaOffset, sizeof (FvNameGuid), (UINT8 *)&FvNameGuid);\r
         if (!EFI_ERROR (Status)) {\r
           FvNameGuidIsFound = TRUE;\r
         }\r
       }\r
+\r
       CoreFreePool (FwVolHeader);\r
     }\r
   }\r
@@ -767,7 +764,7 @@ FvIsBeingProcessed (
     // Check whether the FV image with the found FvNameGuid has been processed.\r
     //\r
     for (Link = mFvHandleList.ForwardLink; Link != &mFvHandleList; Link = Link->ForwardLink) {\r
-      KnownHandle = CR(Link, KNOWN_HANDLE, Link, KNOWN_HANDLE_SIGNATURE);\r
+      KnownHandle = CR (Link, KNOWN_HANDLE, Link, KNOWN_HANDLE_SIGNATURE);\r
       if (CompareGuid (&FvNameGuid, &KnownHandle->FvNameGuid)) {\r
         DEBUG ((DEBUG_ERROR, "FvImage on FvHandle %p and %p has the same FvNameGuid %g.\n", FvHandle, KnownHandle->Handle, &FvNameGuid));\r
         return NULL;\r
@@ -779,17 +776,15 @@ FvIsBeingProcessed (
   ASSERT (KnownHandle != NULL);\r
 \r
   KnownHandle->Signature = KNOWN_HANDLE_SIGNATURE;\r
-  KnownHandle->Handle = FvHandle;\r
+  KnownHandle->Handle    = FvHandle;\r
   if (FvNameGuidIsFound) {\r
     CopyGuid (&KnownHandle->FvNameGuid, &FvNameGuid);\r
   }\r
+\r
   InsertTailList (&mFvHandleList, &KnownHandle->Link);\r
   return KnownHandle;\r
 }\r
 \r
-\r
-\r
-\r
 /**\r
   Convert FvHandle and DriverName into an EFI device path\r
 \r
@@ -805,14 +800,14 @@ FvIsBeingProcessed (
 **/\r
 EFI_DEVICE_PATH_PROTOCOL *\r
 CoreFvToDevicePath (\r
-  IN  EFI_FIRMWARE_VOLUME2_PROTOCOL   *Fv,\r
-  IN  EFI_HANDLE                      FvHandle,\r
-  IN  EFI_GUID                        *DriverName\r
+  IN  EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv,\r
+  IN  EFI_HANDLE                     FvHandle,\r
+  IN  EFI_GUID                       *DriverName\r
   )\r
 {\r
-  EFI_STATUS                          Status;\r
-  EFI_DEVICE_PATH_PROTOCOL            *FvDevicePath;\r
-  EFI_DEVICE_PATH_PROTOCOL            *FileNameDevicePath;\r
+  EFI_STATUS                Status;\r
+  EFI_DEVICE_PATH_PROTOCOL  *FvDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *FileNameDevicePath;\r
 \r
   //\r
   // Remember the device path of the FV\r
@@ -828,16 +823,14 @@ CoreFvToDevicePath (
     SetDevicePathEndNode (&mFvDevicePath.End);\r
 \r
     FileNameDevicePath = AppendDevicePath (\r
-                            FvDevicePath,\r
-                            (EFI_DEVICE_PATH_PROTOCOL *)&mFvDevicePath\r
-                            );\r
+                           FvDevicePath,\r
+                           (EFI_DEVICE_PATH_PROTOCOL *)&mFvDevicePath\r
+                           );\r
   }\r
 \r
   return FileNameDevicePath;\r
 }\r
 \r
-\r
-\r
 /**\r
   Add an entry to the mDiscoveredList. Allocate memory to store the DriverEntry,\r
   and initilize any state variables. Read the Depex from the FV and store it\r
@@ -861,14 +854,13 @@ CoreFvToDevicePath (
 **/\r
 EFI_STATUS\r
 CoreAddToDriverList (\r
-  IN  EFI_FIRMWARE_VOLUME2_PROTOCOL   *Fv,\r
-  IN  EFI_HANDLE                      FvHandle,\r
-  IN  EFI_GUID                        *DriverName,\r
-  IN  EFI_FV_FILETYPE                 Type\r
+  IN  EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv,\r
+  IN  EFI_HANDLE                     FvHandle,\r
+  IN  EFI_GUID                       *DriverName,\r
+  IN  EFI_FV_FILETYPE                Type\r
   )\r
 {\r
-  EFI_CORE_DRIVER_ENTRY               *DriverEntry;\r
-\r
+  EFI_CORE_DRIVER_ENTRY  *DriverEntry;\r
 \r
   //\r
   // Create the Driver Entry for the list. ZeroPool initializes lots of variables to\r
@@ -880,7 +872,7 @@ CoreAddToDriverList (
     DriverEntry->IsFvImage = TRUE;\r
   }\r
 \r
-  DriverEntry->Signature        = EFI_CORE_DRIVER_ENTRY_SIGNATURE;\r
+  DriverEntry->Signature = EFI_CORE_DRIVER_ENTRY_SIGNATURE;\r
   CopyGuid (&DriverEntry->FileName, DriverName);\r
   DriverEntry->FvHandle         = FvHandle;\r
   DriverEntry->Fv               = Fv;\r
@@ -897,7 +889,6 @@ CoreAddToDriverList (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
   Check if a FV Image type file (EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) is\r
   described by a EFI_HOB_FIRMWARE_VOLUME2 Hob.\r
@@ -912,11 +903,11 @@ CoreAddToDriverList (
 **/\r
 BOOLEAN\r
 FvFoundInHobFv2 (\r
-  IN  CONST EFI_GUID                  *FvNameGuid,\r
-  IN  CONST EFI_GUID                  *DriverName\r
+  IN  CONST EFI_GUID  *FvNameGuid,\r
+  IN  CONST EFI_GUID  *DriverName\r
   )\r
 {\r
-  EFI_PEI_HOB_POINTERS                HobFv2;\r
+  EFI_PEI_HOB_POINTERS  HobFv2;\r
 \r
   HobFv2.Raw = GetHobList ();\r
 \r
@@ -925,9 +916,11 @@ FvFoundInHobFv2 (
     // Compare parent FvNameGuid and FileGuid both.\r
     //\r
     if (CompareGuid (DriverName, &HobFv2.FirmwareVolume2->FileName) &&\r
-        CompareGuid (FvNameGuid, &HobFv2.FirmwareVolume2->FvName)) {\r
+        CompareGuid (FvNameGuid, &HobFv2.FirmwareVolume2->FvName))\r
+    {\r
       return TRUE;\r
     }\r
+\r
     HobFv2.Raw = GET_NEXT_HOB (HobFv2);\r
   }\r
 \r
@@ -950,9 +943,9 @@ FvFoundInHobFv2 (
 **/\r
 BOOLEAN\r
 GetFvUsedSize (\r
-  IN EFI_FIRMWARE_VOLUME_HEADER     *FvHeader,\r
-  OUT UINT32                        *FvUsedSize,\r
-  OUT UINT8                         *EraseByte\r
+  IN EFI_FIRMWARE_VOLUME_HEADER  *FvHeader,\r
+  OUT UINT32                     *FvUsedSize,\r
+  OUT UINT8                      *EraseByte\r
   )\r
 {\r
   UINT16                                        ExtHeaderOffset;\r
@@ -962,20 +955,21 @@ GetFvUsedSize (
 \r
   ExtHeaderOffset = ReadUnaligned16 (&FvHeader->ExtHeaderOffset);\r
   if (ExtHeaderOffset != 0) {\r
-    ExtHeader    = (EFI_FIRMWARE_VOLUME_EXT_HEADER *) ((UINT8 *) FvHeader + ExtHeaderOffset);\r
-    ExtEntryList = (EFI_FIRMWARE_VOLUME_EXT_ENTRY *) (ExtHeader + 1);\r
-    while ((UINTN) ExtEntryList < ((UINTN) ExtHeader + ReadUnaligned32 (&ExtHeader->ExtHeaderSize))) {\r
+    ExtHeader    = (EFI_FIRMWARE_VOLUME_EXT_HEADER *)((UINT8 *)FvHeader + ExtHeaderOffset);\r
+    ExtEntryList = (EFI_FIRMWARE_VOLUME_EXT_ENTRY *)(ExtHeader + 1);\r
+    while ((UINTN)ExtEntryList < ((UINTN)ExtHeader + ReadUnaligned32 (&ExtHeader->ExtHeaderSize))) {\r
       if (ReadUnaligned16 (&ExtEntryList->ExtEntryType) == EFI_FV_EXT_TYPE_USED_SIZE_TYPE) {\r
         //\r
         // USED_SIZE FV_EXT_TYPE entry is found.\r
         //\r
-        ExtEntryUsedSize = (EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE *) ExtEntryList;\r
-        *FvUsedSize = ReadUnaligned32 (&ExtEntryUsedSize->UsedSize);\r
+        ExtEntryUsedSize = (EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE *)ExtEntryList;\r
+        *FvUsedSize      = ReadUnaligned32 (&ExtEntryUsedSize->UsedSize);\r
         if ((ReadUnaligned32 (&FvHeader->Attributes) & EFI_FVB2_ERASE_POLARITY) != 0) {\r
           *EraseByte = 0xFF;\r
         } else {\r
           *EraseByte = 0;\r
         }\r
+\r
         DEBUG ((\r
           DEBUG_INFO,\r
           "FV at 0x%x has 0x%x used size, and erase byte is 0x%02x\n",\r
@@ -985,8 +979,9 @@ GetFvUsedSize (
           ));\r
         return TRUE;\r
       }\r
+\r
       ExtEntryList = (EFI_FIRMWARE_VOLUME_EXT_ENTRY *)\r
-                     ((UINT8 *) ExtEntryList + ReadUnaligned16 (&ExtEntryList->ExtEntrySize));\r
+                     ((UINT8 *)ExtEntryList + ReadUnaligned16 (&ExtEntryList->ExtEntrySize));\r
     }\r
   }\r
 \r
@@ -1009,28 +1004,28 @@ GetFvUsedSize (
 **/\r
 EFI_STATUS\r
 CoreProcessFvImageFile (\r
-  IN  EFI_FIRMWARE_VOLUME2_PROTOCOL   *Fv,\r
-  IN  EFI_HANDLE                      FvHandle,\r
-  IN  EFI_GUID                        *FileName\r
+  IN  EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv,\r
+  IN  EFI_HANDLE                     FvHandle,\r
+  IN  EFI_GUID                       *FileName\r
   )\r
 {\r
-  EFI_STATUS                          Status;\r
-  EFI_SECTION_TYPE                    SectionType;\r
-  UINT32                              AuthenticationStatus;\r
-  VOID                                *Buffer;\r
-  VOID                                *AlignedBuffer;\r
-  UINTN                               BufferSize;\r
-  EFI_FIRMWARE_VOLUME_HEADER          *FvHeader;\r
-  UINT32                              FvAlignment;\r
-  EFI_DEVICE_PATH_PROTOCOL            *FvFileDevicePath;\r
-  UINT32                              FvUsedSize;\r
-  UINT8                               EraseByte;\r
-  UINTN                               Index;\r
+  EFI_STATUS                  Status;\r
+  EFI_SECTION_TYPE            SectionType;\r
+  UINT32                      AuthenticationStatus;\r
+  VOID                        *Buffer;\r
+  VOID                        *AlignedBuffer;\r
+  UINTN                       BufferSize;\r
+  EFI_FIRMWARE_VOLUME_HEADER  *FvHeader;\r
+  UINT32                      FvAlignment;\r
+  EFI_DEVICE_PATH_PROTOCOL    *FvFileDevicePath;\r
+  UINT32                      FvUsedSize;\r
+  UINT8                       EraseByte;\r
+  UINTN                       Index;\r
 \r
   //\r
   // Read firmware volume section(s)\r
   //\r
-  SectionType   = EFI_SECTION_FIRMWARE_VOLUME_IMAGE;\r
+  SectionType = EFI_SECTION_FIRMWARE_VOLUME_IMAGE;\r
 \r
   Index = 0;\r
   do {\r
@@ -1039,27 +1034,27 @@ CoreProcessFvImageFile (
     Buffer        = NULL;\r
     BufferSize    = 0;\r
     AlignedBuffer = NULL;\r
-    Status = Fv->ReadSection (\r
-                   Fv,\r
-                   FileName,\r
-                   SectionType,\r
-                   Index,\r
-                   &Buffer,\r
-                   &BufferSize,\r
-                   &AuthenticationStatus\r
-                   );\r
+    Status        = Fv->ReadSection (\r
+                          Fv,\r
+                          FileName,\r
+                          SectionType,\r
+                          Index,\r
+                          &Buffer,\r
+                          &BufferSize,\r
+                          &AuthenticationStatus\r
+                          );\r
     if (!EFI_ERROR (Status)) {\r
-       //\r
+      //\r
       // Evaluate the authentication status of the Firmware Volume through\r
       // Security Architectural Protocol\r
       //\r
       if (gSecurity != NULL) {\r
         FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, FileName);\r
-        Status = gSecurity->FileAuthenticationState (\r
-                              gSecurity,\r
-                              AuthenticationStatus,\r
-                              FvFileDevicePath\r
-                              );\r
+        Status           = gSecurity->FileAuthenticationState (\r
+                                        gSecurity,\r
+                                        AuthenticationStatus,\r
+                                        FvFileDevicePath\r
+                                        );\r
         if (FvFileDevicePath != NULL) {\r
           FreePool (FvFileDevicePath);\r
         }\r
@@ -1071,6 +1066,7 @@ CoreProcessFvImageFile (
           if (Buffer != NULL) {\r
             FreePool (Buffer);\r
           }\r
+\r
           break;\r
         }\r
       }\r
@@ -1078,7 +1074,7 @@ CoreProcessFvImageFile (
       //\r
       // FvImage should be at its required alignment.\r
       //\r
-      FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) Buffer;\r
+      FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)Buffer;\r
       //\r
       // If EFI_FVB2_WEAK_ALIGNMENT is set in the volume header then the first byte of the volume\r
       // can be aligned on any power-of-two boundary. A weakly aligned volume can not be moved from\r
@@ -1107,11 +1103,11 @@ CoreProcessFvImageFile (
         //\r
         // Check FvImage alignment.\r
         //\r
-        if ((UINTN) FvHeader % FvAlignment != 0) {\r
+        if ((UINTN)FvHeader % FvAlignment != 0) {\r
           //\r
           // Allocate the aligned buffer for the FvImage.\r
           //\r
-          AlignedBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES (BufferSize), (UINTN) FvAlignment);\r
+          AlignedBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES (BufferSize), (UINTN)FvAlignment);\r
           if (AlignedBuffer == NULL) {\r
             FreePool (Buffer);\r
             Status = EFI_OUT_OF_RESOURCES;\r
@@ -1124,31 +1120,33 @@ CoreProcessFvImageFile (
               //\r
               // Copy the used bytes and fill the rest with the erase value.\r
               //\r
-              CopyMem (AlignedBuffer, FvHeader, (UINTN) FvUsedSize);\r
+              CopyMem (AlignedBuffer, FvHeader, (UINTN)FvUsedSize);\r
               SetMem (\r
-                (UINT8 *) AlignedBuffer + FvUsedSize,\r
-                (UINTN) (BufferSize - FvUsedSize),\r
+                (UINT8 *)AlignedBuffer + FvUsedSize,\r
+                (UINTN)(BufferSize - FvUsedSize),\r
                 EraseByte\r
                 );\r
             } else {\r
               CopyMem (AlignedBuffer, Buffer, BufferSize);\r
             }\r
-            FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) AlignedBuffer;\r
+\r
+            FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)AlignedBuffer;\r
             FreePool (Buffer);\r
             Buffer = NULL;\r
           }\r
         }\r
       }\r
+\r
       //\r
       // Produce a FVB protocol for the file\r
       //\r
       Status = ProduceFVBProtocolOnBuffer (\r
-                (EFI_PHYSICAL_ADDRESS) (UINTN) FvHeader,\r
-                (UINT64)BufferSize,\r
-                FvHandle,\r
-                AuthenticationStatus,\r
-                NULL\r
-                );\r
+                 (EFI_PHYSICAL_ADDRESS)(UINTN)FvHeader,\r
+                 (UINT64)BufferSize,\r
+                 FvHandle,\r
+                 AuthenticationStatus,\r
+                 NULL\r
+                 );\r
     }\r
 \r
     if (EFI_ERROR (Status)) {\r
@@ -1179,7 +1177,6 @@ CoreProcessFvImageFile (
   }\r
 }\r
 \r
-\r
 /**\r
   Event notification that is fired every time a FV dispatch protocol is added.\r
   More than one protocol may have been added when this event is fired, so you\r
@@ -1200,42 +1197,42 @@ CoreProcessFvImageFile (
 VOID\r
 EFIAPI\r
 CoreFwVolEventProtocolNotify (\r
-  IN  EFI_EVENT       Event,\r
-  IN  VOID            *Context\r
+  IN  EFI_EVENT  Event,\r
+  IN  VOID       *Context\r
   )\r
 {\r
-  EFI_STATUS                    Status;\r
-  EFI_STATUS                    GetNextFileStatus;\r
-  EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;\r
-  EFI_DEVICE_PATH_PROTOCOL      *FvDevicePath;\r
-  EFI_HANDLE                    FvHandle;\r
-  UINTN                         BufferSize;\r
-  EFI_GUID                      NameGuid;\r
-  UINTN                         Key;\r
-  EFI_FV_FILETYPE               Type;\r
-  EFI_FV_FILE_ATTRIBUTES        Attributes;\r
-  UINTN                         Size;\r
-  EFI_CORE_DRIVER_ENTRY         *DriverEntry;\r
-  EFI_GUID                      *AprioriFile;\r
-  UINTN                         AprioriEntryCount;\r
-  UINTN                         Index;\r
-  LIST_ENTRY                    *Link;\r
-  UINT32                        AuthenticationStatus;\r
-  UINTN                         SizeOfBuffer;\r
-  VOID                          *DepexBuffer;\r
-  KNOWN_HANDLE                  *KnownHandle;\r
+  EFI_STATUS                     Status;\r
+  EFI_STATUS                     GetNextFileStatus;\r
+  EFI_FIRMWARE_VOLUME2_PROTOCOL  *Fv;\r
+  EFI_DEVICE_PATH_PROTOCOL       *FvDevicePath;\r
+  EFI_HANDLE                     FvHandle;\r
+  UINTN                          BufferSize;\r
+  EFI_GUID                       NameGuid;\r
+  UINTN                          Key;\r
+  EFI_FV_FILETYPE                Type;\r
+  EFI_FV_FILE_ATTRIBUTES         Attributes;\r
+  UINTN                          Size;\r
+  EFI_CORE_DRIVER_ENTRY          *DriverEntry;\r
+  EFI_GUID                       *AprioriFile;\r
+  UINTN                          AprioriEntryCount;\r
+  UINTN                          Index;\r
+  LIST_ENTRY                     *Link;\r
+  UINT32                         AuthenticationStatus;\r
+  UINTN                          SizeOfBuffer;\r
+  VOID                           *DepexBuffer;\r
+  KNOWN_HANDLE                   *KnownHandle;\r
 \r
   FvHandle = NULL;\r
 \r
   while (TRUE) {\r
     BufferSize = sizeof (EFI_HANDLE);\r
-    Status = CoreLocateHandle (\r
-               ByRegisterNotify,\r
-               NULL,\r
-               mFwVolEventRegistration,\r
-               &BufferSize,\r
-               &FvHandle\r
-               );\r
+    Status     = CoreLocateHandle (\r
+                   ByRegisterNotify,\r
+                   NULL,\r
+                   mFwVolEventRegistration,\r
+                   &BufferSize,\r
+                   &FvHandle\r
+                   );\r
     if (EFI_ERROR (Status)) {\r
       //\r
       // If no more notification events exit\r
@@ -1263,7 +1260,7 @@ CoreFwVolEventProtocolNotify (
     }\r
 \r
     Status = CoreHandleProtocol (FvHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv);\r
-    if (EFI_ERROR (Status) || Fv == NULL) {\r
+    if (EFI_ERROR (Status) || (Fv == NULL)) {\r
       //\r
       // FvHandle must have Firmware Volume2 protocol thus we should never get here.\r
       //\r
@@ -1291,7 +1288,7 @@ CoreFwVolEventProtocolNotify (
       //\r
       Key = 0;\r
       do {\r
-        Type = mDxeFileTypes[Index];\r
+        Type              = mDxeFileTypes[Index];\r
         GetNextFileStatus = Fv->GetNextFile (\r
                                   Fv,\r
                                   &Key,\r
@@ -1334,15 +1331,15 @@ CoreFwVolEventProtocolNotify (
             //\r
             DepexBuffer  = NULL;\r
             SizeOfBuffer = 0;\r
-            Status = Fv->ReadSection (\r
-                           Fv,\r
-                           &NameGuid,\r
-                           EFI_SECTION_SMM_DEPEX,\r
-                           0,\r
-                           &DepexBuffer,\r
-                           &SizeOfBuffer,\r
-                           &AuthenticationStatus\r
-                           );\r
+            Status       = Fv->ReadSection (\r
+                                 Fv,\r
+                                 &NameGuid,\r
+                                 EFI_SECTION_SMM_DEPEX,\r
+                                 0,\r
+                                 &DepexBuffer,\r
+                                 &SizeOfBuffer,\r
+                                 &AuthenticationStatus\r
+                                 );\r
             if (!EFI_ERROR (Status)) {\r
               //\r
               // If SMM depex section is found, this FV image is invalid to be supported.\r
@@ -1357,15 +1354,15 @@ CoreFwVolEventProtocolNotify (
             //\r
             DepexBuffer  = NULL;\r
             SizeOfBuffer = 0;\r
-            Status = Fv->ReadSection (\r
-                           Fv,\r
-                           &NameGuid,\r
-                           EFI_SECTION_DXE_DEPEX,\r
-                           0,\r
-                           &DepexBuffer,\r
-                           &SizeOfBuffer,\r
-                           &AuthenticationStatus\r
-                           );\r
+            Status       = Fv->ReadSection (\r
+                                 Fv,\r
+                                 &NameGuid,\r
+                                 EFI_SECTION_DXE_DEPEX,\r
+                                 0,\r
+                                 &DepexBuffer,\r
+                                 &SizeOfBuffer,\r
+                                 &AuthenticationStatus\r
+                                 );\r
             if (EFI_ERROR (Status)) {\r
               //\r
               // If no depex section, produce a firmware volume block protocol for it so it gets dispatched from.\r
@@ -1392,15 +1389,15 @@ CoreFwVolEventProtocolNotify (
     // Read the array of GUIDs from the Apriori file if it is present in the firmware volume\r
     //\r
     AprioriFile = NULL;\r
-    Status = Fv->ReadSection (\r
-                  Fv,\r
-                  &gAprioriGuid,\r
-                  EFI_SECTION_RAW,\r
-                  0,\r
-                  (VOID **)&AprioriFile,\r
-                  &SizeOfBuffer,\r
-                  &AuthenticationStatus\r
-                  );\r
+    Status      = Fv->ReadSection (\r
+                        Fv,\r
+                        &gAprioriGuid,\r
+                        EFI_SECTION_RAW,\r
+                        0,\r
+                        (VOID **)&AprioriFile,\r
+                        &SizeOfBuffer,\r
+                        &AuthenticationStatus\r
+                        );\r
     if (!EFI_ERROR (Status)) {\r
       AprioriEntryCount = SizeOfBuffer / sizeof (EFI_GUID);\r
     } else {\r
@@ -1415,9 +1412,10 @@ CoreFwVolEventProtocolNotify (
 \r
     for (Index = 0; Index < AprioriEntryCount; Index++) {\r
       for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {\r
-        DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);\r
+        DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);\r
         if (CompareGuid (&DriverEntry->FileName, &AprioriFile[Index]) &&\r
-            (FvHandle == DriverEntry->FvHandle)) {\r
+            (FvHandle == DriverEntry->FvHandle))\r
+        {\r
           CoreAcquireDispatcherLock ();\r
           DriverEntry->Dependent = FALSE;\r
           DriverEntry->Scheduled = TRUE;\r
@@ -1437,8 +1435,6 @@ CoreFwVolEventProtocolNotify (
   }\r
 }\r
 \r
-\r
-\r
 /**\r
   Initialize the dispatcher. Initialize the notification function that runs when\r
   an FV2 protocol is added to the system.\r
@@ -1476,11 +1472,11 @@ CoreDisplayDiscoveredNotDispatched (
   VOID\r
   )\r
 {\r
-  LIST_ENTRY                    *Link;\r
-  EFI_CORE_DRIVER_ENTRY         *DriverEntry;\r
+  LIST_ENTRY             *Link;\r
+  EFI_CORE_DRIVER_ENTRY  *DriverEntry;\r
 \r
-  for (Link = mDiscoveredList.ForwardLink;Link !=&mDiscoveredList; Link = Link->ForwardLink) {\r
-    DriverEntry = CR(Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);\r
+  for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {\r
+    DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);\r
     if (DriverEntry->Dependent) {\r
       DEBUG ((DEBUG_LOAD, "Driver %g was discovered but not loaded!!\n", &DriverEntry->FileName));\r
     }\r