[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-scsi
Subject:    CAM - The Module - Call for testers
From:       Nick Hibma <n_hibma () qubesoft ! com>
Date:       2000-08-09 17:04:26
[Download RAW message or body]

The USB Mass Storage driver uses CAM. At the moment CAM needs to be
compiled into the kernel for the umass driver to work. The following
patch makes CAM a module.

As far as I can test it loads and runs fine, but that is only with a
limited testcase, one USB floppy drive. I'd appreciate it if someone
with at least a SCSI adapter and at least one SCSI device attached to
it, could do the following:

- compile a kernel without scbus, da, cd, sa and other SCSI devices
- recompile the umass module after the patch has been applied
- compile the cam module
- add umass_load to your /boot/loader.conf (which will pull in cam.ko
  through a dependency)

This should work even in the case of a SCSI adapter plus drive from
which you boot. Or at least that's the idea :-}

Thanks in advance!

Nick
--
Qube Software, Ltd.                                             Private:
n_hibma@qubesoft.com                              n_hibma@webweaving.org
                                                     n_hibma@freebsd.org
http://www.qubesoft.com/                   http://www.etla.net/~n_hibma/

["cam.module.diff" (TEXT/PLAIN)]

Index: dev/usb/umass.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/umass.c,v
retrieving revision 1.29
diff -w -u -r1.29 umass.c
--- dev/usb/umass.c	2000/07/30 17:54:34	1.29
+++ dev/usb/umass.c	2000/08/08 19:33:35
@@ -534,6 +534,9 @@
 				int buflen, int printlen);
 #endif
 
+#if defined(__FreeBSD__)
+MODULE_DEPEND(umass, cam, 1,1,1);
+#endif
 
 /*
  * USB device probe/attach/detach
Index: cam/cam_xpt.c
===================================================================
RCS file: /home/ncvs/src/sys/cam/cam_xpt.c,v
retrieving revision 1.90
diff -w -u -r1.90 cam_xpt.c
--- cam/cam_xpt.c	2000/08/08 06:49:33	1.90
+++ cam/cam_xpt.c	2000/08/09 16:41:31
@@ -629,9 +629,20 @@
 #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,
 					 path_id_t path_id,
@@ -1264,6 +1275,18 @@
 	}
 
 	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 */

["cam.module.Makefile" (TEXT/PLAIN)]

#       $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>

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic