From fd8b09912707bf2a0f4653cea02650e36bac404c Mon Sep 17 00:00:00 2001 From: Jeff Brasen Date: Thu, 2 Dec 2021 19:49:34 +0000 Subject: [PATCH 1/8] MdeModulePkg/ScsiDisk: Change TPL to NOTIFY Increase TPL to TPL_NOTIFY to allow for use if caller is > TPL_CALLBACK. This allows services like variable services that run at TPL_NOTIFY to be hosted on ScsiDisks (i.e. UFS) Change-Id: Iaba0a7ebe75fa8333b0166b21badd261bab40712 Reviewed-on: https://git-master.nvidia.com/r/c/3rdparty/edk2/+/2679653 Reviewed-by: svcacv Reviewed-by: svc-sw-mobile-l4t Reviewed-by: Ashish Singhal GVS: Gerrit_Virtual_Submit Tested-by: Jake Garver --- MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c index 98e84b4ea8..b6e5848e77 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c @@ -514,7 +514,7 @@ ScsiDiskReset ( SCSI_DISK_DEV *ScsiDiskDevice; EFI_STATUS Status; - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO (This); @@ -581,7 +581,7 @@ ScsiDiskReadBlocks ( EFI_TPL OldTpl; MediaChange = FALSE; - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO (This); Media = ScsiDiskDevice->BlkIo.Media; @@ -733,7 +733,7 @@ ScsiDiskWriteBlocks ( EFI_TPL OldTpl; MediaChange = FALSE; - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO (This); Media = ScsiDiskDevice->BlkIo.Media; @@ -898,7 +898,7 @@ ScsiDiskResetEx ( SCSI_DISK_DEV *ScsiDiskDevice; EFI_STATUS Status; - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO2 (This); @@ -975,7 +975,7 @@ ScsiDiskReadBlocksEx ( EFI_TPL OldTpl; MediaChange = FALSE; - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO2 (This); Media = ScsiDiskDevice->BlkIo.Media; @@ -1154,7 +1154,7 @@ ScsiDiskWriteBlocksEx ( EFI_TPL OldTpl; MediaChange = FALSE; - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO2 (This); Media = ScsiDiskDevice->BlkIo.Media; @@ -1323,7 +1323,7 @@ ScsiDiskFlushBlocksEx ( EFI_TPL OldTpl; MediaChange = FALSE; - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); ScsiDiskDevice = SCSI_DISK_DEV_FROM_BLKIO2 (This); Media = ScsiDiskDevice->BlkIo.Media; @@ -1717,7 +1717,7 @@ ScsiDiskEraseBlocks ( EFI_TPL OldTpl; MediaChange = FALSE; - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); ScsiDiskDevice = SCSI_DISK_DEV_FROM_ERASEBLK (This); if (!IS_DEVICE_FIXED (ScsiDiskDevice)) { @@ -1907,7 +1907,7 @@ ScsiDiskReceiveData ( AlignedBuffer = NULL; MediaChange = FALSE; AlignedBufferAllocated = FALSE; - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); ScsiDiskDevice = SCSI_DISK_DEV_FROM_STORSEC (This); Media = ScsiDiskDevice->BlkIo.Media; @@ -2122,7 +2122,7 @@ ScsiDiskSendData ( AlignedBuffer = NULL; MediaChange = FALSE; AlignedBufferAllocated = FALSE; - OldTpl = gBS->RaiseTPL (TPL_CALLBACK); + OldTpl = gBS->RaiseTPL (TPL_NOTIFY); ScsiDiskDevice = SCSI_DISK_DEV_FROM_STORSEC (This); Media = ScsiDiskDevice->BlkIo.Media; @@ -2294,7 +2294,7 @@ ScsiDiskDetectMedia ( Status = gBS->CreateEvent ( EVT_TIMER, - TPL_CALLBACK, + TPL_NOTIFY, NULL, NULL, &TimeoutEvt From fe08dcdaa6cc15545dedbda49e9f341eccfa8ddc Mon Sep 17 00:00:00 2001 From: Jeff Brasen Date: Fri, 11 Feb 2022 19:21:23 +0000 Subject: [PATCH 2/8] MdeModulePkg/NonDiscoverablePciDeviceDxe: Allow partial FreeBuffer Add support for partial free of non cached buffers. If a request for less than the full size is requested new allocations for the remaining head and tail of the buffer are added to the list. Added verification that Buffer is EFI_PAGE_SIZE aligned. The XHCI driver does this if the page size for the controller is >4KB. Change-Id: Icaf54ce56878d550bbeda88b714bc15781422eac Signed-off-by: Jeff Brasen Reviewed-on: https://git-master.nvidia.com/r/c/3rdparty/edk2/+/2684951 Reviewed-by: svcacv Reviewed-by: Ashish Singhal GVS: Gerrit_Virtual_Submit Tested-by: Ashish Singhal --- .../NonDiscoverablePciDeviceIo.c | 53 ++++++++++++++++++- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c index c1c5c6267c..77809cfedf 100644 --- a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c +++ b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverablePciDeviceIo.c @@ -960,12 +960,23 @@ NonCoherentPciIoFreeBuffer ( LIST_ENTRY *Entry; EFI_STATUS Status; NON_DISCOVERABLE_DEVICE_UNCACHED_ALLOCATION *Alloc; + NON_DISCOVERABLE_DEVICE_UNCACHED_ALLOCATION *AllocHead; + NON_DISCOVERABLE_DEVICE_UNCACHED_ALLOCATION *AllocTail; BOOLEAN Found; + UINTN StartPages; + UINTN EndPages; + + if (HostAddress != ALIGN_POINTER (HostAddress, EFI_PAGE_SIZE)) { + ASSERT_EFI_ERROR (EFI_INVALID_PARAMETER); + return EFI_INVALID_PARAMETER; + } Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO (This); Found = FALSE; Alloc = NULL; + AllocHead = NULL; + AllocTail = NULL; // // Find the uncached allocation list entry associated @@ -976,9 +987,13 @@ NonCoherentPciIoFreeBuffer ( Entry = Entry->ForwardLink) { Alloc = BASE_CR (Entry, NON_DISCOVERABLE_DEVICE_UNCACHED_ALLOCATION, List); - if ((Alloc->HostAddress == HostAddress) && (Alloc->NumPages == Pages)) { + StartPages = 0; + if (Alloc->HostAddress < HostAddress) { + StartPages = (HostAddress - Alloc->HostAddress) / EFI_PAGE_SIZE; + } + if ((Alloc->HostAddress <= HostAddress) && (Alloc->NumPages >= (Pages + StartPages))) { // - // We are freeing the exact allocation we were given + // We are freeing at least part of what we were given // before by AllocateBuffer() // Found = TRUE; @@ -991,7 +1006,41 @@ NonCoherentPciIoFreeBuffer ( return EFI_NOT_FOUND; } + EndPages = Alloc->NumPages - (Pages + StartPages); + + if (StartPages != 0) { + AllocHead = AllocatePool (sizeof *AllocHead); + if (AllocHead == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + AllocHead->HostAddress = Alloc->HostAddress; + AllocHead->NumPages = StartPages; + AllocHead->Attributes = Alloc->Attributes; + } + + if (EndPages != 0) { + AllocTail = AllocatePool (sizeof *AllocTail); + if (AllocTail == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + AllocTail->HostAddress = Alloc->HostAddress + ((Pages + StartPages) * EFI_PAGE_SIZE); + AllocTail->NumPages = EndPages; + AllocTail->Attributes = Alloc->Attributes; + } + RemoveEntryList (&Alloc->List); + // + // Record this new sub allocations in the linked list, so we + // can restore the memory space attributes later + // + if (AllocHead != NULL) { + InsertHeadList (&Dev->UncachedAllocationList, &AllocHead->List); + } + if (AllocTail != NULL) { + InsertHeadList (&Dev->UncachedAllocationList, &AllocTail->List); + } Status = gDS->SetMemorySpaceAttributes ( (EFI_PHYSICAL_ADDRESS)(UINTN)HostAddress, From 2dba50759af18b2c672aac16d82a222f2521498d Mon Sep 17 00:00:00 2001 From: Jake Garver Date: Wed, 6 Apr 2022 14:42:23 -0400 Subject: [PATCH 3/8] BaseTools: Fix dependency issue in PcdValueInit This change has been accepted upstream, but not yet merged into master. The generated Makefile was missing a dependency. This results in a build-time race condition if the called make runs multiple jobs. Bug 3526159 Change-Id: Ic5df115b1748f393cb495c3a97153e0dc94b3be7 --- BaseTools/Source/Python/Workspace/DscBuildData.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index a9fdc5cafa..a599c5bb76 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -97,7 +97,8 @@ def _IsFieldValueAnArray (Value): AppTarget = ''' all: $(APPFILE) -$(APPFILE): $(OBJECTS) +$(APPLICATION): $(OBJECTS) +$(APPFILE): $(APPLICATION) %s ''' From 59f27cb894c6ecd90380407a18ed4e2dcca2b79e Mon Sep 17 00:00:00 2001 From: Jeff Brasen Date: Fri, 22 Apr 2022 01:01:06 +0800 Subject: [PATCH 4/8] .gitignore: Ignore build tools build logs The python BaseTools/Edk2ToolsBuild.py creates files in BaseTools/BaseToolsBuild and should be ignored. Bug 3663327 Change-Id: I9af2f9a798858087ef6b69d72d58433ee65ae6e3 Signed-off-by: Jeff Brasen Reviewed-on: https://git-master.nvidia.com/r/c/3rdparty/edk2/+/2738035 (cherry picked from commit 0dd5d435d960fab61e7d92d1de39d0a41924635e) Reviewed-on: https://git-master.nvidia.com/r/c/3rdparty/edk2/+/2745216 Tested-by: Ashish Singhal Reviewed-by: Ashish Singhal Reviewed-by: svc-sw-mobile-l4t Reviewed-by: svcacv GVS: Gerrit_Virtual_Submit --- BaseTools/.gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BaseTools/.gitignore b/BaseTools/.gitignore index a45689bc89..ec9c69f8b2 100644 --- a/BaseTools/.gitignore +++ b/BaseTools/.gitignore @@ -17,4 +17,5 @@ Source/C/VfrCompile/VfrTokens.h Source/C/bin/ Source/C/libs/ Bin/Win32 -Lib \ No newline at end of file +Lib +BaseToolsBuild/ \ No newline at end of file From 61dc502e109ca3836c751a3bfade58b66153bb3d Mon Sep 17 00:00:00 2001 From: Jeff Brasen Date: Fri, 24 Jun 2022 14:47:11 -0600 Subject: [PATCH 5/8] DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct translation value The translation value in ACPI should be the difference between the CPU and PCIe address. Signed-off-by: Jeff Brasen Reviewed-by: Pierre Gondois Reviewed-by: Vidya Sagar Reviewed-by: Ashish Singhal --- .../Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c index a34018151f..d4c5f47b07 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c @@ -540,6 +540,7 @@ GeneratePciCrs ( UINT32 RefCount; CM_ARM_PCI_ADDRESS_MAP_INFO *AddrMapInfo; AML_OBJECT_NODE_HANDLE CrsNode; + BOOLEAN IsPosDecode; ASSERT (Generator != NULL); ASSERT (CfgMgrProtocol != NULL); @@ -609,6 +610,11 @@ GeneratePciCrs ( } Translation = (AddrMapInfo->CpuAddress != AddrMapInfo->PciAddress); + if (AddrMapInfo->CpuAddress >= AddrMapInfo->PciAddress) { + IsPosDecode = TRUE; + } else { + IsPosDecode = FALSE; + } switch (AddrMapInfo->SpaceCode) { case PCI_SS_IO: @@ -616,12 +622,12 @@ GeneratePciCrs ( FALSE, TRUE, TRUE, - TRUE, + IsPosDecode, 3, 0, AddrMapInfo->PciAddress, AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1, - Translation ? AddrMapInfo->CpuAddress : 0, + Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0, AddrMapInfo->AddressSize, 0, NULL, @@ -635,7 +641,7 @@ GeneratePciCrs ( case PCI_SS_M32: Status = AmlCodeGenRdDWordMemory ( FALSE, - TRUE, + IsPosDecode, TRUE, TRUE, TRUE, @@ -643,7 +649,7 @@ GeneratePciCrs ( 0, AddrMapInfo->PciAddress, AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1, - Translation ? AddrMapInfo->CpuAddress : 0, + Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0, AddrMapInfo->AddressSize, 0, NULL, @@ -657,7 +663,7 @@ GeneratePciCrs ( case PCI_SS_M64: Status = AmlCodeGenRdQWordMemory ( FALSE, - TRUE, + IsPosDecode, TRUE, TRUE, TRUE, @@ -665,7 +671,7 @@ GeneratePciCrs ( 0, AddrMapInfo->PciAddress, AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1, - Translation ? AddrMapInfo->CpuAddress : 0, + Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0, AddrMapInfo->AddressSize, 0, NULL, From dcbe1f29c04962ca3f287c0b3d9efce566c13e19 Mon Sep 17 00:00:00 2001 From: Jeff Brasen Date: Fri, 24 Jun 2022 17:59:26 -0600 Subject: [PATCH 6/8] DynamicTablesPkg: AcpiSsdtPcieLibArm: Support UID > 0xF Add support for PCIe devices with UID > 0xF. This is done by using the next value in the name so PCI5, PC26, etc Signed-off-by: Jeff Brasen Reviewed-by: Pierre Gondois Reviewed-by: Vidya Sagar Reviewed-by: Ashish Singhal --- .../Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 5 ++++- .../Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c index d4c5f47b07..68ecae96be 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c @@ -824,7 +824,10 @@ GeneratePciDevice ( // Write the name of the PCI device. CopyMem (AslName, "PCIx", AML_NAME_SEG_SIZE + 1); - AslName[AML_NAME_SEG_SIZE - 1] = AsciiFromHex (Uid); + AslName[AML_NAME_SEG_SIZE - 1] = AsciiFromHex (Uid & 0xF); + if (Uid > 0xF) { + AslName[AML_NAME_SEG_SIZE - 2] = AsciiFromHex ((Uid >> 4) & 0xF); + } // ASL: Device (PCIx) {} Status = AmlCodeGenDevice (AslName, ScopeNode, &PciNode); diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h index 59a0d601a3..515a3e1785 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h @@ -31,7 +31,7 @@ Corresponding changes would be needed to support the Name and UID fields describing the Pci root complexes. */ -#define MAX_PCI_ROOT_COMPLEXES_SUPPORTED 16 +#define MAX_PCI_ROOT_COMPLEXES_SUPPORTED 256 // _SB scope of the AML namespace. #define SB_SCOPE "\\_SB_" From 7d82301fd1b08a16e144ac0a038ef7352c4b570c Mon Sep 17 00:00:00 2001 From: Jeff Brasen Date: Fri, 8 Jul 2022 11:56:48 -0600 Subject: [PATCH 7/8] DynamicTablesPkg: AcpiSsdtPcieLibArm: Create support library Add support library to allow for customization of _OSC and slot info. The functions in the library are unchanged, with the exception of adding PciInfo pointer to the APIs. Signed-off-by: Jeff Brasen Reviewed-by: Pierre Gondois Reviewed-by: Vidya Sagar Reviewed-by: Ashish Singhal --- DynamicTablesPkg/DynamicTables.dsc.inc | 1 + DynamicTablesPkg/DynamicTablesPkg.dec | 3 + DynamicTablesPkg/DynamicTablesPkg.dsc | 1 + .../Include/Library/SsdtPcieSupportLib.h | 73 +++++++ .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 168 +-------------- .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.h | 21 -- .../Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf | 2 +- .../SsdtPcieOscTemplate.asl | 0 .../SsdtPcieSupportLib/SsdtPcieSupportLib.c | 200 ++++++++++++++++++ .../SsdtPcieSupportLib/SsdtPcieSupportLib.inf | 30 +++ .../SsdtPcieSupportLibPrivate.h | 25 +++ 11 files changed, 337 insertions(+), 187 deletions(-) create mode 100644 DynamicTablesPkg/Include/Library/SsdtPcieSupportLib.h rename DynamicTablesPkg/Library/{Acpi/Arm/AcpiSsdtPcieLibArm => Common/SsdtPcieSupportLib}/SsdtPcieOscTemplate.asl (100%) create mode 100644 DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.c create mode 100644 DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.inf create mode 100644 DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLibPrivate.h diff --git a/DynamicTablesPkg/DynamicTables.dsc.inc b/DynamicTablesPkg/DynamicTables.dsc.inc index 60bcf4b199..3d4fa0c4c4 100644 --- a/DynamicTablesPkg/DynamicTables.dsc.inc +++ b/DynamicTablesPkg/DynamicTables.dsc.inc @@ -15,6 +15,7 @@ [LibraryClasses.common] AcpiHelperLib|DynamicTablesPkg/Library/Common/AcpiHelperLib/AcpiHelperLib.inf AmlLib|DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf + SsdtPcieSupportLib|DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.inf SsdtSerialPortFixupLib|DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf TableHelperLib|DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec b/DynamicTablesPkg/DynamicTablesPkg.dec index 9b74c5a671..cc34c2bdd6 100644 --- a/DynamicTablesPkg/DynamicTablesPkg.dec +++ b/DynamicTablesPkg/DynamicTablesPkg.dec @@ -30,6 +30,9 @@ ## @libraryclass Defines a set of APIs to a hardware information parser. HwInfoParserLib|Include/Library/HwInfoParserLib.h + ## @libraryclass Defines functions for customizing the generation of _OSC and slot info. + SsdtPcieSupportLib|Include/Library/SsdtPcieSupportLib.h + ## @libraryclass Defines a set of methods for fixing up a SSDT Serial Port. SsdtSerialPortFixupLib|Include/Library/SsdtSerialPortFixupLib.h diff --git a/DynamicTablesPkg/DynamicTablesPkg.dsc b/DynamicTablesPkg/DynamicTablesPkg.dsc index 068f0bc630..07cc837552 100644 --- a/DynamicTablesPkg/DynamicTablesPkg.dsc +++ b/DynamicTablesPkg/DynamicTablesPkg.dsc @@ -41,6 +41,7 @@ [Components.common] DynamicTablesPkg/Library/Common/AcpiHelperLib/AcpiHelperLib.inf DynamicTablesPkg/Library/Common/AmlLib/AmlLib.inf + DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.inf DynamicTablesPkg/Library/Common/SsdtSerialPortFixupLib/SsdtSerialPortFixupLib.inf DynamicTablesPkg/Library/Common/TableHelperLib/TableHelperLib.inf DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib.inf diff --git a/DynamicTablesPkg/Include/Library/SsdtPcieSupportLib.h b/DynamicTablesPkg/Include/Library/SsdtPcieSupportLib.h new file mode 100644 index 0000000000..85e283a994 --- /dev/null +++ b/DynamicTablesPkg/Include/Library/SsdtPcieSupportLib.h @@ -0,0 +1,73 @@ +/** @file + Ssdt PCIe Support Library + + Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef SSDT_PCIE_SUPPORT_LIB_H_ +#define SSDT_PCIE_SUPPORT_LIB_H_ + +#pragma pack(1) + +/** Structure used to map integer to an index. +*/ +typedef struct MappingTable { + /// Mapping table. + /// Contains the Index <-> integer mapping + UINT32 *Table; + + /// Last used index of the Table. + /// Bound by MaxIndex. + UINT32 LastIndex; + + /// Number of entries in the Table. + UINT32 MaxIndex; +} MAPPING_TABLE; + +#pragma pack() + +/** Add an _OSC template method to the PciNode. + + The _OSC method is provided as an AML blob. The blob is + parsed and attached at the end of the PciNode list of variable elements. + + @param [in] PciInfo Pci device information. + @param [in, out] PciNode Pci node to amend. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Could not allocate memory. +**/ +EFI_STATUS +EFIAPI +AddOscMethod ( + IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo, + IN OUT AML_OBJECT_NODE_HANDLE PciNode + ); + +/** Generate Pci slots devices. + + PCI Firmware Specification - Revision 3.3, + s4.8 "Generic ACPI PCI Slot Description" requests to describe the PCI slot + used. It should be possible to enumerate them, but this is additional + information. + + @param [in] PciInfo Pci device information. + @param [in] MappingTable The mapping table structure. + @param [in, out] PciNode Pci node to amend. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +EFI_STATUS +EFIAPI +GeneratePciSlots ( + IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo, + IN CONST MAPPING_TABLE *MappingTable, + IN OUT AML_OBJECT_NODE_HANDLE PciNode + ); + +#endif // SSDT_PCIE_SUPPORT_LIB_H_ diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c index 68ecae96be..62cec3753c 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "SsdtPcieGenerator.h" @@ -280,86 +281,6 @@ GeneratePciDeviceInfo ( return Status; } -/** Generate Pci slots devices. - - PCI Firmware Specification - Revision 3.3, - s4.8 "Generic ACPI PCI Slot Description" requests to describe the PCI slot - used. It should be possible to enumerate them, but this is additional - information. - - @param [in] MappingTable The mapping table structure. - @param [in, out] PciNode Pci node to amend. - - @retval EFI_SUCCESS Success. - @retval EFI_INVALID_PARAMETER Invalid parameter. - @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. -**/ -STATIC -EFI_STATUS -EFIAPI -GeneratePciSlots ( - IN CONST MAPPING_TABLE *MappingTable, - IN OUT AML_OBJECT_NODE_HANDLE PciNode - ) -{ - EFI_STATUS Status; - UINT32 Index; - UINT32 LastIndex; - UINT32 DeviceId; - CHAR8 AslName[AML_NAME_SEG_SIZE + 1]; - AML_OBJECT_NODE_HANDLE DeviceNode; - - ASSERT (MappingTable != NULL); - ASSERT (PciNode != NULL); - - // Generic device name is "Dxx". - CopyMem (AslName, "Dxx_", AML_NAME_SEG_SIZE + 1); - - LastIndex = MappingTable->LastIndex; - - // There are at most 32 devices on a Pci bus. - if (LastIndex >= 32) { - ASSERT (0); - return EFI_INVALID_PARAMETER; - } - - for (Index = 0; Index < LastIndex; Index++) { - DeviceId = MappingTable->Table[Index]; - AslName[AML_NAME_SEG_SIZE - 3] = AsciiFromHex (DeviceId & 0xF); - AslName[AML_NAME_SEG_SIZE - 2] = AsciiFromHex ((DeviceId >> 4) & 0xF); - - // ASL: - // Device (Dxx) { - // Name (_ADR,
) - // } - Status = AmlCodeGenDevice (AslName, PciNode, &DeviceNode); - if (EFI_ERROR (Status)) { - ASSERT (0); - return Status; - } - - /* ACPI 6.4 specification, Table 6.2: "ADR Object Address Encodings" - High word-Device #, Low word-Function #. (for example, device 3, - function 2 is 0x00030002). To refer to all the functions on a device #, - use a function number of FFFF). - */ - Status = AmlCodeGenNameInteger ( - "_ADR", - (DeviceId << 16) | 0xFFFF, - DeviceNode, - NULL - ); - if (EFI_ERROR (Status)) { - ASSERT (0); - return Status; - } - - // _SUN object is not generated as we don't know which slot will be used. - } - - return Status; -} - /** Generate a _PRT object (Pci Routing Table) for the Pci device. Cf. ACPI 6.4 specification, s6.2.13 "_PRT (PCI Routing Table)" @@ -495,7 +416,7 @@ GeneratePrt ( PrtNode = NULL; // Generate the Pci slots once all the device have been added. - Status = GeneratePciSlots (&Generator->DeviceTable, PciNode); + Status = GeneratePciSlots (PciInfo, &Generator->DeviceTable, PciNode); if (EFI_ERROR (Status)) { ASSERT (0); goto exit_handler; @@ -695,89 +616,6 @@ GeneratePciCrs ( return Status; } -/** Add an _OSC template method to the PciNode. - - The _OSC method is provided as an AML blob. The blob is - parsed and attached at the end of the PciNode list of variable elements. - - @param [in, out] PciNode Pci node to amend. - - @retval EFI_SUCCESS The function completed successfully. - @retval EFI_INVALID_PARAMETER Invalid parameter. - @retval EFI_OUT_OF_RESOURCES Could not allocate memory. -**/ -STATIC -EFI_STATUS -EFIAPI -AddOscMethod ( - IN OUT AML_OBJECT_NODE_HANDLE PciNode - ) -{ - EFI_STATUS Status; - EFI_STATUS Status1; - EFI_ACPI_DESCRIPTION_HEADER *SsdtPcieOscTemplate; - AML_ROOT_NODE_HANDLE OscTemplateRoot; - AML_OBJECT_NODE_HANDLE OscNode; - - ASSERT (PciNode != NULL); - - // Parse the Ssdt Pci Osc Template. - SsdtPcieOscTemplate = (EFI_ACPI_DESCRIPTION_HEADER *) - ssdtpcieosctemplate_aml_code; - - OscNode = NULL; - OscTemplateRoot = NULL; - Status = AmlParseDefinitionBlock ( - SsdtPcieOscTemplate, - &OscTemplateRoot - ); - if (EFI_ERROR (Status)) { - DEBUG (( - DEBUG_ERROR, - "ERROR: SSDT-PCI-OSC: Failed to parse SSDT PCI OSC Template." - " Status = %r\n", - Status - )); - return Status; - } - - Status = AmlFindNode (OscTemplateRoot, "\\_OSC", &OscNode); - if (EFI_ERROR (Status)) { - goto error_handler; - } - - Status = AmlDetachNode (OscNode); - if (EFI_ERROR (Status)) { - goto error_handler; - } - - Status = AmlAttachNode (PciNode, OscNode); - if (EFI_ERROR (Status)) { - // Free the detached node. - AmlDeleteTree (OscNode); - goto error_handler; - } - -error_handler: - // Cleanup - Status1 = AmlDeleteTree (OscTemplateRoot); - if (EFI_ERROR (Status1)) { - DEBUG (( - DEBUG_ERROR, - "ERROR: SSDT-PCI-OSC: Failed to cleanup AML tree." - " Status = %r\n", - Status1 - )); - // If Status was success but we failed to delete the AML Tree - // return Status1 else return the original error code, i.e. Status. - if (!EFI_ERROR (Status)) { - return Status1; - } - } - - return Status; -} - /** Generate a Pci device. @param [in] Generator The SSDT Pci generator. @@ -865,7 +703,7 @@ GeneratePciDevice ( } // Add the template _OSC method. - Status = AddOscMethod (PciNode); + Status = AddOscMethod (PciInfo, PciNode); ASSERT_EFI_ERROR (Status); return Status; } diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h index 515a3e1785..7410f9ffd4 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h @@ -36,29 +36,8 @@ // _SB scope of the AML namespace. #define SB_SCOPE "\\_SB_" -/** C array containing the compiled AML template. - This symbol is defined in the auto generated C file - containing the AML bytecode array. -*/ -extern CHAR8 ssdtpcieosctemplate_aml_code[]; - #pragma pack(1) -/** Structure used to map integer to an index. -*/ -typedef struct MappingTable { - /// Mapping table. - /// Contains the Index <-> integer mapping - UINT32 *Table; - - /// Last used index of the Table. - /// Bound by MaxIndex. - UINT32 LastIndex; - - /// Number of entries in the Table. - UINT32 MaxIndex; -} MAPPING_TABLE; - /** A structure holding the Pcie generator and additional private data. */ typedef struct AcpiPcieGenerator { diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf index 283b564801..b38a4e9d34 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf @@ -19,7 +19,6 @@ [Sources] SsdtPcieGenerator.c SsdtPcieGenerator.h - SsdtPcieOscTemplate.asl [Packages] DynamicTablesPkg/DynamicTablesPkg.dec @@ -30,3 +29,4 @@ AcpiHelperLib AmlLib BaseLib + SsdtPcieSupportLib diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieOscTemplate.asl b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieOscTemplate.asl similarity index 100% rename from DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieOscTemplate.asl rename to DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieOscTemplate.asl diff --git a/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.c b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.c new file mode 100644 index 0000000000..e5ab3a3ca8 --- /dev/null +++ b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.c @@ -0,0 +1,200 @@ +/** @file + SSDT PCIe Support Library. + + Copyright (c) 2021 - 2022, Arm Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Reference(s): + - PCI Firmware Specification - Revision 3.0 + - ACPI 6.4 specification: + - s6.2.13 "_PRT (PCI Routing Table)" + - s6.1.1 "_ADR (Address)" + - linux kernel code + - Arm Base Boot Requirements v1.0 + - Arm Base System Architecture v1.0 +**/ + +#include +#include +#include +#include +#include +#include + +// Module specific include files. +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SsdtPcieSupportLibPrivate.h" + +/** Generate Pci slots devices. + + PCI Firmware Specification - Revision 3.3, + s4.8 "Generic ACPI PCI Slot Description" requests to describe the PCI slot + used. It should be possible to enumerate them, but this is additional + information. + + @param [in] PciInfo Pci device information. + @param [in] MappingTable The mapping table structure. + @param [in, out] PciNode Pci node to amend. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. +**/ +EFI_STATUS +EFIAPI +GeneratePciSlots ( + IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo, + IN CONST MAPPING_TABLE *MappingTable, + IN OUT AML_OBJECT_NODE_HANDLE PciNode + ) +{ + EFI_STATUS Status; + UINT32 Index; + UINT32 LastIndex; + UINT32 DeviceId; + CHAR8 AslName[AML_NAME_SEG_SIZE + 1]; + AML_OBJECT_NODE_HANDLE DeviceNode; + + ASSERT (MappingTable != NULL); + ASSERT (PciNode != NULL); + + // Generic device name is "Dxx". + CopyMem (AslName, "Dxx_", AML_NAME_SEG_SIZE + 1); + + LastIndex = MappingTable->LastIndex; + + // There are at most 32 devices on a Pci bus. + if (LastIndex >= 32) { + ASSERT (0); + return EFI_INVALID_PARAMETER; + } + + for (Index = 0; Index < LastIndex; Index++) { + DeviceId = MappingTable->Table[Index]; + AslName[AML_NAME_SEG_SIZE - 3] = AsciiFromHex (DeviceId & 0xF); + AslName[AML_NAME_SEG_SIZE - 2] = AsciiFromHex ((DeviceId >> 4) & 0xF); + + // ASL: + // Device (Dxx) { + // Name (_ADR,
) + // } + Status = AmlCodeGenDevice (AslName, PciNode, &DeviceNode); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + /* ACPI 6.4 specification, Table 6.2: "ADR Object Address Encodings" + High word-Device #, Low word-Function #. (for example, device 3, + function 2 is 0x00030002). To refer to all the functions on a device #, + use a function number of FFFF). + */ + Status = AmlCodeGenNameInteger ( + "_ADR", + (DeviceId << 16) | 0xFFFF, + DeviceNode, + NULL + ); + if (EFI_ERROR (Status)) { + ASSERT (0); + return Status; + } + + // _SUN object is not generated as we don't know which slot will be used. + } + + return Status; +} + +/** Add an _OSC template method to the PciNode. + + The _OSC method is provided as an AML blob. The blob is + parsed and attached at the end of the PciNode list of variable elements. + + @param [in] PciInfo Pci device information. + @param [in, out] PciNode Pci node to amend. + + @retval EFI_SUCCESS The function completed successfully. + @retval EFI_INVALID_PARAMETER Invalid parameter. + @retval EFI_OUT_OF_RESOURCES Could not allocate memory. +**/ +EFI_STATUS +EFIAPI +AddOscMethod ( + IN CONST CM_ARM_PCI_CONFIG_SPACE_INFO *PciInfo, + IN OUT AML_OBJECT_NODE_HANDLE PciNode + ) +{ + EFI_STATUS Status; + EFI_STATUS Status1; + EFI_ACPI_DESCRIPTION_HEADER *SsdtPcieOscTemplate; + AML_ROOT_NODE_HANDLE OscTemplateRoot; + AML_OBJECT_NODE_HANDLE OscNode; + + ASSERT (PciNode != NULL); + + // Parse the Ssdt Pci Osc Template. + SsdtPcieOscTemplate = (EFI_ACPI_DESCRIPTION_HEADER *) + ssdtpcieosctemplate_aml_code; + + OscNode = NULL; + OscTemplateRoot = NULL; + Status = AmlParseDefinitionBlock ( + SsdtPcieOscTemplate, + &OscTemplateRoot + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: SSDT-PCI-OSC: Failed to parse SSDT PCI OSC Template." + " Status = %r\n", + Status + )); + return Status; + } + + Status = AmlFindNode (OscTemplateRoot, "\\_OSC", &OscNode); + if (EFI_ERROR (Status)) { + goto error_handler; + } + + Status = AmlDetachNode (OscNode); + if (EFI_ERROR (Status)) { + goto error_handler; + } + + Status = AmlAttachNode (PciNode, OscNode); + if (EFI_ERROR (Status)) { + // Free the detached node. + AmlDeleteTree (OscNode); + goto error_handler; + } + +error_handler: + // Cleanup + Status1 = AmlDeleteTree (OscTemplateRoot); + if (EFI_ERROR (Status1)) { + DEBUG (( + DEBUG_ERROR, + "ERROR: SSDT-PCI-OSC: Failed to cleanup AML tree." + " Status = %r\n", + Status1 + )); + // If Status was success but we failed to delete the AML Tree + // return Status1 else return the original error code, i.e. Status. + if (!EFI_ERROR (Status)) { + return Status1; + } + } + + return Status; +} diff --git a/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.inf b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.inf new file mode 100644 index 0000000000..57fe32369f --- /dev/null +++ b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLib.inf @@ -0,0 +1,30 @@ +## @file +# Ssdt PCIe Support Library. +# +# Copyright (c) 2021, Arm Limited. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = SsdtPcieSupportLib + FILE_GUID = 510451a0-60b2-446c-b6bf-59cbe4a41782 + VERSION_STRING = 1.0 + MODULE_TYPE = DXE_DRIVER + LIBRARY_CLASS = SsdtPcieSupportLib + +[Sources] + SsdtPcieSupportLib.c + SsdtPcieSupportLibPrivate.h + SsdtPcieOscTemplate.asl + +[Packages] + DynamicTablesPkg/DynamicTablesPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + AcpiHelperLib + AmlLib + BaseLib diff --git a/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLibPrivate.h b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLibPrivate.h new file mode 100644 index 0000000000..0c070b8c7b --- /dev/null +++ b/DynamicTablesPkg/Library/Common/SsdtPcieSupportLib/SsdtPcieSupportLibPrivate.h @@ -0,0 +1,25 @@ +/** @file + SSDT PCIe Support Library private data. + + Copyright (c) 2021, Arm Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Reference(s): + - PCI Firmware Specification - Revision 3.0 + - ACPI 6.4 specification: + - s6.2.13 "_PRT (PCI Routing Table)" + - s6.1.1 "_ADR (Address)" + - linux kernel code + - Arm Base Boot Requirements v1.0 +**/ + +#ifndef SSDT_PCIE_SUPPORT_LIB_PRIVATE_H_ +#define SSDT_PCIE_SUPPORT_LIB_PRIVATE_H_ + +/** C array containing the compiled AML template. + This symbol is defined in the auto generated C file + containing the AML bytecode array. +*/ +extern CHAR8 ssdtpcieosctemplate_aml_code[]; + +#endif // SSDT_PCIE_SUPPORT_LIB_PRIVATE_H_ From 4e9f5c946088190129a11ca2f0538f75f770a391 Mon Sep 17 00:00:00 2001 From: Thejaswani Putta Date: Sun, 28 Aug 2022 15:15:05 -0700 Subject: [PATCH 8/8] ArmPkg/SmbiosMiscDxe: Improve Smbios Type13 table population Smbios Type13 currentLanguage string field is previously hardcoded to English. This is now changed to a PCD which is initialized to the same previosly hardcoded value. Now the platforms can set this PCD based on the customized language setting. TEST: Generated the build with this change and tested the smbiosview output. Signed-off-by: Thejaswani Putta --- ArmPkg/ArmPkg.dec | 3 +++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf | 1 + .../Type13/MiscNumberOfInstallableLanguagesFunction.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index 9da1bbc9f2..43190c3923 100644 --- a/ArmPkg/ArmPkg.dec +++ b/ArmPkg/ArmPkg.dec @@ -387,3 +387,6 @@ # the LinuxBoot payload. # gArmTokenSpaceGuid.PcdLinuxBootFileGuid|{0x0}|VOID*|0x0000005C + + # SMBIOS PCD + gArmTokenSpaceGuid.PcdType13CurrentLanguage|"en|US|iso8859-1"|VOID*|0x30000076 diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf index 60d8fe31c2..e7bac75ab8 100644 --- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf @@ -79,6 +79,7 @@ gArmTokenSpaceGuid.PcdBaseBoardProductName gArmTokenSpaceGuid.PcdBaseBoardVersion gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdType13CurrentLanguage [Guids] gEfiGenericVariableGuid diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInstallableLanguagesFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInstallableLanguagesFunction.c index 386b8800e2..e415a7db12 100644 --- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInstallableLanguagesFunction.c +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInstallableLanguagesFunction.c @@ -136,7 +136,7 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscNumberOfInstallableLanguages) { // Try to check if current langcode matches with the langcodes in installed languages // ZeroMem (CurrentLang, SMBIOS_STRING_MAX_LENGTH - 1); - (VOID)AsciiStrCpyS (CurrentLang, SMBIOS_STRING_MAX_LENGTH - 1, "en|US|iso8859-1"); + (VOID)AsciiStrCpyS (CurrentLang, SMBIOS_STRING_MAX_LENGTH - 1, (CHAR8 *)PcdGetPtr (PcdType13CurrentLanguage)); LangStrLen = AsciiStrLen (CurrentLang); //