xref: /csrg-svn/sys/vax/stand/uba.c (revision 3263)
1 /*	uba.c	4.2	03/15/81	*/
2 
3 #include "../h/param.h"
4 #include "../h/inode.h"
5 #include "../h/cpu.h"
6 #include "../h/pte.h"
7 #include "../h/ubareg.h"
8 #include "../h/vm.h"
9 #include "saio.h"
10 #include "savax.h"
11 
12 ubasetup(io, bdp)
13 	register struct iob *io;
14 	int bdp;
15 {
16 	int npf;
17 	unsigned v;
18 	register struct pte *pte;
19 	int o, temp;
20 
21 	v = btop(io->i_ma);
22 	o = (int)io->i_ma & PGOFSET;
23 	npf = btoc(io->i_cc + o) +1;
24 	pte = ubauba(io->i_unit)->uba_map;
25 	temp = (bdp << 21) | UBAMR_MRV;
26 	if (bdp && (o & 01))
27 		temp |= UBAMR_BO;
28 	v &= 0x1fffff;			/* drop to physical addr */
29 	while (--npf != 0)
30 		*(int *)pte++ = v++ | temp;
31 	*(int *)pte++ = 0;
32 	return ((bdp << UBAMR_DPSHIFT) | o);
33 }
34 
35 ubafree(io, mr)
36 	struct iob *io;
37 	int mr;
38 {
39 	register int bdp;
40 
41 	bdp = (mr >> 28) & 0x0f;
42 	if (bdp == 0)
43 		return;
44 	switch (cpu) {
45 
46 	case VAX_780:
47 		ubauba(io->i_unit)->uba_dpr[bdp] |= UBADPR_BNE;
48 		break;
49 
50 	case VAX_750:
51 		ubauba(io->i_unit)->uba_dpr[bdp] |=
52 		     UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE;
53 		break;
54 	}
55 }
56