feat: fixed some bugs for running on real hardware
This commit is contained in:
@@ -32,6 +32,8 @@ const pci_driver *pci_drivers[MAX_PCI_DRIVERS];
|
||||
int last_pci_device_index = 0;
|
||||
pci_device pci_devices[MAX_PCI_DEVICES];
|
||||
|
||||
void pci_check_bus(uint8_t bus);
|
||||
|
||||
uint32_t pci_register_driver(const pci_driver *pci_driver) {
|
||||
for (int i = 0; i < MAX_PCI_DRIVERS; ++i) {
|
||||
if (pci_drivers[i] != NULL) {
|
||||
@@ -137,9 +139,16 @@ void pci_check_function(uint8_t bus, uint8_t slot, uint8_t func) {
|
||||
pci_devices[last_pci_device_index].config_line_2 = pci_config_read_double_word(bus, slot, func, PCI_CONFIG_LINE_2);
|
||||
pci_devices[last_pci_device_index].config_line_3 = pci_config_read_double_word(bus, slot, func, PCI_CONFIG_LINE_3);
|
||||
pci_devices[last_pci_device_index].device_state.present = 1;
|
||||
pci_pick_driver(&pci_devices[last_pci_device_index]);
|
||||
last_pci_device_index++;
|
||||
|
||||
if (pci_devices[last_pci_device_index-1].class == 0x06 && pci_devices[last_pci_device_index-1].subclass == 0x04) {
|
||||
uint8_t secondary_bus = pci_config_read_byte(bus, slot, func, PCI_CONFIG_SECONDARY_BUS_NUMBER);
|
||||
printf("Found secondary bus: %d\n", secondary_bus);
|
||||
pci_check_bus(secondary_bus);
|
||||
} else {
|
||||
pci_pick_driver(&pci_devices[last_pci_device_index-1]);
|
||||
}
|
||||
|
||||
// todo do something with the function
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user