* Allocate as many contiguous UBA mapping registers
* as are necessary to do transfer of bcnt bytes
* to/from location baddr. Wait for enough map registers.
* Bdpflg is non-zero if a "buffered data path" (BDP) is
* to be used, else 0 -> use direct data path (DDP). Return
* Bits 9-17 Start map reg. no.
* Bits 18-27 No. mapping reg's
register struct pte
*pte
, *io
;
v
= btop(bp
->b_un
.b_addr
);
o
= (int)bp
->b_un
.b_addr
& PGOFSET
;
npf
= btoc(bp
->b_bcount
+ o
) + 1;
while ((reg
= malloc(ubamap
, npf
)) == 0) {
panic("ran out of uba map");
sleep((caddr_t
)ubamap
, PSWP
);
while ((bdp
= malloc(bdpmap
, 1)) == 0) {
panic("ran out of bdp's");
sleep((caddr_t
)bdpmap
, PSWP
);
ubinfo
= (bdp
<< 28) | (npf
<< 18) | (reg
<< 9) | o
;
io
= &(((struct uba_regs
*)UBA0
)->uba_map
[reg
]);
temp
= (bdp
<< 21) | MRV
;
rp
= bp
->b_flags
&B_DIRTY
? &proc
[2] : bp
->b_proc
;
if (bp
->b_flags
& B_UAREA
) {
for (i
= UPAGES
- bp
->b_bcount
/ NBPG
; i
< UPAGES
; i
++) {
if (rp
->p_addr
[i
].pg_pfnum
== 0)
panic("uba: zero upage");
*(int *)io
++ = rp
->p_addr
[i
].pg_pfnum
| temp
;
} else if ((bp
->b_flags
& B_PHYS
) == 0) {
pte
= &Sysmap
[btop(((int)bp
->b_un
.b_addr
)&0x7fffffff)];
*(int *)io
++ = pte
++->pg_pfnum
| temp
;
if (bp
->b_flags
& B_PAGET
)
pte
= &Usrptmap
[btokmx((struct pte
*)bp
->b_un
.b_addr
)];
panic("uba zero uentry");
*(int *)io
++ = pte
++->pg_pfnum
| temp
;
* Non buffer unibus interface... set up a buffer and call ubasetup.
uballoc(addr
, bcnt
, bdpflg
)
ubabuf
.b_un
.b_addr
= addr
;
/* that's all the fields ubasetup() needs */
return (ubasetup(&ubabuf
, bdpflg
));
* Old ubafree(info) is now ubarelse(&info) to avoid races.
register int bdp
, reg
, npf
, a
;
((struct uba_regs
*)UBA0
)->uba_dpr
[bdp
] |= BNE
; /* purge */
npf
= (mr
>> 18) & 0x3ff;
reg
= ((mr
>> 9) & 0x1ff) + 1;
mfree(bdpmap
, NUBABDP
, 1);
#define DELAY(N) { register int d; d = N; while (--d > 0); }
struct uba_regs
*up
= (struct uba_regs
*)UBA0
;
register struct cdevsw
*cdp
;
up
->uba_cr
= IFS
|BRIE
|USEFIE
|SUEFIE
;
while ((up
->uba_cnfgr
& UBIC
) == 0)
for (cdp
= cdevsw
; cdp
->d_open
; cdp
++)