diff options
author | ken <ken@FreeBSD.org> | 2003-02-21 06:19:38 +0000 |
---|---|---|
committer | ken <ken@FreeBSD.org> | 2003-02-21 06:19:38 +0000 |
commit | 915501ccb2cd04785110ff8472f007e5a0b61101 (patch) | |
tree | 914528d9dce9c7668d13bb7c38e332bc381a4abb /sys/dev | |
parent | f66a29b519183414fcd71d2fcc007723367a37bf (diff) | |
download | FreeBSD-src-915501ccb2cd04785110ff8472f007e5a0b61101.zip FreeBSD-src-915501ccb2cd04785110ff8472f007e5a0b61101.tar.gz |
Fix ATAPI/USB/Firewire CDROM drive handling in cd(4) and hopefully fix
a number of related problems along the way.
- Automatically detect CDROM drives that can't handle 6 byte mode
sense and mode select, and adjust our command size accordingly.
We have to handle this in the cd(4) driver (where the buffers are
allocated), since the parameter list length is different for the
6 and 10 byte mode sense commands.
- Remove MODE_SENSE and MODE_SELECT translation removed in ATAPICAM
and in the umass(4) driver, since there's no way for that to work
properly.
- Add a quirk entry for CDROM drives that just hang when they get a 6
byte mode sense or mode select. The reason for the quirk must be
documented in a PR, and all quirks must be approved by
ken@FreeBSD.org. This is to make sure that we fully understand why
each quirk is needed. Once the CAM_NEW_TRAN_CODE is finished, we
should be able to remove any such quirks, since we'll know what
protocol the drive speaks (SCSI, ATAPI, etc.) and therefore whether
we should use 6 or 10 byte mode sense/select commands.
- Change the way the da(4) handles the no_6_byte sysctl. There is
now a per-drive sysctl to set the minimum command size for that
particular disk. (Since you could have multiple disks with
multiple requirements in one system.)
- Loader tunable support for all the sysctls in the da(4) and cd(4)
drivers.
- Add a CDIOCCLOSE ioctl for cd(4) (bde pointed this out a long
time ago).
- Add a media validation routine (cdcheckmedia()) to the cd(4)
driver, to fix some problems bde pointed out a long time ago. We
now allow open() to succeed no matter what, but if we don't detect
valid media, the user can only issue CDIOCCLOSE or CDIOCEJECT
ioctls.
- The media validation routine also reads the table of contents off
the drive. We use the table of contents to implement the
CDIOCPLAYTRACKS ioctl using the PLAY AUDIO MSF command. The
PLAY AUDIO TRACK INDEX command that we previously used was
deprecated after SCSI-2. It works in every SCSI CDROM I've tried,
but doesn't seem to work on ATAPI CDROM drives. We still use the
play audio track index command if we don't have a valid TOC, but
I suppose it'll fail anyway in that case.
- Add _len() versions of scsi_mode_sense() and scsi_mode_select() so
that we can specify the minimum command length.
- Fix a couple of formatting problems in the sense printing code.
MFC after: 4 weeks
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ata/atapi-cam.c | 30 | ||||
-rw-r--r-- | sys/dev/usb/umass.c | 27 |
2 files changed, 0 insertions, 57 deletions
diff --git a/sys/dev/ata/atapi-cam.c b/sys/dev/ata/atapi-cam.c index 02e234b..eb603bb 100644 --- a/sys/dev/ata/atapi-cam.c +++ b/sys/dev/ata/atapi-cam.c @@ -419,36 +419,6 @@ atapi_action(struct cam_sim *sim, union ccb *ccb) } break; } - case MODE_SELECT_6: - /* FALLTHROUGH */ - - case MODE_SENSE_6: - /* - * not supported by ATAPI/MMC devices (per SCSI MMC spec) - * translate to _10 equivalent. - * (actually we should do this only if we have tried - * MODE_foo_6 and received ILLEGAL_REQUEST or - * INVALID COMMAND OPERATION CODE) - * alternative fix: behave like a honest CAM transport, - * do not muck with CDB contents, and change scsi_cd to - * always use MODE_SENSE_10 in cdgetmode(), or let scsi_cd - * know that this specific unit is an ATAPI/MMC one, - * and in /that case/ use MODE_SENSE_10 - */ - - CAM_DEBUG(ccb_h->path, CAM_DEBUG_SUBTRACE, - ("Translating %s into _10 equivalent\n", - (hcb->cmd[0] == MODE_SELECT_6) ? - "MODE_SELECT_6" : "MODE_SENSE_6")); - hcb->cmd[0] |= 0x40; - hcb->cmd[6] = 0; - hcb->cmd[7] = 0; - hcb->cmd[8] = hcb->cmd[4]; - hcb->cmd[9] = hcb->cmd[5]; - hcb->cmd[4] = 0; - hcb->cmd[5] = 0; - break; - case READ_6: /* FALLTHROUGH */ diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index df04e4e..afadc87 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -2846,22 +2846,6 @@ umass_scsi_6_to_10(unsigned char *cmd, int cmdlen, unsigned char **rcmd, * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | * ----------------------------------------- * OP |B2 | ADDRESS |RSV| LEN |CTRL - * - * For mode sense/select, the format is: - * - * 6 byte: - * ------------------------- - * | 0 | 1 | 2 | 3 | 4 | 5 | - * ------------------------- - * OP |B2 |PAG|UNU|LEN|CTRL - * - * 10 byte: - * ----------------------------------------- - * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | - * ----------------------------------------- - * OP |B2 |PAG| UNUSED | LEN |CTRL - * - * with the exception that mode select does not have a page field. */ switch (cmd[0]) { case READ_6: @@ -2870,12 +2854,6 @@ umass_scsi_6_to_10(unsigned char *cmd, int cmdlen, unsigned char **rcmd, case WRITE_6: (*rcmd)[0] = WRITE_10; break; - case MODE_SENSE_6: - (*rcmd)[0] = MODE_SENSE_10; - break; - case MODE_SELECT_6: - (*rcmd)[0] = MODE_SELECT_6; - break; default: return (0); } @@ -2885,11 +2863,6 @@ umass_scsi_6_to_10(unsigned char *cmd, int cmdlen, unsigned char **rcmd, case WRITE_6: memcpy(&(*rcmd)[3], &cmd[1], 3); break; - case MODE_SENSE_6: - (*rcmd)[2] = cmd[2]; - case MODE_SELECT_6: - (*rcmd)[1] = cmd[1]; - break; } (*rcmd)[8] = cmd[4]; (*rcmd)[9] = cmd[5]; |