Commit | Line | Data |
---|---|---|
da7c5cc6 | 1 | /* |
0880b18e | 2 | * Copyright (c) 1982, 1986 Regents of the University of California. |
da7c5cc6 KM |
3 | * All rights reserved. The Berkeley software License Agreement |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
ea457f9f | 6 | * @(#)ubareg.h 7.3 (Berkeley) %G% |
da7c5cc6 | 7 | */ |
1cb3d36a BJ |
8 | |
9 | /* | |
63503d24 | 10 | * VAX UNIBUS adapter definitions |
1cb3d36a | 11 | */ |
bce08673 JB |
12 | |
13 | /* | |
63503d24 MK |
14 | * "UNIBUS" adaptor types. |
15 | * This code is used for both UNIBUSes and Q-buses | |
16 | * with different types of adaptors. | |
17 | * Definition of a type includes support code for that type. | |
bce08673 | 18 | */ |
63503d24 MK |
19 | #if VAX780 || VAX8600 |
20 | #define DW780 1 /* has adaptor regs, sr: 780/785/8600 */ | |
21 | #endif | |
22 | ||
23 | #if VAX750 | |
24 | #define DW750 2 /* has adaptor regs, no sr: 750, 730 */ | |
25 | #endif | |
26 | ||
27 | #if VAX730 | |
28 | #define DW730 3 /* has adaptor regs, no sr: 750, 730 */ | |
29 | #endif | |
30 | ||
31 | #if VAX630 | |
32 | #define QBA 4 /* 22-bit Q-bus, no adaptor regs: uVAX II */ | |
33 | #endif | |
34 | ||
35 | #if VAX8200 || VAX8500 || VAX8800 | |
36 | #define DWBUA 5 /* BI UNIBUS adaptor: 8200/8500/8800 */ | |
37 | #endif | |
bce08673 JB |
38 | |
39 | /* | |
63503d24 MK |
40 | * Size of unibus memory address space in pages |
41 | * (also number of map registers). | |
42 | * QBAPAGES should be 8192, but umem needs to be expanded. | |
bce08673 | 43 | */ |
63503d24 MK |
44 | #define UBAPAGES 496 |
45 | #define NUBMREG 496 | |
46 | #define QBAPAGES UBAPAGES /* for now; should be 8192 */ | |
ea457f9f | 47 | #define UBAIOADDR 0760000 /* start of I/O page */ |
63503d24 | 48 | #define UBAIOPAGES 16 |
bce08673 | 49 | |
b5fa1937 | 50 | #ifndef LOCORE |
1cb3d36a | 51 | /* |
63503d24 | 52 | * DW780/DW750 hardware registers |
1cb3d36a | 53 | */ |
1cb3d36a BJ |
54 | struct uba_regs |
55 | { | |
bbe0bf68 BJ |
56 | int uba_cnfgr; /* configuration register */ |
57 | int uba_cr; /* control register */ | |
58 | int uba_sr; /* status register */ | |
59 | int uba_dcr; /* diagnostic control register */ | |
60 | int uba_fmer; /* failed map entry register */ | |
61 | int uba_fubar; /* failed UNIBUS address register */ | |
1cb3d36a BJ |
62 | int pad1[2]; |
63 | int uba_brsvr[4]; | |
bbe0bf68 BJ |
64 | int uba_brrvr[4]; /* receive vector registers */ |
65 | int uba_dpr[16]; /* buffered data path register */ | |
1cb3d36a | 66 | int pad2[480]; |
63503d24 MK |
67 | struct pte uba_map[UBAPAGES]; /* unibus map register */ |
68 | int pad3[UBAIOPAGES]; /* no maps for device address space */ | |
10a50234 | 69 | }; |
b5fa1937 | 70 | #endif |
10a50234 | 71 | |
63503d24 | 72 | #ifdef DW780 |
4df4b0ef BJ |
73 | /* uba_cnfgr */ |
74 | #define UBACNFGR_UBINIT 0x00040000 /* unibus init asserted */ | |
75 | #define UBACNFGR_UBPDN 0x00020000 /* unibus power down */ | |
76 | #define UBACNFGR_UBIC 0x00010000 /* unibus init complete */ | |
77 | ||
44c2d30b MK |
78 | #define UBACNFGR_BITS \ |
79 | "\40\40PARFLT\37WSQFLT\36URDFLT\35ISQFLT\34MXTFLT\33XMTFLT\30ADPDN\27ADPUP\23UBINIT\22UBPDN\21UBIC" | |
80 | ||
4df4b0ef BJ |
81 | /* uba_cr */ |
82 | #define UBACR_MRD16 0x40000000 /* map reg disable bit 4 */ | |
83 | #define UBACR_MRD8 0x20000000 /* map reg disable bit 3 */ | |
84 | #define UBACR_MRD4 0x10000000 /* map reg disable bit 2 */ | |
85 | #define UBACR_MRD2 0x08000000 /* map reg disable bit 1 */ | |
86 | #define UBACR_MRD1 0x04000000 /* map reg disable bit 0 */ | |
87 | #define UBACR_IFS 0x00000040 /* interrupt field switch */ | |
88 | #define UBACR_BRIE 0x00000020 /* BR interrupt enable */ | |
89 | #define UBACR_USEFIE 0x00000010 /* UNIBUS to SBI error field IE */ | |
90 | #define UBACR_SUEFIE 0x00000008 /* SBI to UNIBUS error field IE */ | |
91 | #define UBACR_CNFIE 0x00000004 /* configuration IE */ | |
92 | #define UBACR_UPF 0x00000002 /* UNIBUS power fail */ | |
93 | #define UBACR_ADINIT 0x00000001 /* adapter init */ | |
10a50234 | 94 | |
4df4b0ef BJ |
95 | /* uba_sr */ |
96 | #define UBASR_BR7FULL 0x08000000 /* BR7 receive vector reg full */ | |
97 | #define UBASR_BR6FULL 0x04000000 /* BR6 receive vector reg full */ | |
98 | #define UBASR_BR5FULL 0x02000000 /* BR5 receive vector reg full */ | |
99 | #define UBASR_BR4FULL 0x01000000 /* BR4 receive vector reg full */ | |
100 | #define UBASR_RDTO 0x00000400 /* UNIBUS to SBI read data timeout */ | |
101 | #define UBASR_RDS 0x00000200 /* read data substitute */ | |
102 | #define UBASR_CRD 0x00000100 /* corrected read data */ | |
103 | #define UBASR_CXTER 0x00000080 /* command transmit error */ | |
104 | #define UBASR_CXTMO 0x00000040 /* command transmit timeout */ | |
105 | #define UBASR_DPPE 0x00000020 /* data path parity error */ | |
106 | #define UBASR_IVMR 0x00000010 /* invalid map register */ | |
107 | #define UBASR_MRPF 0x00000008 /* map register parity failure */ | |
108 | #define UBASR_LEB 0x00000004 /* lost error */ | |
109 | #define UBASR_UBSTO 0x00000002 /* UNIBUS select timeout */ | |
110 | #define UBASR_UBSSYNTO 0x00000001 /* UNIBUS slave sync timeout */ | |
f7c4179b BJ |
111 | |
112 | #define UBASR_BITS \ | |
113 | "\20\13RDTO\12RDS\11CRD\10CXTER\7CXTMO\6DPPE\5IVMR\4MRPF\3LEB\2UBSTO\1UBSSYNTO" | |
10a50234 | 114 | |
4df4b0ef BJ |
115 | /* uba_brrvr[] */ |
116 | #define UBABRRVR_AIRI 0x80000000 /* adapter interrupt request */ | |
117 | #define UBABRRVR_DIV 0x0000ffff /* device interrupt vector field */ | |
bce08673 | 118 | #endif |
10a50234 | 119 | |
4df4b0ef | 120 | /* uba_dpr */ |
63503d24 | 121 | #ifdef DW780 |
4df4b0ef BJ |
122 | #define UBADPR_BNE 0x80000000 /* buffer not empty - purge */ |
123 | #define UBADPR_BTE 0x40000000 /* buffer transfer error */ | |
124 | #define UBADPR_DPF 0x20000000 /* DP function (RO) */ | |
125 | #define UBADPR_BS 0x007f0000 /* buffer state field */ | |
126 | #define UBADPR_BUBA 0x0000ffff /* buffered UNIBUS address */ | |
b2fc55f0 BJ |
127 | #define UBA_PURGE780(uba, bdp) \ |
128 | ((uba)->uba_dpr[bdp] |= UBADPR_BNE) | |
bce08673 JB |
129 | #else |
130 | #define UBA_PURGE780(uba, bdp) | |
131 | #endif | |
63503d24 | 132 | #ifdef DW750 |
4df4b0ef BJ |
133 | #define UBADPR_ERROR 0x80000000 /* error occurred */ |
134 | #define UBADPR_NXM 0x40000000 /* nxm from memory */ | |
135 | #define UBADPR_UCE 0x20000000 /* uncorrectable error */ | |
136 | #define UBADPR_PURGE 0x00000001 /* purge bdp */ | |
3b1e560f SL |
137 | /* the DELAY is for a hardware problem */ |
138 | #define UBA_PURGE750(uba, bdp) { \ | |
139 | ((uba)->uba_dpr[bdp] |= (UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE)); \ | |
140 | DELAY(8); \ | |
141 | } | |
bce08673 JB |
142 | #else |
143 | #define UBA_PURGE750(uba, bdp) | |
144 | #endif | |
145 | ||
114cd253 BJ |
146 | /* |
147 | * Macros for fast buffered data path purging in time-critical routines. | |
148 | * | |
149 | * Too bad C pre-processor doesn't have the power of LISP in macro | |
150 | * expansion... | |
151 | */ | |
bce08673 | 152 | |
63503d24 | 153 | #if DW780 || DW750 |
114cd253 BJ |
154 | #define UBAPURGE(uba, bdp) { \ |
155 | switch (cpu) { \ | |
bce08673 | 156 | case VAX_8600: case VAX_780: UBA_PURGE780((uba), (bdp)); break; \ |
4c078bb2 | 157 | case VAX_750: UBA_PURGE750((uba), (bdp)); break; \ |
114cd253 BJ |
158 | } \ |
159 | } | |
63503d24 | 160 | #else |
23bd9454 | 161 | #define UBAPURGE(uba, bdp) |
114cd253 BJ |
162 | #endif |
163 | ||
bce08673 JB |
164 | |
165 | ||
4df4b0ef BJ |
166 | /* uba_mr[] */ |
167 | #define UBAMR_MRV 0x80000000 /* map register valid */ | |
168 | #define UBAMR_BO 0x02000000 /* byte offset bit */ | |
169 | #define UBAMR_DPDB 0x01e00000 /* data path designator field */ | |
170 | #define UBAMR_SBIPFN 0x000fffff /* SBI page address field */ | |
10a50234 | 171 | |
4df4b0ef | 172 | #define UBAMR_DPSHIFT 21 /* shift to data path designator */ |
10a50234 | 173 | |
10a50234 | 174 | /* |
4df4b0ef | 175 | * Number of unibus buffered data paths and possible uba's per cpu type. |
10a50234 | 176 | */ |
bce08673 | 177 | #define NBDP8600 15 |
63503d24 MK |
178 | #define NBDP780 15 |
179 | #define NBDP750 3 | |
180 | #define NBDP730 0 | |
181 | #define MAXNBDP 15 | |
10a50234 | 182 | |
10a50234 | 183 | /* |
bce08673 | 184 | * Symbolic BUS addresses for UBAs. |
10a50234 | 185 | */ |
bce08673 | 186 | |
9d2503c6 | 187 | #if VAX630 |
63503d24 MK |
188 | #define QBAMAP630 ((struct pte *)0x20088000) |
189 | #define QMEM630 0x30000000 | |
190 | #define QIOPAGE630 0x20000000 | |
191 | /* | |
192 | * Q-bus control registers | |
193 | */ | |
194 | #define QIPCR 0x1f40 /* from start of iopage */ | |
195 | /* bits in QIPCR */ | |
196 | #define Q_DBIRQ 0x0001 /* doorbell interrupt request */ | |
197 | #define Q_LMEAE 0x0020 /* local mem external access enable */ | |
198 | #define Q_DBIIE 0x0040 /* doorbell interrupt enable */ | |
199 | #define Q_AUXHLT 0x0100 /* auxiliary processor halt */ | |
200 | #define Q_DMAQPE 0x8000 /* Q22 bus address space parity error */ | |
9d2503c6 BK |
201 | #endif |
202 | ||
10f66600 | 203 | #if VAX730 |
63503d24 | 204 | #define UMEM730 0xfc0000 |
ea4d5e21 | 205 | #endif |
bce08673 | 206 | |
4df4b0ef | 207 | #if VAX750 |
63503d24 | 208 | #define UMEM750(i) (0xfc0000-(i)*0x40000) |
6531d33e | 209 | #endif |
bce08673 | 210 | |
6531d33e | 211 | #if VAX780 |
63503d24 | 212 | #define UMEM780(i) (0x20100000+(i)*0x40000) |
b5fa1937 | 213 | #endif |
62c8c966 | 214 | |
bce08673 | 215 | #if VAX8600 |
63503d24 MK |
216 | #define UMEMA8600(i) (0x20100000+(i)*0x40000) |
217 | #define UMEMB8600(i) (0x22100000+(i)*0x40000) | |
bce08673 JB |
218 | #endif |
219 | ||
62c8c966 BJ |
220 | /* |
221 | * Macro to offset a UNIBUS device address, often expressed as | |
63503d24 MK |
222 | * something like 0172520, by forcing it into the last 8K |
223 | * of UNIBUS memory space. | |
62c8c966 | 224 | */ |
63503d24 | 225 | #define ubdevreg(addr) ((addr) & 017777) |