summaryrefslogtreecommitdiffstats
path: root/sys/cam/cam_periph.h
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-02-07 07:05:59 +0000
committerpeter <peter@FreeBSD.org>2001-02-07 07:05:59 +0000
commitd4473642637e5eadfea57b93316a31adcf33e702 (patch)
tree7daf0a32251f6c943f48831c9250eaf0e77a3776 /sys/cam/cam_periph.h
parent2b52ef3ebe9d93d57501db078ac5327c92971919 (diff)
downloadFreeBSD-src-d4473642637e5eadfea57b93316a31adcf33e702.zip
FreeBSD-src-d4473642637e5eadfea57b93316a31adcf33e702.tar.gz
Change the peripheral driver list from a linker set to module driven
driver registration. This should allow things like da, sa, cd etc to be in seperate KLD's to the cam core and make them preloadable.
Diffstat (limited to 'sys/cam/cam_periph.h')
-rw-r--r--sys/cam/cam_periph.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/sys/cam/cam_periph.h b/sys/cam/cam_periph.h
index 54c549c..ac32256 100644
--- a/sys/cam/cam_periph.h
+++ b/sys/cam/cam_periph.h
@@ -37,7 +37,30 @@
extern struct cam_periph *xpt_periph;
-extern struct linker_set periphdriver_set;
+extern struct periph_driver **periph_drivers;
+void periphdriver_register(void *);
+
+#include <sys/module.h>
+#define PERIPHDRIVER_DECLARE(name, driver) \
+ static int name ## _modevent(module_t mod, int type, void *data) \
+ { \
+ switch (type) { \
+ case MOD_LOAD: \
+ periphdriver_register(data); \
+ break; \
+ case MOD_UNLOAD: \
+ printf(#name " module unload - not possible for this module type\n"); \
+ return EINVAL; \
+ } \
+ return 0; \
+ } \
+ static moduledata_t name ## _mod = { \
+ #name, \
+ name ## _modevent, \
+ (void *)&driver \
+ }; \
+ DECLARE_MODULE(name, name ## _mod, SI_SUB_DRIVERS, SI_ORDER_ANY); \
+ MODULE_DEPEND(name, cam, 1, 1, 1)
typedef void (periph_init_t)(void); /*
* Callback informing the peripheral driver
OpenPOWER on IntegriCloud