Annotation of sys/arch/mac68k/dev/nubus.h, Revision 1.1.1.1
1.1 nbrk 1: /* $NetBSD: nubus.h,v 1.59 2005/01/15 16:00:59 chs Exp $ */
2:
3: /*
4: * Copyright (c) 1995 Allen Briggs. All rights reserved.
5: *
6: * Redistribution and use in source and binary forms, with or without
7: * modification, are permitted provided that the following conditions
8: * are met:
9: * 1. Redistributions of source code must retain the above copyright
10: * notice, this list of conditions and the following disclaimer.
11: * 2. Redistributions in binary form must reproduce the above copyright
12: * notice, this list of conditions and the following disclaimer in the
13: * documentation and/or other materials provided with the distribution.
14: * 3. All advertising materials mentioning features or use of this software
15: * must display the following acknowledgement:
16: * This product includes software developed by Allen Briggs.
17: * 4. The name of the author may not be used to endorse or promote products
18: * derived from this software without specific prior written permission.
19: *
20: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30: */
31:
32: /*
33: * Nubus cards in Macintoshes are identified by 4 16-bit numbers:
34: * Category: What is the main purpose of this card?
35: * Type: Within this overall category, what kind of card?
36: * DrSW: What software interface does it use?
37: * DrHW: What specific hardware is it?
38: *
39: * For example, the "Toby Frame Buffer" display card is
40: * Category 3 (display)
41: * Type 1 (video)
42: * DrSW 1 (Apple)
43: * and DrHW 1 (TFB).
44: */
45:
46: #include <machine/cpu.h>
47:
48: #define NUBUS_CATEGORY_BOARD 0x0001
49: #define NUBUS_TYPE_BOARD 0x0000 /* We want these for minimal board */
50: #define NUBUS_DRSW_BOARD 0x0000 /* ROMs that come with nothing but */
51: #define NUBUS_DRHW_BOARD 0x0000 /* a board resource (old NI_GPIB) */
52:
53: #define NUBUS_CATEGORY_DISPLAY 0x0003
54: #define NUBUS_TYPE_VIDEO 0x0001
55: #define NUBUS_TYPE_LCD 0x0002
56: #define NUBUS_DRSW_APPLE 0x0001
57: #define NUBUS_DRHW_TFB 0x0001 /* Apple Toby Frame Buffer */
58: #define NUBUS_DRHW_BAER 0x0002 /* Formac Baers/ProNitron 80.IVb */
59: #define NUBUS_DRHW_WVC 0x0006 /* Apple Workstation Video Card */
60: #define NUBUS_DRHW_COLORMAX 0x0007 /* Sigma Designs ColorMax */
61: #define NUBUS_DRHW_SE30 0x0009 /* Apple SE/30 pseudo-slot video */
62: #define NUBUS_DRHW_M2HRVC 0x0013 /* Apple Mac II High-Res Video Card */
63: #define NUBUS_DRHW_MVC 0x0014 /* Apple Mac II Monochrome Video Card */
64: #define NUBUS_DRHW_PVC 0x0017 /* Apple Mac II Portrait Video Card */
65: #define NUBUS_DRHW_MDC 0x0019 /* Apple Macintosh Display Card */
66: #define NUBUS_DRHW_VSC 0x0020 /* Apple Macintosh Duo MiniDock */
67: #define NUBUS_DRHW_JET 0x0029 /* Apple Macintosh DuoDock II */
68: #define NUBUS_DRHW_BOOGIE 0x002b /* Apple Macintosh 24AC Video Card */
69: #define NUBUS_DRHW_VILTRO340 0x0102 /* VillageTronic Mac Picasso 340 */
70: #define NUBUS_DRHW_SUPRGFX 0x0105 /* SuperMac GFX */
71: #define NUBUS_DRHW_RELAX200 0x0131 /* Relax 19" Model 200 */
72: #define NUBUS_DRHW_FORMAC 0x013A /* Formac color card II */
73: #define NUBUS_DRHW_CB264 0x013B /* RasterOps ColorBoard 264 */
74: #define NUBUS_DRHW_MICRON 0x0146 /* Micron Exceed color */
75: #define NUBUS_DRHW_RADGSC 0x0153 /* Radius GS/C */
76: #define NUBUS_DRHW_SPECTRM8 0x017b /* SuperMac Spectrum/8 Series III */
77: #define NUBUS_DRHW_SPECTRUM 0x017c /* SuperMac Spectrum/24 Series III */
78: #define NUBUS_DRHW_VIMAGE 0x026E /* Interware Co., Ltd. Vimage */
79: #define NUBUS_DRHW_CB364 0x026F /* RasterOps ColorBoard 364 */
80: #define NUBUS_DRHW_LVIEW 0x0278 /* Sigma Designs L-View */
81: #define NUBUS_DRHW_RDCGX 0x027C /* Radius DirectColor/GX */
82: #define NUBUS_DRHW_RPC8 0x0291 /* Radius PrecisionColor 8 */
83: #define NUBUS_DRHW_LAPIS 0x0292 /* SE/30 Lapis ProColorServer 8 PDS */
84: #define NUBUS_DRHW_ROPS24LXI 0x02A0 /* RasterOps 8/24 XLi */
85: #define NUBUS_DRHW_ROPSPPGT 0x02A5 /* RasterOps PaintBoard Prism GT 1.0 */
86: #define NUBUS_DRHW_FUTURASX 0x02AE /* E-Machines Futura-SX */
87: #define NUBUS_DRHW_ROPS24XLTV 0x02B7 /* RasterOps 24XlTV */
88: #define NUBUS_DRHW_THUNDER24 0x02CB /* SuperMac Thunder/24 */
89: #define NUBUS_DRHW_MPGX 0x03D6 /* MiroPRISMA GX */
90: #define NUBUS_DRHW_ROPS24MXTV 0x03DF /* RasterOps 24MxTV */
91: #define NUBUS_DRHW_GVIMAGE 0x03FB /* Interware Co., Ltd. Grand Vimage */
92: #define NUBUS_DRHW_RPC24XP 0x0406 /* Radius PrecisionColor 24Xp */
93: #define NUBUS_DRHW_RPC24X 0x040A /* Radius PrecisionColor 24X */
94: #define NUBUS_DRHW_RPC8XJ 0x040B /* Radius PrecisionColor 8xj */
95: #define NUBUS_DRHW_FIILX 0x0417 /* Futura II LX */
96: #define NUBUS_DRHW_FIISXDSP 0x042F /* Futura II SX/DSP */
97: #define NUBUS_DRHW_MC2124NB 0x0462 /* MicroConversions 2124NB II */
98:
99: /* False DrHW values for video cards masquerading as other cards */
100: #define NUBUS_DRHW_SAM768 0x10000 /* Cornerstone/Samsung 768x1006 */
101:
102: #define NUBUS_CATEGORY_NETWORK 0x0004
103: #define NUBUS_TYPE_ETHERNET 0x0001
104: #define NUBUS_DRSW_3COM 0x0000
105: #define NUBUS_DRSW_CABLETRON 0x0001
106: #define NUBUS_DRSW_GATOR 0x0103
107: #define NUBUS_DRSW_ASANTE 0x0104
108: #define NUBUS_DRSW_TECHWORKS 0x0109
109: #define NUBUS_DRSW_DAYNA 0x010B
110: #define NUBUS_DRSW_FARALLON 0x010C
111: #define NUBUS_DRSW_DAYNA2 0x0115
112: #define NUBUS_DRSW_FOCUS 0x011A
113: #define NUBUS_DRSW_ASANTEF 0x011D
114: #define NUBUS_DRSW_TFLLAN 0x011E
115: #define NUBUS_DRHW_INTERLAN 0x0100
116: #define NUBUS_DRHW_ASANTEF 0x0101
117: #define NUBUS_DRHW_KINETICS 0x0106
118: #define NUBUS_DRHW_CABLETRON 0x0109
119: #define NUBUS_DRHW_NUVOLINK 0x010B
120: #define NUBUS_DRHW_ASANTE_LC 0x010F
121: #define NUBUS_DRHW_SONIC 0x0110
122: #define NUBUS_DRHW_TECHWORKS 0x0112
123: #define NUBUS_DRHW_APPLE_SNT 0x0118
124: #define NUBUS_DRHW_APPLE_SN 0x0119
125:
126: #define NUBUS_CATEGORY_COMMUNICATIONS 0x0006
127: #define NUBUS_TYPE_RS232 0x0002
128: #define NUBUS_TYPE_IEEE488 0x0004
129: #define NUBUS_DRSW_HDS 0x0102
130: #define NUBUS_DRSW_NI488 0x0104
131: #define NUBUS_DRSW_HQS 0x0105
132: #define NUBUS_DRHW_HDS 0x0102 /* CS Hustler serial */
133: #define NUBUS_DRHW_HQS 0x0105 /* CS Hurdler quad serial */
134: #define NUBUS_DRHW_NB_GPIB_TNT 0x0102 /* NatInst NB-GPIB/TNT */
135:
136: #define NUBUS_CATEGORY_MEMORY 0x0009 /* Also KanjiTalk Font Card? */
137: #define NUBUS_TYPE_RAMCACHE 0x010C /* From Apple PDS card */
138: #define NUBUS_DRSW_AWGSPDS 0x0100
139: #define NUBUS_DRHW_AWGSPDS 0x0100
140:
141: #define NUBUS_CATEGORY_CPU 0x000A
142: #define NUBUS_TYPE_68000 0x0002
143: #define NUBUS_TYPE_68020 0x0003
144: #define NUBUS_TYPE_68030 0x0004
145: #define NUBUS_TYPE_68040 0x0005
146: #define NUBUS_TYPE_MX 0x0009 /* TI microExplorer */
147:
148: #define NUBUS_CATEGORY_INTBUS 0x000C
149: #define NUBUS_TYPE_SCSI 0x0008
150: #define NUBUS_DRSW_AWGSPDS_SCSI 0x0006
151: #define NUBUS_DRHW_AWGSPDS_SCSI 0x0100
152: #define NUBUS_DRSW_PLI 0x0108
153: #define NUBUS_DRHW_PLI 0x0100
154: #define NUBUS_TYPE_SCSIW 0x000B /* FWB JackHammer Fast/Wide */
155: #define NUBUS_DRSW_FWB 0x0001 /* XXX Allen says 0x010C */
156: #define NUBUS_DRHW_FWB 0x0100
157:
158: #define NUBUS_CATEGORY_DOCK 0x0020
159: #define NUBUS_TYPE_STATION 0x0001
160: #define NUBUS_TYPE_DESK 0x0002
161: #define NUBUS_TYPE_TRAVEL 0x0003
162: /* #define NUBUS_DRSW_APPLE 0x0001 */
163: #define NUBUS_DRSW_NEWERTECH 0x0101
164:
165: /* Station */
166: #define NUBUS_DRHW_DUODOCK 0x0001 /* Apple DuoDock */
167: #define NUBUS_DRHW_DUODOCKII 0x0002 /* Apple DuoDock II */
168:
169: /* Desk */
170: #define NUBUS_DRHW_DUOMINIDOCK 0x0001 /* Apple Duo MiniDock */
171:
172: /* Travel */
173: #define NUBUS_DRHW_MICROSCSI 0x0100 /* Newer Technology SCSI MicroDock */
174:
175:
176: /*
177: * This is the same as Apple's Format Block for a card, with the
178: * addition of a pointer to the base of the NuBUS slot.
179: *
180: * This basically describes a nubus card--this structure is held in the last
181: * N bytes of each valid card's declaration ROM.
182: */
183: typedef struct _nubus_slot {
184: u_long top;
185: u_int8_t slot;
186: u_int8_t bytelanes;
187: u_int8_t step;
188: u_int32_t test_pattern;
189: u_int8_t format;
190: u_int8_t revision_level;
191: u_int32_t crc;
192: u_int32_t length;
193: u_int32_t directory_offset;
194: } nubus_slot;
195:
196: /*
197: * Just a structure to ease comparison of type for drivers, etc.
198: */
199: typedef struct _nubus_type {
200: u_int16_t category;
201: u_int16_t type;
202: u_int16_t drsw;
203: u_int16_t drhw;
204: } nubus_type;
205:
206: /*
207: * nubus_dir is a structure that describes a nubus directory.
208: * The nubus*dir() functions should be used to traverse this.
209: */
210: typedef struct _nubus_dir {
211: u_int32_t dirbase;
212: u_int32_t curr_ent;
213: } nubus_dir;
214:
215: /*
216: * This is the equivalent of an Apple sResource directory entry
217: * with the addition of a pointer to itself (essentially) for easy
218: * calculation of jump to indirect data.
219: */
220: typedef struct _nubus_dirent {
221: u_int32_t myloc;
222: u_int8_t rsrc_id;
223: u_int32_t offset;
224: } nubus_dirent;
225:
226: /*
227: * This is the equivalent of an Apple sResource with the addition of
228: * a pointer back to the sResource directory from whence we came.
229: *
230: * According to the Apple documentation, each sResource is of one of the
231: * following forms:
232: * all: bits 31-24 Identification number
233: *
234: * offset: bits 23-0 Offset to long data, cString, sBlock, etc.
235: * word: bits 23-16 0x00
236: * bits 15-0 word data
237: * byte: bits 23-8 0x0000
238: * bits 7-0 byte data
239: *
240: * The last resource has id = 0xff and data = 0x000000.
241: */
242: typedef struct _nubus_rsrc {
243: u_int32_t myloc;
244: u_int8_t id;
245: u_int32_t data;
246: } nubus_rsrc;
247:
248: /*
249: * On a NuBus master, an sMemory resource (this is a second-level
250: * resource list) holds a list of address ranges for onboard
251: * RAM, ROM and IO resources.
252: */
253: typedef struct _nubus_smem_range {
254: u_int32_t length;
255: u_int32_t offset;
256: } nubus_smem_range;
257:
258: /*
259: * XXX This is mapped on the range list we get back out of the sMemory
260: * resources. I would have liked the range[] array to be of undefined
261: * size but the compiler does not let me.
262: * Maybe it's just too much grief, and we should work with an array
263: * of u_int32_t.
264: */
265: typedef struct _nubus_smem_rangelist {
266: u_int32_t length;
267: nubus_smem_range range[1];
268: } nubus_smem_rangelist;
269:
270:
271: /* Resource IDs for NUBUS_CATEGORY_* (All) */
272: #define NUBUS_RSRC_TYPE 0x01 /* Type (required) */
273: #define NUBUS_RSRC_NAME 0x02 /* Name (required) */
274: #define NUBUS_RSRC_ICON 0x03 /* Icon */
275: #define NUBUS_RSRC_DRVRDIR 0x04 /* Driver directory */
276: #define NUBUS_RSRC_LOADREC 0x05 /* Load record for resource */
277: #define NUBUS_RSRC_BOOTREC 0x06 /* Boot record */
278: #define NUBUS_RSRC_FLAGS 0x07 /* sResource Flags */
279: #define NUBUS_RSRC_HWDEVID 0x08 /* Hardware device ID */
280: #define NUBUS_RSRC_MINOR_BASEOS 0x0A /* Offset to hw in std space */
281: #define NUBUS_RSRC_MINOR_LENGTH 0x0B /* Length of std space */
282: #define NUBUS_RSRC_MAJOR_BASEOS 0x0C /* Offset to hw in super space */
283: #define NUBUS_RSRC_MAJOR_LENGTH 0x0D /* Length of super space */
284: #define NUBUS_RSRC_CICN 0x0F /* Color icon */
285: #define NUBUS_RSRC_ICL8 0x10 /* 8-bit icon data */
286: #define NUBUS_RSRC_ICL4 0x11 /* 4-bit icon data */
287: #define NUBUS_RSRC_SMEMORY 0x6C /* Resource list for master */
288:
289: /* Resource IDs for NUBUS_CATEGORY_DISPLAY */
290: #define NUBUS_RSRC_GAMMADIR 0x40 /* ID for gamma directory */
291: #define NUBUS_RSRC_VIDNAMES 0x41 /* ID for video name directory */
292: #define NUBUS_RSRC_FIRSTMODE 0x80 /* ID for first mode (1-bit) */
293: #define NUBUS_RSRC_SECONDMODE 0x81 /* ID for 2nd mode (2-bit) */
294: #define NUBUS_RSRC_THIRDMODE 0x82 /* ID for 3rd mode (4-bit) */
295: #define NUBUS_RSRC_FOURTHMODE 0x83 /* ID for 4th mode (8-bit) */
296: #define NUBUS_RSRC_FIFTHMODE 0x84 /* ID for 5th mode (16-bit) */
297: #define NUBUS_RSRC_SIXTHMODE 0x85 /* ID for 6th mode (32-bit) */
298:
299: /* Resource IDs for NUBUS_CATEGORY_BOARD */
300: #define NUBUS_RSRC_BOARDID 0x20 /* Board ID */
301: #define NUBUS_RSRC_PRAMINITDATA 0x21 /* Private board data for PRAM */
302: #define NUBUS_RSRC_PRIMARYINIT 0x22 /* Primary init record */
303: #define NUBUS_RSRC_TIMEOUTCONST 0x23 /* Timeout constant */
304: #define NUBUS_RSRC_VENDORINFO 0x24 /* Vendor info list */
305: #define NUBUS_RSRC_BOARDFLAGS 0x25 /* Board flags */
306: #define NUBUS_RSRC_SECONDINIT 0x26 /* Secondary init record */
307:
308: #define NUBUS_RSRC_VEND_ID 0x01 /* Card vendor's design ID */
309: #define NUBUS_RSRC_VEND_SERIAL 0x02 /* Card's serial number */
310: #define NUBUS_RSRC_VEND_REV 0x03 /* Card design's revision level */
311: #define NUBUS_RSRC_VEND_PART 0x04 /* Card part number */
312: #define NUBUS_RSRC_VEND_DATE 0x05 /* Card revision date */
313:
314: /* Resource IDs for NUBUS_RSRC_SMEMORY master sMemory resource list */
315: #define NUBUS_RSRC_SMEM_MINOR_RAMADDR 0x80 /* Minor RAM address ranges */
316: #define NUBUS_RSRC_SMEM_MAJOR_RAMADDR 0x81 /* Major RAM address ranges */
317: #define NUBUS_RSRC_SMEM_MINOR_ROMADDR 0x82 /* Minor ROM address ranges */
318: #define NUBUS_RSRC_SMEM_MAJOR_ROMADDR 0x83 /* Major ROM address ranges */
319: #define NUBUS_RSRC_SMEM_MINOR_DEVADDR 0x84 /* Minor device address ranges */
320: #define NUBUS_RSRC_SMEM_MAJOR_DEVADDR 0x85 /* Major device address ranges */
321:
322:
323: typedef struct _NUBUS_DRIVER {
324: u_int8_t drvr_id;
325: u_int32_t offset;
326: } NUBUS_DRIVER;
327:
328: typedef struct _NUBUS_BLOCK {
329: u_int32_t size; /* Size of block of data */
330: caddr_t data; /* Pointer to data */
331: } NUBUS_BLOCK;
332:
333: typedef struct _NUBUS_EXEC_BLOCK {
334: u_int32_t size; /* Size of total block - 4 */
335: u_int8_t revision; /* Always 0x2 */
336: u_int8_t cpu; /* Which processor? */
337: u_int32_t code_offset; /* Offset base to start of code */
338: caddr_t code; /* pointer to base of code. */
339: } NUBUS_EXEC_BLOCK;
340:
341: #define NUBUS_EXEC_CPU_68000 1
342: #define NUBUS_EXEC_CPU_68020 2
343: #define NUBUS_EXEC_CPU_68030 3
344: #define NUBUS_EXEC_CPU_68040 4
345:
346: #define NUBUS_MIN_SLOT 0x9
347: #define NUBUS_MAX_SLOT 0xE
348: #define NUBUS_ROM_TEST_PATTERN 0x5A932BC7
349:
350: #define NUBUS_SLOT2PA(x) (0xf9000000 + \
351: ((((x) - NUBUS_MIN_SLOT) & 0xf) << 24))
352:
353: struct nubus_attach_args {
354: bus_space_tag_t na_tag;
355: int slot;
356: int rsrcid;
357: u_int16_t category;
358: u_int16_t type;
359: u_int16_t drsw;
360: u_int16_t drhw;
361: nubus_slot *fmt;
362: };
363:
364: struct nubus_softc {
365: struct device sc_dev;
366: };
367:
368:
369: void nubus_get_main_dir(nubus_slot *, nubus_dir *);
370: void nubus_get_dir_from_rsrc(nubus_slot *, nubus_dirent *, nubus_dir *);
371:
372: int nubus_find_rsrc(bus_space_tag_t, bus_space_handle_t, nubus_slot *,
373: nubus_dir *, u_int8_t, nubus_dirent *);
374: int nubus_get_ind_data(bus_space_tag_t, bus_space_handle_t, nubus_slot *,
375: nubus_dirent *, caddr_t, int);
376: int nubus_get_c_string(bus_space_tag_t, bus_space_handle_t, nubus_slot *,
377: nubus_dirent *, caddr_t, int);
378: int nubus_get_smem_addr_rangelist(bus_space_tag_t, bus_space_handle_t,
379: nubus_slot *, nubus_dirent *, caddr_t);
380:
381: char *nubus_get_vendor(bus_space_tag_t, bus_space_handle_t, nubus_slot *,
382: int);
383: char *nubus_get_card_name(bus_space_tag_t, bus_space_handle_t, nubus_slot *);
384: #ifdef DEBUG
385: void nubus_scan_slot(bus_space_tag_t, int);
386: #endif
CVSweb