summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/umass.c
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>2000-08-09 17:41:11 +0000
committern_hibma <n_hibma@FreeBSD.org>2000-08-09 17:41:11 +0000
commit8fb22bea284891455a2cca346eb342f034672eb4 (patch)
tree38ce6eced1f21a55f1209483c7c5a1810ecdd376 /sys/dev/usb/umass.c
parent3b38e4eab572db08074aef39b5a0bb002cf7e293 (diff)
downloadFreeBSD-src-8fb22bea284891455a2cca346eb342f034672eb4.zip
FreeBSD-src-8fb22bea284891455a2cca346eb342f034672eb4.tar.gz
Finally got my brain around what a SIM UNIT number is and how it differs
from the SCSI id it has. (this avoids the confusing umass-sim32 device. It should have been umass-sim0 all along (there is only one), and if it is spoken to as a SCSI device the sim should be umass32. Make the rescan actually work. We need to fill in a target and lun wildcard and not the SCSI id of the SIM. Add a seatbelt.
Diffstat (limited to 'sys/dev/usb/umass.c')
-rw-r--r--sys/dev/usb/umass.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c
index e2d1263..2039db1 100644
--- a/sys/dev/usb/umass.c
+++ b/sys/dev/usb/umass.c
@@ -177,6 +177,8 @@ int umassdebug = UDMASS_ALL;
#endif
#define UMASS_SCSIID_HOST UMASS_SCSIID_MAX
+#define UMASS_SIM_UNIT 0 /* we use one sim for all drives */
+
#define MS_TO_TICKS(ms) ((ms) * hz / 1000)
@@ -1953,7 +1955,7 @@ umass_cam_attach_sim()
return(ENOMEM);
umass_sim = cam_sim_alloc(umass_cam_action, umass_cam_poll, DEVNAME_SIM,
- NULL /*priv*/, UMASS_SCSIID_HOST/*unit number*/,
+ NULL /*priv*/, UMASS_SIM_UNIT /*unit number*/,
1 /*maximum device openings*/,
0 /*maximum tagged device openings*/,
devq);
@@ -2000,7 +2002,7 @@ umass_cam_rescan(struct umass_softc *sc)
USBDEVUNIT(sc->sc_dev), CAM_LUN_WILDCARD));
if (xpt_create_path(&path, xpt_periph, cam_sim_path(umass_sim),
- UMASS_SCSIID_HOST, 0)
+ CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD)
!= CAM_REQ_CMP)
return;
@@ -2078,6 +2080,7 @@ umass_cam_detach(struct umass_softc *sc)
{
struct cam_path *path;
+ if (umass_sim) {
/* detach of sim not done until module unload */
DPRINTF(UDMASS_SCSI, ("%s:%d:%d:%d: losing CAM device entry\n",
USBDEVNAME(sc->sc_dev), cam_sim_path(umass_sim),
@@ -2087,8 +2090,10 @@ umass_cam_detach(struct umass_softc *sc)
USBDEVUNIT(sc->sc_dev), CAM_LUN_WILDCARD)
!= CAM_REQ_CMP)
return(ENOMEM);
+
xpt_async(AC_LOST_DEVICE, path, NULL);
xpt_free_path(path);
+ }
return(0);
}
OpenPOWER on IntegriCloud