summaryrefslogtreecommitdiff
path: root/sys/dev/ic/wdc.c
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2003-10-27 20:58:18 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2003-10-27 20:58:18 +0000
commit5b7765abfca406a2234f4a2f8d04e14c99e59bb2 (patch)
tree05dce0f39e31756c175b8b160970c3a75f0b346e /sys/dev/ic/wdc.c
parentc4bb120d27c0dcb6d9a68fe02253400287f5dff4 (diff)
Skip ATA modes detection for SATA drives, it's useless and some
SATA drives really don't like it. Add a delay between drive reset and issuing IDENTIFY command, some drives need it (from NetBSD). This fixes problems with SATA drives reported by Jonathon Fletcher <jonathon.fletcher@pobox.com>. He also provided access to the test machine.
Diffstat (limited to 'sys/dev/ic/wdc.c')
-rw-r--r--sys/dev/ic/wdc.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c
index 1ad6b18a972..a637ac6bab4 100644
--- a/sys/dev/ic/wdc.c
+++ b/sys/dev/ic/wdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wdc.c,v 1.72 2003/10/26 14:39:59 grange Exp $ */
+/* $OpenBSD: wdc.c,v 1.73 2003/10/27 20:58:17 grange Exp $ */
/* $NetBSD: wdc.c,v 1.68 1999/06/23 19:00:17 bouyer Exp $ */
@@ -822,9 +822,10 @@ wdcattach(chp)
if (i == 1 && ((chp->ch_drive[0].drive_flags & DRIVE) == 0))
chp->ch_flags |= WDCF_ONESLAVE;
/*
- * Issue an IDENTIFY command in order to distinct ATA from OLD.
- * This also kill ATAPI ghost.
+ * Wait a bit, some devices are weird just after a reset.
+ * Then issue a IDENTIFY command, to try to detect slave ghost.
*/
+ delay(5000);
if (ata_get_params(&chp->ch_drive[i], at_poll, &drvp->id) ==
CMD_OK) {
/* If IDENTIFY succeeded, this is not an OLD ctrl */
@@ -1261,6 +1262,21 @@ wdc_probe_caps(drvp, params)
int i, valid_mode_found;
int cf_flags = drvp->cf_flags;
+ if ((wdc->cap & WDC_CAPABILITY_SATA) != 0 &&
+ (params->atap_sata_caps != 0x0000 &&
+ params->atap_sata_caps != 0xffff)) {
+ WDCDEBUG_PRINT(("%s: atap_sata_caps=0x%x\n", __func__,
+ params->atap_sata_caps), DEBUG_PROBE);
+
+ /* Skip ATA modes detection for native SATA drives */
+ drvp->PIO_mode = drvp->PIO_cap = 4;
+ drvp->DMA_mode = drvp->DMA_cap = 2;
+ drvp->UDMA_mode = drvp->UDMA_cap = 5;
+ drvp->drive_flags |= DRIVE_SATA | DRIVE_MODE | DRIVE_UDMA;
+ drvp->ata_vers = 4;
+ return;
+ }
+
if ((wdc->cap & (WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32)) ==
(WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32)) {
struct ataparams params2;