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