diff --git a/src/kernel/drivers/pci.c b/src/kernel/drivers/pci.c index 01e24a2..9fd1426 100644 --- a/src/kernel/drivers/pci.c +++ b/src/kernel/drivers/pci.c @@ -4,6 +4,7 @@ #include "../system/vfs.h" #include "../shared/string.h" #include "../shared/memory.h" +#include "../drivers/serial.h" #define MODULE_NAME "PCI" char *classes[][20] = { @@ -79,20 +80,21 @@ void pci_make_file(uint32_t class, uint8_t bus, uint8_t slot, uint8_t func){ char cpy[256]; vfile_t *file = 0; uint8_t tries = 0; - while(file == 0){ + // while(file == 0){ itoa(tries++, num, 10); strcpy(str, cpy); strcpy(num, cpy + strlen(cpy)); file = fcreate(cpy, 0); // file->read = pci_read_file; // file->write = pci_write_file; - if(file == 0) break; - file->fileops = &pci_fileops; - if(tries >= 254){ - mlog(MODULE_NAME, "Failed to make PCI file for device!\n", MLOG_PRINT); + // if(file == 0) break; + if(!file){ + mlog(MODULE_NAME, "Failed to make file for PCI device!\n", MLOG_PRINT); return; } - } + // printf("ASSERT file == null: %d\n", file == 0); + file->fileops = &pci_fileops; + // } file->id = (uint32_t)slot | ((uint32_t)func << 8) | ((uint32_t)bus << 16); }