BSD 4_4 release
[unix-history] / usr / src / sys / vax / vax / autoconf.c
index 6e761b8..b62198f 100644 (file)
@@ -1,9 +1,36 @@
-/*
- * Copyright (c) 1982,1986 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+/*-
+ * Copyright (c) 1982, 1986 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
  *
  *
- *     @(#)autoconf.c  7.15 (Berkeley) %G%
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)autoconf.c  7.21 (Berkeley) 4/19/93
  */
 
 /*
  */
 
 /*
 #include "mba.h"
 #include "uba.h"
 #include "kra.h"               /* XXX wrong file */
 #include "mba.h"
 #include "uba.h"
 #include "kra.h"               /* XXX wrong file */
+#include "bi.h"
 
 
-#include "param.h"
-#include "systm.h"
-#include "map.h"
-#include "buf.h"
-#include "dkstat.h"
-#include "vm.h"
-#include "malloc.h"
-#include "conf.h"
-#include "dmap.h"
-#include "reboot.h"
-#ifdef SECSIZE
-#include "file.h"
-#include "ioctl.h"
-#include "disklabel.h"
-#endif SECSIZE
-
-#include "pte.h"
-#include "pte.h"
-#include "cpu.h"
+#include "sys/param.h"
+#include "sys/systm.h"
+#include "sys/map.h"
+#include "sys/buf.h"
+#include "sys/dkstat.h"
+#include "sys/vm.h"
+#include "sys/malloc.h"
+#include "sys/conf.h"
+#include "sys/dmap.h"
+#include "sys/reboot.h"
+
+#include "../include/pte.h"
+#include "../include/cpu.h"
 #include "mem.h"
 #include "mem.h"
-#include "mtpr.h"
+#include "../include/mtpr.h"
 #include "nexus.h"
 #include "scb.h"
 #include "ioa.h"
 #include "nexus.h"
 #include "scb.h"
 #include "ioa.h"
-#include "../vaxbi/bireg.h"
-#include "../vaxmba/mbareg.h"
-#include "../vaxmba/mbavar.h"
-#include "../vaxuba/ubareg.h"
-#include "../vaxuba/ubavar.h"
+#include "../bi/bireg.h"
+#include "../mba/mbareg.h"
+#include "../mba/mbavar.h"
+#include "../uba/ubareg.h"
+#include "../uba/ubavar.h"
 
 /*
  * The following several variables are related to
 
 /*
  * The following several variables are related to
@@ -115,8 +137,8 @@ configure()
 #if VAX8600
        case VAX_8600:
                printf("VAX 8600, serial# %d(%d), hardware ECO level %d(%d)\n",
 #if VAX8600
        case VAX_8600:
                printf("VAX 8600, serial# %d(%d), hardware ECO level %d(%d)\n",
-                       cpusid.cpu780.cp_sno, cpusid.cpu780.cp_plant,
-                       cpusid.cpu780.cp_eco >> 4, cpusid.cpu780.cp_eco);
+                       cpusid.cpu8600.cp_sno, cpusid.cpu8600.cp_plant,
+                       cpusid.cpu8600.cp_eco >> 4, cpusid.cpu8600.cp_eco);
                break;
 #endif
 #if VAX8200
                break;
 #endif
 #if VAX8200
@@ -153,6 +175,11 @@ VAX 11/78%c, serial# %d(%d), hardware ECO level %d(%d)\n",
        case VAX_630:
                printf("MicroVAX-II\n");
                break;
        case VAX_630:
                printf("MicroVAX-II\n");
                break;
+#endif
+#if VAX650
+       case VAX_650:
+               printf("MicroVAX 3000, ucode rev %d\n", cpusid.cpu650.cp_urev);
+               break;
 #endif
        }
        for (ocp = percpu; ocp->pc_cputype; ocp++)
 #endif
        }
        for (ocp = percpu; ocp->pc_cputype; ocp++)
@@ -218,7 +245,7 @@ probeio(pcpu)
 
                switch (iob->io_type) {
 
 
                switch (iob->io_type) {
 
-#if VAX630
+#if VAX630 || VAX650
                case IO_QBUS:
                        probeqbus((struct qbus *)iob->io_details);
                        break;
                case IO_QBUS:
                        probeqbus((struct qbus *)iob->io_details);
                        break;
@@ -473,7 +500,6 @@ setscbnex(fn)
 }
 #endif
 
 }
 #endif
 
-#include "bi.h"
 #if NBI > 0
 /*
  * Probe BI node space.
 #if NBI > 0
 /*
  * Probe BI node space.
@@ -880,14 +906,14 @@ unifind(uhp0, pumem)
        caddr_t pumem;
 {
 #ifndef lint
        caddr_t pumem;
 {
 #ifndef lint
-       register int br, cvec;                  /* MUST BE r11, r10 */
+       register int rbr, rcvec;                        /* MUST BE r11, r10 */
 #else
        /*
         * Lint doesn't realize that these
         * can be initialized asynchronously
         * when devices interrupt.
         */
 #else
        /*
         * Lint doesn't realize that these
         * can be initialized asynchronously
         * when devices interrupt.
         */
