Commit Graph

154 Commits

Author SHA1 Message Date
Nate Lawson
b4ea9fb547 Sort quirks into sections. 2003-08-25 18:14:43 +00:00
Nate Lawson
72c5c840ff Add the DA_Q_NO_PREVENT quirk which keeps da(4) from sending PREVENT/ALLOW
commands.  Add a quirk for the Creative Nomad MuVo USB device that uses
it as well as NO_SYNCHRONIZE_CACHE.

PR:		kern/53094
Submitted by:	Richard Nyberg <rnyberg@it.su.se>
MFC after:	3 days
2003-08-22 16:35:53 +00:00
Nate Lawson
6c3bdd6dee Quirk for Jungsoft NEXDISK USB flash key. Fails to mount without
NO_SYNCHRONIZE_CACHE.

PR:		kern/54737
Submitted by:	David Thiel <lx@redundancy.redundancy.org>
MFC after:	3 days
2003-08-22 05:58:23 +00:00
Nate Lawson
e1dca0e939 Add quirks for the EXATELECOM i-Bead mp3 player.
PR:		kern/51675
Submitted by:	Nicolas Jombart <ecu@ipv42.net>
MFC after:	3 days
2003-08-22 05:43:30 +00:00
Nate Lawson
370f5d5b0f Remove all USB quirks that only specify DA_Q_NO_6_BYTE. They are no longer
needed.  Other USB quirks remain in hopes that user testing will reveal
which ones are also no longer needed.

Courtesy of:	USENIX lunch break
2003-08-06 17:30:03 +00:00
Nate Lawson
a70515e217 Remove unused cmd6workaround() calls.
MFC after:	1 day
2003-08-06 14:24:16 +00:00
Nate Lawson
dda5f182ae Fix the new DA_OLD_QUIRKS option for normal and module compiles.
Pointed out by: 	bde
2003-07-29 18:08:16 +00:00
Nate Lawson
af991a6d16 Deprecate USB and Firewire quirks. We should now never send 6 byte commands
to such devices.  If a device fails due to this commit, add:
   options DA_OLD_QUIRKS
to the kernel config and recompile.  Then send the output of "camcontrol
inquiry da0" to scsi@freebsd.org so the quirk can be re-enabled.
2003-07-29 04:32:33 +00:00
Nate Lawson
1deac58179 Add a PATH_INQ flag, PIM_NO_6_BYTE, which indicates the SIM never wishes to
receive 6 byte commands.  Add a check for this flag to da(4) and cd(4) so
that they honor it.  This is a quick workaround for many devices (especially
USB) that require da(4) quirks to operate.  The more complete approach is
to finish the new transport code which will be aware of the SCSI version a
transport implements.

MFC after:	1 day
2003-07-28 06:15:59 +00:00
Thomas Quinot
95f4c5d29d Reference PR for IntelligentStick quirk entry.
PR:		kern/53005
2003-07-18 16:26:36 +00:00
Thomas Quinot
c679659e75 Add quirk entry for IntelligentStick disc-on-key USB devices.
Reported by Samuel Tardieu <sam@rfc1149.net>.

Reviewed by:	roberto
MFC after:	1 week
2003-07-17 15:33:08 +00:00
David E. O'Brien
ee709e7024 Use __FBSDID(). 2003-06-10 18:14:05 +00:00
Nate Lawson
f410510b09 Add a quirk for OTi USB flash key.
PR:		kern/51825
Approved by:	re (rwatson)
2003-05-15 17:35:35 +00:00
Kenneth D. Merry
3674802f42 Fix three problems in large (>2TB) device handling:
- Make sure we don't release the READ CAPACITY CCB twice
 - If we have a device that needs a 16 byte READ CAPACITY command, make
   sure we call xpt_schedule() so we can get a CCB.
 - Don't unlock the peripheral until we're fully probed.

Many thanks to Julian Elischer for providing hardware and testing this.

Tested by:	julian
2003-05-03 00:21:40 +00:00
Kenneth D. Merry
512563b060 Fix compile errors on ia64 in dagetcapacity. Set block_len and maxsector
to 0 initially.  It seems that the ia64 backend isn't as "smart" as the
i386 backend, which realized that those variables were only set or used
when error == 0, and thus were not used uninitialized.
2003-05-01 05:16:13 +00:00
Poul-Henning Kamp
2c50682195 Use %j instead of %q in printf to unbreak sparc64. 2003-04-30 13:36:51 +00:00
Kenneth D. Merry
260cc4834d Add support to CAM for devices with more than 2^32 blocks. (2TB if you're
using 512 byte blocks).

cam_ccb.h:	Bump up volume_size and cylinders in ccb_calc_geometry to
		64 bits and 32 bits respectively, so we can hold larger
		device sizes.  cylinders would overflow at about 500GB.
		Bump CAM_VERSION for this change.  Note that this will
		require a recompile of all applications that talk to the
		pass(4) driver.

