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.
This commit is contained in:
Nick Hibma 2000-08-13 18:49:40 +00:00
parent 9350bdc398
commit 74bd1c1038
4 changed files with 61 additions and 2 deletions

View File

@ -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 @@ xptioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
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)

View File

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

View File

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

33
sys/modules/cam/Makefile Normal file
View File

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