Commit Graph

850 Commits

Author SHA1 Message Date
Alexander Motin
8691755dff MFp4:
Improve reporting ATA Status error details.
2009-11-03 11:19:05 +00:00
Andrew Thompson
bd6d02e7e9 Provide the same sanity check on the sector size in dagetcapacity as when the
disk is first probed. dagetcapacity is called whenever the disk is opened from
geom via d_open(), a zero sector size will cause geom to panic later on.
2009-11-02 23:30:15 +00:00
Alexander Motin
9efda2c908 The async callback could free the device. If it is a broadcast async,
it doesn't hold device reference, so take our own reference.

Submitted by:   thompsa
2009-11-02 08:31:00 +00:00
Alexander Motin
f98d7a47e2 MFp4:
Fix reference counting bug, when device unreferenced before then
invalidated. To do it, do not handle validity flag as another
reference, but explicitly modify reference count each time flag is
modified.

Discovered by:	thompsa
2009-11-01 11:31:06 +00:00
Alexander Motin
1e637ba677 MFp4:
- Reduce code duplication in ATA XPT and PMP driver.
- Move PIO size setting from ada driver to ATA XPT. It is XPT business
to negotiate transfer details. ada driver is now stateless.
- Report PIO size to SIM. It is required for correct PATA SIM operation.
- Tune PMP scan timings. It workarounds some problems with SiI.
- If reset hapens during PMP initialization - restart it.
- Introduce early-initialized periph drivers, which are used during initial
scan process. Use it for xpt, probe, aprobe and pmp. It gives pmp chance
to finish scan before mountroot and numerate devices in right order.
2009-10-31 10:43:38 +00:00
Alexander Motin
d521940e9a MFp4:
Ensure target/lun passed from user-level supported on this bus.
Scanning unsupported IDs causes different issues from duplicate
devices to system crash.
2009-10-31 09:03:48 +00:00
Alexander Motin
0f3e215954 Make "Retrying Command" to be printed before actual retrying.
It should make debug/error log a bit more readable.
2009-10-23 13:39:30 +00:00
Alexander Motin
65d0fb03ad MFp4:
Move Port Multiplier support code out of ATA XPT into pmp periph driver.
This is convinient, as PMP itself is a bus target and has own state.
2009-10-23 12:36:42 +00:00
Alexander Motin
48f2bfe224 Fix the build. 2009-10-23 11:26:58 +00:00
Alexander Motin
bbfa4aa1a6 Replace most of priority numbers with defines. No logical changes. 2009-10-23 08:27:55 +00:00
Alexander Motin
ee64944219 Remove some obsoleted comments. 2009-10-23 07:54:15 +00:00
Alexander Motin
20a7933f53 After thinking again, implement cam_ccbq_fini().
This is effectively NULL change, but makes this API a bit more consistent.
2009-10-22 21:07:32 +00:00
Alexander Motin
ab593611be cam_ccbq_fini() declared for 11 years, but never implemented. Remove it. 2009-10-22 20:44:55 +00:00
Christian Brueffer
e6fa23b0da Fix a memory leak in an error case.
PR:		138376
Submitted by:	Patroklos Argyroudis <argp@census-labs.com>
Reviewed by:	scottl
MFC after:	1 week
2009-10-22 06:13:07 +00:00
Alexander Motin
c0d232d988 MFp4:
Do not search for bus when it is not needed,
2009-10-21 15:57:16 +00:00
Alexander Motin
4b997c49c0 MFp4:
Separate CAM_DEV_IDENTIFY_DATA_VALID flag from CAM_DEV_INQUIRY_DATA_VALID.
Add workaround for very old devices without support for mode setting.
Add some PATA bus scanning support.
Remove some SCSIsms.
2009-10-21 15:27:48 +00:00
Alexander Motin
46f118fe3f MFp4:
Add support for PIO-only devices.
Fix maxio values and 256 sectors transactions for 28bits commands.
Implement periodic ordered commands insertion, sames as da driver does.
Remove some SCSIsms.
2009-10-21 14:20:55 +00:00
Alexander Motin
8e7cccb3bd MFp4:
Report real max_target = 15. SIM doesn't need to know that target 15 is PMP.
It is XPT business.
2009-10-21 13:00:01 +00:00
Pawel Jakub Dawidek
9cdcd1c520 Export disk serial numbers for adaX disks.
Reviewed by:	mav
MFC after:	3 days
2009-10-09 09:29:59 +00:00
Alexander Motin
14a0f03de2 Report SATA 3.x devices. 2009-09-27 20:50:54 +00:00
Alexander Motin
01a967e266 MFp4:
If on sense request device returns no sence, give up and return,
or we may loop forever.
2009-09-22 22:23:52 +00:00
Matt Jacob
35589fc12f Remember to unlock the peripheral prior to notifying the user. Make some
allocations M_NOWAIT so that we don't try and sleep with a nested non-sleepable
lock.

This makes the userland scsi_target begin to function again.

