use old DS3100 style entry point for SCSI disk I/O
authorRalph Campbell <ralph@ucbvax.Berkeley.EDU>
Tue, 16 Feb 1993 03:22:42 +0000 (19:22 -0800)
committerRalph Campbell <ralph@ucbvax.Berkeley.EDU>
Tue, 16 Feb 1993 03:22:42 +0000 (19:22 -0800)
SCCS-vsn: sys/pmax/stand/mkboot.c 7.6
SCCS-vsn: sys/pmax/stand/boot.c 7.6
SCCS-vsn: sys/pmax/stand/conf.c 7.5
SCCS-vsn: sys/pmax/stand/Makefile 5.4
SCCS-vsn: sys/pmax/stand/start.s 7.5
SCCS-vsn: sys/pmax/stand/rz.c 7.2

usr/src/sys/pmax/stand/Makefile
usr/src/sys/pmax/stand/boot.c
usr/src/sys/pmax/stand/conf.c
usr/src/sys/pmax/stand/mkboot.c
usr/src/sys/pmax/stand/rz.c
usr/src/sys/pmax/stand/start.s

index dcc4871..87245bf 100644 (file)
@@ -1,4 +1,4 @@
-#      @(#)Makefile    5.3 (Berkeley) %G%
+#      @(#)Makefile    5.4 (Berkeley) %G%
 
 DESTDIR=
 STAND= ../../stand
 
 DESTDIR=
 STAND= ../../stand
@@ -12,13 +12,17 @@ DEFS= -DSTANDALONE -DDS5000 -DSMALL
 CFLAGS=        -O ${INCPATH} ${DEFS}
 AFLAGS=        -O ${INCPATH} ${DEFS} -DLOCORE
 
 CFLAGS=        -O ${INCPATH} ${DEFS}
 AFLAGS=        -O ${INCPATH} ${DEFS} -DLOCORE
 
-DRIVERS=asc.c rz.c sii.c scsi.c
-SRCS=  conf.c machdep.c trap.c ${DRIVERS}
+DRIVERS= rz.c
+SRCS=  ${DRIVERS}
 LIBS=  libdrive.a libsa/libsa.a ../../libkern/obj/libkern.a
 
 #ALL=  boot mkboot mkboottape
 ALL=   boot
 
 LIBS=  libdrive.a libsa/libsa.a ../../libkern/obj/libkern.a
 
 #ALL=  boot mkboot mkboottape
 ALL=   boot
 
+.s.o:
+       ${CPP} -E ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \
+           ${AS} -o ${.TARGET}
+
 all: ${ALL}
 
 boot: ${LIBS}
 all: ${ALL}
 
 boot: ${LIBS}
@@ -26,22 +30,20 @@ boot: ${LIBS}
 libsa/libsa.a::
        cd libsa; make
 
 libsa/libsa.a::
        cd libsa; make
 
-libdrive.a: conf.o machdep.o trap.o ${DRIVERS:.c=.o}
+libdrive.a: conf.o ${DRIVERS:.c=.o}
        ar crv $@ $?
        ranlib $@
 
        ar crv $@ $?
        ranlib $@
 
-${DRIVERS}: samachdep.h
-
 # depend on DEFS
 
 # depend on DEFS
 
-machdep.o rz.o trap.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
-
 # bootable from real disks
 
 # bootable from real disks
 
-boot:  locore.o boot.o bootconf.o ${LIBS}
-       ld -N -T ${RELOC} -e start locore.o boot.o bootconf.o ${LIBS} -o $@ 
+boot:  start.o boot.o bootconf.o ${LIBS}
+       ld -N -Ttext ${RELOC} -e start start.o boot.o bootconf.o ${LIBS} -o $@ 
+
+start.o: start.s
+       ${CPP} -E ${CFLAGS:M-[ID]*} -DLOCORE ${AINC} ${.IMPSRC} | \
+           ${AS} -o ${.TARGET}
 
 bootconf.o: conf.o
        rm -f bootconf.c
 
 bootconf.o: conf.o
        rm -f bootconf.c
index 85cf10c..0aabed3 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)boot.c      7.5 (Berkeley) %G%
+ *     @(#)boot.c      7.6 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -100,7 +100,7 @@ loadfile(fname)
                goto err;
        }
 
                goto err;
        }
 
