mirror of https://github.com/acidanthera/audk.git
Simplify the code to use the EFI_FV_FILE_INFO structure of DxeCore to save the extra GUID copy.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5525 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
555a6f4536
commit
b6b98e9133
|
@ -91,16 +91,15 @@ PeiLoadFile (
|
|||
|
||||
|
||||
/**
|
||||
Searches DxeCore in all firmware Volumes and loads the first instance that contains DxeCore.
|
||||
|
||||
@param DxeCoreFileName A Pointer to the EFI_GUID to contain the output DxeCore GUID file name.
|
||||
Searches DxeCore in all firmware Volumes and loads the first
|
||||
instance that contains DxeCore.
|
||||
|
||||
@return FileHandle of DxeCore to load DxeCore.
|
||||
|
||||
**/
|
||||
EFI_PEI_FILE_HANDLE
|
||||
DxeIplFindDxeCore (
|
||||
OUT EFI_GUID *DxeCoreFileName
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ DxeLoadCore (
|
|||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_GUID DxeCoreFileName;
|
||||
EFI_FV_FILE_INFO DxeCoreFileInfo;
|
||||
EFI_PHYSICAL_ADDRESS DxeCoreAddress;
|
||||
UINT64 DxeCoreSize;
|
||||
EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint;
|
||||
|
@ -201,9 +201,9 @@ DxeLoadCore (
|
|||
}
|
||||
|
||||
//
|
||||
// Look in all the FVs present in PEI and find the DXE Core
|
||||
// Look in all the FVs present in PEI and find the DXE Core FileHandle
|
||||
//
|
||||
FileHandle = DxeIplFindDxeCore (&DxeCoreFileName);
|
||||
FileHandle = DxeIplFindDxeCore ();
|
||||
|
||||
//
|
||||
// Load the DXE Core from a Firmware Volume, may use LoadFile ppi to do this for save code size.
|
||||
|
@ -216,11 +216,17 @@ DxeLoadCore (
|
|||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Get the DxeCore File Info from the FileHandle for the DxeCore GUID file name.
|
||||
//
|
||||
Status = PeiServicesFfsGetFileInfo (FileHandle, &DxeCoreFileInfo);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Add HOB for the DXE Core
|
||||
//
|
||||
BuildModuleHob (
|
||||
&DxeCoreFileName,
|
||||
&DxeCoreFileInfo.FileName,
|
||||
DxeCoreAddress,
|
||||
EFI_SIZE_TO_PAGES ((UINTN) DxeCoreSize) * EFI_PAGE_SIZE,
|
||||
DxeCoreEntryPoint
|
||||
|
@ -256,22 +262,18 @@ DxeLoadCore (
|
|||
Searches DxeCore in all firmware Volumes and loads the first
|
||||
instance that contains DxeCore.
|
||||
|
||||
@param DxeCoreFileName A Pointer to the EFI_GUID to contain
|
||||
the output DxeCore GUID file name.
|
||||
|
||||
@return FileHandle of DxeCore to load DxeCore.
|
||||
|
||||
**/
|
||||
EFI_PEI_FILE_HANDLE
|
||||
DxeIplFindDxeCore (
|
||||
OUT EFI_GUID *DxeCoreFileName
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Instance;
|
||||
EFI_PEI_FV_HANDLE VolumeHandle;
|
||||
EFI_PEI_FILE_HANDLE FileHandle;
|
||||
EFI_FV_FILE_INFO FvFileInfo;
|
||||
|
||||
Instance = 0;
|
||||
while (TRUE) {
|
||||
|
@ -292,9 +294,10 @@ DxeIplFindDxeCore (
|
|||
Status = PeiServicesFfsFindNextFile (EFI_FV_FILETYPE_DXE_CORE, VolumeHandle, &FileHandle);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
//
|
||||
// Find DxeCore FileHandle in this volume, then we skip other firmware volume.
|
||||
// Find DxeCore FileHandle in this volume, then we skip other firmware volume and
|
||||
// return the FileHandle.
|
||||
//
|
||||
break;
|
||||
return FileHandle;
|
||||
}
|
||||
//
|
||||
// We cannot find DxeCore in this firmware volume, then search the next volume.
|
||||
|
@ -303,16 +306,10 @@ DxeIplFindDxeCore (
|
|||
}
|
||||
|
||||
//
|
||||
// Extract the DxeCore GUID file name.
|
||||
// We should never reach here.
|
||||
//
|
||||
Status = PeiServicesFfsGetFileInfo (FileHandle, &FvFileInfo);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
CopyGuid (DxeCoreFileName, &FvFileInfo.FileName);
|
||||
|
||||
//
|
||||
// Return the FileHandle to load DxeCore from this volume.
|
||||
//
|
||||
return FileHandle;
|
||||
ASSERT (FALSE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue