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
|
|
@ -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