?? autoconf.c
字號:
/*- * 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. * * 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 *//* * Setup the system to run on the current machine. * * Configure() is called at boot time and initializes the uba and mba * device tables and the memory controller monitoring. Available * devices are determined (from possibilities mentioned in ioconf.c), * and the drivers are initialized. */#include "mba.h"#include "uba.h"#include "kra.h" /* XXX wrong file */#include "bi.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 "../include/mtpr.h"#include "nexus.h"#include "scb.h"#include "ioa.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 configuration process, and are used in initializing * the machine. */int cold; /* if 1, still working on cold-start */int dkn; /* number of iostat dk numbers assigned so far */int cpuspeed = 1; /* relative cpu speed *//* * Addresses of the (locore) routines which bootstrap us from * hardware traps to C code. Filled into the system control block * as necessary. * * RIDICULOUS! CONFIG SHOULD GENERATE AN ioconf.h FOR US, with * mba glue also in `glue.s'. (Unibus adapter glue is special, though.) */#if NMBA > 0int (*mbaintv[4])() = { Xmba0int, Xmba1int, Xmba2int, Xmba3int };#if NMBA > 4 Need to expand the table for more than 4 massbus adaptors#endif#endif#if defined(VAX780) || defined(VAX8600)int (*ubaintv[])() ={ Xua0int, Xua1int, Xua2int, Xua3int,#if NUBA > 4 Xua4int, Xua5int, Xua6int, Xua7int,#endif#if NUBA > 8 Need to expand the table for more than 8 unibus adaptors#endif};#endif#if NKDB > 0/* kdb50 driver does not appear in udminit[] (not without csr!) */int Xkdbintr0(); /* generated by autoconf */int (*kdbintv[])() = { Xkdbintr0 };#if NKDB > 1 Need to expand the table for more than 1 KDB adapter#endif#endif/* * This allocates the space for the per-uba information, * such as buffered data path usage. */struct uba_hd uba_hd[NUBA];/* * Determine mass storage and memory configuration for a machine. * Get cpu type, and then switch out to machine specific procedures * which will probe adaptors to see what is out there. */configure(){ union cpusid cpusid; register struct percpu *ocp; register struct pte *ip; cpusid.cpusid = mfpr(SID); switch (cpusid.cpuany.cp_type) {#if VAX8600 case VAX_8600: printf("VAX 8600, serial# %d(%d), hardware ECO level %d(%d)\n", cpusid.cpu8600.cp_sno, cpusid.cpu8600.cp_plant, cpusid.cpu8600.cp_eco >> 4, cpusid.cpu8600.cp_eco); break;#endif#if VAX8200 case VAX_8200: printf("\VAX 82%c0, hardware rev %d, ucode patch rev %d, sec patch %d, ucode rev %d\n", cpusid.cpu8200.cp_5 ? '5' : '0', cpusid.cpu8200.cp_hrev, cpusid.cpu8200.cp_patch, cpusid.cpu8200.cp_secp, cpusid.cpu8200.cp_urev); mastercpu = mfpr(BINID); break;#endif#if VAX780 case VAX_780: printf("\VAX 11/78%c, serial# %d(%d), hardware ECO level %d(%d)\n", cpusid.cpu780.cp_5 ? '5' : '0', cpusid.cpu780.cp_sno, cpusid.cpu780.cp_plant, cpusid.cpu780.cp_eco >> 4, cpusid.cpu780.cp_eco); break;#endif#if VAX750 case VAX_750: printf("VAX 11/750, hardware rev %d, ucode rev %d\n", cpusid.cpu750.cp_hrev, cpusid.cpu750.cp_urev); break;#endif#if VAX730 case VAX_730: printf("VAX 11/730, ucode rev %d\n", cpusid.cpu730.cp_urev); break;#endif#if VAX630 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++) if (ocp->pc_cputype == cpusid.cpuany.cp_type) { cpuspeed = ocp->pc_cpuspeed; cpuops = ocp->pc_ops; if (cpuops->cpu_init != NULL) (*cpuops->cpu_init)(); probeio(ocp); /* * Write protect the scb and UNIBUS interrupt vectors. * It is strange that this code is here, but this is * as soon as we are done mucking with it, and the * write-enable was done in assembly language * to which we will never return. */ for (ip = kvtopte(scb); ip < kvtopte(eUNIvec); ip++) { *(int *)ip &= ~PG_PROT; *(int *)ip |= PG_KR; } mtpr(TBIA, 0);#if GENERIC if ((boothowto & RB_ASKNAME) == 0) setroot(); setconf();#else setroot();#endif /* * Configure swap area and related system * parameter based on device(s) used. */ swapconf(); cold = 0; memenable(); return; } printf("cpu type %d not configured\n", cpusid.cpuany.cp_type); asm("halt");}#if VAX8600 || VAX780 || VAX750 || VAX730int nexnum; /* current nexus number */int nsbi; /* current sbi number */#endif#if VAX8200int numkdb; /* current ``kdb'' number */int bi_nodes; /* XXX remembers found bi nodes */#endif/* * Probe the main IO bus(es). * The percpu structure gives us a handle on the addresses and/or types. */probeio(pcpu) register struct percpu *pcpu;{ register struct iobus *iob; int ioanum; ioanum = 0; for (iob = pcpu->pc_io; ioanum < pcpu->pc_nioa; ioanum++, iob++) { switch (iob->io_type) {#if VAX630 || VAX650 case IO_QBUS: probeqbus((struct qbus *)iob->io_details); break;#endif#if VAX780 || VAX750 || VAX730 case IO_SBI780: case IO_CMI750: case IO_XXX730: probenexi((struct nexusconnect *)iob->io_details); break;#endif#if VAX8600 case IO_ABUS: probe_Abus(ioanum, iob); break;#endif#if VAX8200 case IO_BI: probe_bi((struct bibus *)iob->io_details); break;#endif default: if (iob->io_addr) { printf( "IO adaptor %d, type %d, at address 0x%x is unsupported\n", ioanum, iob->io_type, iob->io_addr); } else printf("IO adaptor %d, type %d, is unsupported\n", ioanum, iob->io_type); break; } }}#if VAX8600probe_Abus(ioanum, iob) register struct iobus *iob;{ register struct ioa *ioap; union ioacsr ioacsr; int type; struct sbia_regs *sbiaregs;#ifdef notyet int sbi1fail(), sbi1alert(), sbi1fault(), sbi1err();#endif ioap = &ioa[ioanum]; ioaccess(iob->io_addr, Ioamap[ioanum], iob->io_size); if (badaddr((caddr_t)ioap, 4)) return; ioacsr.ioa_csr = ioap->ioacsr.ioa_csr; type = ioacsr.ioa_type & IOA_TYPMSK; switch (type) { case IOA_SBIA: printf("SBIA%d at IO adaptor %d address 0x%x\n", nsbi, ioanum, iob->io_addr);#ifdef notyet /* I AM NOT SURE THESE ARE IN THE SAME PLACES */ if (nscb == 1) { scb[1].scb_sbifail = scbentry(sbi1fail, SCB_ISTACK); /* maybe not sbifail, maybe scb1.scb_cmrd */ /* but how can I find out without a broken SBIA1? */ scb[1].scb_sbialert = scbentry(sbi1alert, SCB_ISTACK); scb[1].scb_sbifault = scbentry(sbi1fault, SCB_ISTACK); scb[1].scb_sbierr = scbentry(sbi1err, SCB_ISTACK); }#endif probenexi((struct nexusconnect *)iob->io_details); nsbi++; sbiaregs = (struct sbia_regs *)ioap; sbiaregs->sbi_errsum = -1; sbiaregs->sbi_error = 0x1000; sbiaregs->sbi_fltsts = 0xc0000; break; default: printf("IOA%d at address 0x%x is unsupported (type = 0x%x)\n", ioanum, iob->io_addr, ioacsr.ioa_type); break; }}#endif#if VAX8600 || VAX780 || VAX750 || VAX730/* * Probe nexus space, finding the interconnects * and setting up and probing mba's and uba's for devices. */probenexi(pnc) register struct nexusconnect *pnc;{ register struct nexus *nxv; struct nexus *nxp = pnc->psb_nexbase; union nexcsr nexcsr; int i; ioaccess((caddr_t)nxp, Nexmap[nsbi * NNEXSBI], pnc->psb_nnexus * sizeof(struct nexus)); nxv = &nexus[nsbi * NNEXSBI]; for (nexnum = 0; nexnum < pnc->psb_nnexus; nexnum++, nxp++, nxv++) { if (badaddr((caddr_t)nxv, 4)) continue; if (pnc->psb_nextype && pnc->psb_nextype[nexnum] != NEX_ANY) nexcsr.nex_csr = pnc->psb_nextype[nexnum]; else nexcsr = nxv->nexcsr; if (nexcsr.nex_csr&NEX_APD) continue; switch (nexcsr.nex_type) { case NEX_MBA: printf("mba%d at tr%d\n", nummba, nexnum); if (nummba >= NMBA) { printf("%d mba's", ++nummba); goto unconfig; }#if NMBA > 0 mbafind(nxv, nxp); nummba++;#endif break; case NEX_UBA0: case NEX_UBA1: case NEX_UBA2: case NEX_UBA3: printf("uba%d at tr%d\n", numuba, nexnum); if (numuba >= NUBA) { printf("%d uba's", ++numuba); goto unconfig; }#if NUBA > 0#if VAX750 if (numuba >= 2 && cpu == VAX_750) { printf("More than 2 UBA's"); goto unsupp; }#endif#if defined(VAX780) || defined(VAX8600) if (cpu == VAX_780 || cpu == VAX_8600) setscbnex(ubaintv[numuba]);#endif i = nexcsr.nex_type - NEX_UBA0; probeuba((struct uba_regs *)nxv, (struct uba_regs *)nxp, pnc->psb_umaddr[i]);#endif /* NUBA */ break; case NEX_DR32: /* there can be more than one... are there other codes??? */ printf("dr32"); goto unsupp; case NEX_MEM4: case NEX_MEM4I: case NEX_MEM16: case NEX_MEM16I: printf("mcr%d at tr%d\n", nmcr, nexnum); if (nmcr >= MAXNMCR) { printf("%d mcr's", ++nmcr); goto unconfig; } switch (cpu) {#if VAX780 case VAX_780: /* only ka780 code looks at type */ mcrtype[nmcr] = M780C; break;#endif default: break; } mcraddr[nmcr++] = (caddr_t)nxv; break;#if VAX780 case NEX_MEM64I: case NEX_MEM64L: case NEX_MEM64LI: case NEX_MEM256I: case NEX_MEM256L: case NEX_MEM256LI: printf("mcr%d (el) at tr%d\n", nmcr, nexnum); if (nmcr >= MAXNMCR) { printf("%d mcr's", ++nmcr); goto unconfig; } mcrtype[nmcr] = M780EL; mcraddr[nmcr++] = (caddr_t)nxv; if (nexcsr.nex_type != NEX_MEM64I && nexcsr.nex_type != NEX_MEM256I) break; /* fall into ... */ case NEX_MEM64U: case NEX_MEM64UI: case NEX_MEM256U: case NEX_MEM256UI: printf("mcr%d (eu) at tr%d\n", nmcr, nexnum); if (nmcr >= MAXNMCR) { printf("%d mcr's", ++nmcr); goto unconfig; } mcrtype[nmcr] = M780EU; mcraddr[nmcr++] = (caddr_t)nxv; break;#endif case NEX_MPM0: case NEX_MPM1: case NEX_MPM2: case NEX_MPM3: printf("mpm");
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -