Commit Graph

445 Commits

Author SHA1 Message Date
yamt 99229e5d39 introduce a function to drain bufq and use it where appropriate. 2005-03-31 11:28:53 +00:00
tacha 357eb4e7e6 Disestablish powerhook while detaching atabus. 2005-03-04 11:00:54 +00:00
perry f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
jmcneill 3ab5a3900d Add powerhook for atabus. 2005-01-26 21:51:40 +00:00
bouyer c306ebdd4c Also call ata_dmaerr() on DMA errors (as reported by the underlying controller
driver). We want to downgrade to PIO mode if DMA isn't functionnal.
2005-01-16 20:17:37 +00:00
bouyer 937bfab712 Move ata_dmaerr() so that it's called only when there really has been an error
(ata_bio->r_error doesn't containt anything meaningfull if no error occured).
Fix kern/28255 by Izumi Tsutsui, but with a different patch.
2004-12-08 18:49:52 +00:00
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
soren ba1f348292 s/using DMA data transfers/using DMA/ to make it fit in 80 columns.
DMA only applies to data transfers anyway..
2004-11-14 15:25:11 +00:00
bouyer c31b572a47 Allow polled commands to be queued, if ata_exec_xfer() is called in thread
context. For this introduce 3 new xfer tags:
- C_WAIT, equivalent of AT_WAIT
- C_WAITACT, when there is a thread waiting on this xfer to become the active
  one (that is, to be at the head of the queue)
- C_FREE, set by ata_free_xfer() when it can't free the xfer because it's
  still in use. The holder should then free the xfer ASAP.

If ata_exec_xfer() is called with (C_POLL | C_WAIT), and there is already
xfers to be processed, assert C_WAITACT and sleep.
atastart() checks for C_WAITACT, and wakeup the thread waiting for this xfer
to become active if set. atastart() won't process this xfer, it's the
responsability of the thread waked up to handle it.

Fix (the right way) kern/27421 by Martin Husemann.
2004-10-30 23:10:37 +00:00
bouyer 2bdbaab58f Call xfer->c_start() with the channel from the xfer, not the one from the
thread. They may be different if we have a shared queue.
2004-10-28 20:11:41 +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
thorpej 45bba4e135 Change config_attach_pseudo() to take a cfdata * that contains the
necessary information to create the pseudo-device instance.  Pseudo-device
device's will reference this cfdata, just as normal devices reference
their corresponding cfdata.

Welcome to 2.99.10.
2004-10-15 04:38:36 +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
enami 6d7958ac59 Minimal support for mirror component. The relation between original and
mirror component learned from FreeBSD driver.
2004-09-17 23:21:53 +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 96b589fc18 a round of autoconf cleanup:
-convert submatch() style functions (passed to config_search() or
 config_found_sm()) to the locator passing variants
-pass interface attributes in some cases
-make submatch() functions look uniformly as far as possible
-avoid macros which just hide cfdata members, and reduce dependencies
 on "locators.h"
2004-09-13 12:55:47 +00:00
bouyer bf02dcb5ca If we're not going to handle a reset request because one if already pending,
decrease queue_freeze that we just increased (otherwise the queue stay
frozen after the reset).
Should fix kern/26873 and port-i386/26910.
2004-09-11 18:01:58 +00:00
drochner b4b2fd9326 make the software managed bad-sector list optional
(kernel option WD_SOFTBADSECT)
2004-08-30 09:34:41 +00:00
he 764115cc85 Put an #ifdef _KERNEL around inline functions using panic().
Fixes compile problem for the atactl program for the vax target.
2004-08-23 10:08:48 +00:00
thorpej 09662eaa73 Register description for SATA port multipliers. 2004-08-21 02:25:26 +00:00
thorpej 5373bdd103 - Move to48() to atareg.h and rename it atacmd_to48().
- Add an atacmd_tosataq() that converts a 32-bit command to a Native
  SATA Queued command.
2004-08-21 02:17:07 +00:00
thorpej 8eaae3f96b Eliminate some gratuitous spl frobbing in atabus_thread(). 2004-08-21 00:48:32 +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 2aaf643e25 - atabus_detach(): Manipulate ch_flags at splbio().
- ata_reset_channel(): Assert that we're at splbio() when called.
- Sprinkle some comments about functions that must be called at splbio().
2004-08-20 23:50:13 +00:00
thorpej 4af8216045 WDC_DIAGNOSTIC -> ATA_DEBUG 2004-08-20 23:36:52 +00:00
thorpej e975b9caee - Add an (*ata_reset_channel)() member to ata_bustype.
- Add an ata_reset_channel() function that performs the common parts
  of resetting an ATA channel, which uses the (*ata_reset_channel)()
  callback to do the heavy lifting.  Adjust callers to use ata_reset_channel()
  instead of wdc_reset_channel().

This removes the last wdc-specific code from ata.c!
2004-08-20 23:26:53 +00:00
thorpej bd165f8e47 Use ANSI function decls for atabus open/close/ioctl. 2004-08-20 22:26:23 +00:00
thorpej c5adb42199 wdcreg.h is not needed here any more. 2004-08-20 22:19:00 +00:00
thorpej 56e2a255b5 Move common parts of attaching an ata_channel to a new ata_channel_attach()
function.
2004-08-20 22:17:06 +00:00
thorpej 3234a02f48 Move atabusconfig() to ata.c. 2004-08-20 22:02:40 +00:00
thorpej 51c34ebedf In ata_get_params(), use the (*ata_exec_command)() available from the
ata_bustype rather than using wdc_exec_command() directly.
2004-08-20 20:53:20 +00:00
thorpej 2606542c7b - Add an atac_bustype_ata member to atac_softc to hold a pointer to
the ata_bustype for the controller.  Fill it in and use it instead
  of referencing wdc_ata_bustype directly.
- Add an atac_atapibus_attach member to atac_softc to hold a pointer
  to the function that attaches the ATAPI bus for the controller.  Fill
  it in and use it instead of referencing wdc_atapibus_attach directly.
2004-08-20 20:52:31 +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 9cc521a148 Move most of wdc_softc into a new atac_softc structure that contains
info common to all types of ATA controllers.
2004-08-20 06:39:37 +00:00
thorpej 4b51cecfc2 - Split the register handles out of struct wdc_channel into a separate
wdc_regs structure, and array of which (indexed per channel) is pointed
  to by struct wdc_softc.
- Move the resulting wdc_channel structure to atavar.h and rename it to
  ata_channel.  Rename the corresponding flags.
- Add a "ch_ndrive" member to struct ata_channel, which indicates the
  maximum number of drives that can be present on the channel.  For now,
  this is always 2.  Add an ATA_MAXDRIVES constant that places an upper
  limit on this value, also currently 2.
2004-08-14 15:08:04 +00:00
thorpej 46f4277564 WDCDEBUG -> ATADEBUG. 2004-08-13 04:10:49 +00:00
thorpej ab20886f7b Don't bother with bits that tell of the presence of optional callbacks;
just check the function pointers for NULL.
2004-08-13 03:12:59 +00:00
thorpej 577bf67014 Move wdcstart() to ata.c and rename it to atastart(). 2004-08-13 02:16:40 +00:00
thorpej 996c3ca90e Move wdc_exec_xfer() to ata.c and rename it ata_exec_xfer(). 2004-08-13 02:10:43 +00:00
thorpej e6d61c5bc9 Move wdc_addref() and wdc_delref() to ata.c and rename them to
ata_*.
2004-08-12 22:39:40 +00:00
thorpej 2eaa5c6142 Move wdc_kill_pending() to ata.c and rename it ata_kill_pending(). 2004-08-12 22:33:45 +00:00
thorpej 2600c55e01 - Move wdc_xfer_pool, wdc_get_xfer(), wdc_free_xfer() to ata.c, and rename
to ata_*.
- Use a static initializer for the ata_xfer_pool.
2004-08-12 21:34:52 +00:00
thorpej 52ed169a28 Move wdc_probe_caps() to ata.c and rename it ata_probe_caps(). 2004-08-12 21:10:18 +00:00
thorpej ac7276784a Move wdc_downgrade_mode() to ata.c and rename it to ata_downgrade_mode(). 2004-08-12 21:05:09 +00:00
thorpej 9939d3c63d Move wdc_print_modes() into ata.c and rename it ata_print_modes(). 2004-08-12 20:59:27 +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
thorpej f45b99ef1d Add SATA queued read/write commands. 2004-08-12 04:26:06 +00:00
thorpej 77cc762658 Don't assume wdc-specific ATA / ATAPI code should be brought in if atabus
or atapibus are configured; use a separate wdc_common attribute to indicate
that the shared wdc code is also present.
2004-08-12 04:23:02 +00:00