1 |
1275 |
phoenix |
/*
|
2 |
|
|
nubus.h: various definitions and prototypes for NuBus drivers to use.
|
3 |
|
|
|
4 |
|
|
Originally written by Alan Cox.
|
5 |
|
|
|
6 |
|
|
Hacked to death by C. Scott Ananian and David Huggins-Daines.
|
7 |
|
|
|
8 |
|
|
Some of the constants in here are from the corresponding
|
9 |
|
|
NetBSD/OpenBSD header file, by Allen Briggs. We figured out the
|
10 |
|
|
rest of them on our own. */
|
11 |
|
|
|
12 |
|
|
#ifndef LINUX_NUBUS_H
|
13 |
|
|
#define LINUX_NUBUS_H
|
14 |
|
|
|
15 |
|
|
#ifdef __KERNEL__
|
16 |
|
|
#include <asm/nubus.h>
|
17 |
|
|
#endif
|
18 |
|
|
|
19 |
|
|
enum nubus_category {
|
20 |
|
|
NUBUS_CAT_BOARD = 0x0001,
|
21 |
|
|
NUBUS_CAT_DISPLAY = 0x0003,
|
22 |
|
|
NUBUS_CAT_NETWORK = 0x0004,
|
23 |
|
|
NUBUS_CAT_COMMUNICATIONS = 0x0006,
|
24 |
|
|
NUBUS_CAT_FONT = 0x0009,
|
25 |
|
|
NUBUS_CAT_CPU = 0x000A,
|
26 |
|
|
/* For lack of a better name */
|
27 |
|
|
NUBUS_CAT_DUODOCK = 0x0020
|
28 |
|
|
};
|
29 |
|
|
|
30 |
|
|
enum nubus_type_network {
|
31 |
|
|
NUBUS_TYPE_ETHERNET = 0x0001,
|
32 |
|
|
NUBUS_TYPE_RS232 = 0x0002
|
33 |
|
|
};
|
34 |
|
|
|
35 |
|
|
enum nubus_type_display {
|
36 |
|
|
NUBUS_TYPE_VIDEO = 0x0001
|
37 |
|
|
};
|
38 |
|
|
|
39 |
|
|
enum nubus_type_cpu {
|
40 |
|
|
NUBUS_TYPE_68020 = 0x0003,
|
41 |
|
|
NUBUS_TYPE_68030 = 0x0004,
|
42 |
|
|
NUBUS_TYPE_68040 = 0x0005
|
43 |
|
|
};
|
44 |
|
|
|
45 |
|
|
/* Known <Cat,Type,SW,HW> tuples: (according to TattleTech and Slots)
|
46 |
|
|
* 68030 motherboards: <10,4,0,24>
|
47 |
|
|
* 68040 motherboards: <10,5,0,24>
|
48 |
|
|
* DuoDock Plus: <32,1,1,2>
|
49 |
|
|
*
|
50 |
|
|
* Toby Frame Buffer card: <3,1,1,1>
|
51 |
|
|
* RBV built-in video (IIci): <3,1,1,24>
|
52 |
|
|
* Valkyrie built-in video (Q630): <3,1,1,46>
|
53 |
|
|
* Macintosh Display Card: <3,1,1,25>
|
54 |
|
|
* Sonora built-in video (P460): <3,1,1,34>
|
55 |
|
|
* Jet framebuffer (DuoDock Plus): <3,1,1,41>
|
56 |
|
|
*
|
57 |
|
|
* SONIC comm-slot/on-board and DuoDock Ethernet: <4,1,1,272>
|
58 |
|
|
* SONIC LC-PDS Ethernet (Dayna, but like Apple 16-bit, sort of): <4,1,1,271>
|
59 |
|
|
* Sonic Systems Ethernet A-Series Card: <4,1,268,256>
|
60 |
|
|
* Asante MacCon NuBus-A: <4,1,260,256> (alpha-1.0,1.1 revision)
|
61 |
|
|
* ROM on the above card: <2,1,0,0>
|
62 |
|
|
* Cabletron ethernet card: <4,1,1,265>
|
63 |
|
|
* Farallon ethernet card: <4,1,268,256> (identical to Sonic Systems card)
|
64 |
|
|
* Kinetics EtherPort IIN: <4,1,259,262>
|
65 |
|
|
* API Engineering EtherRun_LCa PDS enet card: <4,1,282,256>
|
66 |
|
|
*
|
67 |
|
|
* Add your devices to the list! You can obtain the "Slots" utility
|
68 |
|
|
* from Apple's FTP site at:
|
69 |
|
|
* ftp://dev.apple.com/devworld/Tool_Chest/Devices_-_Hardware/NuBus_Slot_Manager/
|
70 |
|
|
*
|
71 |
|
|
* Alternately, TattleTech can be found at any Info-Mac mirror site.
|
72 |
|
|
* or from its distribution site: ftp://ftp.decismkr.com/dms
|
73 |
|
|
*/
|
74 |
|
|
|
75 |
|
|
/* DrSW: Uniquely identifies the software interface to a board. This
|
76 |
|
|
is usually the one you want to look at when writing a driver. It's
|
77 |
|
|
not as useful as you think, though, because as we should know by
|
78 |
|
|
now (duh), "Apple Compatible" can mean a lot of things... */
|
79 |
|
|
|
80 |
|
|
/* Add known DrSW values here */
|
81 |
|
|
enum nubus_drsw {
|
82 |
|
|
/* NUBUS_CAT_DISPLAY */
|
83 |
|
|
NUBUS_DRSW_APPLE = 0x0001,
|
84 |
|
|
NUBUS_DRSW_APPLE_HIRES = 0x0013, /* MacII HiRes card driver */
|
85 |
|
|
|
86 |
|
|
/* NUBUS_CAT_NETWORK */
|
87 |
|
|
NUBUS_DRSW_CABLETRON = 0x0001,
|
88 |
|
|
NUBUS_DRSW_SONIC_LC = 0x0001,
|
89 |
|
|
NUBUS_DRSW_KINETICS = 0x0103,
|
90 |
|
|
NUBUS_DRSW_ASANTE = 0x0104,
|
91 |
|
|
NUBUS_DRSW_DAYNA = 0x010b,
|
92 |
|
|
NUBUS_DRSW_FARALLON = 0x010c,
|
93 |
|
|
NUBUS_DRSW_APPLE_SN = 0x010f,
|
94 |
|
|
NUBUS_DRSW_DAYNA2 = 0x0115,
|
95 |
|
|
NUBUS_DRSW_FOCUS = 0x011a,
|
96 |
|
|
NUBUS_DRSW_ASANTE_CS = 0x011d, /* use asante SMC9194 driver */
|
97 |
|
|
NUBUS_DRSW_DAYNA_LC = 0x011e,
|
98 |
|
|
|
99 |
|
|
/* NUBUS_CAT_CPU */
|
100 |
|
|
NUBUS_DRSW_NONE = 0x0000,
|
101 |
|
|
};
|
102 |
|
|
|
103 |
|
|
/* DrHW: Uniquely identifies the hardware interface to a board (or at
|
104 |
|
|
least, it should... some video cards are known to incorrectly
|
105 |
|
|
identify themselves as Toby cards) */
|
106 |
|
|
|
107 |
|
|
/* Add known DrHW values here */
|
108 |
|
|
enum nubus_drhw {
|
109 |
|
|
/* NUBUS_CAT_DISPLAY */
|
110 |
|
|
NUBUS_DRHW_APPLE_TFB = 0x0001, /* Toby frame buffer card */
|
111 |
|
|
NUBUS_DRHW_APPLE_HRVC = 0x0013, /* Mac II High Res Video card */
|
112 |
|
|
NUBUS_DRHW_APPLE_RBV1 = 0x0018, /* IIci RBV video */
|
113 |
|
|
NUBUS_DRHW_APPLE_MDC = 0x0019, /* Macintosh Display Card */
|
114 |
|
|
NUBUS_DRHW_APPLE_SONORA = 0x0022, /* Sonora built-in video */
|
115 |
|
|
NUBUS_DRHW_APPLE_JET = 0x0029, /* Jet framebuffer (DuoDock) */
|
116 |
|
|
NUBUS_DRHW_APPLE_VALKYRIE = 0x002e,
|
117 |
|
|
NUBUS_DRHW_THUNDER24 = 0x02cb, /* SuperMac Thunder/24 */
|
118 |
|
|
|
119 |
|
|
/* NUBUS_CAT_NETWORK */
|
120 |
|
|
NUBUS_DRHW_INTERLAN = 0x0100,
|
121 |
|
|
NUBUS_DRHW_SMC9194 = 0x0101,
|
122 |
|
|
NUBUS_DRHW_KINETICS = 0x0106,
|
123 |
|
|
NUBUS_DRHW_CABLETRON = 0x0109,
|
124 |
|
|
NUBUS_DRHW_ASANTE_LC = 0x010f,
|
125 |
|
|
NUBUS_DRHW_SONIC = 0x0110,
|
126 |
|
|
NUBUS_DRHW_SONIC_NB = 0x0118,
|
127 |
|
|
NUBUS_DRHW_SONIC_LC = 0x0119,
|
128 |
|
|
|
129 |
|
|
/* NUBUS_CAT_COMMUNICATIONS */
|
130 |
|
|
NUBUS_DRHW_DOVEFAX = 0x0100,
|
131 |
|
|
};
|
132 |
|
|
|
133 |
|
|
/* Resource IDs: These are the identifiers for the various weird and
|
134 |
|
|
wonderful tidbits of information that may or may not reside in the
|
135 |
|
|
NuBus ROM directory. */
|
136 |
|
|
enum nubus_res_id {
|
137 |
|
|
NUBUS_RESID_TYPE = 0x0001,
|
138 |
|
|
NUBUS_RESID_NAME = 0x0002,
|
139 |
|
|
NUBUS_RESID_ICON = 0x0003,
|
140 |
|
|
NUBUS_RESID_DRVRDIR = 0x0004,
|
141 |
|
|
NUBUS_RESID_LOADREC = 0x0005,
|
142 |
|
|
NUBUS_RESID_BOOTREC = 0x0006,
|
143 |
|
|
NUBUS_RESID_FLAGS = 0x0007,
|
144 |
|
|
NUBUS_RESID_HWDEVID = 0x0008,
|
145 |
|
|
NUBUS_RESID_MINOR_BASEOS = 0x000a,
|
146 |
|
|
NUBUS_RESID_MINOR_LENGTH = 0x000b,
|
147 |
|
|
NUBUS_RESID_MAJOR_BASEOS = 0x000c,
|
148 |
|
|
NUBUS_RESID_MAJOR_LENGTH = 0x000d,
|
149 |
|
|
NUBUS_RESID_CICN = 0x000f,
|
150 |
|
|
NUBUS_RESID_ICL8 = 0x0010,
|
151 |
|
|
NUBUS_RESID_ICL4 = 0x0011,
|
152 |
|
|
};
|
153 |
|
|
|
154 |
|
|
/* Category-specific resources. */
|
155 |
|
|
enum nubus_board_res_id {
|
156 |
|
|
NUBUS_RESID_BOARDID = 0x0020,
|
157 |
|
|
NUBUS_RESID_PRAMINITDATA = 0x0021,
|
158 |
|
|
NUBUS_RESID_PRIMARYINIT = 0x0022,
|
159 |
|
|
NUBUS_RESID_TIMEOUTCONST = 0x0023,
|
160 |
|
|
NUBUS_RESID_VENDORINFO = 0x0024,
|
161 |
|
|
NUBUS_RESID_BOARDFLAGS = 0x0025,
|
162 |
|
|
NUBUS_RESID_SECONDINIT = 0x0026,
|
163 |
|
|
|
164 |
|
|
/* Not sure why Apple put these next two in here */
|
165 |
|
|
NUBUS_RESID_VIDNAMES = 0x0041,
|
166 |
|
|
NUBUS_RESID_VIDMODES = 0x007e
|
167 |
|
|
};
|
168 |
|
|
|
169 |
|
|
/* Fields within the vendor info directory */
|
170 |
|
|
enum nubus_vendor_res_id {
|
171 |
|
|
NUBUS_RESID_VEND_ID = 0x0001,
|
172 |
|
|
NUBUS_RESID_VEND_SERIAL = 0x0002,
|
173 |
|
|
NUBUS_RESID_VEND_REV = 0x0003,
|
174 |
|
|
NUBUS_RESID_VEND_PART = 0x0004,
|
175 |
|
|
NUBUS_RESID_VEND_DATE = 0x0005
|
176 |
|
|
};
|
177 |
|
|
|
178 |
|
|
enum nubus_net_res_id {
|
179 |
|
|
NUBUS_RESID_MAC_ADDRESS = 0x0080
|
180 |
|
|
};
|
181 |
|
|
|
182 |
|
|
enum nubus_cpu_res_id {
|
183 |
|
|
NUBUS_RESID_MEMINFO = 0x0081,
|
184 |
|
|
NUBUS_RESID_ROMINFO = 0x0082
|
185 |
|
|
};
|
186 |
|
|
|
187 |
|
|
enum nubus_display_res_id {
|
188 |
|
|
NUBUS_RESID_GAMMADIR = 0x0040,
|
189 |
|
|
NUBUS_RESID_FIRSTMODE = 0x0080,
|
190 |
|
|
NUBUS_RESID_SECONDMODE = 0x0081,
|
191 |
|
|
NUBUS_RESID_THIRDMODE = 0x0082,
|
192 |
|
|
NUBUS_RESID_FOURTHMODE = 0x0083,
|
193 |
|
|
NUBUS_RESID_FIFTHMODE = 0x0084,
|
194 |
|
|
NUBUS_RESID_SIXTHMODE = 0x0085
|
195 |
|
|
};
|
196 |
|
|
|
197 |
|
|
struct nubus_dir
|
198 |
|
|
{
|
199 |
|
|
unsigned char *base;
|
200 |
|
|
unsigned char *ptr;
|
201 |
|
|
int done;
|
202 |
|
|
int mask;
|
203 |
|
|
};
|
204 |
|
|
|
205 |
|
|
struct nubus_dirent
|
206 |
|
|
{
|
207 |
|
|
unsigned char *base;
|
208 |
|
|
unsigned char type;
|
209 |
|
|
__u32 data; /* Actually 24bits used */
|
210 |
|
|
int mask;
|
211 |
|
|
};
|
212 |
|
|
|
213 |
|
|
struct nubus_board {
|
214 |
|
|
struct nubus_board* next;
|
215 |
|
|
struct nubus_dev* first_dev;
|
216 |
|
|
|
217 |
|
|
/* Only 9-E actually exist, though 0-8 are also theoretically
|
218 |
|
|
possible, and 0 is a special case which represents the
|
219 |
|
|
motherboard and onboard peripherals (Ethernet, video) */
|
220 |
|
|
int slot;
|
221 |
|
|
/* For slot 0, this is bogus. */
|
222 |
|
|
char name[64];
|
223 |
|
|
|
224 |
|
|
/* Format block */
|
225 |
|
|
unsigned char* fblock;
|
226 |
|
|
/* Root directory (does *not* always equal fblock + doffset!) */
|
227 |
|
|
unsigned char* directory;
|
228 |
|
|
|
229 |
|
|
unsigned long slot_addr;
|
230 |
|
|
/* Offset to root directory (sometimes) */
|
231 |
|
|
unsigned long doffset;
|
232 |
|
|
/* Length over which to compute the crc */
|
233 |
|
|
unsigned long rom_length;
|
234 |
|
|
/* Completely useless most of the time */
|
235 |
|
|
unsigned long crc;
|
236 |
|
|
unsigned char rev;
|
237 |
|
|
unsigned char format;
|
238 |
|
|
unsigned char lanes;
|
239 |
|
|
};
|
240 |
|
|
|
241 |
|
|
struct nubus_dev {
|
242 |
|
|
/* Next link in device list */
|
243 |
|
|
struct nubus_dev* next;
|
244 |
|
|
/* Directory entry in /proc/bus/nubus */
|
245 |
|
|
struct proc_dir_entry* procdir;
|
246 |
|
|
|
247 |
|
|
/* The functional resource ID of this device */
|
248 |
|
|
unsigned char resid;
|
249 |
|
|
/* These are mostly here for convenience; we could always read
|
250 |
|
|
them from the ROMs if we wanted to */
|
251 |
|
|
unsigned short category;
|
252 |
|
|
unsigned short type;
|
253 |
|
|
unsigned short dr_sw;
|
254 |
|
|
unsigned short dr_hw;
|
255 |
|
|
/* This is the device's name rather than the board's.
|
256 |
|
|
Sometimes they are different. Usually the board name is
|
257 |
|
|
more correct. */
|
258 |
|
|
char name[64];
|
259 |
|
|
/* MacOS driver (I kid you not) */
|
260 |
|
|
unsigned char* driver;
|
261 |
|
|
/* Actually this is an offset */
|
262 |
|
|
unsigned long iobase;
|
263 |
|
|
unsigned long iosize;
|
264 |
|
|
unsigned char flags, hwdevid;
|
265 |
|
|
|
266 |
|
|
/* Functional directory */
|
267 |
|
|
unsigned char* directory;
|
268 |
|
|
/* Much of our info comes from here */
|
269 |
|
|
struct nubus_board* board;
|
270 |
|
|
};
|
271 |
|
|
|
272 |
|
|
/* This is all NuBus devices (used to find devices later on) */
|
273 |
|
|
extern struct nubus_dev* nubus_devices;
|
274 |
|
|
/* This is all NuBus cards */
|
275 |
|
|
extern struct nubus_board* nubus_boards;
|
276 |
|
|
|
277 |
|
|
/* Generic NuBus interface functions, modelled after the PCI interface */
|
278 |
|
|
extern void nubus_init(void);
|
279 |
|
|
void nubus_scan_bus(void);
|
280 |
|
|
extern void nubus_proc_init(void);
|
281 |
|
|
int get_nubus_list(char *buf);
|
282 |
|
|
int nubus_proc_attach_device(struct nubus_dev *dev);
|
283 |
|
|
int nubus_proc_detach_device(struct nubus_dev *dev);
|
284 |
|
|
/* If we need more precision we can add some more of these */
|
285 |
|
|
struct nubus_dev* nubus_find_device(unsigned short category,
|
286 |
|
|
unsigned short type,
|
287 |
|
|
unsigned short dr_hw,
|
288 |
|
|
unsigned short dr_sw,
|
289 |
|
|
const struct nubus_dev* from);
|
290 |
|
|
struct nubus_dev* nubus_find_type(unsigned short category,
|
291 |
|
|
unsigned short type,
|
292 |
|
|
const struct nubus_dev* from);
|
293 |
|
|
/* Might have more than one device in a slot, you know... */
|
294 |
|
|
struct nubus_dev* nubus_find_slot(unsigned int slot,
|
295 |
|
|
const struct nubus_dev* from);
|
296 |
|
|
|
297 |
|
|
/* These are somewhat more NuBus-specific. They all return 0 for
|
298 |
|
|
success and -1 for failure, as you'd expect. */
|
299 |
|
|
|
300 |
|
|
/* The root directory which contains the board and functional
|
301 |
|
|
directories */
|
302 |
|
|
int nubus_get_root_dir(const struct nubus_board* board,
|
303 |
|
|
struct nubus_dir* dir);
|
304 |
|
|
/* The board directory */
|
305 |
|
|
int nubus_get_board_dir(const struct nubus_board* board,
|
306 |
|
|
struct nubus_dir* dir);
|
307 |
|
|
/* The functional directory */
|
308 |
|
|
int nubus_get_func_dir(const struct nubus_dev* dev,
|
309 |
|
|
struct nubus_dir* dir);
|
310 |
|
|
|
311 |
|
|
/* These work on any directory gotten via the above */
|
312 |
|
|
int nubus_readdir(struct nubus_dir* dir,
|
313 |
|
|
struct nubus_dirent* ent);
|
314 |
|
|
int nubus_find_rsrc(struct nubus_dir* dir,
|
315 |
|
|
unsigned char rsrc_type,
|
316 |
|
|
struct nubus_dirent* ent);
|
317 |
|
|
int nubus_rewinddir(struct nubus_dir* dir);
|
318 |
|
|
|
319 |
|
|
/* Things to do with directory entries */
|
320 |
|
|
int nubus_get_subdir(const struct nubus_dirent* ent,
|
321 |
|
|
struct nubus_dir* dir);
|
322 |
|
|
void nubus_get_rsrc_mem(void* dest,
|
323 |
|
|
const struct nubus_dirent *dirent,
|
324 |
|
|
int len);
|
325 |
|
|
void nubus_get_rsrc_str(void* dest,
|
326 |
|
|
const struct nubus_dirent *dirent,
|
327 |
|
|
int maxlen);
|
328 |
|
|
|
329 |
|
|
/* We'd like to get rid of this eventually. Only daynaport.c uses it now. */
|
330 |
|
|
static inline void *nubus_slot_addr(int slot)
|
331 |
|
|
{
|
332 |
|
|
return (void *)(0xF0000000|(slot<<24));
|
333 |
|
|
}
|
334 |
|
|
|
335 |
|
|
#endif /* LINUX_NUBUS_H */
|