|
|
1.1 root 1: /*
2: * INET An implementation of the TCP/IP protocol suite for the LINUX
3: * operating system. INET is implemented using the BSD Socket
4: * interface as the means of communication with the user level.
5: *
6: * Holds initial configuration information for devices.
7: *
8: * NOTE: This file is a nice idea, but its current format does not work
9: * well for drivers that support multiple units, like the SLIP
10: * driver. We should actually have only one pointer to a driver
11: * here, with the driver knowing how many units it supports.
12: * Currently, the SLIP driver abuses the "base_addr" integer
13: * field of the 'device' structure to store the unit number...
14: * -FvK
15: *
16: * Version: @(#)Space.c 1.0.8 07/31/96
17: *
18: * Authors: Ross Biro, <[email protected]>
19: * Fred N. van Kempen, <[email protected]>
20: * Donald J. Becker, <[email protected]>
21: *
22: * FIXME:
23: * Sort the device chain fastest first.
24: *
25: * This program is free software; you can redistribute it and/or
26: * modify it under the terms of the GNU General Public License
27: * as published by the Free Software Foundation; either version
28: * 2 of the License, or (at your option) any later version.
29: */
30: #include <linux/config.h>
31: #include <linux/netdevice.h>
32: #include <linux/errno.h>
33:
34: #define NEXT_DEV NULL
35:
36:
37: /* A unified ethernet device probe. This is the easiest way to have every
38: ethernet adaptor have the name "eth[0123...]".
39: */
40:
41: extern int tulip_probe(struct device *dev);
42: extern int hp100_probe(struct device *dev);
43: extern int ultra_probe(struct device *dev);
44: extern int ultra32_probe(struct device *dev);
45: extern int wd_probe(struct device *dev);
46: extern int el2_probe(struct device *dev);
47: extern int ne_probe(struct device *dev);
48: extern int ne2k_pci_probe(struct device *dev);
49: extern int hp_probe(struct device *dev);
50: extern int hp_plus_probe(struct device *dev);
51: extern int znet_probe(struct device *);
52: extern int express_probe(struct device *);
53: extern int eepro_probe(struct device *);
54: extern int el3_probe(struct device *);
55: extern int at1500_probe(struct device *);
56: extern int at1700_probe(struct device *);
57: extern int fmv18x_probe(struct device *);
58: extern int eth16i_probe(struct device *);
59: extern int depca_probe(struct device *);
60: extern int apricot_probe(struct device *);
61: extern int ewrk3_probe(struct device *);
62: extern int de4x5_probe(struct device *);
63: extern int el1_probe(struct device *);
64: extern int via_rhine_probe(struct device *);
65: #if defined(CONFIG_WAVELAN)
66: extern int wavelan_probe(struct device *);
67: #endif /* defined(CONFIG_WAVELAN) */
68: extern int el16_probe(struct device *);
69: extern int elplus_probe(struct device *);
70: extern int ac3200_probe(struct device *);
71: extern int e2100_probe(struct device *);
72: extern int ni52_probe(struct device *);
73: extern int ni65_probe(struct device *);
74: extern int SK_init(struct device *);
75: extern int seeq8005_probe(struct device *);
76: extern int tc59x_probe(struct device *);
77: extern int dgrs_probe(struct device *);
78: extern int smc_init( struct device * );
79: extern int sparc_lance_probe(struct device *);
80: extern int atarilance_probe(struct device *);
81: extern int a2065_probe(struct device *);
82: extern int ariadne_probe(struct device *);
83: extern int hydra_probe(struct device *);
84: extern int yellowfin_probe(struct device *);
85: extern int eepro100_probe(struct device *);
86: extern int epic100_probe(struct device *);
87: extern int rtl8139_probe(struct device *);
88: extern int tlan_probe(struct device *);
89: extern int isa515_probe(struct device *);
90: extern int pcnet32_probe(struct device *);
91: extern int lance_probe(struct device *);
92: /* Detachable devices ("pocket adaptors") */
93: extern int atp_init(struct device *);
94: extern int de600_probe(struct device *);
95: extern int de620_probe(struct device *);
1.1.1.2 ! root 96: extern int tc515_probe(struct device *);
1.1 root 97:
98: static int
99: ethif_probe(struct device *dev)
100: {
101: u_long base_addr = dev->base_addr;
102:
103: if ((base_addr == 0xffe0) || (base_addr == 1))
104: return 1; /* ENXIO */
105:
106: if (1
107: /* All PCI probes are safe, and thus should be first. */
108: #ifdef CONFIG_DE4X5 /* DEC DE425, DE434, DE435 adapters */
109: && de4x5_probe(dev)
110: #endif
111: #ifdef CONFIG_DGRS
112: && dgrs_probe(dev)
113: #endif
114: #ifdef CONFIG_EEXPRESS_PRO100B /* Intel EtherExpress Pro100B */
115: && eepro100_probe(dev)
116: #endif
117: #ifdef CONFIG_EPIC
118: && epic100_probe(dev)
119: #endif
120: #if defined(CONFIG_HP100)
121: && hp100_probe(dev)
122: #endif
123: #if defined(CONFIG_NE2K_PCI)
124: && ne2k_pci_probe(dev)
125: #endif
126: #ifdef CONFIG_PCNET32
127: && pcnet32_probe(dev)
128: #endif
129: #ifdef CONFIG_RTL8139
130: && rtl8139_probe(dev)
131: #endif
132: #ifdef CONFIG_VIA_RHINE
133: && via_rhine_probe(dev)
134: #endif
135: #if defined(CONFIG_DEC_ELCP)
136: && tulip_probe(dev)
137: #endif
138: #ifdef CONFIG_YELLOWFIN
139: && yellowfin_probe(dev)
140: #endif
141: /* Next mostly-safe EISA-only drivers. */
142: #ifdef CONFIG_AC3200 /* Ansel Communications EISA 3200. */
143: && ac3200_probe(dev)
144: #endif
145: #if defined(CONFIG_ULTRA32)
146: && ultra32_probe(dev)
147: #endif
148: /* Third, sensitive ISA boards. */
149: #ifdef CONFIG_AT1700
150: && at1700_probe(dev)
151: #endif
152: #if defined(CONFIG_ULTRA)
153: && ultra_probe(dev)
154: #endif
155: #if defined(CONFIG_SMC9194)
156: && smc_init(dev)
157: #endif
158: #if defined(CONFIG_WD80x3)
159: && wd_probe(dev)
160: #endif
161: #if defined(CONFIG_EL2) /* 3c503 */
162: && el2_probe(dev)
163: #endif
164: #if defined(CONFIG_HPLAN)
165: && hp_probe(dev)
166: #endif
167: #if defined(CONFIG_HPLAN_PLUS)
168: && hp_plus_probe(dev)
169: #endif
170: #if defined(CONFIG_SEEQ8005)
171: && seeq8005_probe(dev)
172: #endif
173: #ifdef CONFIG_E2100 /* Cabletron E21xx series. */
174: && e2100_probe(dev)
175: #endif
176: #if defined(CONFIG_NE2000)
177: && ne_probe(dev)
178: #endif
179: #ifdef CONFIG_AT1500
180: && at1500_probe(dev)
181: #endif
182: #ifdef CONFIG_FMV18X /* Fujitsu FMV-181/182 */
183: && fmv18x_probe(dev)
184: #endif
185: #ifdef CONFIG_ETH16I
186: && eth16i_probe(dev) /* ICL EtherTeam 16i/32 */
187: #endif
188: #ifdef CONFIG_EL3 /* 3c509 */
189: && el3_probe(dev)
190: #endif
191: #if defined(CONFIG_VORTEX)
192: && tc59x_probe(dev)
193: #endif
194: #ifdef CONFIG_3C515 /* 3c515 */
195: && tc515_probe(dev)
196: #endif
197: #ifdef CONFIG_ZNET /* Zenith Z-Note and some IBM Thinkpads. */
198: && znet_probe(dev)
199: #endif
200: #ifdef CONFIG_EEXPRESS /* Intel EtherExpress */
201: && express_probe(dev)
202: #endif
203: #ifdef CONFIG_EEXPRESS_PRO /* Intel EtherExpress Pro/10 */
204: && eepro_probe(dev)
205: #endif
206: #ifdef CONFIG_DEPCA /* DEC DEPCA */
207: && depca_probe(dev)
208: #endif
209: #ifdef CONFIG_EWRK3 /* DEC EtherWORKS 3 */
210: && ewrk3_probe(dev)
211: #endif
212: #ifdef CONFIG_APRICOT /* Apricot I82596 */
213: && apricot_probe(dev)
214: #endif
215: #ifdef CONFIG_EL1 /* 3c501 */
216: && el1_probe(dev)
217: #endif
218: #if defined(CONFIG_WAVELAN) /* WaveLAN */
219: && wavelan_probe(dev)
220: #endif /* defined(CONFIG_WAVELAN) */
221: #ifdef CONFIG_EL16 /* 3c507 */
222: && el16_probe(dev)
223: #endif
224: #ifdef CONFIG_ELPLUS /* 3c505 */
225: && elplus_probe(dev)
226: #endif
227: #ifdef CONFIG_DE600 /* D-Link DE-600 adapter */
228: && de600_probe(dev)
229: #endif
230: #ifdef CONFIG_DE620 /* D-Link DE-620 adapter */
231: && de620_probe(dev)
232: #endif
233: #if defined(CONFIG_SK_G16)
234: && SK_init(dev)
235: #endif
236: #ifdef CONFIG_NI52
237: && ni52_probe(dev)
238: #endif
239: #ifdef CONFIG_NI65
240: && ni65_probe(dev)
241: #endif
242: #ifdef CONFIG_LANCE /* ISA LANCE boards */
243: && lance_probe(dev)
244: #endif
245: #ifdef CONFIG_ATARILANCE /* Lance-based Atari ethernet boards */
246: && atarilance_probe(dev)
247: #endif
248: #ifdef CONFIG_A2065 /* Commodore/Ameristar A2065 Ethernet Board */
249: && a2065_probe(dev)
250: #endif
251: #ifdef CONFIG_ARIADNE /* Village Tronic Ariadne Ethernet Board */
252: && ariadne_probe(dev)
253: #endif
254: #ifdef CONFIG_HYDRA /* Hydra Systems Amiganet Ethernet board */
255: && hydra_probe(dev)
256: #endif
257: #ifdef CONFIG_SUNLANCE
258: && sparc_lance_probe(dev)
259: #endif
260: #ifdef CONFIG_TLAN
261: && tlan_probe(dev)
262: #endif
263: #ifdef CONFIG_LANCE
264: && lance_probe(dev)
265: #endif
266: && 1 ) {
267: return 1; /* -ENODEV or -EAGAIN would be more accurate. */
268: }
269: return 0;
270: }
271:
272: #ifdef CONFIG_SDLA
273: extern int sdla_init(struct device *);
274: static struct device sdla0_dev = { "sdla0", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, sdla_init, };
275:
276: # undef NEXT_DEV
277: # define NEXT_DEV (&sdla0_dev)
278: #endif
279:
280: #ifdef CONFIG_NETROM
281: extern int nr_init(struct device *);
282:
283: static struct device nr3_dev = { "nr3", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, nr_init, };
284: static struct device nr2_dev = { "nr2", 0, 0, 0, 0, 0, 0, 0, 0, 0, &nr3_dev, nr_init, };
285: static struct device nr1_dev = { "nr1", 0, 0, 0, 0, 0, 0, 0, 0, 0, &nr2_dev, nr_init, };
286: static struct device nr0_dev = { "nr0", 0, 0, 0, 0, 0, 0, 0, 0, 0, &nr1_dev, nr_init, };
287:
288: # undef NEXT_DEV
289: # define NEXT_DEV (&nr0_dev)
290: #endif
291:
292: /* Run-time ATtachable (Pocket) devices have a different (not "eth#") name. */
293: #ifdef CONFIG_ATP /* AT-LAN-TEC (RealTek) pocket adaptor. */
294: static struct device atp_dev = {
295: "atp0", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, atp_init, /* ... */ };
296: # undef NEXT_DEV
297: # define NEXT_DEV (&atp_dev)
298: #endif
299:
300: #ifdef CONFIG_ARCNET
301: extern int arcnet_probe(struct device *dev);
302: static struct device arcnet_dev = {
303: "arc0", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, arcnet_probe, };
304: # undef NEXT_DEV
305: # define NEXT_DEV (&arcnet_dev)
306: #endif
307:
308: /* In Mach, by default allow at least 2 interfaces. */
309: #ifdef MACH
310: #ifndef ETH1_ADDR
311: # define ETH1_ADDR 0
312: #endif
313: #ifndef ETH1_IRQ
314: # define ETH1_IRQ 0
315: #endif
316: #endif
317:
318: /* The first device defaults to I/O base '0', which means autoprobe. */
319: #ifndef ETH0_ADDR
320: # define ETH0_ADDR 0
321: #endif
322: #ifndef ETH0_IRQ
323: # define ETH0_IRQ 0
324: #endif
325: /* "eth0" defaults to autoprobe (== 0), other use a base of 0xffe0 (== -0x20),
326: which means "don't probe". These entries exist to only to provide empty
327: slots which may be enabled at boot-time. */
328:
329: static struct device eth7_dev = {
330: "eth7", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, NEXT_DEV, ethif_probe };
331: static struct device eth6_dev = {
332: "eth6", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, ð7_dev, ethif_probe };
333: static struct device eth5_dev = {
334: "eth5", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, ð6_dev, ethif_probe };
335: static struct device eth4_dev = {
336: "eth4", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, ð5_dev, ethif_probe };
337: static struct device eth3_dev = {
338: "eth3", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, ð4_dev, ethif_probe };
339: static struct device eth2_dev = {
340: "eth2", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, ð3_dev, ethif_probe };
341:
342: #ifdef MACH
343: static struct device eth1_dev = {
344: "eth1", 0, 0, 0, 0, ETH1_ADDR, ETH1_IRQ, 0, 0, 0, ð2_dev, ethif_probe };
345: #else
346: static struct device eth1_dev = {
347: "eth1", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, ð2_dev, ethif_probe };
348: #endif
349:
350: static struct device eth0_dev = {
351: "eth0", 0, 0, 0, 0, ETH0_ADDR, ETH0_IRQ, 0, 0, 0, ð1_dev, ethif_probe };
352:
353: # undef NEXT_DEV
354: # define NEXT_DEV (ð0_dev)
355:
356: #if defined(PLIP) || defined(CONFIG_PLIP)
357: extern int plip_init(struct device *);
358: static struct device plip2_dev = {
359: "plip2", 0, 0, 0, 0, 0x278, 2, 0, 0, 0, NEXT_DEV, plip_init, };
360: static struct device plip1_dev = {
361: "plip1", 0, 0, 0, 0, 0x378, 7, 0, 0, 0, &plip2_dev, plip_init, };
362: static struct device plip0_dev = {
363: "plip0", 0, 0, 0, 0, 0x3BC, 5, 0, 0, 0, &plip1_dev, plip_init, };
364: # undef NEXT_DEV
365: # define NEXT_DEV (&plip0_dev)
366: #endif /* PLIP */
367:
368: #if defined(SLIP) || defined(CONFIG_SLIP)
369: /* To be exact, this node just hooks the initialization
370: routines to the device structures. */
371: extern int slip_init_ctrl_dev(struct device *);
372: static struct device slip_bootstrap = {
373: "slip_proto", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, slip_init_ctrl_dev, };
374: #undef NEXT_DEV
375: #define NEXT_DEV (&slip_bootstrap)
376: #endif /* SLIP */
377:
378: #if defined(CONFIG_STRIP)
379: extern int strip_init_ctrl_dev(struct device *);
380: static struct device strip_bootstrap = {
381: "strip_proto", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, strip_init_ctrl_dev, };
382: #undef NEXT_DEV
383: #define NEXT_DEV (&strip_bootstrap)
384: #endif /* STRIP */
385:
386: #if defined(CONFIG_PPP)
387: extern int ppp_init(struct device *);
388: static struct device ppp_bootstrap = {
389: "ppp_proto", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, ppp_init, };
390: #undef NEXT_DEV
391: #define NEXT_DEV (&ppp_bootstrap)
392: #endif /* PPP */
393:
394: #ifdef CONFIG_DUMMY
395: extern int dummy_init(struct device *dev);
396: static struct device dummy_dev = {
397: "dummy", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, dummy_init, };
398: # undef NEXT_DEV
399: # define NEXT_DEV (&dummy_dev)
400: #endif
401:
402: #ifdef CONFIG_EQUALIZER
403: extern int eql_init(struct device *dev);
404: struct device eql_dev = {
405: "eql", /* Master device for IP traffic load
406: balancing */
407: 0x0, 0x0, 0x0, 0x0, /* recv end/start; mem end/start */
408: 0, /* base I/O address */
409: 0, /* IRQ */
410: 0, 0, 0, /* flags */
411: NEXT_DEV, /* next device */
412: eql_init /* set up the rest */
413: };
414: # undef NEXT_DEV
415: # define NEXT_DEV (&eql_dev)
416: #endif
417:
418: #ifdef CONFIG_IBMTR
419:
420: extern int tok_probe(struct device *dev);
421: static struct device ibmtr_dev1 = {
422: "tr1", /* IBM Token Ring (Non-DMA) Interface */
423: 0x0, /* recv memory end */
424: 0x0, /* recv memory start */
425: 0x0, /* memory end */
426: 0x0, /* memory start */
427: 0xa24, /* base I/O address */
428: 0, /* IRQ */
429: 0, 0, 0, /* flags */
430: NEXT_DEV, /* next device */
431: tok_probe /* ??? Token_init should set up the rest */
432: };
433: # undef NEXT_DEV
434: # define NEXT_DEV (&ibmtr_dev1)
435:
436:
437: static struct device ibmtr_dev0 = {
438: "tr0", /* IBM Token Ring (Non-DMA) Interface */
439: 0x0, /* recv memory end */
440: 0x0, /* recv memory start */
441: 0x0, /* memory end */
442: 0x0, /* memory start */
443: 0xa20, /* base I/O address */
444: 0, /* IRQ */
445: 0, 0, 0, /* flags */
446: NEXT_DEV, /* next device */
447: tok_probe /* ??? Token_init should set up the rest */
448: };
449: # undef NEXT_DEV
450: # define NEXT_DEV (&ibmtr_dev0)
451:
452: #endif
453:
454: #ifdef CONFIG_DEFXX
455: extern int dfx_probe(struct device *dev);
456: static struct device fddi7_dev =
457: {"fddi7", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, dfx_probe};
458: static struct device fddi6_dev =
459: {"fddi6", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi7_dev, dfx_probe};
460: static struct device fddi5_dev =
461: {"fddi5", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi6_dev, dfx_probe};
462: static struct device fddi4_dev =
463: {"fddi4", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi5_dev, dfx_probe};
464: static struct device fddi3_dev =
465: {"fddi3", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi4_dev, dfx_probe};
466: static struct device fddi2_dev =
467: {"fddi2", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi3_dev, dfx_probe};
468: static struct device fddi1_dev =
469: {"fddi1", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi2_dev, dfx_probe};
470: static struct device fddi0_dev =
471: {"fddi0", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi1_dev, dfx_probe};
472:
473: #undef NEXT_DEV
474: #define NEXT_DEV (&fddi0_dev)
475: #endif
476:
477: #ifdef CONFIG_NET_IPIP
478: extern int tunnel_init(struct device *);
479:
480: static struct device tunnel_dev1 =
481: {
482: "tunl1", /* IPIP tunnel */
483: 0x0, /* recv memory end */
484: 0x0, /* recv memory start */
485: 0x0, /* memory end */
486: 0x0, /* memory start */
487: 0x0, /* base I/O address */
488: 0, /* IRQ */
489: 0, 0, 0, /* flags */
490: NEXT_DEV, /* next device */
491: tunnel_init /* Fill in the details */
492: };
493:
494: static struct device tunnel_dev0 =
495: {
496: "tunl0", /* IPIP tunnel */
497: 0x0, /* recv memory end */
498: 0x0, /* recv memory start */
499: 0x0, /* memory end */
500: 0x0, /* memory start */
501: 0x0, /* base I/O address */
502: 0, /* IRQ */
503: 0, 0, 0, /* flags */
504: &tunnel_dev1, /* next device */
505: tunnel_init /* Fill in the details */
506: };
507: # undef NEXT_DEV
508: # define NEXT_DEV (&tunnel_dev0)
509:
510: #endif
511:
512: #ifdef CONFIG_APFDDI
513: extern int apfddi_init(struct device *dev);
514: static struct device fddi_dev = {
515: "fddi", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, apfddi_init };
516: # undef NEXT_DEV
517: # define NEXT_DEV (&fddi_dev)
518: #endif
519:
520: #ifdef CONFIG_APBIF
521: extern int bif_init(struct device *dev);
522: static struct device bif_dev = {
523: "bif", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, bif_init };
524: # undef NEXT_DEV
525: # define NEXT_DEV (&bif_dev)
526: #endif
527:
528: #ifdef MACH
529: struct device *dev_base = ð0_dev;
530: #else
531: extern int loopback_init(struct device *dev);
532: struct device loopback_dev = {
533: "lo", /* Software Loopback interface */
534: 0x0, /* recv memory end */
535: 0x0, /* recv memory start */
536: 0x0, /* memory end */
537: 0x0, /* memory start */
538: 0, /* base I/O address */
539: 0, /* IRQ */
540: 0, 0, 0, /* flags */
541: NEXT_DEV, /* next device */
542: loopback_init /* loopback_init should set up the rest */
543: };
544:
545: struct device *dev_base = &loopback_dev;
546: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.