-       /* read the COFF header */
+       /* read the exec header */
        i = read(fd, (char *)&aout, sizeof(aout));
        if (i != sizeof(aout)) {
                printf("No a.out header\n");
        i = read(fd, (char *)&aout, sizeof(aout));
        if (i != sizeof(aout)) {
                printf("No a.out header\n");
@@ -119,7 +119,7 @@ loadfile(fname)
        }
        i = aout.a_text + aout.a_data;
 #ifndef TEST
        }
        i = aout.a_text + aout.a_data;
 #ifndef TEST
-       n = read(fd, (char *)aout.ex_aout.codeStart, i);
+       n = read(fd, (char *)aout.a_entry, i);
 #else
        n = i;
 #endif
 #else
        n = i;
 #endif
index 67d26b6..d2b7305 100644 (file)
@@ -7,36 +7,30 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)conf.c      7.4 (Berkeley) %G%
+ *     @(#)conf.c      7.5 (Berkeley) %G%
  */
 
 #include <stand/stand.h>
  */
 
 #include <stand/stand.h>
-#include <pmax/stand/samachdep.h>
+
+const  struct callback *callv;
+int    errno;
 
 extern int     nullsys(), nodev(), noioctl();
 
 
 extern int     nullsys(), nodev(), noioctl();
 
-#if NRZ > 0
 int    rzstrategy(), rzopen(), rzclose();
 int    rzstrategy(), rzopen(), rzclose();
-#else
-#define        rzstrategy      nodev
-#define        rzopen          nodev
-#define        rzclose         nodev
-#endif
 #define        rzioctl         noioctl
 
 #define        rzioctl         noioctl
 
-#if NTZ > 0 && !defined(BOOT)
+#ifndef BOOT
 int    tzstrategy(), tzopen(), tzclose();
 int    tzstrategy(), tzopen(), tzclose();
-#else
-#define        tzstrategy      nodev
-#define        tzopen          nodev
-#define        tzclose         nodev
 #endif
 #define        tzioctl         noioctl
 
 
 struct devsw devsw[] = {
        { "rz", rzstrategy,     rzopen, rzclose,        rzioctl }, /*0*/
 #endif
 #define        tzioctl         noioctl
 
 
 struct devsw devsw[] = {
        { "rz", rzstrategy,     rzopen, rzclose,        rzioctl }, /*0*/
+#ifndef BOOT
        { "tz", tzstrategy,     tzopen, tzclose,        tzioctl }, /*1*/
        { "tz", tzstrategy,     tzopen, tzclose,        tzioctl }, /*1*/
+#endif
 };
 
 int    ndevs = (sizeof(devsw)/sizeof(devsw[0]));
 };
 
 int    ndevs = (sizeof(devsw)/sizeof(devsw[0]));
index 633db6c..08b570c 100644 (file)
@@ -15,7 +15,7 @@ char copyright[] =
 #endif not lint
 
 #ifndef lint
 #endif not lint
 
 #ifndef lint
-static char sccsid[] = "@(#)mkboot.c   7.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)mkboot.c   7.6 (Berkeley) %G%";
 #endif not lint
 
 #include <sys/param.h>
 #endif not lint
 
 #include <sys/param.h>
@@ -73,7 +73,7 @@ main(argc, argv)
        /*
         * Check for exec header and skip to code segment.
         */
        /*
         * Check for exec header and skip to code segment.
         */
-       if (!DecHeader(ifd, &loadAddr, &execAddr, &length)) {
+       if (!GetHeader(ifd, &loadAddr, &execAddr, &length)) {
                fprintf(stderr, "Need impure text format (OMAGIC) file\n");
                exit(1);
        }
                fprintf(stderr, "Need impure text format (OMAGIC) file\n");
                exit(1);
        }
@@ -133,19 +133,20 @@ usage()
 /*
  *----------------------------------------------------------------------
  *
 /*
  *----------------------------------------------------------------------
  *
- * DecHeader -
+ * GetHeader -
  *
  *
- *     Check if the header is a DEC (COFF) file.
+ *     Check if the header is an a.out file.
  *
  * Results:
  *     Return true if all went ok.
  *
  * Side effects:
  *
  * Results:
  *     Return true if all went ok.
  *
  * Side effects:
- *     None.
+ *     bootFID is left ready to read the text & data sections.
+ *     length is set to the size of the text + data sections.
  *
  *----------------------------------------------------------------------
  */
  *
  *----------------------------------------------------------------------
  */
-DecHeader(bootFID, loadAddr, execAddr, length)
+GetHeader(bootFID, loadAddr, execAddr, length)
        int bootFID;    /* Handle on the boot program */
        long *loadAddr; /* Address to start loading boot program. */
        long *execAddr; /* Address to start executing boot program. */
        int bootFID;    /* Handle on the boot program */
        long *loadAddr; /* Address to start loading boot program. */
        long *execAddr; /* Address to start executing boot program. */
@@ -159,16 +160,15 @@ DecHeader(bootFID, loadAddr, execAddr, length)
                return 0;
        }
        bytesRead = read(bootFID, (char *)&aout, sizeof(aout));
                return 0;
        }
        bytesRead = read(bootFID, (char *)&aout, sizeof(aout));
