diff options
-rw-r--r-- | sys/arch/hp300/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/arch/hp300/conf/files.hp300 | 12 | ||||
-rw-r--r-- | sys/arch/hp300/dev/hd.c (renamed from sys/arch/hp300/dev/rd.c) | 518 | ||||
-rw-r--r-- | sys/arch/hp300/dev/hd_compat.c | 293 | ||||
-rw-r--r-- | sys/arch/hp300/dev/hdreg.h (renamed from sys/arch/hp300/dev/rdreg.h) | 162 | ||||
-rw-r--r-- | sys/arch/hp300/dev/hdvar.h (renamed from sys/arch/hp300/dev/rdvar.h) | 62 | ||||
-rw-r--r-- | sys/arch/hp300/dev/rd_compat.c | 293 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/autoconf.c | 18 | ||||
-rw-r--r-- | sys/arch/hp300/hp300/conf.c | 12 |
9 files changed, 687 insertions, 687 deletions
diff --git a/sys/arch/hp300/conf/GENERIC b/sys/arch/hp300/conf/GENERIC index d44f37380d6..4cffd809a3a 100644 --- a/sys/arch/hp300/conf/GENERIC +++ b/sys/arch/hp300/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.12 1997/02/03 04:47:05 downsj Exp $ +# $OpenBSD: GENERIC,v 1.13 1997/02/03 08:11:52 downsj Exp $ # $NetBSD: GENERIC,v 1.23 1997/01/31 06:12:57 thorpej Exp $ # # Generic kernel - one size fits all. @@ -100,7 +100,7 @@ hpibbus0 at nhpib0 hpibbus* at nhpib? hpibbus* at fhpib? -rd* at hpibbus? slave ? punit ? # HP-IB disks +hd* at hpibbus? slave ? punit ? # HP-IB disks ct* at hpibbus? slave ? punit ? # HP-IB cartridge tapes mt* at hpibbus? slave ? punit ? # HP-IB 9-track tape ppi0 at hpibbus0 slave 5 punit 0 # HP-IB plotter diff --git a/sys/arch/hp300/conf/files.hp300 b/sys/arch/hp300/conf/files.hp300 index 8673bf16eb9..70618b0bc25 100644 --- a/sys/arch/hp300/conf/files.hp300 +++ b/sys/arch/hp300/conf/files.hp300 @@ -1,4 +1,4 @@ -# $OpenBSD: files.hp300,v 1.2 1997/02/03 04:47:08 downsj Exp $ +# $OpenBSD: files.hp300,v 1.3 1997/02/03 08:11:52 downsj Exp $ # $NetBSD: files.hp300,v 1.22 1997/01/30 22:11:19 scottr Exp $ # # hp300-specific configuration info @@ -119,11 +119,11 @@ attach mt at hpibbus file arch/hp300/dev/mt.c mt needs-flag major {mt = 1} -device rd: disk -attach rd at hpibbus -file arch/hp300/dev/rd.c rd needs-flag -file arch/hp300/dev/rd_compat.c rd # XXX -major {rd = 2} +device hd: disk +attach hd at hpibbus +file arch/hp300/dev/hd.c hd needs-flag +file arch/hp300/dev/hd_compat.c hd # XXX +major {hd = 2} device ppi attach ppi at hpibbus diff --git a/sys/arch/hp300/dev/rd.c b/sys/arch/hp300/dev/hd.c index 7af83b52b3d..ddf1bb6401d 100644 --- a/sys/arch/hp300/dev/rd.c +++ b/sys/arch/hp300/dev/hd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rd.c,v 1.8 1997/02/03 04:47:42 downsj Exp $ */ +/* $OpenBSD: hd.c,v 1.1 1997/02/03 08:11:54 downsj Exp $ */ /* $NetBSD: rd.c,v 1.27 1997/01/30 09:14:17 thorpej Exp $ */ /* @@ -61,8 +61,8 @@ #include <hp300/dev/hpibvar.h> -#include <hp300/dev/rdreg.h> -#include <hp300/dev/rdvar.h> +#include <hp300/dev/hdreg.h> +#include <hp300/dev/hdvar.h> #ifdef USELEDS #include <hp300/hp300/led.h> @@ -73,33 +73,33 @@ #include <vm/vm_prot.h> #include <vm/pmap.h> -int rdmatch __P((struct device *, void *, void *)); -void rdattach __P((struct device *, struct device *, void *)); +int hdmatch __P((struct device *, void *, void *)); +void hdattach __P((struct device *, struct device *, void *)); -struct cfattach rd_ca = { - sizeof(struct rd_softc), rdmatch, rdattach +struct cfattach hd_ca = { + sizeof(struct hd_softc), hdmatch, hdattach }; -struct cfdriver rd_cd = { - NULL, "rd", DV_DISK +struct cfdriver hd_cd = { + NULL, "hd", DV_DISK }; -int rdident __P((struct device *, struct rd_softc *, +int hdident __P((struct device *, struct hd_softc *, struct hpibbus_attach_args *)); -void rdreset __P((struct rd_softc *)); -void rdustart __P((struct rd_softc *)); -int rdgetinfo __P((dev_t)); -void rdrestart __P((void *)); -struct buf *rdfinish __P((struct rd_softc *, struct buf *)); +void hdreset __P((struct hd_softc *)); +void hdustart __P((struct hd_softc *)); +int hdgetinfo __P((dev_t)); +void hdrestart __P((void *)); +struct buf *hdfinish __P((struct hd_softc *, struct buf *)); -void rdstart __P((void *)); -void rdintr __P((void *)); -void rdgo __P((void *)); +void hdstart __P((void *)); +void hdintr __P((void *)); +void hdgo __P((void *)); -bdev_decl(rd); -cdev_decl(rd); +bdev_decl(hd); +cdev_decl(hd); -int rderrthresh = RDRETRY-1; /* when to start reporting errors */ +int hderrthresh = HDRETRY-1; /* when to start reporting errors */ #ifdef DEBUG /* error message tables */ @@ -169,81 +169,81 @@ char *err_info[] = { 0, 0 }; -int rddebug = 0x80; -#define RDB_FOLLOW 0x01 -#define RDB_STATUS 0x02 -#define RDB_IDENT 0x04 -#define RDB_IO 0x08 -#define RDB_ASYNC 0x10 -#define RDB_ERROR 0x80 +int hddebug = 0x80; +#define HDB_FOLLOW 0x01 +#define HDB_STATUS 0x02 +#define HDB_IDENT 0x04 +#define HDB_IO 0x08 +#define HDB_ASYNC 0x10 +#define HDB_ERROR 0x80 #endif /* * Misc. HW description, indexed by sc_type. * Nothing really critical here, could do without it. */ -struct rdidentinfo rdidentinfo[] = { - { RD7946AID, 0, "7945A", NRD7945ABPT, - NRD7945ATRK, 968, 108416 }, +struct hdidentinfo hdidentinfo[] = { + { HD7946AID, 0, "7945A", NHD7945ABPT, + NHD7945ATRK, 968, 108416 }, - { RD9134DID, 1, "9134D", NRD9134DBPT, - NRD9134DTRK, 303, 29088 }, + { HD9134DID, 1, "9134D", NHD9134DBPT, + NHD9134DTRK, 303, 29088 }, - { RD9134LID, 1, "9122S", NRD9122SBPT, - NRD9122STRK, 77, 1232 }, + { HD9134LID, 1, "9122S", NHD9122SBPT, + NHD9122STRK, 77, 1232 }, - { RD7912PID, 0, "7912P", NRD7912PBPT, - NRD7912PTRK, 572, 128128 }, + { HD7912PID, 0, "7912P", NHD7912PBPT, + NHD7912PTRK, 572, 128128 }, - { RD7914PID, 0, "7914P", NRD7914PBPT, - NRD7914PTRK, 1152, 258048 }, + { HD7914PID, 0, "7914P", NHD7914PBPT, + NHD7914PTRK, 1152, 258048 }, - { RD7958AID, 0, "7958A", NRD7958ABPT, - NRD7958ATRK, 1013, 255276 }, + { HD7958AID, 0, "7958A", NHD7958ABPT, + NHD7958ATRK, 1013, 255276 }, - { RD7957AID, 0, "7957A", NRD7957ABPT, - NRD7957ATRK, 1036, 159544 }, + { HD7957AID, 0, "7957A", NHD7957ABPT, + NHD7957ATRK, 1036, 159544 }, - { RD7933HID, 0, "7933H", NRD7933HBPT, - NRD7933HTRK, 1321, 789958 }, + { HD7933HID, 0, "7933H", NHD7933HBPT, + NHD7933HTRK, 1321, 789958 }, - { RD9134LID, 1, "9134L", NRD9134LBPT, - NRD9134LTRK, 973, 77840 }, + { HD9134LID, 1, "9134L", NHD9134LBPT, + NHD9134LTRK, 973, 77840 }, - { RD7936HID, 0, "7936H", NRD7936HBPT, - NRD7936HTRK, 698, 600978 }, + { HD7936HID, 0, "7936H", NHD7936HBPT, + NHD7936HTRK, 698, 600978 }, - { RD7937HID, 0, "7937H", NRD7937HBPT, - NRD7937HTRK, 698, 1116102 }, + { HD7937HID, 0, "7937H", NHD7937HBPT, + NHD7937HTRK, 698, 1116102 }, - { RD7914CTID, 0, "7914CT", NRD7914PBPT, - NRD7914PTRK, 1152, 258048 }, + { HD7914CTID, 0, "7914CT", NHD7914PBPT, + NHD7914PTRK, 1152, 258048 }, - { RD7946AID, 0, "7946A", NRD7945ABPT, - NRD7945ATRK, 968, 108416 }, + { HD7946AID, 0, "7946A", NHD7945ABPT, + NHD7945ATRK, 968, 108416 }, - { RD9134LID, 1, "9122D", NRD9122SBPT, - NRD9122STRK, 77, 1232 }, + { HD9134LID, 1, "9122D", NHD9122SBPT, + NHD9122STRK, 77, 1232 }, - { RD7957BID, 0, "7957B", NRD7957BBPT, - NRD7957BTRK, 1269, 159894 }, + { HD7957BID, 0, "7957B", NHD7957BBPT, + NHD7957BTRK, 1269, 159894 }, - { RD7958BID, 0, "7958B", NRD7958BBPT, - NRD7958BTRK, 786, 297108 }, + { HD7958BID, 0, "7958B", NHD7958BBPT, + NHD7958BTRK, 786, 297108 }, - { RD7959BID, 0, "7959B", NRD7959BBPT, - NRD7959BTRK, 1572, 594216 }, + { HD7959BID, 0, "7959B", NHD7959BBPT, + NHD7959BTRK, 1572, 594216 }, - { RD2200AID, 0, "2200A", NRD2200ABPT, - NRD2200ATRK, 1449, 654948 }, + { HD2200AID, 0, "2200A", NHD2200ABPT, + NHD2200ATRK, 1449, 654948 }, - { RD2203AID, 0, "2203A", NRD2203ABPT, - NRD2203ATRK, 1449, 1309896 } + { HD2203AID, 0, "2203A", NHD2203ABPT, + NHD2203ATRK, 1449, 1309896 } }; -int numrdidentinfo = sizeof(rdidentinfo) / sizeof(rdidentinfo[0]); +int numhdidentinfo = sizeof(hdidentinfo) / sizeof(hdidentinfo[0]); int -rdmatch(parent, match, aux) +hdmatch(parent, match, aux) struct device *parent; void *match, *aux; { @@ -258,7 +258,7 @@ rdmatch(parent, match, aux) cf->hpibbuscf_punit < HPIB_NPUNITS) ha->ha_punit = cf->hpibbuscf_punit; - if (rdident(parent, NULL, ha) == 0) { + if (hdident(parent, NULL, ha) == 0) { /* * XXX Some aging HP-IB drives are slow to * XXX respond; give them a chance to catch @@ -266,20 +266,20 @@ rdmatch(parent, match, aux) */ delay(10000); ha->ha_id = hpibid(parent->dv_unit, ha->ha_slave); - return (rdident(parent, NULL, ha)); + return (hdident(parent, NULL, ha)); } return (1); } void -rdattach(parent, self, aux) +hdattach(parent, self, aux) struct device *parent, *self; void *aux; { - struct rd_softc *sc = (struct rd_softc *)self; + struct hd_softc *sc = (struct hd_softc *)self; struct hpibbus_attach_args *ha = aux; - if (rdident(parent, sc, ha) == 0) { + if (hdident(parent, sc, ha) == 0) { printf("\n%s: didn't respond to describe command!\n", sc->sc_dev.dv_xname); return; @@ -298,28 +298,28 @@ rdattach(parent, self, aux) /* Initialize the hpib job queue entry */ sc->sc_hq.hq_softc = sc; sc->sc_hq.hq_slave = sc->sc_slave; - sc->sc_hq.hq_start = rdstart; - sc->sc_hq.hq_go = rdgo; - sc->sc_hq.hq_intr = rdintr; + sc->sc_hq.hq_start = hdstart; + sc->sc_hq.hq_go = hdgo; + sc->sc_hq.hq_intr = hdintr; - sc->sc_flags = RDF_ALIVE; + sc->sc_flags = HDF_ALIVE; #ifdef DEBUG /* always report errors */ - if (rddebug & RDB_ERROR) - rderrthresh = 0; + if (hddebug & HDB_ERROR) + hderrthresh = 0; #endif dk_establish(&sc->sc_dkdev, &sc->sc_dev); /* XXX */ } int -rdident(parent, sc, ha) +hdident(parent, sc, ha) struct device *parent; - struct rd_softc *sc; + struct hd_softc *sc; struct hpibbus_attach_args *ha; { - struct rd_softc rsc; - struct rd_describe *desc = sc != NULL ? &sc->sc_rddesc : NULL; + struct hd_softc rsc; + struct hd_describe *desc = sc != NULL ? &sc->sc_hddesc : NULL; u_char stat, cmd[3]; char name[7]; int i, id, n, ctlr, slave; @@ -332,10 +332,10 @@ rdident(parent, sc, ha) return (0); /* Is it one of the disks we support? */ - for (id = 0; id < numrdidentinfo; id++) - if (ha->ha_id == rdidentinfo[id].ri_hwid) + for (id = 0; id < numhdidentinfo; id++) + if (ha->ha_id == hdidentinfo[id].ri_hwid) break; - if (id == numrdidentinfo || ha->ha_punit > rdidentinfo[id].ri_maxunum) + if (id == numhdidentinfo || ha->ha_punit > hdidentinfo[id].ri_maxunum) return (0); /* @@ -348,7 +348,7 @@ rdident(parent, sc, ha) /* * Reset device and collect description */ - rdreset(sc); + hdreset(sc); cmd[0] = C_SUNIT(ha->ha_punit); cmd[1] = C_SVOL(0); cmd[2] = C_DESC; @@ -365,7 +365,7 @@ rdident(parent, sc, ha) } #ifdef DEBUG - if (rddebug & RDB_IDENT) { + if (hddebug & HDB_IDENT) { printf("\n%s: name: %x ('%s')\n", sc->sc_dev.dv_xname, desc->d_name, name); printf(" iuw %x, maxxfr %d, ctype %d\n", @@ -390,25 +390,25 @@ rdident(parent, sc, ha) * 3. 9122D and 9134L both return same HW id */ switch (ha->ha_id) { - case RD7946AID: + case HD7946AID: if (bcmp(name, "079450", 6) == 0) - id = RD7945A; + id = HD7945A; else - id = RD7946A; + id = HD7946A; break; - case RD9134LID: + case HD9134LID: if (bcmp(name, "091340", 6) == 0) - id = RD9134L; + id = HD9134L; else - id = RD9122D; + id = HD9122D; break; - case RD9134DID: + case HD9134DID: if (bcmp(name, "091220", 6) == 0) - id = RD9122S; + id = HD9122S; else - id = RD9134D; + id = HD9134D; break; } @@ -419,18 +419,18 @@ rdident(parent, sc, ha) * XXX off the driver because all of this code assumes 512 byte * XXX blocks. ICK! */ - printf(": %s\n", rdidentinfo[id].ri_desc); + printf(": %s\n", hdidentinfo[id].ri_desc); printf("%s: %d cylinders, %d heads, %d blocks, %d bytes/block\n", - sc->sc_dev.dv_xname, rdidentinfo[id].ri_ncyl, - rdidentinfo[id].ri_ntpc, rdidentinfo[id].ri_nblocks, + sc->sc_dev.dv_xname, hdidentinfo[id].ri_ncyl, + hdidentinfo[id].ri_ntpc, hdidentinfo[id].ri_nblocks, DEV_BSIZE); return (1); } void -rdreset(rs) - register struct rd_softc *rs; +hdreset(rs) + register struct hd_softc *rs; { int ctlr = rs->sc_dev.dv_parent->dv_unit; int slave = rs->sc_slave; @@ -442,7 +442,7 @@ rdreset(rs) hpibswait(ctlr, slave); hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat)); - rs->sc_src.c_unit = C_SUNIT(RDCTLR); + rs->sc_src.c_unit = C_SUNIT(HDCTLR); rs->sc_src.c_nop = C_NOP; rs->sc_src.c_cmd = C_SREL; rs->sc_src.c_param = C_REL; @@ -460,7 +460,7 @@ rdreset(rs) hpibswait(ctlr, slave); hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat)); #ifdef DEBUG - rs->sc_stats.rdresets++; + rs->sc_stats.hdresets++; #endif } @@ -468,11 +468,11 @@ rdreset(rs) * Read or constuct a disklabel */ int -rdgetinfo(dev) +hdgetinfo(dev) dev_t dev; { - int unit = rdunit(dev); - struct rd_softc *rs = rd_cd.cd_devs[unit]; + int unit = hdunit(dev); + struct hd_softc *rs = hd_cd.cd_devs[unit]; register struct disklabel *lp = rs->sc_dkdev.dk_label; register struct partition *pi; char *msg, *readdisklabel(); @@ -495,7 +495,7 @@ rdgetinfo(dev) /* * Now try to read the disklabel */ - msg = readdisklabel(rdlabdev(dev), rdstrategy, lp, NULL); + msg = readdisklabel(hdlabdev(dev), hdstrategy, lp, NULL); if (msg == NULL) return(0); @@ -503,10 +503,10 @@ rdgetinfo(dev) printf("%s: WARNING: %s, ", rs->sc_dev.dv_xname, msg); #ifdef COMPAT_NOLABEL printf("using old default partitioning\n"); - rdmakedisklabel(unit, lp); + hdmakedisklabel(unit, lp); #else printf("defining `c' partition as entire disk\n"); - pi[2].p_size = rdidentinfo[rs->sc_type].ri_nblocks; + pi[2].p_size = hdidentinfo[rs->sc_type].ri_nblocks; /* XXX reset other info since readdisklabel screws with it */ lp->d_npartitions = 3; pi[0].p_size = 0; @@ -515,24 +515,24 @@ rdgetinfo(dev) } int -rdopen(dev, flags, mode, p) +hdopen(dev, flags, mode, p) dev_t dev; int flags, mode; struct proc *p; { - register int unit = rdunit(dev); - register struct rd_softc *rs; + register int unit = hdunit(dev); + register struct hd_softc *rs; int error, mask, part; - if (unit >= rd_cd.cd_ndevs || - (rs = rd_cd.cd_devs[unit]) == NULL || - (rs->sc_flags & RDF_ALIVE) == 0) + if (unit >= hd_cd.cd_ndevs || + (rs = hd_cd.cd_devs[unit]) == NULL || + (rs->sc_flags & HDF_ALIVE) == 0) return (ENXIO); /* * Wait for any pending opens/closes to complete */ - while (rs->sc_flags & (RDF_OPENING|RDF_CLOSING)) + while (rs->sc_flags & (HDF_OPENING|HDF_CLOSING)) sleep((caddr_t)rs, PRIBIO); /* @@ -541,15 +541,15 @@ rdopen(dev, flags, mode, p) * to stop any other opens. */ if (rs->sc_dkdev.dk_openmask == 0) { - rs->sc_flags |= RDF_OPENING; - error = rdgetinfo(dev); - rs->sc_flags &= ~RDF_OPENING; + rs->sc_flags |= HDF_OPENING; + error = hdgetinfo(dev); + rs->sc_flags &= ~HDF_OPENING; wakeup((caddr_t)rs); if (error) return(error); } - part = rdpart(dev); + part = hdpart(dev); mask = 1 << part; /* Check that the partition exists. */ @@ -574,17 +574,17 @@ rdopen(dev, flags, mode, p) } int -rdclose(dev, flag, mode, p) +hdclose(dev, flag, mode, p) dev_t dev; int flag, mode; struct proc *p; { - int unit = rdunit(dev); - struct rd_softc *rs = rd_cd.cd_devs[unit]; + int unit = hdunit(dev); + struct hd_softc *rs = hd_cd.cd_devs[unit]; register struct disk *dk = &rs->sc_dkdev; int mask, s; - mask = 1 << rdpart(dev); + mask = 1 << hdpart(dev); if (mode == S_IFCHR) dk->dk_copenmask &= ~mask; else @@ -598,25 +598,25 @@ rdclose(dev, flag, mode, p) * we are the last one. */ if (dk->dk_openmask == 0) { - rs->sc_flags |= RDF_CLOSING; + rs->sc_flags |= HDF_CLOSING; s = splbio(); while (rs->sc_tab.b_active) { - rs->sc_flags |= RDF_WANTED; + rs->sc_flags |= HDF_WANTED; sleep((caddr_t)&rs->sc_tab, PRIBIO); } splx(s); - rs->sc_flags &= ~(RDF_CLOSING|RDF_WLABEL); + rs->sc_flags &= ~(HDF_CLOSING|HDF_WLABEL); wakeup((caddr_t)rs); } return(0); } void -rdstrategy(bp) +hdstrategy(bp) register struct buf *bp; { - int unit = rdunit(bp->b_dev); - struct rd_softc *rs = rd_cd.cd_devs[unit]; + int unit = hdunit(bp->b_dev); + struct hd_softc *rs = hd_cd.cd_devs[unit]; register struct buf *dp = &rs->sc_tab; register struct partition *pinfo; register daddr_t bn; @@ -624,19 +624,19 @@ rdstrategy(bp) int offset; #ifdef DEBUG - if (rddebug & RDB_FOLLOW) - printf("rdstrategy(%x): dev %x, bn %x, bcount %x, %c\n", + if (hddebug & HDB_FOLLOW) + printf("hdstrategy(%x): dev %x, bn %x, bcount %x, %c\n", bp, bp->b_dev, bp->b_blkno, bp->b_bcount, (bp->b_flags & B_READ) ? 'R' : 'W'); #endif bn = bp->b_blkno; sz = howmany(bp->b_bcount, DEV_BSIZE); - pinfo = &rs->sc_dkdev.dk_label->d_partitions[rdpart(bp->b_dev)]; + pinfo = &rs->sc_dkdev.dk_label->d_partitions[hdpart(bp->b_dev)]; /* Don't perform partition translation on RAW_PART. */ - offset = (rdpart(bp->b_dev) == RAW_PART) ? 0 : pinfo->p_offset; + offset = (hdpart(bp->b_dev) == RAW_PART) ? 0 : pinfo->p_offset; - if (rdpart(bp->b_dev) != RAW_PART) { + if (hdpart(bp->b_dev) != RAW_PART) { /* * XXX This block of code belongs in * XXX bounds_check_with_label() @@ -661,7 +661,7 @@ rdstrategy(bp) #if LABELSECTOR != 0 bn + offset + sz > LABELSECTOR && #endif - !(bp->b_flags & B_READ) && !(rs->sc_flags & RDF_WLABEL)) { + !(bp->b_flags & B_READ) && !(rs->sc_flags & HDF_WLABEL)) { bp->b_error = EROFS; goto bad; } @@ -671,7 +671,7 @@ rdstrategy(bp) disksort(dp, bp); if (dp->b_active == 0) { dp->b_active = 1; - rdustart(rs); + hdustart(rs); } splx(s); return; @@ -685,17 +685,17 @@ done: * Called from timeout() when handling maintenance releases */ void -rdrestart(arg) +hdrestart(arg) void *arg; { int s = splbio(); - rdustart((struct rd_softc *)arg); + hdustart((struct hd_softc *)arg); splx(s); } void -rdustart(rs) - struct rd_softc *rs; +hdustart(rs) + struct hd_softc *rs; { register struct buf *bp; @@ -703,12 +703,12 @@ rdustart(rs) rs->sc_addr = bp->b_un.b_addr; rs->sc_resid = bp->b_bcount; if (hpibreq(rs->sc_dev.dv_parent, &rs->sc_hq)) - rdstart(rs); + hdstart(rs); } struct buf * -rdfinish(rs, bp) - register struct rd_softc *rs; +hdfinish(rs, bp) + register struct hd_softc *rs; register struct buf *bp; { register struct buf *dp = &rs->sc_tab; @@ -721,18 +721,18 @@ rdfinish(rs, bp) if (dp->b_actf) return (dp->b_actf); dp->b_active = 0; - if (rs->sc_flags & RDF_WANTED) { - rs->sc_flags &= ~RDF_WANTED; + if (rs->sc_flags & HDF_WANTED) { + rs->sc_flags &= ~HDF_WANTED; wakeup((caddr_t)dp); } return (NULL); } void -rdstart(arg) +hdstart(arg) void *arg; { - struct rd_softc *rs = arg; + struct hd_softc *rs = arg; register struct buf *bp = rs->sc_tab.b_actf; register int part, ctlr, slave; @@ -741,24 +741,24 @@ rdstart(arg) again: #ifdef DEBUG - if (rddebug & RDB_FOLLOW) - printf("rdstart(%s): bp %x, %c\n", sc->sc_dev.dv_xname, bp, + if (hddebug & HDB_FOLLOW) + printf("hdstart(%s): bp %x, %c\n", sc->sc_dev.dv_xname, bp, (bp->b_flags & B_READ) ? 'R' : 'W'); #endif - part = rdpart(bp->b_dev); - rs->sc_flags |= RDF_SEEK; + part = hdpart(bp->b_dev); + rs->sc_flags |= HDF_SEEK; rs->sc_ioc.c_unit = C_SUNIT(rs->sc_punit); rs->sc_ioc.c_volume = C_SVOL(0); rs->sc_ioc.c_saddr = C_SADDR; rs->sc_ioc.c_hiaddr = 0; - rs->sc_ioc.c_addr = RDBTOS(bp->b_cylin); + rs->sc_ioc.c_addr = HDBTOS(bp->b_cylin); rs->sc_ioc.c_nop2 = C_NOP; rs->sc_ioc.c_slen = C_SLEN; rs->sc_ioc.c_len = rs->sc_resid; rs->sc_ioc.c_cmd = bp->b_flags & B_READ ? C_READ : C_WRITE; #ifdef DEBUG - if (rddebug & RDB_IO) - printf("rdstart: hpibsend(%x, %x, %x, %x, %x)\n", + if (hddebug & HDB_IO) + printf("hdstart: hpibsend(%x, %x, %x, %x, %x)\n", ctlr, slave, C_CMD, &rs->sc_ioc.c_unit, sizeof(rs->sc_ioc)-2); #endif @@ -770,8 +770,8 @@ again: rs->sc_dkdev.dk_seek++; #ifdef DEBUG - if (rddebug & RDB_IO) - printf("rdstart: hpibawait(%x)\n", ctlr); + if (hddebug & HDB_IO) + printf("hdstart: hpibawait(%x)\n", ctlr); #endif hpibawait(ctlr); return; @@ -780,25 +780,25 @@ again: * Experience has shown that the hpibwait in this hpibsend will * occasionally timeout. It appears to occur mostly on old 7914 * drives with full maintenance tracks. We should probably - * integrate this with the backoff code in rderror. + * integrate this with the backoff code in hderror. */ #ifdef DEBUG - if (rddebug & RDB_ERROR) - printf("%s: rdstart: cmd %x adr %d blk %d len %d ecnt %d\n", + if (hddebug & HDB_ERROR) + printf("%s: hdstart: cmd %x adr %d blk %d len %d ecnt %d\n", rs->sc_dev.dv_xname, rs->sc_ioc.c_cmd, rs->sc_ioc.c_addr, bp->b_blkno, rs->sc_resid, rs->sc_tab.b_errcnt); - rs->sc_stats.rdretries++; + rs->sc_stats.hdretries++; #endif - rs->sc_flags &= ~RDF_SEEK; - rdreset(rs); - if (rs->sc_tab.b_errcnt++ < RDRETRY) + rs->sc_flags &= ~HDF_SEEK; + hdreset(rs); + if (rs->sc_tab.b_errcnt++ < HDRETRY) goto again; - printf("%s: rdstart err: cmd 0x%x sect %d blk %d len %d\n", + printf("%s: hdstart err: cmd 0x%x sect %d blk %d len %d\n", rs->sc_dev.dv_xname, rs->sc_ioc.c_cmd, rs->sc_ioc.c_addr, bp->b_blkno, rs->sc_resid); bp->b_flags |= B_ERROR; bp->b_error = EIO; - bp = rdfinish(rs, bp); + bp = hdfinish(rs, bp); if (bp) { rs->sc_addr = bp->b_un.b_addr; rs->sc_resid = bp->b_bcount; @@ -808,10 +808,10 @@ again: } void -rdgo(arg) +hdgo(arg) void *arg; { - struct rd_softc *rs = arg; + struct hd_softc *rs = arg; struct buf *bp = rs->sc_tab.b_actf; int rw, ctlr, slave; @@ -832,10 +832,10 @@ rdgo(arg) /* ARGSUSED */ void -rdintr(arg) +hdintr(arg) void *arg; { - register struct rd_softc *rs = arg; + register struct hd_softc *rs = arg; int unit = rs->sc_dev.dv_unit; register struct buf *bp = rs->sc_tab.b_actf; u_char stat = 13; /* in case hpibrecv fails */ @@ -845,8 +845,8 @@ rdintr(arg) slave = rs->sc_slave; #ifdef DEBUG - if (rddebug & RDB_FOLLOW) - printf("rdintr(%d): bp %x, %c, flags %x\n", unit, bp, + if (hddebug & HDB_FOLLOW) + printf("hdintr(%d): bp %x, %c, flags %x\n", unit, bp, (bp->b_flags & B_READ) ? 'R' : 'W', rs->sc_flags); if (bp == NULL) { printf("%s: bp == NULL\n", rs->sc_dev.dv_xname); @@ -855,54 +855,54 @@ rdintr(arg) #endif disk_unbusy(&rs->sc_dkdev, (bp->b_bcount - bp->b_resid)); - if (rs->sc_flags & RDF_SEEK) { - rs->sc_flags &= ~RDF_SEEK; + if (rs->sc_flags & HDF_SEEK) { + rs->sc_flags &= ~HDF_SEEK; if (hpibustart(ctlr)) - rdgo(rs); + hdgo(rs); return; } - if ((rs->sc_flags & RDF_SWAIT) == 0) { + if ((rs->sc_flags & HDF_SWAIT) == 0) { #ifdef DEBUG - rs->sc_stats.rdpolltries++; + rs->sc_stats.hdpolltries++; #endif if (hpibpptest(ctlr, slave) == 0) { #ifdef DEBUG - rs->sc_stats.rdpollwaits++; + rs->sc_stats.hdpollwaits++; #endif /* Instrumentation. */ disk_busy(&rs->sc_dkdev); - rs->sc_flags |= RDF_SWAIT; + rs->sc_flags |= HDF_SWAIT; hpibawait(ctlr); return; } } else - rs->sc_flags &= ~RDF_SWAIT; + rs->sc_flags &= ~HDF_SWAIT; rv = hpibrecv(ctlr, slave, C_QSTAT, &stat, 1); if (rv != 1 || stat) { #ifdef DEBUG - if (rddebug & RDB_ERROR) - printf("rdintr: recv failed or bad stat %d\n", stat); + if (hddebug & HDB_ERROR) + printf("hdintr: recv failed or bad stat %d\n", stat); #endif - restart = rderror(unit); + restart = hderror(unit); #ifdef DEBUG - rs->sc_stats.rdretries++; + rs->sc_stats.hdretries++; #endif - if (rs->sc_tab.b_errcnt++ < RDRETRY) { + if (rs->sc_tab.b_errcnt++ < HDRETRY) { if (restart) - rdstart(rs); + hdstart(rs); return; } bp->b_flags |= B_ERROR; bp->b_error = EIO; } - if (rdfinish(rs, bp)) - rdustart(rs); + if (hdfinish(rs, bp)) + hdustart(rs); } int -rdstatus(rs) - register struct rd_softc *rs; +hdstatus(rs) + register struct hd_softc *rs; { register int c, s; u_char stat; @@ -918,8 +918,8 @@ rdstatus(rs) rv = hpibsend(c, s, C_CMD, &rs->sc_rsc, sizeof(rs->sc_rsc)); if (rv != sizeof(rs->sc_rsc)) { #ifdef DEBUG - if (rddebug & RDB_STATUS) - printf("rdstatus: send C_CMD failed %d != %d\n", + if (hddebug & HDB_STATUS) + printf("hdstatus: send C_CMD failed %d != %d\n", rv, sizeof(rs->sc_rsc)); #endif return(1); @@ -927,8 +927,8 @@ rdstatus(rs) rv = hpibrecv(c, s, C_EXEC, &rs->sc_stat, sizeof(rs->sc_stat)); if (rv != sizeof(rs->sc_stat)) { #ifdef DEBUG - if (rddebug & RDB_STATUS) - printf("rdstatus: send C_EXEC failed %d != %d\n", + if (hddebug & HDB_STATUS) + printf("hdstatus: send C_EXEC failed %d != %d\n", rv, sizeof(rs->sc_stat)); #endif return(1); @@ -936,8 +936,8 @@ rdstatus(rs) rv = hpibrecv(c, s, C_QSTAT, &stat, 1); if (rv != 1 || stat) { #ifdef DEBUG - if (rddebug & RDB_STATUS) - printf("rdstatus: recv failed %d or bad stat %d\n", + if (hddebug & HDB_STATUS) + printf("hdstatus: recv failed %d or bad stat %d\n", rv, stat); #endif return(1); @@ -951,45 +951,45 @@ rdstatus(rs) * 0 if we should just quietly give up. */ int -rderror(unit) +hderror(unit) int unit; { - struct rd_softc *rs = rd_cd.cd_devs[unit]; - register struct rd_stat *sp; + struct hd_softc *rs = hd_cd.cd_devs[unit]; + register struct hd_stat *sp; struct buf *bp; daddr_t hwbn, pbn; - if (rdstatus(rs)) { + if (hdstatus(rs)) { #ifdef DEBUG printf("%s: couldn't get status\n", rs->sc_dev.dv_xname); #endif - rdreset(rs); + hdreset(rs); return(1); } sp = &rs->sc_stat; if (sp->c_fef & FEF_REXMT) return(1); if (sp->c_fef & FEF_PF) { - rdreset(rs); + hdreset(rs); return(1); } /* * Unit requests release for internal maintenance. * We just delay awhile and try again later. Use expontially * increasing backoff ala ethernet drivers since we don't really - * know how long the maintenance will take. With RDWAITC and - * RDRETRY as defined, the range is 1 to 32 seconds. + * know how long the maintenance will take. With HDWAITC and + * HDRETRY as defined, the range is 1 to 32 seconds. */ if (sp->c_fef & FEF_IMR) { extern int hz; - int rdtimo = RDWAITC << rs->sc_tab.b_errcnt; + int hdtimo = HDWAITC << rs->sc_tab.b_errcnt; #ifdef DEBUG printf("%s: internal maintenance, %d second timeout\n", - rs->sc_dev.dv_xname, rdtimo); - rs->sc_stats.rdtimeouts++; + rs->sc_dev.dv_xname, hdtimo); + rs->sc_stats.hdtimeouts++; #endif hpibfree(rs->sc_dev.dv_parent, &rs->sc_hq); - timeout(rdrestart, rs, rdtimo * hz); + timeout(hdrestart, rs, hdtimo * hz); return(0); } /* @@ -997,7 +997,7 @@ rderror(unit) * threshhold. By default, this will only report after the * retry limit has been exceeded. */ - if (rs->sc_tab.b_errcnt < rderrthresh) + if (rs->sc_tab.b_errcnt < hderrthresh) return(1); /* @@ -1006,14 +1006,14 @@ rderror(unit) * we just use b_blkno. */ bp = rs->sc_tab.b_actf; - pbn = rs->sc_dkdev.dk_label->d_partitions[rdpart(bp->b_dev)].p_offset; + pbn = rs->sc_dkdev.dk_label->d_partitions[hdpart(bp->b_dev)].p_offset; if ((sp->c_fef & FEF_CU) || (sp->c_fef & FEF_DR) || (sp->c_ief & IEF_RRMASK)) { - hwbn = RDBTOS(pbn + bp->b_blkno); + hwbn = HDBTOS(pbn + bp->b_blkno); pbn = bp->b_blkno; } else { hwbn = sp->c_blk; - pbn = RDSTOB(hwbn) - pbn; + pbn = HDSTOB(hwbn) - pbn; } /* * Now output a generic message suitable for badsect. @@ -1022,7 +1022,7 @@ rderror(unit) * of the transfer, not necessary where the error occured. */ printf("%s%c: hard error sn%d\n", rs->sc_dev.dv_xname, - 'a'+rdpart(bp->b_dev), pbn); + 'a'+hdpart(bp->b_dev), pbn); /* * Now report the status as returned by the hardware with * attempt at interpretation (unless debugging). @@ -1030,14 +1030,14 @@ rderror(unit) printf("%s %s error:", rs->sc_dev.dv_xname, (bp->b_flags & B_READ) ? "read" : "write"); #ifdef DEBUG - if (rddebug & RDB_ERROR) { + if (hddebug & HDB_ERROR) { /* status info */ printf("\n volume: %d, unit: %d\n", (sp->c_vu>>4)&0xF, sp->c_vu&0xF); - rdprinterr("reject", sp->c_ref, err_reject); - rdprinterr("fault", sp->c_fef, err_fault); - rdprinterr("access", sp->c_aef, err_access); - rdprinterr("info", sp->c_ief, err_info); + hdprinterr("reject", sp->c_ref, err_reject); + hdprinterr("fault", sp->c_fef, err_fault); + hdprinterr("access", sp->c_aef, err_access); + hdprinterr("info", sp->c_ief, err_info); printf(" block: %d, P1-P10: ", hwbn); printf("%s", hexstr(*(u_int *)&sp->c_raw[0], 8)); printf("%s", hexstr(*(u_int *)&sp->c_raw[4], 8)); @@ -1064,35 +1064,35 @@ rderror(unit) } int -rdread(dev, uio, flags) +hdread(dev, uio, flags) dev_t dev; struct uio *uio; int flags; { - return (physio(rdstrategy, NULL, dev, B_READ, minphys, uio)); + return (physio(hdstrategy, NULL, dev, B_READ, minphys, uio)); } int -rdwrite(dev, uio, flags) +hdwrite(dev, uio, flags) dev_t dev; struct uio *uio; int flags; { - return (physio(rdstrategy, NULL, dev, B_WRITE, minphys, uio)); + return (physio(hdstrategy, NULL, dev, B_WRITE, minphys, uio)); } int -rdioctl(dev, cmd, data, flag, p) +hdioctl(dev, cmd, data, flag, p) dev_t dev; u_long cmd; caddr_t data; int flag; struct proc *p; { - int unit = rdunit(dev); - struct rd_softc *sc = rd_cd.cd_devs[unit]; + int unit = hdunit(dev); + struct hd_softc *sc = hd_cd.cd_devs[unit]; register struct disklabel *lp = sc->sc_dkdev.dk_label; int error, flags; @@ -1104,23 +1104,23 @@ rdioctl(dev, cmd, data, flag, p) case DIOCGPART: ((struct partinfo *)data)->disklab = lp; ((struct partinfo *)data)->part = - &lp->d_partitions[rdpart(dev)]; + &lp->d_partitions[hdpart(dev)]; return (0); case DIOCWLABEL: if ((flag & FWRITE) == 0) return (EBADF); if (*(int *)data) - sc->sc_flags |= RDF_WLABEL; + sc->sc_flags |= HDF_WLABEL; else - sc->sc_flags &= ~RDF_WLABEL; + sc->sc_flags &= ~HDF_WLABEL; return (0); case DIOCSDINFO: if ((flag & FWRITE) == 0) return (EBADF); return (setdisklabel(lp, (struct disklabel *)data, - (sc->sc_flags & RDF_WLABEL) ? 0 + (sc->sc_flags & HDF_WLABEL) ? 0 : sc->sc_dkdev.dk_openmask, (struct cpu_disklabel *)0)); @@ -1128,14 +1128,14 @@ rdioctl(dev, cmd, data, flag, p) if ((flag & FWRITE) == 0) return (EBADF); error = setdisklabel(lp, (struct disklabel *)data, - (sc->sc_flags & RDF_WLABEL) ? 0 + (sc->sc_flags & HDF_WLABEL) ? 0 : sc->sc_dkdev.dk_openmask, (struct cpu_disklabel *)0); if (error) return (error); flags = sc->sc_flags; - sc->sc_flags = RDF_ALIVE | RDF_WLABEL; - error = writedisklabel(rdlabdev(dev), rdstrategy, lp, + sc->sc_flags = HDF_ALIVE | HDF_WLABEL; + error = writedisklabel(hdlabdev(dev), hdstrategy, lp, (struct cpu_disklabel *)0); sc->sc_flags = flags; return (error); @@ -1144,16 +1144,16 @@ rdioctl(dev, cmd, data, flag, p) } int -rdsize(dev) +hdsize(dev) dev_t dev; { - register int unit = rdunit(dev); - struct rd_softc *rs; + register int unit = hdunit(dev); + struct hd_softc *rs; int psize, didopen = 0; - if (unit >= rd_cd.cd_ndevs || - (rs = rd_cd.cd_devs[unit]) == NULL || - (rs->sc_flags & RDF_ALIVE) == 0) + if (unit >= hd_cd.cd_ndevs || + (rs = hd_cd.cd_devs[unit]) == NULL || + (rs->sc_flags & HDF_ALIVE) == 0) return (-1); /* @@ -1162,18 +1162,18 @@ rdsize(dev) * to handle it here. */ if (rs->sc_dkdev.dk_openmask == 0) { - if (rdopen(dev, FREAD|FWRITE, S_IFBLK, NULL)) + if (hdopen(dev, FREAD|FWRITE, S_IFBLK, NULL)) return(-1); didopen = 1; } - psize = rs->sc_dkdev.dk_label->d_partitions[rdpart(dev)].p_size; + psize = rs->sc_dkdev.dk_label->d_partitions[hdpart(dev)].p_size; if (didopen) - (void) rdclose(dev, FREAD|FWRITE, S_IFBLK, NULL); + (void) hdclose(dev, FREAD|FWRITE, S_IFBLK, NULL); return (psize); } #ifdef DEBUG -rdprinterr(str, err, tab) +hdprinterr(str, err, tab) char *str; short err; char *tab[]; @@ -1192,13 +1192,13 @@ rdprinterr(str, err, tab) } #endif -static int rddoingadump; /* simple mutex */ +static int hddoingadump; /* simple mutex */ /* * Non-interrupt driven, non-dma dump routine. */ int -rddump(dev, blkno, va, size) +hddump(dev, blkno, va, size) dev_t dev; daddr_t blkno; caddr_t va; @@ -1211,23 +1211,23 @@ rddump(dev, blkno, va, size) int nwrt; /* current number of sectors to write */ int unit, part; int ctlr, slave; - struct rd_softc *rs; + struct hd_softc *rs; struct disklabel *lp; char stat; /* Check for recursive dump; if so, punt. */ - if (rddoingadump) + if (hddoingadump) return (EFAULT); - rddoingadump = 1; + hddoingadump = 1; /* Decompose unit and partition. */ - unit = rdunit(dev); - part = rdpart(dev); + unit = hdunit(dev); + part = hdpart(dev); /* Make sure dump device is ok. */ - if (unit >= rd_cd.cd_ndevs || - (rs = rd_cd.cd_devs[unit]) == NULL || - (rs->sc_flags & RDF_ALIVE) == 0) + if (unit >= hd_cd.cd_ndevs || + (rs = hd_cd.cd_devs[unit]) == NULL || + (rs->sc_flags & HDF_ALIVE) == 0) return (ENXIO); ctlr = rs->sc_dev.dv_parent->dv_unit; @@ -1255,7 +1255,7 @@ rddump(dev, blkno, va, size) while (totwrt > 0) { nwrt = totwrt; /* XXX */ -#ifndef RD_DUMP_NOT_TRUSTED +#ifndef HD_DUMP_NOT_TRUSTED /* * Fill out and send HPIB command. */ @@ -1263,7 +1263,7 @@ rddump(dev, blkno, va, size) rs->sc_ioc.c_volume = C_SVOL(0); rs->sc_ioc.c_saddr = C_SADDR; rs->sc_ioc.c_hiaddr = 0; - rs->sc_ioc.c_addr = RDBTOS(blkno); + rs->sc_ioc.c_addr = HDBTOS(blkno); rs->sc_ioc.c_nop2 = C_NOP; rs->sc_ioc.c_slen = C_SLEN; rs->sc_ioc.c_len = nwrt * sectorsize; @@ -1281,18 +1281,18 @@ rddump(dev, blkno, va, size) hpibrecv(ctlr, slave, C_QSTAT, &stat, 1); if (stat) return (EIO); -#else /* RD_DUMP_NOT_TRUSTED */ +#else /* HD_DUMP_NOT_TRUSTED */ /* Let's just talk about this first... */ printf("%s: dump addr %p, blk %d\n", sc->sc_dev.dv_xname, va, blkno); delay(500 * 1000); /* half a second */ -#endif /* RD_DUMP_NOT_TRUSTED */ +#endif /* HD_DUMP_NOT_TRUSTED */ /* update block count */ totwrt -= nwrt; blkno += nwrt; va += sectorsize * nwrt; } - rddoingadump = 0; + hddoingadump = 0; return (0); } diff --git a/sys/arch/hp300/dev/hd_compat.c b/sys/arch/hp300/dev/hd_compat.c new file mode 100644 index 00000000000..4afd1f8a0be --- /dev/null +++ b/sys/arch/hp300/dev/hd_compat.c @@ -0,0 +1,293 @@ +/* $OpenBSD: hd_compat.c,v 1.1 1997/02/03 08:11:54 downsj Exp $ */ +/* $NetBSD: rd_compat.c,v 1.6 1997/01/30 09:14:18 thorpej Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1982, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Utah $Hdr: rd_compat.c 1.1 92/12/21$ + * + * @(#)rd_compat.c 8.1 (Berkeley) 6/10/93 + */ + +/* + * Compatibility for CS80 disks without disklabels. + */ + +#include <sys/param.h> +#include <sys/disklabel.h> +#include <sys/disk.h> +#include <sys/device.h> +#include <sys/buf.h> /* XXX */ + +#include <hp300/dev/hpibvar.h> + +#include <hp300/dev/hdreg.h> +#include <hp300/dev/hdvar.h> + +/* + * CS/80 partitions. We reserve the first cylinder for a LIF + * style boot directory (the 8k allowed in the BSD filesystem + * is just way too small). This boot area is outside of all but + * the C partition. This implies that you cannot use the C + * partition on a bootable disk since the filesystem would overlay + * the boot area. You must use the A partition. + * + * These maps support four basic layouts: + * + * A/B/G: This is the "traditional" setup for a bootable disk. + * A is the root partition, B the swap, and G a user partition. + * A/D/H: This is a setup for bootable systems requiring more swap + * (e.g. those who use HPCL). It has A as the root, D as a + * larger swap, and H as a smaller user partition. + * A/D/E/F: Similar to A/D/H with E and F breaking H into two partitions. + * E could be used for /usr and F for users. + * C: This gives a single, non-bootable, large user filesystem. + * Good for second drives on a machine (e.g. /usr/src). + */ +struct size { + daddr_t nblocks; + int cyloff; +} hd7945A_sizes[8] = { + HDSZ(15904), 1, /* A=cyl 1 thru 142 */ + HDSZ(20160), 143, /* B=cyl 143 thru 322 */ + HDSZ(108416), 0, /* C=cyl 0 thru 967 */ + HDSZ(40320), 143, /* D=cyl 143 thru 502 */ + HDSZ(0), 0, /* E=<undefined> */ + HDSZ(0), 0, /* F=<undefined> */ + HDSZ(72240), 323, /* G=cyl 323 thru 967 */ + HDSZ(52080), 503, /* H=cyl 503 thru 967 */ +}, hd9134D_sizes[8] = { + HDSZ(15936), 1, /* A=cyl 1 thru 166 */ + HDSZ(13056), 167, /* B=cyl 167 thru 302 */ + HDSZ(29088), 0, /* C=cyl 0 thru 302 */ + HDSZ(0), 0, /* D=<undefined> */ + HDSZ(0), 0, /* E=<undefined> */ + HDSZ(0), 0, /* F=<undefined> */ + HDSZ(0), 0, /* G=<undefined> */ + HDSZ(0), 0, /* H=<undefined> */ +}, hd9122S_sizes[8] = { + HDSZ(0), 0, /* A=<undefined> */ + HDSZ(0), 0, /* B=<undefined> */ + HDSZ(1232), 0, /* C=cyl 0 thru 76 */ + HDSZ(0), 0, /* D=<undefined> */ + HDSZ(0), 0, /* E=<undefined> */ + HDSZ(0), 0, /* F=<undefined> */ + HDSZ(0), 0, /* G=<undefined> */ + HDSZ(0), 0, /* H=<undefined> */ +}, hd7912P_sizes[8] = { + HDSZ(15904), 0, /* A=cyl 1 thru 71 */ + HDSZ(22400), 72, /* B=cyl 72 thru 171 */ + HDSZ(128128), 0, /* C=cyl 0 thru 571 */ + HDSZ(42560), 72, /* D=cyl 72 thru 261 */ + HDSZ(0), 292, /* E=<undefined> */ + HDSZ(0), 542, /* F=<undefined> */ + HDSZ(89600), 172, /* G=cyl 221 thru 571 */ + HDSZ(69440), 262, /* H=cyl 262 thru 571 */ +}, hd7914P_sizes[8] = { + HDSZ(15904), 1, /* A=cyl 1 thru 71 */ + HDSZ(40320), 72, /* B=cyl 72 thru 251 */ + HDSZ(258048), 0, /* C=cyl 0 thru 1151 */ + HDSZ(64960), 72, /* D=cyl 72 thru 361 */ + HDSZ(98560), 362, /* E=cyl 362 thru 801 */ + HDSZ(78400), 802, /* F=cyl 802 thru 1151 */ + HDSZ(201600), 252, /* G=cyl 221 thru 1151 */ + HDSZ(176960), 362, /* H=cyl 362 thru 1151 */ +}, hd7933H_sizes[8] = { + HDSZ(16146), 1, /* A=cyl 1 thru 27 */ + HDSZ(66976), 28, /* B=cyl 28 thru 139 */ + HDSZ(789958), 0, /* C=cyl 0 thru 1320 */ + HDSZ(16146), 140, /* D=cyl 140 thru 166 */ + HDSZ(165646), 167, /* E=cyl 167 thru 443 */ + HDSZ(165646), 444, /* F=cyl 444 thru 720 */ + HDSZ(706238), 140, /* G=cyl 140 thru 1320 */ + HDSZ(358800), 721, /* H=cyl 721 thru 1320 */ +}, hd9134L_sizes[8] = { + HDSZ(15920), 1, /* A=cyl 1 thru 199 */ + HDSZ(20000), 200, /* B=cyl 200 thru 449 */ + HDSZ(77840), 0, /* C=cyl 0 thru 972 */ + HDSZ(32000), 200, /* D=cyl 200 thru 599 */ + HDSZ(0), 0, /* E=<undefined> */ + HDSZ(0), 0, /* F=<undefined> */ + HDSZ(41840), 450, /* G=cyl 450 thru 972 */ + HDSZ(29840), 600, /* H=cyl 600 thru 972 */ +}, hd7957A_sizes[8] = { + HDSZ(16016), 1, /* A=cyl 1 thru 104 */ + HDSZ(24640), 105, /* B=cyl 105 thru 264 */ + HDSZ(159544), 0, /* C=cyl 0 thru 1035 */ + HDSZ(42350), 105, /* D=cyl 105 thru 379 */ + HDSZ(54824), 380, /* E=cyl 380 thru 735 */ + HDSZ(46200), 736, /* F=cyl 736 thru 1035 */ + HDSZ(118734), 265, /* G=cyl 265 thru 1035 */ + HDSZ(101024), 380, /* H=cyl 380 thru 1035 */ +}, hd7958A_sizes[8] = { + HDSZ(16128), 1, /* A=cyl 1 thru 64 */ + HDSZ(32256), 65, /* B=cyl 65 thru 192 */ + HDSZ(255276), 0, /* C=cyl 0 thru 1012 */ + HDSZ(48384), 65, /* D=cyl 65 thru 256 */ + HDSZ(100800), 257, /* E=cyl 257 thru 656 */ + HDSZ(89712), 657, /* F=cyl 657 thru 1012 */ + HDSZ(206640), 193, /* G=cyl 193 thru 1012 */ + HDSZ(190512), 257, /* H=cyl 257 thru 1012 */ +}, hd7957B_sizes[8] = { + HDSZ(16002), 1, /* A=cyl 1 thru 127 */ + HDSZ(32760), 128, /* B=cyl 128 thru 387 */ + HDSZ(159894), 0, /* C=cyl 0 thru 1268 */ + HDSZ(49140), 128, /* D=cyl 128 thru 517 */ + HDSZ(50400), 518, /* E=cyl 518 thru 917 */ + HDSZ(44226), 918, /* F=cyl 918 thru 1268 */ + HDSZ(111006), 388, /* G=cyl 388 thru 1268 */ + HDSZ(94626), 518, /* H=cyl 518 thru 1268 */ +}, hd7958B_sizes[8] = { + HDSZ(16254), 1, /* A=cyl 1 thru 43 */ + HDSZ(32886), 44, /* B=cyl 44 thru 130 */ + HDSZ(297108), 0, /* C=cyl 0 thru 785 */ + HDSZ(49140), 44, /* D=cyl 44 thru 173 */ + HDSZ(121716), 174, /* E=cyl 174 thru 495 */ + HDSZ(109620), 496, /* F=cyl 496 thru 785 */ + HDSZ(247590), 131, /* G=cyl 131 thru 785 */ + HDSZ(231336), 174, /* H=cyl 174 thru 785 */ +}, hd7959B_sizes[8] = { + HDSZ(16254), 1, /* A=cyl 1 thru 43 */ + HDSZ(49140), 44, /* B=cyl 44 thru 173 */ + HDSZ(594216), 0, /* C=cyl 0 thru 1571 */ + HDSZ(65772), 44, /* D=cyl 44 thru 217 */ + HDSZ(303912), 218, /* E=cyl 218 thru 1021 */ + HDSZ(207900), 1022, /* F=cyl 1022 thru 1571 */ + HDSZ(528444), 174, /* G=cyl 174 thru 1571 */ + HDSZ(511812), 218, /* H=cyl 218 thru 1571 */ +}, hd2200A_sizes[8] = { + HDSZ(16272), 1, /* A=cyl 1 thru 36 */ + HDSZ(49720), 37, /* B=cyl 37 thru 146 */ + HDSZ(654948), 0, /* C=cyl 0 thru 1448 */ + HDSZ(65992), 37, /* D=cyl 37 thru 182 */ + HDSZ(304648), 183, /* E=cyl 183 thru 856 */ + HDSZ(267584), 857, /* F=cyl 857 thru 1448 */ + HDSZ(588504), 147, /* G=cyl 147 thru 1448 */ + HDSZ(572232), 183, /* H=cyl 183 thru 1448 */ +}, hd2203A_sizes[8] = { + /* modelled after the 7937; i.e. bogus */ + HDSZ(16272), 1, /* A=cyl 1 thru 18 */ + HDSZ(67800), 19, /* B=cyl 19 thru 93 */ + HDSZ(1309896), 0, /* C=cyl 0 thru 1448 */ + HDSZ(16272), 94, /* D=cyl 19 thru 111 */ + HDSZ(305552), 112, /* E=cyl 112 thru 449 */ + HDSZ(305552), 450, /* F=cyl 450 thru 787 */ + HDSZ(1224920), 94, /* G=cyl 94 thru 1448 */ + HDSZ(597544), 788, /* H=cyl 788 thru 1448 */ +}, hd7936H_sizes[8] = { + HDSZ(16359), 1, /* A=cyl 1 thru 19 */ + HDSZ(67158), 20, /* B=cyl 20 thru 97 */ + HDSZ(600978), 0, /* C=cyl 0 thru 697 */ + HDSZ(16359), 98, /* D=cyl 98 thru 116 */ + HDSZ(120540), 117, /* E=cyl 117 thru 256 */ + HDSZ(120540), 256, /* F=cyl 256 thru 396 */ + HDSZ(516600), 98, /* G=cyl 98 thru 697 */ + HDSZ(259161), 397, /* H=cyl 397 thru 697 */ +}, hd7937H_sizes[8] = { + HDSZ(15990), 1, /* A=cyl 1 thru 10 */ + HDSZ(67158), 11, /* B=cyl 11 thru 52 */ + HDSZ(1116102), 0, /* C=cyl 0 thru 697 */ + HDSZ(124722), 53, /* D=cyl 53 thru 130 */ + HDSZ(163098), 131, /* E=cyl 131 thru 232 */ + HDSZ(287820), 233, /* F=cyl 233 thru 412 */ + HDSZ(1031355), 53, /* G=cyl 53 thru 697 */ + HDSZ(455715), 413, /* H=cyl 413 thru 697 */ +}; + +/* + * Indexed the same as hdidentinfo array. + */ +struct hdcompatinfo { + struct size *sizes; /* partition info */ +} hdcompatinfo[] = { + hd7945A_sizes, + hd9134D_sizes, + hd9122S_sizes, + hd7912P_sizes, + hd7914P_sizes, + hd7958A_sizes, + hd7957A_sizes, + hd7933H_sizes, + hd9134L_sizes, + hd7936H_sizes, + hd7937H_sizes, + hd7914P_sizes, + hd7945A_sizes, + hd9122S_sizes, + hd7957B_sizes, + hd7958B_sizes, + hd7959B_sizes, + hd2200A_sizes, + hd2203A_sizes, +}; +int nhdcompatinfo = sizeof(hdcompatinfo) / sizeof(hdcompatinfo[0]); + +hdmakedisklabel(unit, lp) + int unit; + struct disklabel *lp; +{ + extern struct cfdriver hd_cd; + register struct hd_softc *rs = hd_cd.cd_devs[unit]; + register struct hdcompatinfo *ci = &hdcompatinfo[rs->sc_type]; + struct hdidentinfo *ri = &hdidentinfo[rs->sc_type]; + register struct partition *pi; + register int dcount; + + lp->d_nsectors = ri->ri_nbpt; + lp->d_ntracks = ri->ri_ntpc; + lp->d_ncylinders = ri->ri_ncyl; + lp->d_secpercyl = ri->ri_nbpt * ri->ri_ntpc; + lp->d_secperunit = lp->d_secpercyl * ri->ri_ncyl; + lp->d_rpm = 3600; + lp->d_interleave = 1; + lp->d_npartitions = 8; + + pi = lp->d_partitions; + for (dcount = 0; dcount < lp->d_npartitions; dcount++) { + pi->p_size = ci->sizes[dcount].nblocks; + pi->p_offset = ci->sizes[dcount].cyloff * lp->d_secpercyl; + pi->p_fsize = 1024; + if (dcount == 1 || dcount == 3) + pi->p_fstype = FS_SWAP; + else if (dcount == 2) + pi->p_fstype = FS_BOOT; + else + pi->p_fstype = FS_BSDFFS; + pi->p_frag = 8; + pi++; + } +} diff --git a/sys/arch/hp300/dev/rdreg.h b/sys/arch/hp300/dev/hdreg.h index ad1c9ccf478..0ffa53a09e4 100644 --- a/sys/arch/hp300/dev/rdreg.h +++ b/sys/arch/hp300/dev/hdreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rdreg.h,v 1.4 1997/01/12 15:13:00 downsj Exp $ */ +/* $OpenBSD: hdreg.h,v 1.1 1997/02/03 08:11:55 downsj Exp $ */ /* $NetBSD: rdreg.h,v 1.7 1996/02/09 18:00:37 scottr Exp $ */ /* @@ -43,7 +43,7 @@ * @(#)rdreg.h 8.1 (Berkeley) 6/10/93 */ -struct rd_iocmd { +struct hd_iocmd { char c_pad; char c_unit; char c_volume; @@ -57,14 +57,14 @@ struct rd_iocmd { char c_pad2; }; -struct rd_rscmd { +struct hd_rscmd { char c_unit; char c_sram; char c_ram; char c_cmd; }; -struct rd_stat { +struct hd_stat { char c_vu; char c_pend; short c_ref; @@ -87,7 +87,7 @@ struct rd_stat { #define c_blk c_pf.cu_sva.cu_lsl /* for now */ #define c_tva c_pf.cu_tva -struct rd_ssmcmd { +struct hd_ssmcmd { char c_unit; char c_cmd; short c_refm; @@ -96,19 +96,19 @@ struct rd_ssmcmd { short c_iefm; }; -struct rd_srcmd { +struct hd_srcmd { char c_unit; char c_nop; char c_cmd; char c_param; }; -struct rd_clearcmd { +struct hd_clearcmd { char c_unit; char c_cmd; }; -struct rd_describe { +struct hd_describe { u_int d_iuw:16, /* controller: installed unit word */ d_cmaxxfr:16, /* controller: max transfer rate (Kb) */ d_ctype:8, /* controller: controller type */ @@ -133,56 +133,56 @@ struct rd_describe { }; /* HW ids */ -#define RD7946AID 0x220 /* also 7945A */ -#define RD9134DID 0x221 /* also 9122S */ -#define RD9134LID 0x222 /* also 9122D */ -#define RD7912PID 0x209 -#define RD7914CTID 0x20A -#define RD7914PID 0x20B -#define RD7958AID 0x22B -#define RD7957AID 0x22A -#define RD7933HID 0x212 -#define RD7936HID 0x213 /* just guessing -- as of yet unknown */ -#define RD7937HID 0x214 -#define RD7957BID 0x22C /* another guess based on 7958B */ -#define RD7958BID 0x22D -#define RD7959BID 0x22E /* another guess based on 7958B */ -#define RD2200AID 0x22F -#define RD2203AID 0x230 /* yet another guess */ +#define HD7946AID 0x220 /* also 7945A */ +#define HD9134DID 0x221 /* also 9122S */ +#define HD9134LID 0x222 /* also 9122D */ +#define HD7912PID 0x209 +#define HD7914CTID 0x20A +#define HD7914PID 0x20B +#define HD7958AID 0x22B +#define HD7957AID 0x22A +#define HD7933HID 0x212 +#define HD7936HID 0x213 /* just guessing -- as of yet unknown */ +#define HD7937HID 0x214 +#define HD7957BID 0x22C /* another guess based on 7958B */ +#define HD7958BID 0x22D +#define HD7959BID 0x22E /* another guess based on 7958B */ +#define HD2200AID 0x22F +#define HD2203AID 0x230 /* yet another guess */ -/* SW ids -- indicies into rdidentinfo, order is arbitrary */ -#define RD7945A 0 -#define RD9134D 1 -#define RD9122S 2 -#define RD7912P 3 -#define RD7914P 4 -#define RD7958A 5 -#define RD7957A 6 -#define RD7933H 7 -#define RD9134L 8 -#define RD7936H 9 -#define RD7937H 10 -#define RD7914CT 11 -#define RD7946A 12 -#define RD9122D 13 -#define RD7957B 14 -#define RD7958B 15 -#define RD7959B 16 +/* SW ids -- indicies into hdidentinfo, order is arbitrary */ +#define HD7945A 0 +#define HD9134D 1 +#define HD9122S 2 +#define HD7912P 3 +#define HD7914P 4 +#define HD7958A 5 +#define HD7957A 6 +#define HD7933H 7 +#define HD9134L 8 +#define HD7936H 9 +#define HD7937H 10 +#define HD7914CT 11 +#define HD7946A 12 +#define HD9122D 13 +#define HD7957B 14 +#define HD7958B 15 +#define HD7959B 16 -#define NRD7945ABPT 16 -#define NRD7945ATRK 7 -#define NRD9134DBPT 16 -#define NRD9134DTRK 6 -#define NRD9122SBPT 8 -#define NRD9122STRK 2 -#define NRD7912PBPT 32 -#define NRD7912PTRK 7 -#define NRD7914PBPT 32 -#define NRD7914PTRK 7 -#define NRD7933HBPT 46 -#define NRD7933HTRK 13 -#define NRD9134LBPT 16 -#define NRD9134LTRK 5 +#define NHD7945ABPT 16 +#define NHD7945ATRK 7 +#define NHD9134DBPT 16 +#define NHD9134DTRK 6 +#define NHD9122SBPT 8 +#define NHD9122STRK 2 +#define NHD7912PBPT 32 +#define NHD7912PTRK 7 +#define NHD7914PBPT 32 +#define NHD7914PTRK 7 +#define NHD7933HBPT 46 +#define NHD7933HTRK 13 +#define NHD9134LBPT 16 +#define NHD9134LTRK 5 /* * Several HP drives have an odd number of 256 byte sectors per track. @@ -208,39 +208,39 @@ struct rd_describe { * 2200A: 113 x 8 x 1449 113 x 2 x 1449 113 x 4 x 1449 * 2203A: 113 x 16 x 1449 113 x 4 x 1449 113 x 8 x 1449 */ -#define NRD7936HBPT 123 -#define NRD7936HTRK 7 -#define NRD7937HBPT 123 -#define NRD7937HTRK 13 -#define NRD7957ABPT 22 -#define NRD7957ATRK 7 -#define NRD7958ABPT 36 -#define NRD7958ATRK 7 -#define NRD7957BBPT 18 -#define NRD7957BTRK 7 -#define NRD7958BBPT 42 -#define NRD7958BTRK 9 -#define NRD7959BBPT 42 -#define NRD7959BTRK 9 -#define NRD2200ABPT 113 -#define NRD2200ATRK 4 -#define NRD2203ABPT 113 -#define NRD2203ATRK 8 +#define NHD7936HBPT 123 +#define NHD7936HTRK 7 +#define NHD7937HBPT 123 +#define NHD7937HTRK 13 +#define NHD7957ABPT 22 +#define NHD7957ATRK 7 +#define NHD7958ABPT 36 +#define NHD7958ATRK 7 +#define NHD7957BBPT 18 +#define NHD7957BTRK 7 +#define NHD7958BBPT 42 +#define NHD7958BTRK 9 +#define NHD7959BBPT 42 +#define NHD7959BTRK 9 +#define NHD2200ABPT 113 +#define NHD2200ATRK 4 +#define NHD2203ABPT 113 +#define NHD2203ATRK 8 /* controller "unit" number */ -#define RDCTLR 15 +#define HDCTLR 15 /* convert 512 byte count into DEV_BSIZE count */ -#define RDSZ(x) ((x) >> (DEV_BSHIFT-9)) +#define HDSZ(x) ((x) >> (DEV_BSHIFT-9)) /* convert block number into sector number and back */ -#define RDBTOS(x) ((x) << (DEV_BSHIFT-8)) -#define RDSTOB(x) ((x) >> (DEV_BSHIFT-8)) +#define HDBTOS(x) ((x) << (DEV_BSHIFT-8)) +#define HDSTOB(x) ((x) >> (DEV_BSHIFT-8)) /* extract cyl/head/sect info from three-vector address */ -#define RDCYL(tva) ((u_long)(tva).cu_cyhd >> 8) -#define RDHEAD(tva) ((tva).cu_cyhd & 0xFF) -#define RDSECT(tva) ((tva).cu_sect) +#define HDCYL(tva) ((u_long)(tva).cu_cyhd >> 8) +#define HDHEAD(tva) ((tva).cu_cyhd & 0xFF) +#define HDSECT(tva) ((tva).cu_sect) #define REF_MASK 0x0 #define FEF_MASK 0x0 diff --git a/sys/arch/hp300/dev/rdvar.h b/sys/arch/hp300/dev/hdvar.h index 04fd3adeb5f..051bdb246a5 100644 --- a/sys/arch/hp300/dev/rdvar.h +++ b/sys/arch/hp300/dev/hdvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rdvar.h,v 1.6 1997/02/03 04:47:43 downsj Exp $ */ +/* $OpenBSD: hdvar.h,v 1.1 1997/02/03 08:11:55 downsj Exp $ */ /* $NetBSD: rdvar.h,v 1.6 1997/01/30 09:14:19 thorpej Exp $ */ /* @@ -43,7 +43,7 @@ * @(#)rdvar.h 8.1 (Berkeley) 6/10/93 */ -struct rdidentinfo { +struct hdidentinfo { short ri_hwid; /* 2 byte HW id */ short ri_maxunum; /* maximum allowed unit number */ char *ri_desc; /* drive type description */ @@ -53,15 +53,15 @@ struct rdidentinfo { int ri_nblocks; /* DEV_BSIZE blocks on disk */ }; -struct rdstats { - long rdretries; - long rdresets; - long rdtimeouts; - long rdpolltries; - long rdpollwaits; +struct hdstats { + long hdretries; + long hdresets; + long hdtimeouts; + long hdpolltries; + long hdpollwaits; }; -struct rd_softc { +struct hd_softc { struct device sc_dev; struct disk sc_dkdev; int sc_slave; /* HP-IB slave */ @@ -70,37 +70,37 @@ struct rd_softc { short sc_type; char *sc_addr; int sc_resid; - struct rd_describe sc_rddesc; + struct hd_describe sc_hddesc; struct hpibqueue sc_hq; /* hpib job queue entry */ - struct rd_iocmd sc_ioc; - struct rd_rscmd sc_rsc; - struct rd_stat sc_stat; - struct rd_ssmcmd sc_ssmc; - struct rd_srcmd sc_src; - struct rd_clearcmd sc_clear; + struct hd_iocmd sc_ioc; + struct hd_rscmd sc_rsc; + struct hd_stat sc_stat; + struct hd_ssmcmd sc_ssmc; + struct hd_srcmd sc_src; + struct hd_clearcmd sc_clear; struct buf sc_tab; /* buffer queue */ - struct rdstats sc_stats; + struct hdstats sc_stats; }; /* sc_flags values */ -#define RDF_ALIVE 0x01 -#define RDF_SEEK 0x02 -#define RDF_SWAIT 0x04 -#define RDF_OPENING 0x08 -#define RDF_CLOSING 0x10 -#define RDF_WANTED 0x20 -#define RDF_WLABEL 0x40 +#define HDF_ALIVE 0x01 +#define HDF_SEEK 0x02 +#define HDF_SWAIT 0x04 +#define HDF_OPENING 0x08 +#define HDF_CLOSING 0x10 +#define HDF_WANTED 0x20 +#define HDF_WLABEL 0x40 -#define rdunit(x) (minor(x) >> 3) -#define rdpart(x) (minor(x) & 0x7) -#define rdpunit(x) ((x) & 7) -#define rdlabdev(d) (dev_t)(((int)(d)&~7)|2) /* rd?c */ +#define hdunit(x) (minor(x) >> 3) +#define hdpart(x) (minor(x) & 0x7) +#define hdpunit(x) ((x) & 7) +#define hdlabdev(d) (dev_t)(((int)(d)&~7)|2) /* hd?c */ #define b_cylin b_resid -#define RDRETRY 5 -#define RDWAITC 1 /* min time for timeout in seconds */ +#define HDRETRY 5 +#define HDWAITC 1 /* min time for timeout in seconds */ #ifdef _KERNEL -extern struct rdidentinfo rdidentinfo[]; +extern struct hdidentinfo hdidentinfo[]; #endif diff --git a/sys/arch/hp300/dev/rd_compat.c b/sys/arch/hp300/dev/rd_compat.c deleted file mode 100644 index 6eec8ff55a0..00000000000 --- a/sys/arch/hp300/dev/rd_compat.c +++ /dev/null @@ -1,293 +0,0 @@ -/* $OpenBSD: rd_compat.c,v 1.5 1997/02/03 04:47:43 downsj Exp $ */ -/* $NetBSD: rd_compat.c,v 1.6 1997/01/30 09:14:18 thorpej Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1982, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Utah $Hdr: rd_compat.c 1.1 92/12/21$ - * - * @(#)rd_compat.c 8.1 (Berkeley) 6/10/93 - */ - -/* - * Compatibility for CS80 disks without disklabels. - */ - -#include <sys/param.h> -#include <sys/disklabel.h> -#include <sys/disk.h> -#include <sys/device.h> -#include <sys/buf.h> /* XXX */ - -#include <hp300/dev/hpibvar.h> - -#include <hp300/dev/rdreg.h> -#include <hp300/dev/rdvar.h> - -/* - * CS/80 partitions. We reserve the first cylinder for a LIF - * style boot directory (the 8k allowed in the BSD filesystem - * is just way too small). This boot area is outside of all but - * the C partition. This implies that you cannot use the C - * partition on a bootable disk since the filesystem would overlay - * the boot area. You must use the A partition. - * - * These maps support four basic layouts: - * - * A/B/G: This is the "traditional" setup for a bootable disk. - * A is the root partition, B the swap, and G a user partition. - * A/D/H: This is a setup for bootable systems requiring more swap - * (e.g. those who use HPCL). It has A as the root, D as a - * larger swap, and H as a smaller user partition. - * A/D/E/F: Similar to A/D/H with E and F breaking H into two partitions. - * E could be used for /usr and F for users. - * C: This gives a single, non-bootable, large user filesystem. - * Good for second drives on a machine (e.g. /usr/src). - */ -struct size { - daddr_t nblocks; - int cyloff; -} rd7945A_sizes[8] = { - RDSZ(15904), 1, /* A=cyl 1 thru 142 */ - RDSZ(20160), 143, /* B=cyl 143 thru 322 */ - RDSZ(108416), 0, /* C=cyl 0 thru 967 */ - RDSZ(40320), 143, /* D=cyl 143 thru 502 */ - RDSZ(0), 0, /* E=<undefined> */ - RDSZ(0), 0, /* F=<undefined> */ - RDSZ(72240), 323, /* G=cyl 323 thru 967 */ - RDSZ(52080), 503, /* H=cyl 503 thru 967 */ -}, rd9134D_sizes[8] = { - RDSZ(15936), 1, /* A=cyl 1 thru 166 */ - RDSZ(13056), 167, /* B=cyl 167 thru 302 */ - RDSZ(29088), 0, /* C=cyl 0 thru 302 */ - RDSZ(0), 0, /* D=<undefined> */ - RDSZ(0), 0, /* E=<undefined> */ - RDSZ(0), 0, /* F=<undefined> */ - RDSZ(0), 0, /* G=<undefined> */ - RDSZ(0), 0, /* H=<undefined> */ -}, rd9122S_sizes[8] = { - RDSZ(0), 0, /* A=<undefined> */ - RDSZ(0), 0, /* B=<undefined> */ - RDSZ(1232), 0, /* C=cyl 0 thru 76 */ - RDSZ(0), 0, /* D=<undefined> */ - RDSZ(0), 0, /* E=<undefined> */ - RDSZ(0), 0, /* F=<undefined> */ - RDSZ(0), 0, /* G=<undefined> */ - RDSZ(0), 0, /* H=<undefined> */ -}, rd7912P_sizes[8] = { - RDSZ(15904), 0, /* A=cyl 1 thru 71 */ - RDSZ(22400), 72, /* B=cyl 72 thru 171 */ - RDSZ(128128), 0, /* C=cyl 0 thru 571 */ - RDSZ(42560), 72, /* D=cyl 72 thru 261 */ - RDSZ(0), 292, /* E=<undefined> */ - RDSZ(0), 542, /* F=<undefined> */ - RDSZ(89600), 172, /* G=cyl 221 thru 571 */ - RDSZ(69440), 262, /* H=cyl 262 thru 571 */ -}, rd7914P_sizes[8] = { - RDSZ(15904), 1, /* A=cyl 1 thru 71 */ - RDSZ(40320), 72, /* B=cyl 72 thru 251 */ - RDSZ(258048), 0, /* C=cyl 0 thru 1151 */ - RDSZ(64960), 72, /* D=cyl 72 thru 361 */ - RDSZ(98560), 362, /* E=cyl 362 thru 801 */ - RDSZ(78400), 802, /* F=cyl 802 thru 1151 */ - RDSZ(201600), 252, /* G=cyl 221 thru 1151 */ - RDSZ(176960), 362, /* H=cyl 362 thru 1151 */ -}, rd7933H_sizes[8] = { - RDSZ(16146), 1, /* A=cyl 1 thru 27 */ - RDSZ(66976), 28, /* B=cyl 28 thru 139 */ - RDSZ(789958), 0, /* C=cyl 0 thru 1320 */ - RDSZ(16146), 140, /* D=cyl 140 thru 166 */ - RDSZ(165646), 167, /* E=cyl 167 thru 443 */ - RDSZ(165646), 444, /* F=cyl 444 thru 720 */ - RDSZ(706238), 140, /* G=cyl 140 thru 1320 */ - RDSZ(358800), 721, /* H=cyl 721 thru 1320 */ -}, rd9134L_sizes[8] = { - RDSZ(15920), 1, /* A=cyl 1 thru 199 */ - RDSZ(20000), 200, /* B=cyl 200 thru 449 */ - RDSZ(77840), 0, /* C=cyl 0 thru 972 */ - RDSZ(32000), 200, /* D=cyl 200 thru 599 */ - RDSZ(0), 0, /* E=<undefined> */ - RDSZ(0), 0, /* F=<undefined> */ - RDSZ(41840), 450, /* G=cyl 450 thru 972 */ - RDSZ(29840), 600, /* H=cyl 600 thru 972 */ -}, rd7957A_sizes[8] = { - RDSZ(16016), 1, /* A=cyl 1 thru 104 */ - RDSZ(24640), 105, /* B=cyl 105 thru 264 */ - RDSZ(159544), 0, /* C=cyl 0 thru 1035 */ - RDSZ(42350), 105, /* D=cyl 105 thru 379 */ - RDSZ(54824), 380, /* E=cyl 380 thru 735 */ - RDSZ(46200), 736, /* F=cyl 736 thru 1035 */ - RDSZ(118734), 265, /* G=cyl 265 thru 1035 */ - RDSZ(101024), 380, /* H=cyl 380 thru 1035 */ -}, rd7958A_sizes[8] = { - RDSZ(16128), 1, /* A=cyl 1 thru 64 */ - RDSZ(32256), 65, /* B=cyl 65 thru 192 */ - RDSZ(255276), 0, /* C=cyl 0 thru 1012 */ - RDSZ(48384), 65, /* D=cyl 65 thru 256 */ - RDSZ(100800), 257, /* E=cyl 257 thru 656 */ - RDSZ(89712), 657, /* F=cyl 657 thru 1012 */ - RDSZ(206640), 193, /* G=cyl 193 thru 1012 */ - RDSZ(190512), 257, /* H=cyl 257 thru 1012 */ -}, rd7957B_sizes[8] = { - RDSZ(16002), 1, /* A=cyl 1 thru 127 */ - RDSZ(32760), 128, /* B=cyl 128 thru 387 */ - RDSZ(159894), 0, /* C=cyl 0 thru 1268 */ - RDSZ(49140), 128, /* D=cyl 128 thru 517 */ - RDSZ(50400), 518, /* E=cyl 518 thru 917 */ - RDSZ(44226), 918, /* F=cyl 918 thru 1268 */ - RDSZ(111006), 388, /* G=cyl 388 thru 1268 */ - RDSZ(94626), 518, /* H=cyl 518 thru 1268 */ -}, rd7958B_sizes[8] = { - RDSZ(16254), 1, /* A=cyl 1 thru 43 */ - RDSZ(32886), 44, /* B=cyl 44 thru 130 */ - RDSZ(297108), 0, /* C=cyl 0 thru 785 */ - RDSZ(49140), 44, /* D=cyl 44 thru 173 */ - RDSZ(121716), 174, /* E=cyl 174 thru 495 */ - RDSZ(109620), 496, /* F=cyl 496 thru 785 */ - RDSZ(247590), 131, /* G=cyl 131 thru 785 */ - RDSZ(231336), 174, /* H=cyl 174 thru 785 */ -}, rd7959B_sizes[8] = { - RDSZ(16254), 1, /* A=cyl 1 thru 43 */ - RDSZ(49140), 44, /* B=cyl 44 thru 173 */ - RDSZ(594216), 0, /* C=cyl 0 thru 1571 */ - RDSZ(65772), 44, /* D=cyl 44 thru 217 */ - RDSZ(303912), 218, /* E=cyl 218 thru 1021 */ - RDSZ(207900), 1022, /* F=cyl 1022 thru 1571 */ - RDSZ(528444), 174, /* G=cyl 174 thru 1571 */ - RDSZ(511812), 218, /* H=cyl 218 thru 1571 */ -}, rd2200A_sizes[8] = { - RDSZ(16272), 1, /* A=cyl 1 thru 36 */ - RDSZ(49720), 37, /* B=cyl 37 thru 146 */ - RDSZ(654948), 0, /* C=cyl 0 thru 1448 */ - RDSZ(65992), 37, /* D=cyl 37 thru 182 */ - RDSZ(304648), 183, /* E=cyl 183 thru 856 */ - RDSZ(267584), 857, /* F=cyl 857 thru 1448 */ - RDSZ(588504), 147, /* G=cyl 147 thru 1448 */ - RDSZ(572232), 183, /* H=cyl 183 thru 1448 */ -}, rd2203A_sizes[8] = { - /* modelled after the 7937; i.e. bogus */ - RDSZ(16272), 1, /* A=cyl 1 thru 18 */ - RDSZ(67800), 19, /* B=cyl 19 thru 93 */ - RDSZ(1309896), 0, /* C=cyl 0 thru 1448 */ - RDSZ(16272), 94, /* D=cyl 19 thru 111 */ - RDSZ(305552), 112, /* E=cyl 112 thru 449 */ - RDSZ(305552), 450, /* F=cyl 450 thru 787 */ - RDSZ(1224920), 94, /* G=cyl 94 thru 1448 */ - RDSZ(597544), 788, /* H=cyl 788 thru 1448 */ -}, rd7936H_sizes[8] = { - RDSZ(16359), 1, /* A=cyl 1 thru 19 */ - RDSZ(67158), 20, /* B=cyl 20 thru 97 */ - RDSZ(600978), 0, /* C=cyl 0 thru 697 */ - RDSZ(16359), 98, /* D=cyl 98 thru 116 */ - RDSZ(120540), 117, /* E=cyl 117 thru 256 */ - RDSZ(120540), 256, /* F=cyl 256 thru 396 */ - RDSZ(516600), 98, /* G=cyl 98 thru 697 */ - RDSZ(259161), 397, /* H=cyl 397 thru 697 */ -}, rd7937H_sizes[8] = { - RDSZ(15990), 1, /* A=cyl 1 thru 10 */ - RDSZ(67158), 11, /* B=cyl 11 thru 52 */ - RDSZ(1116102), 0, /* C=cyl 0 thru 697 */ - RDSZ(124722), 53, /* D=cyl 53 thru 130 */ - RDSZ(163098), 131, /* E=cyl 131 thru 232 */ - RDSZ(287820), 233, /* F=cyl 233 thru 412 */ - RDSZ(1031355), 53, /* G=cyl 53 thru 697 */ - RDSZ(455715), 413, /* H=cyl 413 thru 697 */ -}; - -/* - * Indexed the same as rdidentinfo array. - */ -struct rdcompatinfo { - struct size *sizes; /* partition info */ -} rdcompatinfo[] = { - rd7945A_sizes, - rd9134D_sizes, - rd9122S_sizes, - rd7912P_sizes, - rd7914P_sizes, - rd7958A_sizes, - rd7957A_sizes, - rd7933H_sizes, - rd9134L_sizes, - rd7936H_sizes, - rd7937H_sizes, - rd7914P_sizes, - rd7945A_sizes, - rd9122S_sizes, - rd7957B_sizes, - rd7958B_sizes, - rd7959B_sizes, - rd2200A_sizes, - rd2203A_sizes, -}; -int nrdcompatinfo = sizeof(rdcompatinfo) / sizeof(rdcompatinfo[0]); - -rdmakedisklabel(unit, lp) - int unit; - struct disklabel *lp; -{ - extern struct cfdriver rd_cd; - register struct rd_softc *rs = rd_cd.cd_devs[unit]; - register struct rdcompatinfo *ci = &rdcompatinfo[rs->sc_type]; - struct rdidentinfo *ri = &rdidentinfo[rs->sc_type]; - register struct partition *pi; - register int dcount; - - lp->d_nsectors = ri->ri_nbpt; - lp->d_ntracks = ri->ri_ntpc; - lp->d_ncylinders = ri->ri_ncyl; - lp->d_secpercyl = ri->ri_nbpt * ri->ri_ntpc; - lp->d_secperunit = lp->d_secpercyl * ri->ri_ncyl; - lp->d_rpm = 3600; - lp->d_interleave = 1; - lp->d_npartitions = 8; - - pi = lp->d_partitions; - for (dcount = 0; dcount < lp->d_npartitions; dcount++) { - pi->p_size = ci->sizes[dcount].nblocks; - pi->p_offset = ci->sizes[dcount].cyloff * lp->d_secpercyl; - pi->p_fsize = 1024; - if (dcount == 1 || dcount == 3) - pi->p_fstype = FS_SWAP; - else if (dcount == 2) - pi->p_fstype = FS_BOOT; - else - pi->p_fstype = FS_BSDFFS; - pi->p_frag = 8; - pi++; - } -} diff --git a/sys/arch/hp300/hp300/autoconf.c b/sys/arch/hp300/hp300/autoconf.c index 0e3428160e8..888dd232af9 100644 --- a/sys/arch/hp300/hp300/autoconf.c +++ b/sys/arch/hp300/hp300/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.10 1997/02/03 04:47:54 downsj Exp $ */ +/* $OpenBSD: autoconf.c,v 1.11 1997/02/03 08:11:59 downsj Exp $ */ /* $NetBSD: autoconf.c,v 1.31 1997/01/31 01:49:41 thorpej Exp $ */ /* @@ -355,7 +355,7 @@ device_register(dev, aux) goto linkup; } - if (bcmp(dev->dv_xname, "rd", 2) == 0) { + if (bcmp(dev->dv_xname, "hd", 2) == 0) { struct hpibbus_attach_args *ha = aux; dd->dd_slave = ha->ha_slave; @@ -421,7 +421,7 @@ struct nam2blk { int maj; } nam2blk[] = { { "ct", 0 }, - { "rd", 2 }, + { "hd", 2 }, { "sd", 4 }, }; @@ -838,7 +838,7 @@ findbootdev() punit = B_UNIT(bootdev); scsiboot = (type == 4); /* sd major */ - hpibboot = (type == 0 || type == 2); /* ct/rd major */ + hpibboot = (type == 0 || type == 2); /* ct/hd major */ netboot = (type == 6); /* le - special */ /* @@ -877,7 +877,7 @@ findbootdev() * Sanity check. */ if ((type == 0 && bcmp(booted_device->dv_xname, "ct", 2)) || - (type == 2 && bcmp(booted_device->dv_xname, "rd", 2))) { + (type == 2 && bcmp(booted_device->dv_xname, "hd", 2))) { printf("WARNING: boot device/type mismatch!\n"); printf("device = %s, type = %d\n", booted_device->dv_xname, type); @@ -950,7 +950,7 @@ findbootdev_slave(ddlist, ctlr, slave, punit) continue; } else { /* - * "rd" -> "hpibbus" -> "fhpib" + * "hd" -> "hpibbus" -> "fhpib" */ if (dd->dd_dev->dv_parent->dv_parent != cdd->dd_dev) continue; @@ -977,7 +977,7 @@ setbootdev() * Note our magic numbers for type: * * 0 == ct - * 2 == rd + * 2 == hd * 4 == sd * 6 == le * @@ -1006,7 +1006,7 @@ setbootdev() /* * Determine device type. */ - if (bcmp(root_device->dv_xname, "rd", 2) == 0) + if (bcmp(root_device->dv_xname, "hd", 2) == 0) type = 2; else if (bcmp(root_device->dv_xname, "sd", 2) == 0) type = 4; @@ -1022,7 +1022,7 @@ setbootdev() switch (type) { case 2: /* - * "rd" -> "hpibbus" -> "fhpib" + * "hd" -> "hpibbus" -> "fhpib" */ for (cdd = dev_data_list_hpib.lh_first, ctlr = 0; cdd != NULL; cdd = cdd->dd_clist.le_next, ctlr++) { diff --git a/sys/arch/hp300/hp300/conf.c b/sys/arch/hp300/hp300/conf.c index 124dc52e997..52d17b69d9a 100644 --- a/sys/arch/hp300/hp300/conf.c +++ b/sys/arch/hp300/hp300/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.11 1997/02/03 04:47:55 downsj Exp $ */ +/* $OpenBSD: conf.c,v 1.12 1997/02/03 08:12:00 downsj Exp $ */ /* $NetBSD: conf.c,v 1.34 1996/12/17 08:41:20 thorpej Exp $ */ /*- @@ -48,8 +48,8 @@ bdev_decl(ct); #include "mt.h" bdev_decl(mt); -#include "rd.h" -bdev_decl(rd); +#include "hd.h" +bdev_decl(hd); bdev_decl(sw); #include "sd.h" bdev_decl(sd); @@ -64,7 +64,7 @@ struct bdevsw bdevsw[] = { bdev_tape_init(NCT,ct), /* 0: cs80 cartridge tape */ bdev_tape_init(NMT,mt), /* 1: magnetic reel tape */ - bdev_disk_init(NRD,rd), /* 2: HPIB disk */ + bdev_disk_init(NHD,hd), /* 2: HPIB disk */ bdev_swap_init(1,sw), /* 3: swap pseudo-device */ bdev_disk_init(NSD,sd), /* 4: SCSI disk */ bdev_disk_init(NCCD,ccd), /* 5: concatenated disk driver */ @@ -115,7 +115,7 @@ cdev_decl(ptc); cdev_decl(log); cdev_decl(ct); cdev_decl(sd); -cdev_decl(rd); +cdev_decl(hd); #include "grf.h" cdev_decl(grf); #include "ppi.h" @@ -158,7 +158,7 @@ struct cdevsw cdevsw[] = cdev_log_init(1,log), /* 6: /dev/klog */ cdev_tape_init(NCT,ct), /* 7: cs80 cartridge tape */ cdev_disk_init(NSD,sd), /* 8: SCSI disk */ - cdev_disk_init(NRD,rd), /* 9: HPIB disk */ + cdev_disk_init(NHD,hd), /* 9: HPIB disk */ cdev_grf_init(NGRF,grf), /* 10: frame buffer */ cdev_ppi_init(NPPI,ppi), /* 11: printer/plotter interface */ cdev_tty_init(NDCA,dca), /* 12: built-in single-port serial */ |