summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2004-01-23 20:48:34 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2004-01-23 20:48:34 +0000
commit03c1bf810f040780bf68a54a5e1005b077c4bca9 (patch)
treef0dc96b8f25d9a0c52241bebf8abf5b7e49fe47d
parentea9ed6050d3c1b741ea22dc902f39da988850f00 (diff)
Use %b to display status register, this will make bug reports more
informative. Also convert WDCS_BITS string to caps.
-rw-r--r--sys/dev/ata/ata_wdc.c15
-rw-r--r--sys/dev/ic/wdc.c23
-rw-r--r--sys/dev/ic/wdcreg.h4
3 files changed, 23 insertions, 19 deletions
diff --git a/sys/dev/ata/ata_wdc.c b/sys/dev/ata/ata_wdc.c
index 6c6382a75f6..c6ef07b91a4 100644
--- a/sys/dev/ata/ata_wdc.c
+++ b/sys/dev/ata/ata_wdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ata_wdc.c,v 1.25 2004/01/15 21:37:57 grange Exp $ */
+/* $OpenBSD: ata_wdc.c,v 1.26 2004/01/23 20:48:33 grange Exp $ */
/* $NetBSD: ata_wdc.c,v 1.21 1999/08/09 09:43:11 bouyer Exp $ */
/*
@@ -355,9 +355,10 @@ again:
if ((ata_bio->flags & ATA_READ) == 0) {
if (wait_for_drq(chp, ata_delay) != 0) {
printf("%s:%d:%d: timeout waiting for DRQ, "
- "st=0x%02x, err=0x%02x\n",
+ "st=0x%b, err=0x%02x\n",
chp->wdc->sc_dev.dv_xname, chp->channel,
- xfer->drive, chp->ch_status, chp->ch_error);
+ xfer->drive, chp->ch_status, WDCS_BITS,
+ chp->ch_error);
if (wdc_ata_err(drvp, ata_bio) != WDC_ATA_ERR)
ata_bio->error = TIMEOUT;
wdc_ata_bio_done(chp, xfer);
@@ -387,9 +388,9 @@ intr: /* Wait for IRQ (either real or polled) */
}
return;
timeout:
- printf("%s:%d:%d: not ready, st=0x%02x, err=0x%02x\n",
+ printf("%s:%d:%d: not ready, st=0x%b, err=0x%02x\n",
chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive,
- chp->ch_status, chp->ch_error);
+ chp->ch_status, WDCS_BITS, chp->ch_error);
if (wdc_ata_err(drvp, ata_bio) != WDC_ATA_ERR)
ata_bio->error = TIMEOUT;
wdc_ata_bio_done(chp, xfer);
@@ -448,9 +449,9 @@ wdc_ata_bio_intr(struct channel_softc *chp, struct wdc_xfer *xfer, int irq)
}
if (chp->ch_status & WDCS_DRQ) {
if (drv_err != WDC_ATA_ERR) {
- printf("%s:%d:%d: intr with DRQ (st=0x%x)\n",
+ printf("%s:%d:%d: intr with DRQ (st=0x%b)\n",
chp->wdc->sc_dev.dv_xname, chp->channel,
- xfer->drive, chp->ch_status);
+ xfer->drive, chp->ch_status, WDCS_BITS);
ata_bio->error = TIMEOUT;
drv_err = WDC_ATA_ERR;
}
diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c
index 7ee749e2468..9e141eb6f89 100644
--- a/sys/dev/ic/wdc.c
+++ b/sys/dev/ic/wdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wdc.c,v 1.81 2003/12/16 03:37:37 millert Exp $ */
+/* $OpenBSD: wdc.c,v 1.82 2004/01/23 20:48:33 grange Exp $ */
/* $NetBSD: wdc.c,v 1.68 1999/06/23 19:00:17 bouyer Exp $ */
@@ -650,9 +650,10 @@ wdcprobe(chp)
st1 = CHP_READ_REG(chp, wdr_status);
WDC_LOG_STATUS(chp, st1);
- WDCDEBUG_PRINT(("%s:%d: before reset, st0=0x%x, st1=0x%x\n",
+ WDCDEBUG_PRINT(("%s:%d: before reset, st0=0x%b, st1=0x%b\n",
chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe",
- chp->channel, st0, st1), DEBUG_PROBE);
+ chp->channel, st0, WDCS_BITS, st1, WDCS_BITS),
+ DEBUG_PROBE);
if ((st0 & 0x7f) == 0x7f || st0 == WDSD_IBM)
ret_value &= ~0x01;
@@ -689,10 +690,11 @@ wdcprobe(chp)
ch = CHP_READ_REG(chp, wdr_cyl_hi);
WDC_LOG_REG(chp, wdr_cyl_lo, (ch << 8) | cl);
- WDCDEBUG_PRINT(("%s:%d:%d: after reset, st=0x%x, sc=0x%x"
+ WDCDEBUG_PRINT(("%s:%d:%d: after reset, st=0x%b, sc=0x%x"
" sn=0x%x cl=0x%x ch=0x%x\n",
chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe",
- chp->channel, drive, st0, sc, sn, cl, ch), DEBUG_PROBE);
+ chp->channel, drive, st0, WDCS_BITS, sc, sn, cl, ch),
+ DEBUG_PROBE);
/*
* This is a simplification of the test in the ATAPI
* spec since not all drives seem to set the other regs
@@ -1111,10 +1113,11 @@ __wdcwait_reset(chp, drv_mask)
if (st1 & WDCS_BSY)
drv_mask &= ~0x02;
end:
- WDCDEBUG_PRINT(("%s:%d: wdcwait_reset() end, st0=0x%x, er0=0x%x, "
- "st1=0x%x, er1=0x%x, reset time=%d msec\n",
+ WDCDEBUG_PRINT(("%s:%d: wdcwait_reset() end, st0=0x%b, er0=0x%x, "
+ "st1=0x%b, er1=0x%x, reset time=%d msec\n",
chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe", chp->channel,
- st0, er0, st1, er1, timeout * WDCDELAY / 1000), DEBUG_PROBE);
+ st0, WDCS_BITS, er0, st1, WDCS_BITS, er1,
+ timeout * WDCDELAY / 1000), DEBUG_PROBE);
return drv_mask;
}
@@ -1150,8 +1153,8 @@ wdc_wait_for_status(chp, mask, bits, timeout)
if ((status & WDCS_BSY) == 0 && (status & mask) == bits)
break;
if (++time > timeout) {
- WDCDEBUG_PRINT(("wdcwait: timeout, status 0x%x "
- "error 0x%x\n", status,
+ WDCDEBUG_PRINT(("wdcwait: timeout, status 0x%b "
+ "error 0x%x\n", status, WDCS_BITS,
CHP_READ_REG(chp, wdr_error)),
DEBUG_STATUSX | DEBUG_STATUS);
return -1;
diff --git a/sys/dev/ic/wdcreg.h b/sys/dev/ic/wdcreg.h
index f913da83b83..a58a54368fe 100644
--- a/sys/dev/ic/wdcreg.h
+++ b/sys/dev/ic/wdcreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: wdcreg.h,v 1.10 2003/10/16 14:15:41 grange Exp $ */
+/* $OpenBSD: wdcreg.h,v 1.11 2004/01/23 20:48:33 grange Exp $ */
/* $NetBSD: wdcreg.h,v 1.22 1999/03/07 14:02:54 bouyer Exp $ */
/*-
@@ -53,7 +53,7 @@
#define WDCS_CORR 0x04 /* corrected data */
#define WDCS_IDX 0x02 /* index */
#define WDCS_ERR 0x01 /* error */
-#define WDCS_BITS "\020\010bsy\007drdy\006dwf\005dsc\004drq\003corr\002idx\001err"
+#define WDCS_BITS "\020\010BSY\007DRDY\006DWF\005DSC\004DRQ\003CORR\002IDX\001ERR"
/*
* Error bits.