Commit Graph

1125 Commits

Author SHA1 Message Date
sos
c8d0fc841f write the right unit # on verbose output. 2006-03-10 12:20:53 +00:00
sos
05ddef3112 Only use the channel in the request given to ata_completed if its
still present.
2006-03-09 10:25:35 +00:00
sos
e55404d344 typo. 2006-03-09 10:24:03 +00:00
sos
2ba86f7da2 Get rid of all the "long long"/"maxint" casting around in printf's.
On all our platforms intmax == int64_t so simply using %j to print
int64_t's is safe all over, and doesn't pullute the code.
2006-03-09 08:34:44 +00:00
sos
6835aad53c ATA_USB will need to hook into the delayed boot identify to have
interrupts running, so externalize it.
2006-03-08 16:39:01 +00:00
sos
d7b5daa52e Always read the TOC in acd_read_toc even if MEDIA_CHANGED wasn't set.
Since we cannot (reliably) detect when media has been removed before we
try to touch it, this could leave stale TOC's around.
2006-03-08 10:14:39 +00:00
sos
d987f74f35 Bail out of afd_sense if ENODEV. 2006-03-08 09:21:48 +00:00
sos
0c7a140bbc Poll device for readiness before trying to get geometry etc. 2006-03-07 16:05:38 +00:00
sos
d56d32f380 Only look for ICRC and CORR errors on ATA devices not ATAPI. 2006-03-07 14:27:54 +00:00
mlaier
042a9c9ce3 Fix the build. %ju prints uintmax_t not unsigned long long (which is
actually "longer" than uintmax_t for the understanding of printf).
2006-03-06 16:02:06 +00:00
sos
5d4e90d775 Add USB modes. 2006-03-05 21:32:38 +00:00
sos
ca50acdfb4 Update atapi-fd to support direct devices such as disks. 2006-03-05 20:30:54 +00:00
sos
ba86c198c3 Work around the deadlock that occours when ATA waits for the taskqueue
to call back for completition and something else is holding the taskqueue
waiting for ATA to return data.
This should clear up the "semaphore timeout !! DANGER Will Robinson !!"
in most situations, and log "taskqueue timeout - completing request directly"
instead, with a delayed "WARNING - freeing taskqueue zombie request" when
the taskqueue finally calls us back with the now stale request.
(It would have been nice if there was a way to remove a scheduled item from
 a taskqueue, but that is not currently implemented in the kernel).

A real fix for this is in the works but wont make it to 6.1RELEASE

definite MFC candidate.
2006-03-01 07:48:41 +00:00
sos
1474f527f4 Fix ata_reinit so it does things in the right order to prevent panic's.
Lock the channel so master/slave setups wont trash during reinit.
2006-02-25 17:27:33 +00:00
sos
cacaead301 Keep the parent device (in this case the channel) around in ata_request,
so we dont panic device removal or failure.
Clean up ata_fail_requests to prevent the queue munging to fail.
2006-02-23 20:15:22 +00:00
sos
f9bb944606 In ata_cmd_allocate() only call ata_pci_allocate once.
found by:	jhb@
2006-02-23 18:52:15 +00:00
sos
e7148b146b Add r/w support for JMicron ATA RAID metadata.
Acknowledgement should definitly go to JMicron Technology for providing full
docs on the metadata format as the only vendor so far, big thanks from here.
2006-02-17 13:02:10 +00:00
sos
ae2214aeae Add support for the JMicron JMB363 dual SATA + single PATA controller.
Documentation and HW kindly provided by JMicron.
2006-02-16 17:09:24 +00:00
sos
1bd04f301b Add a reset of the AHCI machinery to the ICH6/ICH7 support.
This should fix the missed devices on some systems.
2006-02-13 13:47:58 +00:00
sos
931e8a58b8 Unbreak Promise SATAII/150 controllers caused by the DMA dump changes. 2006-02-09 20:54:42 +00:00
sos
e152fa1468 Unbreak dump on legacy systems. Needs a more clean solution but that is
more intrusive and can wait 'til after 6.1
2006-02-09 20:53:32 +00:00
sos
ec5cff93e4 Unbreak DMA dumo on Intel 31224. 2006-02-06 19:17:48 +00:00
sos
0d5c93667a Add support for the JMicron JMB360 SATAII controller.
Thanks to JMicron for providing needed info.

HW donated by:	Ralf Folkerts
2006-01-25 23:07:42 +00:00
sos
cccf088ae7 Do not test for DMA status on legacy ATA devices. This has the unfortunate
side effect that legacy ATA controllers at irq14 and irq15 cannot share
interrupts with anything else without major problems.
This fixes the ATAPI DMA problems some systems/devices have seen.
2006-01-24 12:34:56 +00:00
sos
06de550b9d Fix panic on boot due to not all SATA chipsets having SSTATUS registeri
resources set.
2006-01-21 17:38:10 +00:00
sos
11141440e8 Correct two promise entries, these are only 2port SATA. 2006-01-18 13:34:28 +00:00
sos
9fb5b6a7cc Whitespace cleanup. 2006-01-18 13:10:17 +00:00
sos
3b2388f51b Properly report SATA connection speed. 2006-01-18 10:02:23 +00:00
sos
d58866740c Add support for using DMA on dump, greatly speeds up the dump process.
Add dump support in ataraid.
2006-01-18 09:14:55 +00:00
sos
0371a67ccd Get rid of the advertising clause in the copyright. 2006-01-05 21:27:19 +00:00
sos
1a03c39e37 Return the proper rmi field in DVDIOCREADSTRUCTURE.
PR:	89650
2006-01-04 21:35:57 +00:00
sos
a4ba4c8368 Fix the promise modesetting for old chips.
Pointy hat to:	sos
2006-01-04 10:23:47 +00:00
sos
7f56ef50de Fix promise probe printing. 2006-01-04 08:20:25 +00:00
sos
1a1e1570e1 Add hotplug support for Marvell chips. 2005-12-30 23:15:02 +00:00
sos
8f3c2fbec9 Further updates to the Marvell support code.
Should be reliable enough for actual use by now.
2005-12-28 11:55:43 +00:00
sos
9af24eae40 Change the probes in ATA to return a negative value on success.
This allows other driver to take over if needed during probe, and allows
me to distribute new drivers as modules.
2005-12-27 18:22:11 +00:00
sos
9a9857ef96 Update the last commit to also take 48Bit access functions. 2005-12-27 17:13:11 +00:00
sos
0a54373b35 Add initial support for the Marvell 88SX[56]0[48][01] series of SATA chips.
Hardware donated by: Matthew Jacob
Hardware donated by: Y!
2005-12-27 17:09:52 +00:00
sos
5d3791f740 Fix rebuilds of arrays that got stuck.
Misc minor fixes.

Bughunting and initial fixes by Pav@ and Anton.
2005-12-27 16:49:33 +00:00
sos
7d30e8712e Cleanup the strings for printing chipset names, saves quite some space.
Add a couble new nVidia chips now we are here.
2005-12-16 08:12:13 +00:00
scottl
0b75b9ba21 Make this compile on 64bit systems. It likely isn't correct, but that can
be sorted out later.
2005-12-16 06:11:22 +00:00
sos
deb97ff8b5 Add support for writing VIA metadata.
Null out the metadata on disks when array is deleted.
2005-12-15 13:30:23 +00:00
sos
0243939749 Add RAID0+1 and RAID5 support to VIA RAID code.
Fix support for multiple arrays.
2005-12-14 13:07:49 +00:00
sos
35ed584f73 Add support for VIA VT8251 southbridge.
SATA support for now in compat mode, but all 4 channels usable.
2005-12-14 12:13:00 +00:00
sos
5498992155 Correct calculation of RAID0 sizes on VIA RAID arrays. 2005-12-14 12:11:51 +00:00
sos
09f8635fd4 Add support for writing SiS metadata. 2005-12-12 14:13:55 +00:00
sos
45ca2a8268 Unbreak hotplug support on the ICH6 and ICH7 chipsets. 2005-12-09 14:23:24 +00:00
sos
a35284f0f5 Dont use the BUS_DMA_ALLOCNOW flag. Instead use BUS_DMA_NOWAIT and return
ENOMEM to the upper layers if we run out of memory.

This solves part of the trouble with running on >4GB memory systems.
2005-12-05 22:31:55 +00:00
sos
fe62d3d66a Switch off debugging that was left on in last commit. 2005-12-05 17:58:11 +00:00
sos
5b2e19cba1 Add support for writing Intel MatrixRAID arrays.
Do a little better on handling volumes as well, however we cant create
multiple volumes from FreeBSD yet.

