Commit Graph

870 Commits

Author SHA1 Message Date
Alexander Motin
aeb7e9f945 MFC r204354:
Make PUIS detection more strict. Previous implementation caused false
positives on VMWare's virtual CD-ROMs.
2010-03-01 19:36:19 +00:00
Alexander Motin
df7d3f0a1f MFC r204253:
Make xpt_rescan() more correct, as it was before r197208: do not use
XPT_SCAN_LUN for wildcard LUN, fall back to XPT_SCAN_BUS.
2010-03-01 19:32:34 +00:00
Alexander Motin
d4301de786 MFC r204220, r204353:
Virtualize transport part of periph announcement.
2010-03-01 19:19:30 +00:00
Alexander Motin
02d2ad5770 MFC r204195:
Improve output for controllers that doesn't report SATA speed.
2010-03-01 19:16:34 +00:00
Alexander Motin
04c9f4b6d0 MFC r203931:
Make CD driver a bit more robust and predictable to unreported errors.
2010-02-19 17:45:47 +00:00
Alexander Motin
cf8a9069cd MFC r203499:
On probe error, if restart requested, skip any retries and recovery.
Just restart probe from the beginning immediately.
2010-02-14 19:51:39 +00:00
Alexander Motin
902a54900a MFC r203421:
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-14 19:50:33 +00:00
Alexander Motin
ea35d583e8 MFC r203386:
Change the way in which fake async events generated. Do not use
taskqueue for lock decoupling, as it causes unwanted races.
2010-02-14 19:48:53 +00:00
Alexander Motin
31d3ea037e MFC r203385:
- 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-14 19:46:54 +00:00
Alexander Motin
929100472e MFC r203376, r203384:
- 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-14 19:44:48 +00:00
Alexander Motin
50ae5fde8d MFC r203108:
Large set of CAM improvements:
- 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-02-14 19:38:27 +00:00
Matt Jacob
7733cf8fff MFC a number of changes from head for ISP (203478,203463,203444,202418,201758,
201408,201325,200089,198822,197373,197372,197214,196162). Since one of those
changes was a semicolon cleanup from somebody else, this touches a lot more.
2010-02-11 18:34:06 +00:00
Alexander Motin
b136f43d44 MFC r201990:
- Report SATA in legacy emulation mode still as SATA.
- Make ATA XPT able to handle such case.
2010-01-19 13:00:33 +00:00
Alexander Motin
92d8dadcf8 MFC r201139:
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.

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.
2010-01-19 12:58:29 +00:00
Alexander Motin
328562d78a MFC 200969:
Report stripe size only if physical sector size is not equal to logical.
2010-01-05 13:58:18 +00:00
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