summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/ic/wdc.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c
index f7eac164619..ed570662307 100644
--- a/sys/dev/ic/wdc.c
+++ b/sys/dev/ic/wdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wdc.c,v 1.74 2003/10/29 19:01:11 matthieu Exp $ */
+/* $OpenBSD: wdc.c,v 1.75 2003/10/31 11:46:53 grange Exp $ */
/* $NetBSD: wdc.c,v 1.68 1999/06/23 19:00:17 bouyer Exp $ */
@@ -824,9 +824,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 */
@@ -1060,16 +1061,18 @@ __wdcwait_reset(chp, drv_mask)
int drv_mask;
{
int timeout;
- u_int8_t st0, st1;
+ u_int8_t st0, er0, st1, er1;
/* wait for BSY to deassert */
for (timeout = 0; timeout < WDCNDELAY_RST; timeout++) {
wdc_set_drive(chp, 0);
delay(10);
st0 = CHP_READ_REG(chp, wdr_status);
+ er0 = CHP_READ_REG(chp, wdr_error);
wdc_set_drive(chp, 1);
delay(10);
st1 = CHP_READ_REG(chp, wdr_status);
+ er1 = CHP_READ_REG(chp, wdr_error);
if ((drv_mask & 0x01) == 0) {
/* no master */
@@ -1097,10 +1100,10 @@ __wdcwait_reset(chp, drv_mask)
if (st1 & WDCS_BSY)
drv_mask &= ~0x02;
end:
- WDCDEBUG_PRINT(("%s:%d: wdcwait_reset() end, st0=0x%x, st1=0x%x, "
- "reset time=%d msec\n",
+ WDCDEBUG_PRINT(("%s:%d: wdcwait_reset() end, st0=0x%x, er0=0x%x, "
+ "st1=0x%x, er1=0x%x, reset time=%d msec\n",
chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe", chp->channel,
- st0, st1, timeout*WDCDELAY/1000), DEBUG_PROBE);
+ st0, er0, st1, er1, timeout * WDCDELAY / 1000), DEBUG_PROBE);
return drv_mask;
}
@@ -1253,6 +1256,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;