HW sponsored by:        Mullet Scandinavia AB
2005-12-05 17:33:57 +00:00
sos
52c5335529 Update the ICH7 support so it deals better with chips without AHCI.
Update Intel MatrixRAID support to be able to pick up RAID0+1 (RAID10)
and RAID5 arrays without panic'ing.
This has the side effect of now also supporting multiple volumes on
MatrixRAID's now I have the metadata better understood..

HW sponsored by:	Mullet Scandinavia AB
2005-12-02 10:13:53 +00:00
sos
ff66cda5bc Fix the ata_composite/ata_request leak when using RAID0+1.
Submitted by:	Michael Butler

Minor changes to fit ATA style by me.
2005-11-29 20:08:26 +00:00
sos
e6a12190f6 Fix SiS SATA support, the SATA registers was off.
Add support for SiS metadata.

HW donated by:	obrien
2005-11-28 23:08:37 +00:00
keramida
3a06966265 Fix two identical harmless typos in ata error messages:
s/issueing/issuing/

PR:		kern/89481
Submitted by:	John Nielsen
Approved by:	sos
MFC after:	1 week
2005-11-28 13:23:15 +00:00
sos
1060a7a92f When IOCATAGPARM is called, update the capabilities page that is stored
in the kernel and return the new values.
2005-11-25 09:00:56 +00:00
rwatson
be4f357149 Normalize a significant number of kernel malloc type names:
- Prefer '_' to ' ', as it results in more easily parsed results in
  memory monitoring tools such as vmstat.

- Remove punctuation that is incompatible with using memory type names
  as file names, such as '/' characters.

- Disambiguate some collisions by adding subsystem prefixes to some
  memory types.

- Generally prefer lower case to upper case.

- If the same type is defined in multiple architecture directories,
  attempt to use the same name in additional cases.

Not all instances were caught in this change, so more work is required to
finish this conversion.  Similar changes are required for UMA zone names.
2005-10-31 15:41:29 +00:00
sos
bed22d7cab Return the right format (LBA/MSF) in TOC entries.
Null the TOC on media change even if no media present.

Reported by: des
2005-10-28 21:41:42 +00:00
sos
5e727d7ba4 Enclose the delayed attach in Giant so we dont loose the race with other
drivers trying to attach ATA devices like pccard.
Dont clear the delayed flag before we are acutally finished.

Spotted by: imp
2005-10-27 16:32:39 +00:00
sos
8fe74b285e Minor cleanups, no functional changes 2005-10-13 08:05:21 +00:00
sos
e52c6023e6 Add support for the ATI IXP[234]00 series chipsets.
HW donated by: sentex
2005-10-12 20:00:26 +00:00
sos
ca38720bed Correct the former patch to the way it would have looked after review. 2005-10-10 19:13:27 +00:00
sos
2907b6fd67 Properly react to allocation failures.
Found by:	imp@
2005-10-10 19:12:43 +00:00
peadar
60fb64c30e When breaking up a large request into smaller ones for the strategy
routine, create all the child bio objects before starting the
requests, rather than starting them as created. This closes a race
whereby some number of child operations could complete before the
rest were ever created, and prematurely freeing the parent bio.
This fixes the panics installing in VMWare and qemu
2005-10-09 21:11:05 +00:00
sos
84b311757f Add support for setting the SG list segment size.
Use this for the SiI3112 workaround to get rid of the "oversized DMA" errors.

MFC to 6.0 candidate.
2005-10-06 15:44:07 +00:00
imp
36206617bb Forgot to commit ata-card fixes last night. Fix gleb's attempt to do
the right thing by merging in the changes I neglected to commit last
night.
2005-09-22 18:46:29 +00:00
glebius
6ac8681808 Fix build. 2005-09-22 18:41:56 +00:00
sos
903949a3ce Dont wait for READY on ATAPI_IDENTIFY.
Fixes the losage of some ATAPI device that reported failed probing with
"timeout waiting for read DRQ".
2005-09-19 07:35:42 +00:00
sos
3075efc7af Harden the hotplug support for SATA devices.
This also fixes a few races that was present in the timeout/detach code.

Sponsored by: pair.com
2005-09-14 12:45:06 +00:00
sos
a3b63345a1 Fix problem with finding the still working disk in a broken mirror on VIA. 2005-09-06 19:17:48 +00:00
sos
ab2182f5fc In ata_mode2str() properly list -1 as UNSUPPORTED. 2005-08-29 18:19:06 +00:00
sos
053b83f819 Fix support for the VIA 6421 controller. 2005-08-29 09:01:57 +00:00
sos
0ffb7bad2e Dont set default mode to ATA_DMA_MAX on devices not capable of DMA. 2005-08-25 15:45:03 +00:00
sos
bd2eebc690 Apply fix for "pr82261 DMA-support on Sparc64 broken"
The Acer chip or wiring that SUN uses has problems that this patch
tries to work around.
Original patch by Marius Strobl, hacked into shape by me..
2005-08-23 08:53:01 +00:00
sos
61076facb2 Fix problem on Promise "mio" controllers and 48bit mode caused by last commit 2005-08-22 11:38:53 +00:00
sos
1a7d21ba0c Add support for working around controllers that cannot do DMA in 48bit mode.
The workaround use PIO mode above ~137GB to allow using the disk.
Add the Acer chips with rev < 0xc4 as first candidate.
2005-08-17 15:00:33 +00:00
sos
705a1ddfe6 Use the bio field instead of the driver field as intended. 2005-08-17 14:50:18 +00:00
sos
3419beff85 Add support for the Promise PDC4071[89] chips used on fx the Fasttrak TX4300.
Docs kindly provided by Promise.
2005-08-12 16:54:11 +00:00
sos
5e645d27d6 Add support for the ITE IT8211F controller. 2005-08-05 13:14:00 +00:00
sos
c657d46b46 Dont limit all transfers to DEV_BSIZE (stale dbug code)
Hide the loaded/unloaded message behind bootverbose
2005-08-04 18:39:36 +00:00
sos
d4f57755dc Remove stale struct ata_channel declaration.
Reported by:	rodrigc
2005-07-29 18:14:06 +00:00
sos
880222c4c8 Zero donecount on auto request sense.
PR:		81450
Approved by:	re@ (scottl)
2005-06-28 09:06:52 +00:00
sos
f96bc0932a Dont call ata_finish in ad_dump as that is no longer needed and causes panic.
Dont try to enable read/write caching on devices that doesn't support it,
this reduces the noise from ATA on flash devices and the like.

Approved by: re@ (scottl)
2005-06-27 09:12:11 +00:00
imp
8616206ff9 Eliminate unused argument in PCMCIA_CARD macro.
Provide a backwards compatible way to have the extra macro by defining
PCCARD_API_LEVEL 5 before including pccarddevs for driver writers that
want/need to have the same driver on 5 and 6 with pccard attachments.

Approved by: re (dwhite)
2005-06-24 14:36:54 +00:00
marcel
4729e22704 Avoid GCC optimizations from injecting a call to memset(?) in order
to initialize the buffer array in ata_raid_attach() by removing the
initializer. There's no memset(?) in the kernel. Instead, assign
'\0' to the first element. The buffer array holds strings only, so
this is functionally equivalent.

Applies to: ia64
Tripped over by: tinderbox
2005-06-11 03:21:20 +00:00
sos
b6acc8219d Enable SATA hotplug support.
Submitted by:	Olivier Houchard
2005-06-10 07:43:10 +00:00
sos
4fa0803f24 Fix the long standing problem with poor transferrates on Intel ICHH type
chips. The DMA timing value was set on device 0 for all devices :/

Prodded by: Harald Schmalzbauer
2005-06-09 21:13:44 +00:00
sos
7dd85e5dc3 Fix the register offset for the ATAPI count register thats used to
wrestle the older Promise chips to do 48bit addressing.

Spotted by:	Martin Birgmeier
2005-06-09 19:00:37 +00:00
sos
caaf3d4c8e Use the presence of ctlr->dmainit instead of r_res1 to find out when to
initialise DMA.
2005-06-09 12:31:07 +00:00
sos
9178faa91c Add support for the Intel 31244.
Most code by the submitters, hammered upon to get the right ATA fell by me.

