1 |
199 |
simons |
/*
|
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 |
|
|
* NOTE: This file is a nice idea, but its current format does not work
|
9 |
|
|
* well for drivers that support multiple units, like the SLIP
|
10 |
|
|
* driver. We should actually have only one pointer to a driver
|
11 |
|
|
* here, with the driver knowing how many units it supports.
|
12 |
|
|
* Currently, the SLIP driver abuses the "base_addr" integer
|
13 |
|
|
* field of the 'device' structure to store the unit number...
|
14 |
|
|
* -FvK
|
15 |
|
|
*
|
16 |
|
|
* Version: @(#)Space.c 1.0.7 08/12/93
|
17 |
|
|
*
|
18 |
|
|
* Authors: Ross Biro, <bir7@leland.Stanford.Edu>
|
19 |
|
|
* Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
|
20 |
|
|
* Donald J. Becker, <becker@super.org>
|
21 |
|
|
*
|
22 |
|
|
* FIXME:
|
23 |
|
|
* Sort the device chain fastest first.
|
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 |
|
|
*/
|
30 |
|
|
#include <linux/config.h>
|
31 |
|
|
#include <linux/netdevice.h>
|
32 |
|
|
#include <linux/errno.h>
|
33 |
|
|
|
34 |
|
|
#define NEXT_DEV NULL
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
/* A unified ethernet device probe. This is the easiest way to have every
|
38 |
|
|
ethernet adaptor have the name "eth[0123...]".
|
39 |
|
|
*/
|
40 |
|
|
extern int ether1_probe (struct device *dev);
|
41 |
|
|
extern int ether3_probe (struct device *dev);
|
42 |
|
|
extern int etherc_probe (struct device *dev);
|
43 |
|
|
extern int etherh_probe (struct device *dev);
|
44 |
|
|
extern int am79c961_probe (struct device *dev);
|
45 |
|
|
extern int cs89x0_probe (struct device *dev);
|
46 |
|
|
|
47 |
|
|
static int
|
48 |
|
|
ethif_probe(struct device *dev)
|
49 |
|
|
{
|
50 |
|
|
u_long base_addr = dev->base_addr;
|
51 |
|
|
|
52 |
|
|
if ((base_addr == 0xffe0) || (base_addr == 1))
|
53 |
|
|
return 1; /* ENXIO */
|
54 |
|
|
|
55 |
|
|
if (1
|
56 |
|
|
#ifdef CONFIG_ETHERH
|
57 |
|
|
&& etherh_probe (dev)
|
58 |
|
|
#endif
|
59 |
|
|
#ifdef CONFIG_ETHERC
|
60 |
|
|
&& etherc_probe (dev)
|
61 |
|
|
#endif
|
62 |
|
|
#ifdef CONFIG_TRIO_CS6800
|
63 |
|
|
&& cs89x0_probe (dev)
|
64 |
|
|
#endif
|
65 |
|
|
#ifdef CONFIG_ETHER3
|
66 |
|
|
&& ether3_probe (dev)
|
67 |
|
|
#endif
|
68 |
|
|
#ifdef CONFIG_ETHER1
|
69 |
|
|
&& ether1_probe (dev)
|
70 |
|
|
#endif
|
71 |
|
|
#ifdef CONFIG_AM79C961A
|
72 |
|
|
&& am79c961_probe (dev)
|
73 |
|
|
#endif
|
74 |
|
|
&& 1 ) {
|
75 |
|
|
return 1; /* -ENODEV or -EAGAIN would be more accurate. */
|
76 |
|
|
}
|
77 |
|
|
return 0;
|
78 |
|
|
}
|
79 |
|
|
|
80 |
|
|
/* The first device defaults to I/O base '0', which means autoprobe. */
|
81 |
|
|
#ifndef ETH0_ADDR
|
82 |
|
|
# define ETH0_ADDR 0
|
83 |
|
|
#endif
|
84 |
|
|
#ifndef ETH0_IRQ
|
85 |
|
|
# define ETH0_IRQ 0
|
86 |
|
|
#endif
|
87 |
|
|
/* The first device defaults to I/O base '0', which means autoprobe. */
|
88 |
|
|
#ifndef ETH1_ADDR
|
89 |
|
|
# define ETH1_ADDR 0
|
90 |
|
|
#endif
|
91 |
|
|
#ifndef ETH1_IRQ
|
92 |
|
|
# define ETH1_IRQ 0
|
93 |
|
|
#endif
|
94 |
|
|
/* "eth0" defaults to autoprobe (== 0), other use a base of 0xffe0 (== -0x20),
|
95 |
|
|
which means "don't probe". These entries exist to only to provide empty
|
96 |
|
|
slots which may be enabled at boot-time. */
|
97 |
|
|
|
98 |
|
|
static struct device eth3_dev = {
|
99 |
|
|
"eth3" , 0x0, 0x0, 0x0, 0x0, 0xffe0 , 0 , 0, 0, 0, NEXT_DEV , ethif_probe };
|
100 |
|
|
|
101 |
|
|
static struct device eth2_dev = {
|
102 |
|
|
"eth2" , 0x0, 0x0, 0x0, 0x0, 0xffe0 , 0 , 0, 0, 0, ð3_dev , ethif_probe };
|
103 |
|
|
|
104 |
|
|
static struct device eth1_dev = {
|
105 |
|
|
"eth1" , 0x0, 0x0, 0x0, 0x0, ETH1_ADDR, ETH1_IRQ, 0, 0, 0, ð2_dev , ethif_probe };
|
106 |
|
|
|
107 |
|
|
static struct device eth0_dev = {
|
108 |
|
|
"eth0" , 0x0, 0x0, 0x0, 0x0, ETH0_ADDR, ETH0_IRQ, 0, 0, 0, ð1_dev , ethif_probe };
|
109 |
|
|
|
110 |
|
|
#undef NEXT_DEV
|
111 |
|
|
#define NEXT_DEV (ð0_dev)
|
112 |
|
|
|
113 |
|
|
#if defined(PLIP) || defined(CONFIG_PLIP)
|
114 |
|
|
extern int plip_init(struct device *);
|
115 |
|
|
static struct device plip2_dev = {
|
116 |
|
|
"plip2" , 0x0, 0x0, 0x0, 0x0, 0x278 , 2 , 0, 0, 0, NEXT_DEV , plip_init };
|
117 |
|
|
|
118 |
|
|
static struct device plip1_dev = {
|
119 |
|
|
"plip1" , 0x0, 0x0, 0x0, 0x0, 0x378 , 7 , 0, 0, 0, &plip2_dev, plip_init };
|
120 |
|
|
|
121 |
|
|
static struct device plip0_dev = {
|
122 |
|
|
"plip0" , 0x0, 0x0, 0x0, 0x0, 0x3BC , 5 , 0, 0, 0, &plip1_dev, plip_init };
|
123 |
|
|
|
124 |
|
|
#undef NEXT_DEV
|
125 |
|
|
#define NEXT_DEV (&plip0_dev)
|
126 |
|
|
#endif /* PLIP */
|
127 |
|
|
|
128 |
|
|
#if defined(SLIP) || defined(CONFIG_SLIP)
|
129 |
|
|
/* To be exact, this node just hooks the initialization
|
130 |
|
|
routines to the device structures. */
|
131 |
|
|
extern int slip_init_ctrl_dev(struct device *);
|
132 |
|
|
|
133 |
|
|
static struct device slip_bootstrap = {
|
134 |
|
|
"slip_proto" , 0x0, 0x0, 0x0, 0x0, 0 , 0 , 0, 0, 0, NEXT_DEV , slip_init_ctrl_dev };
|
135 |
|
|
|
136 |
|
|
#undef NEXT_DEV
|
137 |
|
|
#define NEXT_DEV (&slip_bootstrap)
|
138 |
|
|
#endif /* SLIP */
|
139 |
|
|
|
140 |
|
|
#if defined(CONFIG_PPP)
|
141 |
|
|
extern int ppp_init(struct device *);
|
142 |
|
|
|
143 |
|
|
static struct device ppp_bootstrap = {
|
144 |
|
|
"ppp_proto" , 0x0, 0x0, 0x0, 0x0, 0 , 0 , 0, 0, 0, NEXT_DEV , ppp_init };
|
145 |
|
|
|
146 |
|
|
#undef NEXT_DEV
|
147 |
|
|
#define NEXT_DEV (&ppp_bootstrap)
|
148 |
|
|
#endif /* PPP */
|
149 |
|
|
|
150 |
|
|
#ifdef CONFIG_DUMMY
|
151 |
|
|
extern int dummy_init(struct device *dev);
|
152 |
|
|
|
153 |
|
|
static struct device dummy_dev = {
|
154 |
|
|
"dummy" , 0x0, 0x0, 0x0, 0x0, 0 , 0 , 0, 0, 0, NEXT_DEV , dummy_init };
|
155 |
|
|
|
156 |
|
|
#undef NEXT_DEV
|
157 |
|
|
#define NEXT_DEV (&dummy_dev)
|
158 |
|
|
#endif
|
159 |
|
|
|
160 |
|
|
#ifdef CONFIG_EQUALIZER
|
161 |
|
|
extern int eql_init(struct device *dev);
|
162 |
|
|
|
163 |
|
|
static struct device eql_dev = {
|
164 |
|
|
"eql" , 0x0, 0x0, 0x0, 0x0, 0 , 0 , 0, 0, 0, NEXT_DEV , eql_init };
|
165 |
|
|
|
166 |
|
|
#undef NEXT_DEV
|
167 |
|
|
#define NEXT_DEV (&eql_dev)
|
168 |
|
|
#endif
|
169 |
|
|
|
170 |
|
|
#ifdef CONFIG_NET_IPIP
|
171 |
|
|
#ifdef CONFIG_IP_FORWARD
|
172 |
|
|
extern int tunnel_init (struct device *dev);
|
173 |
|
|
|
174 |
|
|
static struct device tunnel_dev1 = {
|
175 |
|
|
"tunl1" , 0x0, 0x0, 0x0, 0x0, 0 , 0 , 0, 0, 0, NEXT_DEV , tunnel_init };
|
176 |
|
|
|
177 |
|
|
static struct device tunnel_dev0 = {
|
178 |
|
|
"tunl0" , 0x0, 0x0, 0x0, 0x0, 0 , 0 , 0, 0, 0, &tunnel_dev1, tunnel_init };
|
179 |
|
|
|
180 |
|
|
#undef NEXT_DEV
|
181 |
|
|
#define NEXT_DEV (&tunnel_dev0)
|
182 |
|
|
#endif
|
183 |
|
|
#endif
|
184 |
|
|
|
185 |
|
|
extern int loopback_init(struct device *dev);
|
186 |
|
|
struct device loopback_dev = {
|
187 |
|
|
"lo" , 0x0, 0x0, 0x0, 0x0, 0 , 0 , 0, 0, 0, NEXT_DEV , loopback_init };
|
188 |
|
|
|
189 |
|
|
struct device *dev_base = &loopback_dev;
|