driver: load driver file by alias only

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-08-12 20:54:27 -04:00
commit 20905ec95f
Signed by: michaelsshaw
GPG key ID: 5A5E0FB20708A9E7
6 changed files with 69 additions and 39 deletions

View file

@ -19,6 +19,7 @@
#include <lib/endian.h>
#define SPIN_MAX 2000
#define AHCI_ALIAS "pci:010601"
static uint8_t sata_device_count = 0;
static uint8_t cd_device_count = 0;
@ -392,8 +393,8 @@ static int ahci_init_device(struct pci_device *device)
void ahci_init()
{
driver_register("ahci", DRIVER_PCI, ahci_init_device, NULL, pci_driver_class(1, 6, 1));
driver_register("ahci", DRIVER_PCI, ahci_init_device, NULL, AHCI_ALIAS);
krdy("AHCI ready\n");
}
DRIVER_ENTRY_PRIORITY(ahci_init, 2);
DRIVER_ALIAS("pci:010601");
DRIVER_ALIAS(AHCI_ALIAS);

View file

@ -79,7 +79,11 @@ size_t pci_find_device(u16 major, u16 minor, list_t *out)
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);
char alias[11];
snprintf(alias, 11, "pci:%06x", driverclass);
struct driver *driver = driver_find(alias);
if (driver && driver->init_device) {
pci_init_t f = driver->init_device;