* [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory @ 2024-03-26 7:57 Aaron Li 2024-03-28 1:14 ` [edk2-devel] 回复: " gaoliming via groups.io 2024-04-01 2:05 ` Zhiguang Liu 0 siblings, 2 replies; 10+ messages in thread From: Aaron Li @ 2024-03-26 7:57 UTC (permalink / raw) To: devel Cc: Zhiguang Liu, Dandan Bi, Liming Gao, Liu Yun, Jiewen Yao, Ray Ni, Michael D Kinney UEFI spec defined ACPI Tables at boot time can be contained in memory of type EfiACPIReclaimMemory or EfiAcpiMemoryNVS, although InstallAcpiTable with AcpiTableProtocol will only allocate memory with type EfiACPIReclaimMemory (Except FACS). This patch provides an optional method controlled by PCD to avoid using EfiACPIReclaimMemory, by setting the PCD PcdNoACPIReclaimMemory to TRUE, all ACPI allocated memory will use EfiAcpiMemoryNVS instead. Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Aaron Li <aaron.li@intel.com> --- MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 37 +++++++++++++++----- MdeModulePkg/MdeModulePkg.dec | 7 ++++ MdeModulePkg/MdeModulePkg.uni | 8 +++++ MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 1 + 4 files changed, 45 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c index e09bc9b704f5..080768033cfa 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c @@ -340,6 +340,7 @@ ReallocateAcpiTableBuffer ( EFI_ACPI_TABLE_INSTANCE TempPrivateData; EFI_STATUS Status; UINT64 CurrentData; + EFI_MEMORY_TYPE AcpiAllocateMemoryType; CopyMem (&TempPrivateData, AcpiTableInstance, sizeof (EFI_ACPI_TABLE_INSTANCE)); // @@ -359,6 +360,12 @@ ReallocateAcpiTableBuffer ( NewMaxTableNumber * sizeof (UINT32); } + if (PcdGetBool (PcdNoACPIReclaimMemory)) { + AcpiAllocateMemoryType = EfiACPIMemoryNVS; + } else { + AcpiAllocateMemoryType = EfiACPIReclaimMemory; + } + if (mAcpiTableAllocType != AllocateAnyPages) { // // Allocate memory in the lower 32 bit of address range for @@ -372,13 +379,13 @@ ReallocateAcpiTableBuffer ( PageAddress = 0xFFFFFFFF; Status = gBS->AllocatePages ( mAcpiTableAllocType, - EfiACPIReclaimMemory, + AcpiAllocateMemoryType, EFI_SIZE_TO_PAGES (TotalSize), &PageAddress ); } else { Status = gBS->AllocatePool ( - EfiACPIReclaimMemory, + AcpiAllocateMemoryType, TotalSize, (VOID **)&Pointer ); @@ -512,6 +519,7 @@ AddTableToList ( EFI_PHYSICAL_ADDRESS AllocPhysAddress; UINT64 Buffer64; BOOLEAN AddToRsdt; + EFI_MEMORY_TYPE AcpiAllocateMemoryType; // // Check for invalid input parameters @@ -550,6 +558,12 @@ AddTableToList ( CurrentTableList->TableSize = CurrentTableSize; CurrentTableList->PoolAllocation = FALSE; + if (PcdGetBool (PcdNoACPIReclaimMemory)) { + AcpiAllocateMemoryType = EfiACPIMemoryNVS; + } else { + AcpiAllocateMemoryType = EfiACPIReclaimMemory; + } + // // Allocation memory type depends on the type of the table // @@ -585,7 +599,7 @@ AddTableToList ( // such as AArch64 that allocate multiples of 64 KB // Status = gBS->AllocatePool ( - EfiACPIReclaimMemory, + AcpiAllocateMemoryType, CurrentTableList->TableSize, (VOID **)&CurrentTableList->Table ); @@ -596,7 +610,7 @@ AddTableToList ( // Status = gBS->AllocatePages ( mAcpiTableAllocType, - EfiACPIReclaimMemory, + AcpiAllocateMemoryType, EFI_SIZE_TO_PAGES (CurrentTableList->TableSize), &AllocPhysAddress ); @@ -1944,6 +1958,7 @@ AcpiTableAcpiTableConstructor ( UINTN RsdpTableSize; UINT8 *Pointer; EFI_PHYSICAL_ADDRESS PageAddress; + EFI_MEMORY_TYPE AcpiAllocateMemoryType; // // Check for invalid input parameters @@ -1978,17 +1993,23 @@ AcpiTableAcpiTableConstructor ( RsdpTableSize += sizeof (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER); } + if (PcdGetBool (PcdNoACPIReclaimMemory)) { + AcpiAllocateMemoryType = EfiACPIMemoryNVS; + } else { + AcpiAllocateMemoryType = EfiACPIReclaimMemory; + } + if (mAcpiTableAllocType != AllocateAnyPages) { PageAddress = 0xFFFFFFFF; Status = gBS->AllocatePages ( mAcpiTableAllocType, - EfiACPIReclaimMemory, + AcpiAllocateMemoryType, EFI_SIZE_TO_PAGES (RsdpTableSize), &PageAddress ); } else { Status = gBS->AllocatePool ( - EfiACPIReclaimMemory, + AcpiAllocateMemoryType, RsdpTableSize, (VOID **)&Pointer ); @@ -2037,13 +2058,13 @@ AcpiTableAcpiTableConstructor ( PageAddress = 0xFFFFFFFF; Status = gBS->AllocatePages ( mAcpiTableAllocType, - EfiACPIReclaimMemory, + AcpiAllocateMemoryType, EFI_SIZE_TO_PAGES (TotalSize), &PageAddress ); } else { Status = gBS->AllocatePool ( - EfiACPIReclaimMemory, + AcpiAllocateMemoryType, TotalSize, (VOID **)&Pointer ); diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index a82dedc070df..a91058e5b5df 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -1533,6 +1533,13 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] # @Prompt Exposed ACPI table versions. gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x3E|UINT32|0x0001004c + ## Indicates whether ACPI Reclaim memory is not available + # Default is FALSE that means ACPI Reclaim memory is available + # If it is set to TRUE that means ACPI Reclaim memory is not available + # For example ACPI Table protocol will use ACPI NVS memory instead of ACPI Reclaim memory + # @Prompt ACPI Reclaim memory is not available. + gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory|FALSE|BOOLEAN|0x0001008b + ## This PCD defines the MAX repair count. # The default value is 0 that means infinite. # @Prompt MAX repair count diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni index a17d34d60b21..6079285e3f8b 100644 --- a/MdeModulePkg/MdeModulePkg.uni +++ b/MdeModulePkg/MdeModulePkg.uni @@ -955,6 +955,14 @@ "BIT 4 - EFI_ACPI_TABLE_VERSION_4_0.<BR>\n" "BIT 5 - EFI_ACPI_TABLE_VERSION_5_0.<BR>" +#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_PROMPT #language en-US "ACPI Reclaim memory is not available." + +#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_HELP #language en-US "Indicates whether ACPI Reclaim memory is not available\n" + "Default is FALSE that means ACPI Reclaim memory is available\n" + "If it is set to TRUE that means ACPI Reclaim memory is not available\n" + "For example ACPI Table protocol will use ACPI NVS memory instead of ACPI Reclaim memory" + + #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_PROMPT #language en-US "Enable export HII data and configuration to be used in OS runtime." #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_HELP #language en-US "Indicates if HII data and configuration has been exported.<BR><BR>\n" diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf index 86dea43e27e4..be498a56cff0 100644 --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf @@ -68,6 +68,7 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory ## CONSUMES [Protocols] gEfiAcpiTableProtocolGuid ## PRODUCES -- 2.44.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117104): https://edk2.groups.io/g/devel/message/117104 Mute This Topic: https://groups.io/mt/105154551/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [edk2-devel] 回复: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory 2024-03-26 7:57 [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory Aaron Li @ 2024-03-28 1:14 ` gaoliming via groups.io 2024-03-28 3:59 ` [edk2-devel] " Aaron Li 2024-04-01 2:05 ` Zhiguang Liu 1 sibling, 1 reply; 10+ messages in thread From: gaoliming via groups.io @ 2024-03-28 1:14 UTC (permalink / raw) To: 'Aaron Li', devel Cc: 'Zhiguang Liu', 'Dandan Bi', 'Liu Yun', 'Jiewen Yao', 'Ray Ni', 'Michael D Kinney' Aaron: Is there a Bugzilla for this issue? What problem will be resolved with this change? Thanks Liming > -----邮件原件----- > 发件人: Aaron Li <aaron.li@intel.com> > 发送时间: 2024年3月26日 15:58 > 收件人: devel@edk2.groups.io > 抄送: Zhiguang Liu <zhiguang.liu@intel.com>; Dandan Bi > <dandan.bi@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Liu Yun > <yun.y.liu@intel.com>; Jiewen Yao <jiewen.yao@intel.com>; Ray Ni > <ray.ni@intel.com>; Michael D Kinney <michael.d.kinney@intel.com> > 主题: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid > using ACPI reclaim memory > > UEFI spec defined ACPI Tables at boot time can be contained in memory of > type EfiACPIReclaimMemory or EfiAcpiMemoryNVS, although InstallAcpiTable > with AcpiTableProtocol will only allocate memory with type > EfiACPIReclaimMemory (Except FACS). > > This patch provides an optional method controlled by PCD to avoid using > EfiACPIReclaimMemory, by setting the PCD PcdNoACPIReclaimMemory to > TRUE, > all ACPI allocated memory will use EfiAcpiMemoryNVS instead. > > Cc: Zhiguang Liu <zhiguang.liu@intel.com> > Cc: Dandan Bi <dandan.bi@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn> > Cc: Liu Yun <yun.y.liu@intel.com> > Cc: Jiewen Yao <jiewen.yao@intel.com> > Cc: Ray Ni <ray.ni@intel.com> > Cc: Michael D Kinney <michael.d.kinney@intel.com> > Signed-off-by: Aaron Li <aaron.li@intel.com> > --- > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 37 > +++++++++++++++----- > MdeModulePkg/MdeModulePkg.dec > | 7 ++++ > MdeModulePkg/MdeModulePkg.uni > | 8 +++++ > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 1 + > 4 files changed, 45 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > index e09bc9b704f5..080768033cfa 100644 > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > @@ -340,6 +340,7 @@ ReallocateAcpiTableBuffer ( > EFI_ACPI_TABLE_INSTANCE TempPrivateData; > EFI_STATUS Status; > UINT64 CurrentData; > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > CopyMem (&TempPrivateData, AcpiTableInstance, sizeof > (EFI_ACPI_TABLE_INSTANCE)); > // > @@ -359,6 +360,12 @@ ReallocateAcpiTableBuffer ( > NewMaxTableNumber * sizeof (UINT32); > } > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; > + } else { > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; > + } > + > if (mAcpiTableAllocType != AllocateAnyPages) { > // > // Allocate memory in the lower 32 bit of address range for > @@ -372,13 +379,13 @@ ReallocateAcpiTableBuffer ( > PageAddress = 0xFFFFFFFF; > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (TotalSize), > &PageAddress > ); > } else { > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > TotalSize, > (VOID **)&Pointer > ); > @@ -512,6 +519,7 @@ AddTableToList ( > EFI_PHYSICAL_ADDRESS AllocPhysAddress; > UINT64 Buffer64; > BOOLEAN AddToRsdt; > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > // > // Check for invalid input parameters > @@ -550,6 +558,12 @@ AddTableToList ( > CurrentTableList->TableSize = CurrentTableSize; > CurrentTableList->PoolAllocation = FALSE; > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; > + } else { > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; > + } > + > // > // Allocation memory type depends on the type of the table > // > @@ -585,7 +599,7 @@ AddTableToList ( > // such as AArch64 that allocate multiples of 64 KB > // > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > CurrentTableList->TableSize, > (VOID **)&CurrentTableList->Table > ); > @@ -596,7 +610,7 @@ AddTableToList ( > // > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (CurrentTableList->TableSize), > &AllocPhysAddress > ); > @@ -1944,6 +1958,7 @@ AcpiTableAcpiTableConstructor ( > UINTN RsdpTableSize; > UINT8 *Pointer; > EFI_PHYSICAL_ADDRESS PageAddress; > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > // > // Check for invalid input parameters > @@ -1978,17 +1993,23 @@ AcpiTableAcpiTableConstructor ( > RsdpTableSize += sizeof > (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER); > } > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; > + } else { > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; > + } > + > if (mAcpiTableAllocType != AllocateAnyPages) { > PageAddress = 0xFFFFFFFF; > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (RsdpTableSize), > &PageAddress > ); > } else { > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > RsdpTableSize, > (VOID **)&Pointer > ); > @@ -2037,13 +2058,13 @@ AcpiTableAcpiTableConstructor ( > PageAddress = 0xFFFFFFFF; > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (TotalSize), > &PageAddress > ); > } else { > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > TotalSize, > (VOID **)&Pointer > ); > diff --git a/MdeModulePkg/MdeModulePkg.dec > b/MdeModulePkg/MdeModulePkg.dec > index a82dedc070df..a91058e5b5df 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -1533,6 +1533,13 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] > # @Prompt Exposed ACPI table versions. > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x3E|UIN > T32|0x0001004c > > + ## Indicates whether ACPI Reclaim memory is not available > + # Default is FALSE that means ACPI Reclaim memory is available > + # If it is set to TRUE that means ACPI Reclaim memory is not available > + # For example ACPI Table protocol will use ACPI NVS memory instead of > ACPI Reclaim memory > + # @Prompt ACPI Reclaim memory is not available. > + > gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory|FALSE|BOOL > EAN|0x0001008b > + > ## This PCD defines the MAX repair count. > # The default value is 0 that means infinite. > # @Prompt MAX repair count > diff --git a/MdeModulePkg/MdeModulePkg.uni > b/MdeModulePkg/MdeModulePkg.uni > index a17d34d60b21..6079285e3f8b 100644 > --- a/MdeModulePkg/MdeModulePkg.uni > +++ b/MdeModulePkg/MdeModulePkg.uni > @@ -955,6 +955,14 @@ > > "BIT 4 - EFI_ACPI_TABLE_VERSION_4_0.<BR>\n" > > "BIT 5 - EFI_ACPI_TABLE_VERSION_5_0.<BR>" > > +#string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_PROM > PT #language en-US "ACPI Reclaim memory is not available." > + > +#string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_HELP > #language en-US "Indicates whether ACPI Reclaim memory is not available\n" > + > "Default is FALSE that means ACPI Reclaim memory is available\n" > + > "If it is set to TRUE that means ACPI Reclaim memory is not available\n" > + > "For example ACPI Table protocol will use ACPI NVS memory instead of ACPI > Reclaim memory" > + > + > #string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_PROMPT > #language en-US "Enable export HII data and configuration to be used in OS > runtime." > > #string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_HELP > #language en-US "Indicates if HII data and configuration has been > exported.<BR><BR>\n" > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > index 86dea43e27e4..be498a56cff0 100644 > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > @@ -68,6 +68,7 @@ [Pcd] > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions ## > CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory > ## CONSUMES > > [Protocols] > gEfiAcpiTableProtocolGuid ## PRODUCES > -- > 2.44.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117188): https://edk2.groups.io/g/devel/message/117188 Mute This Topic: https://groups.io/mt/105189564/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory 2024-03-28 1:14 ` [edk2-devel] 回复: " gaoliming via groups.io @ 2024-03-28 3:59 ` Aaron Li 2024-03-28 5:59 ` Ard Biesheuvel 0 siblings, 1 reply; 10+ messages in thread From: Aaron Li @ 2024-03-28 3:59 UTC (permalink / raw) To: gaoliming, devel@edk2.groups.io Cc: Liu, Zhiguang, Bi, Dandan, Liu, Yun Y, Yao, Jiewen, Ni, Ray, Kinney, Michael D Hi Liming, Currently this patch does not have a related Bugzilla. According to UEFI spec, the ACPI Tables at boot time can be contained in memory of type EfiACPIReclaimMemory or EfiAcpiMemoryNVS. Current implementation in AcpiTableDxe only allocate memory with type EfiACPIReclaimMemory by default. This patch provides an option method to let ACPI Tables be allocated in memory with type EfiAcpiMemoryNVS controlled by PCD. Best, Aaron -----Original Message----- From: gaoliming <gaoliming@byosoft.com.cn> Sent: Thursday, March 28, 2024 9:15 AM To: Li, Aaron <aaron.li@intel.com>; devel@edk2.groups.io Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Liu, Yun Y <yun.y.liu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Ni, Ray <ray.ni@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com> Subject: 回复: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory Aaron: Is there a Bugzilla for this issue? What problem will be resolved with this change? Thanks Liming > -----邮件原件----- > 发件人: Aaron Li <aaron.li@intel.com> > 发送时间: 2024年3月26日 15:58 > 收件人: devel@edk2.groups.io > 抄送: Zhiguang Liu <zhiguang.liu@intel.com>; Dandan Bi > <dandan.bi@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Liu Yun > <yun.y.liu@intel.com>; Jiewen Yao <jiewen.yao@intel.com>; Ray Ni > <ray.ni@intel.com>; Michael D Kinney <michael.d.kinney@intel.com> > 主题: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid > using ACPI reclaim memory > > UEFI spec defined ACPI Tables at boot time can be contained in memory of > type EfiACPIReclaimMemory or EfiAcpiMemoryNVS, although InstallAcpiTable > with AcpiTableProtocol will only allocate memory with type > EfiACPIReclaimMemory (Except FACS). > > This patch provides an optional method controlled by PCD to avoid using > EfiACPIReclaimMemory, by setting the PCD PcdNoACPIReclaimMemory to > TRUE, > all ACPI allocated memory will use EfiAcpiMemoryNVS instead. > > Cc: Zhiguang Liu <zhiguang.liu@intel.com> > Cc: Dandan Bi <dandan.bi@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn> > Cc: Liu Yun <yun.y.liu@intel.com> > Cc: Jiewen Yao <jiewen.yao@intel.com> > Cc: Ray Ni <ray.ni@intel.com> > Cc: Michael D Kinney <michael.d.kinney@intel.com> > Signed-off-by: Aaron Li <aaron.li@intel.com> > --- > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 37 > +++++++++++++++----- > MdeModulePkg/MdeModulePkg.dec > | 7 ++++ > MdeModulePkg/MdeModulePkg.uni > | 8 +++++ > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 1 + > 4 files changed, 45 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > index e09bc9b704f5..080768033cfa 100644 > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > @@ -340,6 +340,7 @@ ReallocateAcpiTableBuffer ( > EFI_ACPI_TABLE_INSTANCE TempPrivateData; > EFI_STATUS Status; > UINT64 CurrentData; > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > CopyMem (&TempPrivateData, AcpiTableInstance, sizeof > (EFI_ACPI_TABLE_INSTANCE)); > // > @@ -359,6 +360,12 @@ ReallocateAcpiTableBuffer ( > NewMaxTableNumber * sizeof (UINT32); > } > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; > + } else { > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; > + } > + > if (mAcpiTableAllocType != AllocateAnyPages) { > // > // Allocate memory in the lower 32 bit of address range for > @@ -372,13 +379,13 @@ ReallocateAcpiTableBuffer ( > PageAddress = 0xFFFFFFFF; > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (TotalSize), > &PageAddress > ); > } else { > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > TotalSize, > (VOID **)&Pointer > ); > @@ -512,6 +519,7 @@ AddTableToList ( > EFI_PHYSICAL_ADDRESS AllocPhysAddress; > UINT64 Buffer64; > BOOLEAN AddToRsdt; > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > // > // Check for invalid input parameters > @@ -550,6 +558,12 @@ AddTableToList ( > CurrentTableList->TableSize = CurrentTableSize; > CurrentTableList->PoolAllocation = FALSE; > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; > + } else { > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; > + } > + > // > // Allocation memory type depends on the type of the table > // > @@ -585,7 +599,7 @@ AddTableToList ( > // such as AArch64 that allocate multiples of 64 KB > // > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > CurrentTableList->TableSize, > (VOID **)&CurrentTableList->Table > ); > @@ -596,7 +610,7 @@ AddTableToList ( > // > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (CurrentTableList->TableSize), > &AllocPhysAddress > ); > @@ -1944,6 +1958,7 @@ AcpiTableAcpiTableConstructor ( > UINTN RsdpTableSize; > UINT8 *Pointer; > EFI_PHYSICAL_ADDRESS PageAddress; > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > // > // Check for invalid input parameters > @@ -1978,17 +1993,23 @@ AcpiTableAcpiTableConstructor ( > RsdpTableSize += sizeof > (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER); > } > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; > + } else { > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; > + } > + > if (mAcpiTableAllocType != AllocateAnyPages) { > PageAddress = 0xFFFFFFFF; > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (RsdpTableSize), > &PageAddress > ); > } else { > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > RsdpTableSize, > (VOID **)&Pointer > ); > @@ -2037,13 +2058,13 @@ AcpiTableAcpiTableConstructor ( > PageAddress = 0xFFFFFFFF; > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (TotalSize), > &PageAddress > ); > } else { > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > TotalSize, > (VOID **)&Pointer > ); > diff --git a/MdeModulePkg/MdeModulePkg.dec > b/MdeModulePkg/MdeModulePkg.dec > index a82dedc070df..a91058e5b5df 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -1533,6 +1533,13 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] > # @Prompt Exposed ACPI table versions. > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x3E|UIN > T32|0x0001004c > > + ## Indicates whether ACPI Reclaim memory is not available > + # Default is FALSE that means ACPI Reclaim memory is available > + # If it is set to TRUE that means ACPI Reclaim memory is not available > + # For example ACPI Table protocol will use ACPI NVS memory instead of > ACPI Reclaim memory > + # @Prompt ACPI Reclaim memory is not available. > + > gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory|FALSE|BOOL > EAN|0x0001008b > + > ## This PCD defines the MAX repair count. > # The default value is 0 that means infinite. > # @Prompt MAX repair count > diff --git a/MdeModulePkg/MdeModulePkg.uni > b/MdeModulePkg/MdeModulePkg.uni > index a17d34d60b21..6079285e3f8b 100644 > --- a/MdeModulePkg/MdeModulePkg.uni > +++ b/MdeModulePkg/MdeModulePkg.uni > @@ -955,6 +955,14 @@ > > "BIT 4 - EFI_ACPI_TABLE_VERSION_4_0.<BR>\n" > > "BIT 5 - EFI_ACPI_TABLE_VERSION_5_0.<BR>" > > +#string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_PROM > PT #language en-US "ACPI Reclaim memory is not available." > + > +#string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_HELP > #language en-US "Indicates whether ACPI Reclaim memory is not available\n" > + > "Default is FALSE that means ACPI Reclaim memory is available\n" > + > "If it is set to TRUE that means ACPI Reclaim memory is not available\n" > + > "For example ACPI Table protocol will use ACPI NVS memory instead of ACPI > Reclaim memory" > + > + > #string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_PROMPT > #language en-US "Enable export HII data and configuration to be used in OS > runtime." > > #string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_HELP > #language en-US "Indicates if HII data and configuration has been > exported.<BR><BR>\n" > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > index 86dea43e27e4..be498a56cff0 100644 > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > @@ -68,6 +68,7 @@ [Pcd] > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions ## > CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory > ## CONSUMES > > [Protocols] > gEfiAcpiTableProtocolGuid ## PRODUCES > -- > 2.44.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117190): https://edk2.groups.io/g/devel/message/117190 Mute This Topic: https://groups.io/mt/105191315/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory 2024-03-28 3:59 ` [edk2-devel] " Aaron Li @ 2024-03-28 5:59 ` Ard Biesheuvel 2024-03-28 7:23 ` Aaron Li 0 siblings, 1 reply; 10+ messages in thread From: Ard Biesheuvel @ 2024-03-28 5:59 UTC (permalink / raw) To: devel, aaron.li Cc: gaoliming, Liu, Zhiguang, Bi, Dandan, Liu, Yun Y, Yao, Jiewen, Ni, Ray, Kinney, Michael D Hello Aaron, Could you describe the problem that is being solved by the ability to use EfiAcpiMemoryNVS for ACPI tables? On Thu, 28 Mar 2024 at 05:59, Aaron Li <aaron.li@intel.com> wrote: > > Hi Liming, > > Currently this patch does not have a related Bugzilla. > > According to UEFI spec, the ACPI Tables at boot time can be contained in memory of type EfiACPIReclaimMemory or EfiAcpiMemoryNVS. > Current implementation in AcpiTableDxe only allocate memory with type EfiACPIReclaimMemory by default. > This patch provides an option method to let ACPI Tables be allocated in memory with type EfiAcpiMemoryNVS controlled by PCD. > > > Best, > Aaron > > -----Original Message----- > From: gaoliming <gaoliming@byosoft.com.cn> > Sent: Thursday, March 28, 2024 9:15 AM > To: Li, Aaron <aaron.li@intel.com>; devel@edk2.groups.io > Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Liu, Yun Y <yun.y.liu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Ni, Ray <ray.ni@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com> > Subject: 回复: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory > > Aaron: > Is there a Bugzilla for this issue? What problem will be resolved with this > change? > > Thanks > Liming > > -----邮件原件----- > > 发件人: Aaron Li <aaron.li@intel.com> > > 发送时间: 2024年3月26日 15:58 > > 收件人: devel@edk2.groups.io > > 抄送: Zhiguang Liu <zhiguang.liu@intel.com>; Dandan Bi > > <dandan.bi@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Liu Yun > > <yun.y.liu@intel.com>; Jiewen Yao <jiewen.yao@intel.com>; Ray Ni > > <ray.ni@intel.com>; Michael D Kinney <michael.d.kinney@intel.com> > > 主题: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid > > using ACPI reclaim memory > > > > UEFI spec defined ACPI Tables at boot time can be contained in memory of > > type EfiACPIReclaimMemory or EfiAcpiMemoryNVS, although InstallAcpiTable > > with AcpiTableProtocol will only allocate memory with type > > EfiACPIReclaimMemory (Except FACS). > > > > This patch provides an optional method controlled by PCD to avoid using > > EfiACPIReclaimMemory, by setting the PCD PcdNoACPIReclaimMemory to > > TRUE, > > all ACPI allocated memory will use EfiAcpiMemoryNVS instead. > > > > Cc: Zhiguang Liu <zhiguang.liu@intel.com> > > Cc: Dandan Bi <dandan.bi@intel.com> > > Cc: Liming Gao <gaoliming@byosoft.com.cn> > > Cc: Liu Yun <yun.y.liu@intel.com> > > Cc: Jiewen Yao <jiewen.yao@intel.com> > > Cc: Ray Ni <ray.ni@intel.com> > > Cc: Michael D Kinney <michael.d.kinney@intel.com> > > Signed-off-by: Aaron Li <aaron.li@intel.com> > > --- > > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 37 > > +++++++++++++++----- > > MdeModulePkg/MdeModulePkg.dec > > | 7 ++++ > > MdeModulePkg/MdeModulePkg.uni > > | 8 +++++ > > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 1 + > > 4 files changed, 45 insertions(+), 8 deletions(-) > > > > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > index e09bc9b704f5..080768033cfa 100644 > > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > @@ -340,6 +340,7 @@ ReallocateAcpiTableBuffer ( > > EFI_ACPI_TABLE_INSTANCE TempPrivateData; > > EFI_STATUS Status; > > UINT64 CurrentData; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > CopyMem (&TempPrivateData, AcpiTableInstance, sizeof > > (EFI_ACPI_TABLE_INSTANCE)); > > // > > @@ -359,6 +360,12 @@ ReallocateAcpiTableBuffer ( > > NewMaxTableNumber * sizeof (UINT32); > > } > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; > > + } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; > > + } > > + > > if (mAcpiTableAllocType != AllocateAnyPages) { > > // > > // Allocate memory in the lower 32 bit of address range for > > @@ -372,13 +379,13 @@ ReallocateAcpiTableBuffer ( > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (TotalSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > TotalSize, > > (VOID **)&Pointer > > ); > > @@ -512,6 +519,7 @@ AddTableToList ( > > EFI_PHYSICAL_ADDRESS AllocPhysAddress; > > UINT64 Buffer64; > > BOOLEAN AddToRsdt; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > // > > // Check for invalid input parameters > > @@ -550,6 +558,12 @@ AddTableToList ( > > CurrentTableList->TableSize = CurrentTableSize; > > CurrentTableList->PoolAllocation = FALSE; > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; > > + } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; > > + } > > + > > // > > // Allocation memory type depends on the type of the table > > // > > @@ -585,7 +599,7 @@ AddTableToList ( > > // such as AArch64 that allocate multiples of 64 KB > > // > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > CurrentTableList->TableSize, > > (VOID **)&CurrentTableList->Table > > ); > > @@ -596,7 +610,7 @@ AddTableToList ( > > // > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (CurrentTableList->TableSize), > > &AllocPhysAddress > > ); > > @@ -1944,6 +1958,7 @@ AcpiTableAcpiTableConstructor ( > > UINTN RsdpTableSize; > > UINT8 *Pointer; > > EFI_PHYSICAL_ADDRESS PageAddress; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > // > > // Check for invalid input parameters > > @@ -1978,17 +1993,23 @@ AcpiTableAcpiTableConstructor ( > > RsdpTableSize += sizeof > > (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER); > > } > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; > > + } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; > > + } > > + > > if (mAcpiTableAllocType != AllocateAnyPages) { > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (RsdpTableSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > RsdpTableSize, > > (VOID **)&Pointer > > ); > > @@ -2037,13 +2058,13 @@ AcpiTableAcpiTableConstructor ( > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (TotalSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > TotalSize, > > (VOID **)&Pointer > > ); > > diff --git a/MdeModulePkg/MdeModulePkg.dec > > b/MdeModulePkg/MdeModulePkg.dec > > index a82dedc070df..a91058e5b5df 100644 > > --- a/MdeModulePkg/MdeModulePkg.dec > > +++ b/MdeModulePkg/MdeModulePkg.dec > > @@ -1533,6 +1533,13 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] > > # @Prompt Exposed ACPI table versions. > > > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x3E|UIN > > T32|0x0001004c > > > > + ## Indicates whether ACPI Reclaim memory is not available > > + # Default is FALSE that means ACPI Reclaim memory is available > > + # If it is set to TRUE that means ACPI Reclaim memory is not available > > + # For example ACPI Table protocol will use ACPI NVS memory instead of > > ACPI Reclaim memory > > + # @Prompt ACPI Reclaim memory is not available. > > + > > gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory|FALSE|BOOL > > EAN|0x0001008b > > + > > ## This PCD defines the MAX repair count. > > # The default value is 0 that means infinite. > > # @Prompt MAX repair count > > diff --git a/MdeModulePkg/MdeModulePkg.uni > > b/MdeModulePkg/MdeModulePkg.uni > > index a17d34d60b21..6079285e3f8b 100644 > > --- a/MdeModulePkg/MdeModulePkg.uni > > +++ b/MdeModulePkg/MdeModulePkg.uni > > @@ -955,6 +955,14 @@ > > > > "BIT 4 - EFI_ACPI_TABLE_VERSION_4_0.<BR>\n" > > > > "BIT 5 - EFI_ACPI_TABLE_VERSION_5_0.<BR>" > > > > +#string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_PROM > > PT #language en-US "ACPI Reclaim memory is not available." > > + > > +#string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_HELP > > #language en-US "Indicates whether ACPI Reclaim memory is not available\n" > > + > > "Default is FALSE that means ACPI Reclaim memory is available\n" > > + > > "If it is set to TRUE that means ACPI Reclaim memory is not available\n" > > + > > "For example ACPI Table protocol will use ACPI NVS memory instead of ACPI > > Reclaim memory" > > + > > + > > #string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_PROMPT > > #language en-US "Enable export HII data and configuration to be used in OS > > runtime." > > > > #string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_HELP > > #language en-US "Indicates if HII data and configuration has been > > exported.<BR><BR>\n" > > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > index 86dea43e27e4..be498a56cff0 100644 > > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > @@ -68,6 +68,7 @@ [Pcd] > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId ## > > CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision ## > > CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions ## > > CONSUMES > > + gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory > > ## CONSUMES > > > > [Protocols] > > gEfiAcpiTableProtocolGuid ## PRODUCES > > -- > > 2.44.0.windows.1 > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117191): https://edk2.groups.io/g/devel/message/117191 Mute This Topic: https://groups.io/mt/105191315/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory 2024-03-28 5:59 ` Ard Biesheuvel @ 2024-03-28 7:23 ` Aaron Li 0 siblings, 0 replies; 10+ messages in thread From: Aaron Li @ 2024-03-28 7:23 UTC (permalink / raw) To: devel@edk2.groups.io, ardb@kernel.org Cc: gaoliming, Liu, Zhiguang, Bi, Dandan, Liu, Yun Y, Yao, Jiewen, Ni, Ray, Kinney, Michael D Hi Ard, We have a feature that requires to publish all ACPI table in EfiAcpiMemoryNVS. Currently only table "FACS" and "UEFI" was published in NVS memory. Best, Aaron -----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ard Biesheuvel Sent: Thursday, March 28, 2024 1:59 PM To: devel@edk2.groups.io; Li, Aaron <aaron.li@intel.com> Cc: gaoliming <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Liu, Yun Y <yun.y.liu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Ni, Ray <ray.ni@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com> Subject: Re: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory Hello Aaron, Could you describe the problem that is being solved by the ability to use EfiAcpiMemoryNVS for ACPI tables? On Thu, 28 Mar 2024 at 05:59, Aaron Li <aaron.li@intel.com> wrote: > > Hi Liming, > > Currently this patch does not have a related Bugzilla. > > According to UEFI spec, the ACPI Tables at boot time can be contained in memory of type EfiACPIReclaimMemory or EfiAcpiMemoryNVS. > Current implementation in AcpiTableDxe only allocate memory with type EfiACPIReclaimMemory by default. > This patch provides an option method to let ACPI Tables be allocated in memory with type EfiAcpiMemoryNVS controlled by PCD. > > > Best, > Aaron > > -----Original Message----- > From: gaoliming <gaoliming@byosoft.com.cn> > Sent: Thursday, March 28, 2024 9:15 AM > To: Li, Aaron <aaron.li@intel.com>; devel@edk2.groups.io > Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Bi, Dandan <dandan.bi@intel.com>; Liu, Yun Y <yun.y.liu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Ni, Ray <ray.ni@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com> > Subject: 回复: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory > > Aaron: > Is there a Bugzilla for this issue? What problem will be resolved with this > change? > > Thanks > Liming > > -----邮件原件----- > > 发件人: Aaron Li <aaron.li@intel.com> > > 发送时间: 2024年3月26日 15:58 > > 收件人: devel@edk2.groups.io > > 抄送: Zhiguang Liu <zhiguang.liu@intel.com>; Dandan Bi > > <dandan.bi@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Liu Yun > > <yun.y.liu@intel.com>; Jiewen Yao <jiewen.yao@intel.com>; Ray Ni > > <ray.ni@intel.com>; Michael D Kinney <michael.d.kinney@intel.com> > > 主题: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid > > using ACPI reclaim memory > > > > UEFI spec defined ACPI Tables at boot time can be contained in memory of > > type EfiACPIReclaimMemory or EfiAcpiMemoryNVS, although InstallAcpiTable > > with AcpiTableProtocol will only allocate memory with type > > EfiACPIReclaimMemory (Except FACS). > > > > This patch provides an optional method controlled by PCD to avoid using > > EfiACPIReclaimMemory, by setting the PCD PcdNoACPIReclaimMemory to > > TRUE, > > all ACPI allocated memory will use EfiAcpiMemoryNVS instead. > > > > Cc: Zhiguang Liu <zhiguang.liu@intel.com> > > Cc: Dandan Bi <dandan.bi@intel.com> > > Cc: Liming Gao <gaoliming@byosoft.com.cn> > > Cc: Liu Yun <yun.y.liu@intel.com> > > Cc: Jiewen Yao <jiewen.yao@intel.com> > > Cc: Ray Ni <ray.ni@intel.com> > > Cc: Michael D Kinney <michael.d.kinney@intel.com> > > Signed-off-by: Aaron Li <aaron.li@intel.com> > > --- > > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 37 > > +++++++++++++++----- > > MdeModulePkg/MdeModulePkg.dec > > | 7 ++++ > > MdeModulePkg/MdeModulePkg.uni > > | 8 +++++ > > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 1 + > > 4 files changed, 45 insertions(+), 8 deletions(-) > > > > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > index e09bc9b704f5..080768033cfa 100644 > > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > @@ -340,6 +340,7 @@ ReallocateAcpiTableBuffer ( > > EFI_ACPI_TABLE_INSTANCE TempPrivateData; > > EFI_STATUS Status; > > UINT64 CurrentData; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > CopyMem (&TempPrivateData, AcpiTableInstance, sizeof > > (EFI_ACPI_TABLE_INSTANCE)); > > // > > @@ -359,6 +360,12 @@ ReallocateAcpiTableBuffer ( > > NewMaxTableNumber * sizeof (UINT32); > > } > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; > > + } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; > > + } > > + > > if (mAcpiTableAllocType != AllocateAnyPages) { > > // > > // Allocate memory in the lower 32 bit of address range for > > @@ -372,13 +379,13 @@ ReallocateAcpiTableBuffer ( > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (TotalSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > TotalSize, > > (VOID **)&Pointer > > ); > > @@ -512,6 +519,7 @@ AddTableToList ( > > EFI_PHYSICAL_ADDRESS AllocPhysAddress; > > UINT64 Buffer64; > > BOOLEAN AddToRsdt; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > // > > // Check for invalid input parameters > > @@ -550,6 +558,12 @@ AddTableToList ( > > CurrentTableList->TableSize = CurrentTableSize; > > CurrentTableList->PoolAllocation = FALSE; > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; > > + } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; > > + } > > + > > // > > // Allocation memory type depends on the type of the table > > // > > @@ -585,7 +599,7 @@ AddTableToList ( > > // such as AArch64 that allocate multiples of 64 KB > > // > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > CurrentTableList->TableSize, > > (VOID **)&CurrentTableList->Table > > ); > > @@ -596,7 +610,7 @@ AddTableToList ( > > // > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (CurrentTableList->TableSize), > > &AllocPhysAddress > > ); > > @@ -1944,6 +1958,7 @@ AcpiTableAcpiTableConstructor ( > > UINTN RsdpTableSize; > > UINT8 *Pointer; > > EFI_PHYSICAL_ADDRESS PageAddress; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > // > > // Check for invalid input parameters > > @@ -1978,17 +1993,23 @@ AcpiTableAcpiTableConstructor ( > > RsdpTableSize += sizeof > > (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER); > > } > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; > > + } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; > > + } > > + > > if (mAcpiTableAllocType != AllocateAnyPages) { > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (RsdpTableSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > RsdpTableSize, > > (VOID **)&Pointer > > ); > > @@ -2037,13 +2058,13 @@ AcpiTableAcpiTableConstructor ( > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (TotalSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > TotalSize, > > (VOID **)&Pointer > > ); > > diff --git a/MdeModulePkg/MdeModulePkg.dec > > b/MdeModulePkg/MdeModulePkg.dec > > index a82dedc070df..a91058e5b5df 100644 > > --- a/MdeModulePkg/MdeModulePkg.dec > > +++ b/MdeModulePkg/MdeModulePkg.dec > > @@ -1533,6 +1533,13 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] > > # @Prompt Exposed ACPI table versions. > > > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x3E|UIN > > T32|0x0001004c > > > > + ## Indicates whether ACPI Reclaim memory is not available > > + # Default is FALSE that means ACPI Reclaim memory is available > > + # If it is set to TRUE that means ACPI Reclaim memory is not available > > + # For example ACPI Table protocol will use ACPI NVS memory instead of > > ACPI Reclaim memory > > + # @Prompt ACPI Reclaim memory is not available. > > + > > gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory|FALSE|BOOL > > EAN|0x0001008b > > + > > ## This PCD defines the MAX repair count. > > # The default value is 0 that means infinite. > > # @Prompt MAX repair count > > diff --git a/MdeModulePkg/MdeModulePkg.uni > > b/MdeModulePkg/MdeModulePkg.uni > > index a17d34d60b21..6079285e3f8b 100644 > > --- a/MdeModulePkg/MdeModulePkg.uni > > +++ b/MdeModulePkg/MdeModulePkg.uni > > @@ -955,6 +955,14 @@ > > > > "BIT 4 - EFI_ACPI_TABLE_VERSION_4_0.<BR>\n" > > > > "BIT 5 - EFI_ACPI_TABLE_VERSION_5_0.<BR>" > > > > +#string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_PROM > > PT #language en-US "ACPI Reclaim memory is not available." > > + > > +#string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_HELP > > #language en-US "Indicates whether ACPI Reclaim memory is not available\n" > > + > > "Default is FALSE that means ACPI Reclaim memory is available\n" > > + > > "If it is set to TRUE that means ACPI Reclaim memory is not available\n" > > + > > "For example ACPI Table protocol will use ACPI NVS memory instead of ACPI > > Reclaim memory" > > + > > + > > #string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_PROMPT > > #language en-US "Enable export HII data and configuration to be used in OS > > runtime." > > > > #string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_HELP > > #language en-US "Indicates if HII data and configuration has been > > exported.<BR><BR>\n" > > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > index 86dea43e27e4..be498a56cff0 100644 > > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > @@ -68,6 +68,7 @@ [Pcd] > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId ## > > CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision ## > > CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions ## > > CONSUMES > > + gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory > > ## CONSUMES > > > > [Protocols] > > gEfiAcpiTableProtocolGuid ## PRODUCES > > -- > > 2.44.0.windows.1 > > > > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117195): https://edk2.groups.io/g/devel/message/117195 Mute This Topic: https://groups.io/mt/105191315/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory 2024-03-26 7:57 [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory Aaron Li 2024-03-28 1:14 ` [edk2-devel] 回复: " gaoliming via groups.io @ 2024-04-01 2:05 ` Zhiguang Liu 2024-04-01 2:31 ` Aaron Li 1 sibling, 1 reply; 10+ messages in thread From: Zhiguang Liu @ 2024-04-01 2:05 UTC (permalink / raw) To: Li, Aaron, devel@edk2.groups.io Cc: Bi, Dandan, Liming Gao, Liu, Yun Y, Yao, Jiewen, Ni, Ray, Kinney, Michael D Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com> > -----Original Message----- > From: Li, Aaron <aaron.li@intel.com> > Sent: Tuesday, March 26, 2024 3:58 PM > To: devel@edk2.groups.io > Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Bi, Dandan > <dandan.bi@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Liu, Yun Y > <yun.y.liu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Ni, Ray > <ray.ni@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com> > Subject: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid > using ACPI reclaim memory > > UEFI spec defined ACPI Tables at boot time can be contained in memory of > type EfiACPIReclaimMemory or EfiAcpiMemoryNVS, although InstallAcpiTable > with AcpiTableProtocol will only allocate memory with type > EfiACPIReclaimMemory (Except FACS). > > This patch provides an optional method controlled by PCD to avoid using > EfiACPIReclaimMemory, by setting the PCD PcdNoACPIReclaimMemory to > TRUE, all ACPI allocated memory will use EfiAcpiMemoryNVS instead. > > Cc: Zhiguang Liu <zhiguang.liu@intel.com> > Cc: Dandan Bi <dandan.bi@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn> > Cc: Liu Yun <yun.y.liu@intel.com> > Cc: Jiewen Yao <jiewen.yao@intel.com> > Cc: Ray Ni <ray.ni@intel.com> > Cc: Michael D Kinney <michael.d.kinney@intel.com> > Signed-off-by: Aaron Li <aaron.li@intel.com> > --- > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 37 > +++++++++++++++----- > MdeModulePkg/MdeModulePkg.dec | 7 ++++ > MdeModulePkg/MdeModulePkg.uni | 8 +++++ > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 1 + > 4 files changed, 45 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > index e09bc9b704f5..080768033cfa 100644 > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > @@ -340,6 +340,7 @@ ReallocateAcpiTableBuffer ( > EFI_ACPI_TABLE_INSTANCE TempPrivateData; > EFI_STATUS Status; > UINT64 CurrentData; > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > CopyMem (&TempPrivateData, AcpiTableInstance, sizeof > (EFI_ACPI_TABLE_INSTANCE)); > // > @@ -359,6 +360,12 @@ ReallocateAcpiTableBuffer ( > NewMaxTableNumber * sizeof (UINT32); > } > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > + > if (mAcpiTableAllocType != AllocateAnyPages) { > // > // Allocate memory in the lower 32 bit of address range for @@ -372,13 > +379,13 @@ ReallocateAcpiTableBuffer ( > PageAddress = 0xFFFFFFFF; > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (TotalSize), > &PageAddress > ); > } else { > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > TotalSize, > (VOID **)&Pointer > ); > @@ -512,6 +519,7 @@ AddTableToList ( > EFI_PHYSICAL_ADDRESS AllocPhysAddress; > UINT64 Buffer64; > BOOLEAN AddToRsdt; > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > // > // Check for invalid input parameters @@ -550,6 +558,12 @@ > AddTableToList ( > CurrentTableList->TableSize = CurrentTableSize; > CurrentTableList->PoolAllocation = FALSE; > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > + > // > // Allocation memory type depends on the type of the table > // > @@ -585,7 +599,7 @@ AddTableToList ( > // such as AArch64 that allocate multiples of 64 KB > // > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > CurrentTableList->TableSize, > (VOID **)&CurrentTableList->Table > ); > @@ -596,7 +610,7 @@ AddTableToList ( > // > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (CurrentTableList->TableSize), > &AllocPhysAddress > ); > @@ -1944,6 +1958,7 @@ AcpiTableAcpiTableConstructor ( > UINTN RsdpTableSize; > UINT8 *Pointer; > EFI_PHYSICAL_ADDRESS PageAddress; > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > // > // Check for invalid input parameters @@ -1978,17 +1993,23 @@ > AcpiTableAcpiTableConstructor ( > RsdpTableSize += sizeof > (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER); > } > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > + > if (mAcpiTableAllocType != AllocateAnyPages) { > PageAddress = 0xFFFFFFFF; > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (RsdpTableSize), > &PageAddress > ); > } else { > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > RsdpTableSize, > (VOID **)&Pointer > ); > @@ -2037,13 +2058,13 @@ AcpiTableAcpiTableConstructor ( > PageAddress = 0xFFFFFFFF; > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (TotalSize), > &PageAddress > ); > } else { > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > TotalSize, > (VOID **)&Pointer > ); > diff --git a/MdeModulePkg/MdeModulePkg.dec > b/MdeModulePkg/MdeModulePkg.dec index a82dedc070df..a91058e5b5df > 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -1533,6 +1533,13 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] > # @Prompt Exposed ACPI table versions. > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x3E|UIN > T32|0x0001004c > > + ## Indicates whether ACPI Reclaim memory is not available # Default > + is FALSE that means ACPI Reclaim memory is available # If it is set > + to TRUE that means ACPI Reclaim memory is not available # For example > + ACPI Table protocol will use ACPI NVS memory instead of ACPI Reclaim > + memory # @Prompt ACPI Reclaim memory is not available. > + > + > gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory|FALSE|BOOL > EAN|0x > + 0001008b > + > ## This PCD defines the MAX repair count. > # The default value is 0 that means infinite. > # @Prompt MAX repair count > diff --git a/MdeModulePkg/MdeModulePkg.uni > b/MdeModulePkg/MdeModulePkg.uni index > a17d34d60b21..6079285e3f8b 100644 > --- a/MdeModulePkg/MdeModulePkg.uni > +++ b/MdeModulePkg/MdeModulePkg.uni > @@ -955,6 +955,14 @@ > "BIT 4 - > EFI_ACPI_TABLE_VERSION_4_0.<BR>\n" > "BIT 5 - > EFI_ACPI_TABLE_VERSION_5_0.<BR>" > > +#string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_PROM > PT #language en-US "ACPI Reclaim memory is not available." > + > +#string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_HELP > #language en-US "Indicates whether ACPI Reclaim memory is not available\n" > + "Default is FALSE that means ACPI > Reclaim memory is available\n" > + "If it is set to TRUE that means > ACPI Reclaim memory is not available\n" > + "For example ACPI Table protocol > will use ACPI NVS memory instead of ACPI Reclaim memory" > + > + > #string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_PROMPT > #language en-US "Enable export HII data and configuration to be used in OS > runtime." > > #string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_HELP > #language en-US "Indicates if HII data and configuration has been > exported.<BR><BR>\n" > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > index 86dea43e27e4..be498a56cff0 100644 > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > @@ -68,6 +68,7 @@ [Pcd] > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions ## > CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory ## > CONSUMES > > [Protocols] > gEfiAcpiTableProtocolGuid ## PRODUCES > -- > 2.44.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117273): https://edk2.groups.io/g/devel/message/117273 Mute This Topic: https://groups.io/mt/105154551/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory 2024-04-01 2:05 ` Zhiguang Liu @ 2024-04-01 2:31 ` Aaron Li 2024-04-02 1:26 ` 回复: " gaoliming via groups.io 2024-04-09 6:23 ` 回复: " gaoliming via groups.io 0 siblings, 2 replies; 10+ messages in thread From: Aaron Li @ 2024-04-01 2:31 UTC (permalink / raw) To: devel@edk2.groups.io, Liming Gao Cc: Bi, Dandan, Liu, Yun Y, Yao, Jiewen, Ni, Ray, Kinney, Michael D, Liu, Zhiguang Hi Liming, Could you please help review and merge it? Thanks. Best, Aaron -----Original Message----- From: Liu, Zhiguang <zhiguang.liu@intel.com> Sent: Monday, April 1, 2024 10:06 AM To: Li, Aaron <aaron.li@intel.com>; devel@edk2.groups.io Cc: Bi, Dandan <dandan.bi@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Liu, Yun Y <yun.y.liu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Ni, Ray <ray.ni@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com> Subject: RE: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com> > -----Original Message----- > From: Li, Aaron <aaron.li@intel.com> > Sent: Tuesday, March 26, 2024 3:58 PM > To: devel@edk2.groups.io > Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Bi, Dandan > <dandan.bi@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Liu, Yun Y > <yun.y.liu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Ni, Ray > <ray.ni@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com> > Subject: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid > using ACPI reclaim memory > > UEFI spec defined ACPI Tables at boot time can be contained in memory of > type EfiACPIReclaimMemory or EfiAcpiMemoryNVS, although InstallAcpiTable > with AcpiTableProtocol will only allocate memory with type > EfiACPIReclaimMemory (Except FACS). > > This patch provides an optional method controlled by PCD to avoid using > EfiACPIReclaimMemory, by setting the PCD PcdNoACPIReclaimMemory to > TRUE, all ACPI allocated memory will use EfiAcpiMemoryNVS instead. > > Cc: Zhiguang Liu <zhiguang.liu@intel.com> > Cc: Dandan Bi <dandan.bi@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn> > Cc: Liu Yun <yun.y.liu@intel.com> > Cc: Jiewen Yao <jiewen.yao@intel.com> > Cc: Ray Ni <ray.ni@intel.com> > Cc: Michael D Kinney <michael.d.kinney@intel.com> > Signed-off-by: Aaron Li <aaron.li@intel.com> > --- > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 37 > +++++++++++++++----- > MdeModulePkg/MdeModulePkg.dec | 7 ++++ > MdeModulePkg/MdeModulePkg.uni | 8 +++++ > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 1 + > 4 files changed, 45 insertions(+), 8 deletions(-) > > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > index e09bc9b704f5..080768033cfa 100644 > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > @@ -340,6 +340,7 @@ ReallocateAcpiTableBuffer ( > EFI_ACPI_TABLE_INSTANCE TempPrivateData; > EFI_STATUS Status; > UINT64 CurrentData; > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > CopyMem (&TempPrivateData, AcpiTableInstance, sizeof > (EFI_ACPI_TABLE_INSTANCE)); > // > @@ -359,6 +360,12 @@ ReallocateAcpiTableBuffer ( > NewMaxTableNumber * sizeof (UINT32); > } > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > + > if (mAcpiTableAllocType != AllocateAnyPages) { > // > // Allocate memory in the lower 32 bit of address range for @@ -372,13 > +379,13 @@ ReallocateAcpiTableBuffer ( > PageAddress = 0xFFFFFFFF; > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (TotalSize), > &PageAddress > ); > } else { > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > TotalSize, > (VOID **)&Pointer > ); > @@ -512,6 +519,7 @@ AddTableToList ( > EFI_PHYSICAL_ADDRESS AllocPhysAddress; > UINT64 Buffer64; > BOOLEAN AddToRsdt; > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > // > // Check for invalid input parameters @@ -550,6 +558,12 @@ > AddTableToList ( > CurrentTableList->TableSize = CurrentTableSize; > CurrentTableList->PoolAllocation = FALSE; > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > + > // > // Allocation memory type depends on the type of the table > // > @@ -585,7 +599,7 @@ AddTableToList ( > // such as AArch64 that allocate multiples of 64 KB > // > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > CurrentTableList->TableSize, > (VOID **)&CurrentTableList->Table > ); > @@ -596,7 +610,7 @@ AddTableToList ( > // > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (CurrentTableList->TableSize), > &AllocPhysAddress > ); > @@ -1944,6 +1958,7 @@ AcpiTableAcpiTableConstructor ( > UINTN RsdpTableSize; > UINT8 *Pointer; > EFI_PHYSICAL_ADDRESS PageAddress; > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > // > // Check for invalid input parameters @@ -1978,17 +1993,23 @@ > AcpiTableAcpiTableConstructor ( > RsdpTableSize += sizeof > (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER); > } > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > + > if (mAcpiTableAllocType != AllocateAnyPages) { > PageAddress = 0xFFFFFFFF; > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (RsdpTableSize), > &PageAddress > ); > } else { > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > RsdpTableSize, > (VOID **)&Pointer > ); > @@ -2037,13 +2058,13 @@ AcpiTableAcpiTableConstructor ( > PageAddress = 0xFFFFFFFF; > Status = gBS->AllocatePages ( > mAcpiTableAllocType, > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > EFI_SIZE_TO_PAGES (TotalSize), > &PageAddress > ); > } else { > Status = gBS->AllocatePool ( > - EfiACPIReclaimMemory, > + AcpiAllocateMemoryType, > TotalSize, > (VOID **)&Pointer > ); > diff --git a/MdeModulePkg/MdeModulePkg.dec > b/MdeModulePkg/MdeModulePkg.dec index a82dedc070df..a91058e5b5df > 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -1533,6 +1533,13 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] > # @Prompt Exposed ACPI table versions. > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x3E|UIN > T32|0x0001004c > > + ## Indicates whether ACPI Reclaim memory is not available # Default > + is FALSE that means ACPI Reclaim memory is available # If it is set > + to TRUE that means ACPI Reclaim memory is not available # For example > + ACPI Table protocol will use ACPI NVS memory instead of ACPI Reclaim > + memory # @Prompt ACPI Reclaim memory is not available. > + > + > gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory|FALSE|BOOL > EAN|0x > + 0001008b > + > ## This PCD defines the MAX repair count. > # The default value is 0 that means infinite. > # @Prompt MAX repair count > diff --git a/MdeModulePkg/MdeModulePkg.uni > b/MdeModulePkg/MdeModulePkg.uni index > a17d34d60b21..6079285e3f8b 100644 > --- a/MdeModulePkg/MdeModulePkg.uni > +++ b/MdeModulePkg/MdeModulePkg.uni > @@ -955,6 +955,14 @@ > "BIT 4 - > EFI_ACPI_TABLE_VERSION_4_0.<BR>\n" > "BIT 5 - > EFI_ACPI_TABLE_VERSION_5_0.<BR>" > > +#string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_PROM > PT #language en-US "ACPI Reclaim memory is not available." > + > +#string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_HELP > #language en-US "Indicates whether ACPI Reclaim memory is not available\n" > + "Default is FALSE that means ACPI > Reclaim memory is available\n" > + "If it is set to TRUE that means > ACPI Reclaim memory is not available\n" > + "For example ACPI Table protocol > will use ACPI NVS memory instead of ACPI Reclaim memory" > + > + > #string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_PROMPT > #language en-US "Enable export HII data and configuration to be used in OS > runtime." > > #string > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_HELP > #language en-US "Indicates if HII data and configuration has been > exported.<BR><BR>\n" > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > index 86dea43e27e4..be498a56cff0 100644 > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > @@ -68,6 +68,7 @@ [Pcd] > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision ## > CONSUMES > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions ## > CONSUMES > + gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory ## > CONSUMES > > [Protocols] > gEfiAcpiTableProtocolGuid ## PRODUCES > -- > 2.44.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117274): https://edk2.groups.io/g/devel/message/117274 Mute This Topic: https://groups.io/mt/105154551/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 10+ messages in thread
* 回复: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory 2024-04-01 2:31 ` Aaron Li @ 2024-04-02 1:26 ` gaoliming via groups.io 2024-04-07 1:56 ` Aaron Li 2024-04-09 6:23 ` 回复: " gaoliming via groups.io 1 sibling, 1 reply; 10+ messages in thread From: gaoliming via groups.io @ 2024-04-02 1:26 UTC (permalink / raw) To: devel, aaron.li Cc: 'Bi, Dandan', 'Liu, Yun Y', 'Yao, Jiewen', 'Ni, Ray', 'Kinney, Michael D', 'Liu, Zhiguang' Aaron: Per the specification, it is valid to publish all ACPI table in EfiAcpiMemoryNVS. So, I have no other comments for this patch. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Thanks Liming > -----邮件原件----- > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Aaron Li > 发送时间: 2024年4月1日 10:32 > 收件人: devel@edk2.groups.io; Liming Gao <gaoliming@byosoft.com.cn> > 抄送: Bi, Dandan <dandan.bi@intel.com>; Liu, Yun Y <yun.y.liu@intel.com>; > Yao, Jiewen <jiewen.yao@intel.com>; Ni, Ray <ray.ni@intel.com>; Kinney, > Michael D <michael.d.kinney@intel.com>; Liu, Zhiguang > <zhiguang.liu@intel.com> > 主题: Re: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD > switch to avoid using ACPI reclaim memory > > Hi Liming, > > Could you please help review and merge it? Thanks. > > Best, > Aaron > > -----Original Message----- > From: Liu, Zhiguang <zhiguang.liu@intel.com> > Sent: Monday, April 1, 2024 10:06 AM > To: Li, Aaron <aaron.li@intel.com>; devel@edk2.groups.io > Cc: Bi, Dandan <dandan.bi@intel.com>; Liming Gao > <gaoliming@byosoft.com.cn>; Liu, Yun Y <yun.y.liu@intel.com>; Yao, Jiewen > <jiewen.yao@intel.com>; Ni, Ray <ray.ni@intel.com>; Kinney, Michael D > <michael.d.kinney@intel.com> > Subject: RE: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to > avoid using ACPI reclaim memory > > Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com> > > > -----Original Message----- > > From: Li, Aaron <aaron.li@intel.com> > > Sent: Tuesday, March 26, 2024 3:58 PM > > To: devel@edk2.groups.io > > Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Bi, Dandan > > <dandan.bi@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Liu, Yun > Y > > <yun.y.liu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Ni, Ray > > <ray.ni@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com> > > Subject: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid > > using ACPI reclaim memory > > > > UEFI spec defined ACPI Tables at boot time can be contained in memory of > > type EfiACPIReclaimMemory or EfiAcpiMemoryNVS, although > InstallAcpiTable > > with AcpiTableProtocol will only allocate memory with type > > EfiACPIReclaimMemory (Except FACS). > > > > This patch provides an optional method controlled by PCD to avoid using > > EfiACPIReclaimMemory, by setting the PCD PcdNoACPIReclaimMemory to > > TRUE, all ACPI allocated memory will use EfiAcpiMemoryNVS instead. > > > > Cc: Zhiguang Liu <zhiguang.liu@intel.com> > > Cc: Dandan Bi <dandan.bi@intel.com> > > Cc: Liming Gao <gaoliming@byosoft.com.cn> > > Cc: Liu Yun <yun.y.liu@intel.com> > > Cc: Jiewen Yao <jiewen.yao@intel.com> > > Cc: Ray Ni <ray.ni@intel.com> > > Cc: Michael D Kinney <michael.d.kinney@intel.com> > > Signed-off-by: Aaron Li <aaron.li@intel.com> > > --- > > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 37 > > +++++++++++++++----- > > MdeModulePkg/MdeModulePkg.dec > | 7 ++++ > > MdeModulePkg/MdeModulePkg.uni > | 8 +++++ > > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 1 > + > > 4 files changed, 45 insertions(+), 8 deletions(-) > > > > diff --git > a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > index e09bc9b704f5..080768033cfa 100644 > > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > @@ -340,6 +340,7 @@ ReallocateAcpiTableBuffer ( > > EFI_ACPI_TABLE_INSTANCE TempPrivateData; > > EFI_STATUS Status; > > UINT64 CurrentData; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > CopyMem (&TempPrivateData, AcpiTableInstance, sizeof > > (EFI_ACPI_TABLE_INSTANCE)); > > // > > @@ -359,6 +360,12 @@ ReallocateAcpiTableBuffer ( > > NewMaxTableNumber * sizeof (UINT32); > > } > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > > + > > if (mAcpiTableAllocType != AllocateAnyPages) { > > // > > // Allocate memory in the lower 32 bit of address range for @@ > -372,13 > > +379,13 @@ ReallocateAcpiTableBuffer ( > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (TotalSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > TotalSize, > > (VOID **)&Pointer > > ); > > @@ -512,6 +519,7 @@ AddTableToList ( > > EFI_PHYSICAL_ADDRESS AllocPhysAddress; > > UINT64 Buffer64; > > BOOLEAN AddToRsdt; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > // > > // Check for invalid input parameters @@ -550,6 +558,12 @@ > > AddTableToList ( > > CurrentTableList->TableSize = CurrentTableSize; > > CurrentTableList->PoolAllocation = FALSE; > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > > + > > // > > // Allocation memory type depends on the type of the table > > // > > @@ -585,7 +599,7 @@ AddTableToList ( > > // such as AArch64 that allocate multiples of 64 KB > > // > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > CurrentTableList->TableSize, > > (VOID **)&CurrentTableList->Table > > ); > > @@ -596,7 +610,7 @@ AddTableToList ( > > // > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES > (CurrentTableList->TableSize), > > &AllocPhysAddress > > ); > > @@ -1944,6 +1958,7 @@ AcpiTableAcpiTableConstructor ( > > UINTN RsdpTableSize; > > UINT8 *Pointer; > > EFI_PHYSICAL_ADDRESS PageAddress; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > // > > // Check for invalid input parameters @@ -1978,17 +1993,23 @@ > > AcpiTableAcpiTableConstructor ( > > RsdpTableSize += sizeof > > (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER); > > } > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > > + > > if (mAcpiTableAllocType != AllocateAnyPages) { > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (RsdpTableSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > RsdpTableSize, > > (VOID **)&Pointer > > ); > > @@ -2037,13 +2058,13 @@ AcpiTableAcpiTableConstructor ( > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (TotalSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > TotalSize, > > (VOID **)&Pointer > > ); > > diff --git a/MdeModulePkg/MdeModulePkg.dec > > b/MdeModulePkg/MdeModulePkg.dec index a82dedc070df..a91058e5b5df > > 100644 > > --- a/MdeModulePkg/MdeModulePkg.dec > > +++ b/MdeModulePkg/MdeModulePkg.dec > > @@ -1533,6 +1533,13 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] > > # @Prompt Exposed ACPI table versions. > > > > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x3E|UIN > > T32|0x0001004c > > > > + ## Indicates whether ACPI Reclaim memory is not available # Default > > + is FALSE that means ACPI Reclaim memory is available # If it is set > > + to TRUE that means ACPI Reclaim memory is not available # For > example > > + ACPI Table protocol will use ACPI NVS memory instead of ACPI Reclaim > > + memory # @Prompt ACPI Reclaim memory is not available. > > + > > + > > > gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory|FALSE|BOOL > > EAN|0x > > + 0001008b > > + > > ## This PCD defines the MAX repair count. > > # The default value is 0 that means infinite. > > # @Prompt MAX repair count > > diff --git a/MdeModulePkg/MdeModulePkg.uni > > b/MdeModulePkg/MdeModulePkg.uni index > > a17d34d60b21..6079285e3f8b 100644 > > --- a/MdeModulePkg/MdeModulePkg.uni > > +++ b/MdeModulePkg/MdeModulePkg.uni > > @@ -955,6 +955,14 @@ > > > "BIT 4 - > > EFI_ACPI_TABLE_VERSION_4_0.<BR>\n" > > > "BIT 5 - > > EFI_ACPI_TABLE_VERSION_5_0.<BR>" > > > > +#string > > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_PROM > > PT #language en-US "ACPI Reclaim memory is not available." > > + > > +#string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_HELP > > #language en-US "Indicates whether ACPI Reclaim memory is not > available\n" > > + > "Default is FALSE that means ACPI > > Reclaim memory is available\n" > > + > "If it is set to TRUE that means > > ACPI Reclaim memory is not available\n" > > + > "For example ACPI Table protocol > > will use ACPI NVS memory instead of ACPI Reclaim memory" > > + > > + > > #string > > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_PROMPT > > #language en-US "Enable export HII data and configuration to be used in OS > > runtime." > > > > #string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_HELP > > #language en-US "Indicates if HII data and configuration has been > > exported.<BR><BR>\n" > > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > index 86dea43e27e4..be498a56cff0 100644 > > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > @@ -68,6 +68,7 @@ [Pcd] > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId > ## > > CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision > ## > > CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions > ## > > CONSUMES > > + gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory > ## > > CONSUMES > > > > [Protocols] > > gEfiAcpiTableProtocolGuid ## PRODUCES > > -- > > 2.44.0.windows.1 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117302): https://edk2.groups.io/g/devel/message/117302 Mute This Topic: https://groups.io/mt/105280101/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory 2024-04-02 1:26 ` 回复: " gaoliming via groups.io @ 2024-04-07 1:56 ` Aaron Li 0 siblings, 0 replies; 10+ messages in thread From: Aaron Li @ 2024-04-07 1:56 UTC (permalink / raw) To: gaoliming, devel@edk2.groups.io Cc: Bi, Dandan, Liu, Yun Y, Yao, Jiewen, Ni, Ray, Kinney, Michael D, Liu, Zhiguang Hi Liming, Can you help merge the patch? Thanks. Best, Aaron -----Original Message----- From: gaoliming <gaoliming@byosoft.com.cn> Sent: Tuesday, April 2, 2024 9:26 AM To: devel@edk2.groups.io; Li, Aaron <aaron.li@intel.com> Cc: Bi, Dandan <dandan.bi@intel.com>; Liu, Yun Y <yun.y.liu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Ni, Ray <ray.ni@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Liu, Zhiguang <zhiguang.liu@intel.com> Subject: 回复: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory Aaron: Per the specification, it is valid to publish all ACPI table in EfiAcpiMemoryNVS. So, I have no other comments for this patch. Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Thanks Liming > -----邮件原件----- > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Aaron Li > 发送时间: 2024年4月1日 10:32 > 收件人: devel@edk2.groups.io; Liming Gao <gaoliming@byosoft.com.cn> > 抄送: Bi, Dandan <dandan.bi@intel.com>; Liu, Yun Y <yun.y.liu@intel.com>; > Yao, Jiewen <jiewen.yao@intel.com>; Ni, Ray <ray.ni@intel.com>; Kinney, > Michael D <michael.d.kinney@intel.com>; Liu, Zhiguang > <zhiguang.liu@intel.com> > 主题: Re: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD > switch to avoid using ACPI reclaim memory > > Hi Liming, > > Could you please help review and merge it? Thanks. > > Best, > Aaron > > -----Original Message----- > From: Liu, Zhiguang <zhiguang.liu@intel.com> > Sent: Monday, April 1, 2024 10:06 AM > To: Li, Aaron <aaron.li@intel.com>; devel@edk2.groups.io > Cc: Bi, Dandan <dandan.bi@intel.com>; Liming Gao > <gaoliming@byosoft.com.cn>; Liu, Yun Y <yun.y.liu@intel.com>; Yao, Jiewen > <jiewen.yao@intel.com>; Ni, Ray <ray.ni@intel.com>; Kinney, Michael D > <michael.d.kinney@intel.com> > Subject: RE: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to > avoid using ACPI reclaim memory > > Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com> > > > -----Original Message----- > > From: Li, Aaron <aaron.li@intel.com> > > Sent: Tuesday, March 26, 2024 3:58 PM > > To: devel@edk2.groups.io > > Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Bi, Dandan > > <dandan.bi@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Liu, Yun > Y > > <yun.y.liu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Ni, Ray > > <ray.ni@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com> > > Subject: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid > > using ACPI reclaim memory > > > > UEFI spec defined ACPI Tables at boot time can be contained in memory of > > type EfiACPIReclaimMemory or EfiAcpiMemoryNVS, although > InstallAcpiTable > > with AcpiTableProtocol will only allocate memory with type > > EfiACPIReclaimMemory (Except FACS). > > > > This patch provides an optional method controlled by PCD to avoid using > > EfiACPIReclaimMemory, by setting the PCD PcdNoACPIReclaimMemory to > > TRUE, all ACPI allocated memory will use EfiAcpiMemoryNVS instead. > > > > Cc: Zhiguang Liu <zhiguang.liu@intel.com> > > Cc: Dandan Bi <dandan.bi@intel.com> > > Cc: Liming Gao <gaoliming@byosoft.com.cn> > > Cc: Liu Yun <yun.y.liu@intel.com> > > Cc: Jiewen Yao <jiewen.yao@intel.com> > > Cc: Ray Ni <ray.ni@intel.com> > > Cc: Michael D Kinney <michael.d.kinney@intel.com> > > Signed-off-by: Aaron Li <aaron.li@intel.com> > > --- > > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 37 > > +++++++++++++++----- > > MdeModulePkg/MdeModulePkg.dec > | 7 ++++ > > MdeModulePkg/MdeModulePkg.uni > | 8 +++++ > > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 1 > + > > 4 files changed, 45 insertions(+), 8 deletions(-) > > > > diff --git > a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > index e09bc9b704f5..080768033cfa 100644 > > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > @@ -340,6 +340,7 @@ ReallocateAcpiTableBuffer ( > > EFI_ACPI_TABLE_INSTANCE TempPrivateData; > > EFI_STATUS Status; > > UINT64 CurrentData; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > CopyMem (&TempPrivateData, AcpiTableInstance, sizeof > > (EFI_ACPI_TABLE_INSTANCE)); > > // > > @@ -359,6 +360,12 @@ ReallocateAcpiTableBuffer ( > > NewMaxTableNumber * sizeof (UINT32); > > } > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > > + > > if (mAcpiTableAllocType != AllocateAnyPages) { > > // > > // Allocate memory in the lower 32 bit of address range for @@ > -372,13 > > +379,13 @@ ReallocateAcpiTableBuffer ( > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (TotalSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > TotalSize, > > (VOID **)&Pointer > > ); > > @@ -512,6 +519,7 @@ AddTableToList ( > > EFI_PHYSICAL_ADDRESS AllocPhysAddress; > > UINT64 Buffer64; > > BOOLEAN AddToRsdt; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > // > > // Check for invalid input parameters @@ -550,6 +558,12 @@ > > AddTableToList ( > > CurrentTableList->TableSize = CurrentTableSize; > > CurrentTableList->PoolAllocation = FALSE; > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > > + > > // > > // Allocation memory type depends on the type of the table > > // > > @@ -585,7 +599,7 @@ AddTableToList ( > > // such as AArch64 that allocate multiples of 64 KB > > // > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > CurrentTableList->TableSize, > > (VOID **)&CurrentTableList->Table > > ); > > @@ -596,7 +610,7 @@ AddTableToList ( > > // > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES > (CurrentTableList->TableSize), > > &AllocPhysAddress > > ); > > @@ -1944,6 +1958,7 @@ AcpiTableAcpiTableConstructor ( > > UINTN RsdpTableSize; > > UINT8 *Pointer; > > EFI_PHYSICAL_ADDRESS PageAddress; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > // > > // Check for invalid input parameters @@ -1978,17 +1993,23 @@ > > AcpiTableAcpiTableConstructor ( > > RsdpTableSize += sizeof > > (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER); > > } > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > > + > > if (mAcpiTableAllocType != AllocateAnyPages) { > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (RsdpTableSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > RsdpTableSize, > > (VOID **)&Pointer > > ); > > @@ -2037,13 +2058,13 @@ AcpiTableAcpiTableConstructor ( > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (TotalSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > TotalSize, > > (VOID **)&Pointer > > ); > > diff --git a/MdeModulePkg/MdeModulePkg.dec > > b/MdeModulePkg/MdeModulePkg.dec index a82dedc070df..a91058e5b5df > > 100644 > > --- a/MdeModulePkg/MdeModulePkg.dec > > +++ b/MdeModulePkg/MdeModulePkg.dec > > @@ -1533,6 +1533,13 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] > > # @Prompt Exposed ACPI table versions. > > > > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x3E|UIN > > T32|0x0001004c > > > > + ## Indicates whether ACPI Reclaim memory is not available # Default > > + is FALSE that means ACPI Reclaim memory is available # If it is set > > + to TRUE that means ACPI Reclaim memory is not available # For > example > > + ACPI Table protocol will use ACPI NVS memory instead of ACPI Reclaim > > + memory # @Prompt ACPI Reclaim memory is not available. > > + > > + > > > gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory|FALSE|BOOL > > EAN|0x > > + 0001008b > > + > > ## This PCD defines the MAX repair count. > > # The default value is 0 that means infinite. > > # @Prompt MAX repair count > > diff --git a/MdeModulePkg/MdeModulePkg.uni > > b/MdeModulePkg/MdeModulePkg.uni index > > a17d34d60b21..6079285e3f8b 100644 > > --- a/MdeModulePkg/MdeModulePkg.uni > > +++ b/MdeModulePkg/MdeModulePkg.uni > > @@ -955,6 +955,14 @@ > > > "BIT 4 - > > EFI_ACPI_TABLE_VERSION_4_0.<BR>\n" > > > "BIT 5 - > > EFI_ACPI_TABLE_VERSION_5_0.<BR>" > > > > +#string > > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_PROM > > PT #language en-US "ACPI Reclaim memory is not available." > > + > > +#string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_HELP > > #language en-US "Indicates whether ACPI Reclaim memory is not > available\n" > > + > "Default is FALSE that means ACPI > > Reclaim memory is available\n" > > + > "If it is set to TRUE that means > > ACPI Reclaim memory is not available\n" > > + > "For example ACPI Table protocol > > will use ACPI NVS memory instead of ACPI Reclaim memory" > > + > > + > > #string > > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_PROMPT > > #language en-US "Enable export HII data and configuration to be used in OS > > runtime." > > > > #string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_HELP > > #language en-US "Indicates if HII data and configuration has been > > exported.<BR><BR>\n" > > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > index 86dea43e27e4..be498a56cff0 100644 > > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > @@ -68,6 +68,7 @@ [Pcd] > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId > ## > > CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision > ## > > CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions > ## > > CONSUMES > > + gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory > ## > > CONSUMES > > > > [Protocols] > > gEfiAcpiTableProtocolGuid ## PRODUCES > > -- > > 2.44.0.windows.1 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117471): https://edk2.groups.io/g/devel/message/117471 Mute This Topic: https://groups.io/mt/105377029/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 10+ messages in thread
* 回复: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory 2024-04-01 2:31 ` Aaron Li 2024-04-02 1:26 ` 回复: " gaoliming via groups.io @ 2024-04-09 6:23 ` gaoliming via groups.io 1 sibling, 0 replies; 10+ messages in thread From: gaoliming via groups.io @ 2024-04-09 6:23 UTC (permalink / raw) To: devel, aaron.li Cc: 'Bi, Dandan', 'Liu, Yun Y', 'Yao, Jiewen', 'Ni, Ray', 'Kinney, Michael D', 'Liu, Zhiguang' PR https://github.com/tianocore/edk2/pull/5539 has been created. Thanks Liming > -----邮件原件----- > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Aaron Li > 发送时间: 2024年4月1日 10:32 > 收件人: devel@edk2.groups.io; Liming Gao <gaoliming@byosoft.com.cn> > 抄送: Bi, Dandan <dandan.bi@intel.com>; Liu, Yun Y <yun.y.liu@intel.com>; > Yao, Jiewen <jiewen.yao@intel.com>; Ni, Ray <ray.ni@intel.com>; Kinney, > Michael D <michael.d.kinney@intel.com>; Liu, Zhiguang > <zhiguang.liu@intel.com> > 主题: Re: [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD > switch to avoid using ACPI reclaim memory > > Hi Liming, > > Could you please help review and merge it? Thanks. > > Best, > Aaron > > -----Original Message----- > From: Liu, Zhiguang <zhiguang.liu@intel.com> > Sent: Monday, April 1, 2024 10:06 AM > To: Li, Aaron <aaron.li@intel.com>; devel@edk2.groups.io > Cc: Bi, Dandan <dandan.bi@intel.com>; Liming Gao > <gaoliming@byosoft.com.cn>; Liu, Yun Y <yun.y.liu@intel.com>; Yao, Jiewen > <jiewen.yao@intel.com>; Ni, Ray <ray.ni@intel.com>; Kinney, Michael D > <michael.d.kinney@intel.com> > Subject: RE: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to > avoid using ACPI reclaim memory > > Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com> > > > -----Original Message----- > > From: Li, Aaron <aaron.li@intel.com> > > Sent: Tuesday, March 26, 2024 3:58 PM > > To: devel@edk2.groups.io > > Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Bi, Dandan > > <dandan.bi@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Liu, Yun > Y > > <yun.y.liu@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>; Ni, Ray > > <ray.ni@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com> > > Subject: [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid > > using ACPI reclaim memory > > > > UEFI spec defined ACPI Tables at boot time can be contained in memory of > > type EfiACPIReclaimMemory or EfiAcpiMemoryNVS, although > InstallAcpiTable > > with AcpiTableProtocol will only allocate memory with type > > EfiACPIReclaimMemory (Except FACS). > > > > This patch provides an optional method controlled by PCD to avoid using > > EfiACPIReclaimMemory, by setting the PCD PcdNoACPIReclaimMemory to > > TRUE, all ACPI allocated memory will use EfiAcpiMemoryNVS instead. > > > > Cc: Zhiguang Liu <zhiguang.liu@intel.com> > > Cc: Dandan Bi <dandan.bi@intel.com> > > Cc: Liming Gao <gaoliming@byosoft.com.cn> > > Cc: Liu Yun <yun.y.liu@intel.com> > > Cc: Jiewen Yao <jiewen.yao@intel.com> > > Cc: Ray Ni <ray.ni@intel.com> > > Cc: Michael D Kinney <michael.d.kinney@intel.com> > > Signed-off-by: Aaron Li <aaron.li@intel.com> > > --- > > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c | 37 > > +++++++++++++++----- > > MdeModulePkg/MdeModulePkg.dec > | 7 ++++ > > MdeModulePkg/MdeModulePkg.uni > | 8 +++++ > > MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf | 1 > + > > 4 files changed, 45 insertions(+), 8 deletions(-) > > > > diff --git > a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > index e09bc9b704f5..080768033cfa 100644 > > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c > > @@ -340,6 +340,7 @@ ReallocateAcpiTableBuffer ( > > EFI_ACPI_TABLE_INSTANCE TempPrivateData; > > EFI_STATUS Status; > > UINT64 CurrentData; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > CopyMem (&TempPrivateData, AcpiTableInstance, sizeof > > (EFI_ACPI_TABLE_INSTANCE)); > > // > > @@ -359,6 +360,12 @@ ReallocateAcpiTableBuffer ( > > NewMaxTableNumber * sizeof (UINT32); > > } > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > > + > > if (mAcpiTableAllocType != AllocateAnyPages) { > > // > > // Allocate memory in the lower 32 bit of address range for @@ > -372,13 > > +379,13 @@ ReallocateAcpiTableBuffer ( > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (TotalSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > TotalSize, > > (VOID **)&Pointer > > ); > > @@ -512,6 +519,7 @@ AddTableToList ( > > EFI_PHYSICAL_ADDRESS AllocPhysAddress; > > UINT64 Buffer64; > > BOOLEAN AddToRsdt; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > // > > // Check for invalid input parameters @@ -550,6 +558,12 @@ > > AddTableToList ( > > CurrentTableList->TableSize = CurrentTableSize; > > CurrentTableList->PoolAllocation = FALSE; > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > > + > > // > > // Allocation memory type depends on the type of the table > > // > > @@ -585,7 +599,7 @@ AddTableToList ( > > // such as AArch64 that allocate multiples of 64 KB > > // > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > CurrentTableList->TableSize, > > (VOID **)&CurrentTableList->Table > > ); > > @@ -596,7 +610,7 @@ AddTableToList ( > > // > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES > (CurrentTableList->TableSize), > > &AllocPhysAddress > > ); > > @@ -1944,6 +1958,7 @@ AcpiTableAcpiTableConstructor ( > > UINTN RsdpTableSize; > > UINT8 *Pointer; > > EFI_PHYSICAL_ADDRESS PageAddress; > > + EFI_MEMORY_TYPE AcpiAllocateMemoryType; > > > > // > > // Check for invalid input parameters @@ -1978,17 +1993,23 @@ > > AcpiTableAcpiTableConstructor ( > > RsdpTableSize += sizeof > > (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER); > > } > > > > + if (PcdGetBool (PcdNoACPIReclaimMemory)) { > > + AcpiAllocateMemoryType = EfiACPIMemoryNVS; } else { > > + AcpiAllocateMemoryType = EfiACPIReclaimMemory; } > > + > > if (mAcpiTableAllocType != AllocateAnyPages) { > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (RsdpTableSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > RsdpTableSize, > > (VOID **)&Pointer > > ); > > @@ -2037,13 +2058,13 @@ AcpiTableAcpiTableConstructor ( > > PageAddress = 0xFFFFFFFF; > > Status = gBS->AllocatePages ( > > mAcpiTableAllocType, > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > EFI_SIZE_TO_PAGES (TotalSize), > > &PageAddress > > ); > > } else { > > Status = gBS->AllocatePool ( > > - EfiACPIReclaimMemory, > > + AcpiAllocateMemoryType, > > TotalSize, > > (VOID **)&Pointer > > ); > > diff --git a/MdeModulePkg/MdeModulePkg.dec > > b/MdeModulePkg/MdeModulePkg.dec index a82dedc070df..a91058e5b5df > > 100644 > > --- a/MdeModulePkg/MdeModulePkg.dec > > +++ b/MdeModulePkg/MdeModulePkg.dec > > @@ -1533,6 +1533,13 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] > > # @Prompt Exposed ACPI table versions. > > > > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x3E|UIN > > T32|0x0001004c > > > > + ## Indicates whether ACPI Reclaim memory is not available # Default > > + is FALSE that means ACPI Reclaim memory is available # If it is set > > + to TRUE that means ACPI Reclaim memory is not available # For > example > > + ACPI Table protocol will use ACPI NVS memory instead of ACPI Reclaim > > + memory # @Prompt ACPI Reclaim memory is not available. > > + > > + > > > gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory|FALSE|BOOL > > EAN|0x > > + 0001008b > > + > > ## This PCD defines the MAX repair count. > > # The default value is 0 that means infinite. > > # @Prompt MAX repair count > > diff --git a/MdeModulePkg/MdeModulePkg.uni > > b/MdeModulePkg/MdeModulePkg.uni index > > a17d34d60b21..6079285e3f8b 100644 > > --- a/MdeModulePkg/MdeModulePkg.uni > > +++ b/MdeModulePkg/MdeModulePkg.uni > > @@ -955,6 +955,14 @@ > > > "BIT 4 - > > EFI_ACPI_TABLE_VERSION_4_0.<BR>\n" > > > "BIT 5 - > > EFI_ACPI_TABLE_VERSION_5_0.<BR>" > > > > +#string > > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_PROM > > PT #language en-US "ACPI Reclaim memory is not available." > > + > > +#string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdNoACPIReclaimMemory_HELP > > #language en-US "Indicates whether ACPI Reclaim memory is not > available\n" > > + > "Default is FALSE that means ACPI > > Reclaim memory is available\n" > > + > "If it is set to TRUE that means > > ACPI Reclaim memory is not available\n" > > + > "For example ACPI Table protocol > > will use ACPI NVS memory instead of ACPI Reclaim memory" > > + > > + > > #string > > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_PROMPT > > #language en-US "Enable export HII data and configuration to be used in OS > > runtime." > > > > #string > > STR_gEfiMdeModulePkgTokenSpaceGuid_PcdHiiOsRuntimeSupport_HELP > > #language en-US "Indicates if HII data and configuration has been > > exported.<BR><BR>\n" > > diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > index 86dea43e27e4..be498a56cff0 100644 > > --- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > +++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf > > @@ -68,6 +68,7 @@ [Pcd] > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorId > ## > > CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultCreatorRevision > ## > > CONSUMES > > gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions > ## > > CONSUMES > > + gEfiMdeModulePkgTokenSpaceGuid.PcdNoACPIReclaimMemory > ## > > CONSUMES > > > > [Protocols] > > gEfiAcpiTableProtocolGuid ## PRODUCES > > -- > > 2.44.0.windows.1 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117538): https://edk2.groups.io/g/devel/message/117538 Mute This Topic: https://groups.io/mt/105417180/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-04-09 6:24 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-03-26 7:57 [edk2-devel] [PATCH v2 1/1] MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory Aaron Li 2024-03-28 1:14 ` [edk2-devel] 回复: " gaoliming via groups.io 2024-03-28 3:59 ` [edk2-devel] " Aaron Li 2024-03-28 5:59 ` Ard Biesheuvel 2024-03-28 7:23 ` Aaron Li 2024-04-01 2:05 ` Zhiguang Liu 2024-04-01 2:31 ` Aaron Li 2024-04-02 1:26 ` 回复: " gaoliming via groups.io 2024-04-07 1:56 ` Aaron Li 2024-04-09 6:23 ` 回复: " gaoliming via groups.io
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox