Import 2.3.27pre3
[davej-history.git] / drivers / net / setup.c
blob63e311d56972b70e785bc6971244cc21964fb232
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 mkiss_init_ctrl_dev(void);
12 extern int ppp_init(void);
13 extern int slip_init_ctrl_dev(void);
14 extern int strip_init_ctrl_dev(void);
15 extern int x25_asy_init_ctrl_dev(void);
17 extern int bpq_init(void);
18 extern int dmascc_init(void);
19 extern int scc_init(void);
20 extern int yam_init(void);
22 extern int acenic_probe(void);
23 extern int arcnet_init(void);
24 extern int bigmac_probe(void);
25 extern int bmac_probe(void);
26 extern int cpm_enet_init(void);
27 extern int dlci_setup(void);
28 extern int dgrs_probe(void);
29 extern int dmfe_reg_board(void);
30 extern int eepro100_probe(void);
31 extern int epic100_probe(void);
32 extern int happy_meal_probe(void);
33 extern int lapbeth_init(void);
34 extern int mace_probe(void);
35 extern int myri_sbus_probe(void);
36 extern int ncr885e_probe(void);
37 extern int ne2k_pci_probe(void);
38 extern int pcnet32_probe(void);
39 extern int qec_probe(void);
40 extern int rcpci_probe(void);
41 extern int rr_hippi_probe(void);
42 extern int rtl8139_probe(void);
43 extern int sdla_setup(void);
44 extern int sis900_probe(void);
45 extern int sparc_lance_probe(void);
46 extern int starfire_probe(void);
47 extern int tc59x_probe(void);
48 extern int tulip_probe(void);
49 extern int via_rhine_probe(void);
50 extern int yellowfin_probe(void);
52 /* Pad device name to IFNAMSIZ=16. F.e. __PAD6 is tring of 9 zeros. */
53 #define __PAD6 "\0\0\0\0\0\0\0\0\0"
54 #define __PAD5 __PAD6 "\0"
55 #define __PAD4 __PAD5 "\0"
56 #define __PAD3 __PAD4 "\0"
57 #define __PAD2 __PAD3 "\0"
61 * Devices in this list must do new style probing. That is they must
62 * allocate their own device objects and do their own bus scans.
65 struct net_probe
67 int (*probe)(void);
68 int status; /* non-zero if autoprobe has failed */
71 struct net_probe pci_probes[] __initdata = {
73 * Early setup devices
76 #if defined(CONFIG_SCC)
77 {scc_init, 0},
78 #endif
79 #if defined(CONFIG_DMASCC)
80 {dmascc_init, 0},
81 #endif
82 #if defined(CONFIG_BPQETHER)
83 {bpq_init, 0},
84 #endif
85 #if defined(CONFIG_DLCI)
86 {dlci_setup, 0},
87 #endif
88 #if defined(CONFIG_SDLA)
89 {sdla_setup, 0},
90 #endif
91 #if defined(CONFIG_LAPBETHER)
92 {lapbeth_init, 0},
93 #endif
94 #if defined(CONFIG_PLIP)
95 {plip_init, 0},
96 #endif
97 #if defined(CONFIG_ARCNET)
98 {arcnet_init, 0},
99 #endif
100 #if defined(CONFIG_8xx)
101 {cpm_enet_init, 0},
102 #endif
104 * SLHC if present needs attaching so other people see it
105 * even if not opened.
108 #ifdef CONFIG_INET
109 #if (defined(CONFIG_SLIP) && defined(CONFIG_SLIP_COMPRESSED)) \
110 || defined(CONFIG_PPP) \
111 || (defined(CONFIG_ISDN) && defined(CONFIG_ISDN_PPP))
112 {slhc_install, 0},
113 #endif
114 #endif
116 * HIPPI
118 #ifdef CONFIG_ROADRUNNER
119 {rr_hippi_probe, 0},
120 #endif
123 * ETHERNET
127 * SBUS Ethernet
130 #ifdef CONFIG_HAPPYMEAL
131 {happy_meal_probe, 0},
132 #endif
133 #ifdef CONFIG_SUNLANCE
134 {sparc_lance_probe, 0},
135 #endif
136 #ifdef CONFIG_SUNQE
137 {qec_probe, 0},
138 #endif
139 #ifdef CONFIG_SUNBMAC
140 {bigmac_probe, 0},
141 #endif
142 #ifdef CONFIG_MYRI_SBUS
143 {myri_sbus_probe, 0},
144 #endif
147 * PowerPC Mainboard
150 #ifdef CONFIG_MACE
151 {mace_probe, 0},
152 #endif
153 #ifdef CONFIG_BMAC
154 {bmac_probe, 0},
155 #endif
156 #ifdef CONFIG_NCR885E
157 {ncr885e_probe, 0},
158 #endif
161 * PCI Ethernet
163 #ifdef CONFIG_DGRS
164 {dgrs_probe, 0},
165 #endif
166 #ifdef CONFIG_RCPCI
167 {rcpci_probe, 0},
168 #endif
169 #ifdef CONFIG_VORTEX
170 {tc59x_probe, 0},
171 #endif
172 #ifdef CONFIG_NE2K_PCI
173 {ne2k_pci_probe, 0},
174 #endif
175 #ifdef CONFIG_PCNET32
176 {pcnet32_probe, 0},
177 #endif
178 #ifdef CONFIG_EEXPRESS_PRO100 /* Intel EtherExpress Pro/100 */
179 {eepro100_probe, 0},
180 #endif
181 #ifdef CONFIG_DEC_ELCP
182 {tulip_probe, 0},
183 #endif
184 #ifdef CONFIG_DE4X5 /* DEC DE425, DE434, DE435 adapters */
185 {de4x5_probe, 0},
186 #endif
187 #ifdef CONFIG_EPIC100
188 {epic100_probe, 0},
189 #endif
190 #ifdef CONFIG_RTL8139
191 {rtl8139_probe, 0},
192 #endif
193 #ifdef CONFIG_SIS900
194 {sis900_probe, 0},
195 #endif
197 #ifdef CONFIG_DM9102
198 {dmfe_reg_board, 0},
199 #endif
201 #ifdef CONFIG_YELLOWFIN
202 {yellowfin_probe, 0},
203 #endif
204 #ifdef CONFIG_ACENIC
205 {acenic_probe, 0},
206 #endif
207 #ifdef CONFIG_VIA_RHINE
208 {via_rhine_probe, 0},
209 #endif
210 #ifdef CONFIG_ADAPTEC_STARFIRE
211 {starfire_probe, 0},
212 #endif
215 * Amateur Radio Drivers
218 #ifdef CONFIG_YAM
219 {yam_init, 0},
220 #endif /* CONFIG_YAM */
223 {NULL, 0},
228 * Run the updated device probes. These do not need a device passed
229 * into them.
232 static void __init network_probe(void)
234 struct net_probe *p = pci_probes;
236 while (p->probe != NULL)
238 p->status = p->probe();
239 p++;
245 * Initialise the line discipline drivers
248 static void __init network_ldisc_init(void)
250 #if defined(CONFIG_SLIP)
251 slip_init_ctrl_dev();
252 #endif
253 #if defined(CONFIG_X25_ASY)
254 x25_asy_init_ctrl_dev();
255 #endif
256 #if defined(CONFIG_MKISS)
257 mkiss_init_ctrl_dev();
258 #endif
259 #if defined(CONFIG_STRIP)
260 strip_init_ctrl_dev();
261 #endif
262 #if defined(CONFIG_PPP)
263 ppp_init():
264 #endif
268 static void __init appletalk_device_init(void)
270 #if defined(CONFIG_IPDDP)
271 extern int ipddp_init(struct net_device *dev);
272 static struct net_device dev_ipddp = {
273 "ipddp0" __PAD6,
274 0, 0, 0, 0,
275 0x0, 0,
276 0, 0, 0, NULL, ipddp_init
279 dev_ipddp.init(&dev_ipddp);
280 #endif /* CONFIG_IPDDP */
285 * The loopback device is global so it can be directly referenced
286 * by the network code.
289 extern int loopback_init(struct net_device *dev);
290 struct net_device loopback_dev =
292 "lo" __PAD2, /* Software Loopback interface */
293 0x0, /* recv memory end */
294 0x0, /* recv memory start */
295 0x0, /* memory end */
296 0x0, /* memory start */
297 0, /* base I/O address */
298 0, /* IRQ */
299 0, 0, 0, /* flags */
300 NULL, /* next device */
301 loopback_init /* loopback_init should set up the rest */
304 static void special_device_init(void)
306 #ifdef CONFIG_DUMMY
308 extern int dummy_init(struct net_device *dev);
309 static struct net_device dummy_dev = {
310 "dummy" __PAD5, 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, dummy_init,
312 register_netdev(&sb1000_dev);
314 #endif
315 #ifdef CONFIG_EQUALIZER
317 extern int eql_init(struct net_device *dev);
318 static struct net_device eql_dev =
320 "eql" __PAD3, /* Master device for IP traffic load balancing */
321 0x0, 0x0, 0x0, 0x0, /* recv end/start; mem end/start */
322 0, /* base I/O address */
323 0, /* IRQ */
324 0, 0, 0, /* flags */
325 NULL, /* next device */
326 eql_init /* set up the rest */
328 register_netdev(&sb1000_dev);
330 #endif
331 #ifdef CONFIG_APBIF
333 extern int bif_init(struct net_device *dev);
334 static struct net_device bif_dev =
336 "bif" __PAD3, 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, bif_init
338 register_netdev(&sb1000_dev);
340 #endif
341 #ifdef CONFIG_NET_SB1000
343 extern int sb1000_probe(struct net_device *dev);
344 static struct net_device sb1000_dev =
346 "cm0", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, sb1000_probe
348 register_netdev(&sb1000_dev);
350 #endif
351 register_netdev(&loopback_dev);
355 * Initialise network devices
358 void __init net_device_init(void)
360 /* Devices supporting the new probing API */
361 network_probe();
362 /* Line disciplines */
363 network_ldisc_init();
364 /* Appletalk */
365 appletalk_device_init();
366 /* Special devices */
367 special_device_init();
368 /* That kicks off the legacy init functions */