DragonFly BSD
DragonFly kernel List (threaded) for 2004-02
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

USB umass blues


From: Miguel Mendez <flynn@xxxxxxxxxxxxxxxxxx>
Date: Sun, 01 Feb 2004 17:38:30 +0100

Hi,

I've been trying to figure out a problem I've been experiencing with my mp3 player on DFly.

Scenario:

All SCSI system, no ide devices. First usb port is attached to my laser printer, second is free (most of the time a usb joypad is there), which is the one I use to connect my AudioKey2 USB mp3 player. Attach goes fine, device is detected and I can mount the filesystem ok. But, when I detach it, it takes away the entire "da" driver. Trying something like 'ls' causes an instant panic with a "Page not present" fault, since it tries to jump to 0x8:0. Of course I can't get a kernel crashdump either.

Now, there's something strange at boot time:

WARNING: "da" is usurping "da"'s cdevsw[]

Given my little umass and cam-fu, I've managed to track the panic problem down to /sys/bus/cam/scsi/scsi_da.c. I've written a super-hackish bandaid patch that lets me keep the system alive, read: not have to reboot every time I need to access my usb mp3 player. I suspect that the main problem lies elsewhere in the da allocation code, which I still haven't studied, but I intend to.

Anyone else finding him/herself in this situation can give my patch a try. Spare me the comments about the quality of the patch, I know the code is not correct and pretty much sucks, but it does the job until I can come up with a proper solution :)

Cheers,
--
	Miguel Mendez <flynn@xxxxxxxxxxxxxxxxxx>
	http://www.energyhq.es.eu.org
	PGP Key: 0xDC8514F1

Index: scsi_da.c
===================================================================
RCS file: /home/dcvs/src/sys/bus/cam/scsi/scsi_da.c,v
retrieving revision 1.12
diff -u -u -r1.12 scsi_da.c
--- scsi_da.c	29 Dec 2003 06:42:10 -0000	1.12
+++ scsi_da.c	1 Feb 2004 16:25:30 -0000
@@ -1051,22 +1051,35 @@
 
 	softc = (struct da_softc *)periph->softc;
 
-	devstat_remove_entry(&softc->device_stats);
-	cam_extend_release(daperiphs, periph->unit_number);
-	xpt_print_path(periph->path);
-	printf("removing device entry\n");
-	/*
-	 * If we can't free the sysctl tree, oh well...
-	 */
-	if ((softc->flags & DA_FLAG_SCTX_INIT) != 0
-	    && sysctl_ctx_free(&softc->sysctl_ctx) != 0) {
+	if(1) {
+		printf("Attempted to remove %s (%d)\n",
+		periph->periph_name,
+		periph->unit_number);
+
+		if ((softc->flags & DA_FLAG_SCTX_INIT) != 0
+		    && sysctl_ctx_free(&softc->sysctl_ctx) != 0) {
+		  xpt_print_path(periph->path);
+		  printf("can't remove sysctl context\n");
+		}
+
+	} else {
+
+		devstat_remove_entry(&softc->device_stats);
+		cam_extend_release(daperiphs, periph->unit_number);
 		xpt_print_path(periph->path);
-		printf("can't remove sysctl context\n");
-	}
-	if (softc->disk.d_dev) {
-		disk_destroy(&softc->disk);
+		printf("removing device entry\n");
+	  
+		if ((softc->flags & DA_FLAG_SCTX_INIT) != 0
+		    && sysctl_ctx_free(&softc->sysctl_ctx) != 0) {
+		  xpt_print_path(periph->path);
+		  printf("can't remove sysctl context\n");
+		}
+		if (softc->disk.d_dev) {
+		  disk_destroy(&softc->disk);
+		}
+		free(softc, M_DEVBUF);
 	}
-	free(softc, M_DEVBUF);
+
 }
 
 static void


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]