Commit Graph

855 Commits

Author SHA1 Message Date
Alexander Motin
f0e624adf8 MFC r200668:
Remove duplicate devstat_start_transaction_bio() call. It is already called
from geom_disk. Dulicate call causes wrong queue depth and busy accounting.
2009-12-25 08:06:35 +00:00
Alexander Motin
e87bb38419 MFC r200218:
- Cleanup kernel messages, mostly PMP.
- Took references on devices, while PMP reinitializes them, to not let them
go and distort freeze reference counting.
2009-12-22 19:56:35 +00:00
Alexander Motin
71e7360ed9 MFC r200171, r200182, r200275, r200295, r200359:
Introduce ATA_CAM kernel option, turning ata(4) controller drivers into
cam(4) interface modules. When enabled, this option deprecates all ata(4)
peripheral drivers (ad, acd, ...) and interfaces and allows cam(4) drivers
(ada, cd, ...) and interfaces to be natively used instead.

As side effect of this, ata(4) mode setting code was completely rewritten
to make controller API more strict and permit above change. While doing
this, SATA revision was separated from PATA mode. It allows DMA-incapable
SATA devices to operate and makes hw.ata.(ata|atapi)_dma tunable work again.

Also allow ata(4) controller drivers (except some specific or broken ones)
to handle larger data transfers. Previous constraint of 64K was artificial
and is not really required by PCI ATA BM specification or hardware.

Submitted by:   nwitehorn (powerpc part)
2009-12-12 10:37:31 +00:00
Alexander Motin
cee2de6c2a MFC r200180:
If we panicked with SIM lock held, do not try to flush caches.
Extra lock recursing will not make debugging easier.
2009-12-11 12:53:09 +00:00
Alexander Motin
c0afc53a8f MFC r200008:
Add CAM_ATAIO_DMA ATA command flag to mark DMA protocol commands.
It is not needed for SATA controllers, but required for PATA.
2009-12-05 08:44:55 +00:00
Alexander Motin
03b5c37446 MFC r199747, r199799, r199821:
- Extend XPT-SIM transfer settings control API. Now it allows to report to
SATA SIM number of tags supported by each device, implement ATA mode and
SATA revision negotiation for both SATA and PATA SIMs.
- Make ahci(4) and siis(4) to use submitted maximum tag number, when
scheduling requests. It allows to support NCQ on devices with lower tags
count then controller supports.
- Make PMP driver to report attached devices connection speeds.
- Implement ATA mode negotiation between user settings, device and
controller capabilities.
- Improve ATA mode/SATA revision control.
2009-12-02 10:32:34 +00:00
Alexander Motin
7e7ac267c9 MFC r199279, r199280, r199281:
- Fix several device freeze counting bugs.
- Remove code that years ago was closing race between request submission
to SIM and device/SIM freeze. That race become impossible after moving from
spl to mutex locking, while this workaround causes some unexpected effects.
2009-12-02 10:10:37 +00:00
Alexander Motin
fbd6bbe74b MFC r199321:
Disable PortMultiplier Async Notifications for time of ports reset.
They are useless at that time, but confuse Marvell AHCI.

Add quirk for SiI57XX Port Multipliers, to hide extra port.
2009-11-23 17:54:57 +00:00
Alexander Motin
dbf0a1cd3e MFC r199263:
Do not enable tagged queueing if controller reports 0 tags support.
2009-11-17 21:26:05 +00:00
Alexander Motin
99695a07ce MFC r199178:
- Move tagged queueing control from ADA to ATA XPT. It allows to control
  device command queue length correctly. First step to support < 32 tags.
