summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/sparc/dev/xd.c60
-rw-r--r--sys/arch/sparc/dev/xy.c55
-rw-r--r--sys/arch/sparc/sparc/disksubr.c11
3 files changed, 63 insertions, 63 deletions
diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c
index 3bae1112c51..5fbed055bd5 100644
--- a/sys/arch/sparc/dev/xd.c
+++ b/sys/arch/sparc/dev/xd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xd.c,v 1.39 2007/06/20 18:16:24 deraadt Exp $ */
+/* $OpenBSD: xd.c,v 1.40 2007/06/24 16:52:04 miod Exp $ */
/* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */
/*
@@ -295,49 +295,51 @@ xdgetdisklabel(xd, b)
struct xd_softc *xd;
void *b;
{
+ struct disklabel *lp = xd->sc_dk.dk_label;
+ struct sun_disklabel *sdl = b;
char *err;
+ extern char *disklabel_sun_to_bsd(struct sun_disklabel *,
+ struct disklabel *);
+
+ bzero(lp, sizeof(struct disklabel));
+ if (sdl->sl_magic == SUN_DKMAGIC)
+ disklabel_sun_to_bsd(sdl, lp);
+ else {
+ /* Required parameters for readdisklabel() */
+ lp->d_secsize = XDFM_BPS;
+ lp->d_secpercyl = 1;
+ }
/* We already have the label data in `b'; setup for dummy strategy */
xd_labeldata = b;
- /* Required parameters for readdisklabel() */
- xd->sc_dk.dk_label->d_secsize = XDFM_BPS;
- xd->sc_dk.dk_label->d_secpercyl = 1;
-
err = readdisklabel(MAKEDISKDEV(0, xd->sc_dev.dv_unit, RAW_PART),
- xddummystrat,
- xd->sc_dk.dk_label, 0);
+ xddummystrat, lp, 0);
if (err) {
/*printf("%s: %s\n", xd->sc_dev.dv_xname, err);*/
- return(XD_ERR_FAIL);
+ return (XD_ERR_FAIL);
}
-#ifdef FIXME
- struct sun_disklabel *sdl;
-
/* Ok, we have the label; fill in `pcyl' if there's SunOS magic */
- sdl = (struct sun_disklabel *)xd->sc_dk.dk_cpulabel->cd_block;
+ sdl = b;
if (sdl->sl_magic == SUN_DKMAGIC)
xd->pcyl = sdl->sl_pcylinders;
else {
printf("%s: WARNING: no `pcyl' in disk label.\n",
- xd->sc_dev.dv_xname);
- xd->pcyl = xd->sc_dk.dk_label->d_ncylinders +
- xd->sc_dk.dk_label->d_acylinders;
+ xd->sc_dev.dv_xname);
+ xd->pcyl = lp->d_ncylinders +
+ lp->d_acylinders;
printf("%s: WARNING: guessing pcyl=%d (ncyl+acyl)\n",
- xd->sc_dev.dv_xname, xd->pcyl);
+ xd->sc_dev.dv_xname, xd->pcyl);
}
-#endif
- xd->ncyl = xd->sc_dk.dk_label->d_ncylinders;
- xd->acyl = xd->sc_dk.dk_label->d_acylinders;
- xd->nhead = xd->sc_dk.dk_label->d_ntracks;
- xd->nsect = xd->sc_dk.dk_label->d_nsectors;
- xd->sectpercyl = xd->sc_dk.dk_label->d_secpercyl =
- xd->nhead * xd->nsect;
- xd->sc_dk.dk_label->d_secsize = XDFM_BPS; /* not handled by
- * sun->bsd */
- return(XD_ERR_AOK);
+ xd->ncyl = lp->d_ncylinders;
+ xd->acyl = lp->d_acylinders;
+ xd->nhead = lp->d_ntracks;
+ xd->nsect = lp->d_nsectors;
+ xd->sectpercyl = lp->d_secpercyl = xd->nhead * xd->nsect;
+ lp->d_secsize = XDFM_BPS; /* not handled by sun->bsd */
+ return (XD_ERR_AOK);
}
/*
@@ -644,7 +646,7 @@ xdattach(parent, self, aux)
xd->nhead = 1;
xd->nsect = 1;
xd->sectpercyl = 1;
- for (lcv = 0; lcv < 126; lcv++) /* init empty bad144 table */
+ for (lcv = 0; lcv < NBT_BAD; lcv++) /* init empty bad144 table */
xd->dkb.bt_bad[lcv].bt_cyl = xd->dkb.bt_bad[lcv].bt_trksec = 0xffff;
rqno = xdc_cmd(xdc, XDCMD_WRP, XDFUN_DRV, xd->xd_drive, 0, 0, 0, fmode);
XDC_DONE(xdc, rqno, err);
@@ -707,7 +709,7 @@ xdattach(parent, self, aux)
/* check dkbad for sanity */
dkb = (struct dkbad *) xa->buf;
- for (lcv = 0; lcv < 126; lcv++) {
+ for (lcv = 0; lcv < NBT_BAD; lcv++) {
if ((dkb->bt_bad[lcv].bt_cyl == 0xffff ||
dkb->bt_bad[lcv].bt_cyl == 0) &&
dkb->bt_bad[lcv].bt_trksec == 0xffff)
@@ -719,7 +721,7 @@ xdattach(parent, self, aux)
if ((dkb->bt_bad[lcv].bt_trksec & 0xff) >= xd->nsect)
break;
}
- if (lcv != 126) {
+ if (lcv != NBT_BAD) {
printf("%s: warning: invalid bad144 sector!\n",
xd->sc_dev.dv_xname);
} else {
diff --git a/sys/arch/sparc/dev/xy.c b/sys/arch/sparc/dev/xy.c
index 93a210c86ef..b4bcbc204c0 100644
--- a/sys/arch/sparc/dev/xy.c
+++ b/sys/arch/sparc/dev/xy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xy.c,v 1.36 2007/06/20 18:16:24 deraadt Exp $ */
+/* $OpenBSD: xy.c,v 1.37 2007/06/24 16:52:04 miod Exp $ */
/* $NetBSD: xy.c,v 1.26 1997/07/19 21:43:56 pk Exp $ */
/*
@@ -235,48 +235,51 @@ xygetdisklabel(xy, b)
struct xy_softc *xy;
void *b;
{
+ struct disklabel *lp = xy->sc_dk.dk_label;
+ struct sun_disklabel *sdl = b;
char *err;
+ extern char *disklabel_sun_to_bsd(struct sun_disklabel *,
+ struct disklabel *);
+
+ bzero(lp, sizeof(struct disklabel));
+ if (sdl->sl_magic == SUN_DKMAGIC)
+ disklabel_sun_to_bsd(sdl, lp);
+ else {
+ /* Required parameters for readdisklabel() */
+ lp->d_secsize = XYFM_BPS;
+ lp->d_secpercyl = 1;
+ }
/* We already have the label data in `b'; setup for dummy strategy */
xy_labeldata = b;
- /* Required parameters for readdisklabel() */
- xy->sc_dk.dk_label->d_secsize = XYFM_BPS;
- xy->sc_dk.dk_label->d_secpercyl = 1;
-
err = readdisklabel(MAKEDISKDEV(0, xy->sc_dev.dv_unit, RAW_PART),
- xydummystrat, xy->sc_dk.dk_label, 0);
+ xydummystrat, lp, 0);
if (err) {
/*printf("%s: %s\n", xy->sc_dev.dv_xname, err);*/
- return(XY_ERR_FAIL);
+ return (XY_ERR_FAIL);
}
-#ifdef FIXME
- struct sun_disklabel *sdl;
-
/* Ok, we have the label; fill in `pcyl' if there's SunOS magic */
- sdl = (struct sun_disklabel *)xy->sc_dk.dk_cpulabel->cd_block;
+ sdl = b;
if (sdl->sl_magic == SUN_DKMAGIC)
xy->pcyl = sdl->sl_pcylinders;
else {
printf("%s: WARNING: no `pcyl' in disk label.\n",
xy->sc_dev.dv_xname);
- xy->pcyl = xy->sc_dk.dk_label->d_ncylinders +
- xy->sc_dk.dk_label->d_acylinders;
+ xy->pcyl = lp->d_ncylinders +
+ lp->d_acylinders;
printf("%s: WARNING: guessing pcyl=%d (ncyl+acyl)\n",
xy->sc_dev.dv_xname, xy->pcyl);
}
-#endif
- xy->ncyl = xy->sc_dk.dk_label->d_ncylinders;
- xy->acyl = xy->sc_dk.dk_label->d_acylinders;
- xy->nhead = xy->sc_dk.dk_label->d_ntracks;
- xy->nsect = xy->sc_dk.dk_label->d_nsectors;
- xy->sectpercyl = xy->sc_dk.dk_label->d_secpercyl =
- xy->nhead * xy->nsect;
- xy->sc_dk.dk_label->d_secsize = XYFM_BPS; /* not handled by
- * sun->bsd */
- return(XY_ERR_AOK);
+ xy->ncyl = lp->d_ncylinders;
+ xy->acyl = lp->d_acylinders;
+ xy->nhead = lp->d_ntracks;
+ xy->nsect = lp->d_nsectors;
+ xy->sectpercyl = lp->d_secpercyl = xy->nhead * xy->nsect;
+ lp->d_secsize = XYFM_BPS; /* not handled by sun->bsd */
+ return (XY_ERR_AOK);
}
/*
@@ -571,7 +574,7 @@ xyattach(parent, self, aux)
xy->nhead = 1;
xy->nsect = 1;
xy->sectpercyl = 1;
- for (lcv = 0; lcv < 126; lcv++) /* init empty bad144 table */
+ for (lcv = 0; lcv < NBT_BAD; lcv++) /* init empty bad144 table */
xy->dkb.bt_bad[lcv].bt_cyl =
xy->dkb.bt_bad[lcv].bt_trksec = 0xffff;
@@ -666,7 +669,7 @@ xyattach(parent, self, aux)
/* check dkbad for sanity */
dkb = (struct dkbad *) xa->buf;
- for (lcv = 0; lcv < 126; lcv++) {
+ for (lcv = 0; lcv < NBT_BAD; lcv++) {
if ((dkb->bt_bad[lcv].bt_cyl == 0xffff ||
dkb->bt_bad[lcv].bt_cyl == 0) &&
dkb->bt_bad[lcv].bt_trksec == 0xffff)
@@ -678,7 +681,7 @@ xyattach(parent, self, aux)
if ((dkb->bt_bad[lcv].bt_trksec & 0xff) >= xy->nsect)
break;
}
- if (lcv != 126) {
+ if (lcv != NBT_BAD) {
printf("%s: warning: invalid bad144 sector!\n",
xy->sc_dev.dv_xname);
} else {
diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c
index f94ea05b9c5..5d639e61a1e 100644
--- a/sys/arch/sparc/sparc/disksubr.c
+++ b/sys/arch/sparc/sparc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.68 2007/06/20 18:15:46 deraadt Exp $ */
+/* $OpenBSD: disksubr.c,v 1.69 2007/06/24 16:52:05 miod Exp $ */
/* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */
/*
@@ -46,7 +46,7 @@
#include "cd.h"
-static char *disklabel_sun_to_bsd(struct sun_disklabel *, struct disklabel *);
+ char *disklabel_sun_to_bsd(struct sun_disklabel *, struct disklabel *);
static int disklabel_bsd_to_sun(struct disklabel *, struct sun_disklabel *);
static __inline u_int sun_extended_sum(struct sun_disklabel *, void *);
@@ -112,11 +112,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *),
goto done;
}
-#if NOTANYMORE
- /* XXX because xd(4) & xy(4) still need it */
- bcopy(bp->b_data, osdep->cd_block, sizeof(osdep->cd_block));
-#endif
-
slp = (struct sun_disklabel *)bp->b_data;
if (slp->sl_magic == SUN_DKMAGIC) {
msg = disklabel_sun_to_bsd(slp, lp);
@@ -238,7 +233,7 @@ sun_extended_sum(struct sun_disklabel *sl, void *end)
*
* The BSD label is cleared out before this is called.
*/
-static char *
+char *
disklabel_sun_to_bsd(struct sun_disklabel *sl, struct disklabel *lp)
{
struct partition *npp;