scsi_all.c:	Add descriptions for READ/WRITE(16), update READ/WRITE(12)
		descriptions, add descriptions for SERVICE ACTION IN/OUT.
		Add a new function, scsi_read_capacity_16(), that issues
		the read capacity service action.  (Necessary for arrays
		larger than 2^32 sectors.)  Update scsi_read_write() to use
		a 64 bit LBA and issue READ(16) or WRITE(16) if necessary.
		NOTE the API change.  This should be largely transparnet
		to most userland applications at compile time, but will
		break binary compatibility.  The CAM_VERSION bump, above,
		also serves the purpose of forcing a recompile for any
		applications that talk to CAM.

scsi_all.h:	Add 16 byte READ/WRITE structures, structures for 16 byte
		READ CAPACITY/SERVICE ACTION IN.  Add scsi_u64to8b() and
		scsi_8btou64.

scsi_da.c:	The da(4) driver probe now has two stages for devices
		larger than 2TB.  If a standard READ CAPACITY(10) returns
		0xffffffff, we issue the 16 byte version of read capacity
		to determine the true array capacity.  We also do the same
		thing in daopen() -- use the 16 byte read capacity if the
		device is large enough.

		The sysctl/loader code has also been updated to accept
		16 bytes as a minimum command size.
2003-04-30 00:35:22 +00:00
Nate Lawson
edae7ea680 SCSI Quirks for:
Casio QV-R3 USB camera, which appears to use a Pentax chipset
    M-Systems DiskOnKey USB flash key
    Feiya "slider" dual-slot flash reader
    SmartDisk (Mitsumi) USB floppy drive

PR:		kern/46545, kern/47793, kern/50020, kern/50226
2003-04-27 20:47:06 +00:00
Poul-Henning Kamp
2b69c2d76a Remove the unused ioctl routine. 2003-04-12 08:44:54 +00:00
Poul-Henning Kamp
891619a66d Use bioq_flush() to drain a bio queue with a specific error code.
Retain the mistake of not updating the devstat API for now.

Spell bioq_disksort() consistently with the remaining bioq_*().

#include <geom/geom_disk.h> where this is more appropriate.
2003-04-01 15:06:26 +00:00
Kenneth D. Merry
461dddba27 Clean up dynamically allocated sysctl variables when we run dacleanup() and
cdcleanup().  This fixes sysctl problems ("can't re-use a leaf") when
someone adds another peripheral at the same unit number.  (e.g. rescan da0,
it goes away, then rescan again and da0 comes back, but since we haven't
cleaned up the sysctl variables from the last da0 instance, we can't
register the variables for the new instance under the same name.)

Reported by:	njl
Tested by:	njl
2003-03-26 04:38:39 +00:00
Poul-Henning Kamp
0be3115328 Don't use the devstat->busy_count for state decisions in the device
drivers.  Doing so imposes atomicity and locking constraints on the
devstat API.

By:	ken
2003-03-15 11:00:56 +00:00
Nate Lawson
bdc321a648 Quirk for SanDisk ImageMate II compact flash reader
PR:		kern/47877
Submitted by:	Mike Durian <durian@boogie.com>
MFC after:	3 days
2003-03-11 02:07:17 +00:00
Nate Lawson
2a7e0bee37 Quirk for Pentax Optio 230 USB camera. Note that other products probably
use the underlying AsahiOptical USB chip and thus this quirk may need to
be generalized in the future.

PR:		kern/46369
Submitted by:	Tim Vanderhoek <vanderh@ecf.utoronto.ca>
MFC After:	3 days
2003-03-11 01:55:11 +00:00
Poul-Henning Kamp
60794e0478 Centralize the devstat handling for all GEOM disk device drivers
in geom_disk.c.

As a side effect this makes a lot of #include <sys/devicestat.h>
lines not needed and some biofinish() calls can be reduced to
biodone() again.
2003-03-08 08:01:31 +00:00
Poul-Henning Kamp
f64bbf8b61 NO_GEOM cleanup:
Move to "struct disk *" centric api.
2003-02-25 22:06:21 +00:00
Poul-Henning Kamp
2c6b49f6af NO_GEOM cleanup:
Retire the "d_dump_t" and use the "dumper_t" type instead.

Dumper_t takes a void * as first arg which is more general than the
dev_t taken by d_dump_t.  (Remember: we could have net-dumpers if
somebody wrote us one!)

Define the convention for GEOM controlled disk devices to be that the
first argument to the dumper function is the struct disk pointer.

Change device drivers accordingly.
2003-02-21 19:00:48 +00:00
Poul-Henning Kamp
b82ff75854 NO_GEOM cleanup:
Change the argument to disk_destroy() to be the same struct disk * as
disk_create() takes.

