xref: /csrg-svn/sys/vax/stand/uba.c (revision 3471)
1*3471Sroot /*	uba.c	4.4	81/04/03	*/
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;
26328Sbill 
273345Swnj 	if (bdp == 2) {
283345Swnj 		reg = 128+64;		/* for stupid ts-11 */
293345Swnj 		bdp = 0;
303345Swnj 	} else
313345Swnj 		reg = 0;
32328Sbill 	v = btop(io->i_ma);
33328Sbill 	o = (int)io->i_ma & PGOFSET;
34328Sbill 	npf = btoc(io->i_cc + o) +1;
353345Swnj 	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;
433345Swnj 	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*3471Sroot 	case VAX_7ZZ:
663345Swnj 		break;
673263Swnj 	}
68328Sbill }
69