123246Smckusick /* 223246Smckusick * Copyright (c) 1982 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*24154Sbloom * @(#)uba.c 6.3 (Berkeley) 08/02/85 723246Smckusick */ 8328Sbill 99806Ssam #include "../machine/pte.h" 109806Ssam 11328Sbill #include "../h/param.h" 12328Sbill #include "../h/inode.h" 13328Sbill #include "../h/vm.h" 147447Sroot #include "../h/fs.h" 159186Ssam 169186Ssam #include "../vax/cpu.h" 179186Ssam #include "../vaxuba/ubareg.h" 189186Ssam 19328Sbill #include "saio.h" 203263Swnj #include "savax.h" 21328Sbill 223345Swnj /* 233345Swnj * Note... this routine does not 243345Swnj * really allocate; unless bdp == 2 253345Swnj * you always get the same space. 263345Swnj * When bdp == 2 you get some other space. 273345Swnj */ 28328Sbill ubasetup(io, bdp) 293263Swnj register struct iob *io; 303263Swnj int bdp; 31328Sbill { 32328Sbill int npf; 33328Sbill unsigned v; 34328Sbill register struct pte *pte; 353345Swnj int o, temp, reg; 364868Sroot static int lastreg = 128+64; 37328Sbill 384868Sroot v = btop(io->i_ma); 394868Sroot o = (int)io->i_ma & PGOFSET; 404868Sroot npf = btoc(io->i_cc + o) +1; 413345Swnj if (bdp == 2) { 424868Sroot reg = lastreg; 434868Sroot lastreg += npf; 443345Swnj bdp = 0; 453345Swnj } else 463345Swnj reg = 0; 473345Swnj pte = &ubauba(io->i_unit)->uba_map[reg]; 483263Swnj temp = (bdp << 21) | UBAMR_MRV; 49328Sbill if (bdp && (o & 01)) 503263Swnj temp |= UBAMR_BO; 51328Sbill v &= 0x1fffff; /* drop to physical addr */ 52328Sbill while (--npf != 0) 53328Sbill *(int *)pte++ = v++ | temp; 54328Sbill *(int *)pte++ = 0; 553345Swnj return ((bdp << 28) | (reg << 9) | o); 56328Sbill } 57328Sbill 583263Swnj ubafree(io, mr) 593263Swnj struct iob *io; 60328Sbill int mr; 61328Sbill { 623263Swnj register int bdp; 63328Sbill 64328Sbill bdp = (mr >> 28) & 0x0f; 653263Swnj if (bdp == 0) 663263Swnj return; 673263Swnj switch (cpu) { 683263Swnj 69*24154Sbloom case VAX_8600: 703263Swnj case VAX_780: 713263Swnj ubauba(io->i_unit)->uba_dpr[bdp] |= UBADPR_BNE; 723263Swnj break; 733263Swnj 743263Swnj case VAX_750: 753263Swnj ubauba(io->i_unit)->uba_dpr[bdp] |= 763263Swnj UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE; 773263Swnj break; 787447Sroot case VAX_730: 793345Swnj break; 803263Swnj } 81328Sbill } 82