1
2
3
4
5
6
7
8
9
10
11
12#ifndef LINUX_NUBUS_H
13#define LINUX_NUBUS_H
14
15#include <linux/types.h>
16#ifdef __KERNEL__
17#include <asm/nubus.h>
18#endif
19
20enum nubus_category {
21 NUBUS_CAT_BOARD = 0x0001,
22 NUBUS_CAT_DISPLAY = 0x0003,
23 NUBUS_CAT_NETWORK = 0x0004,
24 NUBUS_CAT_COMMUNICATIONS = 0x0006,
25 NUBUS_CAT_FONT = 0x0009,
26 NUBUS_CAT_CPU = 0x000A,
27
28 NUBUS_CAT_DUODOCK = 0x0020
29};
30
31enum nubus_type_network {
32 NUBUS_TYPE_ETHERNET = 0x0001,
33 NUBUS_TYPE_RS232 = 0x0002
34};
35
36enum nubus_type_display {
37 NUBUS_TYPE_VIDEO = 0x0001
38};
39
40enum nubus_type_cpu {
41 NUBUS_TYPE_68020 = 0x0003,
42 NUBUS_TYPE_68030 = 0x0004,
43 NUBUS_TYPE_68040 = 0x0005
44};
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83enum nubus_drsw {
84
85 NUBUS_DRSW_APPLE = 0x0001,
86 NUBUS_DRSW_APPLE_HIRES = 0x0013,
87
88
89 NUBUS_DRSW_3COM = 0x0000,
90 NUBUS_DRSW_CABLETRON = 0x0001,
91 NUBUS_DRSW_SONIC_LC = 0x0001,
92 NUBUS_DRSW_KINETICS = 0x0103,
93 NUBUS_DRSW_ASANTE = 0x0104,
94 NUBUS_DRSW_TECHWORKS = 0x0109,
95 NUBUS_DRSW_DAYNA = 0x010b,
96 NUBUS_DRSW_FARALLON = 0x010c,
97 NUBUS_DRSW_APPLE_SN = 0x010f,
98 NUBUS_DRSW_DAYNA2 = 0x0115,
99 NUBUS_DRSW_FOCUS = 0x011a,
100 NUBUS_DRSW_ASANTE_CS = 0x011d,
101 NUBUS_DRSW_DAYNA_LC = 0x011e,
102
103
104 NUBUS_DRSW_NONE = 0x0000,
105};
106
107
108
109
110
111
112enum nubus_drhw {
113
114 NUBUS_DRHW_APPLE_TFB = 0x0001,
115 NUBUS_DRHW_APPLE_WVC = 0x0006,
116 NUBUS_DRHW_SIGMA_CLRMAX = 0x0007,
117 NUBUS_DRHW_APPLE_SE30 = 0x0009,
118 NUBUS_DRHW_APPLE_HRVC = 0x0013,
119 NUBUS_DRHW_APPLE_PVC = 0x0017,
120 NUBUS_DRHW_APPLE_RBV1 = 0x0018,
121 NUBUS_DRHW_APPLE_MDC = 0x0019,
122 NUBUS_DRHW_APPLE_SONORA = 0x0022,
123 NUBUS_DRHW_APPLE_24AC = 0x002b,
124 NUBUS_DRHW_APPLE_VALKYRIE = 0x002e,
125 NUBUS_DRHW_APPLE_JET = 0x0029,
126 NUBUS_DRHW_SMAC_GFX = 0x0105,
127 NUBUS_DRHW_RASTER_CB264 = 0x013B,
128 NUBUS_DRHW_MICRON_XCEED = 0x0146,
129 NUBUS_DRHW_RDIUS_GSC = 0x0153,
130 NUBUS_DRHW_SMAC_SPEC8 = 0x017B,
131 NUBUS_DRHW_SMAC_SPEC24 = 0x017C,
132 NUBUS_DRHW_RASTER_CB364 = 0x026F,
133 NUBUS_DRHW_RDIUS_DCGX = 0x027C,
134 NUBUS_DRHW_RDIUS_PC8 = 0x0291,
135 NUBUS_DRHW_LAPIS_PCS8 = 0x0292,
136 NUBUS_DRHW_RASTER_24XLI = 0x02A0,
137 NUBUS_DRHW_RASTER_PBPGT = 0x02A5,
138 NUBUS_DRHW_EMACH_FSX = 0x02AE,
139 NUBUS_DRHW_RASTER_24XLTV = 0x02B7,
140 NUBUS_DRHW_SMAC_THUND24 = 0x02CB,
141 NUBUS_DRHW_SMAC_THUNDLGHT = 0x03D9,
142 NUBUS_DRHW_RDIUS_PC24XP = 0x0406,
143 NUBUS_DRHW_RDIUS_PC24X = 0x040A,
144 NUBUS_DRHW_RDIUS_PC8XJ = 0x040B,
145
146
147 NUBUS_DRHW_INTERLAN = 0x0100,
148 NUBUS_DRHW_SMC9194 = 0x0101,
149 NUBUS_DRHW_KINETICS = 0x0106,
150 NUBUS_DRHW_CABLETRON = 0x0109,
151 NUBUS_DRHW_ASANTE_LC = 0x010f,
152 NUBUS_DRHW_SONIC = 0x0110,
153 NUBUS_DRHW_TECHWORKS = 0x0112,
154 NUBUS_DRHW_APPLE_SONIC_NB = 0x0118,
155 NUBUS_DRHW_APPLE_SONIC_LC = 0x0119,
156 NUBUS_DRHW_FOCUS = 0x011c,
157 NUBUS_DRHW_SONNET = 0x011d,
158};
159
160
161
162
163enum nubus_res_id {
164 NUBUS_RESID_TYPE = 0x0001,
165 NUBUS_RESID_NAME = 0x0002,
166 NUBUS_RESID_ICON = 0x0003,
167 NUBUS_RESID_DRVRDIR = 0x0004,
168 NUBUS_RESID_LOADREC = 0x0005,
169 NUBUS_RESID_BOOTREC = 0x0006,
170 NUBUS_RESID_FLAGS = 0x0007,
171 NUBUS_RESID_HWDEVID = 0x0008,
172 NUBUS_RESID_MINOR_BASEOS = 0x000a,
173 NUBUS_RESID_MINOR_LENGTH = 0x000b,
174 NUBUS_RESID_MAJOR_BASEOS = 0x000c,
175 NUBUS_RESID_MAJOR_LENGTH = 0x000d,
176 NUBUS_RESID_CICN = 0x000f,
177 NUBUS_RESID_ICL8 = 0x0010,
178 NUBUS_RESID_ICL4 = 0x0011,
179};
180
181
182enum nubus_board_res_id {
183 NUBUS_RESID_BOARDID = 0x0020,
184 NUBUS_RESID_PRAMINITDATA = 0x0021,
185 NUBUS_RESID_PRIMARYINIT = 0x0022,
186 NUBUS_RESID_TIMEOUTCONST = 0x0023,
187 NUBUS_RESID_VENDORINFO = 0x0024,
188 NUBUS_RESID_BOARDFLAGS = 0x0025,
189 NUBUS_RESID_SECONDINIT = 0x0026,
190
191
192 NUBUS_RESID_VIDNAMES = 0x0041,
193 NUBUS_RESID_VIDMODES = 0x007e
194};
195
196
197enum nubus_vendor_res_id {
198 NUBUS_RESID_VEND_ID = 0x0001,
199 NUBUS_RESID_VEND_SERIAL = 0x0002,
200 NUBUS_RESID_VEND_REV = 0x0003,
201 NUBUS_RESID_VEND_PART = 0x0004,
202 NUBUS_RESID_VEND_DATE = 0x0005
203};
204
205enum nubus_net_res_id {
206 NUBUS_RESID_MAC_ADDRESS = 0x0080
207};
208
209enum nubus_cpu_res_id {
210 NUBUS_RESID_MEMINFO = 0x0081,
211 NUBUS_RESID_ROMINFO = 0x0082
212};
213
214enum nubus_display_res_id {
215 NUBUS_RESID_GAMMADIR = 0x0040,
216 NUBUS_RESID_FIRSTMODE = 0x0080,
217 NUBUS_RESID_SECONDMODE = 0x0081,
218 NUBUS_RESID_THIRDMODE = 0x0082,
219 NUBUS_RESID_FOURTHMODE = 0x0083,
220 NUBUS_RESID_FIFTHMODE = 0x0084,
221 NUBUS_RESID_SIXTHMODE = 0x0085
222};
223
224struct nubus_dir
225{
226 unsigned char *base;
227 unsigned char *ptr;
228 int done;
229 int mask;
230};
231
232struct nubus_dirent
233{
234 unsigned char *base;
235 unsigned char type;
236 __u32 data;
237 int mask;
238};
239
240#ifdef __KERNEL__
241struct nubus_board {
242 struct nubus_board* next;
243 struct nubus_dev* first_dev;
244
245
246
247
248 int slot;
249
250 char name[64];
251
252
253 unsigned char* fblock;
254
255 unsigned char* directory;
256
257 unsigned long slot_addr;
258
259 unsigned long doffset;
260
261 unsigned long rom_length;
262
263 unsigned long crc;
264 unsigned char rev;
265 unsigned char format;
266 unsigned char lanes;
267};
268
269struct nubus_dev {
270
271 struct nubus_dev* next;
272
273 struct proc_dir_entry* procdir;
274
275
276 unsigned char resid;
277
278
279 unsigned short category;
280 unsigned short type;
281 unsigned short dr_sw;
282 unsigned short dr_hw;
283
284
285
286 char name[64];
287
288 unsigned char* driver;
289
290 unsigned long iobase;
291 unsigned long iosize;
292 unsigned char flags, hwdevid;
293
294
295 unsigned char* directory;
296
297 struct nubus_board* board;
298};
299
300
301extern struct nubus_dev* nubus_devices;
302
303extern struct nubus_board* nubus_boards;
304
305
306void nubus_scan_bus(void);
307extern void nubus_proc_init(void);
308int get_nubus_list(char *buf);
309int nubus_proc_attach_device(struct nubus_dev *dev);
310int nubus_proc_detach_device(struct nubus_dev *dev);
311
312struct nubus_dev* nubus_find_device(unsigned short category,
313 unsigned short type,
314 unsigned short dr_hw,
315 unsigned short dr_sw,
316 const struct nubus_dev* from);
317struct nubus_dev* nubus_find_type(unsigned short category,
318 unsigned short type,
319 const struct nubus_dev* from);
320
321struct nubus_dev* nubus_find_slot(unsigned int slot,
322 const struct nubus_dev* from);
323
324
325
326
327
328
329int nubus_get_root_dir(const struct nubus_board* board,
330 struct nubus_dir* dir);
331
332int nubus_get_board_dir(const struct nubus_board* board,
333 struct nubus_dir* dir);
334
335int nubus_get_func_dir(const struct nubus_dev* dev,
336 struct nubus_dir* dir);
337
338
339int nubus_readdir(struct nubus_dir* dir,
340 struct nubus_dirent* ent);
341int nubus_find_rsrc(struct nubus_dir* dir,
342 unsigned char rsrc_type,
343 struct nubus_dirent* ent);
344int nubus_rewinddir(struct nubus_dir* dir);
345
346
347int nubus_get_subdir(const struct nubus_dirent* ent,
348 struct nubus_dir* dir);
349void nubus_get_rsrc_mem(void* dest,
350 const struct nubus_dirent *dirent,
351 int len);
352void nubus_get_rsrc_str(void* dest,
353 const struct nubus_dirent *dirent,
354 int maxlen);
355#endif
356
357
358static inline void *nubus_slot_addr(int slot)
359{
360 return (void *)(0xF0000000|(slot<<24));
361}
362
363#endif
364