1*3345Swnj /* uba.c 4.3 81/03/21 */ 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 12*3345Swnj /* 13*3345Swnj * Note... this routine does not 14*3345Swnj * really allocate; unless bdp == 2 15*3345Swnj * you always get the same space. 16*3345Swnj * When bdp == 2 you get some other space. 17*3345Swnj */ 18328Sbill ubasetup(io, bdp) 193263Swnj register struct iob *io; 203263Swnj int bdp; 21328Sbill { 22328Sbill int npf; 23328Sbill unsigned v; 24328Sbill register struct pte *pte; 25*3345Swnj int o, temp, reg; 26328Sbill 27*3345Swnj if (bdp == 2) { 28*3345Swnj reg = 128+64; /* for stupid ts-11 */ 29*3345Swnj bdp = 0; 30*3345Swnj } else 31*3345Swnj reg = 0; 32328Sbill v = btop(io->i_ma); 33328Sbill o = (int)io->i_ma & PGOFSET; 34328Sbill npf = btoc(io->i_cc + o) +1; 35*3345Swnj pte = &ubauba(io->i_unit)->uba_map[reg]; 363263Swnj temp = (bdp << 21) | UBAMR_MRV; 37328Sbill if (bdp && (o & 01)) 383263Swnj temp |= UBAMR_BO; 39328Sbill v &= 0x1fffff; /* drop to physical addr */ 40328Sbill while (--npf != 0) 41328Sbill *(int *)pte++ = v++ | temp; 42328Sbill *(int *)pte++ = 0; 43*3345Swnj return ((bdp << 28) | (reg << 9) | o); 44328Sbill } 45328Sbill 463263Swnj ubafree(io, mr) 473263Swnj struct iob *io; 48328Sbill int mr; 49328Sbill { 503263Swnj register int bdp; 51328Sbill 52328Sbill bdp = (mr >> 28) & 0x0f; 533263Swnj if (bdp == 0) 543263Swnj return; 553263Swnj switch (cpu) { 563263Swnj 573263Swnj case VAX_780: 583263Swnj ubauba(io->i_unit)->uba_dpr[bdp] |= UBADPR_BNE; 593263Swnj break; 603263Swnj 613263Swnj case VAX_750: 623263Swnj ubauba(io->i_unit)->uba_dpr[bdp] |= 633263Swnj UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE; 643263Swnj break; 65*3345Swnj case VAX_730: 66*3345Swnj break; 673263Swnj } 68328Sbill } 69