#include <_stdio.h> #include <alloc.h> #include <hardDrive.h> #include <pci.h> #include <ports.h> #include <stdbool.h> #include <timer.h> void initializeSATADrive(PciDevice *pciDevice) { // todo } 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: initializeIDEDrive(pciDevice, &drives); break; case 6: printf("found a SATA-controller: %i:%i:%i\n", pciDevice->bus, pciDevice->device, pciDevice->function); initializeSATADrive(pciDevice); break; } } void *buffer = malloc(2000); for (ListElement *current = drives; current; current = current->next) { HardDrive *hardDrive = current->data; hardDrive->access(hardDrive, 0, buffer, 1, 0); printf("data: %x %x %s\n", *(uint32_t *)buffer, *((uint32_t *)buffer + 1), buffer); } free(buffer); }