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.
This commit is contained in:
bouyer 1998-10-13 08:59:45 +00:00
parent 39c8c94fa5
commit da5d0a6f17
3 changed files with 25 additions and 12 deletions

View File

@ -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
@ -363,6 +363,17 @@ wdcattach(chp)
wdc_probe_caps(&chp->ch_drive[i]);
}
/*
* 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

View File

@ -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);

View File

@ -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;
}