1*4868Sroot /* uba.c 4.5 81/11/12 */ 2328Sbill 3328Sbill #include "../h/param.h" 4328Sbill #include "../h/inode.h" 53263Swnj #include "../h/cpu.h" 6328Sbill #include "../h/pte.h" 73263Swnj #include "../h/ubareg.h" 8328Sbill #include "../h/vm.h" 9328Sbill #include "saio.h" 103263Swnj #include "savax.h" 11328Sbill 123345Swnj /* 133345Swnj * Note... this routine does not 143345Swnj * really allocate; unless bdp == 2 153345Swnj * you always get the same space. 163345Swnj * When bdp == 2 you get some other space. 173345Swnj */ 18328Sbill ubasetup(io, bdp) 193263Swnj register struct iob *io; 203263Swnj int bdp; 21328Sbill { 22328Sbill int npf; 23328Sbill unsigned v; 24328Sbill register struct pte *pte; 253345Swnj int o, temp, reg; 26*4868Sroot static int lastreg = 128+64; 27328Sbill 28*4868Sroot v = btop(io->i_ma); 29*4868Sroot o = (int)io->i_ma & PGOFSET; 30*4868Sroot npf = btoc(io->i_cc + o) +1; 313345Swnj if (bdp == 2) { 32*4868Sroot reg = lastreg; 33*4868Sroot lastreg += npf; 343345Swnj bdp = 0; 353345Swnj } else 363345Swnj reg = 0; 373345Swnj pte = &ubauba(io->i_unit)->uba_map[reg]; 383263Swnj temp = (bdp << 21) | UBAMR_MRV; 39328Sbill if (bdp && (o & 01)) 403263Swnj temp |= UBAMR_BO; 41328Sbill v &= 0x1fffff; /* drop to physical addr */ 42328Sbill while (--npf != 0) 43328Sbill *(int *)pte++ = v++ | temp; 44328Sbill *(int *)pte++ = 0; 453345Swnj return ((bdp << 28) | (reg << 9) | o); 46328Sbill } 47328Sbill 483263Swnj ubafree(io, mr) 493263Swnj struct iob *io; 50328Sbill int mr; 51328Sbill { 523263Swnj register int bdp; 53328Sbill 54328Sbill bdp = (mr >> 28) & 0x0f; 553263Swnj if (bdp == 0) 563263Swnj return; 573263Swnj switch (cpu) { 583263Swnj 593263Swnj case VAX_780: 603263Swnj ubauba(io->i_unit)->uba_dpr[bdp] |= UBADPR_BNE; 613263Swnj break; 623263Swnj 633263Swnj case VAX_750: 643263Swnj ubauba(io->i_unit)->uba_dpr[bdp] |= 653263Swnj UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE; 663263Swnj break; 673471Sroot case VAX_7ZZ: 683345Swnj break; 693263Swnj } 70328Sbill } 71