* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * RP??/RM?? disk driver
- * with ECC handling and bad block forwarding.
- * Also supports header io operations and
- * commands to write check header and data.
+ * RP??/RM?? disk driver with ECC handling and bad block forwarding.
+ * Also supports header io operations and commands to write check
+ * header and data.
- HPOF_P400, HPOF_M400, HPOF_P400, HPOF_M400,
- HPOF_P800, HPOF_M800, HPOF_P800, HPOF_M800,
- HPOF_P1200, HPOF_M1200, HPOF_P1200, HPOF_M1200,
- 0, 0, 0, 0,
+ HPOF_P400, HPOF_M400, HPOF_P400, HPOF_M400,
+ HPOF_P800, HPOF_M800, HPOF_P800, HPOF_M800,
+ HPOF_P1200, HPOF_M1200, HPOF_P1200, HPOF_M1200,
+ 0, 0, 0, 0,
char debug;
# define HPF_BSEDEBUG 01 /* debugging bad sector forwarding */
# define HPF_ECCDEBUG 02 /* debugging ecc correction */
int ecclim;
int retries;
char debug;
# define HPF_BSEDEBUG 01 /* debugging bad sector forwarding */
# define HPF_ECCDEBUG 02 /* debugging ecc correction */
int ecclim;
int retries;
- * When awaiting command completion, don't
- * hang on to the status register since
- * this ties up some controllers.
+ * When awaiting command completion, don't hang on to the status register
+ * since this ties up some controllers.
- struct hpdevice *hpaddr = (struct hpdevice *)mbadrv(unit);
- register struct hp_softc *sc = &hp_softc[unit];
- register struct disklabel *lp = &hplabel[unit];
+ register struct hp_softc *sc;
+ register struct disklabel *lp;
+ struct hpdevice *hpaddr;
- if (mbainit(UNITTOMBA(unit)) == 0)
- return (ENXIO);
+ if ((u_int)io->i_adapt >= MAXNMBA || !mbainit(io->i_adapt))
+ return (EADAPT);
+ if ((u_int)io->i_ctlr)
+ return (ECTLR);
+ if ((u_int)unit >= MAXUNIT)
+ return (EUNIT);
+ hpaddr = (struct hpdevice *)mbadrv(io->i_adapt, unit);
+ sc = &hp_softc[io->i_adapt][unit];
+ lp = &hplabel[io->i_adapt][unit];
- if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
- printf("hp%d: unlabeled\n", unit);
-#if defined(COMPAT_42) /* && !defined(SMALL) */
- hpmaptype(hpaddr, hpaddr->hpdt & MBDT_TYPE,
- UNITTODRIVE(unit), lp);
-#else
- return (ENXIO);
-#endif
- } else
+ if (error == 0 && (dlp->d_magic != DISKMAGIC ||
+ dlp->d_magic2 != DISKMAGIC))
+ error = EUNLAB;
+ if (error == 0)
- if ((unsigned)io->i_boff >= lp->d_npartitions ||
- lp->d_partitions[io->i_boff].p_size == 0) {
- printf("hp bad minor\n");
- return (EUNIT);
- }
- io->i_boff = lp->d_partitions[io->i_boff].p_offset;
+ if (io->i_part >= lp->d_npartitions ||
+ lp->d_partitions[io->i_part].p_size == 0)
+ return (EPART);
+ io->i_boff = lp->d_partitions[io->i_part].p_offset;
- register unit = io->i_unit;
- struct mba_regs *mba = mbamba(unit);
+ register int unit = io->i_unit;
+ register struct hp_softc *sc;
+ register struct disklabel *lp;
+ struct mba_regs *mba;
+ struct hpdevice *hpaddr;
int cn, tn, sn, bytecnt, bytesleft, rv;
int cn, tn, sn, bytecnt, bytesleft, rv;
+ mba = mbamba(io->i_adapt);
+ hpaddr = (struct hpdevice *)mbadrv(io->i_adapt, unit);
+ sc = &hp_softc[io->i_adapt][unit];
+ lp = &hplabel[io->i_adapt][unit];
HPWAIT(hpaddr);
if (hpaddr->hpds & HPDS_ERR) {
printf("hp error: sn [%d-%d) ds=%b er1=%b\n",
HPWAIT(hpaddr);
if (hpaddr->hpds & HPDS_ERR) {
printf("hp error: sn [%d-%d) ds=%b er1=%b\n",
if (((er2 & HPER2_BSE) && !ML11(sc->type)) ||
(MASKREG(er1) == HPER1_FER && RP06(sc->type))) {
if (io->i_flgs & F_NBSF) {
if (((er2 & HPER2_BSE) && !ML11(sc->type)) ||
(MASKREG(er1) == HPER1_FER && RP06(sc->type))) {
if (io->i_flgs & F_NBSF) {
- register unit = io->i_unit;
- register struct mba_regs *mbp = mbamba(unit);
- register struct hpdevice *rp = (struct hpdevice *)mbadrv(unit);
- register struct hp_softc *sc = &hp_softc[unit];
- register struct disklabel *lp = &hplabel[unit];
+ register int unit = io->i_unit;
+ register struct mba_regs *mbp;
+ register struct hpdevice *rp;
+ register struct hp_softc *sc;
+ register struct disklabel *lp;
int npf, bn, cn, tn, sn, bcr;
int npf, bn, cn, tn, sn, bcr;
+ mbp = mbamba(io->i_adapt);
+ rp = (struct hpdevice *)mbadrv(io->i_adapt, unit);
+ sc = &hp_softc[io->i_adapt][unit];
+ lp = &hplabel[io->i_adapt][unit];
- if ((bbn = isbad(&hpbad[unit], cn, tn, sn)) < 0)
+ if ((bbn = isbad(&hpbad[io->i_adapt][unit], cn, tn, sn)) < 0)
- register struct hp_softc *sc = &hp_softc[unit];
- register struct disklabel *lp = &hplabel[unit];
- struct mba_drv *drv = mbadrv(unit);
+ register struct hp_softc *sc = &hp_softc[io->i_adapt][unit];
+ register struct disklabel *lp = &hplabel[io->i_adapt][unit];
+ struct mba_drv *drv = mbadrv(io->i_adapt, unit);