Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Aug 2003 21:33:07 -0600
From:      "Kenneth D. Merry" <ken@kdm.org>
To:        stable@FreeBSD.org
Subject:   HEADS UP: cd(4), other CAM changes
Message-ID:  <20030824033307.GA87833@panzer.kdm.org>

next in thread | raw e-mail | index | archive | help

I have MFCed cd(4) support for switching between 6 byte and 10 byte mode
sense/select commands, along with a number of related changes.

Hopefully things will work better for people using USB, ATAPI and firewire
CDROM drives under -stable.

As noted below, cd(4)'s open() will still fail under -stable if you don't
have media in the drive.  If bde and I can get things sufficiently worked
out, I may be able to allow the close/eject ioctls to succeed even when
there is no media in the drive.  (That's what happens in -current.)

Another thing to note is that the da(4) command size sysctl has changed.
There is no longer a kern.cam.da.no_6_byte sysctl.  Instead, there are
separate minimum_cmd_size sysctl variables and loader tunables for each
da(4) unit.  (i.e. the same as in -current)  (The reason is, you may have
one disk that can't handle 10 byte commands, and another that can't handle
6 byte commands in the same system.)

Anyway, let me know if you run into problems with these changes.

Ken

----- Forwarded message from "Kenneth D. Merry" <ken@FreeBSD.org> -----

From: "Kenneth D. Merry" <ken@FreeBSD.org>
Date: Sat, 23 Aug 2003 20:26:38 -0700 (PDT)
To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject: cvs commit: src/sys/cam/scsi scsi_all.c scsi_all.h scsi_cd.c
         scsi_cd.h scsi_da.c src/sys/dev/ata atapi-cam.c

ken         2003/08/23 20:26:38 PDT

  FreeBSD src repository

  Modified files:        (Branch: RELENG_4)
    sys/cam/scsi         scsi_all.c scsi_all.h scsi_cd.c scsi_cd.h 
                         scsi_da.c 
    sys/dev/ata          atapi-cam.c 
  Log:
  MFC:  Fix ATAPI/USB/Firewire CDROM drive handling in cd(4) and hopefully
  fix a number of related problems along the way.
  
  Files/revisions merged:
  
  scsi_cd.c:      1.72, 1.77, 1.80
  scsi_all.c:     1.39 (partial)
  scsi_all.h:     1.22
  scsi_cd.h:      1.7
  scsi_da.c:      1.139
  atapi-cam.c:    1.13
  not merged:     umass.c rev 1.76 (doesn't apply to -stable)
  
  Because of the differences between -current and -stable, some of these
  changes are not identical to the ones in -current.
  
  Most notably, cd(4) in -stable uses the slice code, whereas cd(4) in
  -current has no disklabel support at all.  So there is extra code in the
  -stable version of these patches to handle that.
  
   - 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 in ATAPICAM, since
     there's no way for that to work properly.
  
   - Merge support for sending a path inquiry CCB to see if the SIM has set
     the PIM_NO_6_BYTE flag. (scsi_cd.c rev 1.80)
  
   - 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.  In most cases, the PIM_NO_6_BYTE flag set by the
     SIM driver should eliminate the need for a quirk.
  
   - 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.  For
     -stable, open() will still fail if there is no media in the drive.  This
     is because of issues with the slice code handling media changing
     underneath it.  If bde and I can get those issues worked out, there is
     basic code in this set of patches to handle allowing the CDIOCCLOSE and
     CDIOCEJECT ioctls without media in the drive.
  
   - 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.
  
  Approved by:    re
  
  Revision   Changes     Path
  1.14.2.10  +28 -2      src/sys/cam/scsi/scsi_all.c
  1.14.2.5   +17 -0      src/sys/cam/scsi/scsi_all.h
  1.31.2.14  +1117 -378  src/sys/cam/scsi/scsi_cd.c
  1.2.6.3    +54 -31     src/sys/cam/scsi/scsi_cd.h
  1.42.2.40  +94 -8      src/sys/cam/scsi/scsi_da.c
  1.10.2.5   +0 -30      src/sys/dev/ata/atapi-cam.c

----- End forwarded message -----

-- 
Kenneth Merry
ken@kdm.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030824033307.GA87833>