merge with latest Utah version
authorMike Hibler <hibler@ucbvax.Berkeley.EDU>
Fri, 19 Jun 1992 12:33:39 +0000 (04:33 -0800)
committerMike Hibler <hibler@ucbvax.Berkeley.EDU>
Fri, 19 Jun 1992 12:33:39 +0000 (04:33 -0800)
SCCS-vsn: sys/hp300/stand/srt0.c 7.6
SCCS-vsn: sys/hp300/stand/samachdep.h 7.3
SCCS-vsn: sys/hp300/stand/scsi.c 7.5
SCCS-vsn: sys/hp300/stand/ct.c 7.4
SCCS-vsn: sys/hp300/stand/cons.c 7.5
SCCS-vsn: sys/hp300/stand/dca.c 7.4
SCCS-vsn: sys/hp300/stand/dcm.c 7.4
SCCS-vsn: sys/hp300/stand/hil.c 7.3
SCCS-vsn: sys/hp300/stand/hpib.c 7.6
SCCS-vsn: sys/hp300/stand/ite.c 7.4
SCCS-vsn: sys/hp300/stand/ite_dv.c 7.3
SCCS-vsn: sys/hp300/stand/ite_gb.c 7.3
SCCS-vsn: sys/hp300/stand/ite_rb.c 7.3
SCCS-vsn: sys/hp300/stand/ite_subr.c 7.3
SCCS-vsn: sys/hp300/stand/ite_tc.c 7.3
SCCS-vsn: sys/hp300/stand/machdep.c 7.5
SCCS-vsn: sys/hp300/stand/mkboot.c 7.3
SCCS-vsn: sys/hp300/stand/prf.c 7.5
SCCS-vsn: sys/hp300/stand/sd.c 7.5
SCCS-vsn: sys/hp300/stand/installboot.c 7.3
SCCS-vsn: sys/hp300/stand/rd.c 7.4
SCCS-vsn: sys/hp300/stand/boot.c 7.5
SCCS-vsn: sys/hp300/stand/autoconf.c 7.6
SCCS-vsn: sys/hp300/stand/conf.c 7.4
SCCS-vsn: sys/hp300/stand/Makefile 7.10

25 files changed:
usr/src/sys/hp300/stand/Makefile
usr/src/sys/hp300/stand/autoconf.c
usr/src/sys/hp300/stand/boot.c
usr/src/sys/hp300/stand/conf.c
usr/src/sys/hp300/stand/cons.c
usr/src/sys/hp300/stand/ct.c
usr/src/sys/hp300/stand/dca.c
usr/src/sys/hp300/stand/dcm.c
usr/src/sys/hp300/stand/hil.c
usr/src/sys/hp300/stand/hpib.c
usr/src/sys/hp300/stand/installboot.c
usr/src/sys/hp300/stand/ite.c
usr/src/sys/hp300/stand/ite_dv.c
usr/src/sys/hp300/stand/ite_gb.c
usr/src/sys/hp300/stand/ite_rb.c
usr/src/sys/hp300/stand/ite_subr.c
usr/src/sys/hp300/stand/ite_tc.c
usr/src/sys/hp300/stand/machdep.c
usr/src/sys/hp300/stand/mkboot.c
usr/src/sys/hp300/stand/prf.c
usr/src/sys/hp300/stand/rd.c
usr/src/sys/hp300/stand/samachdep.h
usr/src/sys/hp300/stand/scsi.c
usr/src/sys/hp300/stand/sd.c
usr/src/sys/hp300/stand/srt0.c

index 5013b19..719e6e0 100644 (file)
@@ -1,11 +1,11 @@
-#      @(#)Makefile    7.9 (Berkeley) %G%
+#      @(#)Makefile    7.10 (Berkeley) %G%
 
 DESTDIR=
 STAND= ../../stand
 
 DESTDIR=
 STAND= ../../stand
-INCPATH=-I. -I${STAND} -I../../sys -I..
+INCPATH=-I. -I${STAND} -I../.. -I../../sys -I..
 VPATH= ${STAND}
 
 VPATH= ${STAND}
 
-CC=    cc -fpcc-struct-return
+CC=cc
 AS=as
 
 # RELOC=FFF80000 allows for boot prog up to 7F000 (520192) bytes long
 AS=as
 
 # RELOC=FFF80000 allows for boot prog up to 7F000 (520192) bytes long
@@ -16,7 +16,7 @@ DEFS= -DSTANDALONE ${CONS} # -DROMPRF
 CFLAGS=        -O ${INCPATH} ${DEFS}
 
 DRIVERS=autoconf.c cons.c ct.c dca.c dcm.c fhpib.c hil.c hpib.c ite.c \
 CFLAGS=        -O ${INCPATH} ${DEFS}
 
 DRIVERS=autoconf.c cons.c ct.c dca.c dcm.c fhpib.c hil.c hpib.c ite.c \
-       ite_dv.c ite_gb.c ite_rb.c ite_subr.c ite_tc.c nhpib.c rd.c \
+       ite_dv.c ite_gb.c ite_hy.c ite_rb.c ite_subr.c ite_tc.c nhpib.c rd.c \
        scsi.c sd.c
 SRCS=  conf.c machdep.c prf.c ${DRIVERS}
 LIBS=  libsa/libsa.a libdrive.a ${DESTDIR}/usr/lib/libgnulib.a \
        scsi.c sd.c
 SRCS=  conf.c machdep.c prf.c ${DRIVERS}
 LIBS=  libsa/libsa.a libdrive.a ${DESTDIR}/usr/lib/libgnulib.a \
@@ -37,6 +37,12 @@ libdrive.a: conf.o machdep.o prf.o ${DRIVERS:.c=.o}
 
 ${DRIVERS}: samachdep.h
 
 
 ${DRIVERS}: samachdep.h
 
+# depend on DEFS
+
+machdep.o srt0.o: Makefile
+cons.o dca.o hil.o: Makefile
+ite.o ite_subr.o ite_dv.o ite_gb.o ite_hy.o ite_rb.o ite_tc.o: Makefile
+
 # startups
 
 srt0.o: srt0.c
 # startups
 
 srt0.o: srt0.c
@@ -54,7 +60,7 @@ tboot:        tboot.o srt0.o ${LIBS}
 
 tboot.o: boot.o
        cp boot.c tboot.c; chmod +w tboot.c
 
 tboot.o: boot.o
        cp boot.c tboot.c; chmod +w tboot.c
-       ${CC} -c -O ${INCPATH} -DJUSTASK tboot.c
+       ${CC} -c ${CFLAGS} -DJUSTASK tboot.c
        rm -f tboot.c
 
 tcopy: copy.o tpsrt0.o ${LIBS}
        rm -f tboot.c
 
 tcopy: copy.o tpsrt0.o ${LIBS}
@@ -73,10 +79,10 @@ dboot:      boot.o srt0.o bootconf.o ${LIBS}
 bootconf.o: conf.o
        rm -f bootconf.c
        ln -s conf.c bootconf.c
 bootconf.o: conf.o
        rm -f bootconf.c
        ln -s conf.c bootconf.c
-       ${CC} -c ${INCPATH} -DBOOT bootconf.c
+       ${CC} -c ${CFLAGS} -DBOOT bootconf.c
        rm -f bootconf.c
 
        rm -f bootconf.c
 
-# non-secure boot
+# non-secure boot (allows booting non-root owned or world writable kernels)
 
 nboot: nboot.o srt0.o bootconf.o ${LIBS}
        ld -N -T ${RELOC} -e begin -o nboot srt0.o nboot.o bootconf.o ${LIBS}
 
 nboot: nboot.o srt0.o bootconf.o ${LIBS}
        ld -N -T ${RELOC} -e begin -o nboot srt0.o nboot.o bootconf.o ${LIBS}
@@ -87,10 +93,10 @@ nboot:      nboot.o srt0.o bootconf.o ${LIBS}
 nboot.o: boot.o
        rm -f nboot.c
        ln -s boot.c nboot.c
 nboot.o: boot.o
        rm -f nboot.c
        ln -s boot.c nboot.c
-       ${CC} -c -O ${INCPATH} -DINSECURE ${DEFS} nboot.c
+       ${CC} -c ${CFLAGS} -DINSECURE nboot.c
        rm -f nboot.c
 
        rm -f nboot.c
 
-dcopy: copy.o srt0.o conf.o ${LIBS}
+dcopy: copy.o srt0.o conf.o ${LIBS}
        ld -N -T ${RELOC} -e begin -o dcopy srt0.o copy.o conf.o ${LIBS}
 
 mkboot: mkboot.c
        ld -N -T ${RELOC} -e begin -o dcopy srt0.o copy.o conf.o ${LIBS}
 
 mkboot: mkboot.c
@@ -123,7 +129,8 @@ install: mkboot installboot ${ALL}
        rm -f ${DESTDIR}/usr/mdec/bootsd
        ln ${DESTDIR}/usr/mdec/bootrd ${DESTDIR}/usr/mdec/bootsd
        install -c -m 644 tapeboot.lif ${DESTDIR}/usr/mdec/bootct
        rm -f ${DESTDIR}/usr/mdec/bootsd
        ln ${DESTDIR}/usr/mdec/bootrd ${DESTDIR}/usr/mdec/bootsd
        install -c -m 644 tapeboot.lif ${DESTDIR}/usr/mdec/bootct
-       mv diskboot.lif ndiskboot.lif tapeboot.lif ${DESTDIR}/sys/hpdist/tp
+#      mv diskboot.lif ndiskboot.lif tapeboot.lif ${DESTDIR}/sys/hpdist/tp
 
 depend: ${SRCS}
 
 depend: ${SRCS}
-       mkdep ${INCPATH} -DSTANDALONE ${SRCS}
+       mkdep ${INCPATH} ${DEFS} ${SRCS} mkboot.c installboot.c
+       mkdep -a -p ${INCPATH} ${DEFS} mkboot.c installboot.c
index cfcbfe4..e588d47 100644 (file)
@@ -9,26 +9,42 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- * from: Utah $Hdr: autoconf.c 1.13 91/01/21$
+ * from: Utah $Hdr: autoconf.c 1.16 92/05/29$
  *
  *
