SCCS-vsn: sys/hp300/dev/sd.c 7.8
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)sd.c 7.7 (Berkeley) %G%
+ * @(#)sd.c 7.8 (Berkeley) %G%
+/*
+ * Return:
+ * 0 if not really an error
+ * <0 if we should do a retry
+ * >0 if a fatal error
+ */
static int
sderror(unit, sc, hp, stat)
int unit, stat;
register struct sd_softc *sc;
register struct hp_device *hp;
{
static int
sderror(unit, sc, hp, stat)
int unit, stat;
register struct sd_softc *sc;
register struct hp_device *hp;
{
sdsense[unit].status = stat;
if (stat & STS_CHECKCOND) {
sdsense[unit].status = stat;
if (stat & STS_CHECKCOND) {
printf(", key %d", sp->key);
if (sp->valid)
printf(", blk %d", *(int *)&sp->info1);
printf(", key %d", sp->key);
if (sp->valid)
printf(", blk %d", *(int *)&sp->info1);
- /* no sense or recovered error, try again */
- if (sp->key == 0 || sp->key == 1)
- retry = 1;
+ switch (sp->key) {
+ /* no sense, try again */
+ case 0:
+ cond = -1;
+ break;
+ /* recovered error, not a problem */
+ case 1:
+ cond = 0;
+ break;
+ }
register struct sd_softc *sc = &sd_softc[unit];
register struct buf *bp = sdtab[unit].b_actf;
register struct hp_device *hp = sc->sc_hd;
register struct sd_softc *sc = &sd_softc[unit];
register struct buf *bp = sdtab[unit].b_actf;
register struct hp_device *hp = sc->sc_hd;
if (bp == NULL) {
printf("sd%d: bp == NULL\n", unit);
if (bp == NULL) {
printf("sd%d: bp == NULL\n", unit);
printf("sd%d: sdintr: bad scsi status 0x%x\n",
unit, stat);
#endif
printf("sd%d: sdintr: bad scsi status 0x%x\n",
unit, stat);
#endif
- retry = sderror(unit, sc, hp, stat);
- if (retry && sdtab[unit].b_errcnt++ < SDRETRY) {
+ cond = sderror(unit, sc, hp, stat);
+ if (cond) {
+ if (cond < 0 && sdtab[unit].b_errcnt++ < SDRETRY) {
- if (sddebug & SDB_ERROR)
- printf("sd%d: retry #%d\n",
- unit, sdtab[unit].b_errcnt);
+ if (sddebug & SDB_ERROR)
+ printf("sd%d: retry #%d\n",
+ unit, sdtab[unit].b_errcnt);
- sdstart(unit);
- return;
+ sdstart(unit);
+ return;
+ }
+ bp->b_flags |= B_ERROR;
+ bp->b_error = EIO;
- bp->b_flags |= B_ERROR;
- bp->b_error = EIO;
}
sdfinish(unit, sc, bp);
}
}
sdfinish(unit, sc, bp);
}