]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Simplify the code to use the EFI_FV_FILE_INFO structure of DxeCore to save the extra...
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 19 Jul 2008 01:38:40 +0000 (01:38 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 19 Jul 2008 01:38:40 +0000 (01:38 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5525 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
MdeModulePkg/Core/DxeIplPeim/DxeLoad.c

index 99968d4438cd197da55c6a78c625ae95a1c65fac..790ca4545ea50e2a16208530b38f6790c82040c6 100644 (file)
@@ -91,16 +91,15 @@ PeiLoadFile (
 \r
 \r
 /**\r
-   Searches DxeCore in all firmware Volumes and loads the first instance that contains DxeCore.\r
-\r
-   @param DxeCoreFileName    A Pointer to the EFI_GUID to contain the output DxeCore GUID file name.\r
+   Searches DxeCore in all firmware Volumes and loads the first\r
+   instance that contains DxeCore.\r
 \r
    @return FileHandle of DxeCore to load DxeCore.\r
    \r
 **/\r
 EFI_PEI_FILE_HANDLE\r
 DxeIplFindDxeCore (\r
-  OUT EFI_GUID   *DxeCoreFileName\r
+  VOID\r
   );\r
 \r
 \r
index 5cd6b2cb17d3f37781adebb549ddf929770e16e1..b35e09c2c9ea6e05f5ff966d644ff2bc3ad84826 100644 (file)
@@ -142,7 +142,7 @@ DxeLoadCore (
   )\r
 {\r
   EFI_STATUS                                Status;\r
-  EFI_GUID                                  DxeCoreFileName;\r
+  EFI_FV_FILE_INFO                          DxeCoreFileInfo;\r
   EFI_PHYSICAL_ADDRESS                      DxeCoreAddress;\r
   UINT64                                    DxeCoreSize;\r
   EFI_PHYSICAL_ADDRESS                      DxeCoreEntryPoint;\r
@@ -201,9 +201,9 @@ DxeLoadCore (
   }\r
 \r
   //\r
-  // Look in all the FVs present in PEI and find the DXE Core\r
+  // Look in all the FVs present in PEI and find the DXE Core FileHandle\r
   //\r
-  FileHandle = DxeIplFindDxeCore (&DxeCoreFileName);\r
+  FileHandle = DxeIplFindDxeCore ();\r
 \r
   //\r
   // Load the DXE Core from a Firmware Volume, may use LoadFile ppi to do this for save code size.\r
@@ -216,11 +216,17 @@ DxeLoadCore (
              );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
+  //\r
+  // Get the DxeCore File Info from the FileHandle for the DxeCore GUID file name.\r
+  //\r
+  Status = PeiServicesFfsGetFileInfo (FileHandle, &DxeCoreFileInfo);\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
   //\r
   // Add HOB for the DXE Core\r
   //\r
   BuildModuleHob (\r
-    &DxeCoreFileName,\r
+    &DxeCoreFileInfo.FileName,\r
     DxeCoreAddress,\r
     EFI_SIZE_TO_PAGES ((UINTN) DxeCoreSize) * EFI_PAGE_SIZE,\r
     DxeCoreEntryPoint\r
@@ -256,22 +262,18 @@ DxeLoadCore (
    Searches DxeCore in all firmware Volumes and loads the first\r
    instance that contains DxeCore.\r
 \r
-   @param DxeCoreFileName    A Pointer to the EFI_GUID to contain\r
-                             the output DxeCore GUID file name.\r
-\r
    @return FileHandle of DxeCore to load DxeCore.\r
    \r
 **/\r
 EFI_PEI_FILE_HANDLE\r
 DxeIplFindDxeCore (\r
-  OUT EFI_GUID   *DxeCoreFileName\r
+  VOID\r
   )\r
 {\r
   EFI_STATUS            Status;\r
   UINTN                 Instance;\r
   EFI_PEI_FV_HANDLE     VolumeHandle;\r
   EFI_PEI_FILE_HANDLE   FileHandle;\r
-  EFI_FV_FILE_INFO      FvFileInfo;\r
   \r
   Instance    = 0;\r
   while (TRUE) {\r
@@ -292,9 +294,10 @@ DxeIplFindDxeCore (
     Status = PeiServicesFfsFindNextFile (EFI_FV_FILETYPE_DXE_CORE, VolumeHandle, &FileHandle);\r
     if (!EFI_ERROR (Status)) {\r
       //\r
-      // Find DxeCore FileHandle in this volume, then we skip other firmware volume.\r
+      // Find DxeCore FileHandle in this volume, then we skip other firmware volume and\r
+      // return the FileHandle.\r
       //\r
-      break;\r
+      return FileHandle;\r
     }\r
     //\r
     // We cannot find DxeCore in this firmware volume, then search the next volume.\r
@@ -303,16 +306,10 @@ DxeIplFindDxeCore (
   }\r
 \r
   //\r
-  // Extract the DxeCore GUID file name.\r
+  // We should never reach here.\r
   //\r
-  Status = PeiServicesFfsGetFileInfo (FileHandle, &FvFileInfo);\r
-  ASSERT_EFI_ERROR (Status);\r
-  CopyGuid (DxeCoreFileName, &FvFileInfo.FileName);\r
-\r
-  //\r
-  // Return the FileHandle to load DxeCore from this volume.\r
-  //\r
-  return FileHandle;\r
+  ASSERT (FALSE);\r
+  return NULL;\r
 }\r
 \r
 \r
@@ -480,11 +477,11 @@ CustomGuidedSectionExtract (
   // Call GetInfo to get the size and attribute of input guided section data.\r
   //\r
   Status = ExtractGuidedSectionGetInfo (\r
-            InputSection,\r
-            &OutputBufferSize,\r
-            &ScratchBufferSize,\r
-            &SectionAttribute\r
-           );\r
+             InputSection,\r
+             &OutputBufferSize,\r
+             &ScratchBufferSize,\r
+             &SectionAttribute\r
+             );\r
   \r
   if (EFI_ERROR (Status)) {\r
     DEBUG ((DEBUG_ERROR, "GetInfo from guided section Failed - %r\n", Status));\r