|
|
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: /* The shaper hook */
97: extern int shaper_probe(struct device *);
98: /* Red Creek PCI hook */
99: extern int rcpci_probe(struct device *);
100:
101: static int
102: ethif_probe(struct device *dev)
103: {
104: u_long base_addr = dev->base_addr;
105:
106: if ((base_addr == 0xffe0) || (base_addr == 1))
107: return 1; /* ENXIO */
108:
109: if (1
110: /* All PCI probes are safe, and thus should be first. */
111: #ifdef CONFIG_DE4X5 /* DEC DE425, DE434, DE435 adapters */
112: && de4x5_probe(dev)
113: #endif
114: #ifdef CONFIG_DGRS
115: && dgrs_probe(dev)
116: #endif
117: #ifdef CONFIG_EEXPRESS_PRO100B /* Intel EtherExpress Pro100B */
118: && eepro100_probe(dev)
119: #endif
120: #ifdef CONFIG_EPIC
121: && epic100_probe(dev)
122: #endif
123: #if defined(CONFIG_HP100)
124: && hp100_probe(dev)
125: #endif
126: #if defined(CONFIG_NE2K_PCI)
127: && ne2k_pci_probe(dev)
128: #endif
129: #ifdef CONFIG_PCNET32
130: && pcnet32_probe(dev)
131: #endif
132: #ifdef CONFIG_RTL8139
133: && rtl8139_probe(dev)
134: #endif
135: #if defined(CONFIG_VIA_RHINE)
136: && via_rhine_probe(dev)
137: #endif
138: #if defined(CONFIG_VORTEX)
139: && tc59x_probe(dev)
140: #endif
141: #if defined(CONFIG_DEC_ELCP)
142: && tulip_probe(dev)
143: #endif
144: #ifdef CONFIG_YELLOWFIN
145: && yellowfin_probe(dev)
146: #endif
147: /* Next mostly-safe EISA-only drivers. */
148: #ifdef CONFIG_AC3200 /* Ansel Communications EISA 3200. */
149: && ac3200_probe(dev)
150: #endif
151: #if defined(CONFIG_ULTRA32)
152: && ultra32_probe(dev)
153: #endif
154: /* Third, sensitive ISA boards. */
155: #ifdef CONFIG_AT1700
156: && at1700_probe(dev)
157: #endif
158: #if defined(CONFIG_ULTRA)
159: && ultra_probe(dev)
160: #endif
161: #if defined(CONFIG_SMC9194)
162: && smc_init(dev)
163: #endif
164: #if defined(CONFIG_WD80x3)
165: && wd_probe(dev)
166: #endif
167: #if defined(CONFIG_EL2) /* 3c503 */
168: && el2_probe(dev)
169: #endif
170: #if defined(CONFIG_HPLAN)
171: && hp_probe(dev)
172: #endif
173: #if defined(CONFIG_HPLAN_PLUS)
174: && hp_plus_probe(dev)
175: #endif
176: #if defined(CONFIG_SEEQ8005)
177: && seeq8005_probe(dev)
178: #endif
179: #ifdef CONFIG_E2100 /* Cabletron E21xx series. */
180: && e2100_probe(dev)
181: #endif
182: #if defined(CONFIG_NE2000)
183: && ne_probe(dev)
184: #endif
185: #ifdef CONFIG_AT1500
186: && at1500_probe(dev)
187: #endif
188: #ifdef CONFIG_FMV18X /* Fujitsu FMV-181/182 */
189: && fmv18x_probe(dev)
190: #endif
191: #ifdef CONFIG_ETH16I
192: && eth16i_probe(dev) /* ICL EtherTeam 16i/32 */
193: #endif
194: #ifdef CONFIG_EL3 /* 3c509 */
195: && el3_probe(dev)
196: #endif
197: #ifdef CONFIG_3C515 /* 3c515 */
198: && tc515_probe(dev)
199: #endif
200: #ifdef CONFIG_ZNET /* Zenith Z-Note and some IBM Thinkpads. */
201: && znet_probe(dev)
202: #endif
203: #ifdef CONFIG_EEXPRESS /* Intel EtherExpress */
204: && express_probe(dev)
205: #endif
206: #ifdef CONFIG_EEXPRESS_PRO /* Intel EtherExpress Pro/10 */
207: && eepro_probe(dev)
208: #endif
209: #ifdef CONFIG_DEPCA /* DEC DEPCA */
210: && depca_probe(dev)
211: #endif
212: #ifdef CONFIG_EWRK3 /* DEC EtherWORKS 3 */
213: && ewrk3_probe(dev)
214: #endif
215: #ifdef CONFIG_APRICOT /* Apricot I82596 */
216: && apricot_probe(dev)
217: #endif
218: #ifdef CONFIG_EL1 /* 3c501 */
219: && el1_probe(dev)
220: #endif
221: #if defined(CONFIG_WAVELAN) /* WaveLAN */
222: && wavelan_probe(dev)
223: #endif /* defined(CONFIG_WAVELAN) */
224: #ifdef CONFIG_EL16 /* 3c507 */
225: && el16_probe(dev)
226: #endif
227: #ifdef CONFIG_ELPLUS /* 3c505 */
228: && elplus_probe(dev)
229: #endif
230: #ifdef CONFIG_DE600 /* D-Link DE-600 adapter */
231: && de600_probe(dev)
232: #endif
233: #ifdef CONFIG_DE620 /* D-Link DE-620 adapter */
234: && de620_probe(dev)
235: #endif
236: #if defined(CONFIG_SK_G16)
237: && SK_init(dev)
238: #endif
239: #ifdef CONFIG_NI52
240: && ni52_probe(dev)
241: #endif
242: #ifdef CONFIG_NI65
243: && ni65_probe(dev)
244: #endif
245: #ifdef CONFIG_LANCE /* ISA LANCE boards */
246: && lance_probe(dev)
247: #endif
248: #ifdef CONFIG_ATARILANCE /* Lance-based Atari ethernet boards */
249: && atarilance_probe(dev)
250: #endif
251: #ifdef CONFIG_A2065 /* Commodore/Ameristar A2065 Ethernet Board */
252: && a2065_probe(dev)
253: #endif
254: #ifdef CONFIG_ARIADNE /* Village Tronic Ariadne Ethernet Board */
255: && ariadne_probe(dev)
256: #endif
257: #ifdef CONFIG_HYDRA /* Hydra Systems Amiganet Ethernet board */
258: && hydra_probe(dev)
259: #endif
260: #ifdef CONFIG_SUNLANCE
261: && sparc_lance_probe(dev)
262: #endif
263: #ifdef CONFIG_TLAN
264: && tlan_probe(dev)
265: #endif
266: #ifdef CONFIG_LANCE
267: && lance_probe(dev)
268: #endif
269: && 1 ) {
270: return 1; /* -ENODEV or -EAGAIN would be more accurate. */
271: }
272: return 0;
273: }
274:
275: #ifdef CONFIG_SDLA
276: extern int sdla_init(struct device *);
277: static struct device sdla0_dev = { "sdla0", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, sdla_init, };
278:
279: # undef NEXT_DEV
280: # define NEXT_DEV (&sdla0_dev)
281: #endif
282:
283: /* Run-time ATtachable (Pocket) devices have a different (not "eth#") name. */
284: #ifdef CONFIG_ATP /* AT-LAN-TEC (RealTek) pocket adaptor. */
285: static struct device atp_dev = {
286: "atp0", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, atp_init, /* ... */ };
287: # undef NEXT_DEV
288: # define NEXT_DEV (&atp_dev)
289: #endif
290:
291: #ifdef CONFIG_ARCNET
292: extern int arcnet_probe(struct device *dev);
293: static struct device arcnet_dev = {
294: "arc0", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, arcnet_probe, };
295: # undef NEXT_DEV
296: # define NEXT_DEV (&arcnet_dev)
297: #endif
298:
299: /* The first device defaults to I/O base '0', which means autoprobe. */
300: #ifndef ETH0_ADDR
301: # define ETH0_ADDR 0
302: #endif
303: #ifndef ETH0_IRQ
304: # define ETH0_IRQ 0
305: #endif
306: /* "eth0" defaults to autoprobe (== 0), other use a base of 0xffe0 (== -0x20),
307: which means "don't probe". These entries exist to only to provide empty
308: slots which may be enabled at boot-time. */
309:
310: static struct device eth7_dev = {
311: "eth7", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, NEXT_DEV, ethif_probe };
312: static struct device eth6_dev = {
313: "eth6", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, ð7_dev, ethif_probe };
314: static struct device eth5_dev = {
315: "eth5", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, ð6_dev, ethif_probe };
316: static struct device eth4_dev = {
317: "eth4", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, ð5_dev, ethif_probe };
318: static struct device eth3_dev = {
319: "eth3", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, ð4_dev, ethif_probe };
320: static struct device eth2_dev = {
321: "eth2", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, ð3_dev, ethif_probe };
322: static struct device eth1_dev = {
323: "eth1", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, ð2_dev, ethif_probe };
324:
325: static struct device eth0_dev = {
326: "eth0", 0, 0, 0, 0, ETH0_ADDR, ETH0_IRQ, 0, 0, 0, ð1_dev, ethif_probe };
327:
328: # undef NEXT_DEV
329: # define NEXT_DEV (ð0_dev)
330:
331: #if defined(PLIP) || defined(CONFIG_PLIP)
332: extern int plip_init(struct device *);
333: static struct device plip2_dev = {
334: "plip2", 0, 0, 0, 0, 0x278, 2, 0, 0, 0, NEXT_DEV, plip_init, };
335: static struct device plip1_dev = {
336: "plip1", 0, 0, 0, 0, 0x378, 7, 0, 0, 0, &plip2_dev, plip_init, };
337: static struct device plip0_dev = {
338: "plip0", 0, 0, 0, 0, 0x3BC, 5, 0, 0, 0, &plip1_dev, plip_init, };
339: # undef NEXT_DEV
340: # define NEXT_DEV (&plip0_dev)
341: #endif /* PLIP */
342:
343: #if defined(SLIP) || defined(CONFIG_SLIP)
344: /* To be exact, this node just hooks the initialization
345: routines to the device structures. */
346: extern int slip_init_ctrl_dev(struct device *);
347: static struct device slip_bootstrap = {
348: "slip_proto", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, slip_init_ctrl_dev, };
349: #undef NEXT_DEV
350: #define NEXT_DEV (&slip_bootstrap)
351: #endif /* SLIP */
352:
353: #if defined(CONFIG_MKISS)
354: /* To be exact, this node just hooks the initialization
355: routines to the device structures. */
356: extern int mkiss_init_ctrl_dev(struct device *);
357: static struct device mkiss_bootstrap = {
358: "mkiss_proto", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, mkiss_init_ctrl_dev, };
359: #undef NEXT_DEV
360: #define NEXT_DEV (&mkiss_bootstrap)
361: #endif /* MKISS */
362:
363: #if defined(CONFIG_STRIP)
364: extern int strip_init_ctrl_dev(struct device *);
365: static struct device strip_bootstrap = {
366: "strip_proto", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, strip_init_ctrl_dev, };
367: #undef NEXT_DEV
368: #define NEXT_DEV (&strip_bootstrap)
369: #endif /* STRIP */
370:
371: #if defined(CONFIG_SHAPER)
372: static struct device shaper_bootstrap = {
373: "shaper", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, shaper_probe, };
374: #undef NEXT_DEV
375: #define NEXT_DEV (&shaper_bootstrap)
376: #endif /* SHAPER */
377:
378: #if defined(CONFIG_RCPCI)
379: static struct device rcpci_bootstrap = {
380: "rcpci", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, rcpci_probe, };
381: #undef NEXT_DEV
382: #define NEXT_DEV (&rcpci_bootstrap)
383: #endif /* RCPCI */
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: extern int loopback_init(struct device *dev);
528: struct device loopback_dev = {
529: "lo", /* Software Loopback interface */
530: 0x0, /* recv memory end */
531: 0x0, /* recv memory start */
532: 0x0, /* memory end */
533: 0x0, /* memory start */
534: 0, /* base I/O address */
535: 0, /* IRQ */
536: 0, 0, 0, /* flags */
537: NEXT_DEV, /* next device */
538: loopback_init /* loopback_init should set up the rest */
539: };
540:
541: struct device *dev_base = &loopback_dev;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.