ahci: load AHCI as module
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
e8effb194e
commit
cb2c3e1053
6 changed files with 74 additions and 13 deletions
|
|
@ -392,11 +392,8 @@ static int ahci_init_device(struct pci_device *device)
|
|||
|
||||
void ahci_init()
|
||||
{
|
||||
list_t dev_list;
|
||||
list_create(&dev_list);
|
||||
|
||||
driver_register("ahci", DRIVER_PCI, ahci_init_device, NULL, pci_driver_class(1, 6, 1));
|
||||
|
||||
krdy("AHCI ready\n");
|
||||
}
|
||||
DRIVER_ENTRY_PRIORITY(ahci_init, 2);
|
||||
DRIVER_ALIAS("pci:010601");
|
||||
|
|
|
|||
|
|
@ -76,6 +76,17 @@ size_t pci_find_device(u16 major, u16 minor, list_t *out)
|
|||
return n;
|
||||
}
|
||||
|
||||
static void device_init(struct pci_device *pdev)
|
||||
{
|
||||
u32 driverclass = pci_driver_class(pdev->class_major, pdev->class_minor, pdev->prog_if);
|
||||
struct driver *driver = driver_find(DRIVER_PCI, driverclass);
|
||||
|
||||
if (driver && driver->init_device) {
|
||||
pci_init_t f = driver->init_device;
|
||||
f(pdev);
|
||||
}
|
||||
}
|
||||
|
||||
static void host_probe_devices(struct pci_host *host)
|
||||
{
|
||||
for (int bus = 0; bus < 256; bus++) {
|
||||
|
|
@ -138,14 +149,7 @@ static void host_probe_devices(struct pci_host *host)
|
|||
break;
|
||||
}
|
||||
|
||||
/* call the driver */
|
||||
u32 driverclass = pci_driver_class(pdev->class_major, pdev->class_minor, pdev->prog_if);
|
||||
struct driver *driver = driver_find(DRIVER_PCI, driverclass);
|
||||
|
||||
if (driver && driver->init_device) {
|
||||
pci_init_t f = driver->init_device;
|
||||
f(pdev);
|
||||
}
|
||||
device_init(pdev);
|
||||
|
||||
kdebug("PCI device: vendor=%04x, id=%x, major=%x, minor=%x\n", pdev->vendor, pdev->device_id,
|
||||
pdev->class_major, pdev->class_minor);
|
||||
|
|
|
|||
Loading…
Reference in a new issue