Beispiel #1
0
        private static void EnumerateBus(uint bus, uint step)
        {
            for (uint device = 0; device < 32; device++)
            {
                PCIDevice zeroFuncDevice = new PCIDevice(bus, device, 0x00);
                if (zeroFuncDevice.DeviceExists)
                {
                    uint max = ((uint)zeroFuncDevice.HeaderType & 0x80) != 0 ? 8u : 1u;

                    for (uint function = 0; function < max; function++)
                    {
                        PCIDevice pciDevice = new PCIDevice(bus, device, function);
                        if (pciDevice.DeviceExists)
                        {
                            if (pciDevice.HeaderType == PCIDevice.PCIHeaderType.Bridge)
                            {
                                AddDevice(new PCIDeviceBridge(bus, device, function), step);
                            }
                            else if (pciDevice.HeaderType == PCIDevice.PCIHeaderType.Cardbus)
                            {
                                AddDevice(new PCIDeviceCardbus(bus, device, function), step);
                            }
                            else
                            {
                                AddDevice(new PCIDeviceNormal(bus, device, function), step);
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private static void EnumerateBus(uint bus, uint step)
        {
            for (uint device = 0; device < 32; device++)
            {
                PCIDevice zeroFuncDevice = new PCIDevice(bus, device, 0x00);
                if (zeroFuncDevice.DeviceExists)
                {
                    uint max = ((uint)zeroFuncDevice.HeaderType & 0x80) != 0 ? 8u : 1u;

                    for (uint function = 0; function < max; function++)
                    {
                        PCIDevice pciDevice = new PCIDevice(bus, device, function);
                        if (pciDevice.DeviceExists)
                        {
                            if (pciDevice.HeaderType == PCIDevice.PCIHeaderType.Bridge)
                            {
                                AddDevice(new PCIDeviceBridge(bus, device, function), step);
                            }
                            else if (pciDevice.HeaderType == PCIDevice.PCIHeaderType.Cardbus)
                            {
                                AddDevice(new PCIDeviceCardbus(bus, device, function), step);
                            }
                            else
                            {
                                AddDevice(new PCIDeviceNormal(bus, device, function), step);
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        private static void AddDevice(PCIDevice device, uint step)
        {
            Devices.Add(device);
            DeviceManager.AddDevice(device);

            if (device is PCIDeviceBridge)
            {
#if PCI_TRACE
                BasicConsole.WriteLine("Enumerating PCI Bridge Device...");
                BasicConsole.DelayOutput(5);
#endif

                EnumerateBus(((PCIDeviceBridge)device).SecondaryBusNumber, step + 1);
            }
        }
Beispiel #4
0
            /// <summary>
            /// Gets a string that represents the specified PCI device.
            /// </summary>
            /// <param name="device">The device to get a string for.</param>
            /// <returns>The string.</returns>
            public static FOS_System.String GetString(PCIDevice device)
            {
                switch (device.VendorID)
                {
                    case 0x1022://AMD
                        switch (device.DeviceID)
                        {
                            case 0x2000:
                                return "AMD PCnet LANCE PCI Ethernet Controller";
                        }
                        break;
                    case 0x104B://Sony
                        switch (device.DeviceID)
                        {
                            case 0x1040:
                                return "Mylex BT958 SCSI Host Adaptor";
                        }
                        break;
                    case 0x1274://Ensoniq
                        switch (device.DeviceID)
                        {
                            case 0x1371:
                                return "Ensoniq AudioPCI";
                        }
                        break;
                    case 0x15AD://VMware
                        switch (device.DeviceID)
                        {
                            case 0x0405:
                                return "VMware NVIDIA 9500MGS";
                            case 0x0770:
                                return "VMware Standard Enhanced PCI to USB Host Controller";
                            case 0x0790:
                                return "VMware 6.0 Virtual USB 2.0 Host Controller";
                            case 0x07A0:
                                return "VMware PCI Express Root Port";
                        }
                        break;
                    case 0x8086://Intel
                        switch (device.DeviceID)
                        {
                            case 0x7190:
                                return "Intel 440BX/ZX AGPset Host Bridge";
                            case 0x7191:
                                return "Intel 440BX/ZX AGPset PCI-to-PCI bridge";
                            case 0x7110:
                                return "Intel PIIX4/4E/4M ISA Bridge";
                            case 0x7112:
                                return "Intel PIIX4/4E/4M USB Interface";
                        }
                        break;
                }

                switch (device.ClassCode)
                {
                    case 0x00:
                        if (device.Subclass == 0x01)
                        {
                            return "VGA-Compatible unclassified device";
                        }
                        return "Non-VGA unclassified device";
                    case 0x01:
                        #region Mass Storage Controllers
                        if (device.Subclass == 0x00)
                        {
                            return "Mass Storage Controller (SCSI)";
                        }
                        else if (device.Subclass == 0x01)
                        {
                            return "Mass Storage Controller (IDE)";
                        }
                        else if (device.Subclass == 0x02)
                        {
                            return "Mass Storage Controller (Floppy)";
                        }
                        else if (device.Subclass == 0x03)
                        {
                            return "Mass Storage Controller (IPI)";
                        }
                        else if (device.Subclass == 0x04)
                        {
                            return "Mass Storage Controller (RAID)";
                        }
                        else if (device.Subclass == 0x05)
                        {
                            return "Mass Storage Controller (ATA)";
                        }
                        else if (device.Subclass == 0x06)
                        {
                            return "Mass Storage Controller (SATA)";
                        }
                        else if (device.Subclass == 0x07)
                        {
                            return "Mass Storage Controller (Serial Attached SCSI)";
                        }
                        else if (device.Subclass == 0x08)
                        {
                            return "Mass Storage Controller (Non-volatile memory)";
                        }
                        else if (device.Subclass == 0x80)
                        {
                            return "Mass Storage Controller (Other)";
                        }
                        else
                        {
                            return "Mass Storage Controller (Unrecognised)";
                        }
                        #endregion
                    case 0x02:
                        return "Network Controller";
                    case 0x03:
                        return "Display Controller";
                    case 0x04:
                        return "Multimedia Controller";
                    case 0x05:
                        return "Memory Controller";
                    case 0x06:
                        return "Bridge Device";
                    case 0x07:
                        return "Simple Communication Controller";
                    case 0x08:
                        return "Base System Peripheral";
                    case 0x09:
                        return "Input Device";
                    case 0x0A:
                        return "Docking Station";
                    case 0x0B:
                        return "Processor";
                    case 0x0C:
                        #region Serial Bus Controllers
                        if (device.Subclass == 0x00)
                        {
                            return "FireWire (IEEE 1394) Controller";
                        }
                        else if (device.Subclass == 0x02)
                        {
                            return "ACCESS Bus";
                        }
                        else if (device.Subclass == 0x03)
                        {
                            switch (device.ProgIF)
                            {
                                case 0x00:
                                    return "USB Universal Host Controller Interface";
                                case 0x10:
                                    return "USB Open Host Controller Interface";
                                case 0x20:
                                    return "USB Extended Host Controller Interface";
                                case 0x80:
                                    return "USB (Unknown)";
                                case 0xFE:
                                    return "USB (Not host controller)";
                            }
                        }
                        else if (device.Subclass == 0x04)
                        {
                            return "Fibre Channel";
                        }
                        else if (device.Subclass == 0x05)
                        {
                            return "SMBus";
                        }
                        else if (device.Subclass == 0x06)
                        {
                            return "InfiniBand";
                        }
                        else if (device.Subclass == 0x07)
                        {
                            return "IPMI SMIC interface";
                        }
                        else if (device.Subclass == 0x08)
                        {
                            return "SERCOS interface";
                        }
                        else if (device.Subclass == 0x03)
                        {
                            return "CANBUS";
                        }
                        return "Serial Bus Controller";
                        #endregion
                    case 0x0D:
                        return "Wireless Controller";
                    case 0x0E:
                        return "Intelligent I/O Controller";
                    case 0x0F:
                        return "Satellite Communication Controller";
                    case 0x10:
                        return "Encryption/Decryption Controller";
                    case 0x11:
                        return "Data Acquisition and Signal Processing Controller";
                    //case 0xFF:
                    //    return "Unknown device (Spec unspecified)";
                    //default:
                    //    return "Unknown device (Unrecognised)";
                }
                FOS_System.String result = "ClassCode: ";
                result = result + device.ClassCode + "     Subclass: " + device.Subclass + "     ProgIF: " + device.ProgIF;
                return result;
            }
Beispiel #5
0
        private static void AddDevice(PCIDevice device, uint step)
        {
            Devices.Add(device);
            DeviceManager.AddDevice(device);

            if (device is PCIDeviceBridge)
            {
#if PCI_TRACE
                BasicConsole.WriteLine("Enumerating PCI Bridge Device...");
                BasicConsole.DelayOutput(5);
#endif
                 
                EnumerateBus(((PCIDeviceBridge)device).SecondaryBusNumber, step + 1);
            }
        }
Beispiel #6
0
            /// <summary>
            /// Gets a string that represents the specified PCI device.
            /// </summary>
            /// <param name="device">The device to get a string for.</param>
            /// <returns>The string.</returns>
            public static FOS_System.String GetString(PCIDevice device)
            {
                switch (device.VendorID)
                {
                case 0x1022:    //AMD
                    switch (device.DeviceID)
                    {
                    case 0x2000:
                        return("AMD PCnet LANCE PCI Ethernet Controller");
                    }
                    break;

                case 0x104B:    //Sony
                    switch (device.DeviceID)
                    {
                    case 0x1040:
                        return("Mylex BT958 SCSI Host Adaptor");
                    }
                    break;

                case 0x1274:    //Ensoniq
                    switch (device.DeviceID)
                    {
                    case 0x1371:
                        return("Ensoniq AudioPCI");
                    }
                    break;

                case 0x15AD:    //VMware
                    switch (device.DeviceID)
                    {
                    case 0x0405:
                        return("VMware NVIDIA 9500MGS");

                    case 0x0770:
                        return("VMware Standard Enhanced PCI to USB Host Controller");

                    case 0x0790:
                        return("VMware 6.0 Virtual USB 2.0 Host Controller");

                    case 0x07A0:
                        return("VMware PCI Express Root Port");
                    }
                    break;

                case 0x8086:    //Intel
                    switch (device.DeviceID)
                    {
                    case 0x7190:
                        return("Intel 440BX/ZX AGPset Host Bridge");

                    case 0x7191:
                        return("Intel 440BX/ZX AGPset PCI-to-PCI bridge");

                    case 0x7110:
                        return("Intel PIIX4/4E/4M ISA Bridge");

                    case 0x7112:
                        return("Intel PIIX4/4E/4M USB Interface");
                    }
                    break;
                }

                switch (device.ClassCode)
                {
                case 0x00:
                    if (device.Subclass == 0x01)
                    {
                        return("VGA-Compatible unclassified device");
                    }
                    return("Non-VGA unclassified device");

                case 0x01:
                    #region Mass Storage Controllers
                    if (device.Subclass == 0x00)
                    {
                        return("Mass Storage Controller (SCSI)");
                    }
                    else if (device.Subclass == 0x01)
                    {
                        return("Mass Storage Controller (IDE)");
                    }
                    else if (device.Subclass == 0x02)
                    {
                        return("Mass Storage Controller (Floppy)");
                    }
                    else if (device.Subclass == 0x03)
                    {
                        return("Mass Storage Controller (IPI)");
                    }
                    else if (device.Subclass == 0x04)
                    {
                        return("Mass Storage Controller (RAID)");
                    }
                    else if (device.Subclass == 0x05)
                    {
                        return("Mass Storage Controller (ATA)");
                    }
                    else if (device.Subclass == 0x06)
                    {
                        return("Mass Storage Controller (SATA)");
                    }
                    else if (device.Subclass == 0x07)
                    {
                        return("Mass Storage Controller (Serial Attached SCSI)");
                    }
                    else if (device.Subclass == 0x08)
                    {
                        return("Mass Storage Controller (Non-volatile memory)");
                    }
                    else if (device.Subclass == 0x80)
                    {
                        return("Mass Storage Controller (Other)");
                    }
                    else
                    {
                        return("Mass Storage Controller (Unrecognised)");
                    }

                    #endregion
                case 0x02:
                    return("Network Controller");

                case 0x03:
                    return("Display Controller");

                case 0x04:
                    return("Multimedia Controller");

                case 0x05:
                    return("Memory Controller");

                case 0x06:
                    return("Bridge Device");

                case 0x07:
                    return("Simple Communication Controller");

                case 0x08:
                    return("Base System Peripheral");

                case 0x09:
                    return("Input Device");

                case 0x0A:
                    return("Docking Station");

                case 0x0B:
                    return("Processor");

                case 0x0C:
                    #region Serial Bus Controllers
                    if (device.Subclass == 0x00)
                    {
                        return("FireWire (IEEE 1394) Controller");
                    }
                    else if (device.Subclass == 0x02)
                    {
                        return("ACCESS Bus");
                    }
                    else if (device.Subclass == 0x03)
                    {
                        switch (device.ProgIF)
                        {
                        case 0x00:
                            return("USB Universal Host Controller Interface");

                        case 0x10:
                            return("USB Open Host Controller Interface");

                        case 0x20:
                            return("USB Extended Host Controller Interface");

                        case 0x80:
                            return("USB (Unknown)");

                        case 0xFE:
                            return("USB (Not host controller)");
                        }
                    }
                    else if (device.Subclass == 0x04)
                    {
                        return("Fibre Channel");
                    }
                    else if (device.Subclass == 0x05)
                    {
                        return("SMBus");
                    }
                    else if (device.Subclass == 0x06)
                    {
                        return("InfiniBand");
                    }
                    else if (device.Subclass == 0x07)
                    {
                        return("IPMI SMIC interface");
                    }
                    else if (device.Subclass == 0x08)
                    {
                        return("SERCOS interface");
                    }
                    else if (device.Subclass == 0x03)
                    {
                        return("CANBUS");
                    }
                    return("Serial Bus Controller");

                    #endregion
                case 0x0D:
                    return("Wireless Controller");

                case 0x0E:
                    return("Intelligent I/O Controller");

                case 0x0F:
                    return("Satellite Communication Controller");

                case 0x10:
                    return("Encryption/Decryption Controller");

                case 0x11:
                    return("Data Acquisition and Signal Processing Controller");
                    //case 0xFF:
                    //    return "Unknown device (Spec unspecified)";
                    //default:
                    //    return "Unknown device (Unrecognised)";
                }
                FOS_System.String result = "ClassCode: ";
                result = result + device.ClassCode + "     Subclass: " + device.Subclass + "     ProgIF: " + device.ProgIF;
                return(result);
            }