Commit Graph

821 Commits

Author SHA1 Message Date
Poul-Henning Kamp
4db0fda84e Use dynamic major number allocation. 2005-02-27 22:19:35 +00:00
Matthew N. Dodd
5b525a3230 Avoid using tsleep() in the resume path as it may result in the
system hanging if timer interrupts aren't running yet.

This allows my Thinkpad to resume successfully with APM.

Approved by:	 sos
MFC after:	 2 weeks
2005-02-07 17:14:42 +00:00
Maxim Sobolev
4379219537 Boot away another stackgap (one of the lest ones in linuxlator/i386) by
providing special version of CDIOCREADSUBCHANNEL ioctl(), which assumes that
result has to be placed into kernel space not user space. In the long run
more generic solution has to be designed WRT emulating various ioctl()s
that operate on userspace buffers, but right now there is only one such
ioctl() is emulated, so that it makes little sense.

MFC after:	2 weeks
2005-01-30 08:12:37 +00:00
Warner Losh
72217cb810 Catchup to the iodata renaming 2005-01-26 06:30:55 +00:00
Søren Schmidt
6ce188277d Further update to the Promise code.
Support should now cover all old and current products.
2005-01-01 19:24:25 +00:00
Søren Schmidt
5bcdf70082 Loosen the probe a bit.
Try to get out of probing as early as possible on (hopefully) vacant
channels.
2004-12-24 13:38:25 +00:00
Søren Schmidt
0f9c0db3d0 Update the Promise support for combo (SATA+PATA) controllers. 2004-12-24 13:36:04 +00:00
Poul-Henning Kamp
2221dbebce Pass the file->flags down to geom ioctl handlers.
Reject certain ioctls if write permission is not indicated.

Bump geom API version.

Reported by:	Ruben de Groot <mail25@bzerk.org>
2004-12-12 10:09:05 +00:00
Søren Schmidt
241ce89e8c Compensate for off by one bugs in disk firmware for 48BIT addressing cutover. 2004-12-09 07:31:06 +00:00
Søren Schmidt
fb81862424 Update the ICH6 support so all 4 SATA channels can be used.
We still use "normal" mode, AHCI mode is in the works still.

HW donated by:	Sentex
HW donated by:	Yahoo!
2004-12-08 18:00:46 +00:00
Søren Schmidt
88bdf804ed Add support for the ITE IT8212F controller.
HW donated by:	Yahoo!
2004-12-08 11:17:38 +00:00
Søren Schmidt
7f45e0f014 Reset timeout when we are back from interrupt. 2004-12-08 11:16:33 +00:00
Søren Schmidt
da9edda62d Add first shot on support for the new Promise SATAII chips.
HW donated by:	pil.dk
2004-12-08 10:02:41 +00:00
Søren Schmidt
6567c88566 Correct logical error, result was that retries wasn't always made but
failure reported instead.
2004-12-08 09:19:03 +00:00
Søren Schmidt
39c7a710c6 Return ATA register values in the request struct when ATAREQUEST returns. 2004-11-24 10:47:26 +00:00
Scott Long
5f26d98581 Don't set the BUS_DMA_ALLOCNOW flag for the parent tag or the tags that are
used for static memory allocations.

Discussed with: sos
2004-11-17 11:27:30 +00:00
Warner Losh
053a2b550f Tweaks to the resource allocation to allow a few of my obscure
cdrom/ata controller PC Card devices work better.
2004-11-10 00:33:05 +00:00
Søren Schmidt
208a8dc227 Do not retry on requests that has lost thier device during reinit.
Should fix hangs on IBM's etc with the fake slave problem.

MFC:
	asap
2004-10-20 10:11:05 +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
53f19be8fd Cosmetics 2004-10-19 20:11:23 +00:00
Lukas Ertl
dc6b9c2d6e Return the unit number of a channel instead of a hardcoded '1' from
the ATA pccard locking function.  This makes pccard devices like
Compact Flash cards work again.

PR:             kern/72805
Submitted by:   James E. Flemer <jflemer@alum.rpi.edu>
MFC in:         2 days
2004-10-19 10:29:00 +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
8353d82bfd Add support for the ICH6 in legacy mode.
The AHCI part is not supported yet, but is in the works.

5.3 RC1 candidate
2004-10-09 16:27:13 +00:00
Søren Schmidt
6c35773729 Move the PC98 specific geometry "gunk" to geom_pc98.c where it belongs.
This also adds support for bigger disks on the controller I have access to,
and maybe others if I understood the adhoc methods used on those.

