Commit Graph

490 Commits

Author SHA1 Message Date
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
Matt Jacob
2afca7acfb Initial cut at Basic Domain Validation- just add some states to
traverse through during probing.

Reviewed by:	scsi (scottl)
2006-12-04 23:04:13 +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
Nate Lawson
76f3dbcac7 Remove extra whitespace 2006-11-03 05:42:15 +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
Matt Jacob
bd3fd815a7 2nd and final commit that moves us to CAM_NEW_TRAN_CODE
as the default.

Reviewed by multitudes.
2006-11-02 00:54:38 +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
Matt Jacob
fa9ed86506 The first of 3 major steps to move the CAM layer forward to using
the CAM_NEW_TRAN_CODE that has been in the tree for some years now.

This first step consists solely of adding to or correcting
CAM_NEW_TRAN_CODE pieces in the kernel source tree such
that a both a GENERIC (at least on i386) and a LINT build
with CAM_NEW_TRAN_CODE as an option will compile correctly
and run (at least with some the h/w I have).

After a short settle time, the other pieces (making
CAM_NEW_TRAN_CODE the default and updating libcam
and camcontrol) will be brought in.

This will be an incompatible change in that the size of structures
related to XPT_PATH_INQ and XPT_{GET,SET}_TRAN_SETTINGS change
in both size and content. However, basic system operation and
basic system utilities work well enough with this change.

Reviewed by:	freebsd-scsi and specific stakeholders
2006-10-31 05:53:29 +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
Kenneth D. Merry
42cb6a80b6 Implement 'camcontrol reportluns'. This allows users to send the SCSI
REPORT LUNS command to a device.

camcontrol.[c8]:	Implement reportluns.  This tries to print the LUNs
			out in a reasonable format.  Only the periph
			addressing method has been tested, since very little
			hardware that I know of supports the other methods.

scsi_all.[ch]:		Revamp the report luns CDB structure and helper
			functions.  This constitutes a little bit of an API
			change, but since the old CDB length was 10 bytes,
			and the REPORT LUNS CDB length is actually 12 bytes,
			it's clear that no one was using this API in the
			first place.

MFC After:	1 week
2006-08-21 13:24:50 +00:00
John Baldwin
c6cb3ff429 access only has 2 esses.
MFC after:	3 days
2006-08-14 19:29:45 +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
4e359f5ad1 Handle some of the inquiry flags that have come into
usage as of SPC2r20. Specifically, handle the BQueue
flag which will indicate that a device supports the
Basic Queueing model (no Head of Queue or Ordered tags).
When this flag is set, SID_CmdQueue is clear. This has
causes FreeBSD to assume that the device did not support
tagged operations.

MFC after:	1 month
2006-05-30 22:44:00 +00:00
Matt Jacob
336b293c8f Forced commit - last checkin got away from me.
This version of scsi_target.c removes all SMP locking until
we have a lock-aware CAM stack. This allows us to use KNOTE
without a panic at least.

It's not yet clear whether target mode is working yet or not.

Discussed with: Scott, Ken, Nate, Justin
2006-05-24 15:26:07 +00:00
Matt Jacob
a62525f3c8 Make physical buffers in cam_periph_mapmem owned by the kernel in case we
return to user space w/o waiting for I/O to complete.

