Commit Graph

297 Commits

Author SHA1 Message Date
bouyer 3d94454016 Some drives reports ATA version < 4, and still support (and need) the
WDCC_FLUSHCACHE command. So for drive < ATA4, test WDC_CMD2_FC in atap_cmd_set2
before returning ENODEV.
Problem reported and fix tested by Michael Gerhards on port-sparc64.
2004-11-18 22:14:53 +00:00
yamt 05f25dcc2a move buffer queue related stuffs from buf.h to their own header, bufq.h. 2004-10-28 07:07:35 +00:00
bouyer b31a120195 Add a WD_QUIRK_FORCE_LBA48 quirck, which forces all access to use LBA48.
Use it for ST3200822A, which has a broken firmware and return an error
when accessing sector 0xfffffff with a LBA command.
Patch tested by David Brownlee.
2004-09-28 18:22:33 +00:00
thorpej cc79c7aeb0 Add support for wedges to the ATA disk driver. 2004-09-25 03:34:02 +00:00
bouyer cdc0918196 In case of error, reset the channel with AT_RST_NOCMD. We know the reset
won't abort any command at this point.
2004-09-16 20:52:43 +00:00
drochner b4b2fd9326 make the software managed bad-sector list optional
(kernel option WD_SOFTBADSECT)
2004-08-30 09:34:41 +00:00
thorpej 335b799580 atastart() (called only at splbio(), and from interrupts) can change
drive_flags, to make sure all drive_flags manipulations are done at
splbio().
2004-08-21 00:28:34 +00:00
thorpej 709a2d87fc Rename the ata_bustype "ata_reset_channel" member to "ata_reset_drive"
to reflect the new reality after Manuel added the bus reset ioctls.
2004-08-20 17:19:44 +00:00
thorpej 46f4277564 WDCDEBUG -> ATADEBUG. 2004-08-13 04:10:49 +00:00
thorpej 9167731c79 Rename some constants:
WDC_COMPLETE -> ATACMD_COMPLETE
WDC_QUEUED -> ATACMD_QUEUED
WDC_TRY_AGAIN -> ATACMD_TRY_AGAIN
2004-08-12 05:02:50 +00:00
thorpej 3ddac9b2da Rename "struct wdc_command" to "struct ata_command". 2004-08-12 04:57:19 +00:00
mycroft 646cec1d1d A few things:
* Kill off device nodes *before* we clear out the queue, to help prevent any
  new I/O being queued.
* More useful error reporting in wd_setcache() and wd_flushcache().
* Add a wd_standby() (tested but not used yet).

And the most important:
* In wddetach(), if the device was open, call adapt_delref() so that we
  propagate the disable up to our PCMCIA socket.
