#ifndef PCI_H_ #define PCI_H_ #include #include #define PCI_ADDR(addr, bus, device, func) (addr + ((bus) << 20 | device << 15 | func << 12)) enum PCI_CLASS { UNCLASSIFIED, MASS_STORAGE_CONTROLLER, NETWORK_CONTROLLER, DISPLAY_CONTROLLER, MULTIMEDIA_CONTROLLER, MEMORY_CONTROLLER, BRIDGE, COMMUNICATION_CONTROLLER, GENERIC_SYSTEM_PERIPHERAL, INPUT_DEVICE_CONTROLLER, DOCKING_STATION, PROCESSOR, SERIAL_BUS_CONTROLLER, WIRELESS_CONTROLLER, INTELLIGENT_CONTROLLER, SATELLITE_COMMUNICATIONS_CONTROLLER, ENCRYPTION_CONTROLLER, SIGNAL_PROCESSING_CONTROLLER, PROCESSING_ACCELERATORS, }; enum PCI_STORAGE_SUBCLASS { SCSI_STORAGE_CONTROLLER, IDE_INTERFACE, FLOPPY_DISK_CONTROLLER, IPI_BUS_CONTROLLER, RAID_BUS_CONTROLLER, ATA_CONTROLLER, SATA_CONTROLLER, }; struct pci_config_space { uint16_t vendor_id; uint16_t device_id; uint16_t command; uint16_t status; uint8_t revision_id; uint8_t program_interface; uint8_t subclass; uint8_t class; }; // TODO: Bruteforce all devices once then store all valid devices in memory rather than bruteforcing every time to search // TODO: Returning multiple devices struct pci_config_space *pcie_find_device(struct mcfg *mcfg, uint8_t class, uint8_t subclass); #endif