FreeBSD/Linux Kernel Cross Reference
sys/i386at/autoconf.c
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: autoconf.c,v $
29 * Revision 2.19 93/08/10 15:57:38 mrt
30 * Iff rcline != -1, then proberc will turn on the com line first
31 * thing. So the rest of the probe will be reported thru rconsole.
32 * [93/06/08 rvb]
33 *
34 * Revision 2.18 93/05/10 23:24:01 rvb
35 * Checkin for MK80 branch.
36 * [93/05/10 15:13:07 grm]
37 *
38 * Revision 2.16.3.1 93/03/01 15:26:10 grm
39 * Added TTD teledebug code used to initialize the teledebugger and
40 * begin setup debugging.
41 * [93/03/01 grm]
42 *
43 * Revision 2.17 93/05/10 21:18:41 rvb
44 * Lint.
45 * [93/05/08 11:20:03 af]
46 *
47 * Made it possible to have two Adaptec boards.
48 * [93/05/07 18:37:34 af]
49 *
50 * Added include of standard types.
51 * [93/05/06 09:30:11 af]
52 *
53 * Revision 2.16 92/04/03 12:08:35 rpd
54 * Use port 0x250, 0x350 for irq 5 bnc, thick respectively.
55 * [92/04/02 rvb]
56 * Tossing (0x3bc) below is the WRONG thing to do!!
57 * [92/03/10 rvb]
58 *
59 * Revision 2.15 92/03/06 13:38:29 rpd
60 * Removed 0x3bc entry for lprdriver until someone can come up
61 * with a better fix.
62 * [92/03/06 13:16:43 jsb]
63 *
64 * Revision 2.14 92/02/19 16:29:36 elf
65 * Re-oder device probes -- disks first.
66 * [92/02/18 rvb]
67 *
68 * Revision 2.13 92/02/19 15:08:08 elf
69 * Made take_dev_irq() print device name instead of XYZ in case of
70 * failure.
71 * [92/01/20 kivinen]
72 *
73 * Added more possible configurations for ns8390driver to be able to
74 * use two wd cards simultaneously.
75 * [92/01/20 kivinen]
76 *
77 * Revision 2.12 92/01/14 16:43:46 rpd
78 * Flush com3 it is hardly every available and would use irq 6 -- a no-no.
79 * [92/01/08 rvb]
80 *
81 * Revision 2.11 91/10/07 17:25:07 af
82 * Allow for second fd controller and fix hd entry.
83 * [91/10/01 15:26:32 rvb]
84 *
85 * Synchronize with 2.5 tables.
86 * [91/09/04 rvb]
87 *
88 * Revision 2.10 91/08/24 11:57:16 af
89 * Use new MI autoconf procedures. Added SCSI.
90 * [91/08/02 02:52:15 af]
91 *
92 * Revision 2.9 91/06/19 11:55:44 rvb
93 * cputypes.h->platforms.h
94 * [91/06/12 13:45:33 rvb]
95 *
96 * Revision 2.8 91/05/14 16:19:38 mrt
97 * Correcting copyright
98 *
99 * Revision 2.7 91/02/05 17:15:58 mrt
100 * Changed to new Mach copyright
101 * [91/02/01 17:41:36 mrt]
102 *
103 * Revision 2.6 91/01/09 19:56:29 rpd
104 * Converted from wd8003 to ns8390.
105 * [91/01/08 rpd]
106 *
107 * Revision 2.4 90/11/26 14:48:56 rvb
108 * jsb beat me to XMK34, sigh ...
109 * [90/11/26 rvb]
110 * Synched 2.5 & 3.0 at I386q (r1.7.1.8) & XMK35 (r2.4)
111 * [90/11/15 rvb]
112 *
113 * Revision 2.3 90/10/01 14:22:53 jeffreyh
114 * added wd ethernet driver
115 * [90/09/27 18:23:07 jeffreyh]
116 *
117 * Revision 1.7.1.7 90/08/25 15:42:34 rvb
118 * Define take_<>_irq() vs direct manipulations of ivect and friends.
119 * Replace single Ctlr[] with one per Ctlr type.
120 * [90/08/20 rvb]
121 *
122 * Added parallel port printer driver.
123 * [90/08/14 mg32]
124 *
125 * Revision 1.7.1.6 90/07/27 11:22:57 rvb
126 * Move wd8003 IRQ to IRQ9.
127 * [90/07/26 rvb]
128 *
129 * Revision 1.7.1.5 90/07/10 11:41:45 rvb
130 * iPSC2: subtype and call dcminit().
131 * [90/06/16 rvb]
132 *
133 * Rework probe and attach to be much more bsd flavored.
134 * [90/06/07 rvb]
135 *
136 * Revision 1.7.1.4 90/06/07 08:04:46 rvb
137 * updated for new hd driver probe/attach [eugene]
138 * (Temporarily disabled.)
139 *
140 * Revision 1.7.1.3 90/05/14 13:17:45 rvb
141 * Copy in slave_config() from loose_ends.c
142 * [90/04/23 rvb]
143 *
144 * Revision 2.2 90/05/03 15:40:37 dbg
145 * Converted for pure kernel.
146 * [90/04/23 dbg]
147 *
148 * Revision 1.7.1.2 90/03/16 18:14:51 rvb
149 * Add 3com 3c501 ether [bernadat]
150 * Also clean up things, at least for ether; there are NO
151 * controllers -- just devices.
152 *
153 * Revision 1.7.1.1 89/10/22 11:29:41 rvb
154 * Call setconf for generic kernels.
155 * [89/10/17 rvb]
156 *
157 * Revision 1.7 89/09/20 17:26:26 rvb
158 * Support ln for ORC
159 * [89/09/20 rvb]
160 *
161 * Revision 1.6 89/09/09 15:19:19 rvb
162 * pc586, qd and com are now configured based on the appropriate .h
163 * files and pccom -> com.
164 * [89/09/09 rvb]
165 *
166 * Revision 1.5 89/07/17 10:34:58 rvb
167 * Olivetti Changes to X79 upto 5/9/89:
168 * An almost legitimate probe routine().
169 * [89/07/11 rvb]
170 *
171 * Revision 1.4 89/02/26 12:25:02 gm0w
172 * Changes for cleanup.
173 *
174 */
175
176 #ifdef MACH_KERNEL
177 #include <mach_ttd.h>
178 #include <mach/std_types.h>
179 #else MACH_KERNEL
180 #include <cpus.h>
181 #include <platforms.h>
182 #include <generic.h>
183 #include <sys/param.h>
184 #include <mach/machine.h>
185 #include <machine/cpu.h>
186 #endif MACH_KERNEL
187 #include <i386/ipl.h>
188 #include <chips/busses.h>
189
190 /* initialization typecasts */
191 #define SPL_FIVE (vm_offset_t)SPL5
192 #define SPL_SIX (vm_offset_t)SPL6
193 #define SPL_TTY (vm_offset_t)SPLTTY
194
195
196 #include <hd.h>
197 #if NHD > 0
198 extern struct bus_driver hddriver;
199 extern int hdintr();
200 #endif NHD
201
202 #include <fd.h>
203 #if NFD > 0
204 extern struct bus_driver fddriver;
205 extern int fdintr();
206 #endif NFD
207
208 #include <aha.h>
209 #if NAHA > 0
210 extern struct bus_driver aha_driver;
211 extern int aha_intr();
212 #endif NAHA
213
214 #include <pc586.h>
215 #if NPC586 > 0
216 extern struct bus_driver pcdriver;
217 extern int pc586intr();
218 #endif NPC586
219
220 #include <ns8390.h>
221 #if NNS8390 > 0
222 extern struct bus_driver ns8390driver;
223 extern int ns8390intr();
224 #endif NNS8390
225
226 #include <at3c501.h>
227 #if NAT3C501 > 0
228 extern struct bus_driver at3c501driver;
229 extern int at3c501intr();
230 #endif NAT3C501
231
232 #include <com.h>
233 #if NCOM > 0
234 extern struct bus_driver comdriver;
235 extern int comintr();
236 #endif NCOM
237
238 #include <lpr.h>
239 #if NLPR > 0
240 extern struct bus_driver lprdriver;
241 extern int lprintr();
242 #endif NLPR
243
244 #include <wt.h>
245 #if NWT > 0
246 extern struct bus_driver wtdriver;
247 extern int wtintr();
248 #endif NWT
249
250 struct bus_ctlr bus_master_init[] = {
251
252 /* driver name unit intr address len phys_address
253 adaptor alive flags spl pic */
254
255 #if NHD > 0
256 {&hddriver, "hdc", 0, hdintr, 0x1f0, 8, 0x1f0,
257 '?', 0, 0, SPL_FIVE, 14},
258
259 {&hddriver, "hdc", 1, hdintr, 0x170, 8, 0x170,
260 '?', 0, 0, SPL_FIVE, 15},
261 #endif NHD > 0
262
263 #if NAHA > 0
264 {&aha_driver, "ahac", 0, aha_intr, 0x330, 4, 0x330,
265 '?', 0, 0, SPL_FIVE, 11},
266
267 #if NAHA > 1
268
269 {&aha_driver, "ahac", 1, aha_intr, 0x234, 4, 0x234,
270 '?', 0, 0, SPL_FIVE, 12},
271 {&aha_driver, "ahac", 1, aha_intr, 0x230, 4, 0x230,
272 '?', 0, 0, SPL_FIVE, 12},
273 {&aha_driver, "ahac", 1, aha_intr, 0x134, 4, 0x134,
274 '?', 0, 0, SPL_FIVE, 12},
275 {&aha_driver, "ahac", 1, aha_intr, 0x130, 4, 0x130,
276 '?', 0, 0, SPL_FIVE, 12},
277
278 #else
279
280 {&aha_driver, "ahac", 0, aha_intr, 0x334, 4, 0x334,
281 '?', 0, 0, SPL_FIVE, 11},
282 {&aha_driver, "ahac", 0, aha_intr, 0x234, 4, 0x234,
283 '?', 0, 0, SPL_FIVE, 11},
284 {&aha_driver, "ahac", 0, aha_intr, 0x230, 4, 0x230,
285 '?', 0, 0, SPL_FIVE, 11},
286 {&aha_driver, "ahac", 0, aha_intr, 0x134, 4, 0x134,
287 '?', 0, 0, SPL_FIVE, 11},
288 {&aha_driver, "ahac", 0, aha_intr, 0x130, 4, 0x130,
289 '?', 0, 0, SPL_FIVE, 11},
290
291 #endif /* NAHA > 1 */
292 #endif /* NAHA > 0*/
293
294 #if NFD > 0
295 {&fddriver, "fdc", 0, fdintr, 0x3f2, 6, 0x3f2,
296 '?', 0, 0, SPL_FIVE, 6},
297
298 {&fddriver, "fdc", 1, fdintr, 0x372, 6, 0x372,
299 '?', 0, 0, SPL_FIVE, 10},
300 #endif NFD > 0
301
302 0
303 };
304
305
306 struct bus_device bus_device_init[] = {
307
308 /* driver name unit intr address am phys_address
309 adaptor alive ctlr slave flags *mi *next sysdep sysdep */
310
311 #if NHD > 0
312 {&hddriver, "hd", 0, hdintr, 0x104, 8, 0x1f0,
313 '?', 0, 0, 0, 0, 0, 0, SPL_FIVE, 14},
314 {&hddriver, "hd", 1, hdintr, 0x118, 8, 0x1f0,
315 '?', 0, 0, 1, 0, 0, 0, SPL_FIVE, 14},
316 {&hddriver, "hd", 2, hdintr, 0x104, 8, 0x170, /*??*/
317 '?', 0, 1, 0, 0, 0, 0, SPL_FIVE, 15},
318 {&hddriver, "hd", 3, hdintr, 0x118, 8, 0x170,
319 '?', 0, 1, 1, 0, 0, 0, SPL_FIVE, 15},
320 #endif NHD > 0
321
322 #if NAHA > 0
323 { &aha_driver, "rz", 0, 0, 0x0,0, 0, '?', 0, 0, 0, 0, },
324 { &aha_driver, "rz", 1, 0, 0x0,0, 0, '?', 0, 0, 1, 0, },
325 { &aha_driver, "rz", 2, 0, 0x0,0, 0, '?', 0, 0, 2, 0, },
326 { &aha_driver, "rz", 3, 0, 0x0,0, 0, '?', 0, 0, 3, 0, },
327 { &aha_driver, "rz", 4, 0, 0x0,0, 0, '?', 0, 0, 4, 0, },
328 { &aha_driver, "rz", 5, 0, 0x0,0, 0, '?', 0, 0, 5, 0, },
329 { &aha_driver, "rz", 6, 0, 0x0,0, 0, '?', 0, 0, 6, 0, },
330 { &aha_driver, "rz", 7, 0, 0x0,0, 0, '?', 0, 0, 7, 0, },
331
332 { &aha_driver, "tz", 0, 0, 0x0,0, 0, '?', 0, 0, 0, 0, },
333 { &aha_driver, "tz", 1, 0, 0x0,0, 0, '?', 0, 0, 1, 0, },
334 { &aha_driver, "tz", 2, 0, 0x0,0, 0, '?', 0, 0, 2, 0, },
335 { &aha_driver, "tz", 3, 0, 0x0,0, 0, '?', 0, 0, 3, 0, },
336 { &aha_driver, "tz", 4, 0, 0x0,0, 0, '?', 0, 0, 4, 0, },
337 { &aha_driver, "tz", 5, 0, 0x0,0, 0, '?', 0, 0, 5, 0, },
338 { &aha_driver, "tz", 6, 0, 0x0,0, 0, '?', 0, 0, 6, 0, },
339 { &aha_driver, "tz", 7, 0, 0x0,0, 0, '?', 0, 0, 7, 0, },
340
341 #if NAHA > 1
342
343 { &aha_driver, "rz", 8, 0, 0x0,0, 0, '?', 0, 1, 0, 0, },
344 { &aha_driver, "rz", 9, 0, 0x0,0, 0, '?', 0, 1, 1, 0, },
345 { &aha_driver, "rz", 10, 0, 0x0,0, 0, '?', 0, 1, 2, 0, },
346 { &aha_driver, "rz", 11, 0, 0x0,0, 0, '?', 0, 1, 3, 0, },
347 { &aha_driver, "rz", 12, 0, 0x0,0, 0, '?', 0, 1, 4, 0, },
348 { &aha_driver, "rz", 13, 0, 0x0,0, 0, '?', 0, 1, 5, 0, },
349 { &aha_driver, "rz", 14, 0, 0x0,0, 0, '?', 0, 1, 6, 0, },
350 { &aha_driver, "rz", 15, 0, 0x0,0, 0, '?', 0, 1, 7, 0, },
351
352 { &aha_driver, "tz", 8, 0, 0x0,0, 0, '?', 0, 1, 0, 0, },
353 { &aha_driver, "tz", 9, 0, 0x0,0, 0, '?', 0, 1, 1, 0, },
354 { &aha_driver, "tz", 10, 0, 0x0,0, 0, '?', 0, 1, 2, 0, },
355 { &aha_driver, "tz", 11, 0, 0x0,0, 0, '?', 0, 1, 3, 0, },
356 { &aha_driver, "tz", 12, 0, 0x0,0, 0, '?', 0, 1, 4, 0, },
357 { &aha_driver, "tz", 13, 0, 0x0,0, 0, '?', 0, 1, 5, 0, },
358 { &aha_driver, "tz", 14, 0, 0x0,0, 0, '?', 0, 1, 6, 0, },
359 { &aha_driver, "tz", 15, 0, 0x0,0, 0, '?', 0, 1, 7, 0, },
360 #endif NAHA > 1
361 #endif NAHA > 0
362
363 #if NFD > 0
364 {&fddriver, "fd", 0, fdintr, 0x3f2, 6, 0x3f2,
365 '?', 0, 0, 0, 0, 0, 0, SPL_FIVE, 6},
366 {&fddriver, "fd", 1, fdintr, 0x3f2, 6, 0x3f2,
367 '?', 0, 0, 1, 0, 0, 0, SPL_FIVE, 6},
368
369 {&fddriver, "fd", 2, fdintr, 0x372, 6, 0x372,
370 '?', 0, 1, 0, 0, 0, 0, SPL_FIVE, 10},
371 {&fddriver, "fd", 3, fdintr, 0x372, 6, 0x372,
372 '?', 0, 1, 1, 0, 0, 0, SPL_FIVE, 10},
373 #endif NFD > 0
374
375 #if NPC586 > 0
376 /* For MACH Default */
377 {&pcdriver, "pc", 0, pc586intr, 0xd0000, 0, 0xd0000,
378 '?', 0, -1, -1, 0, 0, 0, SPL_FIVE, 9},
379 /* For Factory Default */
380 {&pcdriver, "pc", 0, pc586intr, 0xc0000, 0, 0xc0000,
381 '?', 0, -1, -1, 0, 0, 0, SPL_FIVE, 5},
382 /* For what Intel Ships */
383 {&pcdriver, "pc", 0, pc586intr, 0xf00000, 0, 0xf00000,
384 '?', 0, -1, -1, 0, 0, 0, SPL_FIVE, 12},
385 #endif NPC586 > 0
386
387 #if NNS8390 > 0
388 /* "wd" and "el" */
389 {&ns8390driver, "wd", 0, ns8390intr, 0x280,0x2000,0xd0000,
390 '?', 0, -1, -1, 0, 0, 0, SPL_SIX, 9},
391 {&ns8390driver, "wd", 0, ns8390intr, 0x2a0,0x2000,0xd0000,
392 '?', 0, -1, -1, 0, 0, 0, SPL_SIX, 9},
393 {&ns8390driver, "wd", 0, ns8390intr, 0x2e0,0x2000,0xd0000,
394 '?', 0, -1, -1, 0, 0, 0, SPL_SIX, 5},
395 {&ns8390driver, "wd", 0, ns8390intr, 0x300,0x2000,0xd0000,
396 '?', 0, -1, -1, 0, 0, 0, SPL_SIX, 5},
397 {&ns8390driver, "wd", 0, ns8390intr, 0x250,0x2000,0xd0000,
398 '?', 0, -1, -1, 0, 0, 0, SPL_SIX, 5},
399 {&ns8390driver, "wd", 0, ns8390intr, 0x350,0x2000,0xd0000,
400 '?', 0, -1, -1, 0, 0, 0, SPL_SIX, 5},
401 {&ns8390driver, "wd", 0, ns8390intr, 0x240,0x2000,0xd0000,
402 '?', 0, -1, -1, 0, 0, 0, SPL_SIX, 11},
403 {&ns8390driver, "wd", 1, ns8390intr, 0x340,0x2000,0xe8000,
404 '?', 0, -1, -1, 0, 0, 0, SPL_SIX, 15},
405 #endif NNS8390 > 0
406
407 #if NAT3C501 > 0
408 {&at3c501driver, "et", 0, at3c501intr, 0x300, 0,0x300,
409 '?', 0, -1, -1, 0, 0, 0, SPL_SIX, 9},
410 #endif NAT3C501 > 0
411
412 #if NCOM > 0
413 {&comdriver, "com", 0, comintr, 0x3f8, 8, 0x3f8,
414 '?', 0, -1, -1, 0, 0, 0, SPL_TTY, 4},
415 {&comdriver, "com", 1, comintr, 0x2f8, 8, 0x2f8,
416 '?', 0, -1, -1, 0, 0, 0, SPL_TTY, 3},
417 {&comdriver, "com", 2, comintr, 0x3e8, 8, 0x3e8,
418 '?', 0, -1, -1, 0, 0, 0, SPL_TTY, 5},
419 #endif NCOM > 0
420
421 #if NLPR > 0
422 {&lprdriver, "lpr", 0, lprintr, 0x378, 3, 0x378,
423 '?', 0, -1, -1, 0, 0, 0, SPL_TTY, 7},
424 {&lprdriver, "lpr", 0, lprintr, 0x278, 3, 0x278,
425 '?', 0, -1, -1, 0, 0, 0, SPL_TTY, 7},
426 {&lprdriver, "lpr", 0, lprintr, 0x3bc, 3, 0x3bc,
427 '?', 0, -1, -1, 0, 0, 0, SPL_TTY, 7},
428 #endif NLPR > 0
429
430 #if NWT > 0
431 {&wtdriver, "wt", 0, wtintr, 0x300, 2, 0x300,
432 '?', 0, -1, -1, 0, 0, 0, SPL_FIVE, 5},
433 {&wtdriver, "wt", 0, wtintr, 0x288, 2, 0x288,
434 '?', 0, -1, -1, 0, 0, 0, SPL_FIVE, 5},
435 {&wtdriver, "wt", 0, wtintr, 0x388, 2, 0x388,
436 '?', 0, -1, -1, 0, 0, 0, SPL_FIVE, 5},
437 #endif NWT > 0
438
439 0
440 };
441
442 /*
443 * probeio:
444 *
445 * Probe and subsequently attach devices out on the AT bus.
446 *
447 *
448 */
449 probeio()
450 {
451 register struct bus_device *device;
452 register struct bus_ctlr *master;
453 int i = 0;
454
455 for (master = bus_master_init; master->driver; master++)
456 if (configure_bus_master(master->name, master->address,
457 master->phys_address, i, "atbus"))
458 i++;
459
460 for (device = bus_device_init; device->driver; device++) {
461 /* ignore what we (should) have found already */
462 if (device->alive || device->ctlr != -1)
463 continue;
464 if (configure_bus_device(device->name, device->address,
465 device->phys_address, i, "atbus"))
466 i++;
467 }
468
469 #if MACH_TTD
470 /*
471 * Initialize Remote kernel debugger.
472 */
473 ttd_init();
474 #endif /* MACH_TTD */
475 }
476
477 proberc()
478 {
479 register struct bus_device *device;
480 int i = 0;
481 extern int rcline;
482
483 if (rcline == -1) return;
484
485 for (device = bus_device_init; device->driver; device++) {
486 if (device->driver == &comdriver && device->unit == rcline)
487 configure_bus_device(device->name, device->address,
488 device->phys_address, i, "atbus");
489 }
490 }
491
492 take_dev_irq(dev)
493 struct bus_device *dev;
494 {
495 int pic = (int)dev->sysdep1;
496
497 if (intpri[pic] == 0) {
498 iunit[pic] = dev->unit;
499 ivect[pic] = dev->intr;
500 intpri[pic] = (int)dev->sysdep;
501 form_pic_mask();
502 } else {
503 printf("The device below will clobber IRQ %d.\n", pic);
504 printf("You have two devices at the same IRQ.\n");
505 printf("This won't work. Reconfigure your hardware and try again.\n");
506 printf("%s%d: port = %x, spl = %d, pic = %d.\n",
507 dev->name, dev->unit, dev->address,
508 dev->sysdep, dev->sysdep1);
509 while (1);
510 }
511
512 }
513
514 take_ctlr_irq(ctlr)
515 struct bus_ctlr *ctlr;
516 {
517 int pic = ctlr->sysdep1;
518 if (intpri[pic] == 0) {
519 iunit[pic] = ctlr->unit;
520 ivect[pic] = ctlr->intr;
521 intpri[pic] = (int)ctlr->sysdep;
522 form_pic_mask();
523 } else {
524 printf("The device below will clobber IRQ %d.\n", pic);
525 printf("You have two devices at the same IRQ. This won't work.\n");
526 printf("Reconfigure your hardware and try again.\n");
527 while (1);
528 }
529 }
Cache object: dbfb1ea45005116a60d524f7a804bd90
|