From f8b70e4469d18e39b1bc5f9e4534c02baaaac779 Mon Sep 17 00:00:00 2001 From: Eric-Paul Ickhorn Date: Tue, 25 Apr 2023 22:28:10 +0200 Subject: [PATCH] feature (PCI): Added rest of subclass stringify data --- inc/drivers/pci.h | 4 +- src/drivers/pci.c | 220 ++++++++++++++++++++++++++++++++-------------- 2 files changed, 154 insertions(+), 70 deletions(-) diff --git a/inc/drivers/pci.h b/inc/drivers/pci.h index 5231c2d..23052f6 100644 --- a/inc/drivers/pci.h +++ b/inc/drivers/pci.h @@ -155,7 +155,7 @@ typedef enum { PCI_SUBCLASS_INFINIBAND_SERIAL_BUS_CONTROLLER = 0x06, PCI_SUBCLASS_IPMI_INTERFACE = 0x07, PCI_SUBCLASS_SERCOS_INTERFACE = 0x08, - PCI_SUBCLASS_CANBUS_CONTROOLLER = 0x09, + PCI_SUBCLASS_CANBUS_CONTROLLER = 0x09, PCI_SUBCLASS_OTHER_SERIAL_BUS_CONTROLLER = 0x80 } pci_serial_bus_controller_subclasses_E; @@ -189,7 +189,7 @@ typedef enum { typedef enum { PCI_SUBCLASS_DPIO_MODULES = 0x00, - PCI_SUBCLASS_PERFORMANCE_COUTNERS = 0x01, + PCI_SUBCLASS_PERFORMANCE_COUNTERS = 0x01, PCI_SUBCLASS_COMMUNICATION_SYNCHRONIZER = 0x10, PCI_SUBCLASS_SIGNAL_PROCESSING_MANAGEMENT = 0x20, PCI_SUBCLASS_OTHER_SIGNAL_PROCESSING_CONTROLLER = 0x80 diff --git a/src/drivers/pci.c b/src/drivers/pci.c index 80b0a42..7f86372 100644 --- a/src/drivers/pci.c +++ b/src/drivers/pci.c @@ -10,134 +10,218 @@ string_t pci_get_subclass_string(pci_class_E class, uint8_t subclass) { switch (class) { case PCI_CLASS_UNCLASSIFIED: { switch (subclass) { - case PCI_SUBCLASS_NON_VGA_COMPATIBLE_UNCLASSIFIED_DEVICE: return "Non-VGA-Compatible Unclassified Device"; - case PCI_SUBCLASS_VGA_COMPATIBLE_UNCLASSIFIED_DEVICE: return "VGA-Compatible Unclassified Device"; + case PCI_SUBCLASS_NON_VGA_COMPATIBLE_UNCLASSIFIED_DEVICE: return "Non-VGA-Compatible Unclassified Device"; + case PCI_SUBCLASS_VGA_COMPATIBLE_UNCLASSIFIED_DEVICE: return "VGA-Compatible Unclassified Device"; default: break; } break; } case PCI_CLASS_MASS_STORAGE_CONTROLLER: { switch (subclass) { - case PCI_SUBCLASS_SCSI_BUS_CONTROLLER: return "SCSI Bus Controller"; - case PCI_SUBCLASS_IDE_CONTROLLER: return "IDE Controller"; - case PCI_SUBCLASS_FLOPPY_DISK_CONTROLLER: return "Floppy Disk Controller"; - case PCI_SUBCLASS_IPI_BUS_CONTROLLER: return "IPI Bus Controller"; - case PCI_SUBCLASS_RAID_CONTROLLER: return "RAID Controller"; - case PCI_SUBCLASS_ATA_CONTROLLER: return "ATA Controller"; - case PCI_SUBCLASS_SERIAL_ATA_CONTROLLER: return "SATA Controller"; - case PCI_SUBCLASS_SERIAL_ATTACHED_SCSI_CONTROLLER: return "Serial Attached SCSI Controller"; - case PCI_SUBCLASS_NON_VOLATILE_MEMORY_CONTROLLER: return "Non-Volatile Memory Controller"; - case PCI_SUBCLASS_OTHER_MASS_STORAGE_CONTROLLER: return "Other Mass storage Controller"; + case PCI_SUBCLASS_SCSI_BUS_CONTROLLER: return "SCSI Bus Controller"; + case PCI_SUBCLASS_IDE_CONTROLLER: return "IDE Controller"; + case PCI_SUBCLASS_FLOPPY_DISK_CONTROLLER: return "Floppy Disk Controller"; + case PCI_SUBCLASS_IPI_BUS_CONTROLLER: return "IPI Bus Controller"; + case PCI_SUBCLASS_RAID_CONTROLLER: return "RAID Controller"; + case PCI_SUBCLASS_ATA_CONTROLLER: return "ATA Controller"; + case PCI_SUBCLASS_SERIAL_ATA_CONTROLLER: return "SATA Controller"; + case PCI_SUBCLASS_SERIAL_ATTACHED_SCSI_CONTROLLER: return "Serial Attached SCSI Controller"; + case PCI_SUBCLASS_NON_VOLATILE_MEMORY_CONTROLLER: return "Non-Volatile Memory Controller"; + case PCI_SUBCLASS_OTHER_MASS_STORAGE_CONTROLLER: return "Other Mass storage Controller"; default: break; } break; } case PCI_CLASS_NETWORK_CONTROLLER: { switch (subclass) { - case PCI_SUBCLASS_ETHERNET_CONTROLLER: return "Ethernet Controller"; - case PCI_SUBCLASS_TOKEN_RING_CONTROLLER: return "Token Ring Controller"; - case PCI_SUBCLASS_FDDI_CONTROLLER: return "FDDI Controller"; - case PCI_SUBCLASS_ATM_CONTROLLER: return "ATM Controller"; - case PCI_SUBCLASS_ISDN_CONTROLLER: return "ISDN Controller"; - case PCI_SUBCLASS_WORLDFIP_CONTROLLER: return "WorldFip Controller"; - case PCI_SUBCLASS_PICMG_2_14_MULTI_COMPUTING_CONTROLLER: return "PICMG 2.14 Multi Computing Controller"; - case PCI_SUBCLASS_INFINIBAND_NETWORKCONTROLLER: return "Infiniband Controller"; - case PCI_SUBCLASS_FABRIC_CONTROLLER: return "Fabric Controller"; - case PCI_SUBCLASS_OTHER_NETWORK_CONTROLLER: return "Other Network Controller"; + case PCI_SUBCLASS_ETHERNET_CONTROLLER: return "Ethernet Controller"; + case PCI_SUBCLASS_TOKEN_RING_CONTROLLER: return "Token Ring Controller"; + case PCI_SUBCLASS_FDDI_CONTROLLER: return "FDDI Controller"; + case PCI_SUBCLASS_ATM_CONTROLLER: return "ATM Controller"; + case PCI_SUBCLASS_ISDN_CONTROLLER: return "ISDN Controller"; + case PCI_SUBCLASS_WORLDFIP_CONTROLLER: return "WorldFip Controller"; + case PCI_SUBCLASS_PICMG_2_14_MULTI_COMPUTING_CONTROLLER: return "PICMG 2.14 Multi Computing Controller"; + case PCI_SUBCLASS_INFINIBAND_NETWORKCONTROLLER: return "Infiniband Controller"; + case PCI_SUBCLASS_FABRIC_CONTROLLER: return "Fabric Controller"; + case PCI_SUBCLASS_OTHER_NETWORK_CONTROLLER: return "Other Network Controller"; default: break; } break; } case PCI_CLASS_DISPLAY_CONTROLLER: { switch (subclass) { - case PCI_SUBCLASS_VGA_COMPATIBLE_CONTROLLER: return "VGA Compatible Controller"; - case PCI_SUBCLASS_XGA_COMPATIBLE_CONTROLLER: return "XGA Controller"; - case PCI_SUBCLASS_3D_CONTROLLER_NOT_VGA_COMPATIBLE: return "3D Controller (Not VGA-Compatible)"; - case PCI_SUBCLASS_OTHER_DISPLAY_CONTROLLER: return "Other Display Controller"; + case PCI_SUBCLASS_VGA_COMPATIBLE_CONTROLLER: return "VGA Compatible Controller"; + case PCI_SUBCLASS_XGA_COMPATIBLE_CONTROLLER: return "XGA Controller"; + case PCI_SUBCLASS_3D_CONTROLLER_NOT_VGA_COMPATIBLE: return "3D Controller (Not VGA-Compatible)"; + case PCI_SUBCLASS_OTHER_DISPLAY_CONTROLLER: return "Other Display Controller"; default: break; } break; } case PCI_CLASS_MULTIMEDIA_CONTROLLER: { switch (subclass) { - case PCI_SUBCLASS_MULTIMEDIA_VIDEO_CONTROLLER: return "Multimedia Video Controller"; - case PCI_SUBCLASS_MULTIMEDIA_AUDIO_CONTROLLER: return "Multimedia Audio Controller"; - case PCI_SUBCLASS_COMPUTER_TELEPHONY_DEVICE: return "Computer Telephony Device"; - case PCI_SUBCLASS_AUDIO_DEVICE: return "Audio Device"; - case PCI_SUBCLASS_OTHER_MULTIMEDIA_CONTROLLER: return "Other Multimedia Controller"; + case PCI_SUBCLASS_MULTIMEDIA_VIDEO_CONTROLLER: return "Multimedia Video Controller"; + case PCI_SUBCLASS_MULTIMEDIA_AUDIO_CONTROLLER: return "Multimedia Audio Controller"; + case PCI_SUBCLASS_COMPUTER_TELEPHONY_DEVICE: return "Computer Telephony Device"; + case PCI_SUBCLASS_AUDIO_DEVICE: return "Audio Device"; + case PCI_SUBCLASS_OTHER_MULTIMEDIA_CONTROLLER: return "Other Multimedia Controller"; default: break; } break; } case PCI_CLASS_MEMORY_CONTROLLER: { switch (subclass) { - case PCI_SUBCLASS_RAM_CONTROLLER: return "RAM Controller"; - case PCI_SUBCLASS_FLASH_CONTROLLER: return "Flash Controller"; - case PCI_SUBCLASS_OTHER_MEMORY_CONTROLLER: return "Other Memory Controller"; + case PCI_SUBCLASS_RAM_CONTROLLER: return "RAM Controller"; + case PCI_SUBCLASS_FLASH_CONTROLLER: return "Flash Controller"; + case PCI_SUBCLASS_OTHER_MEMORY_CONTROLLER: return "Other Memory Controller"; default: break; } break; } case PCI_CLASS_BRIDGE: { switch (subclass) { - case PCI_SUBCLASS_HOST_BRIDGE: return "Host Bridge"; - case PCI_SUBCLASS_ISA_BRIDGE: return "ISA Bridge"; - case PCI_SUBCLASS_EISA_BRIDGE: return "EISA Bridge"; - case PCI_SUBCLASS_MCA_BRIDGE: return "MCA Bridge"; - case PCI_SUBCLASS_PCI_TO_PCI_BRIDGE: return "PCI-to-PCI Bridge"; - case PCI_SUBCLASS_PCMCIA_BRIDGE: return "PCMCIA Bridge"; - case PCI_SUBCLASS_NUBUS_BRIDGE: return "NuBus Bridge"; - case PCI_SUBCLASS_CARDBUS_BRIDGE: return "CardBus Bridge"; - case PCI_SUBCLASS_RACEWAY_BRIDGE: return "RACEway Bridge"; - case PCI_SUBCLASS_PCI_TO_PCI_BRIDGE_2: return "PCI-to-PCI Bridge"; - case PCI_SUBCLASS_INFINIBAND_TO_PCI_HOST_BRIDGE: return "InfiniBand-to-PCI Host Bridge"; - case PCI_SUBCLASS_OTHER_BRIDGE: return "Other Bridge"; + case PCI_SUBCLASS_HOST_BRIDGE: return "Host Bridge"; + case PCI_SUBCLASS_ISA_BRIDGE: return "ISA Bridge"; + case PCI_SUBCLASS_EISA_BRIDGE: return "EISA Bridge"; + case PCI_SUBCLASS_MCA_BRIDGE: return "MCA Bridge"; + case PCI_SUBCLASS_PCI_TO_PCI_BRIDGE: return "PCI-to-PCI Bridge"; + case PCI_SUBCLASS_PCMCIA_BRIDGE: return "PCMCIA Bridge"; + case PCI_SUBCLASS_NUBUS_BRIDGE: return "NuBus Bridge"; + case PCI_SUBCLASS_CARDBUS_BRIDGE: return "CardBus Bridge"; + case PCI_SUBCLASS_RACEWAY_BRIDGE: return "RACEway Bridge"; + case PCI_SUBCLASS_PCI_TO_PCI_BRIDGE_2: return "PCI-to-PCI Bridge"; + case PCI_SUBCLASS_INFINIBAND_TO_PCI_HOST_BRIDGE: return "InfiniBand-to-PCI Host Bridge"; + case PCI_SUBCLASS_OTHER_BRIDGE: return "Other Bridge"; default: break; } break; } case PCI_CLASS_SIMPLE_COMMUNICATION_CONTROLLER: { switch (subclass) { - case PCI_SUBCLASS_SERIAL_SIMPLE_COMMUNICATION_CONTROLLER: return "Serial Controller"; - case PCI_SUBCLASS_PARALLEL_SIMPLE_COMMUNICATION_CONTROLLER: return "Parallel Controller"; - case PCI_SUBCLASS_MULTIPORT_SERIAL_CONTROLLER: return "Multiport Serial Controller"; - case PCI_SUBCLASS_MODEM: return "Modem"; - case PCI_SUBCLASS_IEEE_488_1_2_GPIB_CONTROLLER: return "IEEE 488.1/2 (GPIB) Controller"; - case PCI_SUBCLASS_SMART_CARD_CONTROLLER: return "Smart Card Controller"; - case PCI_SUBCLASS_OTHER_SIMPLE_COMMUNICATION_CONTROLLER: return "Other Simple Communication Controller"; + case PCI_SUBCLASS_SERIAL_SIMPLE_COMMUNICATION_CONTROLLER: return "Serial Controller"; + case PCI_SUBCLASS_PARALLEL_SIMPLE_COMMUNICATION_CONTROLLER: return "Parallel Controller"; + case PCI_SUBCLASS_MULTIPORT_SERIAL_CONTROLLER: return "Multiport Serial Controller"; + case PCI_SUBCLASS_MODEM: return "Modem"; + case PCI_SUBCLASS_IEEE_488_1_2_GPIB_CONTROLLER: return "IEEE 488.1/2 (GPIB) Controller"; + case PCI_SUBCLASS_SMART_CARD_CONTROLLER: return "Smart Card Controller"; + case PCI_SUBCLASS_OTHER_SIMPLE_COMMUNICATION_CONTROLLER: return "Other Simple Communication Controller"; default: break; } break; } case PCI_CLASS_BASE_SYSTEM_PERIPHERAL: { switch (subclass) { - case PCI_SUBCLASS_PIC: return "PIC"; - case PCI_SUBCLASS_DMA_CONTROLLER: return "DMA Controller"; - case PCI_SUBCLASS_TIMER: return "Timer"; - case PCI_SUBCLASS_RTC_CONTROLLER: return "RTC Controller"; - case PCI_SUBCLASS_PCI_HOT_PLUG_CONTROLLER: return "PCI Hot-Plug Controller"; - case PCI_SUBCLASS_SD_HOST_CONTROLLER: return "SD Host Controller"; - case PCI_SUBCLASS_IOMMU: return "IOMMU"; - case PCI_SUBCLASS_OTHER_BASE_SYSTEM_PERIPHERAL: return "Other Base System Peripheral"; + case PCI_SUBCLASS_PIC: return "PIC"; + case PCI_SUBCLASS_DMA_CONTROLLER: return "DMA Controller"; + case PCI_SUBCLASS_TIMER: return "Timer"; + case PCI_SUBCLASS_RTC_CONTROLLER: return "RTC Controller"; + case PCI_SUBCLASS_PCI_HOT_PLUG_CONTROLLER: return "PCI Hot-Plug Controller"; + case PCI_SUBCLASS_SD_HOST_CONTROLLER: return "SD Host Controller"; + case PCI_SUBCLASS_IOMMU: return "IOMMU"; + case PCI_SUBCLASS_OTHER_BASE_SYSTEM_PERIPHERAL: return "Other Base System Peripheral"; default: break; } break; } case PCI_CLASS_INPUT_DEVICE_CONTROLLER: { switch (subclass) { - case PCI_SUBCLASS_KEYBOARD_CONTROLLER: return "Keyboard Controller"; - case PCI_SUBCLASS_DIGITIZER_PEN: return "Digitizer Pen"; - case PCI_SUBCLASS_MOUSE_CONTROLLER: return "Mouse Controller"; - case PCI_SUBCLASS_SCANNER_CONTROLLER: return "Scanner Controller"; - case PCI_SUBCLASS_GAMEPORT_CONTROLLER: return "Gameport Controller"; - case PCI_SUBCLASS_OTHER_INPUT_DEVICE_CONTROLLER: return "Other Input Device Controller"; + case PCI_SUBCLASS_KEYBOARD_CONTROLLER: return "Keyboard Controller"; + case PCI_SUBCLASS_DIGITIZER_PEN: return "Digitizer Pen"; + case PCI_SUBCLASS_MOUSE_CONTROLLER: return "Mouse Controller"; + case PCI_SUBCLASS_SCANNER_CONTROLLER: return "Scanner Controller"; + case PCI_SUBCLASS_GAMEPORT_CONTROLLER: return "Gameport Controller"; + case PCI_SUBCLASS_OTHER_INPUT_DEVICE_CONTROLLER: return "Other Input Device Controller"; default: break; } break; } case PCI_CLASS_DOCKING_STATION: { switch (subclass) { - + case PCI_SUBCLASS_GENERIC_DOCKING_STATION: return "Generic Docking Station"; + case PCI_SUBCLASS_OTHER_DOCKING_STATION: return "Other Docking Station"; + default: break; + } + break; + } + case PCI_CLASS_PROCESSOR: { + switch (subclass) { + case PCI_SUBCLASS_386_PROCESSOR: return "386 Processor"; + case PCI_SUBCLASS_486_PROCESSOR: return "486 Processor"; + case PCI_SUBCLASS_PENTIUM_PROCESSOR: return "Pentium Processor"; + case PCI_SUBCLASS_PENTIUM_PRO_PROCESSOR: return "Pentium Pro Processor"; + case PCI_SUBCLASS_ALPHA_PROCESSOR: return "Alpha Processor"; + case PCI_SUBCLASS_POWERPC_PROCESSOR: return "PowerPC Processor"; + case PCI_SUBCLASS_MIPS_PROCESSOR: return "MIPS Processor"; + case PCI_SUBCLASS_COPROCESSOR: return "Co-Processor"; + case PCI_SUBCLASS_OTHER_PROCESSOR: return "Other Processor"; + default: break; + } + break; + } + case PCI_CLASS_SERIAL_BUS_CONTROLLER: { + switch (subclass) { + case PCI_SUBCLASS_FIREWIRE_CONTROLLER: return "FireWire Controller"; + case PCI_SUBCLASS_ACCESS_BUS_CONTROLLER: return "Access Bus Controller"; + case PCI_SUBCLASS_SSA: return "SSA"; + case PCI_SUBCLASS_USB_CONTROLLER: return "USB Controller"; + case PCI_SUBCLASS_FIBRE_CHANNEL: return "Fibre Channel"; + case PCI_SUBCLASS_SMBUS_CONTROLLER: return "SMBus Controller"; + case PCI_SUBCLASS_INFINIBAND_SERIAL_BUS_CONTROLLER: return "InfiniBand Serial Bus Controller"; + case PCI_SUBCLASS_IPMI_INTERFACE: return "IPMI Interface"; + case PCI_SUBCLASS_SERCOS_INTERFACE: return "SERCOS Interface"; + case PCI_SUBCLASS_CANBUS_CONTROLLER: return "CANBUS Controller"; + case PCI_SUBCLASS_OTHER_SERIAL_BUS_CONTROLLER: return "Other Serial Bus Controller"; + default: break; + } + break; + } + case PCI_CLASS_WIRELESS_CONTROLLER: { + switch (subclass) { + case PCI_SUBCLASS_IRDA_COMPATIBLE_CONTROLLER: return "IRDA-compatible Controller"; + case PCI_SUBCLASS_CONSUMER_IR_CONTROLLER: return "Consumer IR Controller"; + case PCI_SUBCLASS_RF_CONTROLLER: return "RF Controller"; + case PCI_SUBCLASS_BLUETOOTH_CONTROLLER: return "Bluetooth Controller"; + case PCI_SUBCLASS_BROADBAND_CONTROLLER: return "Broadband Controller"; + case PCI_SUBCLASS_ETHERNET_CONTROLLER_802_1A: return "Ethernet 802.1a - Controller"; + case PCI_SUBCLASS_ETHERNET_CONTROLLER_802_1B: return "Ethernet 802.1b - Controller"; + case PCI_SUBCLASS_OTHER_WIRELESS_CONTROLLER: return "Other Wireless Controller"; + default: break; + } + break; + } + case PCI_CLASS_INTELLIGENT_CONTROLLER: { + switch (subclass) { + case PCI_SUBCLASS_I20_INTELLIGENT_CONTROLLER: return "I20 Intelligent Controller"; + default: break; + } + break; + } + case PCI_CLASS_SATELLITE_COMMUNICATION_CONTROLLER: { + switch (subclass) { + case PCI_SUBCLASS_SATELLITE_TV_CONTROLLER: return "TV Controller"; + case PCI_SUBCLASS_SATELLITE_AUDIO_CONTROLLER: return "Audio Controller"; + case PCI_SUBCLASS_SATELLITE_VOICE_CONTROLLER: return "Voice Controller"; + case PCI_SUBCLASS_SATELLITE_DATA_CONTROLLER: return "Data Controller"; + default: break; + } + break; + } + case PCI_CLASS_ENCRYPTION_CONTROLLER: { + switch (subclass) { + case PCI_SUBCLASS_NETWORK_AND_COMPUTING_ENCRYPTION_DECRYPTION: return "Network & Computing Encryption Controller"; + case PCI_SUBCLASS_ENTERTAINMENT_ENCRYPTION_DECRYPTION: return "Entertainment Encryption Controller"; + case PCI_SUBCLASS_OTHER_ENCRYPTION_CONTROLLER: return "Other Encryption Controller"; + default: break; + } + break; + } + case PCI_CLASS_SIGNAL_PROCESSING_CONTROLLER: { + switch (subclass) { + case PCI_SUBCLASS_DPIO_MODULES: return "DPIO Modules"; + case PCI_SUBCLASS_PERFORMANCE_COUNTERS: return "Performance Counter"; + case PCI_SUBCLASS_COMMUNICATION_SYNCHRONIZER: return "Communication Synchronizer"; + case PCI_SUBCLASS_SIGNAL_PROCESSING_MANAGEMENT: return "Signal Processing Management"; + case PCI_SUBCLASS_OTHER_SIGNAL_PROCESSING_CONTROLLER: return "Other Signal Processor Controller"; default: break; } break;