audk/MdeModulePkg
Foster Nong 8fc06b6e19 Fix bug on SRIOV ReservedBusNum when ARI enable.
If a device which support both features SR-IOV/ARI  has multi
functions, which maybe support 8-255. After enable ARI forwarding in
the root port and ARI Capable Hierarchy in the SR-IOV PF0.
The device will support and expose multi functions(0-255) with ARI ID routing.
In next device loop in below for() code, actually it still be in the
same SR-IOV device, and just some PF which is over 8 or higher
one(n*8), PciAllocateBusNumber() will allocate bus
number(ReservedBusNum - TempReservedBusNum)) for this PF. if reset
TempReservedBusNum as 0 in this case,it will allocate wrong bus number
for this PF because TempReservedBusNum should be total previous PF's
reserved bus numbers.

code:
  for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
    TempReservedBusNum = 0;
    for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {
    //
    // Check to see whether a pci device is present
    //
    Status = PciDevicePresent (
                 PciRootBridgeIo,
                 &Pci,
                 StartBusNumber,
                 Device,
                 Func
                 );
    ...
    Status = PciAllocateBusNumber (PciDevice, *SubBusNumber,
    (UINT8)(PciDevice->ReservedBusNum - TempReservedBusNum), SubBusNumber);

The solution is add a new flag IsAriEnabled to help handle this case.
if ARI is enabled, then TempReservedBusNum will not be reset again
during all functions(1-255) scan with checking flag IsAriEnabled.

Signed-off-by: Foster Nong <foster.nong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2022-10-14 07:07:01 +00:00
..
Application MdeModulePkg/DumpDynPcd: Remove unsupported format specifiers 2022-08-17 07:45:58 +00:00
Bus Fix bug on SRIOV ReservedBusNum when ARI enable. 2022-10-14 07:07:01 +00:00
Core MdeModulePkg/DxeIplPeim : LoongArch DxeIPL implementation. 2022-10-14 02:16:33 +00:00
Include MdeModulePkg: Move CPU_EXCEPTION_INIT_DATA to UefiCpuPkg 2022-08-09 04:12:28 +00:00
Library MdeModulePkg/UefiBootManagerLib: Add Disk Info support for Ufs 2022-10-06 17:38:41 +00:00
Logo MdeModulePkg/Logo: Add LoongArch64 architecture. 2022-10-14 02:16:33 +00:00
Test MdeModulePkg/UefiSortLib:Add UefiSortLib unit test 2021-08-12 08:34:04 +00:00
Universal MdeModulePkg/CapsuleRuntimeDxe: Add LoongArch64 architecture. 2022-10-14 02:16:33 +00:00
MdeModulePkg.ci.yaml MdeModulePkg: Update YAML to ignore specific ECC files/errors 2021-11-30 14:19:07 +00:00
MdeModulePkg.dec MdeModulePkg: Use configurable PCD for AHCI command retries 2022-09-13 02:51:27 +00:00
MdeModulePkg.dsc MdeModulePkg: Use LockBoxNullLib for LOONGARCH64 2022-10-14 02:16:33 +00:00
MdeModulePkg.uni MdeModulePkg: Use configurable PCD for AHCI command retries 2022-09-13 02:51:27 +00:00
MdeModulePkgExtra.uni MdeModulePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:08 -07:00