Submitted by:	Olivier Houchard
Submitted by:	Jia-Shiun Li
2005-06-08 20:02:55 +00:00
sos
1408d92f09 Apply the usual woodoo for 64bitness. 2005-06-06 15:49:09 +00:00
sos
5211f7a307 Add support for nVidia's software RAID "MediaShield".
HW Sponsored by:	Yahoo!
2005-06-06 13:35:24 +00:00
sos
d5b041c0d9 Make nVidia SATA hotplug support DTRT.
HW sponsored by: Yahoo!
2005-06-05 21:18:26 +00:00
sos
86f5e64b88 Unbreak the ICH6 AHCI support in !48Bit mode. 2005-06-05 18:37:56 +00:00
sos
b33daefd83 Make certain the the 48bit flag is reset if we dont translate LBA. 2005-05-17 12:31:54 +00:00
sos
c05a9b3913 longer used (contents added to sys/ata.h) 2005-05-16 13:39:49 +00:00
sos
05399c3127 Change the way ioctls are issue to ATA.
The most prominent part is that its now possible to issue ata_requests
directly to say acd0, instead of going through the cumbersome /dev/ata
device.
2005-05-16 13:07:27 +00:00
sos
84c444f8a4 Cleanup comments 2005-05-13 10:25:19 +00:00
sos
9f93814a13 Fix more ATAPI breakage.
Apparently some devices are very picky on details :)
2005-05-13 07:58:05 +00:00
sos
aa499335a7 Add new Intel PCI ID's for the ICH7 chips (untested). 2005-05-11 18:29:15 +00:00
sos
eae1ea62ec Add support for AHCI compliant ATA devices.
For now just support the Intel ICH6 as that the HW at hand.

Sponsored by:	pair.com
2005-05-11 16:10:08 +00:00
sos
27408da2e3 Add back one line that got deleted in the last commit.
Change the comment there so it better describes whats going on.

This should fix the boot problems of late.
2005-05-11 14:36:26 +00:00
sos
eb109cd6d5 Fix ATAPI DMA. We need to set the proper flags for DMA modes. 2005-05-11 12:41:35 +00:00
sos
ce43d827c2 Reshape the dma code to be a bit more flexible so it can cope with
new HW that has new and different demands.
Fix a few nits in former commit in this cleanup crusade.

Sponsored by:	pair.com
2005-05-03 07:55:07 +00:00
sos
d1f3a4ab40 Always attach a subdisk even if no valid metadata found.
This allows the disks to be used later in a raid create.
2005-05-02 07:06:50 +00:00
sos
2d7b156b4f Update on the last commit, the dma* funciton needs to be called with
a channel device, not an ata device, or we'll be out of luck in
reset/timeout where we dont have a device.
2005-05-01 12:24:45 +00:00
sos
987cd7bedc Go back to the old way of finding the Promise metadata, the new way was
too simple causing older controllers metadata to get lost.
2005-05-01 08:45:12 +00:00
sos
859b992e3d Take newbusification one step further, ie use the device_t more consequently
all way through the code down the layers, instead of the mix'n'match that
resulted from the conversion done earlier.

Sponsored by:	pair.com
2005-04-30 16:22:07 +00:00
sos
44e51c4adc Now that probing is working in the new fashion, we need to go back to
having ata_getparm issue an ata_request and not fool around with the HW
on its own.
Needed for new HW support.
2005-04-29 11:30:03 +00:00
sos
77e24e4928 Provide a default setmode method.
This shaves off multiple copies of the same setmode stub.
2005-04-28 22:15:44 +00:00
sos
99fa5be8ed Rearrange the way the reset code is called.
Prepare for different looking controllers.
2005-04-28 22:08:08 +00:00
sos
ab882dca1f Fix a bug introduced in r1.89 thats caused leak of requests, and possibly
bogus data to be written.
2005-04-26 06:42:33 +00:00
sos
0841bd55a7 Cosmetics 2005-04-25 07:57:04 +00:00
sos
59f595842e Only try to allocate and use the SATA resource if they are enabled
by the BIOS. It seems some BIOS's doesn't get this right, and that would
result in ATA panic'ing.
2005-04-25 07:50:51 +00:00
sos
50df456889 Rehash the timeout code to make it more simple.
This also removes the warning timeout on the taskqueues stalling as
I'm tired of getting ATA error reports for problems in other parts ;)
Misc cosmetic and comment cleanups now we are here.
2005-04-21 11:13:39 +00:00
sos
01d6e824de When a rebuild is done, properly mark the arrays as functional again. 2005-04-20 14:14:08 +00:00
sos
05ce5bbeb6 Properly hook in devices found by SATA connect events.
This broke on the changes done to get atapicam happy earlier.
2005-04-20 12:51:54 +00:00
sos
6762159f44 CFA (Compact Flash) devices has a special config ID that fails the
normal ATA device check in ata-disk.c. Add support for the CFA magic.
2005-04-19 12:33:26 +00:00
sos
046acb18c8 Fix indentation problem in the last commit 2005-04-19 05:28:08 +00:00
phk
b7f29c0fc0 Add a named reference-count KPI to hold off mounting of the root filesystem.
While we wait for holds to be released, print a list of who holds us
back once per second.

