From fd9abd045e41387ef8e5cfbb4588220cf7a1261d Mon Sep 17 00:00:00 2001 From: Elvin Li Date: Fri, 29 Aug 2014 09:01:52 +0000 Subject: Allocate EfiReservedMemoryType of memory. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Elvin Li Signed-off-by: Liming Gao git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15977 6f19259b-4bc3-4df7-8a09-765794883524 --- .../CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf | 5 ----- .../CapsuleRuntimeDxe/X64/SaveLongModeContext.c | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 16 deletions(-) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf index 491eba378d..fc4863f15a 100644 --- a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf +++ b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf @@ -56,7 +56,6 @@ BaseMemoryLib [LibraryClasses.X64] - LockBoxLib UefiLib BaseMemoryLib HobLib @@ -67,10 +66,6 @@ gEfiCapsuleVendorGuid gEfiFmpCapsuleGuid ## SOMETIMES_CONSUMES ## GUID # FMP capsule GUID -[Guids.X64] - gEfiAcpiVariableGuid ## SOMETIMES_CONSUMES ## GUID # RestoreLockBox - gEfiAcpiS3ContextGuid ## SOMETIMES_CONSUMES ## GUID # RestoreLockBox - [Protocols] gEfiCapsuleArchProtocolGuid ## PRODUCES diff --git a/MdeModulePkg/Universal/CapsuleRuntimeDxe/X64/SaveLongModeContext.c b/MdeModulePkg/Universal/CapsuleRuntimeDxe/X64/SaveLongModeContext.c index a5c7c48eee..79615c9755 100644 --- a/MdeModulePkg/Universal/CapsuleRuntimeDxe/X64/SaveLongModeContext.c +++ b/MdeModulePkg/Universal/CapsuleRuntimeDxe/X64/SaveLongModeContext.c @@ -28,23 +28,22 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include #include #include #include /** - Allocate EfiACPIMemoryNVS below 4G memory address. + Allocate EfiReservedMemoryType below 4G memory address. - This function allocates EfiACPIMemoryNVS below 4G memory address. + This function allocates EfiReservedMemoryType below 4G memory address. - @param Size Size of memory to allocate. + @param Size Size of memory to allocate. - @return Allocated address for output. + @return Allocated Address for output. **/ VOID* -AllocateAcpiNvsMemoryBelow4G ( +AllocateReservedMemoryBelow4G ( IN UINTN Size ) { @@ -58,7 +57,7 @@ AllocateAcpiNvsMemoryBelow4G ( Status = gBS->AllocatePages ( AllocateMaxAddress, - EfiACPIMemoryNVS, + EfiReservedMemoryType, Pages, &Address ); @@ -97,8 +96,8 @@ VariableLockCapsuleLongModeBufferVariable ( } /** - 1. Allocate NVS memory for capsule PEIM to establish a 1:1 Virtual to Physical mapping. - 2. Allocate NVS memroy as a stack for capsule PEIM to transfer from 32-bit mdoe to 64-bit mode. + 1. Allocate Reserved memory for capsule PEIM to establish a 1:1 Virtual to Physical mapping. + 2. Allocate Reserved memroy as a stack for capsule PEIM to transfer from 32-bit mdoe to 64-bit mode. **/ VOID @@ -177,7 +176,7 @@ PrepareContextForCapsulePei ( TotalPagesNum = NumberOfPml4EntriesNeeded + 1; } - LongModeBuffer.PageTableAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateAcpiNvsMemoryBelow4G (EFI_PAGES_TO_SIZE (TotalPagesNum)); + LongModeBuffer.PageTableAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateReservedMemoryBelow4G (EFI_PAGES_TO_SIZE (TotalPagesNum)); ASSERT (LongModeBuffer.PageTableAddress != 0); PcdSet64 (PcdIdentifyMappingPageTablePtr, LongModeBuffer.PageTableAddress); } @@ -186,7 +185,7 @@ PrepareContextForCapsulePei ( // Allocate stack // LongModeBuffer.StackSize = PcdGet32 (PcdCapsulePeiLongModeStackSize); - LongModeBuffer.StackBaseAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateAcpiNvsMemoryBelow4G (PcdGet32 (PcdCapsulePeiLongModeStackSize)); + LongModeBuffer.StackBaseAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)AllocateReservedMemoryBelow4G (PcdGet32 (PcdCapsulePeiLongModeStackSize)); ASSERT (LongModeBuffer.StackBaseAddress != 0); Status = gRT->SetVariable ( -- cgit v1.2.3