This enables drivers to ignore the (now) bogus dev_t which disk_create()
returns.
2003-02-21 15:13:26 +00:00
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
Poul-Henning Kamp
2c71b5639f Announce our ability to do DFLTPHYS sized transfers. 2003-02-11 21:30:28 +00:00
Nate Lawson
4d8d31a7b4 Quirk for Lexar Media Jumpdrive
PR:		kern/47006
Tested by:	George Hartzell <hartzell@kestrel.alerce.com>
MFC after:	1 week
2003-02-09 21:49:45 +00:00
Poul-Henning Kamp
1686ac18f9 NO_GEOM cleanup: retire disk_invalidate() 2003-01-30 19:43:50 +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
Nate Lawson
ec693c0e79 Quirk for Sony USB disk-on-key device.
PR:		kern/46386
Submitted by:	dillon
MFC after:	3 days
2003-01-13 05:09:07 +00:00
Peter Wemm
586864e29d Back out last commit. 2003-01-06 19:30:21 +00:00
Peter Wemm
9bae481c37 Move dashutdown from SHUTDOWN_PRI_DEFAULT to SHUTDOWN_PRI_FIRST.
Otherwise, the scsi devices that it is trying to issue commands to may
have gone away.  This is what caused shutdown to hang on ia64 systems
with mpt scsi controllers.  The bus system has torn down the device tree
and reset the mpt controller etc, and suddenly along comes dashutdown
and wants to issue a few more scsi commands....  <HANG!>

This shouldn't work on i386 either, but it seems to work solely due
to luck.
2003-01-06 08:28:15 +00:00
Nate Lawson
6d82c6a622 Quirk for Memorybird pen drive
PR:		kern/34712
Submitted by:	Oliver Fromme <olli@lurza.secnetix.de>
MFC after:	3 days
2002-12-18 21:47:52 +00:00
Yaroslav Tykhiy
3aa2a1d0e4 Clear the "device open" flag in daopen() before returning a error,
so the device won't stay marked as open whereas it isn't.

Approved by:	re, njl
MFC after:	1 week
2002-12-12 18:09:35 +00:00
Yaroslav Tykhiy
b7c8a7976f Release the reference to the peripheral if returning a error.
That reference is to be held only if daopen() has been successful
and until daclose() releases it.  daclose() won't be called if
daopen() has failed, though.

Approved by:	re, njl
MFC after:	1 week
2002-11-29 15:40:10 +00:00
Nate Lawson
677152abc6 Whitespace cleanup that was missed by quirks commit 1.114 2002-11-23 23:25:56 +00:00
Nate Lawson
a35e039f69 Update quirks, adding PR references and fixing a capitalization mismatch.
PR:		kern/45494
Approved by:	re
2002-11-23 22:39:42 +00:00
Nate Lawson
9dbcd1ae75 Quirk for HP 315 USB Digital Camera
Submitted by:	Keith White <kwhite@uottawa.ca>
PR:		kern/41010

MFC after:	1 week
2002-10-17 18:04:41 +00:00
Poul-Henning Kamp
87d59d4d4b Use malloc(9)'s M_ZERO rather than explicit bzero(9) call. 2002-10-11 09:59:22 +00:00
Kenneth D. Merry
296b4b1692 Fix style problems in the quirk entry section.
MFC after:	2 weeks
2002-10-03 19:59:24 +00:00
Maxim Sobolev
c12958c403 Add quirks for DaisyTechnology PhotoClip camera.
Submitted by:	Olexander Kunitsa <kunia@istc.kiev.ua>
MFC after:	3 days
2002-10-01 15:42:04 +00:00
Guido van Rooij
467f686e93 Add quirk for Apacer HandyDrive
MFC after:	1 week
2002-09-30 10:11:34 +00:00
Poul-Henning Kamp
7812d86f03 (This commit touches about 15 disk device drivers in a very consistent
and predictable way, and I apologize if I have gotten it wrong anywhere,
getting prior review on a patch like this is not feasible, considering
the number of people involved and hardware availability etc.)

If struct disklabel is the messenger: kill the messenger.

Inside struct disk we had a struct disklabel which disk drivers used to
communicate certain metrics to the disklayer above (GEOM or the disk
mini-layer).  This commit changes this communication to use four
explicit fields instead.

Amongst the benefits is that the fields do not get overwritten by
wrong or bogus on-disk disklabels.

Once that is clear, <sys/disk.h> which is included in the drivers
no longer need to pull <sys/disklabel.h> and <sys/diskslice.h> in,
the few places that needs them, have gotten explicit #includes for
them.

The disklabel inside struct disk is now only for internal use in
the disk mini-layer, so instead of embedding it, we malloc it as
we need it.

This concludes (modulus any mistakes) the series of disklabel related
commits.

I belive it all amounts to a NOP for all the rest of you :-)

Sponsored by:   DARPA & NAI Labs.
2002-09-20 19:36:05 +00:00
Poul-Henning Kamp
34e63814be Don't use dkunit() to find out unit, we already have our softc pointer
where we can find it.

Don't call dkpart() just to print the result, it is constant.

Sponsored by:	DARPA & NAI Labs.
2002-09-20 16:25:16 +00:00
Nate Lawson
39c6a8beeb Updates to cmd6workaround:
* Only update cdb in place if not CDB_POINTER
* Correctly check for QFRZ before restarting CCB
* More accurate printf message
* style(9) changes at end

Patch tested successfully on Maxtor 4 G120J6 GAK8.
2002-08-16 22:05:19 +00:00