Newer
Older
tree-os / src / kernel / drivers / pci / hardDrive / hardDrive.c
@lukas lukas on 9 Mar 2022 667 bytes add file system: fat 16
#include <_stdio.h>
#include <alloc.h>
#include <fileSystem.h>
#include <hardDrive.h>
#include <pci.h>
#include <ports.h>

void scanHardDrives() {
    ListElement *drives = NULL;
    for (ListElement *current = *getPciDevices(); current;
         current = current->next) {
        PciDevice *pciDevice = current->data;
        if (pciDevice->class != 1) {
            continue;
        }
        switch (pciDevice->subclass) {
        case 1:
            initializeIdeController(pciDevice, &drives);
            break;
        case 6:
            initializeSataController(pciDevice, &drives);
            break;
        }
    }
    mountDisk(listGet(&drives, 1));
}