xref: /csrg-svn/sys/vax/uba/uba.c (revision 4966)
1*4966Swnj /*	uba.c	4.38	81/11/20	*/
240Sbill 
340Sbill #include "../h/param.h"
42395Swnj #include "../h/systm.h"
52395Swnj #include "../h/cpu.h"
640Sbill #include "../h/map.h"
740Sbill #include "../h/pte.h"
82395Swnj #include "../h/buf.h"
92570Swnj #include "../h/vm.h"
102958Swnj #include "../h/ubareg.h"
112958Swnj #include "../h/ubavar.h"
1240Sbill #include "../h/dir.h"
1340Sbill #include "../h/user.h"
1440Sbill #include "../h/proc.h"
15284Sbill #include "../h/conf.h"
161901Swnj #include "../h/mtpr.h"
172395Swnj #include "../h/nexus.h"
182570Swnj #include "../h/dk.h"
1940Sbill 
202929Swnj #if VAX780
212929Swnj char	ubasr_bits[] = UBASR_BITS;
222929Swnj #endif
232929Swnj 
2440Sbill /*
252570Swnj  * Do transfer on device argument.  The controller
262570Swnj  * and uba involved are implied by the device.
272570Swnj  * We queue for resource wait in the uba code if necessary.
282570Swnj  * We return 1 if the transfer was started, 0 if it was not.
292570Swnj  * If you call this routine with the head of the queue for a
302570Swnj  * UBA, it will automatically remove the device from the UBA
312570Swnj  * queue before it returns.  If some other device is given
322570Swnj  * as argument, it will be added to the request queue if the
332570Swnj  * request cannot be started immediately.  This means that
342570Swnj  * passing a device which is on the queue but not at the head
352570Swnj  * of the request queue is likely to be a disaster.
362570Swnj  */
372570Swnj ubago(ui)
382958Swnj 	register struct uba_device *ui;
392570Swnj {
402958Swnj 	register struct uba_ctlr *um = ui->ui_mi;
412570Swnj 	register struct uba_hd *uh;
422570Swnj 	register int s, unit;
432570Swnj 
442570Swnj 	uh = &uba_hd[um->um_ubanum];
452570Swnj 	s = spl6();
462628Swnj 	if (um->um_driver->ud_xclu && uh->uh_users > 0 || uh->uh_xclu)
472616Swnj 		goto rwait;
482570Swnj 	um->um_ubinfo = ubasetup(um->um_ubanum, um->um_tab.b_actf->b_actf,
492570Swnj 	    UBA_NEEDBDP|UBA_CANTWAIT);
502616Swnj 	if (um->um_ubinfo == 0)
512616Swnj 		goto rwait;
522616Swnj 	uh->uh_users++;
532628Swnj 	if (um->um_driver->ud_xclu)
542616Swnj 		uh->uh_xclu = 1;
552570Swnj 	splx(s);
562570Swnj 	if (ui->ui_dk >= 0) {
572570Swnj 		unit = ui->ui_dk;
582570Swnj 		dk_busy |= 1<<unit;
592570Swnj 	}
602570Swnj 	if (uh->uh_actf == ui)
612570Swnj 		uh->uh_actf = ui->ui_forw;
622570Swnj 	(*um->um_driver->ud_dgo)(um);
632570Swnj 	if (ui->ui_dk >= 0) {
642570Swnj 		dk_xfer[unit]++;
653353Swnj 		dk_wds[unit] += um->um_tab.b_actf->b_actf->b_bcount>>6;
662570Swnj 	}
672570Swnj 	return (1);
682616Swnj rwait:
692616Swnj 	if (uh->uh_actf != ui) {
702616Swnj 		ui->ui_forw = NULL;
712616Swnj 		if (uh->uh_actf == NULL)
722616Swnj 			uh->uh_actf = ui;
732616Swnj 		else
742616Swnj 			uh->uh_actl->ui_forw = ui;
752616Swnj 		uh->uh_actl = ui;
762616Swnj 	}
772616Swnj 	splx(s);
782616Swnj 	return (0);
792570Swnj }
802570Swnj 
812616Swnj ubadone(um)
822958Swnj 	register struct uba_ctlr *um;
832616Swnj {
842616Swnj 	register struct uba_hd *uh = &uba_hd[um->um_ubanum];
852616Swnj 
862628Swnj 	if (um->um_driver->ud_xclu)
872616Swnj 		uh->uh_xclu = 0;
882616Swnj 	uh->uh_users--;
892616Swnj 	ubarelse(um->um_ubanum, &um->um_ubinfo);
902616Swnj }
912616Swnj 
922570Swnj /*
932395Swnj  * Allocate and setup UBA map registers, and bdp's
942395Swnj  * Flags says whether bdp is needed, whether the caller can't
952395Swnj  * wait (e.g. if the caller is at interrupt level).
9640Sbill  *
972570Swnj  * Return value:
9840Sbill  *	Bits 0-8	Byte offset
9940Sbill  *	Bits 9-17	Start map reg. no.
10040Sbill  *	Bits 18-27	No. mapping reg's
10140Sbill  *	Bits 28-31	BDP no.
10240Sbill  */
1032395Swnj ubasetup(uban, bp, flags)
1042395Swnj 	struct buf *bp;
10540Sbill {
1062395Swnj 	register struct uba_hd *uh = &uba_hd[uban];
10740Sbill 	register int temp, i;
10840Sbill 	int npf, reg, bdp;
10940Sbill 	unsigned v;
11040Sbill 	register struct pte *pte, *io;
11140Sbill 	struct proc *rp;
11240Sbill 	int a, o, ubinfo;
11340Sbill 
1143498Swnj #if VAX7ZZ
1153498Swnj 	if (cpu == VAX_7ZZ)
1163332Swnj 		flags &= ~UBA_NEEDBDP;
1173332Swnj #endif
11840Sbill 	v = btop(bp->b_un.b_addr);
11940Sbill 	o = (int)bp->b_un.b_addr & PGOFSET;
12040Sbill 	npf = btoc(bp->b_bcount + o) + 1;
12140Sbill 	a = spl6();
1222784Swnj 	while ((reg = rmalloc(uh->uh_map, npf)) == 0) {
1233913Swnj 		if (flags & UBA_CANTWAIT) {
1243913Swnj 			splx(a);
1252395Swnj 			return (0);
1263913Swnj 		}
1272395Swnj 		uh->uh_mrwant++;
1282395Swnj 		sleep((caddr_t)uh->uh_map, PSWP);
12940Sbill 	}
13040Sbill 	bdp = 0;
1312395Swnj 	if (flags & UBA_NEEDBDP) {
1322395Swnj 		while ((bdp = ffs(uh->uh_bdpfree)) == 0) {
1332395Swnj 			if (flags & UBA_CANTWAIT) {
1342784Swnj 				rmfree(uh->uh_map, npf, reg);
1353913Swnj 				splx(a);
1362395Swnj 				return (0);
1372395Swnj 			}
1382395Swnj 			uh->uh_bdpwant++;
1392395Swnj 			sleep((caddr_t)uh->uh_map, PSWP);
14040Sbill 		}
1412463Swnj 		uh->uh_bdpfree &= ~(1 << (bdp-1));
1424758Swnj 	} else if (flags & UBA_HAVEBDP)
1434758Swnj 		bdp = (flags >> 28) & 0xf;
14440Sbill 	splx(a);
1452463Swnj 	reg--;
14640Sbill 	ubinfo = (bdp << 28) | (npf << 18) | (reg << 9) | o;
1472395Swnj 	io = &uh->uh_uba->uba_map[reg];
1482958Swnj 	temp = (bdp << 21) | UBAMR_MRV;
14940Sbill 	rp = bp->b_flags&B_DIRTY ? &proc[2] : bp->b_proc;
15040Sbill 	if (bdp && (o & 01))
1512958Swnj 		temp |= UBAMR_BO;
15240Sbill 	if (bp->b_flags & B_UAREA) {
15340Sbill 		for (i = UPAGES - bp->b_bcount / NBPG; i < UPAGES; i++) {
15440Sbill 			if (rp->p_addr[i].pg_pfnum == 0)
15540Sbill 				panic("uba: zero upage");
15640Sbill 			*(int *)io++ = rp->p_addr[i].pg_pfnum | temp;
15740Sbill 		}
15840Sbill 	} else if ((bp->b_flags & B_PHYS) == 0) {
159728Sbill 		pte = &Sysmap[btop(((int)bp->b_un.b_addr)&0x7fffffff)];
16040Sbill 		while (--npf != 0)
161728Sbill 			*(int *)io++ = pte++->pg_pfnum | temp;
16240Sbill 	} else {
16340Sbill 		if (bp->b_flags & B_PAGET)
16440Sbill 			pte = &Usrptmap[btokmx((struct pte *)bp->b_un.b_addr)];
16540Sbill 		else
16640Sbill 			pte = vtopte(rp, v);
16740Sbill 		while (--npf != 0) {
16840Sbill 			if (pte->pg_pfnum == 0)
16940Sbill 				panic("uba zero uentry");
17040Sbill 			*(int *)io++ = pte++->pg_pfnum | temp;
17140Sbill 		}
17240Sbill 	}
17340Sbill 	*(int *)io++ = 0;
17440Sbill 	return (ubinfo);
17540Sbill }
17640Sbill 
17740Sbill /*
1782570Swnj  * Non buffer setup interface... set up a buffer and call ubasetup.
17940Sbill  */
1802395Swnj uballoc(uban, addr, bcnt, flags)
1813107Swnj 	int uban;
18240Sbill 	caddr_t addr;
1833107Swnj 	int bcnt, flags;
18440Sbill {
185883Sbill 	struct buf ubabuf;
18640Sbill 
18740Sbill 	ubabuf.b_un.b_addr = addr;
18840Sbill 	ubabuf.b_flags = B_BUSY;
18940Sbill 	ubabuf.b_bcount = bcnt;
190883Sbill 	/* that's all the fields ubasetup() needs */
1912395Swnj 	return (ubasetup(uban, &ubabuf, flags));
19240Sbill }
19340Sbill 
1942053Swnj /*
1952570Swnj  * Release resources on uba uban, and then unblock resource waiters.
1962570Swnj  * The map register parameter is by value since we need to block
1972570Swnj  * against uba resets on 11/780's.
1982053Swnj  */
1992395Swnj ubarelse(uban, amr)
2002053Swnj 	int *amr;
20140Sbill {
2022395Swnj 	register struct uba_hd *uh = &uba_hd[uban];
2032570Swnj 	register int bdp, reg, npf, s;
2042053Swnj 	int mr;
20540Sbill 
2062570Swnj 	/*
2072570Swnj 	 * Carefully see if we should release the space, since
2082570Swnj 	 * it may be released asynchronously at uba reset time.
2092570Swnj 	 */
2102570Swnj 	s = spl6();
2112053Swnj 	mr = *amr;
2122053Swnj 	if (mr == 0) {
2132570Swnj 		/*
2142570Swnj 		 * A ubareset() occurred before we got around
2152570Swnj 		 * to releasing the space... no need to bother.
2162570Swnj 		 */
2172570Swnj 		splx(s);
2182053Swnj 		return;
2192053Swnj 	}
2202067Swnj 	*amr = 0;
2212570Swnj 	splx(s);		/* let interrupts in, we're safe for a while */
22240Sbill 	bdp = (mr >> 28) & 0x0f;
22340Sbill 	if (bdp) {
2242729Swnj 		switch (cpu) {
2252423Skre #if VAX780
2262423Skre 		case VAX_780:
2272958Swnj 			uh->uh_uba->uba_dpr[bdp] |= UBADPR_BNE;
2282423Skre 			break;
2292423Skre #endif
2302423Skre #if VAX750
2312423Skre 		case VAX_750:
2322958Swnj 			uh->uh_uba->uba_dpr[bdp] |=
2332958Swnj 			    UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE;
2342423Skre 			break;
2352423Skre #endif
2362423Skre 		}
2372570Swnj 		uh->uh_bdpfree |= 1 << (bdp-1);		/* atomic */
2382395Swnj 		if (uh->uh_bdpwant) {
2392395Swnj 			uh->uh_bdpwant = 0;
2402395Swnj 			wakeup((caddr_t)uh->uh_map);
24140Sbill 		}
24240Sbill 	}
2432570Swnj 	/*
2442570Swnj 	 * Put back the registers in the resource map.
2452570Swnj 	 * The map code must not be reentered, so we do this
2462570Swnj 	 * at high ipl.
2472570Swnj 	 */
24840Sbill 	npf = (mr >> 18) & 0x3ff;
24940Sbill 	reg = ((mr >> 9) & 0x1ff) + 1;
2502570Swnj 	s = spl6();
2512784Swnj 	rmfree(uh->uh_map, npf, reg);
2522570Swnj 	splx(s);
2532570Swnj 
2542570Swnj 	/*
2552570Swnj 	 * Wakeup sleepers for map registers,
2562570Swnj 	 * and also, if there are processes blocked in dgo(),
2572570Swnj 	 * give them a chance at the UNIBUS.
2582570Swnj 	 */
2592395Swnj 	if (uh->uh_mrwant) {
2602395Swnj 		uh->uh_mrwant = 0;
2612395Swnj 		wakeup((caddr_t)uh->uh_map);
26240Sbill 	}
2632570Swnj 	while (uh->uh_actf && ubago(uh->uh_actf))
2642570Swnj 		;
26540Sbill }
26640Sbill 
2672729Swnj ubapurge(um)
2682958Swnj 	register struct uba_ctlr *um;
2692729Swnj {
2702729Swnj 	register struct uba_hd *uh = um->um_hd;
2712729Swnj 	register int bdp = (um->um_ubinfo >> 28) & 0x0f;
2722729Swnj 
2732729Swnj 	switch (cpu) {
2742729Swnj #if VAX780
2752729Swnj 	case VAX_780:
2762958Swnj 		uh->uh_uba->uba_dpr[bdp] |= UBADPR_BNE;
2772729Swnj 		break;
2782729Swnj #endif
2792729Swnj #if VAX750
2802729Swnj 	case VAX_750:
2812958Swnj 		uh->uh_uba->uba_dpr[bdp] |= UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE;
2822729Swnj 		break;
2832729Swnj #endif
2842729Swnj 	}
2852729Swnj }
2862729Swnj 
2872570Swnj /*
2882570Swnj  * Generate a reset on uba number uban.  Then
2892570Swnj  * call each device in the character device table,
2902570Swnj  * giving it a chance to clean up so as to be able to continue.
2912570Swnj  */
2922395Swnj ubareset(uban)
2932570Swnj 	int uban;
294284Sbill {
295284Sbill 	register struct cdevsw *cdp;
2962646Swnj 	register struct uba_hd *uh = &uba_hd[uban];
2971781Sbill 	int s;
298284Sbill 
299302Sbill 	s = spl6();
3002646Swnj 	uh->uh_users = 0;
3012646Swnj 	uh->uh_zvcnt = 0;
3022646Swnj 	uh->uh_xclu = 0;
3032646Swnj 	uh->uh_hangcnt = 0;
3042646Swnj 	uh->uh_actf = uh->uh_actl = 0;
3052646Swnj 	uh->uh_bdpwant = 0;
3062646Swnj 	uh->uh_mrwant = 0;
3072646Swnj 	wakeup((caddr_t)&uh->uh_bdpwant);
3082646Swnj 	wakeup((caddr_t)&uh->uh_mrwant);
3092958Swnj 	printf("uba%d: reset", uban);
3102958Swnj 	ubainit(uh->uh_uba);
311284Sbill 	for (cdp = cdevsw; cdp->d_open; cdp++)
3122395Swnj 		(*cdp->d_reset)(uban);
313284Sbill 	printf("\n");
314302Sbill 	splx(s);
315284Sbill }
3162395Swnj 
3172570Swnj /*
3182570Swnj  * Init a uba.  This is called with a pointer
3192570Swnj  * rather than a virtual address since it is called
3202570Swnj  * by code which runs with memory mapping disabled.
3212570Swnj  * In these cases we really don't need the interrupts
3222570Swnj  * enabled, but since we run with ipl high, we don't care
3232570Swnj  * if they are, they will never happen anyways.
3242570Swnj  */
3252423Skre ubainit(uba)
3262423Skre 	register struct uba_regs *uba;
3272395Swnj {
3282395Swnj 
3292958Swnj 	switch (cpu) {
3302958Swnj #if VAX780
3313248Swnj 	case VAX_780:
3322958Swnj 		uba->uba_cr = UBACR_ADINIT;
3332958Swnj 		uba->uba_cr = UBACR_IFS|UBACR_BRIE|UBACR_USEFIE|UBACR_SUEFIE;
3342958Swnj 		while ((uba->uba_cnfgr & UBACNFGR_UBIC) == 0)
3352958Swnj 			;
3362958Swnj 		break;
3372958Swnj #endif
3382958Swnj #if VAX750
3393248Swnj 	case VAX_750:
3403352Swnj #endif
3413498Swnj #if VAX7ZZ
3423498Swnj 	case VAX_7ZZ:
3433352Swnj #endif
3443498Swnj #if defined(VAX750) || defined(VAX7ZZ)
3453352Swnj 		mtpr(IUR, 0);
3462958Swnj 		/* give devices time to recover from power fail */
3473332Swnj /* THIS IS PROBABLY UNNECESSARY */
3483352Swnj 		DELAY(500000);
3493332Swnj /* END PROBABLY UNNECESSARY */
3502958Swnj 		break;
3512958Swnj #endif
3522958Swnj 	}
3532395Swnj }
3542395Swnj 
3552958Swnj #if VAX780
3562570Swnj /*
3572570Swnj  * Check to make sure the UNIBUS adaptor is not hung,
3582570Swnj  * with an interrupt in the register to be presented,
3592570Swnj  * but not presenting it for an extended period (5 seconds).
3602570Swnj  */
3612395Swnj unhang()
3622395Swnj {
3632395Swnj 	register int uban;
3642395Swnj 
3652395Swnj 	for (uban = 0; uban < numuba; uban++) {
3662395Swnj 		register struct uba_hd *uh = &uba_hd[uban];
3672395Swnj 		register struct uba_regs *up = uh->uh_uba;
3682395Swnj 
3692395Swnj 		if (up->uba_sr == 0)
3702395Swnj 			return;
3713945Sroot 		up->uba_sr = UBASR_CRD|UBASR_LEB;
3722395Swnj 		uh->uh_hangcnt++;
3732759Swnj 		if (uh->uh_hangcnt > 5*hz) {
3742395Swnj 			uh->uh_hangcnt = 0;
3752929Swnj 			printf("uba%d: hung\n", uban);
3762395Swnj 			ubareset(uban);
3772395Swnj 		}
3782395Swnj 	}
3792395Swnj }
3802395Swnj 
3812570Swnj /*
3822570Swnj  * This is a timeout routine which decrements the ``i forgot to
3832570Swnj  * interrupt'' counts, on an 11/780.  This prevents slowly growing
3842570Swnj  * counts from causing a UBA reset since we are interested only
3852570Swnj  * in hang situations.
3862570Swnj  */
3872395Swnj ubawatch()
3882395Swnj {
3892395Swnj 	register struct uba_hd *uh;
3902395Swnj 	register int uban;
3912395Swnj 
3922784Swnj 	if (panicstr)
3932784Swnj 		return;
3942395Swnj 	for (uban = 0; uban < numuba; uban++) {
3952395Swnj 		uh = &uba_hd[uban];
3962395Swnj 		if (uh->uh_hangcnt)
3972395Swnj 			uh->uh_hangcnt--;
3982395Swnj 	}
3992395Swnj }
4002395Swnj 
4014024Swnj int	ubawedgecnt = 10;
4024024Swnj int	ubacrazy = 500;
4032570Swnj /*
4042570Swnj  * This routine is called by the locore code to
4052570Swnj  * process a UBA error on an 11/780.  The arguments are passed
4062570Swnj  * on the stack, and value-result (through some trickery).
4072570Swnj  * In particular, the uvec argument is used for further
4082570Swnj  * uba processing so the result aspect of it is very important.
4092570Swnj  * It must not be declared register.
4102570Swnj  */
4112423Skre /*ARGSUSED*/
4122395Swnj ubaerror(uban, uh, xx, uvec, uba)
4132395Swnj 	register int uban;
4142395Swnj 	register struct uba_hd *uh;
4152395Swnj 	int uvec;
4162395Swnj 	register struct uba_regs *uba;
4172395Swnj {
4182395Swnj 	register sr, s;
4192395Swnj 
4202395Swnj 	if (uvec == 0) {
4212395Swnj 		uh->uh_zvcnt++;
4222395Swnj 		if (uh->uh_zvcnt > 250000) {
4232929Swnj 			printf("uba%d: too many zero vectors\n");
4242395Swnj 			ubareset(uban);
4252395Swnj 		}
4262395Swnj 		uvec = 0;
4272395Swnj 		return;
4282395Swnj 	}
4292395Swnj 	if (uba->uba_cnfgr & NEX_CFGFLT) {
4302929Swnj 		printf("uba%d: sbi fault sr=%b cnfgr=%b\n",
4312929Swnj 		    uban, uba->uba_sr, ubasr_bits,
4323248Swnj 		    uba->uba_cnfgr, NEXFLT_BITS);
4332395Swnj 		ubareset(uban);
4342395Swnj 		uvec = 0;
4352395Swnj 		return;
4362395Swnj 	}
4372395Swnj 	sr = uba->uba_sr;
4382395Swnj 	s = spl7();
4393473Swnj 	printf("uba%d: uba error sr=%b fmer=%x fubar=%o\n",
4403473Swnj 	    uban, uba->uba_sr, ubasr_bits, uba->uba_fmer, 4*uba->uba_fubar);
4412395Swnj 	splx(s);
4422395Swnj 	uba->uba_sr = sr;
4432958Swnj 	uvec &= UBABRRVR_DIV;
4444024Swnj 	if (++uh->uh_errcnt % ubawedgecnt == 0) {
4454024Swnj 		if (uh->uh_errcnt > ubacrazy)
4464024Swnj 			panic("uba crazy");
4474024Swnj 		printf("ERROR LIMIT ");
4484024Swnj 		ubareset(uban);
4494024Swnj 		uvec = 0;
4504024Swnj 		return;
4514024Swnj 	}
4522395Swnj 	return;
4532395Swnj }
4542395Swnj #endif
4553745Sroot 
456*4966Swnj #if 0
4573745Sroot /*
4583745Sroot  * This routine allows remapping of previously
4593745Sroot  * allocated UNIBUS bdp and map resources
4603745Sroot  * onto different memory addresses.
4613745Sroot  * It should only be used by routines which need
4623745Sroot  * small fixed length mappings for long periods of time
4633745Sroot  * (like the ARPANET ACC IMP interface).
4643745Sroot  * It only maps kernel addresses.
4653745Sroot  */
4663745Sroot ubaremap(uban, ubinfo, addr)
4673745Sroot 	int uban;
4683745Sroot 	register unsigned ubinfo;
4693745Sroot 	caddr_t addr;
4703745Sroot {
4713745Sroot 	register struct uba_hd *uh = &uba_hd[uban];
4723745Sroot 	register struct pte *pte, *io;
4733745Sroot 	register int temp, bdp;
4743745Sroot 	int npf, o;
4753745Sroot 
4763745Sroot 	o = (int)addr & PGOFSET;
4773745Sroot 	bdp = (ubinfo >> 28) & 0xf;
4783745Sroot 	npf = (ubinfo >> 18) & 0x3ff;
4793745Sroot 	io = &uh->uh_uba->uba_map[(ubinfo >> 9) & 0x1ff];
4803745Sroot 	temp = (bdp << 21) | UBAMR_MRV;
4813745Sroot 
4823745Sroot 	/*
4833745Sroot 	 * If using buffered data path initiate purge
4843745Sroot 	 * of old data and set byte offset bit if next
4853745Sroot 	 * transfer will be from odd address.
4863745Sroot 	 */
4873745Sroot 	if (bdp) {
4883745Sroot 		switch (cpu) {
4893745Sroot #if VAX780
4903745Sroot 		case VAX_780:
4913745Sroot 			uh->uh_uba->uba_dpr[bdp] |= UBADPR_BNE;
4923745Sroot 			break;
4933745Sroot #endif
4943745Sroot #if VAX750
4953745Sroot 		case VAX_750:
4963745Sroot 			uh->uh_uba->uba_dpr[bdp] |=
4973745Sroot 			    UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE;
4983745Sroot 			break;
4993745Sroot #endif
5003745Sroot 		}
5013745Sroot 		if (o & 1)
5023745Sroot 			temp |= UBAMR_BO;
5033745Sroot 	}
5043745Sroot 
5053745Sroot 	/*
5063745Sroot 	 * Set up the map registers, leaving an invalid reg
5073745Sroot 	 * at the end to guard against wild unibus transfers.
5083745Sroot 	 */
5093745Sroot 	pte = &Sysmap[btop(((int)addr)&0x7fffffff)];
5103745Sroot 	while (--npf != 0)
5113745Sroot 		*(int *)io++ = pte++->pg_pfnum | temp;
5123745Sroot 	*(int *)io = 0;
5133745Sroot 
5143745Sroot 	/*
5153745Sroot 	 * Return effective UNIBUS address.
5163745Sroot 	 */
5173745Sroot 	return (ubinfo | o);
5183745Sroot }
519*4966Swnj #endif
520