-       register int br = 0, cvec = 0;
+       register int rbr = 0, rcvec = 0;
 #endif
        register struct uba_device *ui;
        register struct uba_ctlr *um;
 #endif
        register struct uba_device *ui;
        register struct uba_ctlr *um;
@@ -897,6 +923,7 @@ unifind(uhp0, pumem)
        int i, (**ivec)();
        caddr_t ualloc;
        extern quad catcher[128];
        int i, (**ivec)();
        caddr_t ualloc;
        extern quad catcher[128];
+       extern int br, cvec;
 #if DW780 || DWBUA
        struct uba_regs *vubp = uhp->uh_uba;
 #endif
 #if DW780 || DWBUA
        struct uba_regs *vubp = uhp->uh_uba;
 #endif
@@ -1006,6 +1033,7 @@ unifind(uhp0, pumem)
                }
 #endif
                cvec = 0x200;
                }
 #endif
                cvec = 0x200;
+               rcvec = 0x200;
                i = (*udp->ud_probe)(reg, um->um_ctlr, um);
 #ifdef DW780
                if (uhp->uh_type == DW780 && vubp->uba_sr) {
                i = (*udp->ud_probe)(reg, um->um_ctlr, um);
 #ifdef DW780
                if (uhp->uh_type == DW780 && vubp->uba_sr) {
@@ -1017,23 +1045,23 @@ unifind(uhp0, pumem)
                        continue;
                printf("%s%d at uba%d csr %o ",
                    udp->ud_mname, um->um_ctlr, numuba, addr);
                        continue;
                printf("%s%d at uba%d csr %o ",
                    udp->ud_mname, um->um_ctlr, numuba, addr);
-               if (cvec == 0) {
+               if (rcvec == 0) {
                        printf("zero vector\n");
                        continue;
                }
                        printf("zero vector\n");
                        continue;
                }
-               if (cvec == 0x200) {
+               if (rcvec == 0x200) {
                        printf("didn't interrupt\n");
                        continue;
                }
                        printf("didn't interrupt\n");
                        continue;
                }
-               printf("vec %o, ipl %x\n", cvec, br);
+               printf("vec %o, ipl %x\n", rcvec, rbr);
                csralloc(ualloc, addr, i);
                um->um_alive = 1;
                um->um_ubanum = numuba;
                um->um_hd = uhp;
                um->um_addr = (caddr_t)reg;
                udp->ud_minfo[um->um_ctlr] = um;
                csralloc(ualloc, addr, i);
                um->um_alive = 1;
                um->um_ubanum = numuba;
                um->um_hd = uhp;
                um->um_addr = (caddr_t)reg;
                udp->ud_minfo[um->um_ctlr] = um;
-               for (cvec /= 4, ivec = um->um_intr; *ivec; cvec++, ivec++)
-                       uhp->uh_vec[cvec] = scbentry(*ivec, SCB_ISTACK);
+               for (rcvec /= 4, ivec = um->um_intr; *ivec; rcvec++, ivec++)
+                       uhp->uh_vec[rcvec] = scbentry(*ivec, SCB_ISTACK);
                for (ui = ubdinit; ui->ui_driver; ui++) {
                        int t;
 
                for (ui = ubdinit; ui->ui_driver; ui++) {
                        int t;
 
@@ -1090,6 +1118,7 @@ unifind(uhp0, pumem)
                        continue;
                }
 #endif
                        continue;
                }
 #endif
+               rcvec = 0x200;
                cvec = 0x200;
                i = (*udp->ud_probe)(reg, ui);
 #ifdef DW780
                cvec = 0x200;
                i = (*udp->ud_probe)(reg, ui);
 #ifdef DW780
@@ -1102,19 +1131,19 @@ unifind(uhp0, pumem)
                        continue;
                printf("%s%d at uba%d csr %o ",
                    ui->ui_driver->ud_dname, ui->ui_unit, numuba, addr);
                        continue;
                printf("%s%d at uba%d csr %o ",
                    ui->ui_driver->ud_dname, ui->ui_unit, numuba, addr);
-               if (cvec == 0) {
+               if (rcvec == 0) {
                        printf("zero vector\n");
                        continue;
                }
                        printf("zero vector\n");
                        continue;
                }
-               if (cvec == 0x200) {
+               if (rcvec == 0x200) {
                        printf("didn't interrupt\n");
                        continue;
                }
                        printf("didn't interrupt\n");
                        continue;
                }
-               printf("vec %o, ipl %x\n", cvec, br);
+               printf("vec %o, ipl %x\n", rcvec, rbr);
                csralloc(ualloc, addr, i);
                ui->ui_hd = uhp;
                csralloc(ualloc, addr, i);
                ui->ui_hd = uhp;
-               for (cvec /= 4, ivec = ui->ui_intr; *ivec; cvec++, ivec++)
-                       uhp->uh_vec[cvec] = scbentry(*ivec, SCB_ISTACK);
+               for (rcvec /= 4, ivec = ui->ui_intr; *ivec; rcvec++, ivec++)
+                       uhp->uh_vec[rcvec] = scbentry(*ivec, SCB_ISTACK);
                ui->ui_alive = 1;
                ui->ui_ubanum = numuba;
                ui->ui_addr = (caddr_t)reg;
                ui->ui_alive = 1;
                ui->ui_ubanum = numuba;
                ui->ui_addr = (caddr_t)reg;
@@ -1211,13 +1240,12 @@ ioaccess(physa, pte, size)
 /*
  * Configure swap space and related parameters.
  */
 /*
  * Configure swap space and related parameters.
  */
-#ifndef SECSIZE
 swapconf()
 {
        register struct swdevt *swp;
        register int nblks;
 
 swapconf()
 {
        register struct swdevt *swp;
        register int nblks;
 
-       for (swp = swdevt; swp->sw_dev; swp++)
+       for (swp = swdevt; swp->sw_dev != NODEV; swp++)
                if (bdevsw[major(swp->sw_dev)].d_psize) {
                        nblks =
                          (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev);
                if (bdevsw[major(swp->sw_dev)].d_psize) {
                        nblks =
                          (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev);
@@ -1225,68 +1253,8 @@ swapconf()
                            (swp->sw_nblks == 0 || swp->sw_nblks > nblks))
                                swp->sw_nblks = nblks;
                }
                            (swp->sw_nblks == 0 || swp->sw_nblks > nblks))
                                swp->sw_nblks = nblks;
                }
-       if (dumplo == 0 && bdevsw[major(dumpdev)].d_psize)
-               dumplo = (*bdevsw[major(dumpdev)].d_psize)(dumpdev) - physmem;
-       if (dumplo < 0)
-               dumplo = 0;
-}
-#else SECSIZE
-swapconf()
-{
-       register struct swdevt *swp;
-       register int nblks;
-       register int bsize;
-       struct partinfo dpart;
-
-       for (swp = swdevt; swp->sw_dev; swp++)
-               if ((nblks = psize(swp->sw_dev, &swp->sw_blksize,
-                   &swp->sw_bshift)) != -1 &&
-                   (swp->sw_nblks == 0 || swp->sw_nblks > nblks))
-                       swp->sw_nblks = nblks;
-
-       if (!cold)      /* In case called for addition of another drive */
-               return;
-       if (dumplo == 0) {
-               nblks = psize(dumpdev, (int *)0, (int *)0);
-               if (nblks == -1 || nblks < ctod(physmem))
-                       dumplo = 0;
-               else
-                       dumplo = nblks - ctod(physmem);
-       }
-}
-
-/*
- * Return size of disk partition in DEV_BSIZE units.
- * If needed, return sector size.
- */
-psize(dev, psize, pshift)
-       register dev_t dev;
-       int *psize, *pshift;
-{
-       register int nblks, bsize, bshift;
-       struct partinfo dpart;
-
-       if ((*bdevsw[major(dev)].d_ioctl)(dev, DIOCGPART,
-           (caddr_t)&dpart, FREAD) == 0)
-               bsize = dpart.disklab->d_secsize;
-       else
-               bsize = DEV_BSIZE;
-       if (psize)
-               *psize = bsize;
-       bshift = 0;
-       for (nblks = DEV_BSIZE / bsize; nblks > 1; nblks >>= 1)
-               bshift++;
-       if (pshift)
-               *pshift = bshift;
-       nblks = -1;
-       if (bdevsw[major(dev)].d_psize) {
-               nblks = (*bdevsw[major(dev)].d_psize)(dev);
-               if (nblks != -1)
-                       nblks >>= bshift;
-       }
-       return (nblks);
+       dumpconf();
 }
 }
-#endif SECSIZE
 
 #define        DOSWAP                  /* Change swdevt, argdev, and dumpdev too */
 u_long bootdev;                /* should be dev_t, but not until 32 bits */
 
 #define        DOSWAP                  /* Change swdevt, argdev, and dumpdev too */
 u_long bootdev;                /* should be dev_t, but not until 32 bits */
@@ -1407,7 +1375,7 @@ setroot()
 
 #ifdef DOSWAP
        mindev &= ~PARTITIONMASK;
 
 #ifdef DOSWAP
        mindev &= ~PARTITIONMASK;
-       for (swp = swdevt; swp->sw_dev; swp++) {
+       for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
                if (majdev == major(swp->sw_dev) &&
                    mindev == (minor(swp->sw_dev) & ~PARTITIONMASK)) {
                        temp = swdevt[0].sw_dev;
                if (majdev == major(swp->sw_dev) &&
                    mindev == (minor(swp->sw_dev) & ~PARTITIONMASK)) {
                        temp = swdevt[0].sw_dev;
@@ -1416,7 +1384,7 @@ setroot()
                        break;
                }
        }
                        break;
                }
        }
-       if (swp->sw_dev == 0)
+       if (swp->sw_dev == NODEV)
                return;
 
        /*
                return;
 
        /*