Commit Graph

76 Commits

Author SHA1 Message Date
Kenneth D. Merry
56eac725a3 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
2003-02-21 06:19:38 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
MIHIRA Sanpei Yoshiro
8541fbec79 Fix `umass0: BBB bulk-in clear stall failed, IOERROR' problem with
some USB devices.  (Make sure to set xfer data length when we force
a short inquiry.)

Obtained from: NetBSD(sys/dev/usb/umass_scsipi.c rev.1.8)
Original idea from: Shingo WATANABE <nabe@nabechan.org>
2003-02-04 13:45:41 +00:00
MIHIRA Sanpei Yoshiro
ab0a90de0a Remove duplicated entry
Put the Trek Smart Thumbdrives (8MB model) entry in the right place.
(Entries are sorted by vendor id).
2003-02-04 13:36:32 +00:00
Tom Rhodes
40cbf25dbb Add support for the Trek Thumbdrive 8MB USB Drive.
PR:		46004
Submitted by:	Brian J. McGovern <mcgovern@tick.beta.com> (original version)
2003-01-30 18:33:01 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Jens Schweikhardt
9d5abbddbf Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.
2003-01-01 18:49:04 +00:00
Matthew Dillon
6c82636572 Revert part of the last commit. Do not fake-up the cylinders to make
the sectors fit (at least, don't fake them up any more then they are
already faked up).
2002-12-22 04:46:44 +00:00
Matthew Dillon
cc7bab9032 Modify the fake cylinders calculation so it is >= the size of the device,
not < the size of the device.  This avoids geom complaints.

Fix a serious bug in the handling of the RS_NO_CLEAR_UA quirk.  When we
go and insert the test-unit-ready command the umass_cam_quirk_cb() function
sets the status as if the READ_CAPACITY command suceeded when, in fact, it
did not.  This leads to the CAM layer trying to use garbage in the return
buffer and panicing the system (or doing other bad things).

Add a quirk entry for MSYSTEMS DISK-ON-KEY, which is sold under the Sony
brand as a solid state disk-on-key usb device.  This device requires
several quirks to work properly.

Note that the disk-on-key device will not work properly until CAM also
gets a quirk entry for it, which has been submitted to the CAM maintainer,
and you may have to temporarily uncomment the DELAY() as well.  -current
does not properly wait for devices to power up so you may also have
to temporarily uncomment the DELAY(300000) to make your device work.
A solution must be found to that issue.

MFC after:	3 days
X-MFC note:	the quirk support must MFCd before this patch can be
2002-12-20 18:56:55 +00:00
Michael Reifenberger
ad59e7ecbd Reviewed by: n_hibma
MFC after:	2 weeks
fix XPT_CALC_GEOMETRY to fill in some reasonable values.
Inspired by aic/sbp.
2002-11-08 07:57:42 +00:00
Ian Dowse
9ce4f7a0f0 Specify the correct protocol for the Olympus C-1 camera. It appears
that this entry was accidentally given the wrong protocol in revision
1.61.

PR:		kern/42417
Submitted by:	"Moriki, Toshiomi" <toshiomi@whi.m-net.ne.jp>
2002-11-01 01:13:20 +00:00
Josef Karthauser
3b7efc56d0 Use the hw.usb sysctl tree instead of debug.usb.
Requested by:	imp
2002-08-08 12:05:51 +00:00
Josef Karthauser
528d1a7fbc Replace the FOO_DEBUG definitions with USB_DEBUG, and switch the
debugging levels to off by default.  Now that debug levels can be
tweaked by sysctl we don't need to go through hoops to get the
different usb parts to produce debug data.
2002-07-31 14:34:36 +00:00
Josef Karthauser
0e6b196686 Get bored with hard coded debug level variables and introduce a debug.usb
sysctl tree for tweaking them real-time.

Reviewed by:	iedowse
2002-07-31 13:33:55 +00:00
Nick Hibma
1a283dd436 clean up some KASSERTS. 2002-06-17 20:44:37 +00:00
Nick Hibma
eb38329015 Rewrite the probe routine. This makes adding drives and quirks more easy.
While there change a few names to less confusing ones.
2002-06-16 20:53:35 +00:00
John Baldwin
3aa68913bc Make this compile again when UMASS_DEBUG isn't defined. 2002-04-11 21:09:41 +00:00
Nick Hibma
b2f485ca0d Delay umass_cam_rescan by 200 ms to make sure attach is finished by the
time we tell CAM to rescan the bus. Together with the previous patch
this should avoid the problem where the devices would wedge because they
got spoken to over two different pipes.

Tested by:	Tomas Pluskal <plusik@pohoda.cz>
2002-04-11 10:34:15 +00:00
Nick Hibma
380ee390fd Postpone I/O to the device until attach has finished. This fixes
attachment after boot in some cases where the device gets confused if
spoken to over two different pipes simultaneously (resulting in TIMEOUT
errors on requesting INQUIRY data).

This solution is far from perfect, as after umass_attach has returned
the USB stack fetches the string descriptors in order for creating the
event that is sent to userland. It just makes the chances of collisions
less likely.

Tested by: 	Tomas Pluskal <plusik@pohoda.cz>
2002-04-10 13:22:12 +00:00
Josef Karthauser
a011c2e7a8 MFNetBSD: Update many URLs. 2002-04-01 21:13:22 +00:00
David E. O'Brien
06989891ed Fix warnings on 64-bit hosts. 2002-03-20 18:04:11 +00:00
Alfred Perlstein
e51a25f850 Remove __P. 2002-03-20 02:08:01 +00:00
Peter Wemm
0d87e7d007 Fix some gcc-3.1+ warnings:
warning: deprecated use of label at end of compound statement
umass.c:2626:46: multi-line string literals are deprecated
2002-03-19 23:20:21 +00:00
Nick Hibma
dfe6efdcae Clean up some debugging output.
Add function to display the CBI command block.
2002-02-19 10:53:25 +00:00
Guido van Rooij
a3e5380a47 1) Fix a debug statement by filling in its data before the printf in
stead of after
2) Honour NO_TEST_UNIT_READY quirk for atapi devices as well
3) Actually support FujiFilm FinePix 6800 camera's. Will very likely also
work for other FinePix models.

Based on a debug session about half a year ago with Nik Hibma.
MFC after:	2 weeks
2002-01-24 15:10:53 +00:00
Josef Karthauser
46c8c4207d Staticise a couple of things that shouldn't be leaked into the
kernel namespace.

Submitted by:	msmith
2002-01-08 10:32:33 +00:00
Josef Karthauser
2ba633961e Sync usb.h with NetBSD, apart from usb_device_info.speed, which
requires logic changes.  For now leave it as usb_device_info.lowspeed.
It will get addressed when the usb.c code is sync'd.
2002-01-02 20:16:53 +00:00
Josef Karthauser
0b4a107145 Revert part of the last commit. UIPROTO_MASS_BBB was renamed to
UIPROTO_MASS_BULK _after_ the previous change was made in NetBSD.
2002-01-02 18:36:46 +00:00
Josef Karthauser
5440b9801c Sync with NetBSD:
date: 2000/02/29 21:37:01;  author: augustss;  state: Exp;
	Distinguish between device and interface classes.
	(I finally found a document that said that they were different.)
2002-01-02 18:28:45 +00:00
John Baldwin
810ffc1e83 - Add a function to convert 6 byte SCSI commands for read, write, mode
sense, and mode select into their 10 byte equivalents.  Eventually the
  da(4) driver will become more intelligent about this, or at least allow
  umass(4) to pass quirks in directly.  However, this is a functional
  workaround until a better fix is implemented.
- Use the 6 to 10 conversion function to allow the ATAPI and UFI command
  sets to emulate 6 byte commands with 10 byte commands.
- Use the ATAPI command set rather than UFI for the ScanLogic SL11R-IDE
  as it supports the SYNCH_CACHE command.
- Enable ATAPI command set support.
- Pass READ/WRITE_12 commands through for UFI support as the UFI spec
  says they should be supported.
- Update a comment in the UFI translation function since we handle
  MODE_SELECT.
2001-12-18 07:55:17 +00:00
Mike Smith
ffb6d5ad8f The ScanLogic SL11R-IDE claims to be SCSI-compatible, but actually requires
the UFI command set.  Even with this patch, it's incredibly slow on my
laptop, but at least now it works.

Note that the drive is reported to CAM with the vendor and device IDs from
the device itself, forcing the user to patch the da(4) quirk table
manually.
2001-12-09 06:02:46 +00:00
Ian Dowse
1a24ca7a4b The Olympus C-1 digital camera uses a non-standard BBB command-status
signature, but otherwise behaves just like a normal USB mass-storage
device. Add a new quirk to cover this case, and enable it for C-1
cameras. The quirk enables translation from the C-1 signature to
the normal CSWSIGNATURE value.

Reviewed by:	n_hibma
2001-11-23 17:35:35 +00:00
Nick Hibma
4817ad7e09 Support for the HP 8200e CD writer. (commented out)
Submitted by:	Heath Nielson <heath@cs.byu.edu>
2001-08-21 22:03:18 +00:00
Nick Hibma
d815b123a2 Add support for the Microtech CameraMate.
Submitted by:		Phil Knaack <pknaack1@netscape.net>
Submitted by:		Jim Bryant <kc5vdj@yahoo.com>
2001-08-21 21:47:08 +00:00
Nick Hibma
924be33dc3 Deconfuse a debugging message. 2001-08-21 21:41:15 +00:00
Nick Hibma
bace1123c3 Add a quirk for drives that do not handle long inquiry data.
Add the entry for the Yano U640MO-03 MO drive. (ifdef-0-ed out for now)

Fix a hack were an original buffer was modified instead of copied
(cmd[] -> (*rcmd)[])

Submitted by:	Iwasa Kazmi <kzmi@ca2.so-net.ne.jp>
2001-01-08 00:25:52 +00:00
Nick Hibma
dbccc4a13a Add the Synchronize command to umass_atapi_transform. It seems to work
unmodified for ATAPI type devices.
2001-01-07 23:58:07 +00:00
Nick Hibma
1f125f1361 Print the correct value in a debugging printf.
Submitted by:	Iwasa Kazmi <kzmi@ca2.so-net.ne.jp>
2001-01-07 23:54:34 +00:00
Nick Hibma
c68067e92a 1) Return the requestad length - the transferred length as the residue,
instead of the requested length. Otherwise all transfers look like 0 byte
transfers to CAM.

Submitted by:	Iwasa Kazmi <kzmi@ca2.so-net.ne.jp>

2) Finalise the command in the case of CBI transfers with CCI (command
completion interrupt).

3) Remove a redundant bzero of a buffer.
2001-01-07 23:43:55 +00:00
Nick Hibma
95e5d98749 UMASS_DEBUG implemented panic(9).
PR:		24044
Submitted by:	Mike Bristow <mike@urgle.com>
2001-01-04 11:27:41 +00:00
Nick Hibma
ad979802f6 Initialise rcmdlen.
Submitted by:	Ian Dowse <iedowse@maths.tcd.ie>
2000-12-20 09:37:35 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +00:00
Nick Hibma
329474c7de Support for RBC devices, like Sony Memory Sticks.
Not extensively tested yet, so be warned.

Submitted by:	Gerd Knops <gerti@bitart.com>
2000-09-04 15:34:14 +00:00
Nick Hibma
50b37103a2 Fix up the command in the destination buffer, not the source.
This makes the conversion from Test-Unit-Ready to Start-Stop-Unit in the case
of SCSI (Iomega Zip drive) actually work.
2000-08-21 09:39:07 +00:00
Nick Hibma
74bd1c1038 CAM, the module: scbus, da, cd, and st wrapped in one module.
Make the umass driver depend on this module.

Makes it possible to compile the kernel without SCSI support and load it
when for example a USB floppy is conencted.
2000-08-13 18:49:40 +00:00
Nick Hibma
cad823f463 Fix indentation ruined by previous commit. 2000-08-11 16:37:43 +00:00
Nick Hibma
b40a42fbe8 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.
2000-08-09 17:41:11 +00:00
Steve Price
bf11d3dcda Spell the word 'limited' with only one 't'. 2000-07-30 17:54:34 +00:00
Nick Hibma
9d6eda11bc Remove the preliminary support for ATAPI. It does not work and breaks
(physically) IBM Microdrives.
2000-07-26 01:01:01 +00:00
Nick Hibma
4f04f78215 Remove __P prototypes to reduce diffs between the NetBSD and FreeBSD
versions.
2000-07-17 18:41:20 +00:00