Commit Graph

251 Commits

Author SHA1 Message Date
Warner Losh
8bd73484dc Use the more specific 'EM732X' designation rather than * to disable sync
cache commands, per request from njl@.
2007-01-23 17:29:31 +00:00
Warner Losh
d5f2a6f556 Add quirk for EasyMP3 EM732X usb 2.0 flash mp3 player.
(It appears that the quirk proceedures link has disappeared and that
this PR complied with it, if there's a problem, please contact me).

PR: usb/96546
2007-01-22 04:34:03 +00:00
Matt Jacob
f0d9af51a1 Add an xpt_print function to reduce most of the xpt_print_path/printf
pairs. Convert the core code to use it.

Reviewed by:	scsi (various folks weighing in with good advice)
MFC after:	2 weeks
2006-12-05 07:45:28 +00:00
Maxim Konovalov
64d5b4fdad o Style: remove a w/space before a comma. 2006-11-26 17:18:31 +00:00
Maxim Konovalov
b18f224062 o Style(9): trim eol w/spaces, w/spaces to tabs, kill an empty line. 2006-11-26 17:15:54 +00:00
Maxim Konovalov
a9622c854a o Add a quirk for X-Micro Flash Disk.
PR:		usb/96901
Submitted by:	Szalai Andras
Reviewed by:	nate (a half of year ago)
MFC after:	3 weeks
2006-11-26 17:13:24 +00:00
Matt Jacob
84d67ea566 Add a tunable that allows one to turn off the automatic sending of
the ORDERED tag. This recoups significant performance gains for many
arrays.

The default is still to send out the ORDERED tag periodically.

Reviewed by:	scsi (justin+timeout)
2006-11-02 21:12:37 +00:00
Pawel Jakub Dawidek
9cd394ea96 Implement BIO_FLUSH handling for da(4), amr(4), ata(4) and ataraid(4).
Sponsored by:	home.pl
2006-10-31 21:19:25 +00:00
Florent Thoumie
f2322e0f52 Add a SCSI da(4) quirk for Rekam USB Camera.
PR:		usb/98713
Submitted by:	Alex <goo@t72.ru>
MFC after:	3 days
2006-10-07 19:04:23 +00:00
Florent Thoumie
41d810c6f4 Add SCSI da(4) quirk for the iRiver H10.
PR:		usb/102547
Submitted by:	Sven Esbjerg <freebsd-pr@xbsd.net>
MFC after:	3 days
2006-10-07 18:28:55 +00:00
Matt Jacob
059cce1a75 Don't allow attachment of disks that could cause GEOM to panic. 2006-09-16 21:21:07 +00:00
Xin LI
232e7000f5 Drop Giant before returning in error path, thus eliminates
two mutex leaks.

Submitted by:	Beyond Luo <fedora ercist iscas ac cn>
PR:		kern/100046
Reviewed by:	ken, scottl
2006-07-14 13:58:32 +00:00
Matt Jacob
9dcfabf816 Actually check to see if XPT_CALC_GEOMETRY had an error
and pick a bogus geometry if it had so we don't later
get a divide by zero trap.
2006-04-18 22:01:59 +00:00
Joerg Wunsch
d7dfbb6b44 Add reference to PR to TOSHIBA TransMemory quirk entry. 2006-03-18 21:13:14 +00:00
Florent Thoumie
f010421bda - Add a PR number for future reference.
Approved by:	njl
2006-03-18 18:28:13 +00:00
Joerg Wunsch
0f9f3dd16b Add the TOSHIBA TransMemory USB sticks to the list of devices that
hate "Synchronize cache" commands.

MFC after:	1 day
2006-03-13 22:26:33 +00:00
Florent Thoumie
b308457205 - Add a scsi_da.c and a umass.c quirk for Genesys 6-in-1 Card Reader.
Reported by:	anders on freebsd-usb@
Tested by:	anders
Approved by:	ssouhlal
MFC after:	3 days
2006-01-30 20:27:44 +00:00
Florent Thoumie
fa9d414d41 Add Product IDs :
- Sandisk Cruzer Micro 128MB [5]
- DANE-ELEC zMate 512MB USB flash drive [7]
- Attache 256MB USB 2.0 Flash Drive [8]
- Sandisk Cruzer Micro 256MB [9]

Add scsi_da.c quirks :
- Samsung USB key 128Mb [1]
- Kingston DataTraveler 2.0 [2]
- Creative MuVo Slim [3]
- United MP 5512 Portable MP3 Player [4]
- Sandisk Cruzer Micro 128MB [5], [9]
- PNY USB Flash keys [6], [7], [8]

Add umass.c quirks :
- Sandisk Cruzer Micro 128MB [5]
- DANE-ELEC zMate 512MB USB flash drive [7]
- Attache 256MB USB 2.0 Flash Drive [8]
- Sandisk Cruzer Micro 256MB [9]

PR:		usb/90081 [1],
		usb/89196 [2],
		kern/86131 [3],
		usb/80487 [4],
		usb/75970 [5],
		usb/75578 [6],
		usb/72344 [7],
		usb/65436 [8],
		usb/70835 [9]
Submitted by:	Henri-Pierre CHARLES <hpc@prism.uvsq.fr> [1],
		Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua> [2],
		Erich Rickheit KSC <rickheit-fbp@numachi.com> [3],
		tnu@chania.di.uoa.gr [4],
		Bram Abbekerk <bram@abbekerk.demon.nl> [5],
		Thomas Pornin <pornin@bolet.org> [6],
		parv <parv@pair.com> [7],
		Peter D. Quilty <pdquilty@adelphia.net> [8],
		Raymundo M. Vega <rvega@ms-smtp-03-eri0.socal.rr.com> [9]
Approved by:	iedowse
MFC after:	3 days
2006-01-26 00:35:54 +00:00
Marcus Alves Grando
fa1d87f552 Allow to use Time DPA20B 1GB MP3 Player [1]
Allow to use Qware BeatZkey! Pro [2]

PR:             usb/81846 [1], usb/79164 [2]
Submitted by:   Ruben de Groot <rdg@bzerk.org> [1], Radek Kozlowski <radek@raadradd.com> [2]
Approved by:    njl
MFC:            1 week
2006-01-13 11:33:40 +00:00
Pawel Jakub Dawidek
1236085a67 Style nit. 2005-12-19 03:43:48 +00:00
Pawel Jakub Dawidek
ef5d77f464 Allow to use TransFlash drive, which can be found in Motorola E398 Mobile Phone.
PR:		usb/89889
Submitted by:	Wojciech A. Koszek <dunstan@freebsd.czest.pl>
MFC after:	1 week
2005-12-19 03:27:28 +00:00
John Polstra
a7e69e8b7d Fix a bug that caused some /dev entries to continue to exist after
the underlying drive had been hot-unplugged from the system.  Here
is a specific example.  Filesystem code had opened /dev/da1s1e.
Subsequently, the drive was hot-unplugged.  This (correctly) caused
all of the associated /dev/da1* entries to be deleted.  When the
filesystem later realized that the drive was gone it closed the
device, reducing the write-access counts to 0 on the geom providers
for da1s1e, da1s1, and da1.  This caused geom to re-taste the
providers, resulting in the devices being created again.  When the
drive was hot-plugged back in, it resulted in duplicate /dev entries
for da1s1e, da1s1, and da1.

This fix adds a new disk_gone() function which is called by CAM when a
drive goes away.  It orphans all of the providers associated with the
drive, setting an error condition of ENXIO in each one.  In addition,
we prevent a re-taste on last close for writing if an error condition
has been set in the provider.

Sponsored by:   Isilon Systems
Reviewed by:    phk
MFC after:      1 week
2005-11-18 02:43:49 +00:00
Pawel Jakub Dawidek
965d0c7edc Add a quirk for my pen-drive. 2005-06-09 17:35:04 +00:00
Doug White
2891ace6c8 Add quirk for TEAC USB floppy drives. 2005-05-05 18:48:41 +00:00
Matt Jacob
cd6640869b Take constructive advice from njl && reformat
previously added quirks slightly.
2005-04-14 04:46:46 +00:00
Nate Lawson
bc82a81ab5 Quirk for ZICPlay USB MP3 Player.
PR:		kern/75057
Submitted by:	Aurelien Nephtali <aurelien.nephtali wanadoo.fr>
2005-04-14 04:31:48 +00:00
Matt Jacob
4a296eb866 Apply quirk.
PR:		57469
Submitted by:	walter@pelissero.de
MFC after:	1 week
2005-04-14 04:12:45 +00:00
Matt Jacob
dbd93079d3 Applied conservative version of suggested quirk.
PR:		57468
Submitted by:	walter@pelissero.de
MFC after:	1 week
2005-04-14 04:05:00 +00:00
Matt Jacob
b1ce2b3e22 Apply quirk suggested by submitter.
PR:		75486
Submitted by:	no_bs@web.de
MFC after:	1 week
2005-04-14 03:59:48 +00:00
Warner Losh
898b0535b7 Start each of the license/copyright comments with /*- 2005-01-05 22:34:37 +00:00
Dag-Erling Smørgrav
0eac4495db Remove the HW_WDOG option; it serves no purpose.
MFC after:	3 days
2004-08-29 11:10:09 +00:00
MIHIRA Sanpei Yoshiro
58e8a8006a add support Frontier Labs NEX IA+ Digital Audio Player with USB CF card reader/writer
PR:		kern/70158
Submitted by:	Bernd Strau. <no_bs@web.de>
MFC after:	1 week
2004-08-12 23:17:09 +00:00
MIHIRA Sanpei Yoshiro
92c7375fb6 Add support iRiver iFP MP3 player
PR:		kern/54881, i386/63941, kern/66124
Submitted by:	Magnus <bsdhead.at.spray.dot.se@FreeBSD.org>,
		Dmitry Dyomin <old@old.com.ua>,
		Dmitry Sivachenko <mitya@demos.su>
MFC after:	1 week
2004-08-08 09:08:37 +00:00
MIHIRA Sanpei Yoshiro
ab625e4edf Quirk for SEGRAND NP-900 USB MP3Player
PR:		kern/64563
Submitted by:	Kunitada Kokubun <unix_grandy@yahoo.co.jp>
MFC after:	1 week
2004-07-18 05:39:14 +00:00
Nate Lawson
d5ed156998 Quirk for Neuros USB audio device.
PR:		kern/63645
Submitted by:	Aron Stansvik <elvstone@osdever.net>
2004-05-02 19:24:23 +00:00
Maxime Henrion
9b64d23770 The opt_da.h file doesn't exist anymore since the DA_OLD_QUIRKS option
has been removed.  Unbreak the build by not including it anymore.
2004-04-19 13:38:10 +00:00
Nate Lawson
f663ded69d Add miscellaneous USB device quirks.
PR:		kern/53067
PR:		kern/54737
PR:		kern/54786
PR:		kern/57046

MFC after:	1 day
2004-04-19 04:14:09 +00:00
Nate Lawson
60305ca7c4 Remove all quirks hidden under DA_OLD_QUIRKS. 2004-04-19 03:34:28 +00:00
Colin Percival
fa81466148 Check that periph is non-NULL before dereferencing it.
Reported by:	"Ted Unangst" <tedu@coverity.com>
Approved by:	rwatson (mentor), ken (scsi@)
2004-02-22 01:14:54 +00:00
Poul-Henning Kamp
0b7ed341e1 Change the disk(9) API in order to make device removal more robust.
Previously the "struct disk" were owned by the device driver and this
gave us problems when the device disappared and the users of that device
were not immediately disappearing.

Now the struct disk is allocate with a new call, disk_alloc() and owned
by geom_disk and just abandonned by the device driver when disk_create()
is called.

Unfortunately, this results in a ton of "s/\./->/" changes to device
drivers.

Since I'm doing the sweep anyway, a couple of other API improvements
have been carried out at the same time:

The Giant awareness flag has been flipped from DISKFLAG_NOGIANT to
DISKFLAG_NEEDSGIANT

A version number have been added to disk_create() so that we can detect,
report and ignore binary drivers with old ABI in the future.

Manual page update to follow shortly.
2004-02-18 21:36:53 +00:00
Paul Saab
da0cc5d3ff Move the ciss quirk to the right section, also update the comment
stating that the controllers do not support SYNC CACHE since ciss
only supports a small subset of the scsi spec.
2003-12-08 06:29:38 +00:00
Paul Saab
284af83b2a ciss doesn't like scsi SYNC CACHE. turn it off 2003-12-08 05:14:13 +00:00
Thomas Quinot
28cd624700 (dacleanup, dasysctlinit): Defend against calling sysctl_ctx_free on
an uninitialized sysctl_ctx, using flag DA_FLAG_SCTX_INIT. This
 prevents a panic encoutered with some umass units that probe correctly
 but fail to attach. Same problem, and same fix, as scsi_cd.c rev. 1.86.

Reviewed by:	njl, ken
2003-10-08 07:12:30 +00:00
Nate Lawson
f3e99b763a Remove the quirk for the FujiFilm camera. Submitter indicates it is now
working without the quirk.

PR:
Submitted by:	guido
Reviewed by:
Approved by:
Obtained from:
MFC after:	30 days
2003-09-04 01:01:20 +00:00
Kenneth D. Merry
700a0cbaca Unbreak buildworld. sys/taskqueue.h is a kernel-only include.
Pointy Hat to:	ken
2003-09-03 12:31:03 +00:00
Kenneth D. Merry
cb32189e23 Move dynamic sysctl(8) variable creation for the cd(4) and da(4) drivers
out of cdregister() and daregister(), which are run from interrupt context.

The sysctl code does blocking mallocs (M_WAITOK), which causes problems
if malloc(9) actually needs to sleep.

The eventual fix for this issue will involve moving the CAM probe process
inside a kernel thread.  For now, though, I have fixed the issue by moving
dynamic sysctl variable creation for these two drivers to a task queue
running in a kernel thread.

The existing task queues (taskqueue_swi and taskqueue_swi_giant) run in
software interrupt handlers, which wouldn't fix the problem at hand.  So I
have created a new task queue, taskqueue_thread, that runs inside a kernel
thread.  (It also runs outside of Giant -- clients must explicitly acquire
and release Giant in their taskqueue functions.)

scsi_cd.c:	Remove sysctl variable creation code from cdregister(), and
		move it to a new function, cdsysctlinit().  Queue
		cdsysctlinit() to the taskqueue_thread taskqueue once we
		have fully registered the cd(4) driver instance.

scsi_da.c:	Remove sysctl variable creation code from daregister(), and
		move it to move it to a new function, dasysctlinit().
		Queue dasysctlinit() to the taskqueue_thread taskqueue once
		we have fully registered the da(4) instance.

taskqueue.h:	Declare the new taskqueue_thread taskqueue, update some
		comments.

subr_taskqueue.c:
		Create the new kernel thread taskqueue.  This taskqueue
		runs outside of Giant, so any functions queued to it would
		need to explicitly acquire/release Giant if they need it.

cd.4:		Update the cd(4) man page to talk about the minimum command
		size sysctl/loader tunable.  Also note that the changer
		variables are available as loader tunables as well.

da.4:		Update the da(4) man page to cover the retry_count,
		default_timeout and minimum_cmd_size sysctl variables/loader
		tunables.  Remove references to /dev/r???, they aren't used
		any longer.

cd.9:		Update the cd(9) man page to describe the CD_Q_10_BYTE_ONLY
		quirk.

taskqueue.9:	Update the taskqueue(9) man page to describe the new thread
		task queue, and the taskqueue_swi_giant queue.

MFC after:	3 days
2003-09-03 04:46:28 +00:00
Nate Lawson
486d7256a3 Remove quirk for Apacer Handydrive. Kevin Oberman <oberman@es.net> reports
that it works without the quirk.  This and any other quirk changes will be
MFCd after the release unless they fix a known problem.

MFC after:	1 month
2003-08-25 18:48:45 +00:00
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
Nate Lawson
e2a5fdf911 Remove usage of cam_extend.c, replace with dev->si_drv1
PR:		kern/39809
Approved by:	gibbs
2002-08-15 20:54:03 +00:00
Matthew Dillon
9424cbcf69 PR: kern/38208
X-MFC after:	immediate w/ release eng approval.
2002-05-29 20:25:59 +00:00
Matthew Dillon
dae7ca35a3 Add a Quirk entry for the USB SimpleTech UCF-100 compact flash reader.
Note that even with the quirk entry the reader typically only works if
the USB device is recognized by UHCI instead of the generic OHCI driver.
2002-05-19 21:59:28 +00:00