📄 autoconf.c
字号:
#ifndef lintstatic char *sccsid = "@(#)autoconf.c 4.1 ULTRIX 7/2/90";#endif lint/************************************************************************ * * * Copyright (c) 1985,86,87,88 by * * Digital Equipment Corporation, Maynard, MA * * All rights reserved. * * * * This software is furnished under a license and may be used and * * copied only in accordance with the terms of such license and * * with the inclusion of the above copyright notice. This * * software or any other copies thereof may not be provided or * * otherwise made available to any other person. No title to and * * ownership of the software is hereby transferred. * * * * This software is derived from software received from the * * University of California, Berkeley, and from Bell * * Laboratories. Use, duplication, or disclosure is subject to * * restrictions under license agreements with University of * * California and with AT&T. * * * * The information in this software is subject to change without * * notice and should not be construed as a commitment by Digital * * Equipment Corporation. * * * * Digital assumes no responsibility for the use or reliability * * of its software on equipment which is not supplied by Digital. * * * ************************************************************************//* ------------------------------------------------------------------------ * Modification History: * * 20-Jul-89 rafiey (Ali Rafieymehr) * Moved is_adapt_alive from biinit.c here. XMI and BI share * this routine. * * 20-Jul-89 -- map (Mark A. Parenti) * Map UBAXMI the same as UBABDA. * * 22-May-89 -- darrell * changed cpup to be global -- as part of the new cpusw. * * 05-Nov-88 -- Robin * Changed the size of the Q22-bus map register to not use all 8k * registers. This is necessary because the QDSS driver needs to * use the top 1K maps directly. By reducing the size by * 1K the registers should never be used at the same time. * * 28-June-1988 -- tresvik * Move filling of installation specific rpb information from machdep * to here. This is necessary to get the ws_display_type for the * LYNX which isn't filled in until lxprobe. * * 27-June-1988 -- larry * Move appendflg to init_main. We flush print buffers after mscp * driver has finished polling for units. * 01-June-1988 -- robin * Make a change to get the correct adapter number printed for * ibus entries. * * 24-May-1988 -- robin (for Larry C.) * Moved setcache functions here from machdep, the I/O space needs * to be mapped before setcache is called. * * 04-Feb-1988 -- jaw * add a routine to check that an adapter has been configed. * * 08-Jan-1988 -- jaw * fix to unifind to NOT allow the BLA (klesib) to match on * wildcarded unibus devices. * * 08-Jan-1988 Todd M. Katz * The configuration adapter structure has been notified to include * fields for bus and nexus numbers. Add parameters to the function * config_set_alive() so that these fields may be set and appropriately * modify all invocations of this function within this module. * * 12-11-87 Robin L. and Larry C. * Added portclass/kmalloc support to the system. * * 12-Aug-86 -- prs Removed #if GENERIC compiler option around call * to setconf. Now, setconf should always be called. * * 22-Jul-86 -- bjg Change appendflg so ALL startup mesgs logged together * * 17-Jul-86 -- jaw NEXUS is now lower case.. * * 10-Jul-86 -- jaw added adpt/nexus to ioctl * * 07-Jul-86 -- jaw added alive bit for adapters for Mr. Installation. * * 13-Jun-86 -- jaw fix to uba reset and drivers. * * 10-Jun-86 -- jaw fixed the uba autoconf that I broke for the 780 and * 8600. * * 5-Jun-86 -- jaw changes to config. * * 17-Apr-86 -- jaw re-write scbprot so it protects ALL of the scb. This * also fixes the "lost" instack page bug. * * 09-Apr-86 Darrell Dunnuck * Called badaddr via the macro BADADDR. * * 18-mar-86 -- jaw br/cvec changed to NOT use registers. * * 10-Mar-86 -- darrell * Moved probenexus to sbi.c and renamed it probesbi, moved probeioa * to sbi.c, and moved machine dependent portions of configure to * the kaXXXX.c files. * * 05-Mar-86 -- pmk added appenflg for errlogging of printf msg. * * 05-Mar-86 -- jaw VAXBI device and controller config code added. * todr code put in cpusw. * * 19-Feb-86 -- bjg add sbi_there flag to be used later for error logging * set in probenexus. * * 18-Feb-86 -- jaw add routines to cpu switch for nexus/unibus addreses * also got rid of some globals like nexnum. * * 03-Feb-86 -- jaw changes to SCB vectoring scheme. * * 15-jul-85 -- jaw * add support for VAX8800 * * 22 Oct 85 -- tresvik * fixed typo `ifdef VAX8600:' changed to `ifdef VAX8600' * * 25 Sep 85 -- tresvik * Changed cpu identification message to make the distinction * between the VAX 8600 and VAX 8650. * * 8 Aug 85 -- lp * Changed unifind routine to clear strays correctly on VAX8200. * Also changed how wildcarded devices get seen by bda and bua * (check for small addr values). * * 8 Aug 85 -- rjl * The MicroVAX-I behavior of uballoc doesn't return a bus virtual * address of zero. It also doesn't need this code due to the fact * that none of the supported devices need to do I/O during probe * so the code is conditionalized for it. * * 1 Aug 85 -- rjl * The first page of memory was mapped directly to allow devices to do * dma transfers in the probe routines. This same map register was * also used by devices to map communications areas. Fixed unifind to * use uballoc like everyone else to avoid double mapping. * * 26-jul-85 -- jaw * VAX8200 vector page allocation for unifind done in biinit.c. * * 11-jul-85 -- jaw * fix bua/bda map registers. * * 19-Jun-85 -- jaw * VAX8200 name change. * * 6 Jun 85 -- jaw * add support for the BDA. * * 6 Jun 85 -- rjl * Set up memory systems on MicroVAXen. This was previously done * in the boot code but needs to be here so that the bits set while * probing I/O space get cleared properly. * * 20-Mar-85 -- jaw * Changes for the VAX8200 * * 12-Mar-85 -- tresvik * Clear SBIA error bits after autoconfig and enable SBI faults. * Fix sizing of second SBIA. * * 9 Mar 85 -- rjl * Changed MicroVAX selection of root floppy to be based on a relative * unit number rather than a predetermined one. * * 27-Feb-85 -tresvik * Changes for support of the VAX8600 were merged in. * * 19 Nov 84 -- rjl * Generalized the tables that probenexus and unifind work from to * support the MicroVAXen's notion of the various spaces. Generalized * ubaacces to make it useful for the initing any set of pte's. * * 31 Aug 84 -- reilly * Change the way the swap device(s) is handle because of the new * disk partitioning scheme. All of swapconf is no longer in here, it * can now be found init_main.c * 13 Nov 84 -- jrs * Add code to check for unconfigured UBA's to avoid panic. * * 11 Aug 84 -- rjl * Merged all MicroVAX changes * * 3 Aug 84 -- rjl * Fixed bug that caused a configuration with two or more of the same * devices on a uba to configure missing devices using address of present * devices. * * 14 Apr 84 -- rjl * Added check and release of contigous buffers. * * 12 Apr 84 -- rjl * Added floating point mismatch warning. This check depends on a * related change in locore.s. * * 16 Feb 84 -- rjl * Added support for dynamic configuration of the rootdevice to be * the same as the boot device. * * 5 Jan 84 --jmcg * This version has been tested on MicroVAX 1. Having the physical * address of the pseudo-nexus space makes things easier elsewhere. * * 2 Jan 84 -- jmcg * Added support for MicroVAX 1. * * 2 Jan 84 --jmcg * Derived from Ultrix-32 baseline sources 1.5; heritage is 4.2BSD, * labeled: * autoconf.c 6.3 83/08/11 * * ------------------------------------------------------------------------ *//* * 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. * * N.B.: A lot of the conditionals based on processor type say * #if VAX780 * and * #if VAX750 * which may be incorrect after more processors are introduced if they * are unlike either of these machines. * * TODO: * use cpusw info about whether a ubasr exists */#include "../h/config.h"#include "../data/autoconf_data.c"#include "../h/kmalloc.h"#include "../vax/rpb.h"#include "../machine/sas/vmb.h"/* save record of sbis present for sbi error logging for 780 and 8600 */long sbi_there = 0; /* bits 0-15 for nexi,sbi0; 16-31 for nexi on sbi1*/extern struct cpusw *cpup; /* pointer to cpusw entry *//* * 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 ioanum = 0; /* only greater than zero on an 8600 */int dkn; /* number of iostat dk numbers assigned so far *//* * Cache state (enable/disable) */int cache_state;int cache2_state;/* * 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(){ int *ip; extern int ws_display_type; extern char Sysbase[]; if((*cpup->config)(cpup) < 0) { printf("No config routine for cpu type %d\n", cpu); asm("halt"); } scbprot(); cold = 0; timer_action();/* * Enable cache - (and floating point accelerator if necessary) */ cachenbl(); setcache (cache_state); /* * Plug in some variables needed by standalone environments to * be able to sense the configuration during installation. THIS * SEECTION OF CODE SHOULD DIE AND MOVE TO USE GETSYSINFO IN THE * FUTURE. */ /* * write enable the RPB */ ip = (int *)Sysmap; *ip &= ~PG_PROT; *ip |= PG_KW; mtpr(TBIS, Sysbase); /* * plug in the address of vmb_info */ rpb.vmbinfo = (long *)&vmb_info; /* * plug in the cpu type and cpu subtype while the RPB * is still writeable */ rpb.cpu = cpu; rpb.cpu_subtype = cpu_subtype; /* * plug in the ws_display_type - this must be done after * graphic cons_init routines are run where it is filled in */ rpb.ws_display_type = ws_display_type; /* * write protect the RPB again */ ip = (int *)Sysmap; *ip &= ~PG_PROT; *ip |= PG_KR; mtpr(TBIS, Sysbase); return;}/* * 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. */scbprot(){ register int *ip,i; extern char scbend; char *scbptr; ip = (int *)Sysmap + (btop(((int) &scb.scb_stray) & 0x7fffffff)); for(scbptr = (char *) &scb.scb_stray; scbptr != (char *) &scbend; scbptr += NBPG) { *ip &= ~PG_PROT; *ip |= PG_KR; mtpr(TBIS, scbptr); ip++; } setconf();}ubacsrcheck(vubp,uhp) struct uba_hd *uhp;char *vubp;{#if defined(VAX780) || defined(VAX8600) || defined(VAX8200) || defined(VAX8800) if (uhp->uba_type & UBABUA) { if (((struct bua_regs *)vubp)->bua_ctrl & BUACR_ERR) { ((struct bua_regs *)vubp)->bua_ctrl = ((struct bua_regs *)vubp)->bua_ctrl; return(1); } } else { ((struct uba_regs *)vubp)->uba_cr = UBACR_IFS|UBACR_BRIE; if (((struct uba_regs *)vubp)->uba_sr) { ((struct uba_regs *)vubp)->uba_sr = ((struct uba_regs *)vubp)->uba_sr; return(1); } }#endif return(0);}/* * Find devices on a UNIBUS. * Uses per-driver routine to set <br,cvec> * and then fills in the tables, with help from a per-driver * slave initialization routine. */unifind(vubp, pubp, vumem, pumem, umemsize, pdevaddr, memmap, haveubasr,adpt_num,nexus_num) char *vubp, *pubp, *vumem, *pumem, *pdevaddr; struct pte *memmap; int umemsize; short haveubasr; int adpt_num; int nexus_num;{ register struct uba_device *ui; register struct uba_ctlr *um; u_short *reg, *ap, addr; register struct uba_hd *uhp; register struct uba_driver *udp; int i, (**ivec)(); caddr_t ualloc; extern int catcher[256]; caddr_t tempio; int ubinfo,savectlr; /* * Initialize the UNIBUS, by freeing the map * registers and the buffered data path registers */ uhp = &uba_hd[numuba]; KM_ALLOC(uhp->uh_map, struct map *, UAMSIZ*sizeof(struct map), KM_RMAP, KM_CLEAR|KM_NOWAIT); ubainitmaps(uhp); KM_ALLOC(uhp->uq_map, struct map *, QAMSIZ*sizeof(struct map), KM_RMAP, KM_CLEAR|KM_NOWAIT); rminit(uhp->uq_map, (long)QBMREG - 1024, (long)1, "qba", QAMSIZ); /* * Save virtual and physical addresses * of adaptor, and allocate and initialize * the UNIBUS interrupt vector. */ uhp->uh_uba = (struct uba_regs *) vubp; uhp->uh_physuba = (struct uba_regs *)pubp; /* set up vector if one hasn't been setup yet */ if (numuba < nNUBA) { /* set the UBA alive in case empty */ config_set_alive("uba", numuba, numuba, -1);#if defined(VAX8600) if( cpu == VAX_8600) uhp->uh_vec = SCB_UNIBUS_PAGE((numuba+1)); else#endif VAX8600 uhp->uh_vec = SCB_UNIBUS_PAGE(numuba); /* * Set last free interrupt vector for devices with * programmable interrupt vectors. Use is to decrement * this number and use result as interrupt vector. */ uhp->uh_lastiv = 0x200; for (i = 0; i < (uhp->uh_lastiv/4); i++) uhp->uh_vec[i] = scbentry(&catcher[i*2], SCB_ISTACK); } /* * Map the adapter memory and the i/o space. For unibuses the i/o space * is the last 8k of the adapter memory. On q-bus it's totally disjoint. * We map the i/o space right after the adapter memory space so that * its easy to compute the virtual addresses. */ if ((uhp->uba_type&(UBABDA|UBAXMI))==0) { /* BDA and XMI do not have dev space! */ ubaaccess(pumem, memmap, umemsize, PG_V|PG_KW); ubaaccess(pdevaddr, memmap+btop(umemsize), DEVSPACESIZE, PG_V|PG_KW); } /* clear uba csr */ if (haveubasr) ubacsrcheck(vubp,uhp); /*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -