summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--IntelSiliconPkg/Feature/VTd/IntelVTdDxe/PciInfo.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/PciInfo.c b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/PciInfo.c
index 305995de03..6ae5df589c 100644
--- a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/PciInfo.c
+++ b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/PciInfo.c
@@ -231,19 +231,13 @@ ScanPciBus (
UINT8 HeaderType;
UINT8 BaseClass;
UINT8 SubClass;
- UINT32 MaxFunction;
UINT16 VendorID;
UINT16 DeviceID;
EFI_STATUS Status;
// Scan the PCI bus for devices
- for (Device = 0; Device < PCI_MAX_DEVICE + 1; Device++) {
- HeaderType = PciSegmentRead8 (PCI_SEGMENT_LIB_ADDRESS(Segment, Bus, Device, 0, PCI_HEADER_TYPE_OFFSET));
- MaxFunction = PCI_MAX_FUNC + 1;
- if ((HeaderType & HEADER_TYPE_MULTI_FUNCTION) == 0x00) {
- MaxFunction = 1;
- }
- for (Function = 0; Function < MaxFunction; Function++) {
+ for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {
+ for (Function = 0; Function <= PCI_MAX_FUNC; Function++) {
VendorID = PciSegmentRead16 (PCI_SEGMENT_LIB_ADDRESS(Segment, Bus, Device, Function, PCI_VENDOR_ID_OFFSET));
DeviceID = PciSegmentRead16 (PCI_SEGMENT_LIB_ADDRESS(Segment, Bus, Device, Function, PCI_DEVICE_ID_OFFSET));
if (VendorID == 0xFFFF && DeviceID == 0xFFFF) {
@@ -275,6 +269,16 @@ ScanPciBus (
}
}
}
+
+ if (Function == 0) {
+ HeaderType = PciSegmentRead8 (PCI_SEGMENT_LIB_ADDRESS(Segment, Bus, Device, 0, PCI_HEADER_TYPE_OFFSET));
+ if ((HeaderType & HEADER_TYPE_MULTI_FUNCTION) == 0x00) {
+ //
+ // It is not a multi-function device, do not scan other functions.
+ //
+ break;
+ }
+ }
}
}