Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/vax/boot/xxboot Rewriting of the VAX boot block. Di...



details:   https://anonhg.NetBSD.org/src/rev/6b05cb9bcce5
branches:  trunk
changeset: 486366:6b05cb9bcce5
user:      ragge <ragge%NetBSD.org@localhost>
date:      Sat May 20 13:21:29 2000 +0000

description:
Rewriting of the VAX boot block. Differences:

- Use the RPB for passing boot device info up to kernel, instead of the
  old BSD "hack" with an encoded longword (see sys/reboot.h for details)
- Instead of separate drivers for all devices, use the HW-provided ROM
  routines as much as possible.
- Add filesystem support for CD9660 also (now when there is space).
- Make everything compile with WARNS=1.

The boot block is now <7K in size and have support for UFS, CD9660 and USTAR.

diffstat:

 sys/arch/vax/boot/xxboot/Makefile |   15 +-
 sys/arch/vax/boot/xxboot/bootxx.c |  293 +++++++++----------------------------
 sys/arch/vax/boot/xxboot/start.s  |   71 ++++----
 3 files changed, 123 insertions(+), 256 deletions(-)

diffs (truncated from 588 to 300 lines):

diff -r 8f4d9c7864d7 -r 6b05cb9bcce5 sys/arch/vax/boot/xxboot/Makefile
--- a/sys/arch/vax/boot/xxboot/Makefile Sat May 20 10:58:05 2000 +0000
+++ b/sys/arch/vax/boot/xxboot/Makefile Sat May 20 13:21:29 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.4 2000/04/18 20:47:04 matt Exp $
+#      $NetBSD: Makefile,v 1.5 2000/05/20 13:21:29 ragge Exp $
 
 S=     ${.CURDIR}/../../../../
 
@@ -7,13 +7,16 @@
 LINKS+=        ${BINDIR}/xxboot ${BINDIR}/rdboot
 LINKS+=        ${BINDIR}/xxboot ${BINDIR}/sdboot
 LINKS+=        ${BINDIR}/xxboot ${BINDIR}/hpboot
+WARNS?=        1
 
 SRCS=  start.s bootxx.c romread.s urem.s udiv.s str.s
 
 STRIPFLAG=
 CPPFLAGS+=-D_STANDALONE -DLIBSA_NO_FD_CHECKING -DLIBSA_NO_RAW_ACCESS \
        -DLIBSA_NO_TWIDDLE -DLIBSA_SINGLE_DEVICE=rom \
-       -DLIBSA_SINGLE_FILESYSTEM=ufs
+       -DLIBSA_NO_COMPAT_UFS \
+       -DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_CLOSE \
+       -DLIBSA_NO_FS_WRITE -DLIBSA_NO_FS_SEEK
 BINDIR=        /usr/mdec
 NOMAN= 1
 
@@ -23,8 +26,12 @@
 .include "${S}/lib/libsa/Makefile.inc"
 LIBSA= ${SALIB}
 
-${PROG}: ${OBJS} ${LIBSA}
-       ld -N -Ttext 100000 -o ${PROG}.out ${OBJS} ${LIBSA}
+KERN_AS=library
+.include "${S}/lib/libkern/Makefile.inc"
+LIBKERN=${KERNLIB}
+
+${PROG}: ${OBJS} ${LIBSA} ${LIBKERN}
+       ld -N -Ttext 100000 -o ${PROG}.out ${OBJS} ${LIBSA} ${LIBKERN}
        objcopy -O binary ${PROG}.out ${PROG}
 
 .include <bsd.prog.mk>
diff -r 8f4d9c7864d7 -r 6b05cb9bcce5 sys/arch/vax/boot/xxboot/bootxx.c
--- a/sys/arch/vax/boot/xxboot/bootxx.c Sat May 20 10:58:05 2000 +0000
+++ b/sys/arch/vax/boot/xxboot/bootxx.c Sat May 20 13:21:29 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootxx.c,v 1.5 2000/04/22 16:50:44 ragge Exp $ */
+/* $NetBSD: bootxx.c,v 1.6 2000/05/20 13:21:29 ragge Exp $ */
 /*-
  * Copyright (c) 1982, 1986 The Regents of the University of California.
  * All rights reserved.
@@ -40,6 +40,9 @@
 
 #include "lib/libsa/stand.h"
 #include "lib/libsa/ufs.h"
+#include "lib/libsa/cd9660.h"
+
+#include "lib/libkern/libkern.h"
 
 #include "../include/pte.h"
 #include "../include/sid.h"
@@ -56,146 +59,89 @@
 #include "dev/mscp/mscp.h"
 #include "dev/mscp/mscpreg.h"
 
-int    command(int, int);
+#include "../boot/data.h"
 
-/*
- * Boot program... argume passed in r10 and r11 determine whether boot
- * stops to ask for system name and which device boot comes from.
- */
-
-volatile u_int  devtype, bootdev;
-unsigned        opendev, boothowto, bootset, memsz;
+void   Xmain(void);
+void   hoppabort(int);
+void   romread_uvax(int lbn, int size, void *buf, struct rpb *rpb);
+int    hpread(int block, int size, char *buf);
+int    read750(int block, int *regs);
+int    unit_init(int, struct rpb *, int);
 
 struct open_file file;
 
 unsigned *bootregs;
 struct rpb *rpb;
+struct bqo *bqo;
 int    vax_cputype;
+struct udadevice {u_short udaip;u_short udasa;};
+volatile struct udadevice *csr;
+
+extern int from;
+#define        FROM750 1
+#define        FROMMV  2
+#define        FROMVMB 4
 
 /*
  * The boot block are used by 11/750, 8200, MicroVAX II/III, VS2000,
  * VS3100/??, VS4000 and VAX6000/???, and only when booting from disk.
  */
+void
 Xmain()
 {
        int io;
-       char *scbb;
-       char *new, *bqo;
        char *hej = "/boot";
 
        vax_cputype = (mfpr(PR_SID) >> 24) & 0xFF;
 
        /*
         */ 
-        switch (vax_cputype) {
-
-        case VAX_TYP_UV2:
-        case VAX_TYP_CVAX:
-       case VAX_TYP_RIGEL:
-       case VAX_TYP_SOC:
-       case VAX_TYP_MARIAH:
-       case VAX_TYP_NVAX:
+       rpb = (void *)0xf0000; /* Safe address right now */
+       bqo = (void *)0xf1000;
+        if (from == FROMMV) {
                /*
                 * now relocate rpb/bqo (which are used by ROM-routines)
                 */
-               rpb = (void*)XXRPB;
-               bcopy ((void*)bootregs[11], rpb, 512);
-               rpb->rpb_base = rpb;
-               bqo = (void*)(512+(int)rpb);
+               bcopy ((void *)bootregs[11], rpb, sizeof(struct rpb));
                bcopy ((void*)rpb->iovec, bqo, rpb->iovecsz);
-               rpb->iovec = (int)bqo;
-               bootregs[11] = (int)rpb;
                if (rpb->devtyp == BDEV_SDN)
                        rpb->devtyp = BDEV_SD;  /* XXX until driver fixed */
-               bootdev = rpb->devtyp;
-               memsz = rpb->pfncnt << 9;
-
-                break;
-       case VAX_8200:
-        case VAX_750:
-               bootdev = bootregs[10];
-               memsz = 0;
-
-                break;
-       default:
-               asm("halt");
+       } else {
+               bzero(rpb, sizeof(struct rpb));
+               rpb->devtyp = bootregs[0];
+               rpb->unit = bootregs[3];
+               rpb->rpb_bootr5 = bootregs[5];
+               rpb->csrphy = bootregs[2];
+               rpb->adpphy = bootregs[1];      /* BI node on 8200 */
         }
-
-       bootset = getbootdev();
+       rpb->rpb_base = rpb;
+       rpb->iovec = (int)bqo;
 
        io = open(hej, 0);
 
        read(io, (void *)0x10000, 0x10000);
        bcopy((void *) 0x10000, 0, 0xffff);
-       hoppabort(32, boothowto, bootset);
+       hoppabort(32);
        asm("halt");
 }
 
-getbootdev()
-{
-       int i, adaptor, controller, unit, partition, retval;
-
-       adaptor = controller = unit = partition = 0;
-
-       switch (vax_cputype) {
-       case VAX_TYP_UV2:
-       case VAX_TYP_CVAX:
-       case VAX_TYP_RIGEL:
-       case VAX_TYP_SOC:
-       case VAX_TYP_MARIAH:
-       case VAX_TYP_NVAX:
-               if (rpb->devtyp == BDEV_SD) {
-                       unit = rpb->unit / 100;
-                       controller = (rpb->csrphy & 0x100 ? 1 : 0);
-               } else {
-                       controller = ((rpb->csrphy & 017777) == 0xDC)?1:0;
-                       unit = rpb->unit;                       /* DUC, DUD? */
-               }
-               break;
-
-       case VAX_TYP_8SS:
-       case VAX_TYP_750:
-               controller = bootregs[1];
-               unit = bootregs[3];
-               break;
-       }
-
-       switch (B_TYPE(bootdev)) {
-       case BDEV_HP:                   /* massbuss boot */
-               adaptor = (bootregs[1] & 0x6000) >> 17;
-               break;
-
-       case BDEV_UDA:          /* UDA50 boot */
-               if (vax_cputype == VAX_750)
-                       adaptor = (bootregs[1] & 0x40000 ? 0 : 1);
-               break;
-
-       case BDEV_RL:           /* RL01/02 */
-       case BDEV_TK:           /* TK50 boot */
-       case BDEV_CNSL:         /* Console storage boot */
-       case BDEV_RD:           /* RD/RX on HDC9224 (MV2000) */
-       case BDEV_ST:           /* SCSI-tape on NCR53xx (MV2000) */
-       case BDEV_SD:           /* SCSI-disk on NCR53xx (3100/76, 4000) */
-               break;
-
-       case BDEV_KDB:          /* DSA disk on KDB50 (VAXBI VAXen) */
-               bootdev = (bootdev & ~B_TYPEMASK) | BDEV_UDA;
-               break;
-
-       default:
-               boothowto |= (RB_SINGLE | RB_ASKNAME);
-       }
-       return MAKEBOOTDEV(bootdev, adaptor, controller, unit, partition);
-}
-
-int     romstrategy __P((void *, int, daddr_t, size_t, void *, size_t *));
-
 /*
  * Write an extremely limited version of a (us)tar filesystem, suitable
  * for loading secondary-stage boot loader.
  * - Can only load file "boot".
  * - Must be the first file on tape.
  */
+struct fs_ops file_system[] = {
+       { ufs_open, 0, ufs_read, 0, 0, ufs_stat },
+       { cd9660_open, 0, cd9660_read, 0, 0, cd9660_stat },
+#if 0
+       { ustarfs_open, 0, ustarfs_read, 0, 0, ustarfs_stat },
+#endif
+};
+
+int nfsys = (sizeof(file_system) / sizeof(struct fs_ops));
+
+#if 0
 int tar_open(char *path, struct open_file *f);
 ssize_t tar_read(struct open_file *f, void *buf, size_t size, size_t *resid);
 
@@ -222,90 +168,47 @@
 {
        romstrategy(0, 0, (8192+512), size, buf, 0);
        *resid = size;
+       return 0; /* XXX */
 }
+#endif
 
-struct disklabel lp;
-int part_off = 0;              /* offset into partition holding /boot */
-char io_buf[MAXBSIZE];
 volatile struct uda {
        struct  mscp_1ca uda_ca;           /* communications area */
        struct  mscp uda_rsp;     /* response packets */
        struct  mscp uda_cmd;     /* command packets */
 } uda;
-struct udadevice {u_short udaip;u_short udasa;};
-volatile struct udadevice *csr;
 
+int
 devopen(f, fname, file)
        struct open_file *f;
        const char    *fname;
        char          **file;
 {
-       extern char     start;
-       char           *msg;
-       int             i, err, off;
-       char            line[64];
-
        *file = (char *)fname;
 
+       if (from == FROM750)
+               return 0;
        /*
-        * On uVAX we need to init [T]MSCP ctlr to be able to use it.
+        * Reinit the VMB boot device.
         */
-       if (vax_cputype == VAX_TYP_UV2 || vax_cputype == VAX_TYP_CVAX) {
-               switch (bootdev) {
-               case BDEV_UDA:  /* MSCP */
-               case BDEV_TK:   /* TMSCP */
-                       csr = (struct udadevice *)rpb->csrphy;
-
-                       csr->udaip = 0; /* Start init */
-                       while((csr->udasa & MP_STEP1) == 0);
-                       csr->udasa = 0x8000;
-                       while((csr->udasa & MP_STEP2) == 0);
-                       csr->udasa = (short)(((u_int)&uda)&0xffff) + 8;
-                       while((csr->udasa & MP_STEP3) == 0);
-                       csr->udasa = 0x10;



Home | Main Index | Thread Index | Old Index