xref: /csrg-svn/sys/vax/stand/uba.c (revision 328)
1*328Sbill /*	uba.c	1.1	06/28/80	*/
2*328Sbill 
3*328Sbill #include "../h/param.h"
4*328Sbill #include "../h/inode.h"
5*328Sbill #include "../h/pte.h"
6*328Sbill #include "../h/uba.h"
7*328Sbill #include "../h/vm.h"
8*328Sbill #include "saio.h"
9*328Sbill 
10*328Sbill ubasetup(io, bdp)
11*328Sbill register struct iob *io;
12*328Sbill {
13*328Sbill 	register int i;
14*328Sbill 	int npf;
15*328Sbill 	unsigned v;
16*328Sbill 	register struct pte *pte;
17*328Sbill 	int o, vaddr, temp;
18*328Sbill 
19*328Sbill 	v = btop(io->i_ma);
20*328Sbill 	o = (int)io->i_ma & PGOFSET;
21*328Sbill 	npf = btoc(io->i_cc + o) +1;
22*328Sbill 	pte = &(((struct uba_regs *)PHYSUBA0)->uba_map[0]);
23*328Sbill 	temp = (bdp << 21) | MRV;
24*328Sbill 	if (bdp && (o & 01))
25*328Sbill 		temp |= BO;
26*328Sbill 	v &= 0x1fffff;			/* drop to physical addr */
27*328Sbill 	while (--npf != 0)
28*328Sbill 		*(int *)pte++ = v++ | temp;
29*328Sbill 	*(int *)pte++ = 0;
30*328Sbill 	return ((bdp << 28) | o);
31*328Sbill }
32*328Sbill 
33*328Sbill ubafree(mr)
34*328Sbill 	int mr;
35*328Sbill {
36*328Sbill 	register int bdp, reg, npf, a;
37*328Sbill 
38*328Sbill 	bdp = (mr >> 28) & 0x0f;
39*328Sbill 	if (bdp)
40*328Sbill 		((struct uba_regs *)PHYSUBA0)->uba_dpr[bdp] |= BNE;
41*328Sbill }
42