2004-08-10 02:33:58 +00:00
bouyer 1f5d4dd9dd Change wdc_kill_pending() to take a struct ata_drive_datas * as argument,
and kill only pending requests for this drive.
Implement a DRIVE_WAITDRAIN flag, which will cause the active command to
be killed once complete.
Other minor fixes.
Now it's possible to detach a ATA or ATAPI device from ioctl even when
a dd on the raw char partition is running.
2004-08-04 22:44:04 +00:00
bouyer bedea96dd4 First cut at implementing ATABUSIODETACH. Still buggy. 2004-08-03 22:37:19 +00:00
bouyer a861f41a39 wddetach(): move lockmgr(LK_DRAIN) near the end; otherwise we'll panic in
wddone() (vdevgone() may end up calling it) trying to get the lock.
wdopen(): check for DVF_ACTIVE.
2004-08-03 22:03:46 +00:00
bouyer 9ad121a77a move cleaning of the bad block list in wddetach() after the call to
disk_detach(), to avoid a race condition with the interrupt code.
2004-08-03 21:38:45 +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
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
bouyer c88ebc6e3e Add support for the DIOCCACHESYNC ioctl. 2004-05-21 20:35:53 +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
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
yamt 7266a95907 store a i/o priority hint in struct buf for buffer queue discipline. 2004-01-10 14:39:50 +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 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
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 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
mycroft 552d27479a Replace home-grown locks with lockmgr(). 2003-11-07 04:10:56 +00:00
mycroft 3fbc866a6e Back out the bogus initializer -- the compiler bug is fixed. 2003-10-29 21:26:43 +00:00
cl b8d68ee313 note 'm68k {u,}int64_t used uninitialized' bug.
add reference to gcc bug report.
mark all (known) occurrences.
2003-10-28 02:01:46 +00:00
fredb fc4e07a00b Appease gcc3 "-Wno-uninitialized". 2003-10-27 23:06:15 +00:00
bouyer 7719e83c8b Following Matt Thomas's request, rename ata attribute to ata_hl, and
wdc_base to ata. We can now have
atabus* at ata?
in kernel config files.
2003-10-08 20:57:59 +00:00
bouyer 99d6009c2a Make the ATA mid-layer appears as atabus, as proposed in
http://mail-index.netbsd.org/tech-kern/2003/09/25/0006.html
This adds a device (atabus) between IDE controllers and wd or atapibus, to
have each ATA channel show up in the device tree. Later there will be atabus
devices in /dev, so that we can do IOCTL on them.
Each atabus has its own kernel thread, to handle operations that needs polling,
e.g. reset and others.

Device probing on each bus it defered to the atabus thread creation.
This allows to do the reset and basic device probes in parallel, which reduce
boot time on systems with several pciide controllers.
2003-10-08 10:58:12 +00:00
mycroft d40837608f 1) Use config_interrupts() to attach IDE and ATAPI drives. This eliminates
most polling.
2) Clean up some goofiness in pciide -- get rid of the whole "candisable" path
   (it's gratuitous) and simplify the code by calling pciide_map_compat_intr(),
   *_set_modes() and wdc_print_modes() from central locations.
3) Add a register writability and register ghost test to eliminate phantom
   drives more quickly.
2003-09-19 21:35:56 +00:00
bouyer feddcdfa5d For LBA drives, compute the number of cylinders from the drive capacity
in the default disklabel and the boot message, instead of using the
value reported by the drive (which is 16383 if the drive is larger than 8G).
Should fix PR 9864
2003-08-03 17:53:04 +00:00
dsl 31722f62d8 KNF and whitespace (and indent a contuation line) 2003-07-11 15:33:13 +00:00
matt 258cc62412 Add LBA48_THRESHOLD #define and set it to the *correct* value. Use it
in place of "0xffffff" (which is one too few 'f').
2003-07-10 23:23:44 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
bouyer 7a5f4f28d0 Don't use LBA48 if we don't have to (that is, if the request is inside the
first 128GB). Tested by Andreas Johansson.
2003-06-29 19:28:16 +00:00
bouyer b55e87ab48 Remove unused WAITTIME definition. Pointed out by Andreas Johansson. 2003-06-29 17:03:47 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
thorpej 577fd9d8fa * Use aprint*().
* Add Ultra/133 to wdc_print_modes().
2003-05-17 21:52:03 +00:00
thorpej e43fecb228 Change bounds_check_with_label() to take a pointer to the disk structure,
rather than the label itself.  This paves the way for some future changes.
2003-05-10 23:12:28 +00:00
dsl d91455ce26 Change return type of readdisklabel() to const char *
I hope I've found all the correct places!
2003-05-02 08:45:10 +00:00
bouyer a704b24037 Fix typo. 2003-04-27 14:33:20 +00:00
bouyer 07e96ff3d7 Acceptable cache operations are r and rw, not none and w
Properly initialise the timeout value.
2003-04-27 14:27:36 +00:00
bouyer 1e2dac7786 Add support for the getcache/setcache ioctls. 2003-04-26 09:54:15 +00:00