Obtained from:	Sean Bruno
MFC after:	1 month
2009-09-19 20:25:54 +00:00
Kenneth D. Merry
5a73cc12bc Fix some instances where CAM rescans get hung up or take a long time to
complete.

Also, allow xpt_rescan() to rescan a LUN instead of a full bus.

MFC after:	3 days
Sponsored by:	Copan Systems, Inc.
2009-09-15 00:15:24 +00:00
Robert Watson
e76d823b81 Use C99 initialization for struct filterops.
Obtained from:	Mac OS X
Sponsored by:	Apple Inc.
MFC after:	3 weeks
2009-09-12 20:03:45 +00:00
Scott Long
216e03861c Free the correct buffer in an error case.
Submitted by:	phk
2009-09-08 16:09:28 +00:00
Poul-Henning Kamp
6778431478 Revert previous commit and add myself to the list of people who should
know better than to commit with a cat in the area.
2009-09-08 13:19:05 +00:00
Poul-Henning Kamp
b34421bf9c Add necessary include. 2009-09-08 13:16:55 +00:00
Alexander Motin
ee358e6376 MFp4:
Remove duplicate qfrozen_cnt variable from struct cam_ed.
ccbq.queue.qfrozen_cnt should be used instead.
2009-09-06 19:06:50 +00:00
Alexander Motin
f96d66a41e Remove unneeded CAM_SIM_MPSAFE check. 2009-09-06 18:59:46 +00:00
Alexander Motin
70f2d05499 s/bus %d/scbus%d/ in some messages to correct terminology. 2009-09-06 18:56:08 +00:00
Alexander Motin
ad41300955 MFp4:
Report scbusX in xpt_announce_periph() to less confuse users by two
different bus addressing schemes.
2009-09-06 18:48:18 +00:00
Alexander Motin
788fb3767d Avoid extra swi_sched() call, if this SIM is already queued.
It reduces overhead for coalesced command completions.
2009-09-06 18:40:48 +00:00
Pawel Jakub Dawidek
6cf918bc9b Make serial numbers of daX disks visible by GEOM.
No objections from:	scottl
Obtained from:		Wheel Sp. z o.o. (http://www.wheel.pl)
2009-09-04 09:40:59 +00:00
Alexander Motin
7606b4450b Short ATA command format has 28bit address, not 36bit.
Rename ata_36bit_cmd() into ata_28bit_cmd(), while it didn't become legacy.

MFC after:	2 days
2009-08-30 16:31:25 +00:00
Alexander Motin
1ddbcde832 ATA_FLUSHCACHE is a 36bit format command, not 48. 2009-08-30 15:36:56 +00:00
Stanislav Sedov
622247c0fb - Add quirk for Sony DSC digital cameras. This umass devices fail
to attach without these quirks applied.

PR:		usb/137035
URL:		http://lists.freebsd.org/pipermail/freebsd-current/2009-August/010852.html
Reported by:	Henri Hennebert <hlh@restart.be>, Andrey V. Elsukov <bu7cher@yandex.ru>
MFC after:	1 week
2009-08-26 21:14:28 +00:00
Alexander Motin
5daa555d8d Fix copy/paste bug, that requests data read during ATA device probe sequence
for ATA_SETFEATURES/ATA_SF_SETXFER command which by definition transfers no
data. Most of controllers are irrelevant to this bug, but some nVidia's
doesn't.

Tested on:	current@
Approved by:	re (kib)
2009-08-18 09:27:17 +00:00
Alexander Motin
33ea30fed7 Fix iSCSI initiator and vpo driver operation, broken by CAM changes.
Reviewed by:	scottl, Danny Braniss
Approved by:	re (rwatson)
2009-08-18 08:46:54 +00:00
Matt Jacob
2df76c160b Add 8Gb support (isp_2500). Fix a fair number of configuration and
firmware loading bugs.

Target mode support has received some serious attention to make it
more usable and stable.

Some backward compatible additions to CAM have been made that make
target mode async events easier to deal with have also been put
into place.

Further refinement and better support for NP-IV (N-port Virtualization)
is now in place.

Code for release prior to RELENG_7 has been stripped away for code clarity.

Sponsored by: Copan Systems

Reviewed by:    scottl, ken, jung-uk kim
Approved by:    re
2009-08-01 01:04:26 +00:00
Alexander Motin
b2da774623 Fix copy-paste bug. Use regular non-polled mode for executing FLUSHCACHE
command on disk close.

Approved by:	re (implicitly)
2009-07-17 21:48:08 +00:00
Ed Maste
c25ebae365 Change xpt_scan_bus to scsi_scan_bus and xpt_scan_lun to scsi_scan_lun
in comments and printfs to match new function names after refacoring.

Approved by:	re
2009-07-14 18:44:17 +00:00
Ed Maste
399831bce6 Fix leaks in probestart, probedone, and scsi_scan_bus. Also free
page_list using the matching malloc type for the allocation.

Approved by:	re
Reviewed by:	scottl [1]
MFC after:	1 week

[1] Original patch was against xpt_cam.c, prior to the cam refactoring.
2009-07-14 17:26:37 +00:00
Alexander Motin
3ccda2f312 Fix copy-paste bug, enabling SIM PMP support, when it was not really found.
Approved by:	re (implicitly)
2009-07-13 21:21:30 +00:00
Alexander Motin
f09f8e3e0b Rename ATA probe driver to "aprobe" to resolve name conflict with SCSI
and fix loading cam as module.

Approved by:	re (implicitly)
2009-07-13 06:12:21 +00:00
Scott Long
52c9ce25d8 Separate the parallel scsi knowledge out of the core of the XPT, and
modularize it so that new transports can be created.

Add a transport for SATA

Add a periph+protocol layer for ATA

Add a driver for AHCI-compliant hardware.

Add a maxio field to CAM so that drivers can advertise their max
I/O capability.  Modify various drivers so that they are insulated
from the value of MAXPHYS.

The new ATA/SATA code supports AHCI-compliant hardware, and will override
the classic ATA driver if it is loaded as a module at boot time or compiled
into the kernel.  The stack now support NCQ (tagged queueing) for increased
performance on modern SATA drives.  It also supports port multipliers.

ATA drives are accessed via 'ada' device nodes.  ATAPI drives are
accessed via 'cd' device nodes.  They can all be enumerated and manipulated
via camcontrol, just like SCSI drives.  SCSI commands are not translated to
their ATA equivalents; ATA native commands are used throughout the entire
stack, including camcontrol.  See the camcontrol manpage for further
details.  Testing this code may require that you update your fstab, and
possibly modify your BIOS to enable AHCI functionality, if available.

This code is very experimental at the moment.  The userland ABI/API has
changed, so applications will need to be recompiled.  It may change
further in the near future.  The 'ada' device name may also change as
more infrastructure is completed in this project.  The goal is to
eventually put all CAM busses and devices until newbus, allowing for
interesting topology and management options.

Few functional changes will be seen with existing SCSI/SAS/FC drivers,
though the userland ABI has still changed.  In the future, transports
specific modules for SAS and FC may appear in order to better support
the topologies and capabilities of these technologies.

The modularization of CAM and the addition of the ATA/SATA modules is
meant to break CAM out of the mold of being specific to SCSI, letting it
grow to be a framework for arbitrary transports and protocols.  It also
allows drivers to be written to support discrete hardware without
jeopardizing the stability of non-related hardware.  While only an AHCI
driver is provided now, a Silicon Image driver is also in the works.
Drivers for ICH1-4, ICH5-6, PIIX, classic IDE, and any other hardware
is possible and encouraged.  Help with new transports is also encouraged.

Submitted by:	scottl, mav
Approved by:	re
2009-07-10 08:18:08 +00:00
Konstantin Belousov
9f80ce043d Change the type of uio_resid member of struct uio from int to ssize_t.
Note that this does not actually enable full-range i/o requests for
64 architectures, and is done now to update KBI only.

Tested by:	pho
Reviewed by:	jhb, bde (as part of the review of the bigger patch)
2009-06-25 18:46:30 +00:00
Scott Long
571e8e20da Change cam_periph_ioctl() to take 'cmd' and a u_long instead of an
int.  All of its callers pass in cmd as a u_long, so this has
always been a dangerous type demotion.  It was spooted by clang/llvm
trying to do a type promotion and sign extension within
cam_periph_ioctl.

Submitted by:	rdivacky
2009-06-22 14:43:48 +00:00
Ed Schouten
912e4916d0 Include <camlib.h> for cam_path_string().
Submitted by:	Pawel Worach
2009-06-14 12:46:34 +00:00
Konstantin Belousov
d8b0556c6d Adapt vfs kqfilter to the shared vnode lock used by zfs write vop. Use
vnode interlock to protect the knote fields [1]. The locking assumes
that shared vnode lock is held, thus we get exclusive access to knote
either by exclusive vnode lock protection, or by shared vnode lock +
vnode interlock.

Do not use kl_locked() method to assert either lock ownership or the
fact that curthread does not own the lock. For shared locks, ownership
is not recorded, e.g. VOP_ISLOCKED can return LK_SHARED for the shared
lock not owned by curthread, causing false positives in kqueue subsystem
assertions about knlist lock.

Remove kl_locked method from knlist lock vector, and add two separate
assertion methods kl_assert_locked and kl_assert_unlocked, that are
supposed to use proper asserts. Change knlist_init accordingly.

Add convenience function knlist_init_mtx to reduce number of arguments
for typical knlist initialization.

Submitted by:	jhb [1]
Noted by:	jhb [2]
Reviewed by:	jhb
Tested by:	rnoland
2009-06-10 20:59:32 +00:00
Edward Tomasz Napierala
ee857ce73b Remove dead code.
Found with:	Coverity Prevent(tm)
CID:		3667
2009-05-12 16:38:32 +00:00