1
2 /*
3 * New style setup code for the network devices
4 */
5
6 #include <linux/config.h>
7 #include <linux/netdevice.h>
8 #include <linux/errno.h>
9 #include <linux/init.h>
10 #include <linux/netlink.h>
11
12 extern int slip_init_ctrl_dev(void);
13 extern int x25_asy_init_ctrl_dev(void);
14
15 extern int dmascc_init(void);
16
17 extern int awc4500_pci_probe(void);
18 extern int awc4500_isa_probe(void);
19 extern int awc4500_pnp_probe(void);
20 extern int awc4500_365_probe(void);
21 extern int arcnet_init(void);
22 extern int scc_enet_init(void);
23 extern int fec_enet_init(void);
24 extern int dlci_setup(void);
25 extern int sdla_setup(void);
26 extern int sdla_c_setup(void);
27 extern int comx_init(void);
28 extern int lmc_setup(void);
29
30 extern int madgemc_probe(void);
31 extern int uml_net_probe(void);
32
33 /* Pad device name to IFNAMSIZ=16. F.e. __PAD6 is string of 9 zeros. */
34 #define __PAD6 "\0\0\0\0\0\0\0\0\0"
35 #define __PAD5 __PAD6 "\0"
36 #define __PAD4 __PAD5 "\0"
37 #define __PAD3 __PAD4 "\0"
38 #define __PAD2 __PAD3 "\0"
39
40
41 /*
42 * Devices in this list must do new style probing. That is they must
43 * allocate their own device objects and do their own bus scans.
44 */
45
46 struct net_probe
47 {
48 int (*probe)(void);
49 int status; /* non-zero if autoprobe has failed */
50 };
51
52 static struct net_probe pci_probes[] __initdata = {
53 /*
54 * Early setup devices
55 */
56
57 #if defined(CONFIG_DMASCC)
58 {dmascc_init, 0},
59 #endif
60 #if defined(CONFIG_DLCI)
61 {dlci_setup, 0},
62 #endif
63 #if defined(CONFIG_SDLA)
64 {sdla_c_setup, 0},
65 #endif
66 #if defined(CONFIG_ARCNET)
67 {arcnet_init, 0},
68 #endif
69 #if defined(CONFIG_SCC_ENET)
70 {scc_enet_init, 0},
71 #endif
72 #if defined(CONFIG_FEC_ENET)
73 {fec_enet_init, 0},
74 #endif
75 #if defined(CONFIG_COMX)
76 {comx_init, 0},
77 #endif
78
79 #if defined(CONFIG_LANMEDIA)
80 {lmc_setup, 0},
81 #endif
82
83 /*
84 *
85 * Wireless non-HAM
86 *
87 */
88 #ifdef CONFIG_AIRONET4500_NONCS
89
90 #ifdef CONFIG_AIRONET4500_PCI
91 {awc4500_pci_probe,0},
92 #endif
93
94 #ifdef CONFIG_AIRONET4500_PNP
95 {awc4500_pnp_probe,0},
96 #endif
97
98 #endif
99
100 /*
101 * Token Ring Drivers
102 */
103 #ifdef CONFIG_MADGEMC
104 {madgemc_probe, 0},
105 #endif
106 #ifdef CONFIG_UML_NET
107 {uml_net_probe, 0},
108 #endif
109
110 {NULL, 0},
111 };
112
113
114 /*
115 * Run the updated device probes. These do not need a device passed
116 * into them.
117 */
118
network_probe(void)119 static void __init network_probe(void)
120 {
121 struct net_probe *p = pci_probes;
122
123 while (p->probe != NULL)
124 {
125 p->status = p->probe();
126 p++;
127 }
128 }
129
130
131 /*
132 * Initialise the line discipline drivers
133 */
134
network_ldisc_init(void)135 static void __init network_ldisc_init(void)
136 {
137 #if defined(CONFIG_SLIP)
138 slip_init_ctrl_dev();
139 #endif
140 #if defined(CONFIG_X25_ASY)
141 x25_asy_init_ctrl_dev();
142 #endif
143 }
144
145
special_device_init(void)146 static void __init special_device_init(void)
147 {
148 #ifdef CONFIG_NET_SB1000
149 {
150 extern int sb1000_probe(struct net_device *dev);
151 static struct net_device sb1000_dev =
152 {
153 "cm0" __PAD3, 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NULL, sb1000_probe
154 };
155 register_netdev(&sb1000_dev);
156 }
157 #endif
158 }
159
160 /*
161 * Initialise network devices
162 */
163
net_device_init(void)164 void __init net_device_init(void)
165 {
166 /* Devices supporting the new probing API */
167 network_probe();
168 /* Line disciplines */
169 network_ldisc_init();
170 /* Special devices */
171 special_device_init();
172 /* That kicks off the legacy init functions */
173 }
174