summaryrefslogtreecommitdiffstats
path: root/drivers/net/setup.c
blob: 184d34613c43ab57844f56fd13333a796b9c50df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
/*
 *	New style setup code for the network devices
 */
 
#include <linux/config.h>
#include <linux/netdevice.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/netlink.h>

extern int mkiss_init_ctrl_dev(void);
extern int ppp_init(void);
extern int slip_init_ctrl_dev(void);
extern int strip_init_ctrl_dev(void);
extern int x25_asy_init_ctrl_dev(void);
  
extern int bpq_init(void);
extern int dmascc_init(void);
extern int scc_init(void);
extern int yam_init(void);

extern int acenic_probe(void); 
extern int arcnet_init(void); 
extern int bigmac_probe(void); 
extern int bmac_probe(void); 
extern int cpm_enet_init(void); 
extern int dlci_setup(void); 
extern int dgrs_probe(void); 
extern int dmfe_reg_board(void); 
extern int eepro100_probe(void); 
extern int epic100_probe(void); 
extern int happy_meal_probe(void); 
extern int lapbeth_init(void);
extern int mace_probe(void); 
extern int myri_sbus_probe(void); 
extern int ncr885e_probe(void); 
extern int ne2k_pci_probe(void); 
extern int pcnet32_probe(void); 
extern int qec_probe(void); 
extern int rcpci_probe(void); 
extern int rr_hippi_probe(void); 
extern int rtl8139_probe(void); 
extern int sdla_setup(void); 
extern int sis900_probe(void); 
extern int sparc_lance_probe(void); 
extern int starfire_probe(void); 
extern int tc59x_probe(void); 
extern int tulip_probe(void); 
extern int via_rhine_probe(void); 
extern int yellowfin_probe(void);

/* Pad device name to IFNAMSIZ=16. F.e. __PAD6 is tring of 9 zeros. */
#define __PAD6 "\0\0\0\0\0\0\0\0\0"
#define __PAD5 __PAD6 "\0"
#define __PAD4 __PAD5 "\0"
#define __PAD3 __PAD4 "\0"
#define __PAD2 __PAD3 "\0"


/*
 *	Devices in this list must do new style probing. That is they must
 *	allocate their own device objects and do their own bus scans.
 */

struct net_probe
{
	int (*probe)(void);
	int status;	/* non-zero if autoprobe has failed */
};
 
struct net_probe pci_probes[] __initdata = {
	/*
	 *	Early setup devices
	 */

#if defined(CONFIG_SCC)
	{scc_init, 0},
#endif
#if defined(CONFIG_DMASCC)
	{dmascc_init, 0},
#endif	
#if defined(CONFIG_BPQETHER)
	{bpq_init, 0},
#endif
#if defined(CONFIG_DLCI)
	{dlci_setup, 0},
#endif
#if defined(CONFIG_SDLA)
	{sdla_setup, 0},
#endif
#if defined(CONFIG_LAPBETHER)
	{lapbeth_init, 0},
#endif
#if defined(CONFIG_PLIP)
	{plip_init, 0},
#endif
#if defined(CONFIG_ARCNET)
	{arcnet_init, 0},
#endif
#if defined(CONFIG_8xx)
        {cpm_enet_init, 0},
#endif
	/*
	 *	SLHC if present needs attaching so other people see it
	 *	even if not opened.
	 */
	 
#ifdef CONFIG_INET	 
#if (defined(CONFIG_SLIP) && defined(CONFIG_SLIP_COMPRESSED)) \
	 || defined(CONFIG_PPP) \
    || (defined(CONFIG_ISDN) && defined(CONFIG_ISDN_PPP))
	{slhc_install, 0},
#endif	
#endif
/*
 *	HIPPI
 */
#ifdef CONFIG_ROADRUNNER
	{rr_hippi_probe, 0},
#endif

/*
 *	ETHERNET
 */
 
/*
 *	SBUS Ethernet
 */

#ifdef CONFIG_HAPPYMEAL
	{happy_meal_probe, 0},
#endif
#ifdef CONFIG_SUNLANCE
	{sparc_lance_probe, 0},
#endif
#ifdef CONFIG_SUNQE
	{qec_probe, 0},
#endif
#ifdef CONFIG_SUNBMAC
	{bigmac_probe, 0},
#endif
#ifdef CONFIG_MYRI_SBUS
	{myri_sbus_probe, 0},
#endif

/*
 *	PowerPC Mainboard
 */

#ifdef CONFIG_MACE
	{mace_probe, 0},
#endif
#ifdef CONFIG_BMAC
	{bmac_probe, 0},
#endif
#ifdef CONFIG_NCR885E
	{ncr885e_probe, 0},
#endif

/*
 *	PCI Ethernet
 */
#ifdef CONFIG_DGRS
	{dgrs_probe, 0},
#endif
#ifdef CONFIG_RCPCI
	{rcpci_probe, 0},
#endif
#ifdef CONFIG_VORTEX
	{tc59x_probe, 0},
#endif
#ifdef CONFIG_NE2K_PCI
	{ne2k_pci_probe, 0},
#endif
#ifdef CONFIG_PCNET32
	{pcnet32_probe, 0},
#endif	
#ifdef CONFIG_EEXPRESS_PRO100	/* Intel EtherExpress Pro/100 */
	{eepro100_probe, 0},
#endif
#ifdef CONFIG_DEC_ELCP 
	{tulip_probe, 0},
#endif
#ifdef CONFIG_DE4X5             /* DEC DE425, DE434, DE435 adapters */
	{de4x5_probe, 0},
#endif
#ifdef CONFIG_EPIC100
	{epic100_probe, 0},
#endif
#ifdef CONFIG_RTL8139
	{rtl8139_probe, 0},
#endif
#ifdef CONFIG_SIS900
	{sis900_probe, 0},
#endif

#ifdef CONFIG_DM9102
	{dmfe_reg_board, 0}, 
#endif

#ifdef CONFIG_YELLOWFIN
	{yellowfin_probe, 0},
#endif
#ifdef CONFIG_ACENIC
	{acenic_probe, 0},
#endif
#ifdef CONFIG_VIA_RHINE
	{via_rhine_probe, 0},
#endif
#ifdef CONFIG_ADAPTEC_STARFIRE
	{starfire_probe, 0},
#endif

/*
 *	Amateur Radio Drivers
 */	

#ifdef CONFIG_YAM
	{yam_init, 0},
#endif	/* CONFIG_YAM */
  
 
	{NULL, 0},
};


