diff options
author | n_hibma <n_hibma@FreeBSD.org> | 2000-04-03 11:11:12 +0000 |
---|---|---|
committer | n_hibma <n_hibma@FreeBSD.org> | 2000-04-03 11:11:12 +0000 |
commit | bb27208af1aacd5e405b2890d505d69484ea0934 (patch) | |
tree | 738f77ecd0cbf844b736bf7dcb70895b7af5b23e /sys/dev/usb/umass.c | |
parent | 865f9734f9cb790a385ee9452264a3904c9d60df (diff) | |
download | FreeBSD-src-bb27208af1aacd5e405b2890d505d69484ea0934.zip FreeBSD-src-bb27208af1aacd5e405b2890d505d69484ea0934.tar.gz |
Add a hack to cam that makes the cam_xpt available to the rest of the
kernel. Justin agress that there is no other reasonable alternative to
do automatic rescans on connect.
The problem is that when a new device attaches to a SIM (SCSI host
controller) we need to send a XPT_SCAN_BUS command to the SIM using
xpt_action. This requires however that there is a peripheral available
to take the command (otherwise xpt_done and later bomb). The RESCAN
ioctl uses the same periph.
This enables a USB mass storage drive to do an automatic rescan on
connection of the drive.
The automatic dropping of a CAM entry on disconnection was already
working (asynchronous event).
The next thing to do is find someone to commit a change to vpo to do the
same thing. Just port umass_cam_rescan and friends across to that
driver.
Approved by: gibbs
Diffstat (limited to 'sys/dev/usb/umass.c')
-rw-r--r-- | sys/dev/usb/umass.c | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index 74b8c90..a7a9418 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -1880,7 +1880,6 @@ umass_cam_rescan(struct umass_softc *sc) { struct cam_path *path; union ccb *ccb = malloc(sizeof(union ccb), M_USBDEV, M_WAITOK); - struct cam_periph *periph; memset(ccb, 0, sizeof(union ccb)); @@ -1889,29 +1888,7 @@ umass_cam_rescan(struct umass_softc *sc) USBDEVNAME(sc->sc_dev), cam_sim_path(umass_sim), USBDEVUNIT(sc->sc_dev), CAM_LUN_WILDCARD)); - /* Lookup the peripheral for the SIM */ - if (xpt_create_path(&path, NULL, cam_sim_path(umass_sim), - UMASS_SCSIID_HOST, 0) - != CAM_REQ_CMP) - return; - periph = cam_periph_find(path, cam_sim_name(umass_sim)); -#ifdef UMASS_DO_CAM_RESCAN - if (periph == NULL) { - DPRINTF(UDMASS_SCSI, ("scbus%d: abusing xpt_periph\n", - cam_sim_path(umass_sim))); - periph = xpt_periph; - } -#endif - if (periph == NULL) { - DPRINTF(UDMASS_SCSI, ("scbus%d: no periph, rescan failed\n", - cam_sim_path(umass_sim))); - xpt_free_path(path); - return; - } - xpt_free_path(path); - - /* Lookup the path again, but now include the periph in the path */ - if (xpt_create_path(&path, periph, cam_sim_path(umass_sim), + if (xpt_create_path(&path, xpt_periph, cam_sim_path(umass_sim), UMASS_SCSIID_HOST, 0) != CAM_REQ_CMP) return; @@ -2474,7 +2451,7 @@ umass_ufi_transform(struct umass_softc *sc, unsigned char *cmd, int cmdlen, /* A UFI command is always 12 bytes in length */ KASSERT(*rcmdlen < UFI_COMMAND_LENGTH, ("rcmdlen = %d < %d, buffer too small", - rcmdlen, UFI_COMMAND_LENGTH)); + *rcmdlen, UFI_COMMAND_LENGTH)); *rcmdlen = UFI_COMMAND_LENGTH; memset(*rcmd, 0, UFI_COMMAND_LENGTH); @@ -2546,7 +2523,7 @@ umass_atapi_transform(struct umass_softc *sc, unsigned char *cmd, int cmdlen, /* A ATAPI command is always 12 bytes in length */ KASSERT(*rcmdlen < ATAPI_COMMAND_LENGTH, ("rcmdlen = %d < %d, buffer too small", - rcmdlen, ATAPI_COMMAND_LENGTH)); + *rcmdlen, ATAPI_COMMAND_LENGTH)); *rcmdlen = ATAPI_COMMAND_LENGTH; memset(*rcmd, 0, ATAPI_COMMAND_LENGTH); |