]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/net/Space.c
isdn/gigaset: beautify ev-layer.c
[mirror_ubuntu-bionic-kernel.git] / drivers / net / Space.c
CommitLineData
1da177e4
LT
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 * Version: @(#)Space.c 1.0.7 08/12/93
9 *
02c30a84 10 * Authors: Ross Biro
1da177e4
LT
11 * 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/
6aa20a22 21 * Paul Gortmaker (06/98):
1da177e4
LT
22 * - 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 */
1da177e4
LT
30#include <linux/netdevice.h>
31#include <linux/etherdevice.h>
1da177e4
LT
32#include <linux/errno.h>
33#include <linux/init.h>
34#include <linux/netlink.h>
1da177e4
LT
35
36/* A unified ethernet device probe. This is the easiest way to have every
37 ethernet adaptor have the name "eth[0123...]".
38 */
39
1da177e4
LT
40extern struct net_device *hp100_probe(int unit);
41extern struct net_device *ultra_probe(int unit);
1da177e4
LT
42extern 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);
1da177e4 55extern struct net_device *el16_probe(int unit);
1da177e4 56extern struct net_device *elplus_probe(int unit);
1da177e4
LT
57extern 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);
1da177e4
LT
62extern 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);
1da177e4 68extern struct net_device *cs89x0_probe(int unit);
1da177e4
LT
69extern struct net_device *mvme147lance_probe(int unit);
70extern struct net_device *tc515_probe(int unit);
71extern struct net_device *lance_probe(int unit);
1da177e4
LT
72extern struct net_device *mac8390_probe(int unit);
73extern struct net_device *mac89x0_probe(int unit);
1da177e4
LT
74extern struct net_device *cops_probe(int unit);
75extern struct net_device *ltpc_probe(void);
6aa20a22 76
1da177e4
LT
77/* 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
1da177e4
LT
106/*
107 * ISA probes that touch addresses < 0x400 (including those that also
a5e371f6 108 * look for EISA/PCI cards in addition to ISA cards).
1da177e4
LT
109 */
110static struct devprobe2 isa_probes[] __initdata = {
7525d4bf 111#if defined(CONFIG_HP100) && defined(CONFIG_ISA) /* ISA, EISA */
1da177e4 112 {hp100_probe, 0},
6aa20a22 113#endif
1da177e4
LT
114#ifdef CONFIG_3C515
115 {tc515_probe, 0},
116#endif
6aa20a22 117#ifdef CONFIG_ULTRA
1da177e4
LT
118 {ultra_probe, 0},
119#endif
6aa20a22 120#ifdef CONFIG_WD80x3
1da177e4
LT
121 {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
6aa20a22 145#ifdef CONFIG_SEEQ8005
1da177e4
LT
146 {seeq8005_probe, 0},
147#endif
148#ifdef CONFIG_CS89x0
e9460a9e 149#ifndef CONFIG_CS89x0_PLATFORM
1da177e4
LT
150 {cs89x0_probe, 0},
151#endif
e9460a9e 152#endif
1da177e4
LT
153#ifdef CONFIG_AT1700
154 {at1700_probe, 0},
155#endif
1da177e4
LT
156#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
1da177e4
LT
174#ifdef CONFIG_EL16 /* 3c507 */
175 {el16_probe, 0},
176#endif
177#ifdef CONFIG_ELPLUS /* 3c505 */
178 {elplus_probe, 0},
179#endif
1da177e4
LT
180#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
1da177e4
LT
212#ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */
213 {mvme147lance_probe, 0},
214#endif
1da177e4
LT
215#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 */
6aa20a22 228
1da177e4
LT
229static 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) &&
1da177e4
LT
237 probe_list2(unit, isa_probes, base_addr == 0) &&
238 probe_list2(unit, parport_probes, base_addr == 0));
239}
240
1da177e4
LT
241/* Statically configured drivers -- order matters here. */
242static int __init net_olddevs_init(void)
243{
244 int num;
245
1da177e4
LT
246#ifdef CONFIG_SBNI
247 for (num = 0; num < 8; ++num)
248 sbni_probe(num);
1da177e4
LT
249#endif
250 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);