mirror of https://github.com/acidanthera/audk.git
Allocate EfiReservedMemoryType of memory.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Elvin Li <elvin.li@intel.com> Signed-off-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15977 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
d7325a8c49
commit
fd9abd045e
|
@ -56,7 +56,6 @@
|
||||||
BaseMemoryLib
|
BaseMemoryLib
|
||||||
|
|
||||||
[LibraryClasses.X64]
|
[LibraryClasses.X64]
|
||||||
LockBoxLib
|
|
||||||
UefiLib
|
UefiLib
|
||||||
BaseMemoryLib
|
BaseMemoryLib
|
||||||
HobLib
|
HobLib
|
||||||
|
@ -67,10 +66,6 @@
|
||||||
gEfiCapsuleVendorGuid
|
gEfiCapsuleVendorGuid
|
||||||
gEfiFmpCapsuleGuid ## SOMETIMES_CONSUMES ## GUID # FMP capsule GUID
|
gEfiFmpCapsuleGuid ## SOMETIMES_CONSUMES ## GUID # FMP capsule GUID
|
||||||
|
|
||||||
[Guids.X64]
|
|
||||||
gEfiAcpiVariableGuid ## SOMETIMES_CONSUMES ## GUID # RestoreLockBox
|
|
||||||
gEfiAcpiS3ContextGuid ## SOMETIMES_CONSUMES ## GUID # RestoreLockBox
|
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiCapsuleArchProtocolGuid ## PRODUCES
|
gEfiCapsuleArchProtocolGuid ## PRODUCES
|
||||||
|
|
||||||
|
|
|
@ -28,23 +28,22 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||||
#include <Library/UefiRuntimeLib.h>
|
#include <Library/UefiRuntimeLib.h>
|
||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
#include <Library/LockBoxLib.h>
|
|
||||||
#include <Library/UefiLib.h>
|
#include <Library/UefiLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/HobLib.h>
|
#include <Library/HobLib.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
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*
|
VOID*
|
||||||
AllocateAcpiNvsMemoryBelow4G (
|
AllocateReservedMemoryBelow4G (
|
||||||
IN UINTN Size
|
IN UINTN Size
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +57,7 @@ AllocateAcpiNvsMemoryBelow4G (
|
||||||
|
|
||||||
Status = gBS->AllocatePages (
|
Status = gBS->AllocatePages (
|
||||||
AllocateMaxAddress,
|
AllocateMaxAddress,
|
||||||
EfiACPIMemoryNVS,
|
EfiReservedMemoryType,
|
||||||
Pages,
|
Pages,
|
||||||
&Address
|
&Address
|
||||||
);
|
);
|
||||||
|
@ -97,8 +96,8 @@ VariableLockCapsuleLongModeBufferVariable (
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
1. Allocate NVS memory for capsule PEIM to establish a 1:1 Virtual to Physical mapping.
|
1. Allocate Reserved 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.
|
2. Allocate Reserved memroy as a stack for capsule PEIM to transfer from 32-bit mdoe to 64-bit mode.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
|
@ -177,7 +176,7 @@ PrepareContextForCapsulePei (
|
||||||
TotalPagesNum = NumberOfPml4EntriesNeeded + 1;
|
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);
|
ASSERT (LongModeBuffer.PageTableAddress != 0);
|
||||||
PcdSet64 (PcdIdentifyMappingPageTablePtr, LongModeBuffer.PageTableAddress);
|
PcdSet64 (PcdIdentifyMappingPageTablePtr, LongModeBuffer.PageTableAddress);
|
||||||
}
|
}
|
||||||
|
@ -186,7 +185,7 @@ PrepareContextForCapsulePei (
|
||||||
// Allocate stack
|
// Allocate stack
|
||||||
//
|
//
|
||||||
LongModeBuffer.StackSize = PcdGet32 (PcdCapsulePeiLongModeStackSize);
|
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);
|
ASSERT (LongModeBuffer.StackBaseAddress != 0);
|
||||||
|
|
||||||
Status = gRT->SetVariable (
|
Status = gRT->SetVariable (
|
||||||
|
|
Loading…
Reference in New Issue