Commit Graph

1103 Commits

Author SHA1 Message Date
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
Alexander Motin
5690c13d14 Add workaround for some ATI chips, failing to soft-reset
when port multiplicator supported, but absent.
2009-02-15 16:05:48 +00:00
Alexander Motin
ce66729032 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
Alexander Motin
d7216f5694 DEVICE_PROBE(9) claims that we must not initialize softc on probe stage.
Move channel softc initialization from ata_XXX_probe() to ata_XXX_attach().

Instead of calculating ata channel number as position in child device list,
pass it's real number directly from controller probe routine using ivars.
It is simpler and IMHO more correct.
2009-02-14 21:54:44 +00:00
Warner Losh
02fa902fbe Fix shutdown routine to return 0 and change signature from void return
to int.
2009-02-04 20:26:27 +00:00
Warner Losh
85d27a4f81 Correct signature for the identify routine. The bad parameter wasn't
used at all, so this is just a tidiness excersize.
2009-02-04 20:23:42 +00:00
David E. O'Brien
b5d54ecafa Fix issue where ata_atapicmd() can never really return EBUSY which is
expected in acd_fixate().

This should fix various problems folks are having with 'burncd' reporting
"burncd: ioctl(CDRIOCFIXATE): Input/output error" during the fixate phase
when "fixate" is issued together with the "data" command.

PR:		95979
Submitted by:	Jaakko Heinonen <jh@saunalahti.fi>
2009-01-12 17:18:58 +00:00
Edward Tomasz Napierala
02caf36ee1 Make "kldunload atapicam" return EBUSY instead of deadlocking when a device
created by atapicam is being kept opened or mounted.  This is probably just
a temporary solution until we invent something better.

Reviewed by:	scottl
Approved by:	rwatson (mentor)
Sponsored by:	FreeBSD Foundation
Reported by:	Jaakko Heinonen
2009-01-08 17:26:51 +00:00
Alexander Motin
f6550fad4d Before modularization commit, atapci driver was attaching only to devices of
storage class. This check was lost. It is not important for the most cases,
but as it was reported on current@, it does important for sis driver and
surely inportant for AHCI driver. So restore it there.

Submitted by:   Toshikazu ICHINOSEKI, Andrey V. Elsukov
Discussed on:   current@
2008-12-18 21:13:46 +00:00
Alexander Motin
3ad8744168 Improve error handling at ata_ahci_chipinit().
Submitted by:	Andrey V. Elsukov
2008-12-17 19:17:58 +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
Peter Wemm
475a75abe5 Don't let ata_completed() dereference a null request->dma pointer to
print dma status after a media error.
2008-11-27 03:37:46 +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
2e9f7f6840 Only call dma.unload() if initialized.
Reported by: Stanislav Sedov
2008-10-27 09:26:24 +00:00
John Baldwin
03befed82c Restore the default maximum segment size for the bus dma tag to 64k as it
is in 6.x and 7.x.  The typo caused 64k transactions to be unnecessarily
split up into two PRD entries.
2008-10-21 18:51:55 +00:00
John Baldwin
dd8c8a8e43 - For chipsets that can't do 64k transfers, fall back to 32k transfers
(still a power of 2) rather than 63k transfers.  Even with 63k transfers
  some machines (such as Dell SC1435's) were experiencing chronic data
  corruption.
- Use the MIO method to talk to the Serverworks HT1000_S1 SATA controller
  like all the other SATA controllers rather than the compat PATA
  method.  This lets the controller see all 4 SATA ports and also
  matches the behavior of the Linux driver.

Silence from:	sos
MFC after:	3 days
2008-10-17 16:03:37 +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
Ed Schouten
6bfa9a2d66 Replace all calls to minor() with dev2unit().
After I removed all the unit2minor()/minor2unit() calls from the kernel
yesterday, I realised calling minor() everywhere is quite confusing.
Character devices now only have the ability to store a unit number, not
a minor number. Remove the confusion by using dev2unit() everywhere.

This commit could also be considered as a bug fix. A lot of drivers call
minor(), while they should actually be calling dev2unit(). In -CURRENT
this isn't a problem, but it turns out we never had any problem reports
related to that issue in the past. I suspect not many people connect
more than 256 pieces of the same hardware.

Reviewed by:	kib
2008-09-27 08:51:18 +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
Philip Paeps
854d77bdd6 Introduce a new loader tunable "hw.ata.ata_dma_check_80pin", defaulting to 1.
This can be used to disable the 80pin cable check on systems which forget to
set the bit -- such as certain laptops and Soekris boards.

PR:		kern/114605 (somewhat reworked)
Submitted by:	marck
MFC after:	1 week
2008-08-15 10:55:11 +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