Commit Graph

41 Commits

Author SHA1 Message Date
Alexander Motin
1254b6802f Make PUIS detection more strict. Previous implementation caused false
positives on VMWare's virtual CD-ROMs.
2010-02-26 10:42:46 +00:00
Alexander Motin
57079b1773 Virtualize transport part of periph announcement. 2010-02-22 19:17:17 +00:00
Alexander Motin
639c2d4fad On probe error, if restart requested, skip any retries and recovery.
Just restart probe from the beginning immediately.
2010-02-04 18:56:38 +00:00
Alexander Motin
4ef08dc5a5 MFp4:
Add Power Up In Stand-by feature support. Device with PUIS enabled
require explicit command to do initial spin-up. Mark that command
with CAM_HIGH_POWER flag, to allow CAM manage staggered spin-up.
2010-02-03 10:06:03 +00:00
Alexander Motin
a9b8edb194 - Use separate buffer for identify data fetching. We can't use main buffer
here if device already running, as data need to be formatted before use.
- Remove some saved_ccb variables. They are unused now.
2010-02-02 18:03:21 +00:00
Alexander Motin
4cca153030 - Give ATA/SATA SIMs info about ATAPI packet size, supported by device.
- Make ATA XPT to reject longer SCSI CDBs then supported by device, or
any SCSI CDBs, if device doesn't support ATAPI.
2010-02-02 11:09:28 +00:00
Alexander Motin
83c5d981ac MFp4: Large set of CAM inprovements.
- Unify bus reset/probe sequence. Whenever bus attached at boot or later,
CAM will automatically reset and scan it. It allows to remove duplicate
code from many drivers.
- Any bus, attached before CAM completed it's boot-time initialization,
will equally join to the process, delaying boot if needed.
- New kern.cam.boot_delay loader tunable should help controllers that
are still unable to register their buses in time (such as slow USB/
PCCard/ CardBus devices), by adding one more event to wait on boot.
- To allow synchronization between different CAM levels, concept of
requests priorities was extended. Priorities now split between several
"run levels". Device can be freezed at specified level, allowing higher
priority requests to pass. For example, no payload requests allowed,
until PMP driver enable port. ATA XPT negotiate transfer parameters,
periph driver configure caching and so on.
- Frozen requests are no more counted by request allocation scheduler.
It fixes deadlocks, when frozen low priority payload requests occupying
slots, required by higher levels to manage theit execution.
- Two last changes were holding proper ATA reinitialization and error
recovery implementation. Now it is done: SATA controllers and Port
Multipliers now implement automatic hot-plug and should correctly
recover from timeouts and bus resets.
- Improve SCSI error recovery for devices on buses without automatic sense
reporting, such as ATAPI or USB. For example, it allows CAM to wait, while
CD drive loads disk, instead of immediately return error status.
- Decapitalize diagnostic messages and make them more readable and sensible.
- Teach PMP driver to limit maximum speed on fan-out ports.
- Make boot wait for PMP scan completes, and make rescan more reliable.
- Fix pass driver, to return CCB to user level in case of error.
- Increase number of retries in cd driver, as device may return several UAs.
2010-01-28 08:41:30 +00:00
Alexander Motin
0025eb12c8 - Report SATA in legacy emulation mode still as SATA.
- Make ATA XPT able to handle such case.
2010-01-10 09:20:56 +00:00
Alexander Motin
1c80ec0a6b Add BIO_DELETE support to ada(4):
- For SSDs use TRIM feature of DATA SET MANAGEMENT command, as defined by
ACS-2 specification working draft.
- For CompactFlash use CFA ERASE command, same as ad(4) does.

With this patch, `newfs -E /dev/ada1` was able to restore write speed of
my heavily weared OCZ Vertex SSD (firmware 1.4) up to the initial level
for the most part of it's capacity. Previous 1.3 firmware, even reportiong
TRIM capabilty bit set, was not working, reporting ABORT error for every
DSM command.

I have no idea whether it is normal, but for some reason it takes 200ms
to handle any TRIM command on this drive, that was making delete extremely
slow. But TRIM command is able to accept long list of LBAs and the length of
that list seems doesn't affect it's execution time. Implemented request
clusting algorithm allowed me to rise delete rate up to reasonable numbers,
when many parallel DELETE requests running.
2009-12-28 20:08:01 +00:00
Alexander Motin
ce8332d468 Report stripe size only if physical sector size is not equal to logical. 2009-12-24 21:54:44 +00:00
Alexander Motin
7bdb664e50 MFp4;
- 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-07 16:23:25 +00:00
Alexander Motin
21cc85878c MFp4:
If we panicked with SIM lock held, do not try to flush caches.
Extra lock recursing will not make debugging easier.
2009-12-06 11:48:53 +00:00
Alexander Motin
066f913a94 MFp4:
Introduce ATA_CAM kernel option, turning ata(4) controller drivers into
cam(4) interface modules. When enabled, this options 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.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-06 00:10:13 +00:00
Alexander Motin
f3631e8d74 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-01 23:01:29 +00:00
Alexander Motin
b447e682d6 MFp4:
Improve ATA mode/SATA revision control.
2009-11-26 08:49:46 +00:00
Alexander Motin
1a6f09b826 Fix small copu-paste bug. 2009-11-25 14:24:14 +00:00
Alexander Motin
c8039fc667 MFp4:
- 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.
2009-11-24 12:47:58 +00:00
Alexander Motin
3a3e47990c 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-16 15:18:02 +00:00
Alexander Motin
507e581190 MFp4:
Do not enable tagged queueing if controller reports 0 tags support.
2009-11-14 08:08:49 +00:00
Alexander Motin
30a4094f86 MFp4:
- 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-11 11:10:36 +00:00
Alexander Motin
2a3510fd51 Fix protype. 2009-11-04 16:37:13 +00:00
Alexander Motin
fd2cc0bde8 PMP commands use short format. PMP write doesn't return result. 2009-11-04 16:16:50 +00:00
Alexander Motin
efa575b6be MFp4:
- 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-04 15:40:19 +00:00
Alexander Motin
c1bd46c2d3 MFp4:
- 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-04 15:24:32 +00:00
Alexander Motin
8691755dff MFp4:
Improve reporting ATA Status error details.
2009-11-03 11:19:05 +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
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
bbfa4aa1a6 Replace most of priority numbers with defines. No logical changes. 2009-10-23 08:27:55 +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
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
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
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
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