xref: /original-bsd/sys/vax/stand/uba.c (revision 6c57d260)
1 /*	uba.c	4.4	81/04/03	*/
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 /*
13  * Note... this routine does not
14  * really allocate; unless bdp == 2
15  * you always get the same space.
16  * When bdp == 2 you get some other space.
17  */
18 ubasetup(io, bdp)
19 	register struct iob *io;
20 	int bdp;
21 {
22 	int npf;
23 	unsigned v;
24 	register struct pte *pte;
25 	int o, temp, reg;
26 
27 	if (bdp == 2) {
28 		reg = 128+64;		/* for stupid ts-11 */
29 		bdp = 0;
30 	} else
31 		reg = 0;
32 	v = btop(io->i_ma);
33 	o = (int)io->i_ma & PGOFSET;
34 	npf = btoc(io->i_cc + o) +1;
35 	pte = &ubauba(io->i_unit)->uba_map[reg];
36 	temp = (bdp << 21) | UBAMR_MRV;
37 	if (bdp && (o & 01))
38 		temp |= UBAMR_BO;
39 	v &= 0x1fffff;			/* drop to physical addr */
40 	while (--npf != 0)
41 		*(int *)pte++ = v++ | temp;
42 	*(int *)pte++ = 0;
43 	return ((bdp << 28) | (reg << 9) | o);
44 }
45 
46 ubafree(io, mr)
47 	struct iob *io;
48 	int mr;
49 {
50 	register int bdp;
51 
52 	bdp = (mr >> 28) & 0x0f;
53 	if (bdp == 0)
54 		return;
55 	switch (cpu) {
56 
57 	case VAX_780:
58 		ubauba(io->i_unit)->uba_dpr[bdp] |= UBADPR_BNE;
59 		break;
60 
61 	case VAX_750:
62 		ubauba(io->i_unit)->uba_dpr[bdp] |=
63 		     UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE;
64 		break;
65 	case VAX_7ZZ:
66 		break;
67 	}
68 }
69