* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)hp.c 7.8 (Berkeley) %G%
+ * @(#)hp.c 7.11 (Berkeley) %G%
*/
#ifdef HPDEBUG
0, 0, 0, 0,
};
-struct buf rhpbuf[NHP];
struct disklabel hplabel[NHP];
struct dkbad hpbad[NHP];
return (0);
}
+/* ARGSUSED */
hpclose(dev, flags, fmt)
dev_t dev;
int flags, fmt;
* Set up dummy label with all that's needed.
*/
if (mi->mi_type == MBDT_ML11A || mi->mi_type == MBDT_ML11B) {
- register struct hpsoftc *sc = &hpsoftc[mi->mi_unit];
register int trt;
sc->sc_mlsize = hpaddr->hpmr & HPMR_SZ;
sc->sc_state = OPEN;
bp->b_flags = B_INVAL | B_AGE;
brelse(bp);
-done:
wakeup((caddr_t)sc);
return (error);
register int er1, er2;
struct hpsoftc *sc = &hpsoftc[mi->mi_unit];
int retry = 0;
- int npf;
- daddr_t bn;
- int bcr;
+ int npf, bcr;
bcr = MASKREG(-mi->mi_mba->mba_bcr);
if (bp->b_flags & B_FORMAT) {
if (hpaddr->hpds&HPDS_ERR || mbsr&MBSR_EBITS) {
er1 = hpaddr->hper1;
er2 = hpaddr->hper2;
- if (bp->b_flags & B_BAD) {
+ if (bp->b_flags & B_BAD)
npf = bp->b_error;
- bn = sc->sc_badbn;
- } else {
+ else {
npf = btodb(bp->b_bcount + (DEV_BSIZE - 1) - bcr);
if (er1 & (HPER1_DCK | HPER1_ECH))
npf--;
- bn = bp->b_blkno + npf;
}
if (HPWAIT(mi, hpaddr) == 0)
goto hard;
#ifdef HPDEBUG
if (hpdebug) {
int dc = hpaddr->hpdc, da = hpaddr->hpda;
+ daddr_t bn;
+ if (bp->b_flags & B_BAD)
+ bn = sc->sc_badbn;
+ else
+ bn = bp->b_blkno + npf;
log(LOG_DEBUG,
"hperr: bp %x cyl %d blk %d blkdone %d as %o dc %x da %x\n",
bp, bp->b_cylin, bn, sc->sc_blkdone,
hpunit(bp->b_dev));
bp->b_flags |= B_ERROR;
} else if (bp->b_flags & B_FORMAT) {
- goto hard;
+ bp->b_flags |= B_ERROR;
} else if (RM80(mi->mi_type) && er2&HPER2_SSE) {
(void) hpecc(mi, SSE);
return (MBD_RESTARTED);
er1 & HPER1_HARD ||
(!ML11(mi->mi_type) && (er2 & HPER2_HARD))) {
hard:
- bp->b_blkno = bn; /* XXX */
- harderr(bp, "hp");
+ diskerr(bp, "hp", "hard error", LOG_PRINTF, npf,
+ &hplabel[mi->mi_unit]);
+ if (bp->b_flags & B_BAD)
+ printf(" (on replacement sector %d)",
+ sc->sc_badbn);
if (mbsr & (MBSR_EBITS &~ (MBSR_DTABT|MBSR_MBEXC)))
- printf("mbsr=%b ", mbsr, mbsr_bits);
- printf("er1=%b er2=%b",
+ printf(" mbsr=%b", mbsr, mbsr_bits);
+ printf(" er1=%b er2=%b\n",
MASKREG(hpaddr->hper1), HPER1_BITS,
MASKREG(hpaddr->hper2), HPER2_BITS);
- if (bp->b_flags & B_FORMAT)
- printf(" (format i/o)");
- printf("\n");
bp->b_flags |= B_ERROR;
bp->b_flags &= ~B_BAD;
} else
(void)HPWAIT(mi, hpaddr);
mbclrattn(mi);
}
- if (mi->mi_tab.b_errcnt && (bp->b_flags & B_ERROR) == 0)
- log(LOG_INFO, "hp%d%c: %d retries %sing sn%d\n",
- hpunit(bp->b_dev), 'a'+(minor(bp->b_dev)&07),
- mi->mi_tab.b_errcnt,
- (bp->b_flags & B_READ) ? "read" : "writ",
- (bp->b_flags & B_BAD) ?
- sc->sc_badbn : bp->b_blkno + sc->sc_blkdone);
+ if (mi->mi_tab.b_errcnt && (bp->b_flags & B_ERROR) == 0) {
+ diskerr(bp, "hp", "retries", LOG_INFO, sc->sc_blkdone,
+ &hplabel[mi->mi_unit]);
+ addlog(": %d retries\n", mi->mi_tab.b_errcnt);
+ }
if ((bp->b_flags & B_BAD) && hpecc(mi, CONT))
return (MBD_RESTARTED);
sc->sc_blkdone = 0;
return (i);
}
-hpread(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
- register int unit = hpunit(dev);
-
- if (unit >= NHP)
- return (ENXIO);
- return (physio(hpstrategy, &rhpbuf[unit], dev, B_READ, minphys, uio));
-}
-
-hpwrite(dev, uio)
- dev_t dev;
- struct uio *uio;
-{
- register int unit = hpunit(dev);
-
- if (unit >= NHP)
- return (ENXIO);
- return (physio(hpstrategy, &rhpbuf[unit], dev, B_WRITE, minphys, uio));
-}
-
hpioctl(dev, cmd, data, flag)
dev_t dev;
int cmd;
int unit = hpunit(dev);
register struct disklabel *lp;
register struct hpsoftc *sc = &hpsoftc[unit];
- register struct format_op *fop;
int error = 0, wlab;
int hpformat();
case DIOCRFORMAT:
case DIOCWFORMAT:
{
+ register struct format_op *fop;
struct uio auio;
struct iovec aiov;
* out if we return nonzero. Callers must check the returned
* count.
*/
- (void) physio(hpformat, &rhpbuf[unit], dev,
+ (void) physio(hpformat, (struct buf *)NULL, dev,
(cmd == DIOCWFORMAT ? B_WRITE : B_READ), minphys, &auio);
fop->df_count -= auio.uio_resid;
fop->df_reg[0] = sc->sc_status;
hpformat(bp)
struct buf *bp;
{
-
bp->b_flags |= B_FORMAT;
- return (hpstrategy(bp));
+ hpstrategy(bp);
}
hpecc(mi, flag)
int bit, byte, mask;
npf--; /* because block in error is previous block */
- bn--;
+ diskerr(bp, "hp", "soft ecc", LOG_WARNING, npf, lp);
if (bp->b_flags & B_BAD)
- bn = sc->sc_badbn;
- log(LOG_WARNING, "hp%d%c: soft ecc sn%d\n", hpunit(bp->b_dev),
- 'a'+(minor(bp->b_dev)&07), bn);
+ addlog(" (on replacement sector %d)", sc->sc_badbn);
+ addlog("\n");
mask = MASKREG(rp->hpec2);
i = MASKREG(rp->hpec1) - 1; /* -1 makes 0 origin */
bit = i&07;