From owner-freebsd-current Thu Feb 20 22:27:30 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F048637B401; Thu, 20 Feb 2003 22:27:26 -0800 (PST) Received: from panzer.kdm.org (panzer.kdm.org [216.160.178.169]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8205443FF3; Thu, 20 Feb 2003 22:27:16 -0800 (PST) (envelope-from ken@panzer.kdm.org) Received: from panzer.kdm.org (localhost [127.0.0.1]) by panzer.kdm.org (8.12.6/8.12.5) with ESMTP id h1L6RFnU009314; Thu, 20 Feb 2003 23:27:15 -0700 (MST) (envelope-from ken@panzer.kdm.org) Received: (from ken@localhost) by panzer.kdm.org (8.12.6/8.12.5/Submit) id h1L6RFv5009313; Thu, 20 Feb 2003 23:27:15 -0700 (MST) (envelope-from ken) Date: Thu, 20 Feb 2003 23:27:14 -0700 From: "Kenneth D. Merry" To: current@FreeBSD.org Cc: scsi@FreeBSD.org Subject: HEADS UP: cd(4) and da(4) changes Message-ID: <20030220232714.A9269@panzer.kdm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I've (finally) checked in the cd(4) mode sense/select patches, along with a number of related fixes. Note that the 6 byte sysctl for the da(4) driver has changed. It is now kern.cam.da.%d.minimum_cmd_size. i.e. there is a separate sysctl for each da unit, since you could have different drives with different requirements in one system. The sysctl for the cd(4) driver follows the same pattern: kern.cam.cd.%d.minimum_cmd_size. For the cd(4) driver it only affects mode sense and mode select. For CDROM devices, 10 byte reads and writes are the only commands that are mandated by the spec, so that's generally what it uses anyway. Also, all sysctls in the da(4) and cd(4) drivers are accessible as loader tunables now. For the rest, see the commit message below. Let me know if you see any problems resulting from this commit. Ken ----- Forwarded message from "Kenneth D. Merry" ----- From: "Kenneth D. Merry" Date: Thu, 20 Feb 2003 22:19:38 -0800 (PST) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/dev/ata atapi-cam.c src/sys/dev/usb umass.c src/sys/cam/scsi scsi_all.c scsi_all.h scsi_cd.c scsi_cd.h scsi_da.c ken 2003/02/20 22:19:38 PST Modified files: sys/dev/ata atapi-cam.c sys/dev/usb umass.c sys/cam/scsi scsi_all.c scsi_all.h scsi_cd.c scsi_cd.h scsi_da.c Log: 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 Revision Changes Path 1.39 +31 -4 src/sys/cam/scsi/scsi_all.c 1.22 +17 -0 src/sys/cam/scsi/scsi_all.h 1.72 +925 -264 src/sys/cam/scsi/scsi_cd.c 1.7 +54 -31 src/sys/cam/scsi/scsi_cd.h 1.127 +89 -8 src/sys/cam/scsi/scsi_da.c 1.13 +0 -30 src/sys/dev/ata/atapi-cam.c 1.76 +0 -27 src/sys/dev/usb/umass.c ----- End forwarded message ----- -- Kenneth Merry ken@kdm.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message