Commit Graph

385 Commits

Author SHA1 Message Date
bouyer 011181ac3e Implement an atabus control device, and define some ATA bus control
IOCTLS. Implement ATABUSIORESET, which will reset the given ATA bus.
2004-08-01 21:40:41 +00:00
bouyer 7ffa35d1a2 Implement asynchronous channel reset.
Use this to reset the channel before doing a dump, instead of the hack in
  wdc_exec_xfer() based on C_POLL. This hack was causing problems on
  controllers with a shared queue, because we now can have C_POLL set during
  concurent channels probes (problem found and analysed on sparc64 by
  Martin Husemann).
This should even make core dumps marginally more reliable on ATA drives.
2004-07-31 21:26:42 +00:00
mycroft d7027450cd Update copyright. 2004-06-22 19:20:56 +00:00
mycroft d1a1c698b0 Do not force ATA_SINGLE on devices that don't support READ/WRITE MULTI. We
just have to take an interrupt for each sector.
Tested with one laptop disk (which normally runs in DMA mode and was forced
to single-sector transfers) and 3 CF cards.  Increases the performance of
the CF cards substantially (760KB/s->1240KB/s in one case, 410KB/s->750KB/s
in the other two cases).
2004-06-22 19:20:14 +00:00
mycroft d78e8eee67 Fix an extremely obvious bug in the handling of the bad block list: the "max"
block was being set 512x further out than it should be, causing rather severe
escalation of the error.

XXX WTF is the point of this shit, anyway?  In most cases, the way you're
supposed to fix a bad block on an ATA disk is to rewrite it -- which will
either just transparently fix it, or spare it.  This code actively prevents
that.
2004-06-01 20:53:03 +00:00
mycroft a4135d1d48 Only downgrade modes due to an actual CRC error. Downgrading on other errors
is anti-social -- especially given that there's no way to upgrade again short
of rebooting.

Also, downgrade UDMA modes more slowly.  It's entirely possible that they're
using an 80-wire cable, but it's just too long for the higher modes, or there
is minor crosstalk.
2004-06-01 19:32:30 +00:00
thorpej f2da431235 Add common routines for SATA controllers. Right now, we have sata_speed(),
which reports the speed encoded in the SStatus register.
2004-05-28 23:26:27 +00:00
thorpej aeb454bce4 Clean-up of use of "precomp". It is used as "features" everywhere, so
rename the fields in wdc_command as appropriate.
2004-05-27 02:23:12 +00:00
wiz d406ce5c68 Fix typo reported by Alexander Yurchenko grange at rt mipt ru in private
mail.
2004-05-23 23:07:59 +00:00
bouyer c88ebc6e3e Add support for the DIOCCACHESYNC ioctl. 2004-05-21 20:35:53 +00:00
bouyer 879d21cebe Add a delay(10) after re-enabling interrupts in the control register.
Some controllers/drives (e.g. SataLink 3114 with WD Raptor) require
it. Should fix kern/23808 by Chris Gilbert, patch suplied by Chris Gilbert
on tech-kern, extended to all places enabling interrupts by me.
2004-05-08 15:03:32 +00:00
bouyer aaf27601c3 When using LBA48, use Flush cache extended command if supported.
From Christos Zoulas in PR 25366, with minor adjustements from me.
2004-05-03 20:11:40 +00:00
itojun aca4c091d3 sprintf -> snprintf 2004-04-22 00:17:10 +00:00
minoura c5bd25260a Change the value of DRIVE_ATAPIST which was same as that of DRIVE_DMAERR.
Ok'd by bouyer.
2004-04-14 05:26:29 +00:00
bouyer fca16a87e1 Make wdc_channel->ch_flags volatile, and cast it to (void *) when used
in tsleep()/wakeup() to appease gcc. Otherwise, the ch_flags value may
be cached in a register in atabus_thread(), and when it sets the WDCF_TH_RUN
bit after tsleep() it may loose loose the changes made by an interrupt handler
or another thread.
Problem analysed by Jukka Andberg on tech-kern.
2004-04-13 19:51:06 +00:00
wiz 4fdf521f76 It's extension, not extention. From Miod Vallat (miod at online fr). 2004-03-14 20:11:24 +00:00
fvdl 7e3d28789f During a control operation (like a reset), wait 10us after selecting
the drive. This fixes (or rather, works around) a timing problem
with WD Raptor drives attached to a Sil3114 SATA controller.

Should fix PR 23808, it fixes the same problem for me.
2004-03-02 13:13:57 +00:00
yamt 395e9958f2 change the way to handle NEW_BUFQ_STRATEGY option.
instead of putting #ifdefs into each drivers,
use a global variable to indicate default strategy.

XXX should have a way to specify other strategies.
2004-02-28 06:28:47 +00:00
hannken 3db4e2acd8 Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern.
VOP_STRATEGY(bp) is replaced by one of two new functions:

- VOP_STRATEGY(vp, bp)  Call the strategy routine of vp for bp.
- DEV_STRATEGY(bp)      Call the d_strategy routine of bp->b_dev for bp.

