Commit Graph

676 Commits

Author SHA1 Message Date
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
73cf209ffb Put a bit of hysteresis into both BUSY SCSI status returns
and CAM_RESRC_UNAVAIL returns. Delay a tunable amount for
either between retries.

This came up because the MPT IOC was returning "IOC out of
resources" for some user and this caused a CAM_RESRC_UNAVAIL
return. Putting a bit of delay between retries helped them
out.

There was some discussion that an async event should be used
to clear CAM_RESRC_UNAVAIL. That's probably a better notion
eventually.

Reviewed by:	scsi@freebsd.org (ade, scott)
MFC after:	1 week
2006-10-01 20:23:50 +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
Matt Jacob
1190a85bef New Dell 1950/2950 SES backplane drops off the bus if you poke
at greater then lun 0.

MFC after:	1 week
2006-09-16 17:35:47 +00:00
Matt Jacob
9fdecced07 null commit to provide commit message to previous
at the request of Sam Leffler: The previous commit
established min and maxtags for VMware pseudo disks
to fix a submitted PR.
2006-09-11 17:57:23 +00:00
Matt Jacob
df4b14f436 PR: 103130
Submitted by:	Shusuke Shinomiya
MFC after:	1 day
2006-09-11 17:34:28 +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
5ce1b00496 Grumble. VMWare ESX and VMWare WorkStation have *slightly* different
inquiry data (pointlessly different I might add). Pick the common
parts.

MFC after:	1 day
2006-06-26 05:41:11 +00:00
Matt Jacob
015a972c95 VMware disk volumes are only on LUN 0, and
some VMware HBAs have known bugs with commands
sent to other than LUN 0.

MFC after:	1 day
2006-06-24 16:40:59 +00:00
Matt Jacob
c1c3139ed3 Add PIM_SEQSCAN for HBA misc flags and code that understands
what to do with it.

This forces us to scan targets sequentially, not in parallel.
The reason we might want to do this is that SPI negotiation
might not work right at the SIM level if we try to do it
in parallel. We *could* fix this for each SIM where this is
broken, but it's a lot harder to do that when we can simply
ask CAM to probe sequentially.

If PIM_SEQSCAN is not set (default), the original behaviour for
probing is unchanged.

LUN probing is still done in parallel for each target in either
case.

While we're at it, clean up some resource leakage for error
cases.

Reviewed by:	ken, scott, scsi@
MFC after:	1 week
2006-06-05 22:22:14 +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
21370dfcff Sorry- last delta was checked in by mistake. 2006-05-24 15:23:27 +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
Poul-Henning Kamp
c40da00ca3 Since DELAY() was moved, most <machine/clock.h> #includes have been
unnecessary.
2006-05-16 14:37:58 +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
Matt Jacob
bae3cbf075 Do more guarding against zero divide traps for the geom subroutine. 2006-04-18 21:53:39 +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
c4270cb6d7 CAM_NEW_TRAN_CODE placeholders for SAS support.
Reviewed by:	nate, ken, justin
MFC after:	1 month
2006-01-20 19:21:38 +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
Ian Dowse
d3ef345454 When deregistering a bus, attempt to flush out all outstanding
operations before returning. Point the bus at a dummy cam_sim
structure so that any CCBs will complete immediately with a
CAM_DEV_NOT_THERE status, and ensure that any xpt_schedule() calls
on the bus's devices will immediately call the peripheral's
periph_start() routine. Also repeat the async messages because
devices that were part of the way through being probed may appear
after the original AC_LOST_DEVICE was sent, and would otherwise
never go away.

These changes make it possible to deregister a bus and free the SIM
at most stages during bus probing without the usual crashes in
camisr(). In particular, plugging in a umass device and then
unplugging it as soon as the first probe messages appeared would
almost always result in a crash. Now the device just goes away with
a few CAM errors and all references to the CAM bus, target and
device are dropped correctly.
2006-01-11 02:06:08 +00:00
Ian Dowse
9a014e6f69 There should be no need to retry when the CCB status code is
CAM_LUN_INVALID or CAM_TID_INVALID. Retries were being triggered
here when a umass device was unplugged, and while the retries
themselves are probably harmless, they complicated finding the real
SIM removal problems.
2006-01-08 20:04:55 +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
Matt Jacob
3b87a552e4 Make the exploring of all luns supported by an HBA more of a
tunable (until we get REPORT LUNS in place).

If we're probing luns, and each probe succeeds, we keep going past
lun 7 if we're a SCSI3 or better device (until we fail to probe).

If we're probing luns, and a probe fails, we only keep going if
we're quirked *for* it (CAM_QUIRK_HILUNS), and if we're not quirked
*against* it (CAM_QUIRK_NOHILUNS), or we're a SCSI3 or better device
and the tunable (kern.cam.cam_srch_hi) is set non-zero.

Reviewed by:	nate@rootlabs.org, gibbs@scsiguy.com, ken@kdm.com, scottl@samsco.org
MFC after:	1 week
2005-09-16 01:26:17 +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
Tai-hwa Liang
7c20d5d795 Fixing a memory leak in xpt_release_device(), which can be quickly
(depends on how many memory you have) observed through "tar -tvf /dev/sa0."

   Without this patch, RELENG_5 and HEAD panics with something like:

     kmem_malloc(4096): kmem_map too small: 42258432 total allocated

   RELENG_4 doesn't panic but spews following errors:

     camq_init: - cannot malloc array!

Reviewed by:	gibbs, scottl
Approved by:	re (scottl)
MFC after:	3 days
2005-06-24 08:09:05 +00:00
Pawel Jakub Dawidek
965d0c7edc Add a quirk for my pen-drive. 2005-06-09 17:35:04 +00:00
Alexander Kabaev
693937214b Do not initialize path variable with useless value just before
xpt_create_path overwrites it anyway.

Noticed by:     Coverity Prevent analysis tool
2005-05-11 17:39:33 +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