public static void PCISetup() { HAL.dArea = deviceArea.PCI; AreaInfo.HALDevInfo.WriteDevicePrefix("PCI", "Detecting PCI Devices..."); HAL.PCIDevices = new List <PCIDevice>(); if ((PCIDevice.GetHeaderType(0x0, 0x0, 0x0) & 0x80) == 0) { CheckBus(0x0); } else { for (ushort fn = 0; fn < 8; fn++) { if (PCIDevice.GetVendorID(0x0, 0x0, fn) != 0xFFFF) { break; } CheckBus(fn); } } }
private static void CheckBus(ushort xBus) { for (ushort device = 0; device < 32; device++) { if (PCIDevice.GetVendorID(xBus, device, 0x0) == 0xFFFF) { continue; } CheckFunction(new PCIDevice(xBus, device, 0x0)); if ((PCIDevice.GetHeaderType(xBus, device, 0x0) & 0x80) != 0) { for (ushort fn = 1; fn < 8; fn++) { if (PCIDevice.GetVendorID(xBus, device, fn) != 0xFFFF) { CheckFunction(new PCIDevice(xBus, device, fn)); } } } } }