123246Smckusick /* 2*35052Skarels * Copyright (c) 1982, 1986, 1988 Regents of the University of California. 323246Smckusick * All rights reserved. The Berkeley software License Agreement 423246Smckusick * specifies the terms and conditions for redistribution. 523246Smckusick * 6*35052Skarels * @(#)uba.c 7.4 (Berkeley) 07/09/88 723246Smckusick */ 8328Sbill 933408Skarels #include "param.h" 1033408Skarels #include "inode.h" 1133408Skarels #include "vm.h" 1233408Skarels #include "fs.h" 139186Ssam 14*35052Skarels #include "../vax/pte.h" 159186Ssam #include "../vax/cpu.h" 169186Ssam #include "../vaxuba/ubareg.h" 179186Ssam 18328Sbill #include "saio.h" 193263Swnj #include "savax.h" 20328Sbill 213345Swnj /* 223345Swnj * Note... this routine does not 233345Swnj * really allocate; unless bdp == 2 243345Swnj * you always get the same space. 253345Swnj * When bdp == 2 you get some other space. 263345Swnj */ 27328Sbill ubasetup(io, bdp) 283263Swnj register struct iob *io; 293263Swnj int bdp; 30328Sbill { 31328Sbill int npf; 3233532Sbostic unsigned int v; 33328Sbill register struct pte *pte; 343345Swnj int o, temp, reg; 354868Sroot static int lastreg = 128+64; 36328Sbill 374868Sroot v = btop(io->i_ma); 384868Sroot o = (int)io->i_ma & PGOFSET; 394868Sroot npf = btoc(io->i_cc + o) +1; 403345Swnj if (bdp == 2) { 414868Sroot reg = lastreg; 424868Sroot lastreg += npf; 433345Swnj bdp = 0; 443345Swnj } else 453345Swnj reg = 0; 4633532Sbostic pte = &ubauba(io->i_adapt)->uba_map[reg]; 473263Swnj temp = (bdp << 21) | UBAMR_MRV; 48328Sbill if (bdp && (o & 01)) 493263Swnj temp |= UBAMR_BO; 50328Sbill v &= 0x1fffff; /* drop to physical addr */ 51328Sbill while (--npf != 0) 52328Sbill *(int *)pte++ = v++ | temp; 53328Sbill *(int *)pte++ = 0; 543345Swnj return ((bdp << 28) | (reg << 9) | o); 55328Sbill } 56328Sbill 573263Swnj ubafree(io, mr) 583263Swnj struct iob *io; 59328Sbill int mr; 60328Sbill { 613263Swnj register int bdp; 62328Sbill 63328Sbill bdp = (mr >> 28) & 0x0f; 643263Swnj if (bdp == 0) 653263Swnj return; 663263Swnj switch (cpu) { 673263Swnj 6833408Skarels #if VAX8200 6933408Skarels case VAX_8200: 7033532Sbostic UBA_PURGEBUA(ubauba(io->i_adapt), bdp); 7133408Skarels break; 7233408Skarels #endif 7333408Skarels 74*35052Skarels #if VAX780 || VAX8600 7524154Sbloom case VAX_8600: 763263Swnj case VAX_780: 7733532Sbostic ubauba(io->i_adapt)->uba_dpr[bdp] |= UBADPR_BNE; 783263Swnj break; 79*35052Skarels #endif 803263Swnj 81*35052Skarels #if VAX750 823263Swnj case VAX_750: 8333532Sbostic ubauba(io->i_adapt)->uba_dpr[bdp] |= 843263Swnj UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE; 853263Swnj break; 86*35052Skarels #endif 8733408Skarels 8833408Skarels default: 893345Swnj break; 903263Swnj } 91328Sbill } 92