From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x231.google.com (mail-wm0-x231.google.com [IPv6:2a00:1450:400c:c09::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 028F98220E for ; Fri, 3 Mar 2017 07:11:49 -0800 (PST) Received: by mail-wm0-x231.google.com with SMTP id 196so8701689wmm.1 for ; Fri, 03 Mar 2017 07:11:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7Hy6Ebp8gmR2hNL8kwinoRYxdjjLKdFhnWOHu7BVGBw=; b=ddp8PAkAIe6BCy9qcIYaGRmBgKIdoI4p2vd7gtoIMuoDYu9S1EK25f7xqmeOkUulun 7ujmrB28LBrthEMhqhhA/SzVQLKhialTGKjNVdGPAXHVC/g5MEaeLfyzZcoqTv8lK0z9 11z+i+PbiYfLvH2SaXsLs9wzs4YmbovheMlIM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7Hy6Ebp8gmR2hNL8kwinoRYxdjjLKdFhnWOHu7BVGBw=; b=f0OgXp7qf/tVWcCQ+pkIyTAN5NjEF6RR09UQeZDU4+hIItsdSMcWMu0vGleANMt9pc Y/WkF+gDieyAJHBZGnUm8q7EklybwKsMXr2AC2DM2PiyOiL3BKRbpwmJbfIajOny69jw kB/EDLRhn8LiW+cbLnhCBCOsm5xvto8x/k0xC47MZ2Uc1L/By7/mvWls8qdM8heciRPQ Byo6T50+EWAIzpA1G6cj/n2sTuNE9Ihk1K2Rrb2lMkKxYgJ35Tp10nuh+uRm+pTpVVI0 SQdQSbhgmlfeLAUmAJTiTnH5s1ACO5b1gNYS+sZIXTyIaGdqO31Mb5AZLlmd2f7NNa77 iiUg== X-Gm-Message-State: AMke39nOmeaIPT0Ej0QPgq+aIv5sviTsGYzTxO8+WWosY7aRNVDdXPaw5AjOYBK3ykLiPOxD X-Received: by 10.28.55.68 with SMTP id e65mr3214323wma.62.1488553907563; Fri, 03 Mar 2017 07:11:47 -0800 (PST) Received: from localhost.localdomain ([105.147.1.203]) by smtp.gmail.com with ESMTPSA id w207sm3428523wmw.1.2017.03.03.07.11.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Mar 2017 07:11:46 -0800 (PST) From: Ard Biesheuvel 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 Date: Fri, 3 Mar 2017 15:11:33 +0000 Message-Id: <1488553894-3520-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488553894-3520-1-git-send-email-ard.biesheuvel@linaro.org> References: <1488553894-3520-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [PATCH v4 3/4] MdeModulePkg/PiSmmCore: switch to MdePkg allocation granularity macros X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Mar 2017 15:11:49 -0000 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 --- 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