ECP package BootScriptSaveOnS3SaveStateThunk driver needs to support framework 32bit dispatch code. It must be loaded into <4G memory.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11349 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2011-03-07 02:23:00 +00:00
parent 6377d2f12d
commit a1fe1d6dd8
1 changed files with 15 additions and 10 deletions

View File

@ -797,11 +797,12 @@ InitializeScriptSaveOnS3SaveState (
{ {
UINT8 *Buffer; UINT8 *Buffer;
UINTN BufferSize; UINTN BufferSize;
VOID *FfsBuffer;
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext; PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
BOOT_SCRIPT_THUNK_DATA *BootScriptThunkData; BOOT_SCRIPT_THUNK_DATA *BootScriptThunkData;
EFI_STATUS Status; EFI_STATUS Status;
VOID *DevicePath; VOID *DevicePath;
EFI_PHYSICAL_ADDRESS MemoryAddress;
UINTN PageNumber;
// //
// Test if the gEfiCallerIdGuid of this image is already installed. if not, the entry // Test if the gEfiCallerIdGuid of this image is already installed. if not, the entry
@ -839,15 +840,19 @@ InitializeScriptSaveOnS3SaveState (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
Status = gBS->AllocatePool (
EfiACPIMemoryNVS, MemoryAddress = SIZE_4GB - 1;
BufferSize + ImageContext.SectionAlignment, PageNumber = EFI_SIZE_TO_PAGES (BufferSize + ImageContext.SectionAlignment);
&FfsBuffer Status = gBS->AllocatePages (
); AllocateMaxAddress,
EfiACPIMemoryNVS,
PageNumber,
&MemoryAddress
);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return EFI_OUT_OF_RESOURCES; return EFI_OUT_OF_RESOURCES;
} }
ImageContext.ImageAddress = (PHYSICAL_ADDRESS)(UINTN)FfsBuffer; ImageContext.ImageAddress = (PHYSICAL_ADDRESS)(UINTN)MemoryAddress;
// //
// Align buffer on section boundry // Align buffer on section boundry
// //
@ -858,7 +863,7 @@ InitializeScriptSaveOnS3SaveState (
// //
Status = PeCoffLoaderLoadImage (&ImageContext); Status = PeCoffLoaderLoadImage (&ImageContext);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->FreePool (FfsBuffer); gBS->FreePages (MemoryAddress, PageNumber);
return Status; return Status;
} }
@ -869,7 +874,7 @@ InitializeScriptSaveOnS3SaveState (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
PeCoffLoaderUnloadImage (&ImageContext); PeCoffLoaderUnloadImage (&ImageContext);
gBS->FreePool (FfsBuffer); gBS->FreePages (MemoryAddress, PageNumber);
return Status; return Status;
} }
// //
@ -878,7 +883,7 @@ InitializeScriptSaveOnS3SaveState (
InvalidateInstructionCacheRange ((VOID *)(UINTN)ImageContext.ImageAddress, (UINTN)ImageContext.ImageSize); InvalidateInstructionCacheRange ((VOID *)(UINTN)ImageContext.ImageAddress, (UINTN)ImageContext.ImageSize);
Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)(ImageContext.EntryPoint)) ((EFI_HANDLE)(UINTN)(ImageContext.ImageAddress), SystemTable); Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)(ImageContext.EntryPoint)) ((EFI_HANDLE)(UINTN)(ImageContext.ImageAddress), SystemTable);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
gBS->FreePool (FfsBuffer); gBS->FreePages (MemoryAddress, PageNumber);
return Status; return Status;
} }
// //