From nobody Sat Nov 2 14:26:49 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1488553915016653.1913306078216; Fri, 3 Mar 2017 07:11:55 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4940382224; Fri, 3 Mar 2017 07:11:50 -0800 (PST) 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) 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) X-Original-To: edk2-devel@lists.01.org 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) From: Ard Biesheuvel To: edk2-devel@lists.01.org, liming.gao@intel.com, michael.d.kinney@intel.com 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: [edk2] [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: , Cc: jiewen.yao@intel.com, star.zeng@intel.com, Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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/MdeModul= ePkg/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= )) !=3D 0) && + if (((SectionAlignment & (RUNTIME_PAGE_ALLOCATION_GRANULARITY - 1)) !=3D= 0) && ((mMemoryProtectionAttribute & EFI_MEMORY_ATTRIBUTES_RUNTIME_MEMORY_= PROTECTION_NON_EXECUTABLE_PE_DATA) !=3D 0)) { DEBUG ((DEBUG_VERBOSE, "SMM SetMemoryAttributesTableSectionAlignment -= Clear\n")); mMemoryProtectionAttribute &=3D ~((UINT64)EFI_MEMORY_ATTRIBUTES_RUNTIM= E_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA); @@ -1125,9 +1125,9 @@ SmmInsertImageRecord ( } =20 SetMemoryAttributesTableSectionAlignment (SectionAlignment); - if ((SectionAlignment & (EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT - 1)= ) !=3D 0) { + if ((SectionAlignment & (RUNTIME_PAGE_ALLOCATION_GRANULARITY - 1)) !=3D = 0) { DEBUG ((DEBUG_WARN, "SMM !!!!!!!! InsertImageRecord - Section Alignme= nt(0x%x) is not %dK !!!!!!!!\n", - SectionAlignment, EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT >> 10)); + SectionAlignment, RUNTIME_PAGE_ALLOCATION_GRANULARITY >> 10)); PdbPointer =3D PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageAddress= ); if (PdbPointer !=3D NULL) { DEBUG ((DEBUG_WARN, "SMM !!!!!!!! Image - %a !!!!!!!!\n", PdbPoint= er)); diff --git a/MdeModulePkg/Core/PiSmmCore/Page.c b/MdeModulePkg/Core/PiSmmCo= re/Page.c index 1bc8fd82c867..4154c2e6a1ec 100644 --- a/MdeModulePkg/Core/PiSmmCore/Page.c +++ b/MdeModulePkg/Core/PiSmmCore/Page.c @@ -110,7 +110,7 @@ AllocateMemoryMapEntry ( Status =3D 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 =3D 0; Index< DEFAULT_PAGE_ALLOCATION / sizeof(MEMORY_MAP= ); Index++) { + for (Index =3D 0; Index< RUNTIME_PAGE_ALLOCATION_GRANULARITY / sizeo= f(MEMORY_MAP); Index++) { FreeDescriptorEntries[Index].Signature =3D MEMORY_MAP_SIGNATURE; InsertTailList (&mFreeMemoryMapEntryList, &FreeDescriptorEntries[I= ndex].Link); } diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.h b/MdeModulePkg/Core/Pi= SmmCore/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 ); =20 -/// -/// 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; =20 --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel