summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Brasen <jbrasen@nvidia.com>2024-11-27 16:12:16 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-12-03 22:13:29 +0000
commit745cab5aadff425a6d20725238b5de7701d59577 (patch)
treeb387078fcef88c9ee6be9687dc4d22aba74677ac
parentbff50932c1288728079f64bb51a3e86cede3a168 (diff)
downloadedk2-745cab5aadff425a6d20725238b5de7701d59577.tar.gz
DynamicTablesPkg: Fix BDF format for PCI initiators
The BDF format for PCI initiators in the SRAT table is incorrect. The format is not a UINT16 but specific bytes. PCI Bus Number (Bits 7:0 of Byte 2) PCI Device Number (Bits 7:3 of Byte 3) PCI Function Number (Bits 2:0 of Byte 3) REF: https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#device-handle-pci Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
-rw-r--r--DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.c
index 20e1a4bfd3..fd83a92dda 100644
--- a/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSratLib/SratGenerator.c
@@ -80,9 +80,9 @@ GET_OBJECT_LIST (
/** Return the PCI Device information in BDF format
- PCI Bus Number - Max 256 busses (Bits 15:8 of BDF)
- PCI Device Number - Max 32 devices (Bits 7:3 of BDF)
- PCI Function Number - Max 8 functions (Bits 2:0 of BDF)
+ PCI Bus Number - Max 256 busses (Bits 7:0 of byte 0 of BDF)
+ PCI Device Number - Max 32 devices (Bits 7:3 of byte 1 of BDF)
+ PCI Function Number - Max 8 functions (Bits 2:0 of byte 1 BDF)
@param [in] DeviceHandlePci Pointer to the PCI Device Handle.
@@ -94,12 +94,12 @@ GetBdf (
IN CONST CM_ARCH_COMMON_DEVICE_HANDLE_PCI *DeviceHandlePci
)
{
- UINT16 Bdf;
+ UINT8 Bdf[2];
- Bdf = (UINT16)DeviceHandlePci->BusNumber << 8;
- Bdf |= (DeviceHandlePci->DeviceNumber & 0x1F) << 3;
- Bdf |= DeviceHandlePci->FunctionNumber & 0x7;
- return Bdf;
+ Bdf[0] = DeviceHandlePci->BusNumber;
+ Bdf[1] = (DeviceHandlePci->DeviceNumber & 0x1F) << 3;
+ Bdf[1] |= DeviceHandlePci->FunctionNumber & 0x7;
+ return *(UINT16 *)Bdf;
}
/** Add the Memory Affinity Structures in the SRAT Table.