Those with more PC98 bigdrive controllers it is hereby invited to add/fix
support for those in geom_pc98.c and not using #ifdef PC98 all over the place.
2004-10-07 17:37:09 +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
844acbc7a3 Always set half'n'half mode on ICH* chips. 2004-10-01 09:06:22 +00:00
Søren Schmidt
49686bbcaf Fix the serverworks modesetting code, of mask offset was wrong. 2004-10-01 09:04:53 +00:00
Søren Schmidt
8f0fb9584e Resurrect dump that broke with the last update. 2004-09-30 20:54:59 +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
c5b2c44ce8 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
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
1d535cd590 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
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
7a6d2ca81b Sync promise_mio_command with WIP on the Promise line of SATA controllers. 2004-09-03 08:23:04 +00:00
Søren Schmidt
df6a77ddcb Cleanup the defines used for various chipsets.
Add new nVidia controllers.
2004-09-03 07:37:53 +00:00
Søren Schmidt
8ea3547a15 Cleanup the storing and printing of the device transfermode for SATA. 2004-09-01 12:15:44 +00:00
Søren Schmidt
d3ef327c8d remove unused prototype 2004-08-27 22:14:45 +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
33203bee0c Set and reset the right bit for UDMA enable/disable on the ICH* chips. 2004-08-27 12:54:58 +00:00
Søren Schmidt
71d7101fac Rearrange the call to disk_destroy.
Suggested by:	phk
2004-08-27 12:03:18 +00:00
Søren Schmidt
1c01d05f9c 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
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
5a8f8e353e Properly check malloc returns. 2004-08-24 10:39:00 +00:00
Søren Schmidt
d607fde675 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
Søren Schmidt
001eba0b3c Correct the args to busdma, mostly cosmetic. 2004-08-20 19:05:22 +00:00
Søren Schmidt
d04d789463 DONT PANIC
Only call dmainit() if there is a valid busmaster resource.
2004-08-20 06:19:25 +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
fe76f7b6c8 Fix Promise sx4/sx4000 support that broke on the latest race fixes. 2004-08-16 09:29:46 +00:00
Søren Schmidt
8b68793ab3 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
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
ed0c8a7dc7 Fix bad free() usage.
Submitted by:	Pawel Jakub Dawidek
2004-08-09 14:22:58 +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
Poul-Henning Kamp
5721c9c76a Tag all geom classes in the tree with a version number. 2004-08-08 07:57:53 +00:00
Søren Schmidt
ba0b5c1c3b Correct the last commit so it works in error situations as well. 2004-08-07 12:49:28 +00:00
Nate Lawson
c68afc9d21 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
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
d5a9dcbf23 Add firmware revision to probe printf. 2004-08-05 21:11:33 +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
b4d89b2e0f 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
Søren Schmidt
a4c3e742b7 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
Søren Schmidt
426fc84503 Dont expect interrupt from ATAPI_RESET, it doesn't deliver one. 2004-07-23 17:01:47 +00:00
Søren Schmidt
4ad91b11e7 Dont set "address setup timing" on newer VIA chips.
closes PR:	69180
2004-07-17 14:48:46 +00:00
Søren Schmidt
cc97de873c Attempt to handle suspend/resume better. 2004-07-12 10:50:50 +00:00
Søren Schmidt
3e3807252b Remove leftover debug output. 2004-06-30 09:22:47 +00:00
Søren Schmidt
dfc7e0081f Add support for LSI type software RAID's.
Made possible by: John Cagle @ HP
2004-06-25 21:21:59 +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
Brian Feldman
5fd2bb173d 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
Søren Schmidt
b2c082c98b Up SiI reset wait a bit, some devices got lost. 2004-06-17 21:36:10 +00:00
Brian Feldman
3c632a5847 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
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
Søren Schmidt
ca5d21e917 Increase robustness of SATA handling. 2004-06-15 11:02:09 +00:00
Søren Schmidt
68599b781f 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
Poul-Henning Kamp
186f2b9e04 Add missing <sys/module.h> includes currently relying on nested include
in <sys/kernel.h>
2004-06-03 06:10:02 +00:00
Søren Schmidt
86e711a393 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
Søren Schmidt
c83c43b66e Use the right cmd+errorcode if we are in autosense/not. 2004-06-01 12:26:08 +00:00
Søren Schmidt
92b3fb2908 Only set and report error if not set already. 2004-06-01 11:37:24 +00:00
Søren Schmidt
541cd509d3 Dont retry on devices that left the system.
Ignore "fake" devices that has 0x7f status.
2004-06-01 11:34:46 +00:00
Warner Losh
2e31e339d1 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
Warner Losh
dba6dd177b 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
Dag-Erling Smørgrav
76b108abfe Whitespace cleanup. 2004-05-20 14:49:12 +00:00
Søren Schmidt
263b4cdea3 Rip out the too verbose "spurious interrupt" printf's, they dont serve
a purpose any longer.
2004-05-17 17:53:12 +00:00
Søren Schmidt
45bf968a10 Fix Sii3114 support. 2004-05-10 20:23:25 +00:00
Søren Schmidt
6230b63c5a Do at better job at unit numbering. 2004-04-30 18:49:03 +00:00
Søren Schmidt
ad452ba45c Spring cleanup of macros 2004-04-30 16:21:34 +00:00
Søren Schmidt
1e311c1849 Reduce the time spent looking for devices on channels that return
what looks like garbage.
2004-04-27 15:52:08 +00:00
Søren Schmidt
1b7cfe4458 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
Søren Schmidt
494377df3d 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
Søren Schmidt
3b53326f69 Change setup for SiS device to allow PCI native mode. 2004-04-24 15:54:20 +00:00
Søren Schmidt
4ee3fbe86b 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
Søren Schmidt
470fcc93b9 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
Søren Schmidt
9036df118c 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
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