- Limit queue for non-tagged devices by 2 slots for ahci(4) and siis(4).
- Implement quirk matching for ATA devices.
- Move xpt_schedule_dev_sendq() from header to source file.
- Move delayed queue shrinking to the more expected place - element freeing.
- Remove some SCSIsms in ATA.
2009-11-17 21:23:05 +00:00
Alexander Motin
6bb752977c MFC r198947:
Implement device stats accounting for ATA commands.
2009-11-17 21:14:58 +00:00
Alexander Motin
f6e8afbf7a MFC r198904, r198905:
PMP commands use short format. PMP write doesn't return result.
2009-11-17 21:14:02 +00:00
Alexander Motin
2c588f5344 MFC r198899:
- Remove CAM_PERIPH_POLLED flag. It is broken by design. Polling can't be
periph flag. May be SIM, may be CCB, but now it works fine just without it.
- Remove check unused for at least five years. If we will ever have non-BIO
devices in CAM, this check is smallest of what we will need.
- If several controllers complete requests same time, call swi_sched()
only once.
2009-11-17 21:09:47 +00:00
Alexander Motin
a60c326522 MFC r198897:
- Add support for sector size > 512 bytes and physical sector of several
logical sectors, introduced by ATA-7 specification.
- Remove some obsoleted code.
2009-11-17 21:08:12 +00:00
Alexander Motin
33e000ff00 MFC r198849:
Improve reporting ATA Status error details.
2009-11-17 20:56:24 +00:00
Alexander Motin
5907c56d56 MFC r198832:
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-17 20:54:52 +00:00
Alexander Motin
0e3aa3c51e MFC r198748, r198782:
Fix reference counting bug, when device unreferenced before
invalidated. To do it, do not handle validity flag as another
reference, but explicitly modify reference count each time flag is
modified.
The async callback could free the device. If it is a broadcast async,
it doesn't hold device reference, so take our own reference.
2009-11-17 20:49:26 +00:00
Alexander Motin
8eea8c79fc MFC r198708:
- 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-11-17 20:43:04 +00:00
Alexander Motin
a3a475dfb6 MFC r198705:
Ensure target/lun passed from user-level supported on this bus.
Scanning unsupported IDs causes different issues from duplicate
devices to system crash.
2009-11-17 20:41:15 +00:00
Alexander Motin
844c81cb6d MFC r198394:
Make "Retrying Command" to be printed before actual retrying.
It should make debug/error log a bit more readable.
2009-11-17 20:20:56 +00:00
Alexander Motin
262d120349 MFC r198389:
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-11-17 20:17:48 +00:00
Alexander Motin
4956ef3a42 MFC r198382, r198385:
Replace most of priority numbers with defines. No logical changes.
2009-11-17 19:38:19 +00:00
Alexander Motin
0072eeecbe MFC r198381:
Remove some obsoleted comments.
2009-11-17 15:16:21 +00:00
Alexander Motin
9afd1b3ab3 MFC r198372, r198377:
Implement cam_ccbq_fini().
This is effectively NULL change, but makes this API a bit more consistent.
2009-11-17 15:14:13 +00:00
Alexander Motin
c6956547fc MFC r198333:
Do not search for bus when it is not needed.
2009-11-17 15:08:01 +00:00
Alexander Motin
1d686e05d5 MFC r198331:
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-11-17 15:04:58 +00:00
Alexander Motin
3c6b9b48a0 MFC r198328:
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-11-17 14:56:00 +00:00
Alexander Motin
db581aa0e3 MFC r198322:
Report real max_target = 15. SIM doesn't need to know that target 15 is PMP.
It is XPT business.
2009-11-17 14:49:35 +00:00
Alexander Motin
1987ffda92 MFC r197541:
Report SATA 3.x devices.
2009-11-17 14:38:47 +00:00
Alexander Motin
71f045ca3f MFC r197421:
If on sense request device returns no sence, give up and return,
or we may loop forever.
2009-11-17 14:37:20 +00:00
Alexander Motin
72d128fa0b MFC r196983:
Free the correct buffer in an error case.

Submitted by:   phk
2009-11-17 14:14:07 +00:00
Alexander Motin
028a10f917 MFC r196903:
Remove duplicate qfrozen_cnt variable from struct cam_ed.
ccbq.queue.qfrozen_cnt should be used instead.
2009-11-17 13:48:27 +00:00
Alexander Motin
f26a262eeb MFC r196901:
Remove unneeded CAM_SIM_MPSAFE check.
2009-11-17 13:04:05 +00:00
Alexander Motin
05e4022d23 MFC r196898:
Report scbusX in xpt_announce_periph() to less confuse users by two
different bus addressing schemes.

MFC r196900:
s/bus %d/scbus%d/ in some messages to correct terminology.
2009-11-17 13:01:17 +00:00
Alexander Motin
b351967560 MFC r196897:
Avoid extra swi_sched() call, if this SIM is already queued.
It reduces overhead for coalesced command completions.
2009-11-17 12:58:07 +00:00
Christian Brueffer
ce68852cc2 MFC: r198356
Fix a memory leak in an error case.
2009-10-31 11:08:04 +00:00
Pawel Jakub Dawidek
1d93d2aa4f MFC r197896:
Export disk serial numbers for adaX disks.

Reviewed by:	mav
Approved by:	re (kib)
2009-10-12 21:03:07 +00:00
Kenneth D. Merry
43eb6aeda0 Merge change r197208 from head to stable/8:
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.

Sponsored by:	Copan Systems, Inc.
Approved by:	re (kib)
2009-09-18 20:35:05 +00:00
Pawel Jakub Dawidek
6bd6f55621 MFC r196822, r196823, r196824:
Remove 'ad:' prefix from disk serial number. We don't want serial number
to change when we reconnect the disk in a way that it is accessible through
CAM for example.

Discussed with:	trasz

Simplify g_disk_ident_adjust() function and allow any printable character
in serial number.

Discussed with:	trasz
Obtained from:	Wheel Sp. z o.o. (http://www.wheel.pl)

Make serial numbers of daX disks visible by GEOM.

No objections from:	scottl
Obtained from:	Wheel Sp. z o.o. (http://www.wheel.pl)

Approved by:	re (kib)
2009-09-15 11:23:59 +00:00
Stanislav Sedov
8b3a7204a7 - MFC r196568:
- Add quirk for Sony DSC digital cameras.  This umass devices fail
    to attach without these quirks applied.

Approved by:	re (kib)
2009-09-04 11:32:05 +00:00
Alexander Motin
be5b3af890 MFC r196657:
ATA_FLUSHCACHE is a 28bit format command, not 48.

MFC r196658:
Improve camcontrol ATA support:
 - Tune protocol version reporting,
 - Add supported DMA/PIO modes reporting.
 - Fix IDENTIFY request for ATAPI devices.
 - Remove confusing "-" for NCQ status.

MFC r196659:
Short ATA command format has 28bit address, not 36bit.
Rename ata_36bit_cmd() into ata_28bit_cmd(), while it didn't become legacy.

Approved by:	re (ATA-CAM blanket)
2009-09-01 12:04:43 +00:00
Alexander Motin
382c5c0df4 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:36:25 +00:00
Alexander Motin
a7f9e24d61 MFC r196352:
Fix iSCSI initiator and vpo driver operation, broken by CAM changes.

Reviewed by:	scottl, Danny Braniss
Approved by:	re (rwatson)
2009-08-18 09:31:00 +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