Use the new KPI from GEOM instead of vfs_mount.c calling g_waitidle().

Use the new KPI also from ata.

With ATAmkIII's newbusification, ata could narrowly miss the window
and ad0 would not exist when we tried to mount root.
2005-04-18 21:21:26 +00:00
sos
97d6dd54fd Add uma zone for composite ops.
Submitted by:	des
2005-04-18 16:01:56 +00:00
sos
47b4ce0270 Adjust the RAID type pickup code for the VIA, we dont actually care
if the array is bootable or not (yet).
2005-04-18 13:51:03 +00:00
sos
2cb9485db2 Add one more Promise SATAII/150 chip id. 2005-04-17 13:37:57 +00:00
sos
01a15eb8cb Spell ATA_NFORCE4_S2 correctly. 2005-04-16 20:03:49 +00:00
sos
e9c922da28 Make things compile again with ATA_STATIC_ID. 2005-04-15 14:19:41 +00:00
sos
b22bb8078c Move the creation of ata_channel child devices to the channel code.
This allows to attach to the children (ATA devices) even without a
driver being attached. This allows atapi-cam to do its work both
with and without the pure ATAPI driver being present.

ATA patches by /me
ATAPI-cam pathes by Thomas
2005-04-15 10:20:52 +00:00
sos
08ff41b73d Read back the real taskfile register values when in 48BIT mode. 2005-04-14 08:48:45 +00:00
sos
9d28f86771 Add a ata_setmode method so we dont panic on setmode.
Note that the mode is only set on the device, we (mostly) have
no knowledge on how to set mode on the controller if at all possible.
2005-04-13 07:14:17 +00:00
sos
9e1c558a88 On amd64 int64_t != long long. 2005-04-12 15:24:00 +00:00
sos
3660e2566d Better use the right name for the VIA software RAID. 2005-04-12 13:29:47 +00:00
sos
a06da1c3b9 Add support for VIA Tech metadata as used on thier SATA parts. 2005-04-12 12:25:27 +00:00
sos
ccda085fe1 Fix the same silly alloc mistake for nVidia and SiS as with VIA in
the previous commit.
2005-04-11 20:50:14 +00:00
sos
b999703730 Fix the bug that caused SATA disks on VIA etc to fail attach. 2005-04-11 20:28:15 +00:00
sos
2c608a89b2 Use the ata_suspend/resume functions instaead of the bus_generic ones.
This should unbreak suspend/resume.

Contributed by:	Wiktor Niesiobedzki
2005-04-10 21:43:29 +00:00
sos
ae0acb41f1 Fix FreeBSD native SPAN arrays.
Prodded by: Ian Dowse
2005-04-10 21:39:25 +00:00
sos
88401dacc6 Refine the SATA PHY code so the time consumed during probe is reduced.
Add the older nVidia nForce2 SATA chip to supported HW.
2005-04-10 10:20:25 +00:00
scottl
f3360984ab Explicity make atapi-cam depend on CAM.
Submitted by: Michal Mertl
2005-04-08 22:51:50 +00:00
sos
92faab9bf9 Add support for the PHY on nVidia, SiS and VIA chips
This code is done blindfolded as I dont have such HW here, so reports
of success/failure are most welcome.

