Commit Graph

1228 Commits

Author SHA1 Message Date
Nathan Whitehorn
f19e4a24de MFC r208162, 208836, 208837:
Program the K2 SATA controller's interrupt to be level-triggered low, and
respect the edge/level settings in the device tree.

OpenPIC on powerpc sets interrupts to be level high by default. On Apple
interrupt controllers, all level interrupts are low regardless of
programming except interrupt 0, used by K2 SATA on some Apple systems, with
the result that the K2 SATA IRQ is misconfigured. Pending review of changes
to this default, work around this by changing the programming of the K2
SATA interrupt to level low.

Approved by:	re (kib)
2010-06-11 14:10:20 +00:00
Nathan Whitehorn
972b06a770 MFC r208870:
Some revisions of the Serverworks K2 SATA controller have a data
corruption bug where if an ATA command is issued before DMA is started,
data will become available to the controller before it knows what to do
with it. This results in either data corruption or a controller crash.

This patch remedies the problem by adopting the workaround employed
by Linux and Darwin: starting the DMA engine prior to sending the ATA
command.

Reviewed by:	mav
Approved by:	re (kib)
2010-06-11 14:06:35 +00:00
Alexander Motin
2d0033c8c8 MFC r208796:
Fix PCH chipset IDs. They are 0x3bxx, not 0x3axx.

Approved by:	re (kib)
2010-06-08 10:52:37 +00:00
Alexander Motin
8c14a06f56 MFC r208410:
Report ATA/SATA channel number to NewBus at location string.
2010-05-24 11:01:56 +00:00
Marius Strobl
931e615af7 MFC: r208349
Change ad_firmware_geom_adjust() to operate on a struct disk * only and
hook it up to ada(4) also. While at it, rename *ad_firmware_geom_adjust()
to *ata_disk_firmware_geom_adjust() etc now that these are no longer
limited to ad(4). This also allows to maintain a compatibility shim for
pc98_ad_firmware_geom_adjust() for the tier-1 PC98 in stable/8.

Reviewed by:	mav (r208349)
2010-05-23 16:16:33 +00:00
Alexander Motin
6488c6b3e9 MFC r208375, r208393:
Improve suspend/resume support. Make sure controller is idle on suspend
and reset it on resume.
2010-05-23 11:29:34 +00:00
Alexander Motin
16dd0aa252 MFC r207432:
Add Target/LUN ID checks.
2010-05-08 13:07:50 +00:00
Alexander Motin
dd6a149269 MFC r207221:
Mark ATA channel as idle on timeout in non-ATA_CAM mode.
This should fix possible duplicate request completion.
2010-05-02 12:40:54 +00:00
Alexander Motin
20151ecd2e MFC r206604:
For early ALI chips do not announce I/O sizes that require unsupported
48bit DMA commands.
2010-05-02 12:39:29 +00:00
Alexander Motin
fec9df653c MFC r205967:
Include opt_ata.h, as some structures here depending on ATA_CAM option.
This fixes ATA_CAM with atamvsata and probably some other drivers.
2010-04-15 12:26:24 +00:00
Alexander Motin
b1a034ef8e MFC r205680:
Use last 16 bytes of serial number in metadata instead of first ones,
same as Intel MatrixRAID does.

PR:             kern/124064
2010-04-15 12:20:13 +00:00
Alexander Motin
3015ec2db6 MFC r205074:
Mask disk_idx to avoid panic because of extra bits set.

