1*9806Ssam /* uba.c 4.8 82/12/17 */ 2328Sbill 3*9806Ssam #include "../machine/pte.h" 4*9806Ssam 5328Sbill #include "../h/param.h" 6328Sbill #include "../h/inode.h" 7328Sbill #include "../h/vm.h" 87447Sroot #include "../h/fs.h" 99186Ssam 109186Ssam #include "../vax/cpu.h" 119186Ssam #include "../vaxuba/ubareg.h" 129186Ssam 13328Sbill #include "saio.h" 143263Swnj #include "savax.h" 15328Sbill 163345Swnj /* 173345Swnj * Note... this routine does not 183345Swnj * really allocate; unless bdp == 2 193345Swnj * you always get the same space. 203345Swnj * When bdp == 2 you get some other space. 213345Swnj */ 22328Sbill ubasetup(io, bdp) 233263Swnj register struct iob *io; 243263Swnj int bdp; 25328Sbill { 26328Sbill int npf; 27328Sbill unsigned v; 28328Sbill register struct pte *pte; 293345Swnj int o, temp, reg; 304868Sroot static int lastreg = 128+64; 31328Sbill 324868Sroot v = btop(io->i_ma); 334868Sroot o = (int)io->i_ma & PGOFSET; 344868Sroot npf = btoc(io->i_cc + o) +1; 353345Swnj if (bdp == 2) { 364868Sroot reg = lastreg; 374868Sroot lastreg += npf; 383345Swnj bdp = 0; 393345Swnj } else 403345Swnj reg = 0; 413345Swnj pte = &ubauba(io->i_unit)->uba_map[reg]; 423263Swnj temp = (bdp << 21) | UBAMR_MRV; 43328Sbill if (bdp && (o & 01)) 443263Swnj temp |= UBAMR_BO; 45328Sbill v &= 0x1fffff; /* drop to physical addr */ 46328Sbill while (--npf != 0) 47328Sbill *(int *)pte++ = v++ | temp; 48328Sbill *(int *)pte++ = 0; 493345Swnj return ((bdp << 28) | (reg << 9) | o); 50328Sbill } 51328Sbill 523263Swnj ubafree(io, mr) 533263Swnj struct iob *io; 54328Sbill int mr; 55328Sbill { 563263Swnj register int bdp; 57328Sbill 58328Sbill bdp = (mr >> 28) & 0x0f; 593263Swnj if (bdp == 0) 603263Swnj return; 613263Swnj switch (cpu) { 623263Swnj 633263Swnj case VAX_780: 643263Swnj ubauba(io->i_unit)->uba_dpr[bdp] |= UBADPR_BNE; 653263Swnj break; 663263Swnj 673263Swnj case VAX_750: 683263Swnj ubauba(io->i_unit)->uba_dpr[bdp] |= 693263Swnj UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE; 703263Swnj break; 717447Sroot case VAX_730: 723345Swnj break; 733263Swnj } 74328Sbill } 75