1 /* 2 * Copyright (c) 1982, 1986, 1988 Regents of the University of California. 3 * All rights reserved. The Berkeley software License Agreement 4 * specifies the terms and conditions for redistribution. 5 * 6 * @(#)uba.c 7.4 (Berkeley) 07/09/88 7 */ 8 9 #include "param.h" 10 #include "inode.h" 11 #include "vm.h" 12 #include "fs.h" 13 14 #include "../vax/pte.h" 15 #include "../vax/cpu.h" 16 #include "../vaxuba/ubareg.h" 17 18 #include "saio.h" 19 #include "savax.h" 20 21 /* 22 * Note... this routine does not 23 * really allocate; unless bdp == 2 24 * you always get the same space. 25 * When bdp == 2 you get some other space. 26 */ 27 ubasetup(io, bdp) 28 register struct iob *io; 29 int bdp; 30 { 31 int npf; 32 unsigned int v; 33 register struct pte *pte; 34 int o, temp, reg; 35 static int lastreg = 128+64; 36 37 v = btop(io->i_ma); 38 o = (int)io->i_ma & PGOFSET; 39 npf = btoc(io->i_cc + o) +1; 40 if (bdp == 2) { 41 reg = lastreg; 42 lastreg += npf; 43 bdp = 0; 44 } else 45 reg = 0; 46 pte = &ubauba(io->i_adapt)->uba_map[reg]; 47 temp = (bdp << 21) | UBAMR_MRV; 48 if (bdp && (o & 01)) 49 temp |= UBAMR_BO; 50 v &= 0x1fffff; /* drop to physical addr */ 51 while (--npf != 0) 52 *(int *)pte++ = v++ | temp; 53 *(int *)pte++ = 0; 54 return ((bdp << 28) | (reg << 9) | o); 55 } 56 57 ubafree(io, mr) 58 struct iob *io; 59 int mr; 60 { 61 register int bdp; 62 63 bdp = (mr >> 28) & 0x0f; 64 if (bdp == 0) 65 return; 66 switch (cpu) { 67 68 #if VAX8200 69 case VAX_8200: 70 UBA_PURGEBUA(ubauba(io->i_adapt), bdp); 71 break; 72 #endif 73 74 #if VAX780 || VAX8600 75 case VAX_8600: 76 case VAX_780: 77 ubauba(io->i_adapt)->uba_dpr[bdp] |= UBADPR_BNE; 78 break; 79 #endif 80 81 #if VAX750 82 case VAX_750: 83 ubauba(io->i_adapt)->uba_dpr[bdp] |= 84 UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE; 85 break; 86 #endif 87 88 default: 89 break; 90 } 91 } 92