I tried to get several folks who know this code better than me to review it
with no luck. I *do* know that w/o this code, using the SCSI target driver
panics in userret (if it doesn't panic in knote first).
2006-05-24 15:22:21 +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
Maxim Konovalov
ae2772f800 o Do not double i/o stats for cd(4) already acounted in g_disk_done().
PR:		kern/95707
Submitted by:	Andre Albsmeier
Reviewed by:	phk
MFC after:	2 weeks
2006-04-17 09:12:53 +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
Matt Jacob
fba92123ac Fix ioctl to not get swallowed by ioctl code (i.e., make sure the darned
code sticks within 8 bits)

MFC after:	1 week
2006-01-18 08:37:27 +00:00
Matt Jacob
de8fa52e52 Incorporate the O_NONBLOCK open semantics of Linux and Solaris. This allows
an application to upon a tape (yea, even the non-control device) even if
it cannot establish a mount session. If the open cannot establish a mount
session and O_NONBLOCK was specified, the tape becomes 'open pending mount'.
All I/O operations that would require access to a tape thereafter until
a close attempt to initiate the mount session. If the mount session succeeds,
the tape driver transitions to full open state, else returns an appropriate
I/O error (ENXIO).

At the same time, add a change that remembers whether tape is being opened
read-only. If so, disallow 'write' operations like writing filemarks that
bypass the normal read-only filtering operations that happen in the write(2)
syscall.

Reviewed by:	ken, justin, grog
MFC after:	2 weeks
Suggested by:	The Bacula Team
2006-01-14 14:32:41 +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
Robert Watson
6a113b3de7 Merge the dev_clone and dev_clone_cred event handlers into a single
event handler, dev_clone, which accepts a credential argument.
Implementors of the event can ignore it if they're not interested,
and most do.  This avoids having multiple event handler types and
fall-back/precedence logic in devfs.

This changes the kernel API for /dev cloning, and may affect third
party packages containg cloning kernel modules.

Requested by:	phk
MFC after:	3 days
2005-08-08 19:55:32 +00:00
Suleiman Souhlal
571dcd15e2 Fix the recent panics/LORs/hangs created by my kqueue commit by:
- Introducing the possibility of using locks different than mutexes
for the knlist locking. In order to do this, we add three arguments to
knlist_init() to specify the functions to use to lock, unlock and
check if the lock is owned. If these arguments are NULL, we assume
mtx_lock, mtx_unlock and mtx_owned, respectively.

- Using the vnode lock for the knlist locking, when doing kqueue operations
on a vnode. This way, we don't have to lock the vnode while holding a
mutex, in filt_vfsread.

Reviewed by:	jmg
Approved by:	re (scottl), scottl (mentor override)
Pointyhat to:	ssouhlal
Will be happy:	everyone
2005-07-01 16:28:32 +00:00
Tai-hwa Liang
362abc449c - Providing fine-grained malloc statistic by replacing M_DEVBUF with
module-specific malloc types.  These should help us to pinpoint the
  possible memory leakage in the future.
- Implementing xpt_alloc_ccb_nowait() and replacing all malloc/free based
  CCB memory management with xpt_alloc_ccb[_nowait]/xpt_free_ccb.  Hopefully
  this would be helpful if someday we move the CCB allocator to use UMA
  instead of malloc().

Encouraged by:	jeffr, rwatson
Reviewed by:	gibbs, scottl
Approved by:	re (scottl)
2005-07-01 15:21:30 +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
e3e16e9998 Make sure we look at the correct sub op codes when
deciding whether it's an operation we can perform
via the control device.

PR:		kern/72010
MFC after:	1 week
2005-04-14 04:51:18 +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
Matt Jacob
8b11740052 The divide by zero panic must have been due to a bogus
period value. I suppose the BT adapter driver should be
fixed, but more importantly we should protect against
dividing by zero.

PR:		kern/75603
MFC after:	1 week
2005-04-14 03:52:50 +00:00
Sam Leffler
aadbcea379 avoid use after free
Submitted by:	gibbs
Reviewed by:	mdodd
Approved by:	Coverity Prevent analysis tool
2005-03-31 21:43:19 +00:00
Poul-Henning Kamp
f4f6abcb4e Explicitly hold a reference to the cdev we have just cloned. This
closes the race where the cdev was reclaimed before it ever made it
back to devfs lookup.
2005-03-31 12:19:44 +00:00
Kenneth D. Merry
53372d3a6d Fix a problem with the cd(4) driver -- the CAMGETPASSTHRU ioctl wouldn't
succeed if there was no media in the drive.

This was broken in rev 1.72 when the media check was added to cdioctl().

For now, check the ioctl group to decide whether to check for media or not.
(We only need to check for media on CD-specific ioctls.)

Reported by:	bland
MFC after:	3 days
2005-03-26 06:05:06 +00:00
Kenneth D. Merry
b3b73720f2 Fix a place where we were referencing a pointer after it had been freed.
Submitted by:	"Henry Miller" <hank@blackhole.com>
MFC after:	3 days
2005-03-26 04:21:11 +00:00
Scott Long
e3f3b2ed9f Don't free the SIM object twice.
Submitted by: Coverity Prevent analysis tool
2005-03-19 06:32:57 +00:00
Scott Long
38cedb4414 Reference a pointer correctly when copying to it's location.
Submitted by: Coverity Prevent analysis tool
2005-02-21 00:28:36 +00:00