More SATA PHY cleanups.
2005-04-08 15:33:04 +00:00
sos
24e2f5bb6c Put the BUS_DMASYNC_PREWRITE in the rigth position. 2005-04-08 12:16:51 +00:00
sos
807c19e464 Generalise the SATA PHY handling code so it wont be duplicated for
each SATA chip.
Promise and Silicon Image are the current candidates for this.
2005-04-08 09:37:47 +00:00
sos
d8f94400b9 Add support for controllers that doesn't have the usual taskfile
layout.  No functional changes.
2005-04-06 10:22:56 +00:00
scottl
224fe6574b Fix a use-after-free problem in atapi_cb(). Add some necessary synchronization
to the XPT_PATH_INQ op.  Don't leak locks on failure in XPT_SCSIIO.  Correctly
fix the CAMDEBUG message.
2005-04-05 15:08:19 +00:00
sos
1a524b80b3 Add firstshot support for Acer Labs Inc SATA parts
Update ALi PATA support to handle ATA133 as well
2005-04-05 14:51:43 +00:00
phk
fa3299671d Push some faulty debugging aside so LINT compiles. 2005-04-05 09:42:52 +00:00
scottl
95301ebbdf Commit ATAPI-CAM for ATAmkIII. Improvements and changes:
- newbus plumbing.  Each atapicam bus is a child off of a parent ata channel
  bus.  This is somewhat of a hack, but allows the ata core to be completely
  free of atapicam knowledge.
- No more global lists of softc's and no more groping around in internal ata
  structures on each command.
- Giant-free operation of the completion handler.
- Per-bus mutex for protecting the busy list and synchronizing detach.
- Lots of streamlining and dead code elimination, better adherence to the
  CAM locking protocol.

This feature still requires that the appropriate atapi-* driver be present
for each atapi device that you want to talk to (i.e. atapi-cd for cdroms).
It does work both compiled into the kernel and as a loadable module.

Reviewed by: thomas, sos
2005-04-05 02:03:31 +00:00
sos
89c98c3d5b Fix a buglet that caused slaves to be nondetected. 2005-04-03 13:03:53 +00:00
sos
372caa3813 Change the ata_* methods to use a channel device instead of a
controller device. This helps when there is no controller parent
to a channel (PPC port).
2005-03-31 15:05:40 +00:00
sos
d38bf78e18 Correct the PCI ID for the SiS 965, and add support for the SATA part
that was left our by accident.

Prodded by:	Patrik Backlund
2005-03-31 06:25:14 +00:00
sos
9b460eacf3 Whoops, this got left out from the megacommit 2005-03-30 12:27:34 +00:00
sos
f820cdfe29 This is the much rumoured ATA mkIII update that I've been working on.
o       ATA is now fully newbus'd and split into modules.
        This means that on a modern system you just load "atapci and ata"
        to get the base support, and then one or more of the device
        subdrivers "atadisk atapicd atapifd atapist ataraid".
        All can be loaded/unloaded anytime, but for obvious reasons you
        dont want to unload atadisk when you have mounted filesystems.

o       The device identify part of the probe has been rewritten to fix
        the problems with odd devices the old had, and to try to remove
        so of the long delays some HW could provoke. Also probing is done
	without the need for interrupts, making earlier probing possible.

o       SATA devices can be hot inserted/removed and devices will be created/
        removed in /dev accordingly.
	NOTE: only supported on controllers that has this feature:
	Promise and Silicon Image for now.
	On other controllers the usual atacontrol detach/attach dance is
	still needed.

o	Support for "atomic" composite ATA requests used for RAID.

o       ATA RAID support has been rewritten and and now supports these
        metadata formats:
                 "Adaptec HostRAID"
                 "Highpoint V2 RocketRAID"
                 "Highpoint V3 RocketRAID"
                 "Intel MatrixRAID"
                 "Integrated Technology Express"
                 "LSILogic V2 MegaRAID"
                 "LSILogic V3 MegaRAID"
                 "Promise FastTrak"
                 "Silicon Image Medley"
		 "FreeBSD PseudoRAID"

o       Update the ioctl API to match new RAID levels etc.

o       Update atacontrol to know about the new RAID levels etc
        NOTE: you need to recompile atacontrol with the new sys/ata.h,
        make world will take care of that.
	NOTE2: that rebuild is done differently from the old system as
	the rebuild is now done piggybacked on read requests to the
	array, so atacontrol simply starts a background "dd" to rebuild
	the array.

o       The reinit code has been worked over to be much more robust.

o       The timeout code has been overhauled for races.

o	Support of new chipsets.

o       Lots of fixes for bugs found while doing the modulerization and
        reviewing the old code.

Missing or changed features from current ATA:

