Commit Graph

1125 Commits

Author SHA1 Message Date
nwhitehorn
1b19722cda 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
mav
d4ed9d6887 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
imp
e114ded794 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
mav
bc83c57ba7 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
rnoland
1c9035fabf 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
mav
ac2078c0ef 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
thompsa
9e91847c9e 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
mav
64431531f8 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
mav
4f862800c6 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
mav
55cab290fc 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
mav
b342cbbd7a 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
mav
9456dca639 Merge rev. 188615, 188812 changes from old-USB to USB2 driver. 2009-02-27 19:27:33 +00:00
mav
9e19feba05 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
mav
e13e5273ad Unhide IDENTIFY command timeouts when verbose messages enabled.
I think it should be suitable for debugging.
2009-02-26 23:07:40 +00:00
mav
9b5b5b028f Restore mtx_lock() call on ata_timeout(), dropped (I think accidentally)
during commit 3 years ago.
2009-02-26 22:26:07 +00:00
mav
bb22735cfd 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
mav
ab8cd68dd6 Fix non-AHCI channels detection on combined JMicron controllers,
broken by r188694.
2009-02-23 22:13:05 +00:00
thompsa
d44ed63bdc Move the uaudio and ata-usb drivers into their correct locations. 2009-02-23 21:19:18 +00:00
thompsa
de29f650e6 Move two missed usb drivers out to the graveyard location under sys/legacy/dev. 2009-02-23 21:07:20 +00:00
mav
dcb65e8ff9 Do not call devices probe/attach if there is nothing new was found. 2009-02-23 08:58:29 +00:00
mav
cd92a84897 Fix spelling.
Submitted by:	gavin
2009-02-23 08:19:30 +00:00
mav
f7385ac83d Tune AHCI verbose messages to make log more readable. 2009-02-22 14:08:20 +00:00
mav
dad2147aeb Remove one more place of master/slave terms usage. 2009-02-22 10:26:02 +00:00
mav
3bc203445d 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
mav
5ac2ce8471 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
mav
96ec4168f2 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
mav
d6b23ce153 Teach device drivers' ata_reinit() methods, that there can be more then two
devices per channel.
2009-02-21 16:39:26 +00:00
mav
1348b6bf73 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
29e2f2f76e 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
mav
5369399ef9 Fix typo: s/SLUMPER/SLUMBER/ 2009-02-20 22:46:24 +00:00
mav
00cf46451c 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
mav
b2740187db 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
mav
69ca5576d6 Fix pc98 build error due to missing variable.
Submitted by:	avg
2009-02-20 14:10:23 +00:00
mav
0b676e2d8d 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
scottl
261fc57b26 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
mav
6127a7d95a 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
mav
049011f572 Quite mechanical ch_detach implementations for all atapci subdrivers.
Some dmainit call fixes for previous commit.
2009-02-19 00:32:55 +00:00
mav
f10246717a 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
mav
d65edba75b Make ch->dma.free() called symmetrically to ch->dma.alloc(). 2009-02-18 21:12:48 +00:00
mav
06c33a48b8 Implement proper attach/detach routines for ISA driver. 2009-02-18 20:42:42 +00:00
mav
bcff264488 Remove unused variable.
Submitted by:	ganbold
2009-02-18 18:36:13 +00:00
mav
62a9b004fc 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
mav
1bb2d9bb68 Remove useless return, that left from previous commit. 2009-02-17 21:35:17 +00:00
mav
9d001280ae 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
mav
84129dcd67 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
mav
2faabf52c8 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
mav
19b1b2f405 Remove unneeded AND operation. We have already checked that bit is set. 2009-02-15 21:54:16 +00:00
mav
9f9ad318fe 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
mav
1685dd7b40 Add workaround for some ATI chips, failing to soft-reset
when port multiplicator supported, but absent.
2009-02-15 16:05:48 +00:00
mav
f35949f29c Tunes to AHCI reset sequences:
- specification claims that 1 second is just a maximum controller reset time;
implement controller reset properly to save almost 1 second of boot, and
about half second of resume time;
- enable channel interrupts only after channel status reset to fix duplicate
device creation on resume due to unwanted device connection event;
- as described in specification, wait for disk ready status after channel
power-up; it is not so important when disk already touched by BIOS, but
solves device not ready problems on resume and probably some other cases.
- uncomment channel stop/start on soft-reset as it is declared mandatory by
specification; it was commented due to some random drive detection problems
on VIA and JMicron controllers, but I hope it is fixed by previous point.
2009-02-14 23:02:59 +00:00