- *     @(#)autoconf.c  7.5 (Berkeley) %G%
+ *     @(#)autoconf.c  7.6 (Berkeley) %G%
  */
 
 #include "samachdep.h"
  */
 
 #include "samachdep.h"
+#include "rominfo.h"
 #include "sys/param.h"
 #include "sys/param.h"
+#include "sys/reboot.h"
 
 
-#include "../dev/device.h"
-#include "../dev/grfvar.h"
+#include "hp/dev/device.h"
+#include "hp/dev/grfreg.h"
+
+/*
+ * Mapping of ROM MSUS types to BSD major device numbers
+ * WARNING: major numbers must match bdevsw indices in hp300/conf.c.
+ */
+char rom2mdev[] = {
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,       /* 0-13: none */
+       4,      /* 14: SCSI disk */
+       0,      /* 15: none */
+       2,      /* 16: CS/80 device on HPIB */
+       2,      /* 17: CS/80 device on HPIB */
+       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,       /* 18-31: none */
+};
 
 struct hp_hw sc_table[MAXCTLRS];
 
 struct hp_hw sc_table[MAXCTLRS];
+int cpuspeed;
 
 extern int internalhpib;
 
 #if 0
 
 extern int internalhpib;
 
 #if 0
-#include "rominfo.h"
 printrominfo()
 {
        struct rominfo *rp = (struct rominfo *)ROMADDR;
 printrominfo()
 {
        struct rominfo *rp = (struct rominfo *)ROMADDR;
+
        printf("boottype %x, name %s, lowram %x, sysflag %x\n",
               rp->boottype, rp->name, rp->lowram, rp->sysflag&0xff);
        printf("rambase %x, ndrives %x, sysflag2 %x, msus %x\n",
        printf("boottype %x, name %s, lowram %x, sysflag %x\n",
               rp->boottype, rp->name, rp->lowram, rp->sysflag&0xff);
        printf("rambase %x, ndrives %x, sysflag2 %x, msus %x\n",
@@ -38,6 +54,31 @@ printrominfo()
 
 configure()
 {
 
 configure()
 {
+       u_long msustobdev();
+
+       switch (machineid) {
+       case HP_320:
+       case HP_330:
+       case HP_340:
+               cpuspeed = MHZ_16;
+               break;
+       case HP_350:
+       case HP_360:
+               cpuspeed = MHZ_25;
+               break;
+       case HP_370:
+               cpuspeed = MHZ_33;
+               break;
+       case HP_375:
+               cpuspeed = MHZ_50;
+               break;
+       case HP_380:
+               cpuspeed = MHZ_25 * 2;  /* XXX */
+               break;
+       default:        /* assume the slowest */
+               cpuspeed = MHZ_16;
+               break;
+       }
        find_devs();
        cninit();
 #if 0
        find_devs();
        cninit();
 #if 0
@@ -45,6 +86,41 @@ configure()
 #endif
        hpibinit();
        scsiinit();
 #endif
        hpibinit();
        scsiinit();
+       if ((bootdev & B_MAGICMASK) != B_DEVMAGIC)
+               bootdev = msustobdev();
+}
+
+/*
+ * Convert HP MSUS to a valid bootdev layout:
+ *     TYPE comes from MSUS device type as mapped by rom2mdev
+ *     PARTITION is set to 0 ('a')
+ *     UNIT comes from MSUS unit (almost always 0)
+ *     CONTROLLER comes from MSUS primary address
+ *     ADAPTOR comes from SCSI/HPIB driver logical unit number
+ *             (passed back via unused hw_pa field)
+ */
+u_long
+msustobdev()
+{
+       struct rominfo *rp = (struct rominfo *) ROMADDR;
+       u_long bdev = 0;
+       register struct hp_hw *hw;
+       int sc;
+
+       sc = (rp->msus >> 8) & 0xFF;
+       for (hw = sc_table; hw < &sc_table[MAXCTLRS]; hw++)
+               if (hw->hw_sc == sc)
+                       break;
+       bdev |= rom2mdev[(rp->msus >> 24) & 0x1F] << B_TYPESHIFT;
+       bdev |= 0 << B_PARTITIONSHIFT;
+       bdev |= ((rp->msus >> 16) & 0xFF) << B_UNITSHIFT;
+       bdev |= (rp->msus & 0xFF) << B_CONTROLLERSHIFT;
+       bdev |= (int)hw->hw_pa << B_ADAPTORSHIFT;
+       bdev |= B_DEVMAGIC;
+#if 0
+       printf("msus %x -> bdev %x\n", rp->msus, bdev);
+#endif
+       return (bdev);
 }
 
 sctoaddr(sc)
 }
 
 sctoaddr(sc)
@@ -73,7 +149,6 @@ find_devs()
        u_char *id_reg;
        register caddr_t addr;
        register struct hp_hw *hw;
        u_char *id_reg;
        register caddr_t addr;
        register struct hp_hw *hw;
-       extern int machineid;
 
        hw = sc_table;
        sctop = machineid == HP_320 ? 32 : 256;
 
        hw = sc_table;
        sctop = machineid == HP_320 ? 32 : 256;
@@ -85,7 +160,7 @@ find_devs()
                        continue;
 
                id_reg = (u_char *) addr;
                        continue;
 
                id_reg = (u_char *) addr;
-               hw->hw_pa = addr;
+               hw->hw_pa = 0;  /* XXX used to pass back LUN from driver */
                if (sc >= 132)
                        hw->hw_size = (id_reg[0x101] + 1) * 0x100000;
                else
                if (sc >= 132)
                        hw->hw_size = (id_reg[0x101] + 1) * 0x100000;
                else
index 8fc9103..2fb2ba9 100644 (file)
@@ -4,11 +4,11 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)boot.c      7.4 (Berkeley) %G%
+ *     @(#)boot.c      7.5 (Berkeley) %G%
  */
 
  */
 
-#include <sys/param.h>
-#include <sys/reboot.h>
+#include "sys/param.h"
+#include "sys/reboot.h"
 #include <a.out.h>
 #include "saio.h"
 
 #include <a.out.h>
 #include "saio.h"
 
 #include "sys/stat.h"
 struct stat sb;
 #endif
 #include "sys/stat.h"
 struct stat sb;
 #endif
-                                       /* XXX -- see sys/reboot.h */
-#define B_MAKEDEV(a,u,p,t) \
-       (((a) << B_ADAPTORSHIFT) | ((u) << B_UNITSHIFT) | \
-        ((p) << B_PARTITIONSHIFT) | ((t) << B_TYPESHIFT))
+
+#define        PRTCPU          /* print out cpu type */
 
 /*
 
 /*
- * Boot program... arguments in `devtype' and `howto' determine
- * whether boot stops to ask for system name and which device
- * boot comes from.
+ * Boot program... bits in `howto' determine whether boot stops to
+ * ask for system name.  Boot device is derived from ROM provided
+ * information.
  */
 
  */
 
-/* Types in `devtype' specifying major device */
-char   devname[][2] = {
-       '\0', '\0',     /* 0 = ct */
-       '\0', '\0',     /* 1 = fd */
-        'r',  'd',     /* 2 = rd */
-       '\0', '\0',     /* 3 = sw */
-        's',  'd',     /* 4 = sd */
-};
-#define        MAXTYPE (sizeof(devname) / sizeof(devname[0]))
-
 char line[100];
 
 char line[100];
 
-int    retry = 0;
+extern unsigned opendev;
 extern char *lowram;
 extern int noconsole;
 extern char *lowram;
 extern int noconsole;
-extern int howto, devtype;
-
-#define        MSUS (0xfffffedc)
+extern int howto, bootdev;
 
 
-char rom2mdev[] = {
-       0,      /*  0 - none */
-       0,      /*  1 - none */
-       0,      /*  2 - none */
-       0,      /*  3 - none */
-       0,      /*  4 - none */
-       0,      /*  5 - none */
-       0,      /*  6 - none */
-       0,      /*  7 - none */
-       0,      /*  8 - none */
-       0,      /*  9 - none */
-       0,      /* 10 - none */
-       0,      /* 11 - none */
-       0,      /* 12 - none */
-       0,      /* 13 - none */
-       4,      /* 14 - SCSI disk */
-       0,      /* 15 - none */
-       2,      /* 16 - CS/80 device on HPIB */
-       2,      /* 17 - CS/80 device on HPIB */
-       0,      /* 18 - none */
-       0,      /* 19 - none */
-       0,      /* 20 - none */
-       0,      /* 21 - none */
-       0,      /* 22 - none */
-       0,      /* 23 - none */
-       0,      /* 24 - none */
-       0,      /* 25 - none */
-       0,      /* 26 - none */
-       0,      /* 27 - none */
-       0,      /* 28 - none */
-       0,      /* 29 - none */
-       0,      /* 30 - none */
-       0,      /* 31 - none */
-};
+#ifdef PRTCPU
+#include "samachdep.h"
+#endif
 
 main()
 {
 
 main()
 {
-       register type, part, unit, io;
        register char *cp;
        register char *cp;
+       int io, retry, type;
+#ifdef PRTCPU
+       extern int machineid;
 
 
+       printf("\nHP");
+       switch (machineid) {
+       case HP_320:
+               cp = "320"; break;
+       case HP_330:
+               cp = "318/319/330"; break;
+       case HP_340:
+               cp = "340"; break;
+       case HP_350:
+               cp = "350"; break;
+       case HP_360:
+               cp = "360"; break;
+       case HP_370:
+               cp = "370"; break;
+       case HP_375:
+               cp = "345/375/400"; break;
+       case HP_380:
+               cp = "380/425"; break;
+       default:
+               cp = "???"; break;
+       }
+       printf("%s CPU\nBoot\n", cp);
+#else
        printf("\nBoot\n");
        printf("\nBoot\n");
+#endif
 #ifdef JUSTASK
        howto = RB_ASKNAME|RB_SINGLE;
 #else
 #ifdef JUSTASK
        howto = RB_ASKNAME|RB_SINGLE;
 #else
-       type = (devtype >> B_TYPESHIFT) & B_TYPEMASK;
-       unit = (devtype >> B_UNITSHIFT) & B_UNITMASK;
-       unit += 8 * ((devtype >> B_ADAPTORSHIFT) & B_ADAPTORMASK);
-       part = (devtype >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
        if ((howto & RB_ASKNAME) == 0) {
        if ((howto & RB_ASKNAME) == 0) {
-               if ((devtype & B_MAGICMASK) != B_DEVMAGIC) {
-                       /*
-                        * we have to map the ROM device type codes
-                        * to Unix major device numbers.
-                        */
-                       type = rom2mdev[*(char *)MSUS & 0x1f];
-                       devtype = (devtype &~ (B_TYPEMASK << B_TYPESHIFT))
-                                 | (type << B_TYPESHIFT);
-               }
-               if (type >= 0 && type <= MAXTYPE && devname[type][0]) {
-                       cp = line;
-                       *cp++ = devname[type][0];
-                       *cp++ = devname[type][1];
-                       *cp++ = '(';
-                       if (unit >= 10)
-                               *cp++ = unit / 10 + '0';
-                       *cp++ = unit % 10 + '0';
-                       *cp++ = ',';
-                       *cp++ = part + '0';
-                       *cp++ = ')';
-                       strcpy(cp, UNIX);
-               } else
-                       howto = RB_SINGLE|RB_ASKNAME;
+               type = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
+               if ((unsigned)type < ndevs && devsw[type].dv_name)
+                       strcpy(line, UNIX);
+               else
+                       howto |= RB_SINGLE|RB_ASKNAME;
        }
 #endif
        }
 #endif
-       for (;;) {
+       for (retry = 0;;) {
                if (!noconsole && (howto & RB_ASKNAME)) {
                        printf(": ");
                        gets(line);
                if (!noconsole && (howto & RB_ASKNAME)) {
                        printf(": ");
                        gets(line);
+                       if (line[0] == 0) {
+                               strcpy(line, UNIX);
+                               printf(": %s\n", line);
+                       }
                } else
                        printf(": %s\n", line);
                io = open(line, 0);
                } else
                        printf(": %s\n", line);
                io = open(line, 0);
@@ -132,64 +95,45 @@ main()
                        (void) fstat(io, &sb);
                        if (sb.st_uid || (sb.st_mode & 2)) {
                                printf("non-secure file, will not load\n");
                        (void) fstat(io, &sb);
                        if (sb.st_uid || (sb.st_mode & 2)) {
                                printf("non-secure file, will not load\n");
+                               close(io);
                                howto = RB_SINGLE|RB_ASKNAME;
                                continue;
                        }
 #endif
                                howto = RB_SINGLE|RB_ASKNAME;
                                continue;
                        }
 #endif
-                       if (howto & RB_ASKNAME) {
-                               /*
-                                * Build up devtype register to pass on to
-                                * booted program.
-                                */ 
-                               cp = line;
-                               for (type = 0; type <= MAXTYPE; type++)
-                                       if ((devname[type][0] == cp[0]) && 
-                                           (devname[type][1] == cp[1]))
-                                               break;
-                               if (type <= MAXTYPE) {
-                                       cp += 3;
-                                       unit = *cp++ - '0';
-                                       if (*cp >= '0' && *cp <= '9')
-                                               unit = unit * 10 + *cp++ - '0';
-                                       cp++;
-                                       part = atol(cp);
-                                       devtype = B_MAKEDEV(unit >> 3, unit & 7, part, type);
-                               }
-                       }
-                       devtype |= B_DEVMAGIC;
-                       copyunix(howto, devtype, io);
+                       copyunix(howto, opendev, io);
                        close(io);
                        close(io);
-                       howto = RB_SINGLE|RB_ASKNAME;
+                       howto |= RB_SINGLE|RB_ASKNAME;
                }
                }
-       bad:
                if (++retry > 2)
                if (++retry > 2)
-                       howto = RB_SINGLE|RB_ASKNAME;
+                       howto |= RB_SINGLE|RB_ASKNAME;
        }
 }
 
 /*ARGSUSED*/
 copyunix(howto, devtype, io)
        }
 }
 
 /*ARGSUSED*/
 copyunix(howto, devtype, io)
-       register howto;         /* d7 contains boot flags */
-       register devtype;       /* d6 contains boot device */
-       register io;
+       register int howto;     /* d7 contains boot flags */
+       register u_int devtype; /* d6 contains boot device */
+       register int io;
 {
        struct exec x;
        register int i;
        register char *load;    /* a5 contains load addr for unix */
        register char *addr;
 
 {
        struct exec x;
        register int i;
        register char *load;    /* a5 contains load addr for unix */
        register char *addr;
 
-       i = read(io, (char *)&x, sizeof x);
-       if (i != sizeof x ||
-           (x.a_magic != 0407 && x.a_magic != 0413 && x.a_magic != 0410))
-               _stop("Bad format\n");
+       i = read(io, (char *)&x, sizeof(x));
+       if (i != sizeof(x) ||
+           (x.a_magic != OMAGIC && x.a_magic != ZMAGIC && x.a_magic != NMAGIC)) {
+               printf("Bad format\n");
+               return;
+       }
        printf("%d", x.a_text);
        printf("%d", x.a_text);
-       if (x.a_magic == 0413 && lseek(io, 0x400, 0) == -1)
+       if (x.a_magic == ZMAGIC && lseek(io, 0x400, L_SET) == -1)
                goto shread;
        load = addr = lowram;
        if (read(io, (char *)addr, x.a_text) != x.a_text)
                goto shread;
        addr += x.a_text;
                goto shread;
        load = addr = lowram;
        if (read(io, (char *)addr, x.a_text) != x.a_text)
                goto shread;
        addr += x.a_text;
-       if (x.a_magic == 0413 || x.a_magic == 0410)
+       if (x.a_magic == ZMAGIC || x.a_magic == NMAGIC)
                while ((int)addr & CLOFSET)
                        *addr++ = 0;
        printf("+%d", x.a_data);
                while ((int)addr & CLOFSET)
                        *addr++ = 0;
        printf("+%d", x.a_data);
@@ -208,7 +152,8 @@ copyunix(howto, devtype, io)
        asm("   movl %0,a5" : : "a" (load));
 #endif
        (*((int (*)()) x.a_entry))();
        asm("   movl %0,a5" : : "a" (load));
 #endif
        (*((int (*)()) x.a_entry))();
-       exit();
+       return;
 shread:
 shread:
-       _stop("Short read\n");
+       printf("Short read\n");
+       return;
 }
 }
index 74a9f85..304a5a1 100644 (file)
@@ -4,18 +4,22 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)conf.c      7.3 (Berkeley) %G%
+ *     @(#)conf.c      7.4 (Berkeley) %G%
  */
 
  */
 
-#include <sys/param.h>
+#include "sys/param.h"
 #include "saio.h"
 
 extern int     nullsys(), nodev(), noioctl();
 
 #include "saio.h"
 
 extern int     nullsys(), nodev(), noioctl();
 
-#ifndef BOOT
+#ifdef BOOT
+#define        ctstrategy      nullsys
+#define        ctopen          nodev
+#define        ctclose         nullsys
+#else
 int    ctstrategy(), ctopen(), ctclose();
 int    ctstrategy(), ctopen(), ctclose();
-#define        ctioctl noioctl
 #endif
 #endif
+#define        ctioctl noioctl
 
 int    rdstrategy(), rdopen();
 #define        rdioctl noioctl
 
 int    rdstrategy(), rdopen();
 #define        rdioctl noioctl
@@ -25,12 +29,24 @@ int sdstrategy(), sdopen();
 
 
 struct devsw devsw[] = {
 
 
 struct devsw devsw[] = {
-       { "rd", rdstrategy,     rdopen, nullsys, noioctl },     /* 0 = rd */
-       { "sd", sdstrategy,     sdopen, nullsys, noioctl },     /* 1 = sd */
-#ifndef BOOT
-       { "ct", ctstrategy,     ctopen, ctclose, noioctl },     /* 2 = ct */
-#endif
-       { NULL },
+       { "ct", ctstrategy,     ctopen, ctclose,        ctioctl }, /*0*/
+       { "??", nullsys,        nodev,  nullsys,        noioctl }, /*1*/
+       { "rd", rdstrategy,     rdopen, nullsys,        rdioctl }, /*2*/
+       { "??", nullsys,        nodev,  nullsys,        noioctl }, /*3*/
+       { "sd", sdstrategy,     sdopen, nullsys,        sdioctl }, /*4*/
 };
 
 int    ndevs = (sizeof(devsw)/sizeof(devsw[0]));
 };
 
 int    ndevs = (sizeof(devsw)/sizeof(devsw[0]));
+
+/*
+ * Convert old style unit syntax into adaptor/controller/unit
+ */
+devconvert(io)
+       register struct iob *io;
+{
+       if (io->i_unit == 0 || io->i_adapt || io->i_ctlr)
+               return;
+       io->i_adapt = io->i_unit / 8;
+       io->i_ctlr = io->i_unit % 8;
+       io->i_unit = 0;
+}
index ec9a670..4190202 100644 (file)
@@ -9,14 +9,14 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- * from: Utah $Hdr: cons.c 1.5 89/08/22$
+ * from: Utah $Hdr: cons.c 1.7 92/02/28$
  *
  *
- *     @(#)cons.c      7.4 (Berkeley) %G%
+ *     @(#)cons.c      7.5 (Berkeley) %G%
  */
 
 #include "sys/param.h"
 #include "samachdep.h"
  */
 
 #include "sys/param.h"
 #include "samachdep.h"
-#include "../hp300/cons.h"
+#include "../hp/dev/cons.h"
 
 #ifdef ITECONSOLE
 int    iteprobe(), iteinit(), itegetchar(), iteputchar();
 
 #ifdef ITECONSOLE
 int    iteprobe(), iteinit(), itegetchar(), iteputchar();
@@ -72,6 +72,13 @@ cngetc()
 cnputc(c)
        int c;
 {
 cnputc(c)
        int c;
 {
+#ifdef ROMPRF
+       extern int userom;
+
+       if (userom)
+               romputchar(c);
+       else
+#endif
        if (cn_tab)
                (*cn_tab->cn_putc)(c);
 }
        if (cn_tab)
                (*cn_tab->cn_putc)(c);
 }
index d983835..6dbc433 100644 (file)
@@ -4,13 +4,13 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ct.c        7.3 (Berkeley) %G%
+ *     @(#)ct.c        7.4 (Berkeley) %G%
  */
 
 /*
  * CS80 tape driver
  */
  */
 
 /*
  * CS80 tape driver
  */
-#include <sys/param.h>
+#include "sys/param.h"
 #include "../dev/ctreg.h"
 
 #include "saio.h"
 #include "../dev/ctreg.h"
 
 #include "saio.h"
@@ -26,7 +26,7 @@ struct        ct_softc {
        char    sc_alive;
        short   sc_punit;
        int     sc_blkno;
        char    sc_alive;
        short   sc_punit;
        int     sc_blkno;
-} ct_softc[NCT];
+} ct_softc[NHPIB][NCT];
 
 #define        CTRETRY         5
 #define        MTFSF           10
 
 #define        CTRETRY         5
 #define        MTFSF           10
@@ -44,16 +44,16 @@ struct      ctinfo {
 };
 int    nctinfo = sizeof(ctinfo) / sizeof(ctinfo[0]);
 
 };
 int    nctinfo = sizeof(ctinfo) / sizeof(ctinfo[0]);
 
-ctinit(unit)
-       register int unit;
+ctinit(ctlr, unit)
+       register int ctlr, unit;
 {
 {
-       register struct ct_softc *rs = &ct_softc[unit];
+       register struct ct_softc *rs = &ct_softc[ctlr][unit];
        u_char stat;
        register int type;
 
        u_char stat;
        register int type;
 
-       if (hpibrecv(unit, C_QSTAT, &stat, 1) != 1 || stat)
+       if (hpibrecv(ctlr, unit, C_QSTAT, &stat, 1) != 1 || stat)
                return (0);
                return (0);
-       if (ctident(unit) < 0)
+       if (ctident(ctlr, unit) < 0)
                return (0);
        ct_ssmc.unit = C_SUNIT(rs->sc_punit);
        ct_ssmc.cmd = C_SSM;
                return (0);
        ct_ssmc.unit = C_SUNIT(rs->sc_punit);
        ct_ssmc.cmd = C_SSM;
@@ -61,22 +61,22 @@ ctinit(unit)
        ct_ssmc.refm = REF_MASK;
        ct_ssmc.aefm = AEF_MASK;
        ct_ssmc.iefm = IEF_MASK;
        ct_ssmc.refm = REF_MASK;
        ct_ssmc.aefm = AEF_MASK;
        ct_ssmc.iefm = IEF_MASK;
-       hpibsend(unit, C_CMD, &ct_ssmc, sizeof(ct_ssmc));
-       hpibswait(unit);
-       hpibrecv(unit, C_QSTAT, &stat, 1);
+       hpibsend(ctlr, unit, C_CMD, &ct_ssmc, sizeof(ct_ssmc));
+       hpibswait(ctlr, unit);
+       hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
        rs->sc_alive = 1;
        return (1);
 }
 
        rs->sc_alive = 1;
        return (1);
 }
 
-ctident(unit)
-       int unit;
+ctident(ctlr, unit)
+       int ctlr, unit;
 {
        struct ct_describe desc;
        u_char stat, cmd[3];
        char name[7];
        int id, i;
 
 {
        struct ct_describe desc;
        u_char stat, cmd[3];
        char name[7];
        int id, i;
 
-       id = hpibid(unit);
+       id = hpibid(ctlr, unit);
        if ((id & 0x200) == 0)
                return(-1);
        for (i = 0; i < nctinfo; i++)
        if ((id & 0x200) == 0)
                return(-1);
        for (i = 0; i < nctinfo; i++)
@@ -84,7 +84,7 @@ ctident(unit)
                        break;
        if (i == nctinfo)
                return(-1);
                        break;
        if (i == nctinfo)
                return(-1);
-       ct_softc[unit].sc_punit = ctinfo[i].punit;
+       ct_softc[ctlr][unit].sc_punit = ctinfo[i].punit;
        id = i;
 
        /*
        id = i;
 
        /*
@@ -95,9 +95,9 @@ ctident(unit)
        cmd[0] = C_SUNIT(0);
        cmd[1] = C_SVOL(0);
        cmd[2] = C_DESC;
        cmd[0] = C_SUNIT(0);
        cmd[1] = C_SVOL(0);
        cmd[2] = C_DESC;
-       hpibsend(unit, C_CMD, cmd, sizeof(cmd));
-       hpibrecv(unit, C_EXEC, &desc, 37);
-       hpibrecv(unit, C_QSTAT, &stat, sizeof(stat));
+       hpibsend(ctlr, unit, C_CMD, cmd, sizeof(cmd));
+       hpibrecv(ctlr, unit, C_EXEC, &desc, 37);
+       hpibrecv(ctlr, unit, C_QSTAT, &stat, sizeof(stat));
        bzero(name, sizeof(name));
        if (!stat) {
                register int n = desc.d_name;
        bzero(name, sizeof(name));
        if (!stat) {
                register int n = desc.d_name;
@@ -120,17 +120,23 @@ ctident(unit)
 ctopen(io)
        struct iob *io;
 {
 ctopen(io)
        struct iob *io;
 {
-       register int unit = io->i_unit;
-       register struct ct_softc *rs = &ct_softc[unit];
+       register struct ct_softc *rs;
+       register int unit, ctlr;
        register int skip;
 
        register int skip;
 
-       if (hpibalive(unit) == 0)
-               _stop("ct controller not configured");
+       devconvert(io);
+
+       ctlr = io->i_adapt;
+       if (ctlr >= NHPIB || hpibalive(ctlr) == 0)
+               return(EADAPT);
+       unit = io->i_ctlr;
+       if (unit >= NCT)
+               return(ECTLR);
        if (rs->sc_alive == 0)
        if (rs->sc_alive == 0)
-               if (ctinit(unit) == 0)
-                       _stop("ct init failed");
+               if (ctinit(ctlr, unit) == 0)
+                       return(ENXIO);
        ctstrategy(io, MTREW);
        ctstrategy(io, MTREW);
-       skip = io->i_boff;
+       skip = io->i_part;
        while (skip--)
                ctstrategy(io, MTFSF);
 }
        while (skip--)
                ctstrategy(io, MTFSF);
 }
@@ -145,8 +151,9 @@ ctstrategy(io, func)
        register struct iob *io;
        register int func;
 {
        register struct iob *io;
        register int func;
 {
-       register int unit = io->i_unit;
-       register struct ct_softc *rs = &ct_softc[unit];
+       register int ctlr = io->i_adapt;
+       register int unit = io->i_ctlr;
+       register struct ct_softc *rs = &ct_softc[ctlr][unit];
        char stat;
 
        rs->sc_retry = 0;
        char stat;
 
        rs->sc_retry = 0;
@@ -180,28 +187,26 @@ top:
                io->i_cc = 0;
        }
 retry:
                io->i_cc = 0;
        }
 retry:
-       hpibsend(unit, C_CMD, &ct_ioc, sizeof(ct_ioc));
+       hpibsend(ctlr, unit, C_CMD, &ct_ioc, sizeof(ct_ioc));
        if (func != MTREW) {
        if (func != MTREW) {
-               hpibswait(unit);
-               hpibgo(unit, C_EXEC, io->i_ma, io->i_cc,
+               hpibswait(ctlr, unit);
+               hpibgo(ctlr, unit, C_EXEC, io->i_ma, io->i_cc,
                        func != F_WRITE ? F_READ : F_WRITE);
                        func != F_WRITE ? F_READ : F_WRITE);
-               hpibswait(unit);
-       }
-       else {
-               while (hpibswait(unit) < 0)
+               hpibswait(ctlr, unit);
+       } else {
+               while (hpibswait(ctlr, unit) < 0)
                        ;
        }
                        ;
        }
-       hpibrecv(unit, C_QSTAT, &stat, 1);
+       hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
        if (stat) {
        if (stat) {
-               stat = cterror(unit);
+               stat = cterror(ctlr, unit);
                if (stat == 0)
                        return (-1);
                if (stat == 2)
                        return (0);
                if (++rs->sc_retry > CTRETRY)
                        return (-1);
                if (stat == 0)
                        return (-1);
                if (stat == 2)
                        return (0);
                if (++rs->sc_retry > CTRETRY)
                        return (-1);
-               else
-                       goto retry;
+               goto retry;
        }
        rs->sc_blkno += CTBTOK(io->i_cc);
        if (func == MTFSF)
        }
        rs->sc_blkno += CTBTOK(io->i_cc);
        if (func == MTFSF)
@@ -209,27 +214,27 @@ retry:
        return (io->i_cc);
 }
 
        return (io->i_cc);
 }
 
-cterror(unit)
-       register int unit;
+cterror(ctlr, unit)
+       register int ctlr, unit;
 {
 {
-       register struct ct_softc *ct = &ct_softc[unit];
+       register struct ct_softc *rs = &ct_softc[ctlr][unit];
        char stat;
 
        char stat;
 
-       ct_rsc.unit = C_SUNIT(ct->sc_punit);
+       ct_rsc.unit = C_SUNIT(rs->sc_punit);
        ct_rsc.cmd = C_STATUS;
        ct_rsc.cmd = C_STATUS;
-       hpibsend(unit, C_CMD, &ct_rsc, sizeof(ct_rsc));
-       hpibrecv(unit, C_EXEC, &ct_stat, sizeof(ct_stat));
-       hpibrecv(unit, C_QSTAT, &stat, 1);
+       hpibsend(ctlr, unit, C_CMD, &ct_rsc, sizeof(ct_rsc));
+       hpibrecv(ctlr, unit, C_EXEC, &ct_stat, sizeof(ct_stat));
+       hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
        if (stat) {
                printf("ct%d: request status fail %d\n", unit, stat);
                return(0);
        }
        if (ct_stat.c_aef & AEF_EOF) {
                /* 9145 drives don't increment block number at EOF */
        if (stat) {
                printf("ct%d: request status fail %d\n", unit, stat);
                return(0);
        }
        if (ct_stat.c_aef & AEF_EOF) {
                /* 9145 drives don't increment block number at EOF */
-               if ((ct_stat.c_blk - ct->sc_blkno) == 0)
-                       ct->sc_blkno++;
+               if ((ct_stat.c_blk - rs->sc_blkno) == 0)
+                       rs->sc_blkno++;
                else
                else
-                       ct->sc_blkno = ct_stat.c_blk;
+                       rs->sc_blkno = ct_stat.c_blk;
                return (2);
        }
        printf("ct%d err: vu 0x%x, pend 0x%x, bn%d", unit,
                return (2);
        }
        printf("ct%d err: vu 0x%x, pend 0x%x, bn%d", unit,
index 253195a..c340eb5 100644 (file)
@@ -9,14 +9,14 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)dca.c       7.3 (Berkeley) %G%
+ *     @(#)dca.c       7.4 (Berkeley) %G%
  */
 
 #ifdef DCACONSOLE
 #include "sys/param.h"
  */
 
 #ifdef DCACONSOLE
 #include "sys/param.h"
-#include "../dev/dcareg.h"
+#include "hp/dev/dcareg.h"
 #include "../include/cpu.h"
 #include "../include/cpu.h"
-#include "../hp300/cons.h"
+#include "hp/dev/cons.h"
 
 struct dcadevice *dcacnaddr = 0;
 
 
 struct dcadevice *dcacnaddr = 0;
 
@@ -30,8 +30,11 @@ dcaprobe(cp)
                cp->cn_pri = CN_DEAD;
                return;
        }
                cp->cn_pri = CN_DEAD;
                return;
        }
+#ifdef FORCEDCACONSOLE
+       cp->cn_pri = CN_REMOTE;
+#else
        dca = dcacnaddr;
        dca = dcacnaddr;
-       switch (dca->dca_irid) {
+       switch (dca->dca_id) {
        case DCAID0:
        case DCAID1:
                cp->cn_pri = CN_NORMAL;
        case DCAID0:
        case DCAID1:
                cp->cn_pri = CN_NORMAL;
@@ -44,6 +47,7 @@ dcaprobe(cp)
                cp->cn_pri = CN_DEAD;
                break;
        }
                cp->cn_pri = CN_DEAD;
                break;
        }
+#endif
 }
 
 dcainit(cp)
 }
 
 dcainit(cp)
@@ -51,7 +55,7 @@ dcainit(cp)
 {
        register struct dcadevice *dca = dcacnaddr;
 
 {
        register struct dcadevice *dca = dcacnaddr;
 
-       dca->dca_irid = 0xFF;
+       dca->dca_reset = 0xFF;
        DELAY(100);
        dca->dca_ic = 0;
        dca->dca_cfcr = CFCR_DLAB;
        DELAY(100);
        dca->dca_ic = 0;
        dca->dca_cfcr = CFCR_DLAB;
index 6c85d46..829ff85 100644 (file)
@@ -9,13 +9,13 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)dcm.c       7.3 (Berkeley) %G%
+ *     @(#)dcm.c       7.4 (Berkeley) %G%
  */
 
 #ifdef DCMCONSOLE
 #include "sys/param.h"
  */
 
 #ifdef DCMCONSOLE
 #include "sys/param.h"
-#include "../hp300/cons.h"
-#include "../dev/device.h"
+#include "hp/dev/cons.h"
+#include "hp/dev/device.h"
 #include "../dev/dcmreg.h"
 
 struct dcmdevice *dcmcnaddr = NULL;
 #include "../dev/dcmreg.h"
 
 struct dcmdevice *dcmcnaddr = NULL;
index 1b3611f..49e5819 100644 (file)
@@ -11,7 +11,7 @@
  *
  * from: Utah $Hdr: hil.c 1.1 89/08/22$
  *
  *
  * from: Utah $Hdr: hil.c 1.1 89/08/22$
  *
- *     @(#)hil.c       7.2 (Berkeley) %G%
+ *     @(#)hil.c       7.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -22,9 +22,9 @@
 #ifdef ITECONSOLE
 
 #include "sys/param.h"
 #ifdef ITECONSOLE
 
 #include "sys/param.h"
-#include "../dev/hilreg.h"
-#include "../dev/kbdmap.h"
-#include "../dev/itevar.h"
+#include "hp/dev/hilreg.h"
+#include "hp/dev/kbdmap.h"
+#include "hp/dev/itevar.h"
 
 #ifndef SMALL
 
 
 #ifndef SMALL
 
index 6b796da..a1f5b36 100644 (file)
@@ -4,15 +4,15 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)hpib.c      7.5 (Berkeley) %G%
+ *     @(#)hpib.c      7.6 (Berkeley) %G%
  */
 
 /*
  * HPIB driver
  */
  */
 
 /*
  * HPIB driver
  */
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include "../dev/device.h"
+#include "sys/param.h"
+#include "sys/reboot.h"
+#include "hp/dev/device.h"
 #include "hpibvar.h"
 
 #include "saio.h"
 #include "hpibvar.h"
 
 #include "saio.h"
@@ -23,17 +23,13 @@ int fhpibppoll(), nhpibppoll();
 
 struct hpib_softc hpib_softc[NHPIB];
 
 
 struct hpib_softc hpib_softc[NHPIB];
 
-#define        hpibunit(x)     ((x) >> 3)
-#define        hpibslave(x)    ((x) & 7)
-
 hpibinit()
 {
        extern struct hp_hw sc_table[];
        register struct hp_hw *hw;
        register struct hpib_softc *hs;
        register int i, addr;
 hpibinit()
 {
        extern struct hp_hw sc_table[];
        register struct hp_hw *hw;
        register struct hpib_softc *hs;
        register int i, addr;
-       static int first = 1;
-       
+
        i = 0;
        for (hw = sc_table; i < NHPIB && hw < &sc_table[MAXCTLRS]; hw++) {
                if (!HW_ISHPIB(hw))
        i = 0;
        for (hw = sc_table; i < NHPIB && hw < &sc_table[MAXCTLRS]; hw++) {
                if (!HW_ISHPIB(hw))
@@ -45,14 +41,7 @@ hpibinit()
                                continue;
                if (howto & RB_ASKNAME)
                        printf("hpib%d at sc%d\n", i, hw->hw_sc);
                                continue;
                if (howto & RB_ASKNAME)
                        printf("hpib%d at sc%d\n", i, hw->hw_sc);
-               /*
-                * Adjust devtype on first call.  This routine assumes that
-                * adaptor is in the high byte of devtype.
-                */
-               if (first && ((devtype >> 24) & 0xff) == hw->hw_sc) {
-                       devtype = (devtype & 0x00ffffff) | (i << 24);
-                       first = 0;
-               }
+               hw->hw_pa = (caddr_t) i;        /* XXX for autoconfig */
                hs->sc_alive = 1;
                i++;
        }
                hs->sc_alive = 1;
                i++;
        }
@@ -61,68 +50,53 @@ hpibinit()
 hpibalive(unit)
        register int unit;
 {
 hpibalive(unit)
        register int unit;
 {
-       unit = hpibunit(unit);
        if (unit >= NHPIB || hpib_softc[unit].sc_alive == 0)
                return (0);
        return (1);
 }
 
        if (unit >= NHPIB || hpib_softc[unit].sc_alive == 0)
                return (0);
        return (1);
 }
 
-hpibid(unit)
-       register int unit;
+hpibid(unit, slave)
+       int unit, slave;
 {
 {
-       register struct hpib_softc *hs = &hpib_softc[hpibunit(unit)];
-       register int slave;
        short id;
        short id;
+       int rv;
 
 
-       slave = hpibslave(unit);
-       unit = hpibunit(unit);
-       if (hs->sc_type == HPIBC)
-               slave = fhpibrecv(unit, 31, slave, &id, 2);
+       if (hpib_softc[unit].sc_type == HPIBC)
+               rv = fhpibrecv(unit, 31, slave, &id, 2);
        else
        else
-               slave = nhpibrecv(unit, 31, slave, &id, 2);
-       if (slave != 2)
+               rv = nhpibrecv(unit, 31, slave, &id, 2);
+       if (rv != 2)
                return (0);
        return (id);
 }
 
                return (0);
        return (id);
 }
 
-hpibsend(unit, sec, buf, cnt)
-       register char *buf;
-       register int cnt;
+hpibsend(unit, slave, sec, buf, cnt)
+       int unit, slave;
+       char *buf;
+       int cnt;
 {
 {
-       register struct hpib_softc *hs = &hpib_softc[hpibunit(unit)];
-       register int slave;
-
-       slave = hpibslave(unit);
-       unit = hpibunit(unit);
-       if (hs->sc_type == HPIBC)
+       if (hpib_softc[unit].sc_type == HPIBC)
                return (fhpibsend(unit, slave, sec, buf, cnt));
                return (fhpibsend(unit, slave, sec, buf, cnt));
-       else
-               return (nhpibsend(unit, slave, sec, buf, cnt));
+       return (nhpibsend(unit, slave, sec, buf, cnt));
 }
 
 }
 
-hpibrecv(unit, sec, buf, cnt)
-       register char *buf;
-       register int cnt;
+hpibrecv(unit, slave, sec, buf, cnt)
+       int unit, slave;
+       char *buf;
+       int cnt;
 {
 {
-       register struct hpib_softc *hs = &hpib_softc[hpibunit(unit)];
-       register int slave;
-
-       slave = hpibslave(unit);
-       unit = hpibunit(unit);
-       if (hs->sc_type == HPIBC)
+       if (hpib_softc[unit].sc_type == HPIBC)
                return (fhpibrecv(unit, slave, sec, buf, cnt));
                return (fhpibrecv(unit, slave, sec, buf, cnt));
-       else
-               return (nhpibrecv(unit, slave, sec, buf, cnt));
+       return (nhpibrecv(unit, slave, sec, buf, cnt));
 }
 
 }
 
-hpibswait(unit)
-       register int unit;
+hpibswait(unit, slave)
+       register int unit, slave;
 {
        register int timo = 1000000;
 {
        register int timo = 1000000;
-       register int slave = 0x80 >> hpibslave(unit);
        register int (*poll)();
 
        register int (*poll)();
 
-       unit = hpibunit(unit);
+       slave = 0x80 >> slave;
        if (hpib_softc[unit].sc_type == HPIBC)
                poll = fhpibppoll;
        else
        if (hpib_softc[unit].sc_type == HPIBC)
                poll = fhpibppoll;
        else
@@ -135,14 +109,10 @@ hpibswait(unit)
        return (0);
 }
 
        return (0);
 }
 
-hpibgo(unit, sec, addr, count, flag)
-       register int unit;
+hpibgo(unit, slave, sec, addr, count, flag)
+       int unit, slave;
        char *addr;
 {
        char *addr;
 {
-       register int slave;
-
-       slave = hpibslave(unit);
-       unit = hpibunit(unit);
        if (hpib_softc[unit].sc_type == HPIBC)
                if (flag == F_READ)
                        fhpibrecv(unit, slave, sec, addr, count);
        if (hpib_softc[unit].sc_type == HPIBC)
                if (flag == F_READ)
                        fhpibrecv(unit, slave, sec, addr, count);
index e2d5919..0586b75 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)installboot.c       7.2 (Berkeley) %G%
+ *     @(#)installboot.c       7.3 (Berkeley) %G%
  */
 
 #ifndef lint
  */
 
 #ifndef lint
@@ -14,11 +14,11 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)installboot.c      7.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)installboot.c      7.2 (Berkeley) 12/16/90";
 #endif /* not lint */
 
 #include "sys/param.h"
 #endif /* not lint */
 
 #include "sys/param.h"
-#include "ufs/fs.h"
+#include "ufs/ffs/fs.h"
 
 char block[1024];
 int maxbootsize = 16 * 7 * 512;                /* XXX */
 
 char block[1024];
 int maxbootsize = 16 * 7 * 512;                /* XXX */
index 7e1927c..9019d80 100644 (file)
@@ -9,9 +9,9 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- * from: Utah $Hdr: ite.c 1.20 91/01/21$
+ * from: Utah $Hdr: ite.c 1.23 92/02/28$
  *
  *
- *     @(#)ite.c       7.3 (Berkeley) %G%
+ *     @(#)ite.c       7.4 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
 #ifdef ITECONSOLE
 
 #include "sys/param.h"
 #ifdef ITECONSOLE
 
 #include "sys/param.h"
-#include "../hp300/cons.h"
-#include "../dev/device.h"
-#include "../dev/itevar.h"
-#include "../dev/grfvar.h"
-
-int nodev();
-
-int topcat_init(), topcat_putc();
-int topcat_clear(), topcat_cursor(), topcat_scroll();
-int gatorbox_init(), gatorbox_clear();
-int gatorbox_putc(), gatorbox_cursor(), gatorbox_scroll();
-int rbox_init(), rbox_clear();
-int rbox_putc(), rbox_cursor(), rbox_scroll();
-int dvbox_init(), dvbox_clear();
-int dvbox_putc(), dvbox_cursor(), dvbox_scroll();
+#include "hp/dev/cons.h"
+#include "hp/dev/device.h"
+#include "hp/dev/itevar.h"
+#include "hp/dev/grfreg.h"
+
+extern int nodev();
+extern u_char ite_readbyte();
+extern int ite_writeglyph();
+
+extern int topcat_init(), topcat_putc();
+extern int topcat_clear(), topcat_cursor(), topcat_scroll();
+extern int gbox_init(), gbox_clear();
+extern int gbox_putc(), gbox_cursor(), gbox_scroll();
+extern int rbox_init(), rbox_clear();
+extern int rbox_putc(), rbox_cursor(), rbox_scroll();
+extern int dvbox_init(), dvbox_clear();
+extern int dvbox_putc(), dvbox_cursor(), dvbox_scroll();
+extern int hyper_init(), hyper_clear();
+extern int hyper_putc(), hyper_cursor(), hyper_scroll();
 
 struct itesw itesw[] = {
 
 struct itesw itesw[] = {
-       topcat_init,            nodev,                  topcat_clear,
-       topcat_putc,            topcat_cursor,          topcat_scroll,
-
-       gatorbox_init,          nodev,                  gatorbox_clear,
-       gatorbox_putc,          gatorbox_cursor,        gatorbox_scroll,
-
-       rbox_init,              nodev,                  rbox_clear,
-       rbox_putc,              rbox_cursor,            rbox_scroll,
-
-       dvbox_init,             nodev,                  dvbox_clear,
-       dvbox_putc,             dvbox_cursor,           dvbox_scroll,
+       GID_TOPCAT,
+       topcat_init,    nodev,          topcat_clear,   topcat_putc,
+       topcat_cursor,  topcat_scroll,  ite_readbyte,   ite_writeglyph,
+       GID_GATORBOX,
+       gbox_init,      nodev,          gbox_clear,     gbox_putc,
+       gbox_cursor,    gbox_scroll,    ite_readbyte,   ite_writeglyph,
+       GID_RENAISSANCE,
+       rbox_init,      nodev,          rbox_clear,     rbox_putc,
+       rbox_cursor,    rbox_scroll,    ite_readbyte,   ite_writeglyph,
+       GID_LRCATSEYE,
+       topcat_init,    nodev,          topcat_clear,   topcat_putc,
+       topcat_cursor,  topcat_scroll,  ite_readbyte,   ite_writeglyph,
+       GID_HRCCATSEYE,
+       topcat_init,    nodev,          topcat_clear,   topcat_putc,
+       topcat_cursor,  topcat_scroll,  ite_readbyte,   ite_writeglyph,
+       GID_HRMCATSEYE,
+       topcat_init,    nodev,          topcat_clear,   topcat_putc,
+       topcat_cursor,  topcat_scroll,  ite_readbyte,   ite_writeglyph,
+       GID_DAVINCI,
+       dvbox_init,     nodev,          dvbox_clear,    dvbox_putc,
+       dvbox_cursor,   dvbox_scroll,   ite_readbyte,   ite_writeglyph,
+       GID_HYPERION,
+       hyper_init,     nodev,          hyper_clear,    hyper_putc,
+       hyper_cursor,   hyper_scroll,   ite_readbyte,   ite_writeglyph,
 };
 };
+int    nitesw = sizeof(itesw) / sizeof(itesw[0]);
 
 /* these guys need to be in initialized data */
 int itecons = -1;
 
 /* these guys need to be in initialized data */
 int itecons = -1;
@@ -75,36 +93,26 @@ iteconfig()
                /* XXX: redundent but safe */
                if (badaddr((caddr_t)gr) || gr->gr_id != GRFHWID)
                        continue;
                /* XXX: redundent but safe */
                if (badaddr((caddr_t)gr) || gr->gr_id != GRFHWID)
                        continue;
-               switch (gr->gr_id2) {
-               case GID_GATORBOX:
-                       dtype = ITE_GATORBOX;
-                       break;
-               case GID_TOPCAT:
-               case GID_LRCATSEYE:
-               case GID_HRCCATSEYE:
-               case GID_HRMCATSEYE:
-                       dtype = ITE_TOPCAT;
-                       break;
-               case GID_RENAISSANCE:
-                       dtype = ITE_RENAISSANCE;
-                       break;
-               case GID_DAVINCI:
-                       dtype = ITE_DAVINCI;
-                       break;
-               default:
+               for (dtype = 0; dtype < nitesw; dtype++)
+                       if (itesw[dtype].ite_hwid == gr->gr_id2)
+                               break;
+               if (dtype == nitesw)
                        continue;
                        continue;
-               }
                if (i >= NITE)
                        break;
                ip = &ite_softc[i];
                if (i >= NITE)
                        break;
                ip = &ite_softc[i];
+               ip->isw = &itesw[dtype];
                ip->regbase = (caddr_t) gr;
                fboff = (gr->gr_fbomsb << 8) | gr->gr_fbolsb;
                ip->fbbase = (caddr_t) (*((u_char *)ip->regbase+fboff) << 16);
                /* DIO II: FB offset is relative to select code space */
                if (ip->regbase >= (caddr_t)DIOIIBASE)
                        ip->fbbase += (int)ip->regbase;
                ip->regbase = (caddr_t) gr;
                fboff = (gr->gr_fbomsb << 8) | gr->gr_fbolsb;
                ip->fbbase = (caddr_t) (*((u_char *)ip->regbase+fboff) << 16);
                /* DIO II: FB offset is relative to select code space */
                if (ip->regbase >= (caddr_t)DIOIIBASE)
                        ip->fbbase += (int)ip->regbase;
+               ip->fbwidth  = gr->gr_fbwidth_h << 8 | gr->gr_fbwidth_l;
+               ip->fbheight = gr->gr_fbheight_h << 8 | gr->gr_fbheight_l;
+               ip->dwidth   = gr->gr_dwidth_h << 8 | gr->gr_dwidth_l;
+               ip->dheight  = gr->gr_dheight_h << 8 | gr->gr_dheight_l;
                ip->flags = ITE_ALIVE|ITE_CONSOLE;
                ip->flags = ITE_ALIVE|ITE_CONSOLE;
-               ip->type = dtype;
                i++;
        }
 }
                i++;
        }
 }
@@ -171,8 +179,8 @@ iteinit(cp)
        ip->cursorx = 0;
        ip->cursory = 0;
 
        ip->cursorx = 0;
        ip->cursory = 0;
 
-       (*itesw[ip->type].ite_init)(ip);
-       (*itesw[ip->type].ite_cursor)(ip, DRAW_CURSOR);
+       (*ip->isw->ite_init)(ip);
+       (*ip->isw->ite_cursor)(ip, DRAW_CURSOR);
 
        itecons = ite;
        kbdinit();
 
        itecons = ite;
        kbdinit();
@@ -182,7 +190,7 @@ iteputchar(c)
        register int c;
 {
        register struct ite_softc *ip = &ite_softc[itecons];
        register int c;
 {
        register struct ite_softc *ip = &ite_softc[itecons];
-       register struct itesw *sp = &itesw[ip->type];
+       register struct itesw *sp = ip->isw;
 
        c &= 0x7F;
        switch (c) {
 
        c &= 0x7F;
        switch (c) {
index 329de46..012875f 100644 (file)
@@ -9,9 +9,9 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- * from: Utah $Hdr: ite_dv.c 1.1 89/02/28$
+ * from: Utah $Hdr: ite_dv.c 1.2 92/01/20$
  *
  *
- *     @(#)ite_dv.c    7.2 (Berkeley) %G%
+ *     @(#)ite_dv.c    7.3 (Berkeley) %G%
  */
 
 #include "samachdep.h"
  */
 
 #include "samachdep.h"
@@ -19,9 +19,8 @@
 #ifdef ITECONSOLE
 
 #include "sys/param.h"
 #ifdef ITECONSOLE
 
 #include "sys/param.h"
-#include "../dev/itevar.h"
-#include "../dev/itereg.h"
-#include "../dev/grfvar.h"
+#include "hp/dev/itevar.h"
+#include "hp/dev/itereg.h"
 #include "../dev/grf_dvreg.h"
 
 #define REGBASE                ((struct dvboxfb *)(ip->regbase))
 #include "../dev/grf_dvreg.h"
 
 #define REGBASE                ((struct dvboxfb *)(ip->regbase))
@@ -32,7 +31,7 @@ dvbox_init(ip)
 {
        int i;
        
 {
        int i;
        
-       dv_reset(REGADDR);
+       dv_reset(ip->regbase);
        DELAY(4000);
 
        /*
        DELAY(4000);
 
        /*
@@ -82,16 +81,16 @@ dvbox_init(ip)
        }
        REGBASE->cmapbank = 0;
        
        }
        REGBASE->cmapbank = 0;
        
-       db_waitbusy(REGADDR);
+       db_waitbusy(ip->regbase);
 
 
-       ite_devinfo(ip);
+       ite_fontinfo(ip);
        ite_fontinit(ip);
 
        /*
         * Clear the (visible) framebuffer.
         */
        dvbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
        ite_fontinit(ip);
 
        /*
         * Clear the (visible) framebuffer.
         */
        dvbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
-       db_waitbusy(REGADDR);
+       db_waitbusy(ip->regbase);
 
        /*
         * Stash the inverted cursor.
 
        /*
         * Stash the inverted cursor.
@@ -99,7 +98,7 @@ dvbox_init(ip)
        dvbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
                         ip->cblanky, ip->cblankx, ip->ftheight,
                         ip->ftwidth, RR_COPYINVERTED);
        dvbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
                         ip->cblanky, ip->cblankx, ip->ftheight,
                         ip->ftwidth, RR_COPYINVERTED);
-       db_waitbusy(REGADDR);
+       db_waitbusy(ip->regbase);
 }
 
 dvbox_putc(ip, c, dy, dx, mode)
 }
 
 dvbox_putc(ip, c, dy, dx, mode)
@@ -160,7 +159,7 @@ dvbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
        if (h == 0 || w == 0)
                return;
        
        if (h == 0 || w == 0)
                return;
        
-       db_waitbusy(REGADDR);
+       db_waitbusy(ip->regbase);
        dp->rep_rule = func << 4 | func;
        dp->source_y = sy;
        dp->source_x = sx;
        dp->rep_rule = func << 4 | func;
        dp->source_y = sy;
        dp->source_x = sx;
index 20280f1..34452e0 100644 (file)
@@ -9,9 +9,9 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- * from: Utah $Hdr: ite_gb.c 1.8 89/02/23$
+ * from: Utah $Hdr: ite_gb.c 1.9 92/01/20$
  *
  *
- *     @(#)ite_gb.c    7.2 (Berkeley) %G%
+ *     @(#)ite_gb.c    7.3 (Berkeley) %G%
  */
 
 #include "samachdep.h"
  */
 
 #include "samachdep.h"
 
 #include "sys/param.h"
 
 
 #include "sys/param.h"
 
-#include "../dev/itevar.h"
-#include "../dev/itereg.h"
-#include "../dev/grfvar.h"
+#include "hp/dev/itevar.h"
+#include "hp/dev/itereg.h"
 #include "../dev/grf_gbreg.h"
 
 #define REGBASE        ((struct gboxfb *)(ip->regbase))
 #include "../dev/grf_gbreg.h"
 
 #define REGBASE        ((struct gboxfb *)(ip->regbase))
-#define WINDOWMOVER    gatorbox_windowmove
+#define WINDOWMOVER    gbox_windowmove
 
 
-gatorbox_init(ip)
+gbox_init(ip)
        register struct ite_softc *ip;
 {
        REGBASE->write_protect = 0x0;
        register struct ite_softc *ip;
 {
        REGBASE->write_protect = 0x0;
@@ -48,51 +47,51 @@ gatorbox_init(ip)
        REGBASE->cmap_grn    = 0x00;
        REGBASE->cmap_blu    = 0x00;
        REGBASE->cmap_write  = 0x00;
        REGBASE->cmap_grn    = 0x00;
        REGBASE->cmap_blu    = 0x00;
        REGBASE->cmap_write  = 0x00;
-       gbcm_waitbusy(REGADDR);
+       gbcm_waitbusy(ip->regbase);
        
        REGBASE->creg_select = 0x01;
        REGBASE->cmap_red    = 0xFF;
        REGBASE->cmap_grn    = 0xFF;
        REGBASE->cmap_blu    = 0xFF;
        REGBASE->cmap_write  = 0x01;
        
        REGBASE->creg_select = 0x01;
        REGBASE->cmap_red    = 0xFF;
        REGBASE->cmap_grn    = 0xFF;
        REGBASE->cmap_blu    = 0xFF;
        REGBASE->cmap_write  = 0x01;
-       gbcm_waitbusy(REGADDR);
+       gbcm_waitbusy(ip->regbase);
 
        REGBASE->creg_select = 0xFF;
        REGBASE->cmap_red    = 0xFF;
        REGBASE->cmap_grn    = 0xFF;
        REGBASE->cmap_blu    = 0xFF;
        REGBASE->cmap_write  = 0x01;
 
        REGBASE->creg_select = 0xFF;
        REGBASE->cmap_red    = 0xFF;
        REGBASE->cmap_grn    = 0xFF;
        REGBASE->cmap_blu    = 0xFF;
        REGBASE->cmap_write  = 0x01;
-       gbcm_waitbusy(REGADDR);
+       gbcm_waitbusy(ip->regbase);
 
 
-       ite_devinfo(ip);
+       ite_fontinfo(ip);
        ite_fontinit(ip);
 
        /*
         * Clear the display. This used to be before the font unpacking
         * but it crashes. Figure it out later.
         */
        ite_fontinit(ip);
 
        /*
         * Clear the display. This used to be before the font unpacking
         * but it crashes. Figure it out later.
         */
-       gatorbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
-       tile_mover_waitbusy(REGADDR);
+       gbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
+       tile_mover_waitbusy(ip->regbase);
 
        /*
         * Stash the inverted cursor.
         */
 
        /*
         * Stash the inverted cursor.
         */
-       gatorbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
-                           ip->cblanky, ip->cblankx, ip->ftheight,
-                           ip->ftwidth, RR_COPYINVERTED);
+       gbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
+                       ip->cblanky, ip->cblankx, ip->ftheight,
+                       ip->ftwidth, RR_COPYINVERTED);
 }
 
 }
 
-gatorbox_putc(ip, c, dy, dx, mode)
+gbox_putc(ip, c, dy, dx, mode)
        register struct ite_softc *ip;
         register int dy, dx;
        int c, mode;
 {
        register struct ite_softc *ip;
         register int dy, dx;
        int c, mode;
 {
-       gatorbox_windowmove(ip, charY(ip, c), charX(ip, c),
-                           dy * ip->ftheight, dx * ip->ftwidth,
-                           ip->ftheight, ip->ftwidth, RR_COPY);
+       gbox_windowmove(ip, charY(ip, c), charX(ip, c),
+                       dy * ip->ftheight, dx * ip->ftwidth,
+                       ip->ftheight, ip->ftwidth, RR_COPY);
 }
 
 }
 
-gatorbox_cursor(ip, flag)
+gbox_cursor(ip, flag)
        register struct ite_softc *ip;
         register int flag;
 {
        register struct ite_softc *ip;
         register int flag;
 {
@@ -106,45 +105,45 @@ gatorbox_cursor(ip, flag)
                erase_cursor(ip)
 }
 
                erase_cursor(ip)
 }
 
-gatorbox_clear(ip, sy, sx, h, w)
+gbox_clear(ip, sy, sx, h, w)
        struct ite_softc *ip;
        register int sy, sx, h, w;
 {
        struct ite_softc *ip;
        register int sy, sx, h, w;
 {
-       gatorbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
-                           sy * ip->ftheight, sx * ip->ftwidth, 
-                           h  * ip->ftheight, w  * ip->ftwidth,
-                           RR_CLEAR);
+       gbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
+                       sy * ip->ftheight, sx * ip->ftwidth, 
+                       h  * ip->ftheight, w  * ip->ftwidth,
+                       RR_CLEAR);
 }
 
 }
 
-#define        gatorbox_blockmove(ip, sy, sx, dy, dx, h, w) \
-       gatorbox_windowmove((ip), \
-                           (sy) * ip->ftheight, \
-                           (sx) * ip->ftwidth, \
-                           (dy) * ip->ftheight, \
-                           (dx) * ip->ftwidth, \
-                           (h)  * ip->ftheight, \
-                           (w)  * ip->ftwidth, \
-                           RR_COPY)
-
-gatorbox_scroll(ip, sy, sx, count, dir)
+#define        gbox_blockmove(ip, sy, sx, dy, dx, h, w) \
+       gbox_windowmove((ip), \
+                       (sy) * ip->ftheight, \
+                       (sx) * ip->ftwidth, \
+                       (dy) * ip->ftheight, \
+                       (dx) * ip->ftwidth, \
+                       (h)  * ip->ftheight, \
+                       (w)  * ip->ftwidth, \
+                       RR_COPY)
+
+gbox_scroll(ip, sy, sx, count, dir)
         register struct ite_softc *ip;
         register int sy;
         int dir, sx, count;
 {
        register int height, dy, i;
        
         register struct ite_softc *ip;
         register int sy;
         int dir, sx, count;
 {
        register int height, dy, i;
        
-       tile_mover_waitbusy(REGADDR);
+       tile_mover_waitbusy(ip->regbase);
        REGBASE->write_protect = 0x0;
 
        REGBASE->write_protect = 0x0;
 
-       gatorbox_cursor(ip, ERASE_CURSOR);
+       gbox_cursor(ip, ERASE_CURSOR);
 
        dy = sy - count;
        height = ip->rows - sy;
        for (i = 0; i < height; i++)
 
        dy = sy - count;
        height = ip->rows - sy;
        for (i = 0; i < height; i++)
-               gatorbox_blockmove(ip, sy + i, sx, dy + i, 0, 1, ip->cols);
+               gbox_blockmove(ip, sy + i, sx, dy + i, 0, 1, ip->cols);
 }
 
 }
 
-gatorbox_windowmove(ip, sy, sx, dy, dx, h, w, mask)
+gbox_windowmove(ip, sy, sx, dy, dx, h, w, mask)
      register struct ite_softc *ip;
      int sy, sx, dy, dx, mask;
      register int h, w;
      register struct ite_softc *ip;
      int sy, sx, dy, dx, mask;
      register int h, w;
@@ -154,7 +153,7 @@ gatorbox_windowmove(ip, sy, sx, dy, dx, h, w, mask)
        src  = (sy * 1024) + sx;        /* upper left corner in pixels */
        dest = (dy * 1024) + dx;
 
        src  = (sy * 1024) + sx;        /* upper left corner in pixels */
        dest = (dy * 1024) + dx;
 
-       tile_mover_waitbusy(REGADDR);
+       tile_mover_waitbusy(ip->regbase);
        REGBASE->width = -(w / 4);
        REGBASE->height = -(h / 4);
        if (src < dest)
        REGBASE->width = -(w / 4);
        REGBASE->height = -(h / 4);
        if (src < dest)
index 6956192..4c3b67e 100644 (file)
@@ -9,9 +9,9 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- * from: Utah $Hdr: ite_rb.c 1.5 89/02/20$
+ * from: Utah $Hdr: ite_rb.c 1.6 92/01/20$
  *
  *
- *     @(#)ite_rb.c    7.2 (Berkeley) %G%
+ *     @(#)ite_rb.c    7.3 (Berkeley) %G%
  */
 
 #include "samachdep.h"
  */
 
 #include "samachdep.h"
@@ -19,9 +19,9 @@
 #ifdef ITECONSOLE
 
 #include "sys/param.h"
 #ifdef ITECONSOLE
 
 #include "sys/param.h"
-#include "../dev/itevar.h"
-#include "../dev/itereg.h"
-#include "../dev/grfvar.h"
+#include "hp/dev/itevar.h"
+#include "hp/dev/itereg.h"
+
 #include "../dev/grf_rbreg.h"
 
 #define REGBASE                ((struct rboxfb *)(ip->regbase))
 #include "../dev/grf_rbreg.h"
 
 #define REGBASE                ((struct rboxfb *)(ip->regbase))
@@ -32,7 +32,7 @@ rbox_init(ip)
 {
        int i;
        
 {
        int i;
        
-       rb_waitbusy(REGADDR);
+       rb_waitbusy(ip->regbase);
        DELAY(3000);
 
        REGBASE->interrupt = 0x04;
        DELAY(3000);
 
        REGBASE->interrupt = 0x04;
@@ -41,7 +41,7 @@ rbox_init(ip)
        REGBASE->drive = 0x01;
        REGBASE->vdrive = 0x0;
 
        REGBASE->drive = 0x01;
        REGBASE->vdrive = 0x0;
 
-       ite_devinfo(ip);
+       ite_fontinfo(ip);
        
        REGBASE->opwen = 0xFF;
 
        
        REGBASE->opwen = 0xFF;
 
@@ -49,17 +49,17 @@ rbox_init(ip)
         * Clear the framebuffer.
         */
        rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
         * Clear the framebuffer.
         */
        rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
-       rb_waitbusy(REGADDR);
+       rb_waitbusy(ip->regbase);
        
        for(i = 0; i < 16; i++) {
        
        for(i = 0; i < 16; i++) {
-               *(REGADDR + 0x63c3 + i*4) = 0x0;
-               *(REGADDR + 0x6403 + i*4) = 0x0;
-               *(REGADDR + 0x6803 + i*4) = 0x0;
-               *(REGADDR + 0x6c03 + i*4) = 0x0;
-               *(REGADDR + 0x73c3 + i*4) = 0x0;
-               *(REGADDR + 0x7403 + i*4) = 0x0;
-               *(REGADDR + 0x7803 + i*4) = 0x0;
-               *(REGADDR + 0x7c03 + i*4) = 0x0;
+               *(ip->regbase + 0x63c3 + i*4) = 0x0;
+               *(ip->regbase + 0x6403 + i*4) = 0x0;
+               *(ip->regbase + 0x6803 + i*4) = 0x0;
+               *(ip->regbase + 0x6c03 + i*4) = 0x0;
+               *(ip->regbase + 0x73c3 + i*4) = 0x0;
+               *(ip->regbase + 0x7403 + i*4) = 0x0;
+               *(ip->regbase + 0x7803 + i*4) = 0x0;
+               *(ip->regbase + 0x7c03 + i*4) = 0x0;
        }
 
        REGBASE->rep_rule = 0x33;
        }
 
        REGBASE->rep_rule = 0x33;
@@ -155,7 +155,7 @@ rbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
        if (h == 0 || w == 0)
                return;
        
        if (h == 0 || w == 0)
                return;
        
-       rb_waitbusy(REGADDR);
+       rb_waitbusy(ip->regbase);
        rp->rep_rule = func << 4 | func;
        rp->source_y = sy;
        rp->source_x = sx;
        rp->rep_rule = func << 4 | func;
        rp->source_y = sy;
        rp->source_x = sx;
index f009981..eb79753 100644 (file)
@@ -9,9 +9,9 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- * from: Utah $Hdr: ite_subr.c 1.1 89/02/17$
+ * from: Utah $Hdr: ite_subr.c 1.2 92/01/20$
  *
  *
- *     @(#)ite_subr.c  7.2 (Berkeley) %G%
+ *     @(#)ite_subr.c  7.3 (Berkeley) %G%
  */
 
 #include "samachdep.h"
  */
 
 #include "samachdep.h"
 #ifdef ITECONSOLE
 
 #include "sys/param.h"
 #ifdef ITECONSOLE
 
 #include "sys/param.h"
-#include "../dev/itevar.h"
-#include "../dev/itereg.h"
+#include "hp/dev/itevar.h"
+#include "hp/dev/itereg.h"
 
 
-ite_devinfo(ip)
+ite_fontinfo(ip)
        struct ite_softc *ip;
 {
        struct ite_softc *ip;
 {
-       struct fontinfo *fi;
-       struct font *fd;
+       u_long fontaddr = getword(ip, getword(ip, FONTROM) + FONTADDR);
 
 
-       fi = (struct fontinfo *) ((*FONTROM << 8 | *(FONTROM + 2)) + REGADDR);
-       fd = (struct font *) ((fi->haddr << 8 | fi->laddr) + REGADDR);
-
-       ip->ftheight = fd->fh;
-       ip->ftwidth  = fd->fw;
-       ip->fbwidth  = ITEREGS->fbwidth_h << 8 | ITEREGS->fbwidth_l;
-       ip->fbheight = ITEREGS->fbheight_h << 8 | ITEREGS->fbheight_l;
-       ip->dwidth   = ITEREGS->dispwidth_h << 8 | ITEREGS->dispwidth_l;
-       ip->dheight  = ITEREGS->dispheight_h << 8 | ITEREGS->dispheight_l;
+       ip->ftheight = getbyte(ip, fontaddr + FONTHEIGHT);
+       ip->ftwidth  = getbyte(ip, fontaddr + FONTWIDTH);
        ip->rows     = ip->dheight / ip->ftheight;
        ip->cols     = ip->dwidth / ip->ftwidth;
 
        ip->rows     = ip->dheight / ip->ftheight;
        ip->cols     = ip->dwidth / ip->ftwidth;
 
@@ -65,40 +57,61 @@ ite_devinfo(ip)
 ite_fontinit(ip)
        register struct ite_softc *ip;
 {
 ite_fontinit(ip)
        register struct ite_softc *ip;
 {
-       struct fontinfo *fi;
-       struct font *fd;
-       register u_char *fbmem, *dp;
-       register int bn;
-       int c, l, b;
+       int bytewidth = (((ip->ftwidth - 1) / 8) + 1);
+       int glyphsize = bytewidth * ip->ftheight;
+       u_char fontbuf[500];
+       u_char *dp, *fbmem;
+       int c, i, romp;
 
 
-       fi = (struct fontinfo *) ((*FONTROM << 8 | *(FONTROM + 2)) + REGADDR);
-       fd = (struct font *) ((fi->haddr << 8 | fi->laddr) + REGADDR);
+       romp = getword(ip, getword(ip, FONTROM) + FONTADDR) + FONTDATA;
+       for (c = 0; c < 128; c++) {
+               fbmem = (u_char *)
+                   (FBBASE +
+                    (ip->fonty + (c / ip->cpl) * ip->ftheight) * ip->fbwidth +
+                    (ip->fontx + (c % ip->cpl) * ip->ftwidth));
+               dp = fontbuf;
+               for (i = 0; i < glyphsize; i++) {
+                       *dp++ = getbyte(ip, romp);
+                       romp += 2;
+               }
+               writeglyph(ip, fbmem, fontbuf);
+       }
+}
 
 
-       dp = fd->data;
+/*
+ * Display independent versions of the readbyte and writeglyph routines.
+ */
+u_char
+ite_readbyte(ip, disp)
+       struct ite_softc *ip;
+       int disp;
+{
+       return((u_char) *(((u_char *)ip->regbase) + disp));
+}
 
 
-       for (c = 0; c < 128; c++) {
-               fbmem = (u_char *) FBBASE +
-                       (ip->fonty + (c / ip->cpl) * ip->ftheight) *
-                       ip->fbwidth;
-               fbmem += ip->fontx + (c % ip->cpl) * ip->ftwidth;
-               for (l = 0; l < ip->ftheight; l++) {
-                       bn = 7;
-                       for (b = 0; b < ip->ftwidth; b++) {
-                               if ((1 << bn) & *dp)
-                                       *fbmem++ = 1;
-                               else
-                                       *fbmem++ = 0;
-                               if (--bn < 0) {
-                                       bn = 7;
-                                       dp += 2;
-                               }
+ite_writeglyph(ip, fbmem, glyphp)
+       register struct ite_softc *ip;
+       register u_char *fbmem, *glyphp;
+{
+       register int bn;
+       int c, l, b;
+
+       for (l = 0; l < ip->ftheight; l++) {
+               bn = 7;
+               for (b = 0; b < ip->ftwidth; b++) {
+                       if ((1 << bn) & *glyphp)
+                               *fbmem++ = 1;
+                       else
+                               *fbmem++ = 0;
+                       if (--bn < 0) {
+                               bn = 7;
+                               glyphp++;
                        }
                        }
-                       if (bn < 7)
-                               dp += 2;
-                       fbmem -= ip->ftwidth;
-                       fbmem += ip->fbwidth;
                }
                }
+               if (bn < 7)
+                       glyphp++;
+               fbmem -= ip->ftwidth;
+               fbmem += ip->fbwidth;
        }
        }
-
 }
 #endif
 }
 #endif
index 4e696e4..d072778 100644 (file)
@@ -9,9 +9,9 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- * from: Utah $Hdr: ite_tc.c 1.9 89/02/20$
+ * from: Utah $Hdr: ite_tc.c 1.11 92/01/20$
  *
  *
- *     @(#)ite_tc.c    7.2 (Berkeley) %G%
+ *     @(#)ite_tc.c    7.3 (Berkeley) %G%
  */
 
 #include "samachdep.h"
  */
 
 #include "samachdep.h"
@@ -19,9 +19,9 @@
 #ifdef ITECONSOLE
 
 #include "sys/param.h"
 #ifdef ITECONSOLE
 
 #include "sys/param.h"
-#include "../dev/itevar.h"
-#include "../dev/itereg.h"
-#include "../dev/grfvar.h"
+#include "hp/dev/itevar.h"
+#include "hp/dev/itereg.h"
+#include "hp/dev/grfreg.h"
 #include "../dev/grf_tcreg.h"
 
 #define REGBASE                ((struct tcboxfb *)(ip->regbase))
 #include "../dev/grf_tcreg.h"
 
 #define REGBASE                ((struct tcboxfb *)(ip->regbase))
@@ -31,6 +31,21 @@ topcat_init(ip)
        register struct ite_softc *ip;
 {
 
        register struct ite_softc *ip;
 {
 
+       /*
+        * Catseye looks a lot like a topcat, but not completely.
+        * So, we set some bits to make it work.
+        */
+       if (REGBASE->fbid != GID_TOPCAT) {
+               while ((REGBASE->catseye_status & 1))
+                       ;
+               REGBASE->catseye_status = 0x0;
+               REGBASE->vb_select      = 0x0;
+               REGBASE->tcntrl         = 0x0;
+               REGBASE->acntrl         = 0x0;
+               REGBASE->pncntrl        = 0x0;
+               REGBASE->rug_cmdstat    = 0x90;
+       }
+
        /*
         * Determine the number of planes by writing to the first frame
         * buffer display location, then reading it back. 
        /*
         * Determine the number of planes by writing to the first frame
         * buffer display location, then reading it back. 
@@ -49,13 +64,13 @@ topcat_init(ip)
        REGBASE->ren  = ip->planemask;
        REGBASE->prr  = RR_COPY;
 
        REGBASE->ren  = ip->planemask;
        REGBASE->prr  = RR_COPY;
 
-       ite_devinfo(ip);
+       ite_fontinfo(ip);
 
        /*
         * Clear the framebuffer on all planes.
         */
        topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
 
        /*
         * Clear the framebuffer on all planes.
         */
        topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
-       tc_waitbusy(REGADDR, ip->planemask);
+       tc_waitbusy(ip->regbase, ip->planemask);
 
        ite_fontinit(ip);
 
 
        ite_fontinit(ip);
 
@@ -125,7 +140,7 @@ topcat_windowmove(ip, sy, sx, dy, dx, h, w, func)
        
        if (h == 0 || w == 0)
                return;
        
        if (h == 0 || w == 0)
                return;
-       tc_waitbusy(REGADDR, ip->planemask);
+       tc_waitbusy(ip->regbase, ip->planemask);
        rp->wmrr     = func;
        rp->source_y = sy;
        rp->source_x = sx;
        rp->wmrr     = func;
        rp->source_y = sy;
        rp->source_x = sx;
index 7602b06..744b490 100644 (file)
@@ -9,9 +9,9 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- * from: Utah $Hdr: machdep.c 1.6 88/05/24$
+ * from: Utah $Hdr: machdep.c 1.10 92/06/18
  *
  *
- *     @(#)machdep.c   7.4 (Berkeley) %G%
+ *     @(#)machdep.c   7.5 (Berkeley) %G%
  */
 
 #include "sys/param.h"
  */
 
 #include "sys/param.h"
@@ -45,30 +45,41 @@ bcmp(s1, s2, len)
        return (0);
 }
 
        return (0);
 }
 
+#ifdef ROMPRF
+int userom;
+#endif
+
 trap(fp)
 trap(fp)
- struct frame {
-        int dregs[8];
-        int aregs[8];
-        int whoknows;
-        short sr;
-        int pc;
-        short frame;
- } *fp;
      struct frame {
+               int dregs[8];
+               int aregs[8];
+               int whoknows;
+               short sr;
+               int pc;
+               short frame;
      } *fp;
 {
        static int intrap = 0;
 
        if (intrap)
 {
        static int intrap = 0;
 
        if (intrap)
-               return;
+               return(0);
        intrap = 1;
        intrap = 1;
-       printf("Got unexpected trap, vector = %x, ps = %x, pc = %x\n",
-              fp->frame&0xFFF, fp->sr, fp->pc);
+#ifdef ROMPRF
+       userom = 1;
+#endif
+       printf("Got unexpected trap: format=%x vector=%x ps=%x pc=%x\n",
+                 (fp->frame>>12)&0xF, fp->frame&0xFFF, fp->sr, fp->pc);
        printf("dregs: %x %x %x %x %x %x %x %x\n",
               fp->dregs[0], fp->dregs[1], fp->dregs[2], fp->dregs[3], 
               fp->dregs[4], fp->dregs[5], fp->dregs[6], fp->dregs[7]);
        printf("aregs: %x %x %x %x %x %x %x %x\n",
               fp->aregs[0], fp->aregs[1], fp->aregs[2], fp->aregs[3], 
               fp->aregs[4], fp->aregs[5], fp->aregs[6], fp->aregs[7]);
        printf("dregs: %x %x %x %x %x %x %x %x\n",
               fp->dregs[0], fp->dregs[1], fp->dregs[2], fp->dregs[3], 
               fp->dregs[4], fp->dregs[5], fp->dregs[6], fp->dregs[7]);
        printf("aregs: %x %x %x %x %x %x %x %x\n",
               fp->aregs[0], fp->aregs[1], fp->aregs[2], fp->aregs[3], 
               fp->aregs[4], fp->aregs[5], fp->aregs[6], fp->aregs[7]);
+#ifdef ROMPRF
+       userom = 0;
+#endif
        intrap = 0;
        intrap = 0;
+       return(0);
 }
 
 #ifdef ROMPRF
 }
 
 #ifdef ROMPRF
@@ -76,7 +87,7 @@ trap(fp)
 #define COLS   128
 
 romputchar(c)
 #define COLS   128
 
 romputchar(c)
- register int c;
      register int c;
 {
        static char buf[COLS];
        static int col = 0, row = 0;
 {
        static char buf[COLS];
        static int col = 0, row = 0;
@@ -86,6 +97,7 @@ romputchar(c)
        case '\0':
                break;
        case '\r':
        case '\0':
                break;
        case '\r':
+               break;  /* ignore */
        case '\n':
                for (i = col; i < COLS-1; i++)
                        buf[i] = ' ';
        case '\n':
                for (i = col; i < COLS-1; i++)
                        buf[i] = ' ';
index 8899e93..aedc74f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)mkboot.c    7.2 (Berkeley) %G%
+ *     @(#)mkboot.c    7.3 (Berkeley) %G%
  */
 
 #ifndef lint
  */
 
 #ifndef lint
@@ -14,13 +14,14 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)mkboot.c   7.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)mkboot.c   7.2 (Berkeley) 12/16/90";
 #endif /* not lint */
 
 #endif /* not lint */
 
-#include "../include/param.h"
+#include "sys/param.h"
+#include "sys/exec.h"
+#include "sys/file.h"
 #include "volhdr.h"
 #include "volhdr.h"
-#include <sys/exec.h>
-#include <sys/file.h>
+
 #include <stdio.h>
 #include <ctype.h>
 
 #include <stdio.h>
 #include <ctype.h>
 
@@ -106,6 +107,7 @@ main(argc, argv)
        lifd[0].dir_type = DIR_TYPE;
        lifd[0].dir_addr = 3;
        lifd[0].dir_length = n;
        lifd[0].dir_type = DIR_TYPE;
        lifd[0].dir_addr = 3;
        lifd[0].dir_length = n;
+       bcddate(from1, lifd[0].dir_toc);
        lifd[0].dir_flag = DIR_FLAG;
        lifd[0].dir_exec = lpflag? loadpoint + ex.a_entry : ex.a_entry;
        lifv.vol_length = lifd[0].dir_addr + lifd[0].dir_length;
        lifd[0].dir_flag = DIR_FLAG;
        lifd[0].dir_exec = lpflag? loadpoint + ex.a_entry : ex.a_entry;
        lifv.vol_length = lifd[0].dir_addr + lifd[0].dir_length;
@@ -118,6 +120,7 @@ main(argc, argv)
                lifd[1].dir_type = DIR_TYPE;
                lifd[1].dir_addr = 3 + lifd[0].dir_length;
                lifd[1].dir_length = n;
                lifd[1].dir_type = DIR_TYPE;
                lifd[1].dir_addr = 3 + lifd[0].dir_length;
                lifd[1].dir_length = n;
+               bcddate(from2, lifd[1].dir_toc);
                lifd[1].dir_flag = DIR_FLAG;
                lifd[1].dir_exec = lpflag? loadpoint + ex.a_entry : ex.a_entry;
                lifv.vol_length = lifd[1].dir_addr + lifd[1].dir_length;
                lifd[1].dir_flag = DIR_FLAG;
                lifd[1].dir_exec = lpflag? loadpoint + ex.a_entry : ex.a_entry;
                lifv.vol_length = lifd[1].dir_addr + lifd[1].dir_length;
@@ -221,3 +224,29 @@ lifname(str)
                lname[i] = '\0';
        return(lname);
 }
                lname[i] = '\0';
        return(lname);
 }
+
+#include "sys/stat.h"
+#include "/usr/include/time.h" /* XXX */
+
+bcddate(fd, toc)
+       int fd;
+       char *toc;
+{
+       struct stat statb;
+       struct tm *tm;
+
+       fstat(fd, &statb);
+       tm = localtime(&statb.st_ctime);
+       *toc = ((tm->tm_mon+1) / 10) << 4;
+       *toc++ |= (tm->tm_mon+1) % 10;
+       *toc = (tm->tm_mday / 10) << 4;
+       *toc++ |= tm->tm_mday % 10;
+       *toc = (tm->tm_year / 10) << 4;
+       *toc++ |= tm->tm_year % 10;
+       *toc = (tm->tm_hour / 10) << 4;
+       *toc++ |= tm->tm_hour % 10;
+       *toc = (tm->tm_min / 10) << 4;
+       *toc++ |= tm->tm_min % 10;
+       *toc = (tm->tm_sec / 10) << 4;
+       *toc |= tm->tm_sec % 10;
+}
index a5d2d20..e9b420f 100644 (file)
@@ -4,9 +4,14 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)prf.c       7.4 (Berkeley) %G%
+ *     @(#)prf.c       7.5 (Berkeley) %G%
  */
 
  */
 
+/*
+ * XXX we know that scankbd is only called from read/write to interrupt
+ * a boot program.  Since we restart only on ^C and we do that here, we
+ * always return 0 to avoid a longjmp in the caller.
+ */
 scankbd()
 {
        register int c;
 scankbd()
 {
        register int c;
@@ -17,7 +22,7 @@ scankbd()
                _stop("");
                /* NOTREACHED */
        }
                _stop("");
                /* NOTREACHED */
        }
-       return(c);
+       return(0);
 }
 
 getchar()
 }
 
 getchar()
@@ -33,7 +38,8 @@ getchar()
                _stop("");
                /* NOTREACHED */
        }
                _stop("");
                /* NOTREACHED */
        }
-       putchar(c);
+       if (c != '\b' && c != '\177')
+               putchar(c);
        return(c);
 }
 
        return(c);
 }
 
index 943e8c0..bb9335d 100644 (file)
@@ -9,15 +9,15 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- * from: Utah $Hdr: rd.c 1.14 89/02/27$
+ * from: Utah $Hdr: rd.c 1.17 92/06/18$
  *
  *
- *     @(#)rd.c        7.3 (Berkeley) %G%
+ *     @(#)rd.c        7.4 (Berkeley) %G%
  */
 
 /*
  * CS80/SS80 disk driver
  */
  */
 
 /*
  * CS80/SS80 disk driver
  */
-#include <sys/param.h>
+#include "sys/param.h"
 #include "saio.h"
 #include "samachdep.h"
 
 #include "saio.h"
 #include "samachdep.h"
 
@@ -32,7 +32,7 @@ struct        rd_softc {
        char    sc_retry;
        char    sc_alive;
        short   sc_type;
        char    sc_retry;
        char    sc_alive;
        short   sc_type;
-} rd_softc[NRD];
+} rd_softc[NHPIB][NRD];
 
 #define        RDRETRY         5
 
 
 #define        RDRETRY         5
 
@@ -48,7 +48,9 @@ int rdcyloff[][8] = {
        { 1, 65,  0, 65,  257, 657, 193, 257, },        /* 7958A */
        { 1, 128, 0, 128, 518, 918, 388, 518, },        /* 7957B */
        { 1, 44,  0, 44,  174, 496, 131, 174, },        /* 7958B */
        { 1, 65,  0, 65,  257, 657, 193, 257, },        /* 7958A */
        { 1, 128, 0, 128, 518, 918, 388, 518, },        /* 7957B */
        { 1, 44,  0, 44,  174, 496, 131, 174, },        /* 7958B */
-       { 1, 44,  0, 44,  218, 918, 174, 218, },        /* 7959B */
+       { 1, 44,  0, 44,  218, 1022,174, 218, },        /* 7959B */
+       { 1, 37,  0, 37,  183, 857, 147, 183, },        /* 2200A */
+       { 1, 19,  0, 94,  112, 450, 94,  788, },        /* 2203A */
        { 1, 20,  0, 98,  117, 256, 98,  397, },        /* 7936H */
        { 1, 11,  0, 53,  63,  217, 53,  371, },        /* 7937H */
 };
        { 1, 20,  0, 98,  117, 256, 98,  397, },        /* 7936H */
        { 1, 11,  0, 53,  63,  217, 53,  371, },        /* 7937H */
 };
@@ -67,34 +69,34 @@ struct rdinfo {
        NRD7957ABPT*NRD7957ATRK, RD7957AID, rdcyloff[7],
        NRD7933HBPT*NRD7933HTRK, RD7933HID, rdcyloff[5],
        NRD9134LBPT*NRD9134LTRK, RD9134LID, rdcyloff[6],
        NRD7957ABPT*NRD7957ATRK, RD7957AID, rdcyloff[7],
        NRD7933HBPT*NRD7933HTRK, RD7933HID, rdcyloff[5],
        NRD9134LBPT*NRD9134LTRK, RD9134LID, rdcyloff[6],
-       NRD7936HBPT*NRD7936HTRK, RD7936HID, rdcyloff[12],
-       NRD7937HBPT*NRD7937HTRK, RD7937HID, rdcyloff[13],
+       NRD7936HBPT*NRD7936HTRK, RD7936HID, rdcyloff[14],
+       NRD7937HBPT*NRD7937HTRK, RD7937HID, rdcyloff[15],
        NRD7914PBPT*NRD7914PTRK, RD7914CTID,rdcyloff[4],
        NRD7945ABPT*NRD7945ATRK, RD7946AID, rdcyloff[0],
        NRD9122SBPT*NRD9122STRK, RD9134LID, rdcyloff[2],
        NRD7957BBPT*NRD7957BTRK, RD7957BID, rdcyloff[9],
        NRD7958BBPT*NRD7958BTRK, RD7958BID, rdcyloff[10],
        NRD7959BBPT*NRD7959BTRK, RD7959BID, rdcyloff[11],
        NRD7914PBPT*NRD7914PTRK, RD7914CTID,rdcyloff[4],
        NRD7945ABPT*NRD7945ATRK, RD7946AID, rdcyloff[0],
        NRD9122SBPT*NRD9122STRK, RD9134LID, rdcyloff[2],
        NRD7957BBPT*NRD7957BTRK, RD7957BID, rdcyloff[9],
        NRD7958BBPT*NRD7958BTRK, RD7958BID, rdcyloff[10],
        NRD7959BBPT*NRD7959BTRK, RD7959BID, rdcyloff[11],
+       NRD2200ABPT*NRD2200ATRK, RD2200AID, rdcyloff[12],
+       NRD2203ABPT*NRD2203ATRK, RD2203AID, rdcyloff[13],
 };
 int    nrdinfo = sizeof(rdinfo) / sizeof(rdinfo[0]);
                                        
 };
 int    nrdinfo = sizeof(rdinfo) / sizeof(rdinfo[0]);
                                        
-rdinit(unit)
-       register int unit;
+rdinit(ctlr, unit)
+       int ctlr, unit;
 {
 {
-       register struct rd_softc *rs;
+       register struct rd_softc *rs = &rd_softc[ctlr][unit];
        u_char stat;
 
        u_char stat;
 
-       if (unit > NRD)
-               return (0);
-       rs = &rd_softc[unit];
-       rs->sc_type = rdident(unit);
+       rs->sc_type = rdident(ctlr, unit);
        if (rs->sc_type < 0)
                return (0);
        rs->sc_alive = 1;
        return (1);
 }
 
        if (rs->sc_type < 0)
                return (0);
        rs->sc_alive = 1;
        return (1);
 }
 
-rdreset(unit)
+rdreset(ctlr, unit)
+       register int ctlr, unit;
 {
        u_char stat;
 
 {
        u_char stat;
 
@@ -104,19 +106,20 @@ rdreset(unit)
        rd_ssmc.c_fefm = FEF_MASK;
        rd_ssmc.c_aefm = AEF_MASK;
        rd_ssmc.c_iefm = IEF_MASK;
        rd_ssmc.c_fefm = FEF_MASK;
        rd_ssmc.c_aefm = AEF_MASK;
        rd_ssmc.c_iefm = IEF_MASK;
-       hpibsend(unit, C_CMD, &rd_ssmc, sizeof(rd_ssmc));
-       hpibswait(unit);
-       hpibrecv(unit, C_QSTAT, &stat, 1);
+       hpibsend(ctlr, unit, C_CMD, &rd_ssmc, sizeof(rd_ssmc));
+       hpibswait(ctlr, unit);
+       hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
 }
 
 }
 
-rdident(unit)
+rdident(ctlr, unit)
+       register int ctlr, unit;
 {
        struct rd_describe desc;
        u_char stat, cmd[3];
        char name[7];
        register int id, i;
 
 {
        struct rd_describe desc;
        u_char stat, cmd[3];
        char name[7];
        register int id, i;
 
-       id = hpibid(unit);
+       id = hpibid(ctlr, unit);
        if ((id & 0x200) == 0)
                return(-1);
        for (i = 0; i < nrdinfo; i++)
        if ((id & 0x200) == 0)
                return(-1);
        for (i = 0; i < nrdinfo; i++)
@@ -125,13 +128,13 @@ rdident(unit)
        if (i == nrdinfo)
                return(-1);
        id = i;
        if (i == nrdinfo)
                return(-1);
        id = i;
-       rdreset(unit);
+       rdreset(ctlr, unit);
        cmd[0] = C_SUNIT(0);
        cmd[1] = C_SVOL(0);
        cmd[2] = C_DESC;
        cmd[0] = C_SUNIT(0);
        cmd[1] = C_SVOL(0);
        cmd[2] = C_DESC;
-       hpibsend(unit, C_CMD, cmd, sizeof(cmd));
-       hpibrecv(unit, C_EXEC, &desc, 37);
-       hpibrecv(unit, C_QSTAT, &stat, sizeof(stat));
+       hpibsend(ctlr, unit, C_CMD, cmd, sizeof(cmd));
+       hpibrecv(ctlr, unit, C_EXEC, &desc, 37);
+       hpibrecv(ctlr, unit, C_QSTAT, &stat, sizeof(stat));
        bzero(name, sizeof(name));
        if (!stat) {
                register int n = desc.d_name;
        bzero(name, sizeof(name));
        if (!stat) {
                register int n = desc.d_name;
@@ -174,27 +177,36 @@ rdident(unit)
 rdopen(io)
        struct iob *io;
 {
 rdopen(io)
        struct iob *io;
 {
-       register int unit = io->i_unit;
-       register struct rd_softc *rs = &rd_softc[unit];
+       register struct rd_softc *rs;
        struct rdinfo *ri;
        struct rdinfo *ri;
+       int unit, ctlr, part;
 
 
-       if (hpibalive(unit) == 0)
-               _stop("rd controller not configured");
+       devconvert(io);
+
+       ctlr = io->i_adapt;
+       if (ctlr >= NHPIB || hpibalive(ctlr) == 0)
+               return (EADAPT);
+       unit = io->i_ctlr;
+       if (unit >= NRD)
+               return (ECTLR);
+       rs = &rd_softc[ctlr][unit];
        if (rs->sc_alive == 0)
        if (rs->sc_alive == 0)
-               if (rdinit(unit) == 0)
-                       _stop("rd init failed");
-       if (io->i_boff < 0 || io->i_boff > 7)
-               _stop("rd bad minor");
+               if (rdinit(ctlr, unit) == 0)
+                       return (ENXIO);
+       part = io->i_part;
+       if (part >= 8)
+               return (EPART);
        ri = &rdinfo[rs->sc_type];
        ri = &rdinfo[rs->sc_type];
-       io->i_boff = ri->cyloff[io->i_boff] * ri->nbpc;
+       io->i_boff = ri->cyloff[part] * ri->nbpc;
 }
 
 rdstrategy(io, func)
        register struct iob *io;
 }
 
 rdstrategy(io, func)
        register struct iob *io;
-       register int func;
+       int func;
 {
 {
-       register int unit = io->i_unit;
-       register struct rd_softc *rs = &rd_softc[unit];
+       register int ctlr = io->i_adapt;
+       register int unit = io->i_ctlr;
+       register struct rd_softc *rs = &rd_softc[ctlr][unit];
        char stat;
 
        rs->sc_retry = 0;
        char stat;
 
        rs->sc_retry = 0;
@@ -208,40 +220,42 @@ rdstrategy(io, func)
        rd_ioc.c_len = io->i_cc;
        rd_ioc.c_cmd = func == F_READ ? C_READ : C_WRITE;
 retry:
        rd_ioc.c_len = io->i_cc;
        rd_ioc.c_cmd = func == F_READ ? C_READ : C_WRITE;
 retry:
-       hpibsend(unit, C_CMD, &rd_ioc.c_unit, sizeof(rd_ioc)-2);
-       hpibswait(unit);
-       hpibgo(unit, C_EXEC, io->i_ma, io->i_cc, func);
-       hpibswait(unit);
-       hpibrecv(unit, C_QSTAT, &stat, 1);
+       hpibsend(ctlr, unit, C_CMD, &rd_ioc.c_unit, sizeof(rd_ioc)-2);
+       hpibswait(ctlr, unit);
+       hpibgo(ctlr, unit, C_EXEC, io->i_ma, io->i_cc, func);
+       hpibswait(ctlr, unit);
+       hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
        if (stat) {
        if (stat) {
-               if (rderror(unit) == 0)
+               if (rderror(ctlr, unit, io->i_part) == 0)
                        return(-1);
                if (++rs->sc_retry > RDRETRY)
                        return(-1);
                        return(-1);
                if (++rs->sc_retry > RDRETRY)
                        return(-1);
-               else
-                       goto retry;
+               goto retry;
        }
        return(io->i_cc);
 }
 
        }
        return(io->i_cc);
 }
 
-rderror(unit)
-       register int unit;
+rderror(ctlr, unit, part)
+       register int ctlr, unit;
+       int part;
 {
 {
-       register struct rd_softc *rd = &rd_softc[unit];
+       register struct rd_softc *rd = &rd_softc[ctlr][unit];
        char stat;
 
        rd_rsc.c_unit = C_SUNIT(0);
        rd_rsc.c_sram = C_SRAM;
        rd_rsc.c_ram = C_RAM;
        rd_rsc.c_cmd = C_STATUS;
        char stat;
 
        rd_rsc.c_unit = C_SUNIT(0);
        rd_rsc.c_sram = C_SRAM;
        rd_rsc.c_ram = C_RAM;
        rd_rsc.c_cmd = C_STATUS;
-       hpibsend(unit, C_CMD, &rd_rsc, sizeof(rd_rsc));
-       hpibrecv(unit, C_EXEC, &rd_stat, sizeof(rd_stat));
-       hpibrecv(unit, C_QSTAT, &stat, 1);
+       hpibsend(ctlr, unit, C_CMD, &rd_rsc, sizeof(rd_rsc));
+       hpibrecv(ctlr, unit, C_EXEC, &rd_stat, sizeof(rd_stat));
+       hpibrecv(ctlr, unit, C_QSTAT, &stat, 1);
        if (stat) {
        if (stat) {
-               printf("rd(%d,?): request status fail %d\n", unit, stat);
+               printf("rd(%d,%d,0,%d): request status fail %d\n",
+                      ctlr, unit, part, stat);
                return(0);
        }
                return(0);
        }
-       printf("rd(%d,?) err: vu 0x%x", unit, rd_stat.c_vu);
+       printf("rd(%d,%d,0,%d) err: vu 0x%x",
+              ctlr, unit, part, rd_stat.c_vu);
        if ((rd_stat.c_aef & AEF_UD) || (rd_stat.c_ief & (IEF_MD|IEF_RD)))
                printf(", block %d", rd_stat.c_blk);
        printf(", R0x%x F0x%x A0x%x I0x%x\n",
        if ((rd_stat.c_aef & AEF_UD) || (rd_stat.c_ief & (IEF_MD|IEF_RD)))
                printf(", block %d", rd_stat.c_blk);
        printf(", R0x%x F0x%x A0x%x I0x%x\n",
index e457342..8ec4bfe 100644 (file)
@@ -4,15 +4,16 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)samachdep.h 7.2 (Berkeley) %G%
+ *     @(#)samachdep.h 7.3 (Berkeley) %G%
  */
 
 #define        NHPIB           4
  */
 
 #define        NHPIB           4
-#define NITE           4
 #define        NSCSI           2
 #define        NSCSI           2
-#define NRD            (NHPIB * 8)
-#define NCT            (NHPIB * 8)
-#define NSD            (NSCSI * 8)
+#define NRD            8
+#define NCT            8
+#define NSD            8
+
+#define NITE           4
 
 /* from cpu.h */
 #define IIOV(x)                (x)
 
 /* from cpu.h */
 #define IIOV(x)                (x)
 #define HP_370         4       /* 33Mhz 68030+64K external cache */
 #define HP_340         5       /* 16Mhz 68030 */
 #define HP_375         6       /* 50Mhz 68030+32K external cache */
 #define HP_370         4       /* 33Mhz 68030+64K external cache */
 #define HP_340         5       /* 16Mhz 68030 */
 #define HP_375         6       /* 50Mhz 68030+32K external cache */
+#define HP_380         7       /* 25Mhz 68040 */
+
+#define MHZ_8          1
+#define MHZ_16         2
+#define MHZ_25         3
+#define MHZ_33         4
+#define MHZ_50         6
 
 
-extern int howto, devtype;
+extern int cpuspeed, machineid;
+extern int howto, bootdev;
 
 /* bogon grfinfo structure to keep grf_softc happy */
 struct grfinfo {
 
 /* bogon grfinfo structure to keep grf_softc happy */
 struct grfinfo {
index 1bd2713..b6da5ce 100644 (file)
  *
  * from: Utah $Hdr: scsi.c 1.3 90/01/27$
  *
  *
  * from: Utah $Hdr: scsi.c 1.3 90/01/27$
  *
- *     @(#)scsi.c      7.4 (Berkeley) %G%
+ *     @(#)scsi.c      7.5 (Berkeley) %G%
  */
 
 /*
  * SCSI bus driver for standalone programs.
  */
 
  */
 
 /*
  * SCSI bus driver for standalone programs.
  */
 
-#include <sys/param.h>
-#include <sys/reboot.h>
-#include "../dev/device.h"
+#include "sys/param.h"
+#include "sys/reboot.h"
+#include "hp/dev/device.h"
 #include "../dev/scsireg.h"
 #include "scsivar.h"
 
 #include "../dev/scsireg.h"
 #include "scsivar.h"
 
 
 struct scsi_softc scsi_softc[NSCSI];
 
 
 struct scsi_softc scsi_softc[NSCSI];
 
-#define        scsiunit(x)     ((x) >> 3)
-#define        scsislave(x)    ((x) & 7)
-
 void scsireset();
 void scsireset();
-int scsi_cmd_wait = 500;
-int scsi_data_wait = 300000;
+int scsi_cmd_wait = 50000;     /* use the "real" driver init_wait value */
+int scsi_data_wait = 50000;    /* use the "real" driver init_wait value */
 
 scsiinit()
 {
 
 scsiinit()
 {
@@ -42,7 +39,7 @@ scsiinit()
        register struct hp_hw *hw;
        register struct scsi_softc *hs;
        register int i, addr;
        register struct hp_hw *hw;
        register struct scsi_softc *hs;
        register int i, addr;
-       static int first = 1;
+       static int waitset = 0;
        
        i = 0;
        for (hw = sc_table; i < NSCSI && hw < &sc_table[MAXCTLRS]; hw++) {
        
        i = 0;
        for (hw = sc_table; i < NSCSI && hw < &sc_table[MAXCTLRS]; hw++) {
@@ -53,23 +50,23 @@ scsiinit()
                scsireset(i);
                if (howto & RB_ASKNAME)
                        printf("scsi%d at sc%d\n", i, hw->hw_sc);
                scsireset(i);
                if (howto & RB_ASKNAME)
                        printf("scsi%d at sc%d\n", i, hw->hw_sc);
-               /*
-                * Adjust devtype on first call.  This routine assumes that
-                * adaptor is in the high byte of devtype.
-                */
-               if (first && ((devtype >> 24) & 0xff) == hw->hw_sc) {
-                       devtype = (devtype & 0x00ffffff) | (i << 24);
-                       first = 0;
-               }
+               hw->hw_pa = (caddr_t) i;        /* XXX for autoconfig */
                hs->sc_alive = 1;
                i++;
        }
                hs->sc_alive = 1;
                i++;
        }
+       /*
+        * Adjust the wait values
+        */
+       if (!waitset) {
+               scsi_cmd_wait *= cpuspeed;
+               scsi_data_wait *= cpuspeed;
+               waitset = 1;
+       }
 }
 
 scsialive(unit)
        register int unit;
 {
 }
 
 scsialive(unit)
        register int unit;
 {
-       unit = scsiunit(unit);
        if (unit >= NSCSI || scsi_softc[unit].sc_alive == 0)
                return (0);
        return (1);
        if (unit >= NSCSI || scsi_softc[unit].sc_alive == 0)
                return (0);
        return (1);
@@ -83,7 +80,6 @@ scsireset(unit)
        register struct scsi_softc *hs;
        u_int i;
 
        register struct scsi_softc *hs;
        u_int i;
 
-       unit = scsiunit(unit);
        hs = &scsi_softc[unit];
        hd = (struct scsidevice *)hs->sc_addr;
        hd->scsi_id = 0xFF;
        hs = &scsi_softc[unit];
        hd = (struct scsidevice *)hs->sc_addr;
        hd->scsi_id = 0xFF;
@@ -126,7 +122,9 @@ scsiabort(hs, hd)
        register struct scsi_softc *hs;
        volatile register struct scsidevice *hd;
 {
        register struct scsi_softc *hs;
        volatile register struct scsidevice *hd;
 {
-       printf("scsi error: scsiabort\n");
+       printf("scsi%d error: scsiabort\n", hs - scsi_softc);
+
+       scsireset(hs - scsi_softc);
        return (0);
 }
 
        return (0);
 }
 
@@ -156,10 +154,15 @@ static int
 wait_for_select(hd)
        volatile register struct scsidevice *hd;
 {
 wait_for_select(hd)
        volatile register struct scsidevice *hd;
 {
+       register int wait;
        u_char ints;
 
        u_char ints;
 
-       while ((ints = hd->scsi_ints) == 0)
+       wait = scsi_data_wait;
+       while ((ints = hd->scsi_ints) == 0) {
+               if (--wait < 0)
+                       return (1);
                DELAY(1);
                DELAY(1);
+       }
        hd->scsi_ints = ints;
        return (!(hd->scsi_ssts & SSTS_INITIATOR));
 }
        hd->scsi_ints = ints;
        return (!(hd->scsi_ssts & SSTS_INITIATOR));
 }
@@ -243,19 +246,19 @@ scsiicmd(hs, target, cbuf, clen, buf, len, xferphase)
 {
        volatile register struct scsidevice *hd =
                                (struct scsidevice *)hs->sc_addr;
 {
        volatile register struct scsidevice *hd =
                                (struct scsidevice *)hs->sc_addr;
-       int i;
        u_char phase, ints;
        register int wait;
 
        /* select the SCSI bus (it's an error if bus isn't free) */
        if (issue_select(hd, target, hs->sc_scsi_addr))
        u_char phase, ints;
        register int wait;
 
        /* select the SCSI bus (it's an error if bus isn't free) */
        if (issue_select(hd, target, hs->sc_scsi_addr))
-               return (0);
+               return (-2);
        if (wait_for_select(hd))
        if (wait_for_select(hd))
-               return (0);
+               return (-2);
        /*
         * Wait for a phase change (or error) then let the device
         * sequence us through the various SCSI phases.
         */
        /*
         * Wait for a phase change (or error) then let the device
         * sequence us through the various SCSI phases.
         */
+       hs->sc_stat = -1;
        phase = CMD_PHASE;
        while (1) {
                wait = scsi_cmd_wait;
        phase = CMD_PHASE;
        while (1) {
                wait = scsi_cmd_wait;
@@ -306,12 +309,22 @@ scsiicmd(hs, target, cbuf, clen, buf, len, xferphase)
                        break;
 
                case BUS_FREE_PHASE:
                        break;
 
                case BUS_FREE_PHASE:
-                       return (1);
+                       goto out;
 
                default:
 
                default:
-                       printf("unexpected scsi phase %d\n", phase);
+                       printf("scsi%d: unexpected scsi phase %d\n",
+                              hs - scsi_softc, phase);
                        goto abort;
                }
                        goto abort;
                }
+#ifdef SLOWSCSI
+               /*
+                * XXX we have wierd transient problems with booting from
+                * slow scsi disks on fast machines.  I have never been
+                * able to pin the problem down, but a large delay here
+                * seems to always work.
+                */
+               DELAY(1000);
+#endif
                /* wait for last command to complete */
                while ((ints = hd->scsi_ints) == 0) {
                        if (--wait < 0)
                /* wait for last command to complete */
                while ((ints = hd->scsi_ints) == 0) {
                        if (--wait < 0)
@@ -322,73 +335,64 @@ scsiicmd(hs, target, cbuf, clen, buf, len, xferphase)
                if (ints & INTS_SRV_REQ)
                        phase = hd->scsi_psns & PHASE;
                else if (ints & INTS_DISCON)
                if (ints & INTS_SRV_REQ)
                        phase = hd->scsi_psns & PHASE;
                else if (ints & INTS_DISCON)
-                       return (1);
-               else if ((ints & INTS_CMD_DONE) == 0) {
+                       goto out;
+               else if ((ints & INTS_CMD_DONE) == 0)
                        goto abort;
                        goto abort;
-               }
        }
 abort:
        scsiabort(hs, hd);
        }
 abort:
        scsiabort(hs, hd);
-       return (0);
+out:
+       return (hs->sc_stat);
 }
 
 int
 }
 
 int
-scsi_test_unit_rdy(unit)
+scsi_test_unit_rdy(ctlr, slave)
+       int ctlr, slave;
 {
 {
-       int ctlr = scsiunit(unit);
-       int slave = scsislave(unit);
        register struct scsi_softc *hs = &scsi_softc[ctlr];
        static struct scsi_cdb6 cdb = { CMD_TEST_UNIT_READY };
 
        register struct scsi_softc *hs = &scsi_softc[ctlr];
        static struct scsi_cdb6 cdb = { CMD_TEST_UNIT_READY };
 
-       if (scsiicmd(hs, slave, &cdb, sizeof(cdb), (u_char *)0, 0,
-                    STATUS_PHASE) == 0)
-               return (0);
-               
-       return (hs->sc_stat == 0);
+       return (scsiicmd(hs, slave, &cdb, sizeof(cdb), (u_char *)0, 0,
+                        STATUS_PHASE));
 }
 
 int
 }
 
 int
-scsi_request_sense(unit, buf, len)
-       int unit;
+scsi_request_sense(ctlr, slave, buf, len)
+       int ctlr, slave;
        u_char *buf;
        unsigned len;
 {
        u_char *buf;
        unsigned len;
 {
-       int ctlr = scsiunit(unit);
-       int slave = scsislave(unit);
        register struct scsi_softc *hs = &scsi_softc[ctlr];
        static struct scsi_cdb6 cdb = { CMD_REQUEST_SENSE };
 
        cdb.len = len;
        register struct scsi_softc *hs = &scsi_softc[ctlr];
        static struct scsi_cdb6 cdb = { CMD_REQUEST_SENSE };
 
        cdb.len = len;
-       return (scsiicmd(hs, slave, &cdb, sizeof(cdb), buf, len, DATA_IN_PHASE));
+       return (scsiicmd(hs, slave, &cdb, sizeof(cdb), buf, len,
+                        DATA_IN_PHASE));
 }
 
 int
 }
 
 int
-scsi_read_capacity(unit, buf, len)
-       int unit;
+scsi_read_capacity(ctlr, slave, buf, len)
+       int ctlr, slave;
        u_char *buf;
        unsigned len;
 {
        u_char *buf;
        unsigned len;
 {
-       int ctlr = scsiunit(unit);
-       int slave = scsislave(unit);
        register struct scsi_softc *hs = &scsi_softc[ctlr];
        static struct scsi_cdb10 cdb = { CMD_READ_CAPACITY };
 
        register struct scsi_softc *hs = &scsi_softc[ctlr];
        static struct scsi_cdb10 cdb = { CMD_READ_CAPACITY };
 
-       return (scsiicmd(hs, slave, &cdb, sizeof(cdb), buf, len, DATA_IN_PHASE));
+       return (scsiicmd(hs, slave, &cdb, sizeof(cdb), buf, len,
+                        DATA_IN_PHASE));
 }
 
 int
 }
 
 int
-scsi_tt_read(unit, buf, len, blk, nblk)
-       int unit;
+scsi_tt_read(ctlr, slave, buf, len, blk, nblk)
+       int ctlr, slave;
        u_char *buf;
        u_int len;
        daddr_t blk;
        u_int nblk;
 {
        u_char *buf;
        u_int len;
        daddr_t blk;
        u_int nblk;
 {
-       int ctlr = scsiunit(unit);
-       int slave = scsislave(unit);
        register struct scsi_softc *hs = &scsi_softc[ctlr];
        struct scsi_cdb10 cdb;
        register struct scsi_softc *hs = &scsi_softc[ctlr];
        struct scsi_cdb10 cdb;
-       int stat;
 
        bzero(&cdb, sizeof(cdb));
        cdb.cmd = CMD_READ_EXT;
 
        bzero(&cdb, sizeof(cdb));
        cdb.cmd = CMD_READ_EXT;
@@ -398,25 +402,20 @@ scsi_tt_read(unit, buf, len, blk, nblk)
        cdb.lbal = blk;
        cdb.lenh = nblk >> (8 + DEV_BSHIFT);
        cdb.lenl = nblk >> DEV_BSHIFT;
        cdb.lbal = blk;
        cdb.lenh = nblk >> (8 + DEV_BSHIFT);
        cdb.lenl = nblk >> DEV_BSHIFT;
-       stat = scsiicmd(hs, slave, &cdb, sizeof(cdb), buf, len, DATA_IN_PHASE);
-       if (stat == 0)
-               return (1);
-       return (hs->sc_stat);
+       return (scsiicmd(hs, slave, &cdb, sizeof(cdb), buf, len,
+                        DATA_IN_PHASE));
 }
 
 int
 }
 
 int
-scsi_tt_write(unit, buf, len, blk, nblk)
-       int unit;
+scsi_tt_write(ctlr, slave, buf, len, blk, nblk)
+       int ctlr, slave;
        u_char *buf;
        u_int len;
        daddr_t blk;
        u_int nblk;
 {
        u_char *buf;
        u_int len;
        daddr_t blk;
        u_int nblk;
 {
-       int ctlr = scsiunit(unit);
-       int slave = scsislave(unit);
        register struct scsi_softc *hs = &scsi_softc[ctlr];
        struct scsi_cdb10 cdb;
        register struct scsi_softc *hs = &scsi_softc[ctlr];
        struct scsi_cdb10 cdb;
-       int stat;
 
        bzero(&cdb, sizeof(cdb));
        cdb.cmd = CMD_WRITE_EXT;
 
        bzero(&cdb, sizeof(cdb));
        cdb.cmd = CMD_WRITE_EXT;
@@ -426,8 +425,6 @@ scsi_tt_write(unit, buf, len, blk, nblk)
        cdb.lbal = blk;
        cdb.lenh = nblk >> (8 + DEV_BSHIFT);
        cdb.lenl = nblk >> DEV_BSHIFT;
        cdb.lbal = blk;
        cdb.lenh = nblk >> (8 + DEV_BSHIFT);
        cdb.lenl = nblk >> DEV_BSHIFT;
-       stat = scsiicmd(hs, slave, &cdb, sizeof(cdb), buf, len, DATA_OUT_PHASE);
-       if (stat == 0)
-               return (1);
-       return (hs->sc_stat);
+       return (scsiicmd(hs, slave, &cdb, sizeof(cdb), buf, len,
+                        DATA_OUT_PHASE));
 }
 }
index 597c173..0cc04a3 100644 (file)
  *
  * from: Utah $Hdr: sd.c 1.2 90/01/23$
  *
  *
  * from: Utah $Hdr: sd.c 1.2 90/01/23$
  *
- *     @(#)sd.c        7.4 (Berkeley) %G%
+ *     @(#)sd.c        7.5 (Berkeley) %G%
  */
 
 /*
  * SCSI CCS disk driver
  */
 
  */
 
 /*
  * SCSI CCS disk driver
  */
 
-#include <sys/param.h>
+#include "sys/param.h"
 #include "saio.h"
 #include "samachdep.h"
 
 #include "saio.h"
 #include "samachdep.h"
 
@@ -28,36 +28,36 @@ struct      sd_softc {
        char    sc_retry;
        char    sc_alive;
        short   sc_blkshift;
        char    sc_retry;
        char    sc_alive;
        short   sc_blkshift;
-} sd_softc[NSD];
+} sd_softc[NSCSI][NSD];
 
 int sdpartoff[] = {
        1024,   17408,  0,      17408,
 
 int sdpartoff[] = {
        1024,   17408,  0,      17408,
-       115712, 218112, 82944,  0
+       115712, 218112, 82944,  115712
 };
 
 #define        SDRETRY         2
 
 };
 
 #define        SDRETRY         2
 
-sdinit(unit)
-       register int unit;
+sdinit(ctlr, unit)
+       int ctlr, unit;
 {
 {
-       register struct sd_softc *ss;
+       register struct sd_softc *ss = &sd_softc[ctlr][unit];
        u_char stat;
        int capbuf[2];
 
        u_char stat;
        int capbuf[2];
 
-       if (unit > NSD)
-               return (0);
-       ss = &sd_softc[unit];
        /* NB: HP6300 won't boot if next printf is removed (???) - vj */
        /* NB: HP6300 won't boot if next printf is removed (???) - vj */
-       printf("sd%d: ", unit);
-       if ((stat = scsi_test_unit_rdy(unit)) == 0) {
+       printf("sd(%d,%d,0,0): ", ctlr, unit);
+       stat = scsi_test_unit_rdy(ctlr, unit);
+       if (stat) {
                /* drive may be doing RTZ - wait a bit */
                /* drive may be doing RTZ - wait a bit */
-               printf("not ready - retrying ... ");
+               printf("not ready - ");
                if (stat == STS_CHECKCOND) {
                if (stat == STS_CHECKCOND) {
+                       printf("retrying ... ");
                        DELAY(1000000);
                        DELAY(1000000);
-                       if (scsi_test_unit_rdy(unit) == 0) {
-                               printf("giving up.\n");
-                               return (0);
-                       }
+                       stat = scsi_test_unit_rdy(ctlr, unit);
+               }
+               if (stat) {
+                       printf("giving up (stat=%x).\n", stat);
+                       return (0);
                }
        }
        printf("unit ready.\n");
                }
        }
        printf("unit ready.\n");
@@ -66,7 +66,9 @@ sdinit(unit)
         */
        capbuf[0] = 0;
        capbuf[1] = 0;
         */
        capbuf[0] = 0;
        capbuf[1] = 0;
-       if (scsi_read_capacity(unit, (u_char *)capbuf, sizeof(capbuf)) != 0) {
+       stat = scsi_read_capacity(ctlr, unit,
+                                 (u_char *)capbuf, sizeof(capbuf));
+       if (stat == 0) {
                if (capbuf[1] > DEV_BSIZE)
                        for (; capbuf[1] > DEV_BSIZE; capbuf[1] >>= 1)
                                ++ss->sc_blkshift;
                if (capbuf[1] > DEV_BSIZE)
                        for (; capbuf[1] > DEV_BSIZE; capbuf[1] >>= 1)
                                ++ss->sc_blkshift;
@@ -75,49 +77,59 @@ sdinit(unit)
        return (1);
 }
 
        return (1);
 }
 
-sdreset(unit)
+sdreset(ctlr, unit)
+       int ctlr, unit;
 {
 }
 
 sdopen(io)
        struct iob *io;
 {
 {
 }
 
 sdopen(io)
        struct iob *io;
 {
-       register int unit = io->i_unit;
-       register struct sd_softc *ss = &sd_softc[unit];
-       struct sdinfo *ri;
+       register struct sd_softc *ss;
+       int ctlr, unit, part;
 
 
-       if (scsialive(unit) == 0)
-               _stop("scsi controller not configured");
+       devconvert(io);
+
+       ctlr = io->i_adapt;
+       if (ctlr >= NSCSI || scsialive(ctlr) == 0)
+               return (EADAPT);
+       unit = io->i_ctlr;
+       if (unit >= NSD)
+               return (ECTLR);
+       ss = &sd_softc[ctlr][unit];
        if (ss->sc_alive == 0)
        if (ss->sc_alive == 0)
-               if (sdinit(unit) == 0)
-                       _stop("sd init failed");
-       if (io->i_boff < 0 || io->i_boff > 7)
-               _stop("sd bad minor");
-       io->i_boff = sdpartoff[io->i_boff];
+               if (sdinit(ctlr, unit) == 0)
+                       return (ENXIO);
+       part = io->i_part;
+       if (part >= 8)
+               return (EPART);
+       io->i_boff = sdpartoff[part];
+       return (0);
 }
 
 sdstrategy(io, func)
        register struct iob *io;
 }
 
 sdstrategy(io, func)
        register struct iob *io;
-       register int func;
+       int func;
 {
 {
-       register int unit = io->i_unit;
-       register struct sd_softc *ss = &sd_softc[unit];
-       char stat;
+       register int ctlr = io->i_adapt;
+       register int unit = io->i_ctlr;
+       register struct sd_softc *ss = &sd_softc[ctlr][unit];
        daddr_t blk = io->i_bn >> ss->sc_blkshift;
        u_int nblk = io->i_cc >> ss->sc_blkshift;
        daddr_t blk = io->i_bn >> ss->sc_blkshift;
        u_int nblk = io->i_cc >> ss->sc_blkshift;
+       char stat;
 
        ss->sc_retry = 0;
 retry:
        if (func == F_READ)
 
        ss->sc_retry = 0;
 retry:
        if (func == F_READ)
-               stat = scsi_tt_read(unit, io->i_ma, io->i_cc, blk, nblk);
+               stat = scsi_tt_read(ctlr, unit, io->i_ma, io->i_cc, blk, nblk);
        else
        else
-               stat = scsi_tt_write(unit, io->i_ma, io->i_cc, blk, nblk);
+               stat = scsi_tt_write(ctlr, unit, io->i_ma, io->i_cc, blk, nblk);
        if (stat) {
        if (stat) {
-               printf("sd(%d,?) err: 0x%x\n", unit, stat);
+               printf("sd(%d,%d,%d,%d): block=%x, error=0x%x\n",
+                      ctlr, unit, io->i_unit, io->i_part, blk, stat);
                if (++ss->sc_retry > SDRETRY)
                        return(-1);
                if (++ss->sc_retry > SDRETRY)
                        return(-1);
-               else
-                       goto retry;
+               goto retry;
        }
        return(io->i_cc);
 }
        }
        return(io->i_cc);
 }
index 03c0903..2bbd8a5 100644 (file)
@@ -9,9 +9,9 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- * from: Utah $Hdr: srt0.c 1.12 91/04/25$
+ * from: Utah $Hdr: srt0.c 1.15 92/06/18$
  *
  *
- *     @(#)srt0.c      7.5 (Berkeley) %G%
+ *     @(#)srt0.c      7.6 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
        .globl  _edata
        .globl  _main
        .globl  _configure
        .globl  _edata
        .globl  _main
        .globl  _configure
-       .globl  _bootdev
        .globl  _firstopen
        .globl  __rtt
        .globl  _firstopen
        .globl  __rtt
-       .globl  _lowram,_howto,_devtype,_internalhpib,_machineid
+       .globl  _bootdev,_howto,_lowram,_machineid
+       .globl  _internalhpib
 
        STACK =    0xfffff000   | below the ROM page
        BOOTTYPE = 0xfffffdc0
 
        STACK =    0xfffff000   | below the ROM page
        BOOTTYPE = 0xfffffdc0
@@ -43,8 +43,6 @@
        .data
 _bootdev:
        .long   0
        .data
 _bootdev:
        .long   0
-_devtype:
-       .long   0
 _howto:
        .long   0
 _lowram:
 _howto:
        .long   0
 _lowram:
@@ -74,9 +72,10 @@ vecloop:
        movc    d0,cacr         |   only exists on 68030
        movc    cacr,d0         | read it back
        tstl    d0              | zero?
        movc    d0,cacr         |   only exists on 68030
        movc    cacr,d0         | read it back
        tstl    d0              | zero?
-       jeq     is68020         | yes, we have 68020
+       jeq     not68030        | yes, we have 68020/68040
        movl    #0x808,d0
        movc    d0,cacr         | clear data freeze bit again
        movl    #0x808,d0
        movc    d0,cacr         | clear data freeze bit again
+
        movl    #0x80,MMUCMD    | set magic cookie
        movl    MMUCMD,d0       | read it back
        btst    #7,d0           | cookie still on?
        movl    #0x80,MMUCMD    | set magic cookie
        movl    MMUCMD,d0       | read it back
        btst    #7,d0           | cookie still on?
@@ -96,6 +95,20 @@ not370:
        jeq     ihpibcheck      | no, a 360
        movl    #6,a0@          | yes, must be a 345/375/400
        jra     ihpibcheck
        jeq     ihpibcheck      | no, a 360
        movl    #6,a0@          | yes, must be a 345/375/400
        jra     ihpibcheck
+not68030:
+       bset    #31,d0          | data cache enable bit
+       movc    d0,cacr         |   only exists on 68040
+       movc    cacr,d0         | read it back
+       tstl    d0              | zero?
+       beq     is68020         | yes, we have 68020
+       moveq   #0,d0           | now turn it back off
+       movec   d0,cacr         |   before we access any data
+       .long   0x4e7b0004      | movc d0,itt0
+       .long   0x4e7b0005      | movc d0,itt1
+       .long   0x4e7b0006      | movc d0,dtt0
+       .long   0x4e7b0007      | movc d0,dtt1
+       movl    #7,a0@          | we have a 380
+       jra     ihpibcheck
 is68020:
        movl    #1,a0@          | consider a 330 for now
        movl    #1,MMUCMD       | a 68020, write HP MMU location
 is68020:
        movl    #1,a0@          | consider a 330 for now
        movl    #1,MMUCMD       | a 68020, write HP MMU location
@@ -114,39 +127,30 @@ ihpibcheck:
        jeq     boottype        | yes, continue
        clrl    _internalhpib   | no, clear the internal address
 /*
        jeq     boottype        | yes, continue
        clrl    _internalhpib   | no, clear the internal address
 /*
- * If this is a reboot, extract howto/devtype stored by kernel
+ * If this is a reboot, extract howto/bootdev stored by kernel
  */
 boottype:
        cmpw    #12,BOOTTYPE    | is this a reboot (REQ_REBOOT)?
        jne     notreboot       | no, skip
  */
 boottype:
        cmpw    #12,BOOTTYPE    | is this a reboot (REQ_REBOOT)?
        jne     notreboot       | no, skip
-       movl    #MAXADDR,a0     | find last page
-       movl    a0@+,d7         | and extract howto, devtype
+       lea     MAXADDR,a0      | find last page
+       movl    a0@+,d7         | and extract howto, bootdev
        movl    a0@+,d6         |   from where doboot() left them
        jra     boot1
 /*
        movl    a0@+,d6         |   from where doboot() left them
        jra     boot1
 /*
- * At this point we do not know which logical hpib the given select
- * code refers to.  So we just put the select code in the adaptor field
- * where hpibinit() can replace it with the logical hpib number.
- * Note that this may clobber the B_DEVMAGIC field but that isn't set
- * til later anyway.
+ * At this point we do not know which logical device the MSUS select
+ * code refers to so we cannot construct bootdev.  So we just punt
+ * and let configure() construct it.
  */
 notreboot:
  */
 notreboot:
+       moveq   #0,d6           | make sure bootdev is invalid
        cmpw    #18,BOOTTYPE    | does the user want to interact?
        jeq     askme           | yes, go to it
        cmpw    #18,BOOTTYPE    | does the user want to interact?
        jeq     askme           | yes, go to it
-       movl    MSUS,d1         | no, get rom info
-       movw    d1,d6           | MSUS comes with SC in upper, unit in lower
-       swap    d6              | put in place
-       movw    #2,d6           | assume 'a' partition of rd disk
        moveq   #0,d7           | default to RB_AUTOBOOT
        jra     boot1
 askme:
        moveq   #0,d7           | default to RB_AUTOBOOT
        jra     boot1
 askme:
-       moveq   #7,d6           | default to HP-IB at sc7
-       lslw    #8,d6           | position as adaptor number
-       swap    d6              | put in place (note implied unit 0)
-       movw    #2,d6           | assume 'a' partition of rd disk
        moveq   #3,d7           | default to RB_SINGLE|RB_ASKNAME
 boot1:
        moveq   #3,d7           | default to RB_SINGLE|RB_ASKNAME
 boot1:
-       movl    d6,_devtype     | save devtype and howto
+       movl    d6,_bootdev     | save bootdev and howto
        movl    d7,_howto       |   globally so all can access
        movl    LOWRAM,d0       | read lowram value from bootrom
        addl    #NBPG,d0        | must preserve this for bootrom to reboot
        movl    d7,_howto       |   globally so all can access
        movl    LOWRAM,d0       | read lowram value from bootrom
        addl    #NBPG,d0        | must preserve this for bootrom to reboot
@@ -176,7 +180,7 @@ _badaddr:
        movl    #catchbad,BUSERR| plug in our handler
        movl    sp@(4),a0       | address to probe
        movw    a0@,d1          | do it
        movl    #catchbad,BUSERR| plug in our handler
        movl    sp@(4),a0       | address to probe
        movw    a0@,d1          | do it
-       movl    __bsave,BUSERR  | if we got here, it didn''t fault /* XXX cpp */
+       movl    __bsave,BUSERR  | if we got here, it did not fault
        clrl    d0              | return that this was not a bad addr
        rts
 
        clrl    d0              | return that this was not a bad addr
        rts
 
@@ -196,6 +200,13 @@ trap:
        moveml  #0xFFFF,sp@-    | save registers
        movl    sp,sp@-         | push pointer to frame
        jsr     _trap           | call C routine to deal with it
        moveml  #0xFFFF,sp@-    | save registers
        movl    sp,sp@-         | push pointer to frame
        jsr     _trap           | call C routine to deal with it
+       tstl    d0
+       jeq     Lstop
+       addql   #4,sp
+       moveml  sp@+,#0x7FFF
+       addql   #8,sp
+       rte
+Lstop:
        stop    #0x2700         | stop cold
 
 nmi:
        stop    #0x2700         | stop cold
 
 nmi: