merge 4.1b with 4.1c
[unix-history] / usr / src / sys / vax / stand / uba.c
CommitLineData
b5d17f4d 1/* uba.c 4.6 82/07/15 */
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 8#include "../h/vm.h"
b5d17f4d 9#include "../h/fs.h"
1e215e14 10#include "saio.h"
99fe9747 11#include "savax.h"
1e215e14 12
19542281
BJ
13/*
14 * Note... this routine does not
15 * really allocate; unless bdp == 2
16 * you always get the same space.
17 * When bdp == 2 you get some other space.
18 */
1e215e14 19ubasetup(io, bdp)
99fe9747
BJ
20 register struct iob *io;
21 int bdp;
1e215e14 22{
1e215e14
BJ
23 int npf;
24 unsigned v;
25 register struct pte *pte;
19542281 26 int o, temp, reg;
3486ee81 27 static int lastreg = 128+64;
1e215e14 28
3486ee81
BJ
29 v = btop(io->i_ma);
30 o = (int)io->i_ma & PGOFSET;
31 npf = btoc(io->i_cc + o) +1;
19542281 32 if (bdp == 2) {
3486ee81
BJ
33 reg = lastreg;
34 lastreg += npf;
19542281
BJ
35 bdp = 0;
36 } else
37 reg = 0;
19542281 38 pte = &ubauba(io->i_unit)->uba_map[reg];
99fe9747 39 temp = (bdp << 21) | UBAMR_MRV;
1e215e14 40 if (bdp && (o & 01))
99fe9747 41 temp |= UBAMR_BO;
1e215e14
BJ
42 v &= 0x1fffff; /* drop to physical addr */
43 while (--npf != 0)
44 *(int *)pte++ = v++ | temp;
45 *(int *)pte++ = 0;
19542281 46 return ((bdp << 28) | (reg << 9) | o);
1e215e14
BJ
47}
48
99fe9747
BJ
49ubafree(io, mr)
50 struct iob *io;
1e215e14
BJ
51 int mr;
52{
99fe9747 53 register int bdp;
1e215e14
BJ
54
55 bdp = (mr >> 28) & 0x0f;
99fe9747
BJ
56 if (bdp == 0)
57 return;
58 switch (cpu) {
59
60 case VAX_780:
61 ubauba(io->i_unit)->uba_dpr[bdp] |= UBADPR_BNE;
62 break;
63
64 case VAX_750:
65 ubauba(io->i_unit)->uba_dpr[bdp] |=
66 UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE;
67 break;
b5d17f4d 68 case VAX_730:
19542281 69 break;
99fe9747 70 }
1e215e14 71}