Import 2.3.41pre2
[davej-history.git] / drivers / net / setup.c
blob35b90ff3b8b1bea96d51b35b2fc8e0f24b0256e1
1 /*
2 * New style setup code for the network devices
3 */
5 #include <linux/config.h>
6 #include <linux/netdevice.h>
7 #include <linux/errno.h>
8 #include <linux/init.h>
9 #include <linux/netlink.h>
11 extern int plip_init(void);
12 extern int mkiss_init_ctrl_dev(void);
13 extern int ppp_init(void);
14 extern int slip_init_ctrl_dev(void);
15 extern int strip_init_ctrl_dev(void);
16 extern int x25_asy_init_ctrl_dev(void);
17 extern int slhc_install(void);
19 extern int bpq_init(void);
20 extern int dmascc_init(void);
21 extern int scc_init(void);
22 extern int yam_init(void);
24 extern int acenic_probe(void);
25 extern int awc4500_pci_probe(void);
26 extern int awc4500_isa_probe(void);
27 extern int awc4500_pnp_probe(void);
28 extern int awc4500_365_probe(void);
29 extern int arcnet_init(void);
30 extern int bigmac_probe(void);
31 extern int bmac_probe(void);
32 extern int cpm_enet_init(void);
33 extern int oaknet_init(void);
34 extern int dlci_setup(void);
35 extern int dgrs_probe(void);
36 extern int dmfe_reg_board(void);
37 extern int eepro100_probe(void);
38 extern int epic100_probe(void);
39 extern int happy_meal_probe(void);
40 extern int lapbeth_init(void);
41 extern int mace_probe(void);
42 extern int myri_sbus_probe(void);
43 extern int ncr885e_probe(void);
44 extern int ne2k_pci_probe(void);
45 extern int pcnet32_probe(void);
46 extern int qec_probe(void);
47 extern int rcpci_probe(void);
48 extern int rr_hippi_probe(void);
49 extern int rtl8139_probe(void);
50 extern int sdla_setup(void);
51 extern int sdla_c_setup(void);
52 extern int sis900_probe(void);
53 extern int skge_probe(void);
54 extern int sparc_lance_probe(void);
55 extern int starfire_probe(void);
56 extern int tc59x_probe(void);
57 extern int tulip_probe(void);
58 extern int via_rhine_probe(void);
59 extern int yellowfin_probe(void);
61 /* Pad device name to IFNAMSIZ=16. F.e. __PAD6 is tring of 9 zeros. */
62 #define __PAD6 "\0\0\0\0\0\0\0\0\0"
63 #define __PAD5 __PAD6 "\0"
64 #define __PAD4 __PAD5 "\0"
65 #define __PAD3 __PAD4 "\0"
66 #define __PAD2 __PAD3 "\0"
70 * Devices in this list must do new style probing. That is they must
71 * allocate their own device objects and do their own bus scans.
74 struct net_probe
76 int (*probe)(void);
77 int status; /* non-zero if autoprobe has failed */
80 struct net_probe pci_probes[] __initdata = {
82 * Early setup devices
85 #if defined(CONFIG_SCC)
86 {scc_init, 0},
87 #endif
88 #if defined(CONFIG_DMASCC)
89 {dmascc_init, 0},
90 #endif
91 #if defined(CONFIG_BPQETHER)
92 {bpq_init, 0},
93 #endif
94 #if defined(CONFIG_DLCI)
95 {dlci_setup, 0},
96 #endif
97 #if defined(CONFIG_SDLA)
98 {sdla_c_setup, 0},
99 #endif
100 #if defined(CONFIG_LAPBETHER)
101 {lapbeth_init, 0},
102 #endif
103 #if defined(CONFIG_PLIP)
104 {plip_init, 0},
105 #endif
106 #if defined(CONFIG_ARCNET)
107 {arcnet_init, 0},
108 #endif
109 #if defined(CONFIG_8xx)
110 {cpm_enet_init, 0},
111 #endif
113 * SLHC if present needs attaching so other people see it
114 * even if not opened.
117 #ifdef CONFIG_INET
118 #if (defined(CONFIG_SLIP) && defined(CONFIG_SLIP_COMPRESSED)) \
119 || defined(CONFIG_PPP) \
120 || (defined(CONFIG_ISDN) && defined(CONFIG_ISDN_PPP))
121 {slhc_install, 0},
122 #endif
123 #endif
125 * HIPPI
127 #ifdef CONFIG_ROADRUNNER
128 {rr_hippi_probe, 0},
129 #endif
132 * ETHERNET
136 * SBUS Ethernet
139 #ifdef CONFIG_HAPPYMEAL
140 {happy_meal_probe, 0},
141 #endif
142 #ifdef CONFIG_SUNLANCE
143 {sparc_lance_probe, 0},
144 #endif
145 #ifdef CONFIG_SUNQE
146 {qec_probe, 0},
147 #endif
148 #ifdef CONFIG_SUNBMAC
149 {bigmac_probe, 0},
150 #endif
151 #ifdef CONFIG_MYRI_SBUS
152 {myri_sbus_probe, 0},
153 #endif
156 * PowerPC Mainboard
159 #ifdef CONFIG_MACE
160 {mace_probe, 0},
161 #endif
162 #ifdef CONFIG_BMAC
163 {bmac_probe, 0},
164 #endif
165 #ifdef CONFIG_NCR885E
166 {ncr885e_probe, 0},
167 #endif
170 * IBM "Oak" Evaluation board
172 #ifdef CONFIG_OAKNET
173 {oaknet_init, 0},
174 #endif
177 * PCI Ethernet
179 #ifdef CONFIG_DGRS
180 {dgrs_probe, 0},
181 #endif
182 #ifdef CONFIG_RCPCI
183 {rcpci_probe, 0},
184 #endif
185 #ifdef CONFIG_VORTEX
186 {tc59x_probe, 0},
187 #endif
188 #ifdef CONFIG_NE2K_PCI
189 {ne2k_pci_probe, 0},
190 #endif
191 #ifdef CONFIG_PCNET32
192 {pcnet32_probe, 0},
193 #endif
194 #ifdef CONFIG_EEXPRESS_PRO100 /* Intel EtherExpress Pro/100 */
195 {eepro100_probe, 0},
196 #endif
197 #ifdef CONFIG_DEC_ELCP
198 {tulip_probe, 0},
199 #endif
200 #ifdef CONFIG_EPIC100
201 {epic100_probe, 0},
202 #endif
203 #ifdef CONFIG_RTL8139
204 {rtl8139_probe, 0},
205 #endif
206 #ifdef CONFIG_SIS900
207 {sis900_probe, 0},
208 #endif
210 #ifdef CONFIG_DM9102
211 {dmfe_reg_board, 0},
212 #endif
214 #ifdef CONFIG_YELLOWFIN
215 {yellowfin_probe, 0},
216 #endif
217 #ifdef CONFIG_ACENIC
218 {acenic_probe, 0},
219 #endif
220 #ifdef CONFIG_SK98LIN
221 {skge_probe, 0},
222 #endif
223 #ifdef CONFIG_VIA_RHINE
224 {via_rhine_probe, 0},
225 #endif
226 #ifdef CONFIG_ADAPTEC_STARFIRE
227 {starfire_probe, 0},
228 #endif
232 * Wireless non-HAM
235 #ifdef CONFIG_AIRONET4500_NONCS
237 #ifdef CONFIG_AIRONET4500_PCI
238 {awc4500_pci_probe,0},
239 #endif
241 #ifdef CONFIG_AIRONET4500_PNP
242 {awc4500_pnp_probe,0},
243 #endif
245 #endif
247 * Amateur Radio Drivers
250 #ifdef CONFIG_YAM
251 {yam_init, 0},
252 #endif /* CONFIG_YAM */
255 {NULL, 0},
260 * Run the updated device probes. These do not need a device passed
261 * into them.
264 static void __init network_probe(void)
266 struct net_probe *p = pci_probes;
268 while (p->probe != NULL)
270 p->status = p->probe();
271 p++;
277 * Initialise the line discipline drivers
280 static void __init network_ldisc_init(void)
282 #if defined(CONFIG_SLIP)
283 slip_init_ctrl_dev();
284 #endif
285 #if defined(CONFIG_X25_ASY)
286 x25_asy_init_ctrl_dev();
287 #endif
288 #if defined(CONFIG_MKISS)
289 mkiss_init_ctrl_dev();
290 #endif
291 #if defined(CONFIG_STRIP)
292 strip_init_ctrl_dev();
293 #endif
294 #if defined(CONFIG_PPP)
295 ppp_init();
296 #endif
300 static void __init appletalk_device_init(void)
302 #if defined(CONFIG_IPDDP)
303 extern int ipddp_init(struct net_device *dev);
304 static struct net_device dev_ipddp = {
305 "ipddp0" __PAD6,
306 0, 0, 0, 0,
307 0x0, 0,
308 0, 0, 0, NULL, ipddp_init
311 dev_ipddp.init(&dev_ipddp);
312 #endif /* CONFIG_IPDDP */
317 * The loopback device is global so it can be directly referenced
318 * by the network code.
321 extern int loopback_init(struct net_device *dev);
322 struct net_device loopback_dev =
324 "lo" __PAD2, /* Software Loopback interface */
325 0x0, /* recv memory end */
326 0x0, /* recv memory start */
327 0x0, /* memory end */
328 0x0, /* memory start */
329 0, /* base I/O address */
330 0, /* IRQ */
331 0, 0, 0, /* flags */
332 NULL, /* next device */
333 loopback_init /* loopback_init should set up the rest */
336 static void special_device_init(void)
338 #ifdef CONFIG_DUMMY
340 extern int dummy_init(struct net_device *dev);
341 static struct net_device dummy_dev = {
342 "dummy" __PAD5, 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, dummy_init,
344 register_netdev(&dummy_dev);
346 #endif
347 #ifdef CONFIG_EQUALIZER
349 extern int eql_init(struct net_device *dev);
350 static struct net_device eql_dev =
352 "eql" __PAD3, /* Master device for IP traffic load balancing */
353 0x0, 0x0, 0x0, 0x0, /* recv end/start; mem end/start */
354 0, /* base I/O address */
355 0, /* IRQ */
356 0, 0, 0, /* flags */
357 NULL, /* next device */
358 eql_init /* set up the rest */
360 register_netdev(&eql_dev);
362 #endif
363 #ifdef CONFIG_APBIF
365 extern int bif_init(struct net_device *dev);
366 static struct net_device bif_dev =
368 "bif" __PAD3, 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, bif_init
370 register_netdev(&bif_dev);
372 #endif
373 #ifdef CONFIG_NET_SB1000
375 extern int sb1000_probe(struct net_device *dev);
376 static struct net_device sb1000_dev =
378 "cm0", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, sb1000_probe
380 register_netdev(&sb1000_dev);
382 #endif
383 register_netdev(&loopback_dev);
387 * Initialise network devices
390 void __init net_device_init(void)
392 /* Devices supporting the new probing API */
393 network_probe();
394 /* Line disciplines */
395 network_ldisc_init();
396 /* Appletalk */
397 appletalk_device_init();
398 /* Special devices */
399 special_device_init();
400 /* That kicks off the legacy init functions */