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>
This commit is contained in:
Jeff Brasen 2024-11-27 16:12:16 -08:00 committed by mergify[bot]
parent bff50932c1
commit 745cab5aad
1 changed files with 8 additions and 8 deletions

View File

@ -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.