o       atapi-cd no longer has support for ATAPI changers. Todays its
        much cheaper and alot faster to copy those CD images to disk
        and serve them from there. Besides they dont seem to be made
        anymore, maybe for that exact reason.

o       ATA RAID can only read metadata from all the above metadata formats,
	not write all of them (Promise and Highpoint V2 so far). This means
	that arrays can be picked up from the BIOS, but they cannot be
	created from FreeBSD. There is more to it than just the missing
	write metadata support, those formats are not unique to a given
	controller like Promise and Highpoint formats, instead they exist
	for several types, and even worse, some controllers can have
	different formats and its impossible to tell which one.
	The outcome is that we cannot reliably create the metadata of those
	formats and be sure the controller BIOS will understand it.
	However write support is needed to update/fail/rebuild the arrays
	properly so it sits fairly high on the TODO list.

o       So far atapicam is not supported with these changes. When/if this
	will change is up to the maintainer of atapi-cam so go there for
	questions.

HW donated by:  Webveveriet AS
HW donated by:  Frode Nordahl
HW donated by:  Yahoo!
HW donated by:  Sentex
Patience by:	Vife and my boys (and even the cats)
2005-03-30 12:03:40 +00:00
njl
471bba60d9 Whitespace nit. Clarifies which body this line belongs to. 2005-03-06 10:17:30 +00:00
imp
3c710e1d53 Use BUS_PROBE_DEFAULT for pci probe return value 2005-03-05 19:06:12 +00:00
mdodd
b7cba6037a When resubmitting a timed out request, reset donecount.
Submitted by:	  Nate Lawson <nate AT root.org>
2005-03-02 04:01:37 +00:00
mdodd
58f0b642ef Handle PIO timeouts in ata_end_transaction() by immediately returning.
Failure to do this will result in following ata_pio_read() calls walking
off the end of the read buffer.

This resolves the "memory modified after free" panics common with Thinkpads
and CD/DVD drives.

Submitted by:	 Nate Lawson <nate AT root.org>
2005-03-02 03:59:28 +00:00
mdodd
85764e2aa4 In ata_generic_reset() while waiting for both master & slave to become
idle the 'mask' variable could be set to 0, resulting in the timeout loop
running for the full 31 seconds.

Handling this case eliminates long hangs on resume on some systems.

Submitted by:		Nate Lawson <nate AT root.org>
2005-03-02 03:34:51 +00:00
phk
6fb2ef6eec Use dynamic major number allocation. 2005-02-27 22:19:35 +00:00
mdodd
dbd1fe8138 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
sobomax
69aa6843ef 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
imp
570c925965 Catchup to the iodata renaming 2005-01-26 06:30:55 +00:00
sos
f2c733ccbe Further update to the Promise code.
Support should now cover all old and current products.
2005-01-01 19:24:25 +00:00
sos
35197bc60b 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
sos
ad59528a79 Update the Promise support for combo (SATA+PATA) controllers. 2004-12-24 13:36:04 +00:00
phk
35b3c9fdfb 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
sos
c6a934b3e0 Compensate for off by one bugs in disk firmware for 48BIT addressing cutover. 2004-12-09 07:31:06 +00:00
sos
778b1dc628 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
sos
0138ea081f Add support for the ITE IT8212F controller.
HW donated by:	Yahoo!
2004-12-08 11:17:38 +00:00
sos
db3855bde9 Reset timeout when we are back from interrupt. 2004-12-08 11:16:33 +00:00
sos
d4647dd77b Add first shot on support for the new Promise SATAII chips.
HW donated by:	pil.dk
2004-12-08 10:02:41 +00:00
sos
5dc3dca989 Correct logical error, result was that retries wasn't always made but
failure reported instead.
2004-12-08 09:19:03 +00:00
sos
ccede841b5 Return ATA register values in the request struct when ATAREQUEST returns. 2004-11-24 10:47:26 +00:00
scottl
db12de4f40 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
imp
8c126525fe 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
sos
1837c14755 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
sos
480318fb03 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
sos
214bd9b162 Cosmetics 2004-10-19 20:11:23 +00:00
le
f14caa383f 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
sos
b9ce738620 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
sos
3d81c20638 Dont sleep with lock held. 2004-10-10 13:24:39 +00:00
sos
38ce00cc1c 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
sos
058a8fa0b8 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
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