public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org, liming.gao@intel.com,
	michael.d.kinney@intel.com
Cc: star.zeng@intel.com, jiewen.yao@intel.com,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH v4 3/4] MdeModulePkg/PiSmmCore: switch to MdePkg allocation granularity macros
Date: Fri,  3 Mar 2017 15:11:33 +0000	[thread overview]
Message-ID: <1488553894-3520-4-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1488553894-3520-1-git-send-email-ard.biesheuvel@linaro.org>

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>
---
 MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c | 6 +++---
 MdeModulePkg/Core/PiSmmCore/Page.c                  | 4 ++--
 MdeModulePkg/Core/PiSmmCore/PiSmmCore.h             | 6 ------
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c b/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
index 6cfd35945ab1..e3c505ef18ab 100644
--- a/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
+++ b/MdeModulePkg/Core/PiSmmCore/MemoryAttributesTable.c
@@ -795,7 +795,7 @@ SetMemoryAttributesTableSectionAlignment (
   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)) {
     DEBUG ((DEBUG_VERBOSE, "SMM SetMemoryAttributesTableSectionAlignment - Clear\n"));
     mMemoryProtectionAttribute &= ~((UINT64)EFI_MEMORY_ATTRIBUTES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA);
@@ -1125,9 +1125,9 @@ SmmInsertImageRecord (
   }
 
   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",
-      SectionAlignment, EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT >> 10));
+      SectionAlignment, RUNTIME_PAGE_ALLOCATION_GRANULARITY >> 10));
     PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageAddress);
     if (PdbPointer != NULL) {
       DEBUG ((DEBUG_WARN, "SMM !!!!!!!!  Image - %a  !!!!!!!!\n", PdbPointer));
diff --git a/MdeModulePkg/Core/PiSmmCore/Page.c b/MdeModulePkg/Core/PiSmmCore/Page.c
index 1bc8fd82c867..4154c2e6a1ec 100644
--- a/MdeModulePkg/Core/PiSmmCore/Page.c
+++ b/MdeModulePkg/Core/PiSmmCore/Page.c
@@ -110,7 +110,7 @@ AllocateMemoryMapEntry (
     Status = SmmInternalAllocatePagesEx (
                AllocateAnyPages,
                EfiRuntimeServicesData,
-               EFI_SIZE_TO_PAGES(DEFAULT_PAGE_ALLOCATION),
+               EFI_SIZE_TO_PAGES (RUNTIME_PAGE_ALLOCATION_GRANULARITY),
                &Mem,
                TRUE
                );
@@ -121,7 +121,7 @@ AllocateMemoryMapEntry (
       //
       // 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;
         InsertTailList (&mFreeMemoryMapEntryList, &FreeDescriptorEntries[Index].Link);
       }
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
index bdef026e6c68..45b9d9758be8 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h
@@ -1151,12 +1151,6 @@ SmiHandlerProfileUnregisterHandler (
   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 EFI_SMRAM_DESCRIPTOR     *mFullSmramRanges;
 
-- 
2.7.4



  parent reply	other threads:[~2017-03-03 15:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 15:11 [PATCH v4 0/4] MdePkg, MdeModulePkg: Enforce page allocation granularity Ard Biesheuvel
2017-03-03 15:11 ` [PATCH v4 1/4] MdePkg/ProcessorBind: add defines for " Ard Biesheuvel
2017-03-03 15:11 ` [PATCH v4 2/4] MdeModulePkg/DxeCore: switch to MdePkg allocation granularity macros Ard Biesheuvel
2017-03-03 15:11 ` Ard Biesheuvel [this message]
2017-03-03 15:11 ` [PATCH v4 4/4] MdeModulePkg/PeiCore: honour minimal runtime allocation granularity Ard Biesheuvel
2017-03-03 15:31 ` [PATCH v4 0/4] MdePkg, MdeModulePkg: Enforce page " Yao, Jiewen
2017-03-06  2:33 ` Gao, Liming
2017-03-06 15:14   ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488553894-3520-4-git-send-email-ard.biesheuvel@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox