Commit Graph

896 Commits

Author SHA1 Message Date
sos
181b909b2c 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
sos
96967ead83 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
sos
104924bb06 Always set half'n'half mode on ICH* chips. 2004-10-01 09:06:22 +00:00
sos
a2615e3bda Fix the serverworks modesetting code, of mask offset was wrong. 2004-10-01 09:04:53 +00:00
sos
e7c7f8c03c Resurrect dump that broke with the last update. 2004-09-30 20:54:59 +00:00
sos
2fb6fe6a94 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
sos
63d0be9051 Rearrange the order of I/O's in dma-start/stop, some chipsets are very
picky on the order of this, especially in error situations.
2004-09-26 11:42:42 +00:00
sos
7e6d8f0852 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
sos
7c3c92e15d Reduce the amount of memory reported to busdma.
This made the requirements for bouncebuffers too big with PAE.
Cleanup the way size defines for transfers are implemented.
2004-09-10 10:31:37 +00:00
sos
d5ca951456 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
sos
f4de4acfe4 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
sos
05ea18e82c Sync promise_mio_command with WIP on the Promise line of SATA controllers. 2004-09-03 08:23:04 +00:00
sos
ee581aec84 Cleanup the defines used for various chipsets.
Add new nVidia controllers.
2004-09-03 07:37:53 +00:00
sos
f91a9a0e8d Cleanup the storing and printing of the device transfermode for SATA. 2004-09-01 12:15:44 +00:00
sos
8740f32a4f remove unused prototype 2004-08-27 22:14:45 +00:00
sos
e873df18d5 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
sos
f73c7c1c58 Set and reset the right bit for UDMA enable/disable on the ICH* chips. 2004-08-27 12:54:58 +00:00
sos
d8df060fde Rearrange the call to disk_destroy.
Suggested by:	phk
2004-08-27 12:03:18 +00:00
sos
1ec5d22c32 Sii_reset needs to wait up to 1 second to get slow disks with it so
use tsleep instead of DELAY.
2004-08-24 20:11:26 +00:00
sos
aa70a744dd Always pick up giant before returning from an ioctl call. 2004-08-24 15:09:05 +00:00
sos
9410cb311e Properly check malloc returns. 2004-08-24 10:39:00 +00:00
sos
be94cde364 Workaround devices that responds with registers as *both* master & slave,
but fail utterly when we try to talk to the "fake" device.
2004-08-22 15:54:08 +00:00
sos
61ba3ee1cb Correct the args to busdma, mostly cosmetic. 2004-08-20 19:05:22 +00:00
sos
3e33988307 DONT PANIC
Only call dmainit() if there is a valid busmaster resource.
2004-08-20 06:19:25 +00:00
sos
2f36723c3d 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
sos
0c3597671a Fix Promise sx4/sx4000 support that broke on the latest race fixes. 2004-08-16 09:29:46 +00:00
sos
6f119c28ba Allow the use of a supplied function to set the PRD table. This is
needed for new chips that supports 64bit addressing.
2004-08-13 08:14:27 +00:00
sos
a71e43e2c6 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
sos
ee3f3a009a Fix bad free() usage.
Submitted by:	Pawel Jakub Dawidek
2004-08-09 14:22:58 +00:00
sos
7d8a7cc8a3 Close a race in ata_reinit(). 2004-08-09 12:02:32 +00:00
jmg
895cafe317 make sure that ioctl's to ata use the proper cmd IOCATA...
Reviewed by:	sos
2004-08-09 06:47:53 +00:00
phk
d8d2b01380 Tag all geom classes in the tree with a version number. 2004-08-08 07:57:53 +00:00
sos
c483b63711 Correct the last commit so it works in error situations as well. 2004-08-07 12:49:28 +00:00
njl
d9ff05bfb1 Fix a panic in ata_generic_transaction(). The DMA pointer of the channel
was being unconditionally dereferenced but was NULL for PIO requests.
Check the request flags for a DMA transaction before dereferencing.

Reported by:	ceri
Tested by:	Radek Kozlowski <radek -at- raadradd.com>
2004-08-06 22:23:53 +00:00
sos
6016d1505d 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
sos
54e7375090 Add firmware revision to probe printf. 2004-08-05 21:11:33 +00:00
sos
12d6bd3743 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
sos
e95ea22d81 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
sos
9ad7d89c48 Fix the reset sequence for sx4/sx4000 type controllers, it could hang the
chip in an indefinite state.
2004-07-30 13:33:09 +00:00
sos
a33b996095 Refine the wait for ATAPI_RESET.
Properly wait for not busy and introduce a timeout for devices not
setting busy (as they should).
Leave a printf in there that states how long the wait was, as I'd like
to get an idea of the variations here. The time needed seems also to be
affected by whether a medium is present or not.
2004-07-24 19:03:28 +00:00
sos
13128d7277 Dont expect interrupt from ATAPI_RESET, it doesn't deliver one. 2004-07-23 17:01:47 +00:00
sos
7eac47804a Dont set "address setup timing" on newer VIA chips.
closes PR:	69180
2004-07-17 14:48:46 +00:00
sos
4997cbe712 Attempt to handle suspend/resume better. 2004-07-12 10:50:50 +00:00
sos
a600480444 Remove leftover debug output. 2004-06-30 09:22:47 +00:00
sos
2c69c72b78 Add support for LSI type software RAID's.
Made possible by: John Cagle @ HP
2004-06-25 21:21:59 +00:00
sos
166655f4a8 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
green
acfb823f3f Call the detach function with g_waitfor_event() so that it can access
the GEOM topology.

There are still issues with not detaching from cam correctly such that
upon a device detach there's an invalid pointer dereference from the
later call to cam_rescan().
2004-06-21 20:42:03 +00:00
sos
86c6c2575c Up SiI reset wait a bit, some devices got lost. 2004-06-17 21:36:10 +00:00
green
16b3d5deee atapicam(4) is currently off by three orders of magnitude regarding the
timeout values in the CAM CCBs.  Divide by 1000 to get values in seconds
which are what ata(4) timeouts internally use.

This does lose granularity, though, and small values can now round down
to zero.  It's probably worth making all ata(4) timeouts in terms of
hz/ticks/milliseconds/something.
2004-06-17 07:29:56 +00:00
phk
dfd1f7fd50 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
sos
ca830264a9 Oops, backout debug code.. 2004-06-15 11:38:48 +00:00
sos
3ebcca508c Dont set prefetch etc on VIA chips, causes problems on newer chips and
ATAPI devices.
2004-06-15 11:16:36 +00:00
sos
153630cb88 Increase robustness of SATA handling. 2004-06-15 11:02:09 +00:00
sos
f7faebf7e4 Back out the last change as that broke some SATA devices.
Now we are cleaing up remove a few lines of unused code.
2004-06-11 07:39:15 +00:00
phk
9db9f1379c Add missing <sys/module.h> includes currently relying on nested include
in <sys/kernel.h>
2004-06-03 06:10:02 +00:00
sos
1a40a5a65c When waiting for drive to become ready, reinit the request params as they
might get trashed by autosensing.
2004-06-01 12:28:45 +00:00
sos
a6ddd03408 Use the right cmd+errorcode if we are in autosense/not. 2004-06-01 12:26:08 +00:00
sos
70c10dad98 Only set and report error if not set already. 2004-06-01 11:37:24 +00:00
sos
2fbc4845f9 Dont retry on devices that left the system.
Ignore "fake" devices that has 0x7f status.
2004-06-01 11:34:46 +00:00
imp
5f2befc69a Fix disordering of pccarddevs.h noticed by bde. Also remove a few
redundant includes and fix some of the include disordering.

Submitted by: bde
2004-05-27 03:49:45 +00:00
imp
1f5642e8bb Move to generating pccarddevs.h on the fly, both for the kernel and
the modules.

