mirror of https://github.com/acidanthera/audk.git
Code scrub DxeIpl to add back the CONST modifier and solve a typecast warning.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5516 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
f88f0fb67b
commit
9b937a73b0
|
@ -61,6 +61,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
//
|
||||
extern BOOLEAN gInMemory;
|
||||
|
||||
//
|
||||
// This PPI is installed to indicate the end of the PEI usage of memory
|
||||
//
|
||||
extern CONST EFI_PEI_PPI_DESCRIPTOR gEndOfPeiSignalPpi;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Loads and relocates a PE/COFF image into memory.
|
||||
|
||||
|
@ -84,21 +91,19 @@ PeiLoadFile (
|
|||
|
||||
|
||||
/**
|
||||
Find DxeCore driver from all First Volumes.
|
||||
Searches DxeCore in all firmware Volumes and loads the first instance that contains DxeCore.
|
||||
|
||||
@param FileHandle Pointer to FFS file to search.
|
||||
@param DxeCoreFileName A Pointer to the EFI_GUID to contain the output DxeCore GUID file name.
|
||||
|
||||
@return EFI_SUCESS Success to find the FFS in specificed FV
|
||||
@return others Fail to find the FFS in specificed FV
|
||||
@return FileHandle of DxeCore to load DxeCore.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFI_PEI_FILE_HANDLE
|
||||
DxeIplFindDxeCore (
|
||||
OUT EFI_PEI_FILE_HANDLE *FileHandle
|
||||
OUT EFI_GUID *DxeCoreFileName
|
||||
);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
This function simply retrieves the function pointer of ImageRead in
|
||||
ImageContext structure.
|
||||
|
@ -145,14 +150,12 @@ DxeLoadCore (
|
|||
|
||||
@param DxeCoreEntryPoint The entrypoint of DxeCore.
|
||||
@param HobList The start of HobList passed to DxeCore.
|
||||
@param EndOfPeiSignal The PPI descriptor for EFI_END_OF_PEI_PPI.
|
||||
|
||||
**/
|
||||
VOID
|
||||
HandOffToDxeCore (
|
||||
IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
|
||||
IN EFI_PEI_HOB_POINTERS HobList,
|
||||
IN EFI_PEI_PPI_DESCRIPTOR *EndOfPeiSignal
|
||||
IN EFI_PEI_HOB_POINTERS HobList
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -25,32 +25,32 @@ BOOLEAN gInMemory = FALSE;
|
|||
// Module Globals used in the DXE to PEI handoff
|
||||
// These must be module globals, so the stack can be switched
|
||||
//
|
||||
EFI_DXE_IPL_PPI mDxeIplPpi = {
|
||||
CONST EFI_DXE_IPL_PPI mDxeIplPpi = {
|
||||
DxeLoadCore
|
||||
};
|
||||
|
||||
EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI mCustomGuidedSectionExtractionPpi = {
|
||||
CONST EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI mCustomGuidedSectionExtractionPpi = {
|
||||
CustomGuidedSectionExtract
|
||||
};
|
||||
|
||||
EFI_PEI_DECOMPRESS_PPI mDecompressPpi = {
|
||||
CONST EFI_PEI_DECOMPRESS_PPI mDecompressPpi = {
|
||||
Decompress
|
||||
};
|
||||
|
||||
EFI_PEI_PPI_DESCRIPTOR mPpiList[] = {
|
||||
CONST EFI_PEI_PPI_DESCRIPTOR mPpiList[] = {
|
||||
{
|
||||
EFI_PEI_PPI_DESCRIPTOR_PPI,
|
||||
&gEfiDxeIplPpiGuid,
|
||||
&mDxeIplPpi
|
||||
(VOID *) &mDxeIplPpi
|
||||
},
|
||||
{
|
||||
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||
&gEfiPeiDecompressPpiGuid,
|
||||
&mDecompressPpi
|
||||
(VOID *) &mDecompressPpi
|
||||
}
|
||||
};
|
||||
|
||||
EFI_PEI_PPI_DESCRIPTOR mPpiSignal = {
|
||||
CONST EFI_PEI_PPI_DESCRIPTOR gEndOfPeiSignalPpi = {
|
||||
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||
&gEfiEndOfPeiSignalPpiGuid,
|
||||
NULL
|
||||
|
@ -102,7 +102,7 @@ PeimInitializeDxeIpl (
|
|||
ASSERT (GuidPpi != NULL);
|
||||
while (ExtractHandlerNumber-- > 0) {
|
||||
GuidPpi->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
|
||||
GuidPpi->Ppi = &mCustomGuidedSectionExtractionPpi;
|
||||
GuidPpi->Ppi = (VOID *) &mCustomGuidedSectionExtractionPpi;
|
||||
GuidPpi->Guid = &(ExtractHandlerGuidTable [ExtractHandlerNumber]);
|
||||
Status = PeiServicesInstallPpi (GuidPpi++);
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
|
@ -203,11 +203,7 @@ DxeLoadCore (
|
|||
//
|
||||
// Look in all the FVs present in PEI and find the DXE Core
|
||||
//
|
||||
FileHandle = NULL;
|
||||
Status = DxeIplFindDxeCore (&FileHandle);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
CopyGuid(&DxeCoreFileName, &(((EFI_FFS_FILE_HEADER*)FileHandle)->Name));
|
||||
FileHandle = DxeIplFindDxeCore (&DxeCoreFileName);
|
||||
|
||||
//
|
||||
// Load the DXE Core from a Firmware Volume, may use LoadFile ppi to do this for save code size.
|
||||
|
@ -244,7 +240,7 @@ DxeLoadCore (
|
|||
// Transfer control to the DXE Core
|
||||
// The handoff state is simply a pointer to the HOB list
|
||||
//
|
||||
HandOffToDxeCore (DxeCoreEntryPoint, HobList, &mPpiSignal);
|
||||
HandOffToDxeCore (DxeCoreEntryPoint, HobList);
|
||||
//
|
||||
// If we get here, then the DXE Core returned. This is an error
|
||||
// Dxe Core should not return.
|
||||
|
@ -256,41 +252,67 @@ DxeLoadCore (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Find DxeCore driver from all First Volumes.
|
||||
Searches DxeCore in all firmware Volumes and loads the first
|
||||
instance that contains DxeCore.
|
||||
|
||||
@param FileHandle Pointer to FFS file to search.
|
||||
@param DxeCoreFileName A Pointer to the EFI_GUID to contain
|
||||
the output DxeCore GUID file name.
|
||||
|
||||
@return EFI_SUCESS Success to find the FFS in specificed FV
|
||||
@return others Fail to find the FFS in specificed FV
|
||||
@return FileHandle of DxeCore to load DxeCore.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFI_PEI_FILE_HANDLE
|
||||
DxeIplFindDxeCore (
|
||||
OUT EFI_PEI_FILE_HANDLE *FileHandle
|
||||
OUT EFI_GUID *DxeCoreFileName
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS FileStatus;
|
||||
UINTN Instance;
|
||||
EFI_PEI_FV_HANDLE VolumeHandle;
|
||||
EFI_PEI_FILE_HANDLE FileHandle;
|
||||
EFI_FV_FILE_INFO FvFileInfo;
|
||||
|
||||
Instance = 0;
|
||||
*FileHandle = NULL;
|
||||
while (TRUE) {
|
||||
//
|
||||
// Traverse all firmware volume instances
|
||||
//
|
||||
Status = PeiServicesFfsFindNextVolume (Instance, &VolumeHandle);
|
||||
//
|
||||
// If some error occurs here, then we cannot find any firmware
|
||||
// volume that may contain DxeCore.
|
||||
//
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
do {
|
||||
Status = PeiServicesFfsFindNextVolume (Instance++, &VolumeHandle);
|
||||
//
|
||||
// Find the DxeCore file type from the beginning in this firmware volume.
|
||||
//
|
||||
FileHandle = NULL;
|
||||
Status = PeiServicesFfsFindNextFile (EFI_FV_FILETYPE_DXE_CORE, VolumeHandle, &FileHandle);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
FileStatus = PeiServicesFfsFindNextFile (EFI_FV_FILETYPE_DXE_CORE, VolumeHandle, FileHandle);
|
||||
if (!EFI_ERROR (FileStatus)) {
|
||||
return FileStatus;
|
||||
//
|
||||
// Find DxeCore FileHandle in this volume, then we skip other firmware volume.
|
||||
//
|
||||
break;
|
||||
}
|
||||
//
|
||||
// We cannot find DxeCore in this firmware volume, then search the next volume.
|
||||
//
|
||||
Instance++;
|
||||
}
|
||||
} while (!EFI_ERROR (Status));
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
//
|
||||
// Extract the DxeCore GUID file name.
|
||||
//
|
||||
Status = PeiServicesFfsGetFileInfo (FileHandle, &FvFileInfo);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
CopyGuid (DxeCoreFileName, &FvFileInfo.FileName);
|
||||
|
||||
//
|
||||
// Return the FileHandle to load DxeCore from this volume.
|
||||
//
|
||||
return FileHandle;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,14 +53,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED IA32_DESCRIPTOR gLidtDescriptor = {
|
|||
|
||||
@param DxeCoreEntryPoint The entrypoint of DxeCore.
|
||||
@param HobList The start of HobList passed to DxeCore.
|
||||
@param EndOfPeiSignal The PPI descriptor for EFI_END_OF_PEI_PPI.
|
||||
|
||||
**/
|
||||
VOID
|
||||
HandOffToDxeCore (
|
||||
IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
|
||||
IN EFI_PEI_HOB_POINTERS HobList,
|
||||
IN EFI_PEI_PPI_DESCRIPTOR *EndOfPeiSignal
|
||||
IN EFI_PEI_HOB_POINTERS HobList
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
@ -106,7 +104,7 @@ HandOffToDxeCore (
|
|||
//
|
||||
// End of PEI phase singal
|
||||
//
|
||||
Status = PeiServicesInstallPpi (EndOfPeiSignal);
|
||||
Status = PeiServicesInstallPpi (&gEndOfPeiSignalPpi);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
AsmWriteCr3 (PageTables);
|
||||
|
@ -169,7 +167,7 @@ HandOffToDxeCore (
|
|||
//
|
||||
// End of PEI phase singal
|
||||
//
|
||||
Status = PeiServicesInstallPpi (EndOfPeiSignal);
|
||||
Status = PeiServicesInstallPpi (&gEndOfPeiSignalPpi);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
|
|
|
@ -56,9 +56,6 @@ PeiImageRead (
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
This function simply retrieves the function pointer of ImageRead in
|
||||
ImageContext structure.
|
||||
|
|
|
@ -25,14 +25,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
@param DxeCoreEntryPoint The entrypoint of DxeCore.
|
||||
@param HobList The start of HobList passed to DxeCore.
|
||||
@param EndOfPeiSignal The PPI descriptor for EFI_END_OF_PEI_PPI.
|
||||
|
||||
**/
|
||||
VOID
|
||||
HandOffToDxeCore (
|
||||
IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
|
||||
IN EFI_PEI_HOB_POINTERS HobList,
|
||||
IN EFI_PEI_PPI_DESCRIPTOR *EndOfPeiSignal
|
||||
IN EFI_PEI_HOB_POINTERS HobList
|
||||
)
|
||||
{
|
||||
VOID *BaseOfStack;
|
||||
|
@ -66,7 +64,7 @@ HandOffToDxeCore (
|
|||
//
|
||||
// End of PEI phase singal
|
||||
//
|
||||
Status = PeiServicesInstallPpi (EndOfPeiSignal);
|
||||
Status = PeiServicesInstallPpi (&gEndOfPeiSignalPpi);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
|
|
|
@ -25,14 +25,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
@param DxeCoreEntryPoint The entrypoint of DxeCore.
|
||||
@param HobList The start of HobList passed to DxeCore.
|
||||
@param EndOfPeiSignal The PPI descriptor for EFI_END_OF_PEI_PPI.
|
||||
|
||||
**/
|
||||
VOID
|
||||
HandOffToDxeCore (
|
||||
IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
|
||||
IN EFI_PEI_HOB_POINTERS HobList,
|
||||
IN EFI_PEI_PPI_DESCRIPTOR *EndOfPeiSignal
|
||||
IN EFI_PEI_HOB_POINTERS HobList
|
||||
)
|
||||
{
|
||||
VOID *BaseOfStack;
|
||||
|
@ -55,7 +53,7 @@ HandOffToDxeCore (
|
|||
//
|
||||
// End of PEI phase singal
|
||||
//
|
||||
Status = PeiServicesInstallPpi (EndOfPeiSignal);
|
||||
Status = PeiServicesInstallPpi (&gEndOfPeiSignalPpi);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue