MdeModulePkg/PiSmmCore: switch to MdePkg allocation granularity macros
Remove the local definitions for the default and runtime page allocation granularity macros, and switch to the new MdePkg versions. Note that this replaces a reference to the 'default' version with the more correct 'runtime' version, but this matters little in practice. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
@ -795,7 +795,7 @@ SetMemoryAttributesTableSectionAlignment (
|
|||||||
IN UINT32 SectionAlignment
|
IN UINT32 SectionAlignment
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (((SectionAlignment & (EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT - 1)) != 0) &&
|
if (((SectionAlignment & (RUNTIME_PAGE_ALLOCATION_GRANULARITY - 1)) != 0) &&
|
||||||
((mMemoryProtectionAttribute & EFI_MEMORY_ATTRIBUTES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA) != 0)) {
|
((mMemoryProtectionAttribute & EFI_MEMORY_ATTRIBUTES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA) != 0)) {
|
||||||
DEBUG ((DEBUG_VERBOSE, "SMM SetMemoryAttributesTableSectionAlignment - Clear\n"));
|
DEBUG ((DEBUG_VERBOSE, "SMM SetMemoryAttributesTableSectionAlignment - Clear\n"));
|
||||||
mMemoryProtectionAttribute &= ~((UINT64)EFI_MEMORY_ATTRIBUTES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA);
|
mMemoryProtectionAttribute &= ~((UINT64)EFI_MEMORY_ATTRIBUTES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA);
|
||||||
@ -1125,9 +1125,9 @@ SmmInsertImageRecord (
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetMemoryAttributesTableSectionAlignment (SectionAlignment);
|
SetMemoryAttributesTableSectionAlignment (SectionAlignment);
|
||||||
if ((SectionAlignment & (EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT - 1)) != 0) {
|
if ((SectionAlignment & (RUNTIME_PAGE_ALLOCATION_GRANULARITY - 1)) != 0) {
|
||||||
DEBUG ((DEBUG_WARN, "SMM !!!!!!!! InsertImageRecord - Section Alignment(0x%x) is not %dK !!!!!!!!\n",
|
DEBUG ((DEBUG_WARN, "SMM !!!!!!!! InsertImageRecord - Section Alignment(0x%x) is not %dK !!!!!!!!\n",
|
||||||
SectionAlignment, EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT >> 10));
|
SectionAlignment, RUNTIME_PAGE_ALLOCATION_GRANULARITY >> 10));
|
||||||
PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageAddress);
|
PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageAddress);
|
||||||
if (PdbPointer != NULL) {
|
if (PdbPointer != NULL) {
|
||||||
DEBUG ((DEBUG_WARN, "SMM !!!!!!!! Image - %a !!!!!!!!\n", PdbPointer));
|
DEBUG ((DEBUG_WARN, "SMM !!!!!!!! Image - %a !!!!!!!!\n", PdbPointer));
|
||||||
|
@ -110,7 +110,7 @@ AllocateMemoryMapEntry (
|
|||||||
Status = SmmInternalAllocatePagesEx (
|
Status = SmmInternalAllocatePagesEx (
|
||||||
AllocateAnyPages,
|
AllocateAnyPages,
|
||||||
EfiRuntimeServicesData,
|
EfiRuntimeServicesData,
|
||||||
EFI_SIZE_TO_PAGES(DEFAULT_PAGE_ALLOCATION),
|
EFI_SIZE_TO_PAGES (RUNTIME_PAGE_ALLOCATION_GRANULARITY),
|
||||||
&Mem,
|
&Mem,
|
||||||
TRUE
|
TRUE
|
||||||
);
|
);
|
||||||
@ -121,7 +121,7 @@ AllocateMemoryMapEntry (
|
|||||||
//
|
//
|
||||||
// Enque the free memmory map entries into the list
|
// Enque the free memmory map entries into the list
|
||||||
//
|
//
|
||||||
for (Index = 0; Index< DEFAULT_PAGE_ALLOCATION / sizeof(MEMORY_MAP); Index++) {
|
for (Index = 0; Index< RUNTIME_PAGE_ALLOCATION_GRANULARITY / sizeof(MEMORY_MAP); Index++) {
|
||||||
FreeDescriptorEntries[Index].Signature = MEMORY_MAP_SIGNATURE;
|
FreeDescriptorEntries[Index].Signature = MEMORY_MAP_SIGNATURE;
|
||||||
InsertTailList (&mFreeMemoryMapEntryList, &FreeDescriptorEntries[Index].Link);
|
InsertTailList (&mFreeMemoryMapEntryList, &FreeDescriptorEntries[Index].Link);
|
||||||
}
|
}
|
||||||
|
@ -1151,12 +1151,6 @@ SmiHandlerProfileUnregisterHandler (
|
|||||||
IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
|
IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler
|
||||||
);
|
);
|
||||||
|
|
||||||
///
|
|
||||||
/// For generic EFI machines make the default allocations 4K aligned
|
|
||||||
///
|
|
||||||
#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)
|
|
||||||
#define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)
|
|
||||||
|
|
||||||
extern UINTN mFullSmramRangeCount;
|
extern UINTN mFullSmramRangeCount;
|
||||||
extern EFI_SMRAM_DESCRIPTOR *mFullSmramRanges;
|
extern EFI_SMRAM_DESCRIPTOR *mFullSmramRanges;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user