PR:             kern/102211
Submitted by:   yoichi
2010-03-31 07:49:59 +00:00
Alexander Motin
576e956f32 MFC r204509:
- Add ALI M5228 PATA ID.
- Add missed DMA initialization for ALI SATA chips.
2010-03-03 19:14:05 +00:00
Alexander Motin
3a8904bf97 MFC r204250:
Fix recursive lock attempt on hot-plug event in non-ATA_CAM mode.
2010-03-03 19:12:53 +00:00
Alexander Motin
4c88138161 MFC r204210, r204216:
Add Intel PCH SATA controller IDs.
2010-03-03 19:11:39 +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
ee22e37df5 MFC r203449:
Implement poll method for atapicam.
It is not perfect, but better then nothing.
2010-02-14 19:56:42 +00:00
Alexander Motin
34cbb135e7 MFC r203347:
NetCell is a PCI hardware RAID without cable and mode setting.
2010-02-14 19:55:41 +00:00
Alexander Motin
dd96528dec MFC r203525:
Report SATA300 chips also as SATA.
2010-02-14 19:54:16 +00:00
Alexander Motin
d2846ca800 MFC r203445:
Report to CAM unit number of underlying ataX bus device, instead of this
atapicamX. It is more apropriate and useful together with "ata" name.
2010-02-14 19:53:09 +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
Alexander Motin
9290c85988 MFC r203030:
Add support for SATA part of Marvell 88SE912x controllers to ahci(4).
Limit early revisions from 6Gb/s to 3Gb/s by default, or they negotiate
only 1.5Gb/s, when 3Gb/s devices connected.

Add dummy driver for PATA part of these controllers, preventing generic
driver attach them. It causes system freeze when SATA controller used after
PATA was touched.
2010-02-14 19:28:45 +00:00
Alexander Motin
82368eed51 MFC r202699:
Make ata_getrev() an optional method by implementing ata_null_getrev().
This fixes a bogus '???' boot message on Cambria boards with a CompactFlash
card.
2010-02-14 19:23:05 +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
f8451095fa MFC r203043, r203058:
Do not place fake interrupt register on chip.
Now we have better place for it.
2010-02-05 12:17:14 +00:00
Alexander Motin
3ca74a280b MFC r203034:
Restore SATA speed reporting, broken by ATA_CAM changes.
2010-02-05 12:09:43 +00:00
Alexander Motin
dc65878eb6 MFC r203033:
Clear ch->devices, if hard-reset failed.
This makes hot-plug work better.
2010-02-05 12:07:53 +00:00
Alexander Motin
89dbf1bfd5 MFC r201993:
Report which of IXP700 legacy ATA channels are SATA.
2010-01-19 13:27:54 +00:00
Alexander Motin
4c75a1d302 MFC r200857:
Add support for Intel SCH PATA controller.

PR:             kern/140251
2010-01-19 13:26:45 +00:00
Alexander Motin
44f39e7d59 MFC r200817:
Spell AMD properly.
2010-01-19 13:25:31 +00:00
Alexander Motin
f59a7ba7ba MFC r200754:
Add VIA CX700/VX800 chipsets SATA/PATA support.

PR:             kern/121521
2010-01-19 13:24:11 +00:00
Alexander Motin
1c2e876f53 MFC r200753:
Fairly set master/slave shared PIO/WDMA timings on ITE 821x controllers.
Previous implementation could only limit mode, but not rise it back.
2010-01-19 13:21:25 +00:00
Alexander Motin
928e4114fe MFC r200655:
Serverworks OSB4 has no 0x4a (piomode) register, do not touch it.
Also OSB4 has some problems with UDMA transfers, limit it to WDMA2.
2010-01-19 13:07:25 +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
989435a380 MFC r200414:
CFA support doesn't exclude FLUSH support.
2009-12-22 20:00:20 +00:00
Marius Strobl
9624f980b1 MFC: r200544
Set ATA_CHECKS_CABLE when appropriate.

Reviewed by:	mav
2009-12-21 20:17:34 +00:00
Marius Strobl
b4aa1acbfb MFC: r200482, r200485
o Properly support M5229 revision 0xc7 and 0xc8:
  - These revisions no longer have cable detection capability.
  - The UDMA support bit of register 0x4b has been dropped without an
    replacement.
  - According to Linux it's crucial for working ATAPI DMA support to
    also set the reserved bit 1 of regsiter 0x53 with these revisions.
o Only set ATA_CHECKS_CABLE for chip versions that actually support
  cable detection, i.e. neither for ALI_OLD nor for ALI_NEW revisions
  >= 0xc7.
