summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorbouyer <bouyer@NetBSD.org>1998-10-13 08:59:45 +0000
committerbouyer <bouyer@NetBSD.org>1998-10-13 08:59:45 +0000
commitda5d0a6f1749ce7aaa0fd27149dacee075dbb85a (patch)
treeb8d4f3bb8e31bce8aaa95b1bef48b37b9d560c7b /sys/dev
parent39c8c94fa571f15bd1411e02a950923c305bc843 (diff)
pciide.c: don't define WDCDEBUG, so it compiles on alpha. Correct a bogon
in the printing of DMA mode (piix3/4 only) others: set the debug_mask to 0, so that debug messages are turned off by default but can be easily turned on. Reset drive_flags to 0 for unconfigured devices, so that they are ignored later. For configured devices, reset state to 0 after probe/attach.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/wdc.c15
-rw-r--r--sys/dev/pci/pciide.c6
-rw-r--r--sys/dev/scsipi/atapi_wdc.c16
3 files changed, 25 insertions, 12 deletions
diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c
index 1320a08cf09..0333a204c5c 100644
--- a/sys/dev/ic/wdc.c
+++ b/sys/dev/ic/wdc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: wdc.c,v 1.31 1998/10/12 16:09:18 bouyer Exp $ */
+/* $NetBSD: wdc.c,v 1.32 1998/10/13 08:59:45 bouyer Exp $ */
/*
@@ -125,7 +125,7 @@ int wdprint __P((void *, const char *));
#define DEBUG_FUNCS 0x08
#define DEBUG_PROBE 0x10
#ifdef WDCDEBUG
-int wdcdebug_mask = DEBUG_PROBE;
+int wdcdebug_mask = 0;
int wdc_nxfer = 0;
#define WDCDEBUG_PRINT(args, level) if (wdcdebug_mask & (level)) printf args
#else
@@ -364,6 +364,17 @@ wdcattach(chp)
}
/*
+ * reset drive_flags for unnatached devices, reset state for attached
+ * ones
+ */
+ for (i = 0; i < 2; i++) {
+ if (chp->ch_drive[i].drv_softc == NULL)
+ chp->ch_drive[i].drive_flags = 0;
+ else
+ chp->ch_drive[i].state = 0;
+ }
+
+ /*
* Reset channel. The probe, with some combinations of ATA/ATAPI
* devices keep it in a mostly working, but strange state (with busy
* led on)
diff --git a/sys/dev/pci/pciide.c b/sys/dev/pci/pciide.c
index 2b5ee68db3e..1b8eaffd035 100644
--- a/sys/dev/pci/pciide.c
+++ b/sys/dev/pci/pciide.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pciide.c,v 1.9 1998/10/12 16:09:20 bouyer Exp $ */
+/* $NetBSD: pciide.c,v 1.10 1998/10/13 08:59:46 bouyer Exp $ */
/*
* Copyright (c) 1996, 1998 Christopher G. Demetriou. All rights reserved.
@@ -42,8 +42,6 @@
*
*/
-#define WDCDEBUG
-
#define DEBUG_DMA 0x01
#define DEBUG_XFERS 0x02
#define DEBUG_FUNCS 0x08
@@ -1042,7 +1040,7 @@ pio: /* use PIO mode */
drvp->drv_softc->dv_xname,
sc->sc_wdcdev.sc_dev.dv_xname,
channel, drive, drvp->PIO_mode);
- if (drvp[drive].drive_flags & DRIVE_DMA)
+ if (drvp->drive_flags & DRIVE_DMA)
printf(", DMA mode %d", drvp->DMA_mode);
if (drvp->drive_flags & DRIVE_UDMA)
printf(", UDMA mode %d", drvp->UDMA_mode);
diff --git a/sys/dev/scsipi/atapi_wdc.c b/sys/dev/scsipi/atapi_wdc.c
index 88c9b7275c4..691899899d3 100644
--- a/sys/dev/scsipi/atapi_wdc.c
+++ b/sys/dev/scsipi/atapi_wdc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: atapi_wdc.c,v 1.2 1998/10/12 16:09:23 bouyer Exp $ */
+/* $NetBSD: atapi_wdc.c,v 1.3 1998/10/13 08:59:46 bouyer Exp $ */
/*
* Copyright (c) 1998 Manuel Bouyer.
@@ -72,7 +72,7 @@
#define DEBUG_FUNCS 0x08
#define DEBUG_PROBE 0x10
#ifdef WDCDEBUG
-int wdcdebug_atapi_mask = DEBUG_PROBE;
+int wdcdebug_atapi_mask = 0;
#define WDCDEBUG_PRINT(args, level) \
if (wdcdebug_atapi_mask & (level)) \
printf args
@@ -250,6 +250,7 @@ wdc_atapi_start(chp, xfer)
if (wait_for_unbusy(chp, ATAPI_DELAY) < 0) {
printf("wdc_atapi_start: not ready, st = %02x\n",
chp->ch_status);
+ sc_xfer->error = XS_TIMEOUT;
wdc_atapi_reset(chp, xfer);
return;
}
@@ -277,6 +278,7 @@ wdc_atapi_start(chp, xfer)
/* Wait for at last 400ns for status bit to be valid */
delay(1);
if (wdc_atapi_intr(chp, xfer) == 0) {
+ sc_xfer->error = XS_TIMEOUT;
wdc_atapi_reset(chp, xfer);
return;
}
@@ -322,6 +324,7 @@ wdc_atapi_intr(chp, xfer)
printf("%s:%d:%d: device timeout, c_bcount=%d, c_skip%d\n",
chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive,
xfer->c_bcount, xfer->c_skip);
+ sc_xfer->error = XS_TIMEOUT;
wdc_atapi_reset(chp, xfer);
return 1;
}
@@ -411,6 +414,7 @@ again:
printf(", falling back to PIO\n");
drvp->drive_flags &= ~(DRIVE_DMA | DRIVE_UDMA);
}
+ sc_xfer->error = XS_TIMEOUT;
wdc_atapi_reset(chp, xfer);
return 1;
}
@@ -477,6 +481,7 @@ again:
printf(", falling back to PIO\n");
drvp->drive_flags &= ~(DRIVE_DMA | DRIVE_UDMA);
}
+ sc_xfer->error = XS_TIMEOUT;
wdc_atapi_reset(chp, xfer);
return 1;
}
@@ -650,17 +655,17 @@ timeout:
}
printf("%s:%d:%d: %s timed out\n",
chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive, errstring);
+ sc_xfer->error = XS_TIMEOUT;
wdc_atapi_reset(chp, xfer);
return 1;
error:
printf("%s:%d:%d: %s ",
chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive,
errstring);
- printf("error (%x)\n", chp->ch_error);
+ printf("error (0x%x)\n", chp->ch_error);
sc_xfer->error = XS_SENSE;
sc_xfer->sense.atapi_sense = chp->ch_error;
- drvp->state = 0;
- wdc_atapi_done(chp, xfer);
+ wdc_atapi_reset(chp, xfer);
return 1;
}
@@ -707,7 +712,6 @@ wdc_atapi_reset(chp, xfer)
wdc_atapi_done(chp, xfer);
return;
}
- sc_xfer->error = XS_TIMEOUT;
wdc_atapi_done(chp, xfer);
return;
}