⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 autoconf.c

📁 早期freebsd实现
💻 C
📖 第 1 页 / 共 3 页
字号:
			goto unsupp;		case NEX_CI:			printf("ci");			goto unsupp;		default:			printf("nexus type %x", nexcsr.nex_type);unsupp:			printf(" unsupported (at tr %d)\n", nexnum);			continue;unconfig:			printf(" not configured\n");			continue;		}	}	if (nummba > NMBA)		nummba = NMBA;	if (numuba > NUBA)		numuba = NUBA;	if (nmcr > MAXNMCR)		nmcr = MAXNMCR;}setscbnex(fn)	int (*fn)();{	register struct scb *scbp = &scb[nsbi];	scbp->scb_ipl14[nexnum] = scbp->scb_ipl15[nexnum] =	    scbp->scb_ipl16[nexnum] = scbp->scb_ipl17[nexnum] =		scbentry(fn, SCB_ISTACK);}#endif#if NBI > 0/* * Probe BI node space. * * THIS DEPENDS ON BI SPACE == NEXUS SPACE * THIS WILL NOT WORK FOR MULTIPLE BIs */probe_bi(p)	register struct bibus *p;{	register struct bi_node *biv, *bip;	register int node;	short dtype;	/* must ignore BI errors while configuring */	bip = p->pbi_base;	ioaccess((caddr_t)bip, Nexmap[0], sizeof(*bip) * NNODEBI);/* XXX */	printf("vaxbi0 at address 0x%x\n", bip);	biv = (struct bi_node *) &nexus[0];	/* XXX */	for (node = 0; node < NNODEBI; node++, bip++, biv++) {		if (badaddr((caddr_t)biv, 4))			continue;		bi_nodes |= 1 << node;		/* XXX */		dtype = biv->biic.bi_dtype;		/* clear bus errors */		biv->biic.bi_ber = ~(BIBER_MBZ|BIBER_NMR|BIBER_UPEN);		switch (dtype) {		case BIDT_KA820: {			/* is this right?? */			int cp5 = biv->biic.bi_revs & 0x8000 ? '5' : '0';			if (node != mastercpu) {				printf("slave ka82%c cpu", cp5);				goto unsupp;			}			printf("ka82%c cpu at node %x\n", cp5, node);			biv->biic.bi_intrdes = 1 << mastercpu;			biv->biic.bi_csr |= BICSR_SEIE | BICSR_HEIE;			break;		}		case BIDT_DWBUA:			if (numuba >= NUBA || /*XXX*/numuba > 2) {				printf("%d uba's", ++numuba);				goto unconfig;			}#if NUBA > 0			printf("uba%d at node %x\n", numuba, node);			/*			 * Run a self test reset to drop any `old' errors,			 * so that they cannot cause a BI bus error.			 */			(void) bi_selftest(&biv->biic);			/*			 * Enable interrupts.  DWBUAs must have			 * high priority.			 */			biv->biic.bi_intrdes = 1 << mastercpu;			biv->biic.bi_csr = (biv->biic.bi_csr&~BICSR_ARB_MASK) |				BICSR_ARB_HIGH;			probeuba((struct uba_regs *)biv, (struct uba_regs *)bip,				(caddr_t)UMEM8200(node));#endif /* NUBA */			break;		case BIDT_MS820:			printf("mcr%d at node %x\n", nmcr, node);			if (nmcr >= MAXNMCR) {				printf("%d mcr's", ++nmcr);				goto unconfig;			}			mcraddr[nmcr++] = (caddr_t)biv;			biv->biic.bi_intrdes = 1 << mastercpu;			biv->biic.bi_csr |= BICSR_SEIE | BICSR_HEIE;			break;		case BIDT_KDB50:			if (numkdb >= NKDB) {				printf("%d kdb's", ++numkdb);				goto unconfig;			}#if NKDB > 0			printf("kdb%d at node %x\n", numkdb, node);			kdbconfig(numkdb, (struct biiregs *)biv,				(struct biiregs *)bip,				(int)&scb[0].scb_ipl15[node] - (int)&scb[0]);			scb[0].scb_ipl15[node] =				scbentry(kdbintv[numkdb], SCB_ISTACK);			kdbfind(numkdb);#endif			numkdb++;			break;		case BIDT_DEBNA:		case BIDT_DEBNK:			printf("debna/debnk ethernet");			goto unsupp;		default:			printf("node type 0x%x ", dtype);unsupp:			printf(" unsupported (at node %x)\n", node);			break;unconfig:			printf(" not configured (at node %x)\n", node);			continue;		}#ifdef DO_EINTRCSR		biv->biic.bi_eintrcsr = BIEIC_IPL17 |			(int)&scb[0].scb_bierr - (int)&scb[0];		/* but bi reset will need to restore this */#endif	}	if (numuba > NUBA)		numuba = NUBA;	if (numkdb > NKDB)		numkdb = NKDB;	if (nmcr > MAXNMCR)		nmcr = MAXNMCR;}#if NKDB > 0/* * Find drives attached to a particular KDB50. */kdbfind(kdbnum)	int kdbnum;{	extern struct uba_driver kdbdriver;	register struct uba_device *ui;	register struct uba_driver *udp = &kdbdriver;	int t;	for (ui = ubdinit; ui->ui_driver; ui++) {		/* ui->ui_ubanum is trash */		if (ui->ui_driver != udp || ui->ui_alive ||		    ui->ui_ctlr != kdbnum && ui->ui_ctlr != '?')			continue;		t = ui->ui_ctlr;		ui->ui_ctlr = kdbnum;		if ((*udp->ud_slave)(ui) == 0) {			ui->ui_ctlr = t;			continue;		}		ui->ui_alive = 1;		ui->ui_ubanum = -1;		/* make these invalid so we can see if someone uses them */		/* might as well make each one different too */		ui->ui_hd = (struct uba_hd *)0xc0000010;		ui->ui_addr = (caddr_t)0xc0000014;		ui->ui_physaddr = (caddr_t)0xc0000018;		ui->ui_mi = (struct uba_ctlr *)0xc000001c;		if (ui->ui_dk && dkn < DK_NDRIVE)			ui->ui_dk = dkn++;		else			ui->ui_dk = -1;		/* ui_type comes from driver */		udp->ud_dinfo[ui->ui_unit] = ui;		printf("%s%d at %s%d slave %d\n",		    udp->ud_dname, ui->ui_unit,		    udp->ud_mname, ui->ui_ctlr, ui->ui_slave);		(*udp->ud_attach)(ui);	}}#endif /* NKDB > 0 */#endif /* NBI > 0 */#if NMBA > 0struct	mba_device *mbaconfig();/* * Find devices attached to a particular mba * and look for each device found in the massbus * initialization tables. */mbafind(nxv, nxp)	struct nexus *nxv, *nxp;{	register struct mba_regs *mdp;	register struct mba_drv *mbd;	register struct mba_device *mi;	register struct mba_slave *ms;	int dn, dt, sn;	struct mba_device fnd;	mdp = (struct mba_regs *)nxv;	mba_hd[nummba].mh_mba = mdp;	mba_hd[nummba].mh_physmba = (struct mba_regs *)nxp;	setscbnex(mbaintv[nummba]);	mdp->mba_cr = MBCR_INIT;	mdp->mba_cr = MBCR_IE;	fnd.mi_mba = mdp;	fnd.mi_mbanum = nummba;	for (mbd = mdp->mba_drv, dn = 0; mbd < &mdp->mba_drv[8]; mbd++, dn++) {		if ((mbd->mbd_ds&MBDS_DPR) == 0)			continue;		mdp->mba_sr |= MBSR_NED;		/* si kludge */		dt = mbd->mbd_dt & 0xffff;		if (dt == 0)			continue;		if (mdp->mba_sr&MBSR_NED)			continue;			/* si kludge */		if (dt == MBDT_MOH)			continue;		fnd.mi_drive = dn;#define	qeq(a, b)	( a == b || a == '?' )		if ((mi = mbaconfig(&fnd, dt)) && (dt & MBDT_TAP))		    for (sn = 0; sn < 8; sn++) {			mbd->mbd_tc = sn;		        for (ms = mbsinit; ms->ms_driver; ms++)			    if (ms->ms_driver == mi->mi_driver &&				ms->ms_alive == 0 && 				qeq(ms->ms_ctlr, mi->mi_unit) &&				qeq(ms->ms_slave, sn) &&				(*ms->ms_driver->md_slave)(mi, ms, sn)) {					printf("%s%d at %s%d slave %d\n"					    , ms->ms_driver->md_sname					    , ms->ms_unit					    , mi->mi_driver->md_dname					    , mi->mi_unit					    , sn					);					ms->ms_alive = 1;					ms->ms_ctlr = mi->mi_unit;					ms->ms_slave = sn;					break;				}		    }	}}/* * Have found a massbus device; * see if it is in the configuration table. * If so, fill in its data. */struct mba_device *mbaconfig(ni, type)	register struct mba_device *ni;	register int type;{	register struct mba_device *mi;	register short *tp;	register struct mba_hd *mh;	for (mi = mbdinit; mi->mi_driver; mi++) {		if (mi->mi_alive)			continue;		tp = mi->mi_driver->md_type;		for (mi->mi_type = 0; *tp; tp++, mi->mi_type++)			if (*tp == (type&MBDT_TYPE))				goto found;		continue;found:#define	match(fld)	(ni->fld == mi->fld || mi->fld == '?')		if (!match(mi_drive) || !match(mi_mbanum))			continue;		printf("%s%d at mba%d drive %d",		    mi->mi_driver->md_dname, mi->mi_unit,		    ni->mi_mbanum, ni->mi_drive);		mi->mi_alive = 1;		mh = &mba_hd[ni->mi_mbanum];		mi->mi_hd = mh;		mh->mh_mbip[ni->mi_drive] = mi;		mh->mh_ndrive++;		mi->mi_mba = ni->mi_mba;		mi->mi_drv = &mi->mi_mba->mba_drv[ni->mi_drive];		mi->mi_mbanum = ni->mi_mbanum;		mi->mi_drive = ni->mi_drive;		/*		 * If drive has never been seen before,		 * give it a dkn for statistics.		 */		if (mi->mi_driver->md_info[mi->mi_unit] == 0) {			mi->mi_driver->md_info[mi->mi_unit] = mi;			if (mi->mi_dk && dkn < DK_NDRIVE)				mi->mi_dk = dkn++;			else				mi->mi_dk = -1;		}		(*mi->mi_driver->md_attach)(mi);		printf("\n");		return (mi);	}	return (0);}#endif/* * Fixctlrmask fixes the masks of the driver ctlr routines * which otherwise save r10 and r11 where the interrupt and br * level are passed through. */fixctlrmask(){	register struct uba_ctlr *um;	register struct uba_device *ui;	register struct uba_driver *ud;#define	phys(a,b) ((b)(((int)(a))&0x7fffffff))	for (um = ubminit; ud = phys(um->um_driver, struct uba_driver *); um++)		*phys(ud->ud_probe, short *) &= ~0xc00;	for (ui = ubdinit; ud = phys(ui->ui_driver, struct uba_driver *); ui++)		*phys(ud->ud_probe, short *) &= ~0xc00;}#ifdef QBA/* * Configure a Q-bus. */probeqbus(qb)	struct qbus *qb;{	register struct uba_hd *uhp = &uba_hd[numuba];	ioaccess((caddr_t)qb->qb_map, Nexmap[0],		qb->qb_memsize * sizeof (struct pte));	uhp->uh_type = qb->qb_type;	uhp->uh_uba = (struct uba_regs *)0xc0000000;   /* no uba adaptor regs */	uhp->uh_mr = (struct pte *)&nexus[0];	/*	 * The map registers start right at 20088000 on the	 * ka630, so we have to subtract out the 2k offset to make the	 * pointers work..	 */	uhp->uh_physuba = (struct uba_regs *)(((u_long)qb->qb_map)-0x800);	uhp->uh_memsize = qb->qb_memsize;	ioaccess(qb->qb_maddr, UMEMmap[numuba], uhp->uh_memsize * NBPG);	uhp->uh_mem = umem[numuba];	/*	 * The I/O page is mapped to the 8K of the umem address space	 * immediately after the memory section that is mapped.	 */	ioaccess(qb->qb_iopage, UMEMmap[numuba] + uhp->uh_memsize,	    UBAIOPAGES * NBPG);	uhp->uh_iopage = umem[numuba] + (uhp->uh_memsize * NBPG);	unifind(uhp, qb->qb_iopage);}#endif#if NUBA > 0probeuba(vubp, pubp, pumem)	struct uba_regs *vubp, *pubp;	caddr_t pumem;{	register struct uba_hd *uhp = &uba_hd[numuba];	/*	 * Save virtual and physical addresses of adaptor.	 */	switch (cpu) {#ifdef DW780	case VAX_8600:	case VAX_780:		uhp->uh_type = DW780;		break;#endif#ifdef DW750	case VAX_750:		uhp->uh_type = DW750;		break;#endif#ifdef DW730	case VAX_730:		uhp->uh_type = DW730;		break;#endif#ifdef DWBUA	case VAX_8200:		uhp->uh_type = DWBUA;		break;#endif	default:		panic("unknown UBA type");		/*NOTREACHED*/	}	uhp->uh_uba = vubp;	uhp->uh_physuba = pubp;	uhp->uh_mr = vubp->uba_map;	uhp->uh_memsize = UBAPAGES;	ioaccess(pumem, UMEMmap[numuba], (UBAPAGES + UBAIOPAGES) * NBPG);	uhp->uh_mem = umem[numuba];	uhp->uh_iopage = umem[numuba] + (uhp->uh_memsize * NBPG);	unifind(uhp, pumem + (uhp->uh_memsize * NBPG));}/* * Find devices on a UNIBUS. * Uses per-driver routine to set <br,cvec> into <r11,r10>, * and then fills in the tables, with help from a per-driver * slave initialization routine. */unifind(uhp0, pumem)	struct uba_hd *uhp0;	caddr_t pumem;{#ifndef lint	register int rbr, rcvec;			/* MUST BE r11, r10 */#else	/*	 * Lint doesn't realize that these	 * can be initialized asynchronously	 * when devices interrupt.	 */	register int rbr = 0, rcvec = 0;#endif	register struct uba_device *ui;	register struct uba_ctlr *um;	register struct uba_hd *uhp = uhp0;	u_short *reg, *ap, addr;	struct uba_driver *udp;	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	/*	 * Initialize the UNIBUS, by freeing the map	 * registers and the buffered data path registers	 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -