added in uda and mt support
[unix-history] / usr / src / sys / vax / stand / uba.c
CommitLineData
3486ee81 1/* uba.c 4.5 81/11/12 */
1e215e14
BJ
2
3#include "../h/param.h"
4#include "../h/inode.h"
99fe9747 5#include "../h/cpu.h"
1e215e14 6#include "../h/pte.h"
99fe9747 7#include "../h/ubareg.h"
1e215e14
BJ
8#include "../h/vm.h"
9#include "saio.h"
99fe9747 10#include "savax.h"
1e215e14 11
19542281
BJ
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 */
1e215e14 18ubasetup(io, bdp)
99fe9747
BJ
19 register struct iob *io;
20 int bdp;
1e215e14 21{
1e215e14
BJ
22 int npf;
23 unsigned v;
24 register struct pte *pte;
19542281 25 int o, temp, reg;
3486ee81 26 static int lastreg = 128+64;
1e215e14 27
3486ee81
BJ
28 v = btop(io->i_ma);
29 o = (int)io->i_ma & PGOFSET;
30 npf = btoc(io->i_cc + o) +1;
19542281 31 if (bdp == 2) {
3486ee81
BJ
32 reg = lastreg;
33 lastreg += npf;
19542281
BJ
34 bdp = 0;
35 } else
36 reg = 0;
19542281 37 pte = &ubauba(io->i_unit)->uba_map[reg];
99fe9747 38 temp = (bdp << 21) | UBAMR_MRV;
1e215e14 39 if (bdp && (o & 01))
99fe9747 40 temp |= UBAMR_BO;
1e215e14
BJ
41 v &= 0x1fffff; /* drop to physical addr */
42 while (--npf != 0)
43 *(int *)pte++ = v++ | temp;
44 *(int *)pte++ = 0;
19542281 45 return ((bdp << 28) | (reg << 9) | o);
1e215e14
BJ
46}
47
99fe9747
BJ
48ubafree(io, mr)
49 struct iob *io;
1e215e14
BJ
50 int mr;
51{
99fe9747 52 register int bdp;
1e215e14
BJ
53
54 bdp = (mr >> 28) & 0x0f;
99fe9747
BJ
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;
d54f1867 67 case VAX_7ZZ:
19542281 68 break;
99fe9747 69 }
1e215e14 70}