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