Commit Graph

135 Commits

Author SHA1 Message Date
Marius Strobl
5187458fcd - First pass at const'ifying ata(4) as appropriate.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers

MFC after:	1 week
2012-03-21 16:59:39 +00:00
Marius Strobl
812e6f1cf5 Remove remnants of ATA_LOCKING uses in the ATA_CAM case and wrap it
along with functions, SYSCTLs and tunables that are not used with
ATA_CAM in #ifndef ATA_CAM, similar to the existing #ifdef'ed ATA_CAM
code for the other way around. This makes it easier to understand
which parts of ata(4) actually are used in the new world order and
to later on remove the !ATA_CAM bits. It also makes it obvious that
there is something fishy with the C-bus front-end as well as in the
ATP850 support, as these used ATA_LOCKING which is defunct in the
ATA_CAM case. When fixing the former, ATA_LOCKING probably needs to
be brought back in some form or other.

Reviewed by:	mav
MFC after:	1 week
2012-03-21 08:57:15 +00:00
Alexander Motin
9364490242 Fix names of some Marvell SATA chips. It looks like chips with proprietary
interface supported by mvs(4) are 88SX, while AHCI-like chips are 88SE.

PR:		kern/165271
Submitted by:	Jia-Shiun Li <jiashiun@gmail.com>
MFC after:	1 week
2012-03-02 08:49:07 +00:00
Ulrich Spörlein
9a14aa017b Convert files to UTF-8 2012-01-15 13:23:18 +00:00
Jim Harris
9bea89c1b0 Add 0x2826 device ID for C600 (Patsburg) SATA controller in RAID mode.
Reviewed by: mav
Approved by: scottl
2012-01-06 00:22:55 +00:00
Alexander Motin
dd3ebdba6f Add PCI IDs for the Intel ICH9M SATA controllers.
MFC after:	2 weeks
2011-12-14 13:12:55 +00:00
Alexander Motin
c779dc1485 Some dmesg cosmetics:
- for the legacy PCI ATA channels move channel number out of the device
description, same as it is for ahci(4), siis(4) and mvs(4);
 - add device description for the ISA ATA channels.
2011-10-24 08:47:23 +00:00
Alexander Motin
dd60e051f7 - Use mutex to serialize index/data register pair usage, when
accessing SATA registers. Unserialized access under heavy load caused
wrong speed reporting and potentially could cause device loss.
 - To free memory and other resources (including above), allocated
during chipinit() method call on attach, add new chipdeinit() method,
called during driver detach.

Submitted by:   Andrew Boyer <aboyer@averesystems.com> (initial version)
Approved by:	re (kib)
MFC after:	1 week
2011-07-22 16:37:04 +00:00
Jack F Vogel
73e3bb6563 Chipset support for the new Intel Panther Point PCH, thanks
to Seth Heasley for preparing the changes.
2011-05-11 20:31:27 +00:00
Alexander Motin
53479021ba - Fix mapping of the last two SATA ports on 6-port Intel controllers.
This improves hard-reset and hot-plug on these ports.
 - Device with ID 0x29218086 is a 2-port variant of ICH9 in legacy mode.
Skip probing for nonexistent slave devices there.
2011-04-21 11:44:16 +00:00
Jack F Vogel
bf0477b215 Support for the new Patsburg PCH chipset:
- SMBus Controller
     - SATA Controller
     - HD Audio Controller
     - Watchdog Controller

Thanks to Seth Heasley (seth.heasley@intel.com) for providing us code.

MFC after 3 days
2011-02-01 01:05:11 +00:00
Jack F Vogel
d5267ede37 Support for the new DH89xxCC PCH chipset including:
- SATA controller
      - Watchdog timer
      - SMBus controller
2011-01-31 18:41:52 +00:00
Alexander Motin
040545848d Add IDs for VIA VX900 chipset SATA controller.
(Missed part of r215428)
2010-11-17 17:52:04 +00:00
Alexander Motin
bfc8500c34 Add Intel Cougar Point PCH SATA Controller DeviceIDs. Correct some existing
entries for Intel Ibex Peak (5 Series/3400 Series) PCH SATA controllers.

Submitted by:	jfv@
MFC after:	1 week
2010-08-28 07:10:51 +00:00
Alexander Motin
445cc79ca9 Report ATA/SATA channel number to NewBus at location string. 2010-05-22 07:32:47 +00:00
Alexander Motin
f60d46f99a - Add ALI M5228 PATA ID.
- Add missed DMA initialization for ALI SATA chips.
2010-03-01 07:32:49 +00:00
Alexander Motin
6268666c1b 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.5Gbps, 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-01-26 15:25:24 +00:00
Alexander Motin
7aab51b33e Add support for Intel SCH PATA controller.
PR:		kern/140251
2009-12-22 19:48:06 +00:00
Alexander Motin
c357f2c827 Add VIA CX700/VX800 chipsets SATA/PATA support.
PR:		kern/121521
Tested by:	Alex Deiter
2009-12-20 16:23:11 +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
6bd8779bb9 Change the way in which AHCI+PATA combined controllers, such as JMicron
and Marvell handled. Instead of trying to attach two different drivers to
single device, wrapping each call, make one of them (atajmicron, atamarvell)
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.

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-16 15:38:27 +00:00
Alexander Motin
3f809d7a40 Add support for SATA ports on SATA+PATA Marvell controllers.
These controllers provide combination of AHCI for SATA and legacy
PCI ATA for PATA. Use same solution as used for JMicron controllers.
Add IDs of Marvell 88SX6102, 88SX6111. 88SX6141 alike controllers
2009-11-13 22:53:49 +00:00
Alexander Motin
fb549e86e7 Add more ICH10 chip IDs.
Submitted by:	Dmitry S. Luhtionov <mitya@cabletv.dp.ua>
2009-11-09 09:27:09 +00:00
Alexander Motin
99844cbf65 Add IDs for nVidia MCP65/77/79/89 SATA conntrollers. 2009-11-02 19:02:31 +00:00
Alexander Motin
6aca3a5d0b Add support for different request block format used by Gen-IIe Marvell SATA.
This adds support for Marvell 6042/7042 chips and Adaptec 1430SA controller.
2009-10-30 20:28:49 +00:00
Alexander Motin
6d3af67b23 Add two more VIA SATA chip IDs.
PR:		kern/135057
2009-10-26 10:00:59 +00:00
Rafal Jaworowski
93588d5c28 Move non-PCI prototypes from ata-pci.h -> ata-all.h.
This removes unnecessary PCI #includes dependency for systems with ATA
controllers living at non-PCI buses.

Submitted by:	Piotr Ziecik
Obtained from:	Semihalf
2009-06-24 15:38:17 +00:00
Ariff Abdullah
fbcaa016a2 Add another PCI id for Nvidia nForce MCP67, found in several Acer laptops. 2009-06-08 14:37:47 +00:00
John Baldwin
bb2aebf3ad - Add a void pointer to the ata-pci controller softc to allow
chipset-specific code to attach chipset-specific data.
- Use chipset-specific data in the acard and promise chipsets rather than
  changing the ivars of ATA PCI devices.  ivars are reserved for use by the
  parent bus driver and are _not_ available for use by devices directly.
  This fixes a panic during sysctl -a with certain Promise controllers with
  ACPI enabled.

Reviewed by:	mav
Tested by:	Magnus Kling (kingfon @ gmail) (on 7)
MFC after:	3 days
2009-05-14 14:57:13 +00:00
Alexander Motin
88413c6b88 Add ID of one more SII3132 revision found on adaptec aar-1225sa rev a2.
PR:		kern/127289
2009-05-07 19:17:06 +00:00
Jung-uk Kim
f71ac6d60a - Always force AHCI mode on a ATI/AMD SB600/700/800 SATA controller. These
controllers may be configured as legacy IDE mode by modifying subclass and
progif without actually changing PCI device IDs.  Instead of complicating
code, we always force AHCI mode while probing.  Also we restore AHCI mode
while resuming per ATI/AMD register programming/requirement guides.
- Fix SB700/800 "combined" mode.  Unlike SB600, this PATA controller can
combine two SATA ports and emulate one PATA channel as primary or secondary
depending on BIOS configuration.  When the combined mode is disabled, this
channel disappears and it works just like SB600 PATA controller, however.
- Add more PCI device IDs for SB700/800 and adjust device descriptions.
SB800 shares the same PCI device IDs and added two more SATA IDs.
2009-04-27 17:29:51 +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
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
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
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
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
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
Alexander Motin
cb33306f41 Call ata_legacy() only once on attach and save it's result. Scanning PCI
configuration registers (which are not going to change) on every interrupt
looks expensive, especially when interrupt is shared. Profiling shows me 3%
of time spent by atapci0 on pure network load due to IRQ sharing with em0.
2008-12-16 16:04:40 +00:00
Alexander Motin
69c43a238b Restore AHCI suspend/resume support,
broken with modularization commit (rev 183724).
2008-12-01 01:34:18 +00:00
Rui Paulo
5941227fcc Add support for Marvell PATA M88SX6121.
PR:		129154
Submitted by:	João Barros <joao.barros at gmail.com>
MFC after:	1 month
2008-11-25 00:39:03 +00:00
Søren Schmidt
13014ca04a This is the roumored ATA modulerisation works, and it needs a little explanation.
If you just config KERNEL as usual there should be no apparent changes, you'll get all chipset support code compiled in.

However there is now a way to only compile in code for chipsets needed on a pr vendor basis. ATA now has the following "device" entries:

atacore:	ATA core functionality, always needed for any ATA setup

atacard:	CARDBUS support
atacbus:	PC98 cbus support
ataisa:		ISA bus support
atapci:		PCI bus support only generic chipset support.

ataahci:	AHCI support, also pulled in by some vendor modules.

ataacard, ataacerlabs, ataadaptec, ataamd, ataati, atacenatek, atacypress, atacyrix, atahighpoint, ataintel, ataite, atajmicron, atamarvell, atamicron, atanational, atanetcell, atanvidia, atapromise, ataserverworks, atasiliconimage, atasis, atavia;	Vendor support, ie atavia for VIA chipsets

atadisk:	ATA disk driver
ataraid:	ATA softraid driver

atapicd:	ATAPI cd/dvd driver
atapifd:	ATAPI floppy/flashdisk driver
atapist:	ATAPI tape driver

atausb:		ATA<>USB bridge
atapicam:	ATA<>CAM bridge

This makes it possible to config a kernel with just VIA chipset support by having the following ATA lines in the kernel config file:

device          atacore
device          atapci
device          atavia

And then you need the atadisk, atapicd etc lines in there just as usual.

If you use ATA as modules loaded at boot there is few changes except the rename of the "ata" module to "atacore", things looks just as usual.
However under atapci you now have a whole bunch of vendor specific drivers, that you can kldload individually depending on you needs. Drivers have the same names as used in the kernel config explained above.
2008-10-09 12:56:57 +00:00
Søren Schmidt
0cf07094ca Add ICH10 PCI id's.
Submitted by:	Xin Li

Fix the number of PATA ports on newer ICHX chips, they have just 1 port not 2.
2008-10-02 19:18:28 +00:00
Søren Schmidt
ed0c85e094 Add support for the ITE 8213 controller.
Thanks goes to ITE who provided docs and feedback and made this possible.

Minor fixups to the Intel ICH code for bugs found while doing this.
(ITE8213 is very semilar to an Intel ICH)

MFC after: 1 week
2008-09-26 07:29:48 +00:00
Søren Schmidt
7aab7e054f Cleanup the AHCI code a bit.
Add suspend/resume for AHCI, general methods added.

Inspired by: Andrey V. Elsukov
2008-09-18 12:12:34 +00:00
Alexander Motin
02e5ff6c1b Add one more SII3132 chip PCI ID found on Adaptec Serial ATA II RAID 1220SA.
Submitted by:	Dmitry S. Luhtionov <mitya@cabletv.dp.ua>
2008-09-04 10:27:58 +00:00
Remko Lodder
1d69e13d1f Detect ATA controllers in the Macbook3.
PR:		118135
Submitted by:	ed
Approved by:	imp (mentor, implicit)
MFC after:	1 week
2008-07-10 21:36:53 +00:00
Remko Lodder
e9cb96265f Add new device id for ICH8M, which supports greater than UDMA33 mode
when it worked as generic IDE.

PR:			125422
Submitted by:		Andrey V. Elsukov <bu7cher at yandex dot ru>
Approved by:		imp (mentor, implicit)
MFC after:		1 week
2008-07-09 15:07:53 +00:00
Remko Lodder
8a282d33ec Add support for the ICH9 in non AHCI mode (RAID mode).
Submitted by:	Andrey V. Elsukov <bu7cher at yandex dot ru>
Tested by:	Vitalij L. Fadeev <fvl at mail dot ru>
Approved by:	imp (mentor, implicit)
MFC after:	1 week
2008-07-09 15:06:41 +00:00
Søren Schmidt
347458c95e Add HW level support for the Adaptec 1420SA controller. 2008-04-21 10:51:38 +00:00