45 lines
1.1 KiB
C
45 lines
1.1 KiB
C
//
|
|
// Created by rick on 03-02-21.
|
|
//
|
|
|
|
#include "ide.h"
|
|
#include <types.h>
|
|
#include <kprint.h>
|
|
#include <drivers/pci.h>
|
|
#include <libc/stdbool.h>
|
|
|
|
const char* ide_pci_driver_name = "pci-ide";
|
|
|
|
u8 ide_pci_validate(const pci_device *device);
|
|
u8 ide_pci_initialize(const pci_device *device);
|
|
|
|
const pci_driver ide_pci_driver = {
|
|
.name = "pci-ide",
|
|
.description = "Default PCI IDE Driver",
|
|
.order = 0xFF, // let other drivers precede if they can
|
|
.pci_use_subclass = true,
|
|
.pci_class = PCI_CLASS_MASS_STORAGE,
|
|
.pci_subclass = PCI_SUB_CLASS_IDE,
|
|
|
|
.validate = ide_pci_validate,
|
|
.initialize = ide_pci_initialize,
|
|
};
|
|
|
|
u8 ide_pci_validate(const pci_device *device) {
|
|
if (device->class != PCI_CLASS_MASS_STORAGE
|
|
|| device->subclass != PCI_SUB_CLASS_IDE) {
|
|
return PCI_VALIDATE_FAIL;
|
|
}
|
|
// todo other validations
|
|
return PCI_VALIDATE_OK;
|
|
}
|
|
|
|
u8 ide_pci_initialize(const pci_device *device) {
|
|
kprint("IDE registered");
|
|
return PCI_VALIDATE_OK;
|
|
}
|
|
|
|
void ide_register() {
|
|
pci_register_driver(&ide_pci_driver);
|
|
}
|