source: svn/trunk/newcon3bcm2_21bu/toolchain/mips-linux-uclibc/include/linux/nubus.h @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

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