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