DEV_STRATEGY(bp) is used only for block-to-block device situations.
2004-01-25 18:06:48 +00:00
yamt 7266a95907 store a i/o priority hint in struct buf for buffer queue discipline. 2004-01-10 14:39:50 +00:00
thorpej 197f2f50da More structure member namespace cleanup: thread -> ch_thread 2004-01-03 23:59:58 +00:00
thorpej a963286f8d More wdc_channel structure member namespace cleanup:
- channel -> ch_channel
- wdc -> ch_wdc
2004-01-03 22:56:52 +00:00
thorpej 5bd80d8373 Rename "struct channel_softc" to "struct wdc_channel". 2004-01-03 01:50:52 +00:00
thorpej 9bc0bf3f15 Prepend "wdc_" to wait_for_drq, wait_for_unbusy, and wait_for_ready. 2004-01-01 20:25:22 +00:00
thorpej 527c829fa0 Rename:
- wdc_xfer to ata_xfer
- channel_queue to ata_queue
and move them to <dev/ata/atavar.h> so they can be used by non-wdc ATA
controllers.  Clean up the member names of these structures while at it.
2004-01-01 17:18:53 +00:00
thorpej 3787a92812 Move the register definitions for ATA Task File registers to atareg.h;
they are also used by controllers that do not map the registers into the
system address space, and are thus distinct from the "controller" registers.
2003-12-30 19:30:13 +00:00
thorpej 3695c4271b SMART info is logically part of the register set; move it from atavar.h
to atareg.h
2003-12-30 19:12:24 +00:00
thorpej 0ad3db4759 Move most of the atabus layer into ata.c. 2003-12-30 16:28:37 +00:00
thorpej 962cc4da4a Tweak function names in debug messages. 2003-12-30 00:43:31 +00:00
lha 56a919527c add more fields to ata_smart_attr, add structures for selftest log 2003-12-20 19:53:54 +00:00
thorpej d6d47a7224 Some additional SATA-II registers. 2003-12-17 16:16:36 +00:00
thorpej 5af2747f1e Serial ATA register definitions. 2003-12-14 17:14:47 +00:00
thorpej b9ee1b0117 Move the wddone() prototype to wd.c 2003-12-14 05:38:20 +00:00
thorpej 777270ce9b Garbage-collect __ATA_DISK_PRIVATE; it is no longer needed. 2003-12-14 05:37:25 +00:00
thorpej d8f4e7306d No need to include wdvar.h anymore. 2003-12-14 05:34:29 +00:00
thorpej a58ada4aad Instead of calling wddone() directly, set a (*drv_done)() callback in
the ata_drive_datas structure and invoke that.
2003-12-14 05:33:29 +00:00
thorpej 3dd2f16d75 Move struct ata_device from wdvar.h to atavar.h. 2003-12-14 05:14:39 +00:00
thorpej 09bbcae770 Move struct ata_bustype from wdvar.h to atavar.h. 2003-12-14 05:10:19 +00:00
thorpej be3146e7b3 Move struct ata_bio from wdvar.h to atavar.h. 2003-12-14 05:03:28 +00:00
thorpej 86046f9e1b Tidy up the whitespace. 2003-12-14 04:59:40 +00:00
thorpej a644de6271 Liberally apply static. 2003-12-14 02:48:36 +00:00
thorpej 0848b66944 Cosmetic changes in some autoconfiguration messages. 2003-12-14 02:46:34 +00:00
thorpej 51132ab100 De-__P and use ANSI-style function decls. 2003-12-14 02:45:48 +00:00
keihan b8702f530b netbsd.org -> NetBSD.org
This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean".  Thanks for the patiance, and sorry for all the commits.
2003-12-04 13:57:30 +00:00
yamt c64b77bad6 add definitions of new feature bits. 2003-11-30 14:05:47 +00:00
yamt b9bb4e3f05 - rename WDC_CAP_LBA48 to ATA_CMD2_LBA48.
- remove WDC_CAP_QUEUE. (there's already ATA_CMD2_RWQ.)

as discussed on tech-kern@.
2003-11-30 13:57:12 +00:00
fvdl 6242a54566 There are some cards that map the ATA control and IDE DMA registers
in a different fashion. Individually, they have the same functionality,
but their layout is different. An example of such a chipset is
the Promise 203xx.

To be able to deal with this, transform the cmd and dma bus_space handles
into an array of handles, each seperately created with bus_space_subregion.
The code generated by using the extra indirection shouldn't change much,
since the extra indirection is negated by having the offset calculation
already done in bus_space_subregion. E.g.

	bus_space_write_4(tag, handle, offset, value)

becomes

	bus_space_write_4(tag, handles[offset], 0, value)

Reviewed by Manuel Bouyer. Tested on wdc_isa, wdc_pcmcia, viaide, piixide (i386)
and on cmdide (sparc64).
2003-11-27 23:02:40 +00:00
yamt d1e85f1677 remove ATA_CMD2_SMART, which seems wrong and isn't used. 2003-11-26 15:03:14 +00:00
mycroft 552d27479a Replace home-grown locks with lockmgr(). 2003-11-07 04:10:56 +00:00
wiz c0177219fe Fix some typos. From Tom Cosgrove via jmc@openbsd. 2003-11-02 09:52:33 +00:00