summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>2000-08-13 18:49:40 +0000
committern_hibma <n_hibma@FreeBSD.org>2000-08-13 18:49:40 +0000
commitcbb74c17bdde9e04efd4115114940217143abe93 (patch)
treef008fa927436b05de6cb7f877e62d71234d3d789
parenta6c3c8dbfbbbdbe8e9dc451f059eec365e4825a1 (diff)
downloadFreeBSD-src-cbb74c17bdde9e04efd4115114940217143abe93.zip
FreeBSD-src-cbb74c17bdde9e04efd4115114940217143abe93.tar.gz
CAM, the module: scbus, da, cd, and st wrapped in one module.
Make the umass driver depend on this module. Makes it possible to compile the kernel without SCSI support and load it when for example a USB floppy is conencted.
-rw-r--r--sys/cam/cam_xpt.c25
-rw-r--r--sys/dev/usb/umass.c3
-rw-r--r--sys/modules/Makefile2
-rw-r--r--sys/modules/cam/Makefile33
4 files changed, 61 insertions, 2 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index eade26c..b5fe1c4 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -629,8 +629,19 @@ u_int32_t cam_debug_delay;
#endif /* CAM_DEBUG_BUS || CAM_DEBUG_TARGET || CAM_DEBUG_LUN */
/* Our boot-time initialization hook */
+static int cam_module_event_handler(module_t, int /*modeventtype_t*/, void *);
+
+static moduledata_t cam_moduledata = {
+ "cam",
+ cam_module_event_handler,
+ NULL
+};
+
static void xpt_init(void *);
-SYSINIT(cam, SI_SUB_CONFIGURE, SI_ORDER_SECOND, xpt_init, NULL);
+
+DECLARE_MODULE(cam, cam_moduledata, SI_SUB_CONFIGURE, SI_ORDER_SECOND);
+MODULE_VERSION(cam, 1);
+
static cam_status xpt_compile_path(struct cam_path *new_path,
struct cam_periph *perph,
@@ -1266,6 +1277,18 @@ ptstartover:
return(error);
}
+static int
+cam_module_event_handler(module_t mod, int what, void *arg)
+{
+ if (what == MOD_LOAD) {
+ xpt_init(NULL);
+ } else if (what == MOD_UNLOAD) {
+ return EBUSY;
+ }
+
+ return 0;
+}
+
/* Functions accessed by the peripheral drivers */
static void
xpt_init(dummy)
diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c
index d798de7..2f81aa1 100644
--- a/sys/dev/usb/umass.c
+++ b/sys/dev/usb/umass.c
@@ -536,6 +536,9 @@ Static void umass_dump_buffer (struct umass_softc *sc, u_int8_t *buffer,
int buflen, int printlen);
#endif
+#if defined(__FreeBSD__)
+MODULE_DEPEND(umass, cam, 1,1,1);
+#endif
/*
* USB device probe/attach/detach
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 6bbfbb6..2747785 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -7,7 +7,7 @@ _randomdev= randomdev
.endif
SUBDIR= 3dfx accf_data accf_http agp aha amr an aue \
- ccd cd9660 coda cue dc fdesc fxp if_disc if_ef \
+ cam ccd cd9660 coda cue dc fdesc fxp if_disc if_ef \
if_ppp if_sl if_tap if_tun ipfilter ipfw ispfw joy kernfs kue \
md mfs mii mlx msdos ncp netgraph nfs ntfs nullfs \
nwfs oldcard pccard pcic portal procfs ${_randomdev} \
diff --git a/sys/modules/cam/Makefile b/sys/modules/cam/Makefile
new file mode 100644
index 0000000..2075d39
--- /dev/null
+++ b/sys/modules/cam/Makefile
@@ -0,0 +1,33 @@
+# $FreeBSD$
+
+MAINTAINER = n_hibma@freebsd.org
+S = ${.CURDIR}/../..
+
+.PATH: $S/cam $S/cam/scsi
+KMOD = cam
+
+# See sys/conf/options for the flags that go into the different opt_*.h files.
+SRCS = opt_cam.h
+SRCS += opt_scsi.h
+SRCS += opt_cd.h
+SRCS += opt_hw_wdog.h
+SRCS += opt_pt.h
+SRCS += opt_sa.h
+SRCS += opt_ses.h
+SRCS += device_if.h bus_if.h
+SRCS += cam.c cam_extend.c cam_periph.c cam_queue.c
+SRCS += cam_sim.c cam_xpt.c
+SRCS += scsi_all.c scsi_cd.c scsi_ch.c
+SRCS += scsi_da.c
+SRCS += scsi_pass.c
+SRCS += scsi_pt.c
+SRCS += scsi_sa.c
+SRCS += scsi_ses.c
+SRCS += scsi_targ_bh.c scsi_target.c
+
+NOMAN =
+
+opt_scsi.h:
+ echo '#define SCSI_DELAY 15000' > opt_scsi.h
+
+.include <bsd.kmod.mk>
OpenPOWER on IntegriCloud