/*
 *	Run the updated device probes. These do not need a device passed
 *	into them.
 */
 
static void __init network_probe(void)
{
	struct net_probe *p = pci_probes;

	while (p->probe != NULL)
	{
		p->status = p->probe();
		p++;
	}
}


/*
 *	Initialise the line discipline drivers
 */
 
static void __init network_ldisc_init(void)
{
#if defined(CONFIG_SLIP)
	slip_init_ctrl_dev();
#endif
#if defined(CONFIG_X25_ASY)
	x25_asy_init_ctrl_dev();
#endif
#if defined(CONFIG_MKISS)
	mkiss_init_ctrl_dev();
#endif
#if defined(CONFIG_STRIP)
	strip_init_ctrl_dev();
#endif
#if defined(CONFIG_PPP)
	ppp_init();
#endif
}


static void __init appletalk_device_init(void)
{
#if defined(CONFIG_IPDDP)
	extern int ipddp_init(struct net_device *dev);
	static struct net_device dev_ipddp = {
				"ipddp0"  __PAD6,
				0, 0, 0, 0,
				0x0, 0,
				0, 0, 0, NULL, ipddp_init 
	};
	
	dev_ipddp.init(&dev_ipddp);
#endif /* CONFIG_IPDDP */
}


/*
 *	The loopback device is global so it can be directly referenced
 *	by the network code.
 */
 
extern int loopback_init(struct net_device *dev);
struct net_device loopback_dev = 
{
	"lo" __PAD2,		/* Software Loopback interface		*/
	0x0,			/* recv memory end			*/
	0x0,			/* recv memory start			*/
	0x0,			/* memory end				*/
	0x0,			/* memory start				*/
	0,			/* base I/O address			*/
	0,			/* IRQ					*/
	0, 0, 0,		/* flags				*/
	NULL,			/* next device				*/
	loopback_init		/* loopback_init should set up the rest	*/
};

static void special_device_init(void)
{
#ifdef CONFIG_DUMMY
	{
		extern int dummy_init(struct net_device *dev);
		static struct net_device dummy_dev = {
			"dummy" __PAD5, 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, dummy_init, 
		};
		register_netdev(&sb1000_dev);
	}
#endif	
#ifdef CONFIG_EQUALIZER
	{
		extern int eql_init(struct net_device *dev);
		static struct net_device eql_dev = 
		{
			"eql" __PAD3,			/* Master device for IP traffic load balancing */
			0x0, 0x0, 0x0, 0x0,		/* recv end/start; mem end/start */
			0,				/* base I/O address */
			0,				/* IRQ */
			0, 0, 0,			/* flags */
			NULL,				/* next device */
			eql_init			/* set up the rest */
		};
		register_netdev(&sb1000_dev);
	}
#endif	
#ifdef CONFIG_APBIF
	{
		extern int bif_init(struct net_device *dev);
		static struct net_device bif_dev = 
		{
        		"bif" __PAD3, 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, bif_init 
        	};
		register_netdev(&sb1000_dev);
        }
#endif
#ifdef CONFIG_NET_SB1000
	{
		extern int sb1000_probe(struct net_device *dev);
		static struct net_device sb1000_dev = 
		{
			"cm0", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, sb1000_probe 
		};
		register_netdev(&sb1000_dev);
	}
#endif
	register_netdev(&loopback_dev);
}

/*
 *	Initialise network devices
 */
 
void __init net_device_init(void)
{
	/* Devices supporting the new probing API */
	network_probe();
	/* Line disciplines */
	network_ldisc_init();
	/* Appletalk */
	appletalk_device_init();
	/* Special devices */
	special_device_init();
	/* That kicks off the legacy init functions */
}