fix (drivers): pushing without testing was a bad idea ^^

This commit is contained in:
antifallobst 2023-06-01 13:50:51 +02:00
parent 74aa1a4e4d
commit 78ea65ec75
2 changed files with 18 additions and 8 deletions

View File

@ -97,7 +97,7 @@ void kmain(boot_info_T boot_info) {
void (*drv_test)() = entry;
drv_test();
driver_T* resolved = driver_lookup_pci_device(0x886, 0x2920);
driver_T* resolved = driver_lookup_pci_device(0x8086, 0x2922);
DEBUG("driver: 0x%x", drv);
DEBUG("resolved: 0x%x", resolved);

View File

@ -32,22 +32,22 @@ driver_manager_chunk_T* driver_manager_chunk_alloc(driver_manager_chunk_T* prev)
}
driver_T* driver_find_pci_device(uint16_t vendor_id, uint16_t device_id) {
log(LOG_WARNING, "driver manager -> driver lookup on disk is not implemented yet");
log(LOG_WARNING, "driver manager -> pci driver lookup on disk is not implemented yet");
return NULL;
}
driver_T* driver_find_usb_device(uint16_t vendor_id, uint16_t device_id) {
log(LOG_WARNING, "driver manager -> driver lookup on disk is not implemented yet");
log(LOG_WARNING, "driver manager -> usb driver lookup on disk is not implemented yet");
return NULL;
}
driver_T* driver_find_fs_gpt(uint8_t guid[16]) {
log(LOG_WARNING, "driver manager -> driver lookup on disk is not implemented yet");
log(LOG_WARNING, "driver manager -> gpt driver lookup on disk is not implemented yet");
return NULL;
}
driver_T* driver_find_fs_mbr(uint8_t type) {
log(LOG_WARNING, "driver manager -> driver lookup on disk is not implemented yet");
log(LOG_WARNING, "driver manager -> mbr driver lookup on disk is not implemented yet");
return NULL;
}
@ -58,6 +58,7 @@ void driver_init_pci(driver_T* driver, driver_config_pci_T* conf) {
hashmap_T* level_2 = hashmap_lookup(&g_driver_manager.lookup_table_pci, device_id->vendor_id);
if (level_2 == NULL) {
level_2 = memory_allocate(sizeof(hashmap_T));
*level_2 = hashmap_create(DRIVER_MANAGER_HASHMAP_SIZE);
hashmap_insert(&g_driver_manager.lookup_table_pci, device_id->vendor_id, level_2);
}
@ -130,9 +131,18 @@ void driver_init_fs(driver_T* driver, driver_config_fs_T* conf) {
void driver_init(driver_T* driver, driver_transport_protocol_E protocol, conf_U conf) {
switch (protocol) {
case DRIVER_TRANSPORT_PCI: driver_init_pci(driver, conf.pci);
case DRIVER_TRANSPORT_USB: driver_init_usb(driver, conf.usb);
case DRIVER_TRANSPORT_FS: driver_init_fs (driver, conf.fs);
case DRIVER_TRANSPORT_PCI: {
driver_init_pci(driver, conf.pci);
break;
}
case DRIVER_TRANSPORT_USB: {
driver_init_usb(driver, conf.usb);
break;
}
case DRIVER_TRANSPORT_FS: {
driver_init_fs(driver, conf.fs);
break;
}
}
}