2009-12-20 01:44:47 +00:00
Marius Strobl
3759df8ec6 MFC: r200481
Specify the capability and media bits of the capabilities page in
native, i.e. big-endian, format and convert as appropriate like we
also do with the multibyte fields of the other pages. This fixes
the output of acd_describe() to match reality on big-endian machines
without breaking it on little-endian ones. While at it, also convert
the remaining multibyte fields of the pages read although they are
currently unused for consistency and in order to prevent possible
similar bugs in the future.
2009-12-20 01:38:01 +00:00
Marius Strobl
23c703cfc8 MFC: r200459
Unbreak the ata_atapi() usage. Since r200171 (MFC'ed in r200432) the
mode setting functions get a ata_device type device passed instead of
a ata_channel one, thus ata_atapi() has to be adjusted accordingly.

Reviewed by:	mav
2009-12-16 18:39:32 +00:00
Alexander Motin
2750344277 MFC r200607:
Large I/Os on Promise controllers reported to cause UDMA ICRC errors and
subsequent timeouts. Restore previous limit for now, at least until
I will have hardware to experiment.

PR:             kern/141438
2009-12-16 17:48:26 +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
248e8fd706 MFC r200353:
Limit maximum I/O size, depending on command set supported by device.
It is required to suppot non-LBA48 devices with MAXPHYS above 128K.
Same is done in ada(4).
2009-12-11 12:44:44 +00:00
Alexander Motin
26952f96e5 MFC r200121:
Do not ignore device interrupt if bus mastering is still active. It is
normal in case of media read error and some ATAPI cases, when transfer size
is unknown beforehand. PCI ATA BM specification tells that in case of such
underrun driver should just manually stop DMA engine. DMA engine should
same time guarantie that all bus mastering transfers completed at the moment
of driver reads interrupt flag asserted.
This change fixes interrupt storms and command timeouts in many cases.

PR:             kern/103602, sparc64/121539, kern/133122, kern/139654
2009-12-09 17:20:10 +00:00
Alexander Motin
3ca1ec74ed MFC r200117:
On Soft Reset, read device signature from FIS receive area, instead of
PxSIG register. It works better for NVidia chipsets. ahci(4) does the same.

PR:             kern/140472, i386/138668
2009-12-09 17:11:09 +00:00
Alexander Motin
06a7b83b5e MFC r199822:
Drop USB mass storage devices support from ata(4). It is out of the build as
long as I remember, and completely superseded by better maintained umass(4).
It's main idea was to optionally avoid CAM dependency for such devices, but
with move ATA to CAM, it is not actual any more.

No objections:  hselasky@, thompsa@, arch@
2009-12-02 10:47:11 +00:00
Alexander Motin
0264833689 MFC r199645, r199646:
Fix Intel PATA UDMA timings setting, affecting write performance.
Binary divider value 10 specified in datasheet is not a hex 0x10.
UDMA2 should be 33/2 instead of 66/4, which is documented as reverved,
UDMA4 should be 66/2 instead of 66/4, which is definitely wrong.
Release over-agressive WDMA0 mode timings as close to spec as chip can.
2009-11-26 14:56:58 +00:00
Alexander Motin
052c5232f5 MFC r199749:
Use only lower byte of sectors_intr IDENTIFY word as sector count.
This fixes SET_MULTI error during boot on devices supporting less then
16 sectors per interrupt.
2009-11-26 14:50:01 +00:00
Alexander Motin
8f51326c68 MFC r199259, r199262, r199322:
Change the way in which AHCI+PATA combined controllers, such as JMicron
are handled. Instead of trying to attach two different drivers to
single device, wrapping each call, make one of them (atajmicron)
attach do device solely, but create child device for AHCI driver,
passing it all required resources. It is quite easy, as none of
resources are shared, except IRQ.
Add support for AHCI SATA parts of alike SATA+PATA MArvell controllers.
Add IDs of Marvell 88SX6102, 88SX6111. 88SX6141 controllers.

As result, it:
- makes drivers operation more independent and straitforward,
- allows to use new ahci(4) driver with such devices, adding support for
new features, such as PMP and NCQ, same time keeping legacy PATA support,
- will allow to just drop old ataahci driver, when it's time come.
2009-11-23 08:56:17 +00:00
Alexander Motin
0cde70967f MFC r198752:
Allow SATA1 SiI chips to do full-sized DMA. Specification tells that we may
release DMA constrants even more, but it require some additional handling.
2009-11-23 08:46:26 +00:00