aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/umass.c
diff options
context:
space:
mode:
authorNick Hibma <n_hibma@FreeBSD.org>2000-08-09 17:41:11 +0000
committerNick Hibma <n_hibma@FreeBSD.org>2000-08-09 17:41:11 +0000
commitb40a42fbe88b64f8019824c189b3b72ba13564d3 (patch)
tree3dc59f9181e2b8e50610bbcc0539cff00fe5adfc /sys/dev/usb/umass.c
parent02211bae3b9f99a8e0ecb998bb0a38dc5f432689 (diff)
downloadsrc-b40a42fbe88b64f8019824c189b3b72ba13564d3.tar.gz
src-b40a42fbe88b64f8019824c189b3b72ba13564d3.zip
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.
Notes
Notes: svn path=/head/; revision=64454
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 e2d1263d349e..2039db157194 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);
}