Commit Graph

1242 Commits

Author SHA1 Message Date
Andrew Thompson
760bc48e7e s/usb2_/usb_/ on all C structs for the USB stack. 2009-05-28 17:36:36 +00:00
Andrew Thompson
fadc970b77 Fix a few variable renames of usb2_mode outside dev/usb. 2009-05-21 02:09:12 +00:00
Warner Losh
9e31449738 Last commit was in error, revert. 2009-05-20 21:31:47 +00:00
Warner Losh
00b4e54ae7 We no longer need to use d_thread_t, migrate to struct thread *. 2009-05-20 17:29:21 +00:00
Alexander Motin
74150c398a Fix NULL dereference on Promise SX4 controllers, while executing commands
that do not require data transfer (FLUSHCACHE).

Tested by:	Magnus Kling <klingfon@gmail.com>
MFC after:	1 week
2009-05-20 09:44:32 +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
Edward Tomasz Napierala
f095d54f01 Remove dead code.
Found with:	Coverity Prevent(tm)
CID:		556
2009-05-12 16:39:43 +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
Alexander Motin
b1d1fff76c Improve kernel dumping reliability for busy ATA channels:
- Generate fake channel interrupts even if channel busy with previous
request to let it finish. Without this, dumping requests were just queued
and never processed.
 - Drop pre-dump requests queue on dumping. ATA code, working in dumping
(interruptless) mode, unable to handle long request queue. Actually, to get
coherent dump we anyway should do as few unrelated actions as possible.
2009-05-01 08:03:46 +00:00
Alexander Motin
4c10f2e605 Add experimental support for SATA interface power management.
Feature is controlled by hint.ata.X.pm_level tunable:
 0 - PM disabled, old behaviour, default.
 1 - device is allowed to initiate PM state change, host is passive.
 2 - host initiates PARTIAL state transition every time port is idle.
 3 - host initiates SLUMBER state transition every time port is idle.

PARTIAL state has up to 100us (50us for me) wakeup latency, but for my
ICH8M saves 0.5W of power per drive. SLUMBER state has up to 10ms (3.5ms
for me) wakeup latency, but saves 0.8W of power.

Modes 2 and 3 are implemented only for AHCI driver now.

Interface power management is incompatible with device presence detection
(host receives no signal from drive, so unable to monitor it), so later is
disabled when PM is used.
2009-04-29 21:17:18 +00:00
Jung-uk Kim
c39437eb46 Use cached progif instead of reading it again. 2009-04-27 21:45:05 +00:00
Jung-uk Kim
c6b8ee96f6 - Give generic AHCI driver lower priority than device-specific drivers.
- Consistently use BUS_PROBE_GENERIC instead of -100.
2009-04-27 21:34:15 +00:00
Jung-uk Kim
7267edac39 Reduce code duplication and excessive pci_get_slot() calls.
Reviewed by:	mav
2009-04-27 19:39:18 +00:00
Jung-uk Kim
3388ca6b71 Reduce excessive pci_get_devid() and pci_get_revid() calls
on the same PCI device while device probing.
2009-04-27 18:10:42 +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
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
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
Remko Lodder
05e423585f Driver failed to allocate MMIO resources. Attached patch adds a fallback path.
It uses generic IDE facilities if sii-specific allocations failed

PR:		125421
Submitted by:	Andrey V. Elsukov <bu7cher at yandex dot ru>
Approved by:	imp (mentor, implicit)
MFC after:	1 week
2008-07-09 15:10: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
81b910389d Wait up to 1S for the TFD data to signal un-busy before fetching the signature.
This at least helps a few slow devices out there.

Submitted by:	Andrey V. Elsukov
2008-06-11 08:48:25 +00:00
Søren Schmidt
082b99a8b9 Rearrange how to call dma.alloc() so that we have resources alloc'd when need but also late enough to know how many to create. 2008-06-11 06:44:58 +00:00
Søren Schmidt
454f3b9249 Dont call ata_start() when ata_reinit fails in the ioctl path. 2008-05-26 08:58:48 +00:00
Peter Grehan
a384947e92 Fix panic and breakage for non-DMA ATA devices e.g. powermac macio cells.
Handle cases where dma function pointers may be NULL, and where
the max_iosize can't be derived from a DMA data structure. For
the latter, revert to the prior behaviour of using DFLTPHYS for
the max i/o size when there is no other data.