-       if (bytesRead != sizeof(aout) || aout.ex_fhdr.magic != COFF_MAGIC ||
-           aout.a_magic != OMAGIC)
+       if (bytesRead != sizeof(aout) || aout.a_magic != OMAGIC)
                return 0;
                return 0;
-       *loadAddr = aout.ex_aout.codeStart;
+       *loadAddr = aout.a_entry;
        *execAddr = aout.a_entry;
        *length = aout.a_text + aout.a_data;
        if (lseek(bootFID, N_TXTOFF(aout), 0) < 0) {
                perror(bootfname);
                return 0;
        }
        *execAddr = aout.a_entry;
        *length = aout.a_text + aout.a_data;
        if (lseek(bootFID, N_TXTOFF(aout), 0) < 0) {
                perror(bootfname);
                return 0;
        }
-       printf("Input file is COFF format\n");
+       printf("Input file is a.out format\n");
        return 1;
 }
        return 1;
 }
index b8da33a..5eb9972 100644 (file)
@@ -7,46 +7,21 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)rz.c        7.1 (Berkeley) %G%
+ *     @(#)rz.c        7.2 (Berkeley) %G%
  */
 
  */
 
-/*
- * SCSI CCS (Command Command Set) disk driver.
- * NOTE: The name was changed from "sd" to "rz" for DEC naming compatibility.
- * I guess I can't avoid confusion someplace.
- */
-#include <pmax/stand/samachdep.h>
-#if NRZ > 0
-
 #include <stand/stand.h>
 #include <sys/param.h>
 #include <sys/disklabel.h>
 #include <stand/stand.h>
 #include <sys/param.h>
 #include <sys/disklabel.h>
-#include <pmax/dev/device.h>
-#include <pmax/dev/scsi.h>
-
-void   rzstart(), rzdone();
-
-struct driver rzdriver = {
-       "rz", (int (*)())0, rzstart, rzdone,
-};
 
 struct rz_softc {
 
 struct rz_softc {
-       struct  scsi_device sc_sd;      /* physical unit info */
-       u_short sc_part;                /* disk partition number */
-       u_short sc_type;                /* drive type from INQUIRY cmd */
-       u_int   sc_blks;                /* number of blocks on device */
-       int     sc_blksize;             /* device block size in bytes */
-       int     sc_bshift;              /* convert device blocks to DEV_BSIZE */
+       int     sc_fd;                  /* PROM file id */
+       int     sc_ctlr;                /* controller number */
+       int     sc_unit;                /* disk unit number */
+       int     sc_part;                /* disk partition number */
        struct  disklabel sc_label;     /* disk label for this disk */
        struct  disklabel sc_label;     /* disk label for this disk */
-       struct  ScsiCmd sc_cmd;         /* command for controller */
-       ScsiGroup1Cmd sc_rwcmd;         /* group 1 SCSI commands */
-       struct  scsi_fmt_sense sc_sense;        /* sense data from last cmd */
-       int     sc_error;               /* error code */
-       int     sc_resid;               /* amount of data not transfered */
 };
 
 };
 
-volatile int   done;
-
 int
 rzstrategy(devdata, rw, bn, reqcnt, addr, cnt)
        void *devdata;
 int
 rzstrategy(devdata, rw, bn, reqcnt, addr, cnt)
        void *devdata;
@@ -60,126 +35,26 @@ rzstrategy(devdata, rw, bn, reqcnt, addr, cnt)
        register int part = sc->sc_part;
        register struct partition *pp = &sc->sc_label.d_partitions[part];
        register int s;
        register int part = sc->sc_part;
        register struct partition *pp = &sc->sc_label.d_partitions[part];
        register int s;
-       long cylin;
+       long offset;
 
 
-       sc->sc_error = 0;
-       s = howmany(reqcnt, DEV_BSIZE);
-       if ((unsigned)bn + s > pp->p_size) {
-               s = pp->p_size - bn;
-               /* if exactly at end of disk, return an EOF */
-               if (s == 0) {
-                       *cnt = 0;
-                       return (0);
-               }
-               /* if none of it fits, error */
-               if (s < 0) {
-                       *cnt = 0;
-                       return (EINVAL);
-               }
-               /* otherwise, truncate */
-               reqcnt = dbtob(s);
-       }
+       offset = bn * DEV_BSIZE;
        /*
        /*
-        * Non-aligned or partial-block transfers not handled.
+        * Partial-block transfers not handled.
         */
         */
-       s = sc->sc_blksize - 1;
-       if ((dbtob(bn) & s) || (reqcnt & s)) {
+       if (reqcnt & (DEV_BSIZE - 1)) {
                *cnt = 0;
                return (EINVAL);
        }
                *cnt = 0;
                return (EINVAL);
        }
-       cylin = (bn + pp->p_offset) >> sc->sc_bshift;
-
-       sc->sc_cmd.buf = addr;
-       sc->sc_cmd.buflen = reqcnt;
-       sc->sc_cmd.cmd = (u_char *)&sc->sc_rwcmd;
-       sc->sc_cmd.cmdlen = sizeof(sc->sc_rwcmd);
-
-       if (rw & F_READ) {
-               sc->sc_cmd.flags = 0;
-               sc->sc_rwcmd.command = SCSI_READ_EXT;
-       } else {
-               sc->sc_cmd.flags = SCSICMD_DATA_TO_DEVICE;
-               sc->sc_rwcmd.command = SCSI_WRITE_EXT;
-       }
-       sc->sc_rwcmd.highAddr = cylin >> 24;
-       sc->sc_rwcmd.midHighAddr = cylin >> 16;
-       sc->sc_rwcmd.midLowAddr = cylin >> 8;
-       sc->sc_rwcmd.lowAddr = cylin;
-       s = howmany(reqcnt, sc->sc_blksize);
-       sc->sc_rwcmd.highBlockCount = s >> 8;
-       sc->sc_rwcmd.lowBlockCount = s;
-
-       rzstart(sc);
 
 
-       *cnt = reqcnt - sc->sc_resid;
-       return (sc->sc_error);
-}
-
-void
-rzstart(sc)
-       register struct rz_softc *sc;
-{
-       ScsiGroup0Cmd reqcmd;
-
-       /* tell controller to start this command */
-       done = 0;
-       (*sc->sc_sd.sd_cdriver->d_start)(&sc->sc_cmd);
-       while (!done)
-               ;
-
-       /* check for errors that need to be processed */
-       if (!(sc->sc_sense.status & SCSI_STATUS_CHECKCOND))
-               return;
-
-       /* start a REQUEST_SENSE command */
-       scsiGroup0Cmd(SCSI_REQUEST_SENSE, sc->sc_sd.sd_slave, 0,
-               sizeof(sc->sc_sense.sense), &reqcmd);
-       sc->sc_cmd.cmdlen = sizeof(ScsiGroup0Cmd);
-       sc->sc_cmd.cmd = (u_char *)&reqcmd;
-       sc->sc_cmd.buf = (char *)sc->sc_sense.sense;
-       sc->sc_cmd.buflen = sizeof(sc->sc_sense.sense);
-       sc->sc_cmd.flags = 0;
-
-       /* tell controller to start this command */
-       done = 0;
-       (*sc->sc_sd.sd_cdriver->d_start)(&sc->sc_cmd);
-       while (!done)
-               ;
-
-       if (sc->sc_error || (sc->sc_sense.status & SCSI_STATUS_CHECKCOND)) {
-               printf("rz%d: error reading sense data: error %d scsi status 0x%x\n",
-                       sc->sc_sd.sd_unit, sc->sc_error, sc->sc_sense.status);
-               /*
-                * We got an error during the REQUEST_SENSE,
-                * fill in no sense for data.
-                */
-               sc->sc_sense.sense[0] = 0x70;
-               sc->sc_sense.sense[2] = SCSI_CLASS7_NO_SENSE;
-       } else {
-               printf("rz%d: ", sc->sc_sd.sd_unit);
-               scsiPrintSense((ScsiClass7Sense *)sc->sc_sense.sense,
-                       sizeof(sc->sc_sense.sense) - sc->sc_resid);
-       }
-       if (sc->sc_error == 0)
-               sc->sc_error = EIO;
-}
-
-/*
- * This is called by the controller driver when the command is done.
- */
-void
-rzdone(data, error, resid, status)
-       void *data;
-       int error;              /* error number from errno.h */
-       int resid;              /* amount not transfered */
-       int status;             /* SCSI status byte */
-{
-       register struct rz_softc *sc = (struct rz_softc *)data;
+       offset += pp->p_offset * DEV_BSIZE;
+       if (prom_lseek(sc->sc_fd, offset, 0) < 0)
+               return (EIO);
+       s = prom_read(sc->sc_fd, addr, reqcnt);
+       if (s < 0)
+               return (EIO);
 
 
-       sc->sc_error = error;
-       sc->sc_resid = resid;
-       sc->sc_sense.status = status;
-       done = 1;
+       *cnt = s;
+       return (0);
 }
 
 int
 }
 
 int
