diff options
author | Ian Moffett <ian@osmora.org> | 2025-07-03 17:50:35 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-07-03 17:51:02 -0400 |
commit | 8378d14cc0f4996080e21c84491ba9b8fcb679a4 (patch) | |
tree | ffbf2f0bfa473003ff1b6992fea685a2860f285f /sys | |
parent | 197b0ecd37e8c41015586ee9711c807b9b625b0b (diff) |
kernel: driver: Assign names to all drivers
Assign a name to each driver through the DRIVER_EXPORT() or
DRIVER_DEFER() macros. This can be used for blacklisting driver
startups.
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/isa/i8042.c | 2 | ||||
-rw-r--r-- | sys/arch/amd64/isa/mc1468.c | 2 | ||||
-rw-r--r-- | sys/arch/amd64/isa/spkr.c | 2 | ||||
-rw-r--r-- | sys/dev/dmi/dmi.c | 2 | ||||
-rw-r--r-- | sys/dev/ic/ahci.c | 2 | ||||
-rw-r--r-- | sys/dev/ic/nvme.c | 2 | ||||
-rw-r--r-- | sys/dev/phy/e1000.c | 2 | ||||
-rw-r--r-- | sys/dev/phy/rtl.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/xhci.c | 2 | ||||
-rw-r--r-- | sys/dev/video/fbdev.c | 2 | ||||
-rw-r--r-- | sys/include/sys/driver.h | 11 |
11 files changed, 17 insertions, 14 deletions
diff --git a/sys/arch/amd64/isa/i8042.c b/sys/arch/amd64/isa/i8042.c index eb8960c..69d9f92 100644 --- a/sys/arch/amd64/isa/i8042.c +++ b/sys/arch/amd64/isa/i8042.c @@ -435,4 +435,4 @@ i8042_init(void) return 0; } -DRIVER_EXPORT(i8042_init); +DRIVER_EXPORT(i8042_init, "i8042"); diff --git a/sys/arch/amd64/isa/mc1468.c b/sys/arch/amd64/isa/mc1468.c index bbaa3d1..1f3ae1d 100644 --- a/sys/arch/amd64/isa/mc1468.c +++ b/sys/arch/amd64/isa/mc1468.c @@ -278,4 +278,4 @@ static struct cdevsw mc1468_cdevsw = { .write = mc1468_dev_write, }; -DRIVER_EXPORT(mc1468_init); +DRIVER_EXPORT(mc1468_init, "mc1468"); diff --git a/sys/arch/amd64/isa/spkr.c b/sys/arch/amd64/isa/spkr.c index b2f63b0..c96e5f9 100644 --- a/sys/arch/amd64/isa/spkr.c +++ b/sys/arch/amd64/isa/spkr.c @@ -119,4 +119,4 @@ static struct cdevsw beep_cdevsw = { .write = dev_write }; -DRIVER_EXPORT(beep_init); +DRIVER_EXPORT(beep_init, "pcspkr"); diff --git a/sys/dev/dmi/dmi.c b/sys/dev/dmi/dmi.c index 8c7f21c..59946ad 100644 --- a/sys/dev/dmi/dmi.c +++ b/sys/dev/dmi/dmi.c @@ -248,4 +248,4 @@ dmi_init(void) return 0; } -DRIVER_EXPORT(dmi_init); +DRIVER_EXPORT(dmi_init, "dmi"); diff --git a/sys/dev/ic/ahci.c b/sys/dev/ic/ahci.c index 5dbf4a7..d17c6a3 100644 --- a/sys/dev/ic/ahci.c +++ b/sys/dev/ic/ahci.c @@ -1040,4 +1040,4 @@ static struct bdevsw ahci_bdevsw = { .bsize = ahci_dev_bsize }; -DRIVER_DEFER(ahci_init); +DRIVER_DEFER(ahci_init, "ahci"); diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c index 822b085..147ab4f 100644 --- a/sys/dev/ic/nvme.c +++ b/sys/dev/ic/nvme.c @@ -662,4 +662,4 @@ static struct bdevsw nvme_bdevsw = { .write = nowrite }; -DRIVER_DEFER(nvme_init); +DRIVER_DEFER(nvme_init, "nvme"); diff --git a/sys/dev/phy/e1000.c b/sys/dev/phy/e1000.c index 95efe6d..41a2a27 100644 --- a/sys/dev/phy/e1000.c +++ b/sys/dev/phy/e1000.c @@ -355,4 +355,4 @@ e1000_init(void) return 0; } -DRIVER_EXPORT(e1000_init); +DRIVER_EXPORT(e1000_init, "e1000"); diff --git a/sys/dev/phy/rtl.c b/sys/dev/phy/rtl.c index 691f767..d096d1a 100644 --- a/sys/dev/phy/rtl.c +++ b/sys/dev/phy/rtl.c @@ -440,4 +440,4 @@ rt81xx_init(void) return rt_init_mac(); } -DRIVER_DEFER(rt81xx_init); +DRIVER_DEFER(rt81xx_init, "rtl81xx"); diff --git a/sys/dev/usb/xhci.c b/sys/dev/usb/xhci.c index 46ec4af..0ccb7a0 100644 --- a/sys/dev/usb/xhci.c +++ b/sys/dev/usb/xhci.c @@ -545,4 +545,4 @@ xhci_init(void) return xhci_init_hc(&xhc); } -DRIVER_EXPORT(xhci_init); +DRIVER_EXPORT(xhci_init, "xhci"); diff --git a/sys/dev/video/fbdev.c b/sys/dev/video/fbdev.c index 8a2499d..6b1c6c8 100644 --- a/sys/dev/video/fbdev.c +++ b/sys/dev/video/fbdev.c @@ -135,4 +135,4 @@ static const struct ctlops fb_size_ctl = { .write = NULL, }; -DRIVER_EXPORT(fbdev_init); +DRIVER_EXPORT(fbdev_init, "fbdev"); diff --git a/sys/include/sys/driver.h b/sys/include/sys/driver.h index 9f08de3..a7cb2ae 100644 --- a/sys/include/sys/driver.h +++ b/sys/include/sys/driver.h @@ -43,6 +43,7 @@ struct driver_var { struct driver { int(*init)(void); + const char *name; struct driver_var *data; }; @@ -56,7 +57,7 @@ extern char __drivers_init_end[]; extern char __driversd_init_start[]; extern char __driversd_init_end[]; -#define DRIVER_EXPORT(INIT) \ +#define DRIVER_EXPORT(INIT, NAME) \ static struct driver_var __driver_var = { \ .deferred = 0 \ }; \ @@ -64,7 +65,8 @@ extern char __driversd_init_end[]; __attribute__((used, section(".drivers"))) \ static struct driver __driver_desc = { \ .init = INIT, \ - .data = &__driver_var \ + .data = &__driver_var, \ + .name = NAME \ } /* @@ -84,7 +86,7 @@ extern char __driversd_init_end[]; * context has yet to be initialized. The driver may * use this to defer requests for I/O. */ -#define DRIVER_DEFER(INIT) \ +#define DRIVER_DEFER(INIT, NAME) \ static struct driver_var __driver_var = { \ .deferred = 1 \ }; \ @@ -92,7 +94,8 @@ extern char __driversd_init_end[]; __attribute__((used, section(".drivers.defer"))) \ static struct driver __driver_desc = { \ .init = INIT, \ - .data = &__driver_var \ + .data = &__driver_var, \ + .name = NAME \ } #define DRIVER_DEFERRED() __driver_var.deferred |