1: /*
2: * Copyright (c) 1986 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)uba.h 1.2 (2.11BSD GTE) 1/3/93
7: */
8:
9: /*
10: * Structure to access UNIBUS map registers.
11: */
12:
13: struct ubmap {
14: short ub_lo;
15: short ub_hi;
16: };
17:
18: #ifdef UCB_METER
19: /*
20: * Structure for metering mapalloc performance.
21: */
22: struct ubmeter {
23: long ub_calls; /* total # of calls to mapalloc */
24: long ub_remaps; /* total # of buffer remappings */
25: long ub_fails; /* total # of allocation failures */
26: long ub_pages; /* total # of pages allocated */
27: };
28: #endif
29:
30: #define UBMAP ((struct ubmap *) 0170200)
31: #define UBPAGE 020000 /* size of UNIBUS map segment */
32:
33: /*
34: * BUF_UBADDR is the UNIBUS address of buffers
35: * if we have a UNIBUS map, as distinguished from bpaddr,
36: * which is the physical address in clicks.
37: */
38: #define BUF_UBADDR 020000
39:
40: /*
41: * Bytes to UNIBUS pages.
42: */
43: #define btoub(b) ((((long)(b)) + ((long)(UBPAGE - 1))) / ((long)UBPAGE))
44:
45: /*
46: * Number of UNIBUS registers required by n objects of size s.
47: */
48: #define nubreg(n,s) (((long) (n) * (long) (s) + \
49: ((long) (UBPAGE - 1))) / (long) UBPAGE)
50:
51: /*
52: * Set UNIBUS register r to point at physical address p (in bytes).
53: */
54: #define setubregno(r,p) { \
55: UBMAP[r].ub_lo = loint(p); \
56: UBMAP[r].ub_hi = hiint(p); \
57: }
58:
59: /*
60: * Point the appropriate UNIBUS register at a kernel
61: * virtual data address (in clicks). V must be less
62: * than btoc(248K).
63: */
64: #define pointubreg(v,sep) { ubadr_t x; \
65: short regno; \
66: regno = ((v) >> 7) & 037; \
67: x = (ubadr_t) (v) & ~01; \
68: UBMAP[regno].ub_lo = loint (x); \
69: UBMAP[regno].ub_hi = hiint (x); \
70: }
71:
72: #ifdef KERNEL
73: extern short ubmap; /* Do we have UNIBUS registers? */
74: extern memaddr bpaddr; /* physical click-address of buffers */
75: extern struct map ub_map[];
76: extern int ub_wantmr;
77: #endif
Defined struct's
ubmap
defined in line
13; used 26 times
Defined macros
UBMAP
defined in line
30; used 19 times
UBPAGE
defined in line
31; used 12 times
btoub
defined in line
43; used 5 times
Usage of this include