Reviewed by:		marcel
No objection by:	sos
2008-05-08 17:55:44 +00:00
Søren Schmidt
347458c95e Add HW level support for the Adaptec 1420SA controller. 2008-04-21 10:51:38 +00:00
Søren Schmidt
7963bde3d2 Unload DMA slot on device timeouts. 2008-04-21 10:35:19 +00:00
Søren Schmidt
629f08ade0 Do not enable FIS based PM switching, even if not used some controllers barf. 2008-04-21 10:34:31 +00:00
Bjoern A. Zeeb
95b02815da devclass_get_maxunit() returns n+1 with n starting at 0.
So if we have channel 0..3  devclass_get_maxunit is 4.

It's never been a problem as devclass_get_device() has
catched a possibly bad input.

Discussed with:	scottl
2008-04-20 17:45:32 +00:00
Søren Schmidt
3d970c5c0e Fix the breakage that caused AHCI devices to vanish. Editor droppings :(
Put the ATAPI device numbering back to the old ways.
2008-04-18 15:15:04 +00:00
Søren Schmidt
1b164f3101 Alloc two DMA slots pr default, silly me forgot that slaves still exists. 2008-04-17 18:11:47 +00:00
Søren Schmidt
104c094e06 Go back to preallocating everything possible on init.
This avoids calling busdma in the request processing path which caused a traumatic performance degradation.
Allocation has be postponed to after we know how many devices we possible can have on portmulitpliers to save some space.
2008-04-17 12:29:35 +00:00
Søren Schmidt
d90a6aaeb2 Fix problem with slave devices.
Fix or rather bring ENOMEM problems back to the state it was before.
Temporarily disable PortMultipliers on AHCI devices.
2008-04-14 18:34:24 +00:00
Søren Schmidt
1a796873ca Fix identify of slave devices. 2008-04-13 16:05:34 +00:00
Søren Schmidt
a7c33e78bf Dont call hw.status recursively.
Spotted by: Marcel Moolenaar
2008-04-12 17:21:22 +00:00
Søren Schmidt
31d745f2ed Fix badly placed '{'
Dont leak requests on busdma failure (not that we'd get anywhere anyhow).

Reported by: antoine@
2008-04-11 22:56:27 +00:00
Søren Schmidt
dca5e1abd5 Fix the brokenness in the former commit, sorry for the mess.
The problem is that the PM support is part of a much larger WIP here, but due to popular demand I decided to get some of it imported.

Also I forgot the mention:

HW sponsored by: Vitsch Electronics / VEHosting
2008-04-11 11:30:27 +00:00
Søren Schmidt
350d133a64 Fix clearing of nVidia interrupts. 2008-04-10 20:40:25 +00:00
Søren Schmidt
9f82379c24 Add experimental support for SATA Port Multipliers
Support is working on the Silicon Image SiI3124/3132.
Support is working on some AHCI chips but far from all.

Remember this is WIP, so test reports and (constructive) suggestions are welcome!
2008-04-10 13:05:05 +00:00
Søren Schmidt
471798c310 Unbreak the last commit.
Changes from the PM WIP sneaked in and caused compile errors.
2008-03-20 21:21:31 +00:00
Søren Schmidt
8ab1ead1c0 Fix Problem with Intel Matrix RAID.
Fix from PR/121899.
2008-03-20 11:54:26 +00:00
Poul-Henning Kamp
72d945abcc Add a "spindown" facility to ata-disks: If no requests have been received
for a configurable number of seconds, spin the disk down.  Spin it back
up on the next request.

Notice that the timeout is only armed by a request, so to spin down a
disk you may have to do:

	atacontrol spindown ad10 5
	dd if=/dev/ad10 of=/dev/null count=1

To disable spindown, set timeout to zero:

	atacontrol spindown ad10 0

In order to debug any trouble caused, this code is somewhat noisy on the
console.

Enabling spindown on a disk containing / or /var/log/messages is not
going to do anything sensible.

Spinning a disk up and down all the time will wear it out, use sensibly.

Approved by:	sos
2008-03-17 10:33:23 +00:00
Søren Schmidt
0ef0323800 Add proper support for the SATA/AHCI part of IXP[67]00 2008-03-07 09:29:19 +00:00
Poul-Henning Kamp
24ecb0cb15 If the disk reports that it support the Compact Flash Association command
set, announce BIO_DELETE capability and issue ATA_CFA_ERASE when we get one.

Once we issue more BIO_DELETE, this will improve lifetime, and
possibly write speed of Flash based devices which have usable flash
adaptation layers.

For now, about the only usage is the newfs(1) -E flag.

Approved by:	sos
2008-01-02 20:33:54 +00:00
Poul-Henning Kamp
08d2425f6f Follow the current fashion of gratuitously stomping into other
peoples code with irrelevant changes[1]:

Use bus_{read|write_*() instead of bus_space_{read|write}_*() for
purely stylistic reasons.

Due to compiler optimizations and inlining, this is for all practical
purposes without effect in the compiled code.

[1] NB: Approved by:	sos
2008-01-02 20:31:14 +00:00
Søren Schmidt
4c088dcd6c Implement a workaround of the datacorruption problem on serverworks HT1000 chipsets.
The HT1000 DMA engine seems to not always like 64K transfers and sometimes barfs data all over memory leading to instant chrash and burn.
Also fix 48bit adressing issues, apparently newer chips needs 16bit writes and not the usual fifo thing.

HW donated by: Travis Mikalson at TerraNovaNet
2007-12-13 11:47:36 +00:00
Søren Schmidt
02d76bfa1b Fix speed report on Intel SATA chips in compat mode.
Fix broken detect of JMicron 368.
2007-12-07 13:14:31 +00:00
Søren Schmidt
91b4ff52c7 Use device_set_desc_copy in the generic ident as its used on a temp buffer. 2007-11-26 19:08:08 +00:00
Søren Schmidt
506310cd36 Add preliminary SATA ATAPI support for sii 3132/3124 chips. 2007-11-23 08:17:14 +00:00
Kevin Lo
2f3ad9ba29 Fix KASSERT messages. 2007-11-20 04:52:19 +00:00
Søren Schmidt
2d9f60ca25 Dont fumble the ivars on reinit, avoids panic on suspend/resume om some systems that looses thier devices.
Patch by: jhb@
2007-11-19 21:11:26 +00:00
Søren Schmidt
34cf71f7ef Try to workaound silicon bugs in Promise gen2 (ie TX4) chips
Initial patch by Alexander Sabourenkov who found it in Promise's own driver.

Further fixes and sanity checks by yours truely.
2007-11-19 20:47:31 +00:00
Søren Schmidt
6b899f5077 Fix the problem with certain ATAPI commands on AHCI devices.
Revert the probe in atapi-cd.c to the old usage now its fixed on AHCI.
THis change also fixes using virtual CD's om fx parallels.

Still leaves the GEOM problem of telling media vs device access apart in the access function.
2007-11-19 18:05:48 +00:00
Søren Schmidt
200c7605c8 Add generic support for chipsets that say they support AHCI. This should catch new chipsets that we dont know but that we should support.
Add a few new PCI id's.
Misc cleanups.
2007-11-18 14:44:52 +00:00
Søren Schmidt
53a8035b0f Fix the signature matching code on AHCI controllers.
Add SATA ATAPI support for AHCI controllers.
2007-10-26 09:01:06 +00:00
Søren Schmidt
13a0de8755 Update the way we get the mode pages on probe. 2007-10-26 08:59:23 +00:00
Søren Schmidt
f31e86f556 Fix treating some modern chips (mem mapped) as legacy devices. 2007-10-26 08:57:08 +00:00
Xin LI
8846f7d296 Add PCI ID for ICH9 AHCI w/ two adapters.
Tested by:	Abdullah Ibn Hamad Al-Marri <almarrie gmail com>
Approved by:	sos
Approved by:	re (kensmith)
2007-10-09 20:15:09 +00:00
Søren Schmidt
358904bf9d Add support for the VIA 8237S
Fix the LBA28/LBA48 crossover bug.

Approved by: re@
2007-10-04 19:17:16 +00:00
Poul-Henning Kamp
13a3fdf1fe Recognize the CS5536 support chip for the AMD Geode LX CPU to enable
UDMA modes.

Please notice that Soekris NET5501 bios versions before 1.32f has a bug
that prevents this from working.

Approved by:	re (gnn)
MFC:		2 weeks
2007-10-04 06:21:54 +00:00
Simon L. B. Nielsen
18928d0deb Add PCI IDs for Intel ICH9.
PR:		kern/114473
Submitted by:	Michael Fuckner <michael@fuckner.net>
MFC after:	2 weeks
OK'ed by:	sos
Approved by:	re (bmah)
2007-09-10 19:16:39 +00:00
John Baldwin
14657ee81f Expand the data structure returned by the ATA RAID status ioctl to include
detailed status on each of the backing subdisks.  This allows userland
to see which subdisks are online, failed, missing, or a hot spare.

MFC after:	1 week
Approved by:	re (bmah)
Reviewed by:	sos
2007-08-13 18:46:31 +00:00
Remko Lodder
266d3a7a09 Add Viking Interworks 256MB as an ata device; this might give
some false positives but at this moment it is better to add
support then to dont have it at all (comment from Soren).

PR:		kern/111516
Submitted by:	Thomas Nystrom <thn at saeab dot se>
Approved by:	re (kensmith)
Approved by:	imp (mentor)
OK'ed by:	sos (With the comment noted above about false
		positives).
2007-06-26 22:13:43 +00:00
Søren Schmidt
27568384f3 Add support for the nVidia MCP61 series chipset.
Approved by: re (mux@)
2007-06-25 08:21:21 +00:00
Warner Losh
d98db3b7b2 Include usb_port.h
Approved by: re@ (blanket and/or cleanup commit approval)
2007-06-23 21:52:05 +00:00
Scott Long
b50569b71d Prepare for future integration between CAM and newbus. xpt_bus_register
now takes a device_t to be the parent of the bus that is being created.
Most SIMs have been updated with a reasonable argument, but a few exceptions
just pass NULL for now.  This argument isn't used yet and the newbus
integration likely won't be ready until after 7.0-RELEASE.
2007-06-17 05:55:54 +00:00
Bruce M Simpson
d3fd8d85fc Do not attempt to enable AHCI mode on ALi SATA controllers other
than the 5288.

It is not correctly implemented in earlier silicon, and the BIOS often
lies about AHCI capability on platforms where these chips are deployed.
With this change I am able to boot FreeBSD on the ASUS Vintage AH-1
barebones system.

Approved by:	sos
2007-06-13 17:44:49 +00:00
Pawel Jakub Dawidek
1bfd71cfc5 File d_ident field with disk's serial number.
No answer from:	sos
2007-05-06 01:20:06 +00:00
Scott Long
ae780f57f6 MPSAFE atapi-cam 2007-05-02 15:30:24 +00:00
Thomas Quinot
057f398585 (atapi_action, case XPT_SCSI_IO): Enable DMA only for READ and WRITE commands
as some combinations of chipset, controller and target do not behave
 correctly when DMA is enabled for other commands.

PR:		kern/103602
MFC after:	2 weeks
2007-04-30 09:33:57 +00:00
Thomas Quinot
e651554bf6 (atapi_cb): Fix test for the presence of sense data. An incorrect condition
was being tested, which would result in a system hang in some configurations.

PR:		kern/112119
Reviewed by:	scottl
MFC after:	3 days
2007-04-30 09:26:43 +00:00
Ollivier Robert
825f8b5050 Use the same timeout parameters for BIO_FLUSH as with the other commands.
This workaround the problem in Parallels/VMWare where the emulated drivers are
slower, especially with ATA_FLUSHCACHE.  The problem appears much more
frequently with ZFS which use it a lot more.

Approved:	sos, pjd
2007-04-26 12:59:20 +00:00
Scott Long
2b83592fdc Remove Giant from CAM. Drivers (SIMs) now register a mutex that CAM will
use to synchornize and protect all data objects that are used for that
SIM.  Drivers that are not yet MPSAFE register Giant and operate as
usual.  RIght now, no drivers are MPSAFE, though a few will be changed
in the coming week as this work settles down.

The driver API has changed, so all CAM drivers will need to be recompiled.
The userland API has not changed, so tools like camcontrol do not need to
be recompiled.
2007-04-15 08:49:19 +00:00
Søren Schmidt
ae4ce3ceef OK, this is not my day, fix the former fix :/ 2007-04-08 21:53:52 +00:00
Søren Schmidt
f27a14650f Hopefully unbreak the 64bit DMA support this time. 2007-04-08 19:18:51 +00:00
Søren Schmidt
cd945eed47 Dont zero out 64BIT flag on DMA ops. 2007-04-08 15:31:39 +00:00
Søren Schmidt
fe2fb53542 Add 64bit addressing support to SiI 3132/3124 2007-04-06 17:36:35 +00:00
Søren Schmidt
2cfcfef1fc Remove debug gunk. 2007-04-06 16:21:34 +00:00
Søren Schmidt
16194fc40b Add support for 64bit addressing to AHCI and Marvell controllers.
Munged into ATA shape and Marvell specifics my yours truely.

Submitted by: jhb
2007-04-06 16:18:59 +00:00