BSD 4_1_snap release
[unix-history] / sys / stand / uba.c
CommitLineData
d2b723ab
C
1/* uba.c 4.5 81/11/12 */
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 */
18ubasetup(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 static int lastreg = 128+64;
27
28 v = btop(io->i_ma);
29 o = (int)io->i_ma & PGOFSET;
30 npf = btoc(io->i_cc + o) +1;
31 if (bdp == 2) {
32 reg = lastreg;
33 lastreg += npf;
34 bdp = 0;
35 } else
36 reg = 0;
37 pte = &ubauba(io->i_unit)->uba_map[reg];
38 temp = (bdp << 21) | UBAMR_MRV;
39 if (bdp && (o & 01))
40 temp |= UBAMR_BO;
41 v &= 0x1fffff; /* drop to physical addr */
42 while (--npf != 0)
43 *(int *)pte++ = v++ | temp;
44 *(int *)pte++ = 0;
45 return ((bdp << 28) | (reg << 9) | o);
46}
47
48ubafree(io, mr)
49 struct iob *io;
50 int mr;
51{
52 register int bdp;
53
54 bdp = (mr >> 28) & 0x0f;
55 if (bdp == 0)
56 return;
57 switch (cpu) {
58
59 case VAX_780:
60 ubauba(io->i_unit)->uba_dpr[bdp] |= UBADPR_BNE;
61 break;
62
63 case VAX_750:
64 ubauba(io->i_unit)->uba_dpr[bdp] |=
65 UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE;
66 break;
67 case VAX_7ZZ:
68 break;
69 }
70}