Commit Graph

1127 Commits

Author SHA1 Message Date
Ed Schouten
e439bf9ccc Remove unneeded device index from unit number.
We only use the unit number to determine whether we should rewind the
device upon closure.
2009-04-26 09:21:37 +00:00
Ed Schouten
82b70c3e01 Improve clarity: if (a && (b ? b : c)) -> if (a && (b || c))
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
2009-04-07 19:44:06 +00:00
Nathan Whitehorn
95b2008950 The Serverworks SATA chipsets used in Apple G5 systems require requiring
the ATA status register with a 4-byte read request. This updates it, and
subsequent 1-byte reads will return the correct result.

This commit adds a hack to do this, which is currently ifdef'd powerpc,
although Linux and Darwin do this unconditionally on all platforms.
2009-04-04 00:26:01 +00:00
Alexander Motin
9cf4fe2ebe Integrate user/mav/ata branch:
Add ch_suspend/ch_resume methods for PCI controllers and implement them
for AHCI. Refactor AHCI channel initialization according to it.

Fix Port Multipliers operation. It is far from perfect yet, but works now.
Tested with JMicron JMB363 AHCI + SiI 3726 PMP pair.
Previous version was also tested with SiI 4726 PMP.

Hardware sponsored by: Vitsch Electronics / VEHosting.nl
2009-03-30 22:18:38 +00:00
Warner Losh
aef30cdbf5 Check the Disk FUNCE recorded in the CIS to see if we should probe for
both disks, or if we should suppress the slave drive.  Default to
suppressing the slave, in the case that this REQIURED tuple turns out
to not actually be present...
2009-03-12 06:30:59 +00:00
Alexander Motin
79ca9100fd Add type specific suspend/resume ata channel functions. Add checks to avoid
crash on detached channel resume. Add placeholder for possible type-specific
suspend/resume routines.
2009-03-09 20:48:57 +00:00
Robert Noland
9373e7bb61 Remove the local management of INTx as this is now taken care of by pci.
Reviewed by:	jhb
MFC after:	3 days
2009-03-04 18:25:39 +00:00
Alexander Motin
3a51cb7912 Set PortMultiplier port only for SATA2 channels, where it is applicable.
Doing it on old SATA controllers like Promise PDC20375 SATA150 breaks
their operation.

Tested by:	marcus on PDC20375
2009-03-03 06:39:38 +00:00
Andrew Thompson
9aef556d71 Rename the ushub device class back to uhub as it was in the old usb stack,
moused(8) looks for "uhub/ums" to decide if needs to load the module.

Reported by:	Garrett Cooper
2009-03-02 05:37:05 +00:00
Alexander Motin
bb237e0c30 Give controller a chance to issue Soft Reset clear command before checking
ready status. Most of controllers managed to issue coommand and set BUSY
bit almost simultaneously, before we will read it, but at least JMicron JMB363
don't. Ignore timeout errors to keep old behavior when error there was
impossible.

For me this fixes timeout errors on the first command after channel attach
or reinit. Boot in my case is not affected, as there is much time passing
between reset and next command giving reset time to complete.
2009-03-01 22:50:14 +00:00
Alexander Motin
413de0293b Comment out enabling FIS Based Switching inside ata_ahci_issue_cmd() as it
done in other places. Until we have no support for command queueing we have
no any benefit from FBS, while enabling it only here somehow leads to
"port not ready" errors on Intel 63XXESB2 controller.

Tested by:	Larry Rosenman <ler AT lerctr.org>
2009-03-01 16:47:49 +00:00
Alexander Motin
ea74abd5f5 Revert my ata_identify()/ata_reinit() related changes: r189166, r189091
and partially r188903. Revert breaks new drives detection on reinit to the
state as it was before me, but fixes series of new bugs reported by some
people.

Unconditional queueing of ata_completed() calls can lead to deadlock if
due to timeout ata_reinit() was called at the same thread by previous
ata_completed(). Calling of ata_identify() on ata_reinit() in current
implementation opens numerous races and deadlocks.

Problems I was touching here are still exist and should be addresed, but
probably in different way.
2009-02-28 22:07:15 +00:00
Alexander Motin
84b59262f1 Rework device probing by moving ata_getparam() call from ata_identify() to
drivers' probe routines. It allows not to sleep and so not drop Giant inside
ata_identify() critical section and so avoid crash if it reentered on
request timeout. Reentering of probe call checked inside of it.

Give device own knowledge about it's type (ata/atapi/atapicam). It is not
a good idea to ask channel status for device type inside ata_getparam().

Add softc memory deallocation on device destruction.
2009-02-28 11:25:05 +00:00
Alexander Motin
2c4c54b7a8 Merge rev. 188615, 188812 changes from old-USB to USB2 driver. 2009-02-27 19:27:33 +00:00
Alexander Motin
2ef522c17f Rollback rev. 189093.
mtx_lock() is not needed there as callout initialized with callout_init_mtx().
Sorry.

Submitted by:	Ian Dowse
2009-02-26 23:21:32 +00:00
Alexander Motin
77de503bfa Unhide IDENTIFY command timeouts when verbose messages enabled.
I think it should be suitable for debugging.
2009-02-26 23:07:40 +00:00
Alexander Motin
7a3a39cc64 Restore mtx_lock() call on ata_timeout(), dropped (I think accidentally)
during commit 3 years ago.
2009-02-26 22:26:07 +00:00
Alexander Motin
69328334a6 Remove direct ata_completed() call options from ata_finish(), except for the
kernel dumping case.

ata_completed() may initiate ata_reinit() on error, that may lead to drives
attach or detach. Attach and detach are sending requests to drives and sleep
waiting for results. But ata_finish() can be called directly from
interrupt handler where sleeping is prohibited, so we must break this chain
somewhere. This place seems to fit best.
2009-02-26 21:33:48 +00:00
Alexander Motin
9738772d4e Fix non-AHCI channels detection on combined JMicron controllers,
broken by r188694.
2009-02-23 22:13:05 +00:00
Andrew Thompson
3a3f90c6c3 Move the uaudio and ata-usb drivers into their correct locations. 2009-02-23 21:19:18 +00:00
Andrew Thompson
e02917222d Move two missed usb drivers out to the graveyard location under sys/legacy/dev. 2009-02-23 21:07:20 +00:00
Alexander Motin
3b80d8accb Do not call devices probe/attach if there is nothing new was found. 2009-02-23 08:58:29 +00:00
Alexander Motin
43b4ee0925 Fix spelling.
Submitted by:	gavin
2009-02-23 08:19:30 +00:00
Alexander Motin
aa4ba29b8d Tune AHCI verbose messages to make log more readable. 2009-02-22 14:08:20 +00:00
Alexander Motin
6d4019d23a Remove one more place of master/slave terms usage. 2009-02-22 10:26:02 +00:00
Alexander Motin
e412a8c3b5 Use only higher half of device signature to identify device type. Some
devices return incorrect values in lower part confusing detection, while
higher part itself gives enough information for proper detetion.
2009-02-21 23:46:34 +00:00
Alexander Motin
97a7b00c15 Increase initial busy waiting time. If drive was hot-plugged, it may need
much time to spin-up.
2009-02-21 23:42:28 +00:00
Alexander Motin
6030a3f04c Improve ata_reinit():
- protect againtst recursions,
 - add new devices detection using ata_identify().

Improve ata_identify():
 - do not add duplicate device if device already exist.

Rework SATA hot-plug events handling. Instead of unsafe duplicate
implementation use common ata_reinit() to handle all state changes.

All together this gives quite stable and robust cold- and hot-plug operation,
invariant to false, lost and duplicate events.
2009-02-21 22:57:26 +00:00
Alexander Motin
7c84b0bd94 Teach device drivers' ata_reinit() methods, that there can be more then two
devices per channel.
2009-02-21 16:39:26 +00:00
Alexander Motin
3f9a1dcaeb Disable port hardware on detach. First switch it to slumber mode to
power-down peer transmitter, then disable completely.
Side effect of this is saving about 0.5W of power per detached device.
2009-02-20 23:17:52 +00:00
Marcel Moolenaar
2571133f87 Don't read the TOC for DIOCGPROVIDERALIAS. This causes the
acd code to create new provider (?), but not from an expected
context, which results in a panic (GEOM topology not held).
2009-02-20 23:01:27 +00:00
Alexander Motin
ca6c2e3666 Fix typo: s/SLUMPER/SLUMBER/ 2009-02-20 22:46:24 +00:00
Alexander Motin
26159d4874 Reduce soft-reset assertion time from 5ms to 50us.
ATA specification declares minimal reset time of 5us. SATA keeps it, but
requires devices to handle commands transmitted even one by one without
any gap.
2009-02-20 20:29:32 +00:00
Alexander Motin
53fb2a7ac9 Disable port interrupts before doing PHY reset.
PHY reset causes drive connect/disconnect events, unwanted at this moment.
2009-02-20 20:20:00 +00:00
Alexander Motin
72dc9f05dd Fix pc98 build error due to missing variable.
Submitted by:	avg
2009-02-20 14:10:23 +00:00
Alexander Motin
53963e588a Handle nForce MCP67 and MCP73 SATA controllers as AHCI. They report itself
as ATA RAID, but generic ATAPCI driver unable to detect drives there. AHCI
driver reported to handle them fine. Linux does the same.

Submitted by:	Andrey V. Elsukov on stable@
2009-02-20 08:49:56 +00:00
Scott Long
934dec8c2f Add basic support for DDF, often found on Adaptec HostRAID controllers.
Spares and rebuilds are not supported, so this code should be considered
for entertainment purposes only.
2009-02-20 06:10:12 +00:00
Alexander Motin
b50bb79c6a Use channel driver's attach/detach routines instead of ata_attach()/
ata_detach() to implement IOCATAATTACH/IOCATADETACH ioctls.
This will permit channel drivers to properly shutdown port hardware on channel
detach and init it on attach.
2009-02-19 12:47:24 +00:00
Alexander Motin
78d154163c Quite mechanical ch_detach implementations for all atapci subdrivers.
Some dmainit call fixes for previous commit.
2009-02-19 00:32:55 +00:00
Alexander Motin
04ff88ceac As soon as they called in only same one place (ata_pcichannel_attach()),
join allocate() and dmainit() atapci subdriver's channel initialization
methods into single ch_attach() method.

As opposite to ch_attach() add new ch_detach() method to deallocate/disable
channel.
2009-02-18 22:17:48 +00:00
Alexander Motin
6340835dfd Make ch->dma.free() called symmetrically to ch->dma.alloc(). 2009-02-18 21:12:48 +00:00
Alexander Motin
6a03316a2d Implement proper attach/detach routines for ISA driver. 2009-02-18 20:42:42 +00:00
Alexander Motin
50b6b9cc54 Remove unused variable.
Submitted by:	ganbold
2009-02-18 18:36:13 +00:00
Alexander Motin
7b3a8a2730 Adaptively increase control command timeout when drive is spun down.
This should fix, for example, cache flush timeout error on shutdown, if
some drives are not mounted.

PR:		kern/111023
2009-02-17 23:20:04 +00:00
Alexander Motin
b3747cb7d6 Remove useless return, that left from previous commit. 2009-02-17 21:35:17 +00:00
Alexander Motin
46a309e292 ata_interrupt() does not need to return anything. It is not it's business
to report request completion, expecially when it is not reliable.
2009-02-17 21:17:21 +00:00
Alexander Motin
2e46610e21 Make core dumping to ad not to freeze even if interrupts, not disabled
for some reason, stealing our events.
2009-02-16 22:25:39 +00:00
Alexander Motin
9f8919f236 Give atapci knowledge about set of implemented AHCI ports. It is possible
to not allocate them after the recent ata channels enumeration changes.
It allows to save some resources, not bother user with unexisting hardware
and not check unimplemented ports status on every interrupt.
2009-02-16 19:10:07 +00:00
Alexander Motin
1c4dd558d1 Remove unneeded AND operation. We have already checked that bit is set. 2009-02-15 21:54:16 +00:00
Alexander Motin
a3b7c762ba Add initial single-vector MSI support into atapci driver.
Works fine with AHCI and theoretically other MSI capable devices.

At this moment support disabled by default. To enable it, set
"hint.atapci.X.msi=1" device hint.
2009-02-15 20:37:55 +00:00