@@ -189,149 +64,35 @@ rzopen(f, ctlr, unit, part)
 {
        register struct rz_softc *sc;
        register struct disklabel *lp;
 {
        register struct rz_softc *sc;
        register struct disklabel *lp;
-       register struct scsi_device *sd;
        register int i;
        char *msg;
        register int i;
        char *msg;
-       ScsiGroup0Cmd inqcmd;
-       ScsiInquiryData inqbuf;
-       u_char capbuf[8];
        char buf[DEV_BSIZE];
        int cnt;
        char buf[DEV_BSIZE];
        int cnt;
-       struct driver *scsi_driver;
+       static char device[] = "rz(0,0,0)";
 
 
-       if (unit >= NRZ || part >= MAXPARTITIONS)
-               return (ENXIO);
-#ifdef DS3100
-       if (ctlr >= NSII)
+       if (unit >= 8 || part >= 8)
                return (ENXIO);
                return (ENXIO);
-       else {
-               extern struct driver siidriver;
-
-               scsi_driver = &siidriver;
-       }
-#endif
-#ifdef DS5000
-       {
-       struct pmax_ctlr *cp, *tc_ctlr __P((int, int));
-
-       cp = tc_ctlr(ctlr, TC_SCSI);
-       if (!cp)
+       device[5] = '0' + unit;
+       /* NOTE: only support reads for now */
+       if ((i = prom_open(device, 0)) < 0)
                return (ENXIO);
                return (ENXIO);
-       ctlr = cp->pmax_unit;   /* convert from slot # to controller unit */
-       scsi_driver = cp->pmax_driver;
-       }
-#endif
 
        sc = alloc(sizeof(struct rz_softc));
        bzero(sc, sizeof(struct rz_softc));
        f->f_devdata = (void *)sc;
 
 
        sc = alloc(sizeof(struct rz_softc));
        bzero(sc, sizeof(struct rz_softc));
        f->f_devdata = (void *)sc;
 
-       sc->sc_sd.sd_driver = &rzdriver;
-       sc->sc_sd.sd_cdriver = scsi_driver;
-       sc->sc_sd.sd_unit = unit;
-       sc->sc_sd.sd_ctlr = ctlr;
-       sc->sc_sd.sd_drive = unit;
-       sc->sc_sd.sd_slave = 0;
-       sc->sc_sd.sd_flags = 0;
-       sc->sc_sd.sd_alive = 1;
+       sc->sc_fd = i;
+       sc->sc_ctlr = ctlr;
+       sc->sc_unit = unit;
        sc->sc_part = part;
 
        sc->sc_part = part;
 
-       /* init fields that don't change */
-       sc->sc_cmd.sd = sd = &sc->sc_sd;
-       sc->sc_cmd.unit = (int)sc;
-
-       /*
-        * Try to find out what type of device this is.
-        */
-       scsiGroup0Cmd(SCSI_INQUIRY, sd->sd_slave, 0, sizeof(inqbuf), &inqcmd);
-       sc->sc_cmd.cmdlen = sizeof(ScsiGroup0Cmd);
-       sc->sc_cmd.cmd = (u_char *)&inqcmd;
-       sc->sc_cmd.buflen = sizeof(inqbuf);
-       sc->sc_cmd.buf = (char *)&inqbuf;
-       sc->sc_cmd.flags = 0;
-
-       /* tell controller to start this command */
-       rzstart(sc);
-
-       if (sc->sc_error || (i = sizeof(inqbuf) - sc->sc_resid) < 5)
-               goto bad;
-       switch (inqbuf.type) {
-       case SCSI_DISK_TYPE:            /* disk */
-       case SCSI_WORM_TYPE:            /* WORM */
-       case SCSI_ROM_TYPE:             /* CD-ROM */
-       case SCSI_OPTICAL_MEM_TYPE:     /* Magneto-optical */
-               break;
-
-       default:                        /* not a disk */
-               goto bad;
-       }
-       sc->sc_type = inqbuf.type;
-
-       /* find out how big a disk this is */
-       scsiGroup1Cmd(SCSI_READ_CAPACITY, sd->sd_slave, 0, 0, &sc->sc_rwcmd);
-       sc->sc_cmd.cmdlen = sizeof(ScsiGroup1Cmd);
-       sc->sc_cmd.cmd = (u_char *)&sc->sc_rwcmd;
-       sc->sc_cmd.buflen = sizeof(capbuf);
-       sc->sc_cmd.buf = (char *)capbuf;
-       sc->sc_cmd.flags = 0;
-
-       rzstart(sc);
-
-       if (sc->sc_error || sc->sc_resid != 0)
-               goto bad;
-       sc->sc_blks = ((capbuf[0] << 24) | (capbuf[1] << 16) |
-               (capbuf[2] << 8) | capbuf[3]) + 1;
-       sc->sc_blksize = (capbuf[4] << 24) | (capbuf[5] << 16) |
-               (capbuf[6] << 8) | capbuf[7];
-
-#if 0
-       printf("rz%d at %s%d drive %d slave %d", sd->sd_unit,
-               sd->sd_cdriver->d_name, sd->sd_ctlr, sd->sd_drive,
-               sd->sd_slave);
-       if (inqbuf.version > 1 || i < 36)
-               printf(" type 0x%x, qual 0x%x, ver %d",
-                       inqbuf.type, inqbuf.qualifier, inqbuf.version);
-       else {
-               char vid[9], pid[17], revl[5];
-
-               bcopy((caddr_t)inqbuf.vendorID, (caddr_t)vid, 8);
-               bcopy((caddr_t)inqbuf.productID, (caddr_t)pid, 16);
-               bcopy((caddr_t)inqbuf.revLevel, (caddr_t)revl, 4);
-               for (i = 8; --i > 0; )
-                       if (vid[i] != ' ')
-                               break;
-               vid[i+1] = 0;
-               for (i = 16; --i > 0; )
-                       if (pid[i] != ' ')
-                               break;
-               pid[i+1] = 0;
-               for (i = 4; --i > 0; )
-                       if (revl[i] != ' ')
-                               break;
-               revl[i+1] = 0;
-               printf(" %s %s rev %s", vid, pid, revl);
-       }
-       printf(", %d %d byte blocks\n", sc->sc_blks, sc->sc_blksize);
-#endif
-
-       if (sc->sc_blksize != DEV_BSIZE) {
-               if (sc->sc_blksize < DEV_BSIZE) {
-                       printf("rz%d: need %d byte blocks - drive ignored\n",
-                               unit, DEV_BSIZE);
-                       goto bad;
-               }
-               for (i = sc->sc_blksize; i > DEV_BSIZE; i >>= 1)
-                       ++sc->sc_bshift;
-               sc->sc_blks <<= sc->sc_bshift;
-       }
-
        /* try to read disk label and partition table information */
        lp = &sc->sc_label;
        lp->d_secsize = DEV_BSIZE;
        /* try to read disk label and partition table information */
        lp = &sc->sc_label;
        lp->d_secsize = DEV_BSIZE;
-       lp->d_secpercyl = 1 << sc->sc_bshift;
+       lp->d_secpercyl = 1;
        lp->d_npartitions = MAXPARTITIONS;
        lp->d_partitions[part].p_offset = 0;
        lp->d_npartitions = MAXPARTITIONS;
        lp->d_partitions[part].p_offset = 0;
-       lp->d_partitions[part].p_size = sc->sc_blks;
+       lp->d_partitions[part].p_size = 0x7fffffff;
        i = rzstrategy(sc, F_READ, (daddr_t)LABELSECTOR, DEV_BSIZE, buf, &cnt);
        if (i || cnt != DEV_BSIZE) {
                printf("rz%d: error reading disk label\n", unit);
        i = rzstrategy(sc, F_READ, (daddr_t)LABELSECTOR, DEV_BSIZE, buf, &cnt);
        if (i || cnt != DEV_BSIZE) {
                printf("rz%d: error reading disk label\n", unit);
@@ -359,4 +120,3 @@ rzclose(f)
        f->f_devdata = (void *)0;
        return (0);
 }
        f->f_devdata = (void *)0;
        return (0);
 }
-#endif
index 89d1a79..cd47a59 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)start.s     7.4 (Berkeley) %G%
+ *     @(#)start.s     7.5 (Berkeley) %G%
  *
  * start.s -
  *
  *
  * start.s -
  *
 
 #include <machine/regdef.h>
 #include <machine/machConst.h>
 
 #include <machine/regdef.h>
 #include <machine/machConst.h>
+#include <machine/machAsmDefs.h>
+#include <pmax/stand/dec_prom.h>
 
 /*
  * Amount to take off of the stack for the benefit of the debugger.
  */
 #define START_FRAME    ((4 * 4) + 4 + 4)
 
 /*
  * Amount to take off of the stack for the benefit of the debugger.
  */
 #define START_FRAME    ((4 * 4) + 4 + 4)
-#define Init   0xbfc00018
 
        .globl  start
 start:
        .set    noreorder
 
        .globl  start
 start:
        .set    noreorder
-       mtc0    zero, MACH_COP_0_STATUS_REG     # Disable interrupts
-       li      sp, MACH_CODE_START - START_FRAME
-       la      gp, _gp
+       li      v0, MACH_SR_BOOT_EXC_VEC
+       mtc0    v0, MACH_COP_0_STATUS_REG       # Disable interrupts
+       la      sp, start - START_FRAME
        sw      zero, START_FRAME - 4(sp)       # Zero out old ra for debugger
        sw      zero, START_FRAME - 8(sp)       # Zero out old fp for debugger
        sw      zero, START_FRAME - 4(sp)       # Zero out old ra for debugger
        sw      zero, START_FRAME - 8(sp)       # Zero out old fp for debugger
-       jal     main                            # main(argc, argv, envp)
+#ifdef DS3100
+       la      a3, callvec                     # init call vector
+#endif
+       sw      a3, callv                       # save call vector
+       move    s0, a0                          # save argc
+       move    s1, a1                          # save argv
+       la      a0, edata                       # clear BSS
+       la      a1, end
+       jal     bzero                           # bzero(edata, end - edata)
+       subu    a1, a1, a0
+       move    a0, s0                          # restore argc
+       jal     main                            # main(argc, argv)
+       move    a1, s1                          # restore argv
+       li      v0, DEC_PROM_RESTART            # done, so call prom
+       j       v0
        nop
        nop
-       li      a0, Init                        # done, so call prom
-       j       a0
 
 /* dummy routine for gcc2 */
        .globl  __main
 
 /* dummy routine for gcc2 */
        .globl  __main
@@ -53,12 +66,35 @@ __main:
        j       ra
        nop
 
        j       ra
        nop
 
-       .globl  Boot_Transfer
-Boot_Transfer:
-       mtc0    zero, MACH_COP_0_STATUS_REG     # Disable interrupts
-       li      sp, MACH_CODE_START - START_FRAME
-       la      gp, _gp
-       sw      zero, START_FRAME - 4(sp)       # Zero out old ra for debugger
-       sw      zero, START_FRAME - 8(sp)       # Zero out old fp for debugger
-       jal     a3                              # Jump to routine
+LEAF(prom_restart)
+       li      v0, DEC_PROM_RESTART
+       j       v0
        nop
        nop
+END(prom_restart)
+
+LEAF(prom_open)
+       li      v0, DEC_PROM_OPEN
+       j       v0
+       nop
+END(prom_open)
+
+LEAF(prom_lseek)
+       li      v0, DEC_PROM_LSEEK
+       j       v0
+       nop
+END(prom_lseek)
+
+LEAF(prom_read)
+       li      v0, DEC_PROM_READ
+       j       v0
+       nop
+END(prom_read)
+
+LEAF(printf)
+       lw      v0, callv       # get pointer to call back vectors
+       sw      a1, 4(sp)       # store args on stack for printf
+       lw      v0, 48(v0)      # offset for callv->printf
+       sw      a2, 8(sp)
+       j       v0              # call PROM printf
+       sw      a3, 12(sp)
+END(printf)