Also generate usbdevs.h automatically now, but a non-kernel file is
stopping that at the moment.
2004-05-26 00:53:10 +00:00
des
1c76db064e Whitespace cleanup. 2004-05-20 14:49:12 +00:00
sos
f217f52c7f Rip out the too verbose "spurious interrupt" printf's, they dont serve
a purpose any longer.
2004-05-17 17:53:12 +00:00
sos
b4c5462d13 Fix Sii3114 support. 2004-05-10 20:23:25 +00:00
sos
a4daa2d36b Do at better job at unit numbering. 2004-04-30 18:49:03 +00:00
sos
266c927d2d Spring cleanup of macros 2004-04-30 16:21:34 +00:00
sos
7b7ea5391b Reduce the time spent looking for devices on channels that return
what looks like garbage.
2004-04-27 15:52:08 +00:00
sos
18295a0f2e Use pci_get_progif to decide if this is one of the primary/secondary
channels. This also work when PCI native mode has been selected
(patch for /sys/dev/pci/pci.c needed for that) since pci_get_progif
uses the saved value for progif, not the one stored after we may have
changed from legacy mode to native PCI mode.
2004-04-27 12:54:59 +00:00
sos
70a39823c7 Try the simplify determining what is ata0 and ata1.
Remove the PCI native addressing code, it eed to be run before we even
have control in the ATA driver and should be moved to the pci code.
2004-04-24 16:32:06 +00:00
sos
0eae77e315 Change setup for SiS device to allow PCI native mode. 2004-04-24 15:54:20 +00:00
sos
5e6e9f86ba Make the test for ATA PCI legacy addressing mode more robust.
Add code (currently ifdef'd out) to allow ATA PCI native addressing.
Fix the altio offset for ATA PCI devices.
2004-04-21 20:03:26 +00:00
sos
144f138e6f Do not pre-allocate resources for BAR's on ATA MASTERDEV's thats on
the standard ATA primary and secondary addresses.

Reintroduce the size 1 ALTIO space so that we can have both ATA and
floppies back working.
2004-04-20 20:57:29 +00:00
sos
313fe9e05d Move a verbose printf before the first exit so we get a chance
to see what was there.
2004-04-19 18:29:43 +00:00
sos
cc41608d4e 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
njl
05a1f56fc9 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
sos
662b843050 Update the SiS support to distinguish older southbridges better. 2004-03-16 16:23:28 +00:00
sos
dc99d6d221 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
sos
b841b4a2f1 Add yet another VIA pci id. 2004-03-11 14:08:11 +00:00
sos
c1c4026c1a Only setup sii_reset on sii311[24]. 2004-03-04 16:39:59 +00:00
thomas
b924bcd144 Use auto-sense data provided by the lowlevel ATA code. 2004-03-04 15:37:39 +00:00
sos
6b843cff78 If being verbose in the autosense code, print the original error. 2004-03-02 16:16:54 +00:00
sos
3090a1eb47 Report the original command on failures that causes auto sense.
Keep the ATA_R_QUIET flag if set during autosense.
2004-03-02 14:05:12 +00:00
sos
20140d6615 Fix getting progress data for some device in yet another way.
Take advantage of the new autosense logic.
2004-03-02 14:03:43 +00:00
sos
16b335106f Remember to mtx_destroy mutexes. 2004-03-01 13:17:07 +00:00
sos
3c49599da8 Rearrange sense_key and sense_data to get alignment right.
Submitted by: Marcel
2004-02-29 09:35:29 +00:00
sos
8b2299dc54 Issue a request sense command automagically when ATAPI commands fail
with a valid sense key.
2004-02-28 17:47:27 +00:00
sos
71424aefe1 Add support for the sii3512 SATA chip. 2004-02-25 09:55:49 +00:00
phk
ad925439e0 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
sos
1de14db959 Dont alloc size 0 buffers. 2004-02-21 18:30:03 +00:00
sos
7a8fa65984 Check both PORTEN and MEMEN for enabled HW. 2004-02-21 18:21:13 +00:00
sos
74a845e42e Only register interrupt as seen if it was a real HW interrupt. 2004-02-21 16:55:10 +00:00
phk
49c92e5706 Change the disk(9) API in order to make device removal more robust.
Previously the "struct disk" were owned by the device driver and this
gave us problems when the device disappared and the users of that device
were not immediately disappearing.

Now the struct disk is allocate with a new call, disk_alloc() and owned
by geom_disk and just abandonned by the device driver when disk_create()
is called.

Unfortunately, this results in a ton of "s/\./->/" changes to device
drivers.

Since I'm doing the sweep anyway, a couple of other API improvements
have been carried out at the same time:

The Giant awareness flag has been flipped from DISKFLAG_NOGIANT to
DISKFLAG_NEEDSGIANT

A version number have been added to disk_create() so that we can detect,
report and ignore binary drivers with old ABI in the future.

Manual page update to follow shortly.
2004-02-18 21:36:53 +00:00
sos
8a794db9e9 Dont use the bio_taskqueue if we are in timeout.
Use taskqueue_thread rather than taskqueue_swi (maybe we should have
a taskqueue_ata).
2004-02-17 19:24:11 +00:00
thomas
b1740ac085 (atapi_cb): Reenable automatic retrieve of sense data on error, making
it asynchronous to avoid incorrect use of ata_atapicmd within an
 ATAPI callback.

Tested by:	harti
2004-02-11 10:14:08 +00:00
sos
e954c4b75e Commit simple workarounf for the "LiteOn" hang on boot problem.
This allows the system to boot so I can get the world out of
my mailbox and get some work done to figure out what this mess
is all about.
2004-02-06 11:36:50 +00:00
sos
88dbe90498 Move the enabling of interrupt back to where it was some time ago.
This apparently was what broke the boot with some devices (liteon).
2004-02-02 15:49:01 +00:00
sos
7d8abef95b Fix support for the Promise TX4 on amd64.
Somehow the bridge on there shows up with another PCI id than
it does on x86, no idea why...
2004-02-02 14:05:57 +00:00
sos
d6d611fb17 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
sos
85f33cbeb4 Cleanups/cosmetics. 2004-01-29 15:03:01 +00:00
sos
e2d757c7c1 Fix for those lost interrupts on probe on lots of controller types.
Note to self, just because an idea is good, it doesn't apply everywhere.
2004-01-28 21:54:40 +00:00
sos
3678d31f17 Use the biotask functionality in GEOM to put finished requests on
instead of taskqueue_swi. This shaves from 1 to 10% of the overhead.

Overhaul the locking once more, there was a few possible races that
are now closed.
2004-01-28 20:38:51 +00:00
sos
928e6e1d2c Fix breakage in PIO multisector support. 2004-01-23 10:38:56 +00:00
sos
dcc245d4e9 Update the support for the VIA 8237 southbridge. 2004-01-20 16:51:02 +00:00
sos
5948092ae2 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
ru
d1f9a77c02 Fixed a memory leak. 2004-01-18 17:21:15 +00:00
sos
9d9c0df372 Fix botch in last commit. 2004-01-18 15:58:30 +00:00
sos
523bdbcc21 Add missing free's. 2004-01-18 10:50:40 +00:00
sos
05b82e9162 Add support for the Silicon Image 3114 4 channel SATA controller. 2004-01-17 23:34:13 +00:00
sos
894449cd93 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
sos
3892f4c9cb Fix potential cable detection problem on older CMD chips. 2004-01-14 14:24:36 +00:00
sos
04c923e6c5 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
sos
58a7725eaf Always return ENOMEM if ata_request_alloc fails so GEOM can dtrt. 2004-01-12 09:33:10 +00:00
sos
815a7852da #include sema.h is now required. 2004-01-12 07:16:07 +00:00
sos
d6c0154728 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
sos
c87939ff3b Use the saved params for LBA-CHS conversion. Fixes PC98 bug. 2004-01-08 19:17:16 +00:00
sos
cb427b7fa2 Try to simplify the SiS probe. If SiS stays with the current schema for
new nothbridges we should even find the southbridge and be able to
use it (if its one we know that is).
2003-12-25 19:37:11 +00:00
sos
e39859cafe Fix the register timings for AMD/VIA/nVidia chipsets. 2003-12-18 17:36:41 +00:00
sos
8b0e0833ec Add support for the SiS 661 chipset (using SiS 963 south). 2003-12-18 08:07:05 +00:00
sos
55beee1cca Fix compilation on 64bit archs. 2003-12-16 19:41:38 +00:00
sos
a1979e4f7e Print the LBA on failing R/W commands. 2003-12-15 20:43:17 +00:00
sos
fa790cf424 Finetune last commit, we need to take care of empty channels. 2003-12-10 23:06:24 +00:00
sos
e6cf44c49d Add back the national support, this was removed by accident earlier. 2003-12-09 19:13:50 +00:00
sos
8b107990e3 More errata fixing for the SiI3112A disaster chip:
Serialize access to the SATA channels, the chip messes up if
both channels are used at the same time.

The SiI3112 hereby takes the price as the most crappy SATA chip in
existance by a significant amount.

My advise to our userbase is to avoid this chip like the plague...
2003-12-08 09:22:20 +00:00
sos
8a088743db Fix more problems with the Silicon Image 3112A:
Setup decent transfer mode defaults as some BIOS's seem to put in
things that it *knows* doesn't work.
(Note to BIOS writers: stop doing that nonsense, we will get things
working with your crappy HW anyways, and then recommend users to buy
someone else's products that "just works", thankyou.. )

Limit the device transfer mode to ATA100/UDMA5 on generic SATA.
 Since we dont know if the user is using a pure SATA device or an
old PATA drive with a SATA converter dongle, we need to limit the
speed used here to cover up the problems with Marvell ATA-SATA bridges
used in lots of SATA products.

This workaround is enabled for all detectable SATA controllers as they
seem to have semilar problems here. One notable exception is all the
Promise pdc2037x chips which just always work (cudos to Promise!).
2003-12-08 08:27:52 +00:00
sos
7df01b5cbc Try a little harder to catch when fixate finishes.
On the <QSI CD-RW/DVD-ROM SBW-242> that failed causing burncd to
wait forever...
2003-12-07 23:15:22 +00:00
scottl
a6ef4bf45a Fix a potential problem with atapi-cam where an incorrect flag is passed
into the ata queueing layer.

Approved by:	re
2003-12-05 01:02:46 +00:00
sos
86b39578a0 Fix for the missing slave problem.
Approved by: re@
2003-12-03 15:32:53 +00:00
sos
e57603da9f Fix modesetting on ISA only systems.
Approved by: re@
2003-12-03 13:40:26 +00:00
sos
396e8abc85 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
sos
9bcba46103 Workaround for errata on early versions of the sii3112.
Approved by: re@
2003-11-28 19:01:28 +00:00
sos
a7fe60b249 Correct the former patch, I accidently committed the wrong version.
Approved by: re@
2003-11-24 14:54:41 +00:00
sos
fbc1154fb8 Fix panic on certain failed configs.
Approved by: re@
2003-11-24 14:22:30 +00:00
sos
dbb35f2dd3 Be less noisy when GEOM probes around during boot if drive contains
invalid media (ie empty CD/DVD)

Approved by: re@
2003-11-24 14:20:19 +00:00
sos
2c3c1553db Fix support for the cmd646 chip.
Spotted by: tmm
reviewed by: re@
2003-11-21 22:58:56 +00:00
sos
7755abc4df Add support for the SiS964 ATA/SATA southbridge.
This could not have been done without the support from kuriyama.

Approved by: re@
2003-11-18 15:27:28 +00:00
sos
b25c284c76 Work around the problem that some CDROM drives might return different
TOC's for the same media!! that borks up GEOM.
Although this looks like bad HW the following patch removes the
chance for GEOM panic'ing.

Approved by: re@
2003-11-18 15:23:37 +00:00
sos
ebe00702c0 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
sos
f94d8d190f Update the dump code to flush buffers at the end of the dump
to avoid loosing evt cached data.
2003-11-11 07:49:45 +00:00
scottl
b5775784dd Free the ata_request struct after we are done using it. This should stop
the memory leak seen when using ATAPICAM.
2003-11-09 20:46:08 +00:00
sos
1528f8f6b7 Fix typo in breaking up requests to size limit.
Found by: Peter Edwards <pmedwards@eircom.net>
2003-11-09 10:11:15 +00:00
sos
2b6b524b73 Remove the NOGIANT flag again, it was premature. 2003-11-08 09:56:34 +00:00
sos
4c2de3d46a Better attempt at fooling GEOM into working with burnable media. 2003-11-07 08:31:09 +00:00
sos
d7dd8dce01 Pull ataraid out from under giant.
Use the right bio_* fields for internal stuff.
2003-11-05 15:41:20 +00:00
des
a58f9feb7e 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
sos
7908dcfbce Fix burning of CD's that got broken by the GEOM'ification.
GEOM was not designed to handle media that does not have
a size. Blank CD's are of that type, so cheat and set the
media size to -1. This allows burning to work, but makes
GEOM issue outofrange reads that makes the ATAPI subsystem
spew out a few warnings. GEOM should be tought about this.

GEOM was not designed to handle changing the sectorsize
between opens. Writing multitack CD's with both audio and
data tracks needs to change sector size on the fly. We
cheat here and stuff the current sectorsize into GEOM
private internals. GEOM should grow some clean way for this.
2003-11-02 22:24:47 +00:00
sos
3cc8e8cc8d On ATA control commands return the registers in the request. 2003-11-02 22:04:53 +00:00
sos
8cb7424022 GEOM'ify atapi-cd. Original patch by phk, subtle changes by me. 2003-11-01 09:44:33 +00:00
sos
4034aaaff9 Fix cable detection on AMD chips. 2003-11-01 09:30:15 +00:00
sos
d72fb90a16 Add support for the VIA 8237 (both PATA and SATA part).
Cleanup the SATA support a bit now we are here anyways.
2003-10-30 13:16:21 +00:00
sos
67cd4eebae Cleanup the interrupt code that deals with the busmaster bits. 2003-10-28 21:08:14 +00:00
sos
b0cc5e450b This should allow us to boot with DMA enabled on unknown PCI ATA
chipsets, well at least newer ones...
2003-10-28 19:01:48 +00:00
sos
63e0f3bdf5 Properly unload the DMA SG list on errors. 2003-10-21 19:25:20 +00:00
sos
08d97161dc Fix the DMA problem that most severely hit on the DS3112a SATA chip
in connection with Marvell based SATA->PATA dongles.

The problem was caused by a combination of things working
together to make it hard to spot...

The ATA driver has always started the ATA command, then build
the SG list for DMA and then finally started the DMA engine.
While this is according to specs, it poses a potential
problem as some controllers apparently do not allow for unlimitted
time between starting the ATA command and starting the DMA engine.

At about the same time as ATAng was committed there were lots
of other changes applied, some of which was locking in parts
that causes the busdma load functions to take significantly
longer to load the SG list.

This pushed the time spent between starting the ATA command and
starting the DMA engine over the hill for some controllers
(especially the Silicon Image DS3112a) and caused what looked
like lost interrupts.

The solution is to get all the SG list work or rather all
busdma related stuff done before we even try to start anything.

This has the nice side effect of seperating busdma out the
way it should be, so the working of the ATA machinery is not
cluttered up with busdma droppings, making the code easier
to read and understand.
2003-10-21 19:20:37 +00:00
silby
f0e686a675 Change all SYSCTLS which are readonly and have a related TUNABLE
from CTLFLAG_RD to CTLFLAG_RDTUN so that sysctl(8) can provide
more useful error messages.
2003-10-21 18:28:36 +00:00
sos
b85e19be51 Up the alignment requirement of the SC1100 to 16 bytes, it has all the bugs and then some of its Cyrix inheritance.
Set the max_iosize for the Cyrix to 63K as the SC1100.
2003-10-21 08:53:29 +00:00
sos
e83edc4bf6 If just gcc could make up its mind... 2003-10-20 14:28:37 +00:00
sos
0468baeb3f Only return valid DMA error bits. 2003-10-20 13:45:11 +00:00
sos
c0bf81d66c Up delay from 10 to 100ms after reset, this helps some slow devices
get their act together before we start probing.
2003-10-20 13:44:33 +00:00
sos
cff8e144fe Only announce ECC errors when its only that. 2003-10-20 13:32:42 +00:00
phk
466d3b80d8 No need to initialize bio_pblkno from bio_blkno, disksort uses bio_offset. 2003-10-18 17:24:51 +00:00
sos
3d089cc2b5 Reintroduce the "recovered from lost interrupt" code, but in a new
(hopefully) panic safe way.

Why the interrupts are lost is still a mystery, to me at least.
2003-10-14 16:53:13 +00:00
sos
7712a47b75 Redo the code that handles eject/close. 2003-10-12 13:11:57 +00:00
sos
e9cd93f034 Avoid potential race on ATA_R_DONE. 2003-10-12 12:38:03 +00:00
sos
e0cb3af529 Put devices into sleep mode (ie spin down) on detach. 2003-10-12 12:37:11 +00:00
sos
4f4aab360e Up timeout to 10s (from 5) in r/w commands. 2003-10-12 12:35:44 +00:00
sos
10cc9981e2 Use isprint instead of isalpha in determining valid ident string. 2003-10-12 11:10:41 +00:00
sos
2688d98031 Restore transfermode on devices after reinit. 2003-10-10 11:03:27 +00:00
sos
dff7842fed Dont store ata_params for devices that return a bogus ident string. 2003-10-10 11:00:06 +00:00
sos
a2ab5a4d04 Fix the bug that prevented DMA from working on old Acer chips.
Found by: Andrew Gallatin <gallatin@cs.duke.edu>
Pointy hat to: sos
2003-10-09 14:33:06 +00:00
sos
93a92c1266 Give more correct params to busdma_* 2003-10-07 13:48:55 +00:00
sos
5efe096026 Improve timeout handling and reporting. 2003-10-07 13:47:40 +00:00
sos
d6450d69ba Properly get out of transaction() if setting up the transfer fails. 2003-10-07 13:45:56 +00:00
sos
b36254292b 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
imp
e837ada539 Include pccard/pccard_cis.h here too 2003-10-07 04:26:14 +00:00
sos
c8f8c81f54 Fix the problem with accessing certain FLASH devices. The problem
was that accessing the status reg could occour too fast, confusing
the logic in the flash part. Could not have been located without:

HW donated by: Jonas Bülow <jonas@servicefactory.se>
2003-10-01 09:58:19 +00:00
phk
7099deadda 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
thomas
8bdc92f0f2 Enable DMA for ATAPI/CAM input/output operations.
Reviewed by:	scottl
2003-09-24 18:40:10 +00:00
tmm
00a4662792 Fix inverted BURN_BRIDGES and GONE_IN_5 #ifdefs. 2003-09-22 17:58:40 +00:00
phk
2e70579d54 Make the clone handler BURN_BRIDGES but the actual 'a' and 'c' partition
check GONE_IN_5:  We need the clone handler for root filesystem case.

Once under GEOM, we can remove the clone handler as GEOM provides one.
2003-09-21 18:57:12 +00:00
thomas
caa0284630 (atapi_cb): Reorganize error handling circuitry.
Fix to the messages output under CAM_DEBUG_CCB: the summary sense
 information (error bits and sense key) is in the error field, not
 in the result field, of struct ata_request. No other functional change.
2003-09-21 16:49:53 +00:00
thomas
b909344096 (atapi_cb): Disable autosense for now as it causes a missed ATA interrupt.
Minor reformatting.
2003-09-21 08:53:05 +00:00
sos
afa1f29efd Dont reject a master device if it said slave failed. 2003-09-20 08:38:33 +00:00
thomas
8c7501fe47 (atapi_action): avoid memory leak in a marginal invalid ccb case.
(free_hcb): defend against calling TAILQ_REMOVE on an hcb that was
 not inserted on pending_hcbs.
2003-09-19 16:25:44 +00:00
sos
6605c73f36 Always check the sensekey field on ATAPI returns
Add INQUIRY to cmd2str.
2003-09-19 12:46:12 +00:00
sos
656202405b Cosmetics 2003-09-18 16:44:54 +00:00
sos
883996d3a1 Be a bit more restrictive in the probe so we dont hang around
on empty channels in most cases.
2003-09-18 16:43:08 +00:00
sos
14ff5b8544 Properly handle error code returns from the lower levels ATAPI code. 2003-09-18 09:22:14 +00:00
sos
c13a8cc2c7 When ignoring interrupts (due to no running request set) then try
to grap the channel so we can read status (and clear an evt pending
interrupt).
2003-09-16 15:21:37 +00:00
sos
8e84f6e31b Rearrange the probe a bit first try ATAPI signatures then ATA. 2003-09-16 15:16:36 +00:00
sos
476595cf12 Properly cast longs to off_t so we dont loose precision. 2003-09-16 14:41:44 +00:00
phk
1ea5197e3f Disable the use of cloning use in floppy and CD drivers.
This commit puts the relevant code snippets under #ifdef GONE_IN_5
(rather than #ifndef BURN_BRIDGES) thereby disabling the code now.

The code wil be entirely removed before 5.2 unless we find reasons
why this would be a bad idea.

Approach suggested by:	imp
2003-09-11 19:27:24 +00:00
thomas
3b78f25cc9 (atapi_action, case XPT_PATH_INQ): Handle properly the case of
CAM_TARGET_WILDCARD (target_id_t is an unsigned integer type).
Fixes boot-time crash on Alpha.

Reviewed by:	roberto
Approved by:	re (murray)
MFC after:	1 week
2003-09-11 17:34:47 +00:00
sos
b8fc895447 Add support of the DIOCGSECTORSIZE & DIOCGMEDIASIZE ioctl's
so that newfs works on dvd-rw/dvd-ram again..
2003-09-11 15:59:16 +00:00
sos
335666e6d6 Try a bit harder to probe disks that doesn't quite set BUSY right. 2003-09-10 09:57:16 +00:00
sos
2ae98bd2ef Add another ID for the SiI3112a SATA chip as used on the Adaptec 1210SA.
RAID support is still in the works, so for now just normal ATA ops.

Sponsored by:	Matt Douhan(www.fruitsalad.org)
2003-09-08 13:55:05 +00:00
sos
fa2b1d6313 Limit the size of the rebuild requests to be within safety. 2003-09-08 13:36:26 +00:00
sos
a1e52d797a #ifdef out the vague ATA disk detection code causing fake ATA disks
to be found on some systems.
Hopefully this doesn't loose any real ATA disks...
2003-09-08 08:36:46 +00:00
sos
d2bb76d946 Handle shared channels better.
Try to avoid the spurios interrupts better.
2003-09-08 08:32:25 +00:00
sos
f64155d27c Update the PIO mode gathering code.
Reported by: bde
2003-09-08 08:30:43 +00:00
phk
2f3a7d1606 Forgotten in previous commit to atapi-cd.c: Add #ifndef BURN_BRIDGES
around cloning routines.
2003-09-05 11:08:55 +00:00