blob: 5637c2671415f6838e04d05b6f3a23f40c16804c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 * Version: @(#)Space.c 1.0.7 08/12/93
9 *
Jesper Juhl02c30a82005-05-05 16:16:16 -070010 * Authors: Ross Biro
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
12 * Donald J. Becker, <becker@scyld.com>
13 *
14 * Changelog:
15 * Stephen Hemminger (09/2003)
16 * - get rid of pre-linked dev list, dynamic device allocation
17 * Paul Gortmaker (03/2002)
18 * - struct init cleanup, enable multiple ISA autoprobes.
19 * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 09/1999
20 * - fix sbni: s/device/net_device/
Jeff Garzik6aa20a22006-09-13 13:24:59 -040021 * Paul Gortmaker (06/98):
Linus Torvalds1da177e2005-04-16 15:20:36 -070022 * - sort probes in a sane way, make sure all (safe) probes
23 * get run once & failed autoprobes don't autoprobe again.
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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#include <linux/netdevice.h>
31#include <linux/etherdevice.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#include <linux/errno.h>
33#include <linux/init.h>
34#include <linux/netlink.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035
36/* A unified ethernet device probe. This is the easiest way to have every
37 ethernet adaptor have the name "eth[0123...]".
38 */
39
Linus Torvalds1da177e2005-04-16 15:20:36 -070040extern struct net_device *hp100_probe(int unit);
41extern struct net_device *ultra_probe(int unit);
Linus Torvalds1da177e2005-04-16 15:20:36 -070042extern struct net_device *wd_probe(int unit);
43extern struct net_device *el2_probe(int unit);
44extern struct net_device *ne_probe(int unit);
45extern struct net_device *hp_probe(int unit);
46extern struct net_device *hp_plus_probe(int unit);
47extern struct net_device *express_probe(int unit);
48extern struct net_device *eepro_probe(int unit);
49extern struct net_device *at1700_probe(int unit);
50extern struct net_device *fmv18x_probe(int unit);
51extern struct net_device *eth16i_probe(int unit);
52extern struct net_device *i82596_probe(int unit);
53extern struct net_device *ewrk3_probe(int unit);
54extern struct net_device *el1_probe(int unit);
Linus Torvalds1da177e2005-04-16 15:20:36 -070055extern struct net_device *el16_probe(int unit);
Linus Torvalds1da177e2005-04-16 15:20:36 -070056extern struct net_device *elplus_probe(int unit);
Linus Torvalds1da177e2005-04-16 15:20:36 -070057extern struct net_device *e2100_probe(int unit);
58extern struct net_device *ni5010_probe(int unit);
59extern struct net_device *ni52_probe(int unit);
60extern struct net_device *ni65_probe(int unit);
61extern struct net_device *sonic_probe(int unit);
Linus Torvalds1da177e2005-04-16 15:20:36 -070062extern struct net_device *seeq8005_probe(int unit);
63extern struct net_device *smc_init(int unit);
64extern struct net_device *atarilance_probe(int unit);
65extern struct net_device *sun3lance_probe(int unit);
66extern struct net_device *sun3_82586_probe(int unit);
67extern struct net_device *apne_probe(int unit);
Linus Torvalds1da177e2005-04-16 15:20:36 -070068extern struct net_device *cs89x0_probe(int unit);
Linus Torvalds1da177e2005-04-16 15:20:36 -070069extern struct net_device *mvme147lance_probe(int unit);
70extern struct net_device *tc515_probe(int unit);
71extern struct net_device *lance_probe(int unit);
Linus Torvalds1da177e2005-04-16 15:20:36 -070072extern struct net_device *mac8390_probe(int unit);
73extern struct net_device *mac89x0_probe(int unit);
Linus Torvalds1da177e2005-04-16 15:20:36 -070074extern struct net_device *cops_probe(int unit);
75extern struct net_device *ltpc_probe(void);
Jeff Garzik6aa20a22006-09-13 13:24:59 -040076
Linus Torvalds1da177e2005-04-16 15:20:36 -070077/* Detachable devices ("pocket adaptors") */
78extern struct net_device *de620_probe(int unit);
79
80/* Fibre Channel adapters */
81extern int iph5526_probe(struct net_device *dev);
82
83/* SBNI adapters */
84extern int sbni_probe(int unit);
85
86struct devprobe2 {
87 struct net_device *(*probe)(int unit);
88 int status; /* non-zero if autoprobe has failed */
89};
90
91static int __init probe_list2(int unit, struct devprobe2 *p, int autoprobe)
92{
93 struct net_device *dev;
94 for (; p->probe; p++) {
95 if (autoprobe && p->status)
96 continue;
97 dev = p->probe(unit);
98 if (!IS_ERR(dev))
99 return 0;
100 if (autoprobe)
101 p->status = PTR_ERR(dev);
102 }
103 return -ENODEV;
104}
105
106/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 * ISA probes that touch addresses < 0x400 (including those that also
Paul Gortmakera5e371f2012-05-16 19:48:42 -0400108 * look for EISA/PCI cards in addition to ISA cards).
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109 */
110static struct devprobe2 isa_probes[] __initdata = {
Jeff Garzik7525d4b2006-10-02 21:08:22 -0400111#if defined(CONFIG_HP100) && defined(CONFIG_ISA) /* ISA, EISA */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112 {hp100_probe, 0},
Jeff Garzik6aa20a22006-09-13 13:24:59 -0400113#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114#ifdef CONFIG_3C515
115 {tc515_probe, 0},
116#endif
Jeff Garzik6aa20a22006-09-13 13:24:59 -0400117#ifdef CONFIG_ULTRA
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 {ultra_probe, 0},
119#endif
Jeff Garzik6aa20a22006-09-13 13:24:59 -0400120#ifdef CONFIG_WD80x3
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 {wd_probe, 0},
122#endif
123#ifdef CONFIG_EL2 /* 3c503 */
124 {el2_probe, 0},
125#endif
126#ifdef CONFIG_HPLAN
127 {hp_probe, 0},
128#endif
129#ifdef CONFIG_HPLAN_PLUS
130 {hp_plus_probe, 0},
131#endif
132#ifdef CONFIG_E2100 /* Cabletron E21xx series. */
133 {e2100_probe, 0},
134#endif
135#if defined(CONFIG_NE2000) || \
136 defined(CONFIG_NE_H8300) /* ISA (use ne2k-pci for PCI cards) */
137 {ne_probe, 0},
138#endif
139#ifdef CONFIG_LANCE /* ISA/VLB (use pcnet32 for PCI cards) */
140 {lance_probe, 0},
141#endif
142#ifdef CONFIG_SMC9194
143 {smc_init, 0},
144#endif
Jeff Garzik6aa20a22006-09-13 13:24:59 -0400145#ifdef CONFIG_SEEQ8005
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146 {seeq8005_probe, 0},
147#endif
148#ifdef CONFIG_CS89x0
Jaccon Bastiaansene9460a92012-01-26 21:46:15 +0100149#ifndef CONFIG_CS89x0_PLATFORM
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150 {cs89x0_probe, 0},
151#endif
Jaccon Bastiaansene9460a92012-01-26 21:46:15 +0100152#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153#ifdef CONFIG_AT1700
154 {at1700_probe, 0},
155#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156#ifdef CONFIG_ETH16I
157 {eth16i_probe, 0}, /* ICL EtherTeam 16i/32 */
158#endif
159#ifdef CONFIG_EEXPRESS /* Intel EtherExpress */
160 {express_probe, 0},
161#endif
162#ifdef CONFIG_EEXPRESS_PRO /* Intel EtherExpress Pro/10 */
163 {eepro_probe, 0},
164#endif
165#ifdef CONFIG_EWRK3 /* DEC EtherWORKS 3 */
166 {ewrk3_probe, 0},
167#endif
168#if defined(CONFIG_APRICOT) || defined(CONFIG_MVME16x_NET) || defined(CONFIG_BVME6000_NET) /* Intel I82596 */
169 {i82596_probe, 0},
170#endif
171#ifdef CONFIG_EL1 /* 3c501 */
172 {el1_probe, 0},
173#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700174#ifdef CONFIG_EL16 /* 3c507 */
175 {el16_probe, 0},
176#endif
177#ifdef CONFIG_ELPLUS /* 3c505 */
178 {elplus_probe, 0},
179#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180#ifdef CONFIG_NI5010
181 {ni5010_probe, 0},
182#endif
183#ifdef CONFIG_NI52
184 {ni52_probe, 0},
185#endif
186#ifdef CONFIG_NI65
187 {ni65_probe, 0},
188#endif
189 {NULL, 0},
190};
191
192static struct devprobe2 parport_probes[] __initdata = {
193#ifdef CONFIG_DE620 /* D-Link DE-620 adapter */
194 {de620_probe, 0},
195#endif
196 {NULL, 0},
197};
198
199static struct devprobe2 m68k_probes[] __initdata = {
200#ifdef CONFIG_ATARILANCE /* Lance-based Atari ethernet boards */
201 {atarilance_probe, 0},
202#endif
203#ifdef CONFIG_SUN3LANCE /* sun3 onboard Lance chip */
204 {sun3lance_probe, 0},
205#endif
206#ifdef CONFIG_SUN3_82586 /* sun3 onboard Intel 82586 chip */
207 {sun3_82586_probe, 0},
208#endif
209#ifdef CONFIG_APNE /* A1200 PCMCIA NE2000 */
210 {apne_probe, 0},
211#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700212#ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */
213 {mvme147lance_probe, 0},
214#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700215#ifdef CONFIG_MAC8390 /* NuBus NS8390-based cards */
216 {mac8390_probe, 0},
217#endif
218#ifdef CONFIG_MAC89x0
219 {mac89x0_probe, 0},
220#endif
221 {NULL, 0},
222};
223
224/*
225 * Unified ethernet device probe, segmented per architecture and
226 * per bus interface. This drives the legacy devices only for now.
227 */
Jeff Garzik6aa20a22006-09-13 13:24:59 -0400228
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229static void __init ethif_probe2(int unit)
230{
231 unsigned long base_addr = netdev_boot_base("eth", unit);
232
233 if (base_addr == 1)
234 return;
235
236 (void)( probe_list2(unit, m68k_probes, base_addr == 0) &&
Linus Torvalds1da177e2005-04-16 15:20:36 -0700237 probe_list2(unit, isa_probes, base_addr == 0) &&
238 probe_list2(unit, parport_probes, base_addr == 0));
239}
240
Linus Torvalds1da177e2005-04-16 15:20:36 -0700241/* Statically configured drivers -- order matters here. */
242static int __init net_olddevs_init(void)
243{
244 int num;
245
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246#ifdef CONFIG_SBNI
247 for (num = 0; num < 8; ++num)
248 sbni_probe(num);
249#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250 for (num = 0; num < 8; ++num)
251 ethif_probe2(num);
252
253#ifdef CONFIG_COPS
254 cops_probe(0);
255 cops_probe(1);
256 cops_probe(2);
257#endif
258#ifdef CONFIG_LTPC
259 ltpc_probe();
260#endif
261
262 return 0;
263}
264
265device_initcall(net_olddevs_init);