Commit Graph

234 Commits

Author SHA1 Message Date
Søren Schmidt
39c7a710c6 Return ATA register values in the request struct when ATAREQUEST returns. 2004-11-24 10:47:26 +00:00
Søren Schmidt
61efd2a8b3 Idle the channel earlier in reinit().
Cosmetic change to suspend, dont call tsleep an extra time at exit.
2004-10-19 20:13:38 +00:00
Søren Schmidt
b2d35a0408 Refine locking so it covers the "running" variable as well.
Adjust comments etc to fit the new locking system.
2004-10-13 15:16:35 +00:00
Søren Schmidt
b913aa0b7f Dont sleep with lock held. 2004-10-10 13:24:39 +00:00
Søren Schmidt
e59142714c Add SHARP to the pool of drives that doesn not need byteswapping of
the model etc fields from identify.
2004-10-07 11:43:25 +00:00
Søren Schmidt
6192895db8 Fix the PC98 lockups on boot.
The interchannel locking for PC98 needed to be updated to match the
rest of the locking in ATA.
2004-10-06 19:46:08 +00:00
Søren Schmidt
b5dee91f5f Remove the old ATA_*LOCK_CH macros that used atomic ops and use
mutexes instead.
This closes the last (known) race issues in ATA which should fix
the various hangs etc seen on heavy loaded systems.

Change from using timeout functions to using callout functions in
the timeout code. This together with above closes the race that could
happen if timeout and device interrupt occured simultaniously.

Also fix the possible recursion in ata_reinit() on very dodgy
devices that could take us down in the probe.
2004-09-26 11:48:43 +00:00
Søren Schmidt
a49513587b Ignore leading '_' in model name returned by devices.
This make "_NEC" devices appear as "NEC" which is more corrent.
The reason is tha NEC originally screwed up on the byteorder in the
model string, so now that they have realized that they prefixed the '_'
so that not every ATA driver on the planet would call them "EN C" :)
2004-09-16 09:35:01 +00:00
Søren Schmidt
6c893545ad Release the hold on ata_delayed_attach earlier so we can use tsleep
in the boot probe as well.

Suggested by:	gibbs
2004-09-09 13:25:46 +00:00
Søren Schmidt
0f7cfb8473 Introduce ata_udelay() that uses tsleep instead of DELAY if possible.
In places where we have long delays that doesn't depend on too accurate
timing, use ata_udelay() instead of DELAY() so we dont uselessly spin
the CPU if not nessesary;
2004-09-03 12:10:44 +00:00
Søren Schmidt
dc26948b0c Fix the handling of "inflight" requests when doing reinit's.
Add missing untimeout that would get lost in handling of some
error situations, and caused what looked like random timeouts
afterwards when the timeout fired.
2004-08-27 14:48:32 +00:00
Søren Schmidt
741d64783e Always pick up giant before returning from an ioctl call. 2004-08-24 15:09:05 +00:00
Søren Schmidt
5f7a48ef1e Improve (hopefully) on the workaround code for devices that doesn't
interrupt when command is done, ie some ATAPI CD drives with no
media loaded.
2004-08-16 09:32:35 +00:00
Søren Schmidt
d53fc3e41c Change the order of ata_dmainit/ata_allocate in preparation of
supporting new chipsets where this is needed.
2004-08-12 08:20:36 +00:00
Søren Schmidt
74f492f9bf Close a race in ata_reinit(). 2004-08-09 12:02:32 +00:00
John-Mark Gurney
3633dce05f make sure that ioctl's to ata use the proper cmd IOCATA...
Reviewed by:	sos
2004-08-09 06:47:53 +00:00
Søren Schmidt
7e6d75884f Try to narrow down the race window on HW that does not have ways to
poll for which channel actually pulled the irq line.
2004-08-05 21:13:41 +00:00
Søren Schmidt
601d3a344e Change the default to switch on DMA on ATAPI devices if they can
do UDMA2 (ATA33) mode and beyond.
2004-08-01 12:31:38 +00:00
Søren Schmidt
eaf8d2de9e Fix the panic (""memory modified after free") when ata_getparam() fails
and retries.

Found by:	Nate Lawson
2004-07-31 10:29:29 +00:00
Søren Schmidt
cc97de873c Attempt to handle suspend/resume better. 2004-07-12 10:50:50 +00:00
Søren Schmidt
29dc49f725 Use the right ordering of args on mtx_init(). No functional changes
since the args in question was all zero's.

Found by: Jimmy Olgeni <olgeni@FreeBSD.org>
2004-06-22 11:18:25 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Søren Schmidt
821b5752b3 Oops, backout debug code.. 2004-06-15 11:38:48 +00:00
Søren Schmidt
ebb6fc23c2 Dont set prefetch etc on VIA chips, causes problems on newer chips and
ATAPI devices.
2004-06-15 11:16:36 +00:00
Dag-Erling Smørgrav
76b108abfe Whitespace cleanup. 2004-05-20 14:49:12 +00:00
Søren Schmidt
ad452ba45c Spring cleanup of macros 2004-04-30 16:21:34 +00:00
Søren Schmidt
f2972d7eb8 Add support for the Promise command sequencer present on all modern Promise
controllers (PDC203** PDC206**).

This also adds preliminary support for the Promise SX4/SX4000 but *only*
as a "normal" Promise ATA controller (ATA RAID's are supported though
but only RAID0, RAID1 and RAID0+1).

This cuts off yet another 5-8% of the command overhead on promise controllers,
making them the fastest we have ever had support for.

Work is now continuing to add support for this in ATA RAID, to accellerate
ATA RAID quite a bit on these controllers, and especially the SX4/SX4000
series as they have quite a few tricks in there..

This commit also adds a few fixes to the SATA code needed for proper support.
2004-04-13 09:44:20 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
Søren Schmidt
498e55436a Add support for detaching PCI controllers.
This adds support for cardbus ATA/SATA controllers. I get roughly the
same transfer speeds as on true PCI controllers. Nice to be able to add
a couble of "real" disks to a laptop :)
2004-03-15 12:03:48 +00:00
Søren Schmidt
e7c9858a8f Remember to mtx_destroy mutexes. 2004-03-01 13:17:07 +00:00
Poul-Henning Kamp
dc08ffec87 Device megapatch 4/6:
Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
2004-02-21 21:10:55 +00:00
Søren Schmidt
367d380b54 Be more robust in the probe. We dont want to get into a loop with
reinitting when we try to identify devices. If they dont interrupt
on identify we retry once. If this fails we simply ignore that device.
2004-01-30 19:16:08 +00:00
Søren Schmidt
cedc7194d5 Fix breakage on timeout/retries. The bug cause a sema to be leaked so
that the calling process would newer wakeup.
2004-01-19 15:20:00 +00:00
Søren Schmidt
5df3ca789c Use UMA instead of plain malloc for getting ATA request storage.
This gives +10% performance on simple tests, so definitly worth it.
A few percent more could be had by not using M_ZERO'd alloc's, but
we then need to clear fields all over the place to be safe, and
that was deemed not worth the trouble (and it makes life dangerous).
2004-01-14 21:26:35 +00:00
Søren Schmidt
6f595c71c2 Fix ata_getparam to accept the fact that some crappy devices can pose as
both master and slave at the same time confusing the probe code.
2004-01-13 21:35:39 +00:00
Søren Schmidt
a7a120f649 Overhaul of the timeout/reinit framework. This should clear up most
of the leftovers from the old version that really doesn't work anymore.

Add a reset function for host-end of the ATA channel. This is needed
for the SiI3112 in order to whack it back to reality if a device
locks up the SATA interface (thereby preventing that we can reset the
device). The result is that ATA now recovers from the timeouts that
happens with the SiI3112A and more or less all disks based on old
PATA electronics with a Marvell PATA->SATA converter. This includes
lots of the popular SATA dongles and the WDC Raptor disks..
2004-01-11 22:08:34 +00:00
Søren Schmidt
ccd50c4818 Fix ata-card.
The altio resource magic no longer worked probably due to other changes
in the kernel. Redo that part so it also fits better into ATAng.
Fix detach so it doesn't panic the system when a pccard device is
yanked.

Approved by: re@
2003-11-30 16:27:59 +00:00
Søren Schmidt
1bebf0fbc9 Centralise mode setting. Instead of doing it in all subdrivers, do
it in ata-all.c where it belongs.

Prime controller HW by always setting PIO mode first in attach.
2003-11-11 14:55:36 +00:00
Dag-Erling Smørgrav
9e4826180a Move sysctl declarations next to the corresponding tunable declarations.
Add a sysctl declaration for hw.ata.atapi_dma, which had gone MIA (though
setting it in loader.conf still worked, it was not visible at runtime)

Approved by:	sos
2003-11-03 09:25:02 +00:00
Søren Schmidt
c4c8a3e041 Put devices into sleep mode (ie spin down) on detach. 2003-10-12 12:37:11 +00:00
Søren Schmidt
61dbcc0d05 Use isprint instead of isalpha in determining valid ident string. 2003-10-12 11:10:41 +00:00
Søren Schmidt
82681884cf Restore transfermode on devices after reinit. 2003-10-10 11:03:27 +00:00
Søren Schmidt
6235c1f6ae Dont store ata_params for devices that return a bogus ident string. 2003-10-10 11:00:06 +00:00
Søren Schmidt
e203a01fad In case we loose a device during reset in reinit() finish off
the request with error instead of loosing it.
2003-10-07 13:44:15 +00:00
Poul-Henning Kamp
70cd771337 The present defaults for the open and close for device drivers which
provide no methods does not make any sense, and is not used by any
driver.

It is a pretty hard to come up with even a theoretical concept of
a device driver which would always fail open and close with ENODEV.

Change the defaults to be nullopen() and nullclose() which simply
does nothing.

Remove explicit initializations to these from the drivers which
already used them.
2003-09-27 12:01:01 +00:00
Søren Schmidt
9855ae3844 Update the PIO mode gathering code.
Reported by: bde
2003-09-08 08:30:43 +00:00
Søren Schmidt
7c78880561 Rearrange the probe code yet again. 2003-09-01 11:13:21 +00:00
Søren Schmidt
61f07fc6ca Return the translated result code from ATA/ATAPI commands. 2003-08-27 15:27:56 +00:00
Søren Schmidt
9f06a4277f Unify prototypes.
Cosmetics.
2003-08-25 09:01:49 +00:00
Søren Schmidt
ea01d56917 Only call FLUSH_CACHE on devices that say they can.
This will get rid of the warnings issued at shutdown (that seems to
worry alot of users), but will also no flush cache on lots of
devices that can, but doesn't set the right support bits...
2003-08-25 07:59:50 +00:00