summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/ata/ata.c23
-rw-r--r--sys/dev/atapiscsi/atapiscsi.c41
-rw-r--r--sys/dev/ic/wdc.c87
-rw-r--r--sys/dev/ic/wdcdbg.h29
4 files changed, 90 insertions, 90 deletions
diff --git a/sys/dev/ata/ata.c b/sys/dev/ata/ata.c
index 61f6180276e..03f4994246e 100644
--- a/sys/dev/ata/ata.c
+++ b/sys/dev/ata/ata.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ata.c,v 1.7 2000/10/28 18:08:45 csapuntz Exp $ */
+/* $OpenBSD: ata.c,v 1.8 2000/10/29 18:42:49 deraadt Exp $ */
/* $NetBSD: ata.c,v 1.9 1999/04/15 09:41:09 bouyer Exp $ */
/*
* Copyright (c) 1998 Manuel Bouyer. All rights reserved.
@@ -44,7 +44,19 @@
#include <dev/ata/atavar.h>
#include <dev/ic/wdcreg.h>
#include <dev/ic/wdcvar.h>
-#include <dev/ic/wdcdbg.h>
+
+#define WDCDEBUG
+
+#define DEBUG_FUNCS 0x08
+#define DEBUG_PROBE 0x10
+#ifdef WDCDEBUG
+extern int wdcdebug_mask; /* init'ed in wdc.c */
+#define WDCDEBUG_PRINT(args, level) \
+ if (wdcdebug_mask & (level)) \
+ printf args
+#else
+#define WDCDEBUG_PRINT(args, level)
+#endif
#define ATAPARAMS_SIZE 512
@@ -89,6 +101,7 @@ ata_get_params(drvp, flags, prms)
{
int ret;
if ((ret = wdc_exec_command(drvp, &wdc_c)) != WDC_COMPLETE) {
+ printf ("WDC_EXEC_COMMAND: %d\n");
return CMD_AGAIN;
}
}
@@ -96,7 +109,8 @@ ata_get_params(drvp, flags, prms)
if (wdc_c.flags & (AT_ERROR | AT_TIMEOU | AT_DF)) {
struct channel_softc *chp = drvp->chnl_softc;
- WDCDEBUG_PRINT_PROBE(("IDENTIFY failed: 0x%x\n", wdc_c.flags));
+ WDCDEBUG_PRINT(("IDENTIFY failed: 0x%x\n", wdc_c.flags)
+ , DEBUG_PROBE);
/* Andreas Gunnarsson reports a setup with a flash
disk where the ATA drive remains comatose until
@@ -104,8 +118,7 @@ ata_get_params(drvp, flags, prms)
if (try == 0 && (drvp->drive_flags & DRIVE_ATA) &&
(wdc_c.flags & AT_TIMEOU) &&
!(chp->ch_flags & WDCS_BSY)) {
- WDCDEBUG_PRINT_PROBE
- (("Retrying IDENTIFY\n"));
+ WDCDEBUG_PRINT(("Retrying IDENTIFY\n"), DEBUG_PROBE);
try++;
goto again;
}
diff --git a/sys/dev/atapiscsi/atapiscsi.c b/sys/dev/atapiscsi/atapiscsi.c
index 2fb1b67c2b5..9c24473c818 100644
--- a/sys/dev/atapiscsi/atapiscsi.c
+++ b/sys/dev/atapiscsi/atapiscsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atapiscsi.c,v 1.31 2000/10/28 18:08:45 csapuntz Exp $ */
+/* $OpenBSD: atapiscsi.c,v 1.32 2000/10/29 18:42:50 deraadt Exp $ */
/*
* This code is derived from code with the copyright below.
@@ -78,7 +78,7 @@
#define READY 6
-#define WDCDEBUG_PROBE
+#define WDCDEBUG
#define DEBUG_INTR 0x01
#define DEBUG_XFERS 0x02
@@ -89,9 +89,8 @@
#define DEBUG_POLL 0x40
#define DEBUG_ERRORS 0x80 /* Debug error handling code */
-int wdcdebug_atapi_mask = 0;
-
#if defined(WDCDEBUG)
+int wdcdebug_atapi_mask = 0;
#define WDCDEBUG_PRINT(args, level) \
if (wdcdebug_atapi_mask & (level)) \
printf args
@@ -99,12 +98,6 @@ int wdcdebug_atapi_mask = 0;
#define WDCDEBUG_PRINT(args, level)
#endif
-#if defined(WDCDEBUG) || defined(WDCDEBUG_PROBE)
-#define WDCDEBUG_PRINT_PROBE(args) if (wdcdebug_atapi_mask & DEBUG_PROBE) printf args
-#else
-#define WDCDEBUG_PRINT_PROBE(args)
-#endif
-
/* 10 ms, this is used only before sending a cmd. */
#define ATAPI_DELAY 10
#define ATAPI_RESET_WAIT 2000
@@ -243,8 +236,10 @@ atapiscsi_attach(parent, self, aux)
printf("\n");
+#ifdef WDCDEBUG
if (chp->wdc->sc_dev.dv_cfdata->cf_flags & WDC_OPTION_PROBE_VERBOSE)
wdcdebug_atapi_mask |= DEBUG_PROBE;
+#endif
as->chp = chp;
as->sc_adapterlink.adapter_softc = as;
@@ -269,9 +264,10 @@ atapiscsi_attach(parent, self, aux)
wdc_probe_caps(drvp, id);
- WDCDEBUG_PRINT_PROBE(
- ("general config %04x capabilities %04x ",
- id->atap_config, id->atap_capabilities1));
+ WDCDEBUG_PRINT(
+ ("general config %04x capabilities %04x ",
+ id->atap_config, id->atap_capabilities1),
+ DEBUG_PROBE);
/* Tape drives do funny DSC stuff */
if (ATAPI_CFG_TYPE(id->atap_config) ==
@@ -285,8 +281,8 @@ atapiscsi_attach(parent, self, aux)
drvp->atapi_cap |=
(id->atap_config & ATAPI_CFG_DRQ_MASK);
- WDCDEBUG_PRINT_PROBE(
- ("driver caps %04x\n", drvp->atapi_cap));
+ WDCDEBUG_PRINT(("driver caps %04x\n", drvp->atapi_cap),
+ DEBUG_PROBE);
} else
drvp->drive_flags &= ~DRIVE_ATAPI;
}
@@ -317,8 +313,10 @@ atapiscsi_attach(parent, self, aux)
}
}
+#ifdef WDCDEBUG
if (chp->wdc->sc_dev.dv_cfdata->cf_flags & WDC_OPTION_PROBE_VERBOSE)
wdcdebug_atapi_mask &= ~DEBUG_PROBE;
+#endif
}
void
@@ -366,8 +364,8 @@ wdc_atapi_get_params(chp, drive, id)
* ATAPI devices one day.
*/
if ((drvp->drive_flags & DRIVE_ATAPI) == 0) {
- WDCDEBUG_PRINT_PROBE(("wdc_atapi_get_params: drive %d not present\n",
- drive));
+ WDCDEBUG_PRINT(("wdc_atapi_get_params: drive %d not present\n",
+ drive), DEBUG_PROBE);
return (-1);
}
bzero(&wdc_c, sizeof(struct wdc_command));
@@ -383,10 +381,10 @@ wdc_atapi_get_params(chp, drive, id)
panic("wdc_atapi_get_params");
}
if (wdc_c.flags & (AT_ERROR | AT_TIMEOU | AT_DF)) {
- WDCDEBUG_PRINT_PROBE(("wdc_atapi_get_params: ATAPI_SOFT_RESET "
+ WDCDEBUG_PRINT(("wdc_atapi_get_params: ATAPI_SOFT_RESET "
"failed for drive %s:%d:%d: error 0x%x\n",
chp->wdc->sc_dev.dv_xname, chp->channel, drive,
- wdc_c.r_error));
+ wdc_c.r_error), DEBUG_PROBE);
return (-1);
}
drvp->state = 0;
@@ -398,9 +396,10 @@ wdc_atapi_get_params(chp, drive, id)
retry:
if (ata_get_params(drvp, at_poll, id) != 0) {
- WDCDEBUG_PRINT_PROBE(("wdc_atapi_get_params: ATAPI_IDENTIFY_DEVICE "
+ WDCDEBUG_PRINT(("wdc_atapi_get_params: ATAPI_IDENTIFY_DEVICE "
"failed for drive %s:%d:%d\n",
- chp->wdc->sc_dev.dv_xname, chp->channel, drive));
+ chp->wdc->sc_dev.dv_xname, chp->channel, drive),
+ DEBUG_PROBE);
if (retries--) {
delay(100000);
diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c
index a200e8a5488..cb2999bb538 100644
--- a/sys/dev/ic/wdc.c
+++ b/sys/dev/ic/wdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wdc.c,v 1.22 2000/10/28 18:08:46 csapuntz Exp $ */
+/* $OpenBSD: wdc.c,v 1.23 2000/10/29 18:42:49 deraadt Exp $ */
/* $NetBSD: wdc.c,v 1.68 1999/06/23 19:00:17 bouyer Exp $ */
@@ -91,9 +91,10 @@
#include <dev/ata/atareg.h>
#include <dev/ic/wdcreg.h>
#include <dev/ic/wdcvar.h>
+
#include "atapiscsi.h"
-#include <dev/ic/wdcdbg.h>
+#define WDCDEBUG
#define WDCDELAY 100 /* 100 microseconds */
#define WDCNDELAY_RST (WDC_RESET_WAIT * 1000 / WDCDELAY)
@@ -112,7 +113,23 @@ int __wdccommand_intr __P((struct channel_softc *, struct wdc_xfer *, int));
int wdprint __P((void *, const char *));
void wdc_kill_pending __P((struct channel_softc *));
+
+#define DEBUG_INTR 0x01
+#define DEBUG_XFERS 0x02
+#define DEBUG_STATUS 0x04
+#define DEBUG_FUNCS 0x08
+#define DEBUG_PROBE 0x10
+#define DEBUG_STATUSX 0x20
+#define DEBUG_SDRIVE 0x40
+#define DEBUG_DETACH 0x80
+
+#ifdef WDCDEBUG
int wdcdebug_mask = 0;
+int wdc_nxfer = 0;
+#define WDCDEBUG_PRINT(args, level) if (wdcdebug_mask & (level)) printf args
+#else
+#define WDCDEBUG_PRINT(args, level)
+#endif
int at_poll = AT_POLL;
@@ -386,26 +403,26 @@ wdc_preata_drive(chp, drive)
{
if (wdc_floating_bus(chp, drive)) {
- WDCDEBUG_PRINT_PROBE(("%s:%d:%d: floating bus detected\n",
+ WDCDEBUG_PRINT(("%s:%d:%d: floating bus detected\n",
chp->wdc->sc_dev.dv_xname,
- chp->channel, drive));
+ chp->channel, drive), DEBUG_PROBE);
return 0;
}
CHP_WRITE_REG(chp, wdr_sdh, WDSD_IBM | (drive << 4));
delay(100);
if (wdcwait(chp, WDCS_DRDY | WDCS_DRQ, WDCS_DRDY, 10000) != 0) {
- WDCDEBUG_PRINT_PROBE(("%s:%d:%d: not ready\n",
+ WDCDEBUG_PRINT(("%s:%d:%d: not ready\n",
chp->wdc->sc_dev.dv_xname,
- chp->channel, drive));
+ chp->channel, drive), DEBUG_PROBE);
return 0;
}
CHP_WRITE_REG(chp, wdr_command, WDCC_RECAL);
if (wdcwait(chp, WDCS_DRDY | WDCS_DRQ, WDCS_DRDY, 10000) != 0) {
- WDCDEBUG_PRINT_PROBE(("%s:%d:%d: WDCC_RECAL failed\n",
+ WDCDEBUG_PRINT(("%s:%d:%d: WDCC_RECAL failed\n",
chp->wdc->sc_dev.dv_xname,
- chp->channel, drive));
+ chp->channel, drive), DEBUG_PROBE);
return 0;
}
@@ -432,9 +449,9 @@ wdc_ata_present(chp, drive)
time_to_done = wdc_wait_for_status(chp, WDCS_DRDY, WDCS_DRDY, 1000);
if (time_to_done == -1) return 0;
- WDCDEBUG_PRINT_PROBE(("%s:%d:%d: waiting for ready %d msec\n",
+ WDCDEBUG_PRINT(("%s:%d:%d: waiting for ready %d msec\n",
chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe",
- chp->channel, drive, time_to_done));
+ chp->channel, drive, time_to_done), DEBUG_PROBE);
/*
This section has been disabled because my Promise Ultra/66
@@ -463,22 +480,21 @@ wdc_ata_present(chp, drive)
time_to_done = wdc_wait_for_status(chp, 0, 0, 1000);
if (time_to_done == -1) {
- WDCDEBUG_PRINT_PROBE((
- "%s:%d:%d: timeout waiting for NOP to complete\n",
+ WDCDEBUG_PRINT(("%s:%d:%d: timeout waiting for NOP to complete\n",
chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe",
- chp->channel, drive));
+ chp->channel, drive), DEBUG_PROBE);
return 0;
}
- WDCDEBUG_PRINT_PROBE(("%s:%d:%d: NOP completed in %d msec\n",
+ WDCDEBUG_PRINT(("%s:%d:%d: NOP completed in %d msec\n",
chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe",
- chp->channel, drive, time_to_done));
+ chp->channel, drive, time_to_done), DEBUG_PROBE);
if (!(chp->ch_status & WDCS_ERR) &&
!(chp->ch_error & WDCE_ABRT)) {
- WDCDEBUG_PRINT_PROBE(("%s:%d:%d: NOP command did not ABORT command\n",
+ WDCDEBUG_PRINT(("%s:%d:%d: NOP command did not ABORT command\n",
chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe",
- chp->channel, drive));
+ chp->channel, drive), DEBUG_PROBE);
return 0;
}
#endif
@@ -521,9 +537,9 @@ wdcprobe(chp)
delay(10);
st1 = CHP_READ_REG(chp, wdr_status);
- WDCDEBUG_PRINT_PROBE(("%s:%d: before reset, st0=0x%x, st1=0x%x\n",
+ WDCDEBUG_PRINT(("%s:%d: before reset, st0=0x%x, st1=0x%x\n",
chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe",
- chp->channel, st0, st1));
+ chp->channel, st0, st1), DEBUG_PROBE);
/*
If the status is 0x7f or 0xff, then it's
@@ -544,9 +560,9 @@ wdcprobe(chp)
delay(2000);
ret_value = __wdcwait_reset(chp, ret_value);
- WDCDEBUG_PRINT_PROBE(("%s:%d: after reset, ret_value=0x%d\n",
+ WDCDEBUG_PRINT(("%s:%d: after reset, ret_value=0x%d\n",
chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe", chp->channel,
- ret_value));
+ ret_value), DEBUG_PROBE);
if (ret_value == 0)
return 0;
@@ -568,10 +584,10 @@ wdcprobe(chp)
cl = CHP_READ_REG(chp, wdr_cyl_lo);
ch = CHP_READ_REG(chp, wdr_cyl_hi);
- WDCDEBUG_PRINT_PROBE(("%s:%d:%d: after reset, st=0x%x, sc=0x%x"
+ WDCDEBUG_PRINT(("%s:%d:%d: after reset, st=0x%x, 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));
+ chp->channel, drive, st0, 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
@@ -589,12 +605,12 @@ wdcprobe(chp)
}
}
-
+#ifdef WDCDEBUG
if ((chp->ch_flags & WDCF_VERBOSE_PROBE) ||
(chp->wdc &&
(chp->wdc->sc_dev.dv_cfdata->cf_flags & WDC_OPTION_PROBE_VERBOSE)))
wdcdebug_mask &= ~DEBUG_PROBE;
-
+#endif
return (ret_value);
}
@@ -650,10 +666,10 @@ wdcattach(chp)
return;
}
-
+#ifdef WDCDEBUG
if (chp->wdc->sc_dev.dv_cfdata->cf_flags & WDC_OPTION_PROBE_VERBOSE)
wdcdebug_mask |= DEBUG_PROBE;
-
+#endif
/* init list only once */
if (inited == 0) {
@@ -688,9 +704,9 @@ wdcattach(chp)
} else {
chp->ch_drive[i].drive_flags &=
~(DRIVE_ATA | DRIVE_ATAPI);
- WDCDEBUG_PRINT_PROBE(("%s:%d:%d: IDENTIFY failed\n",
+ WDCDEBUG_PRINT(("%s:%d:%d: IDENTIFY failed\n",
chp->wdc->sc_dev.dv_xname,
- chp->channel, i));
+ chp->channel, i), DEBUG_PROBE);
if (!wdc_preata_drive(chp, i))
chp->ch_drive[i].drive_flags &= ~DRIVE_OLD;
@@ -699,8 +715,9 @@ wdcattach(chp)
ctrl_flags = chp->wdc->sc_dev.dv_cfdata->cf_flags;
channel_flags = (ctrl_flags >> (NBBY * chp->channel)) & 0xff;
- WDCDEBUG_PRINT_PROBE(("wdcattach: ch_drive_flags 0x%x 0x%x\n",
- chp->ch_drive[0].drive_flags, chp->ch_drive[1].drive_flags));
+ WDCDEBUG_PRINT(("wdcattach: ch_drive_flags 0x%x 0x%x\n",
+ chp->ch_drive[0].drive_flags, chp->ch_drive[1].drive_flags),
+ DEBUG_PROBE);
/* If no drives, abort here */
if ((chp->ch_drive[0].drive_flags & DRIVE) == 0 &&
@@ -781,10 +798,10 @@ wdcattach(chp)
#endif
exit:
-
+#ifdef WDCDEBUG
if (chp->wdc->sc_dev.dv_cfdata->cf_flags & WDC_OPTION_PROBE_VERBOSE)
wdcdebug_mask &= ~DEBUG_PROBE;
-
+#endif
return;
}
@@ -991,10 +1008,10 @@ __wdcwait_reset(chp, drv_mask)
if (st1 & WDCS_BSY)
drv_mask &= ~0x02;
end:
- WDCDEBUG_PRINT_PROBE(("%s:%d: wdcwait_reset() end, st0=0x%x, st1=0x%x, "
+ WDCDEBUG_PRINT(("%s:%d: wdcwait_reset() end, st0=0x%x, st1=0x%x, "
"reset time=%d msec\n",
chp->wdc ? chp->wdc->sc_dev.dv_xname : "wdcprobe", chp->channel,
- st0, st1, timeout*WDCDELAY/1000));
+ st0, st1, timeout*WDCDELAY/1000), DEBUG_PROBE);
return drv_mask;
}
diff --git a/sys/dev/ic/wdcdbg.h b/sys/dev/ic/wdcdbg.h
deleted file mode 100644
index ed7c6031922..00000000000
--- a/sys/dev/ic/wdcdbg.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* $OpenBSD: wdcdbg.h,v 1.1 2000/10/28 18:08:46 csapuntz Exp $ */
-
-#define WDCDEBUG_PROBE
-
-#define DEBUG_INTR 0x01
-#define DEBUG_XFERS 0x02
-#define DEBUG_STATUS 0x04
-#define DEBUG_FUNCS 0x08
-#define DEBUG_PROBE 0x10
-#define DEBUG_STATUSX 0x20
-#define DEBUG_SDRIVE 0x40
-#define DEBUG_DETACH 0x80
-
-extern int wdcdebug_mask; /* init'ed in wdc.c */
-
-#ifdef WDCDEBUG
-extern int wdcdebug_mask; /* init'ed in wdc.c */
-#define WDCDEBUG_PRINT(args, level) \
- if (wdcdebug_mask & (level)) \
- printf args
-#else
-#define WDCDEBUG_PRINT(args, level)
-#endif
-
-#if defined(WDCDEBUG) || defined(WDCDEBUG_PROBE)
-#define WDCDEBUG_PRINT_PROBE(args) if (wdcdebug_mask & DEBUG_PROBE) printf args
-#else
-#define WDCDEBUG_PRINT_PROBE(args)
-#endif