root/drivers/net/Space.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. ethif_probe

   1 /*
   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 
  41 extern int hp100_probe(struct device *dev);
  42 extern int ultra_probe(struct device *dev);
  43 extern int wd_probe(struct device *dev);
  44 extern int el2_probe(struct device *dev);
  45 extern int ne_probe(struct device *dev);
  46 extern int hp_probe(struct device *dev);
  47 extern int hp_plus_probe(struct device *dev);
  48 extern int znet_probe(struct device *);
  49 extern int express_probe(struct device *);
  50 extern int eepro_probe(struct device *);
  51 extern int el3_probe(struct device *);
  52 extern int at1500_probe(struct device *);
  53 extern int at1700_probe(struct device *);
  54 extern int eth16i_probe(struct device *);
  55 extern int depca_probe(struct device *);
  56 extern int apricot_probe(struct device *);
  57 extern int ewrk3_probe(struct device *);
  58 extern int de4x5_probe(struct device *);
  59 extern int el1_probe(struct device *);
  60 #if     defined(CONFIG_WAVELAN)
  61 extern int wavelan_probe(struct device *);
  62 #endif  /* defined(CONFIG_WAVELAN) */
  63 extern int el16_probe(struct device *);
  64 extern int elplus_probe(struct device *);
  65 extern int ac3200_probe(struct device *);
  66 extern int e2100_probe(struct device *);
  67 extern int ni52_probe(struct device *);
  68 extern int ni65_probe(struct device *);
  69 extern int SK_init(struct device *);
  70 extern int seeq8005_probe(struct device *);
  71 extern int tc59x_probe(struct device *);
  72 
  73 /* Detachable devices ("pocket adaptors") */
  74 extern int atp_init(struct device *);
  75 extern int de600_probe(struct device *);
  76 extern int de620_probe(struct device *);
  77 
  78 static int
  79 ethif_probe(struct device *dev)
     /* [previous][next][first][last][top][bottom][index][help] */
  80 {
  81     u_long base_addr = dev->base_addr;
  82 
  83     if ((base_addr == 0xffe0)  ||  (base_addr == 1))
  84         return 1;               /* ENXIO */
  85 
  86     if (1
  87 #if defined(CONFIG_VORTEX)
  88         && tc59x_probe(dev)
  89 #endif
  90 #if defined(CONFIG_SEEQ8005)
  91         && seeq8005_probe(dev)
  92 #endif
  93 #if defined(CONFIG_HP100)
  94         && hp100_probe(dev)
  95 #endif  
  96 #if defined(CONFIG_ULTRA)
  97         && ultra_probe(dev)
  98 #endif
  99 #if defined(CONFIG_WD80x3) || defined(WD80x3)
 100         && wd_probe(dev)
 101 #endif
 102 #if defined(CONFIG_EL2) || defined(EL2) /* 3c503 */
 103         && el2_probe(dev)
 104 #endif
 105 #if defined(CONFIG_HPLAN) || defined(HPLAN)
 106         && hp_probe(dev)
 107 #endif
 108 #if defined(CONFIG_HPLAN_PLUS)
 109         && hp_plus_probe(dev)
 110 #endif
 111 #ifdef CONFIG_AC3200            /* Ansel Communications EISA 3200. */
 112         && ac3200_probe(dev)
 113 #endif
 114 #ifdef CONFIG_E2100             /* Cabletron E21xx series. */
 115         && e2100_probe(dev)
 116 #endif
 117 #if defined(CONFIG_NE2000) || defined(NE2000)
 118         && ne_probe(dev)
 119 #endif
 120 #ifdef CONFIG_AT1500
 121         && at1500_probe(dev)
 122 #endif
 123 #ifdef CONFIG_AT1700
 124         && at1700_probe(dev)
 125 #endif
 126 #ifdef CONFIG_ETH16I
 127         && eth16i_probe(dev)    /* ICL EtherTeam 16i/32 */
 128 #endif
 129 #ifdef CONFIG_EL3               /* 3c509 */
 130         && el3_probe(dev)
 131 #endif
 132 #ifdef CONFIG_ZNET              /* Zenith Z-Note and some IBM Thinkpads. */
 133         && znet_probe(dev)
 134 #endif
 135 #ifdef CONFIG_EEXPRESS          /* Intel EtherExpress */
 136         && express_probe(dev)
 137 #endif
 138 #ifdef CONFIG_EEXPRESS_PRO      /* Intel EtherExpress Pro/10 */
 139         && eepro_probe(dev)
 140 #endif
 141 #ifdef CONFIG_DEPCA             /* DEC DEPCA */
 142         && depca_probe(dev)
 143 #endif
 144 #ifdef CONFIG_EWRK3             /* DEC EtherWORKS 3 */
 145         && ewrk3_probe(dev)
 146 #endif
 147 #ifdef CONFIG_DE4X5             /* DEC DE425, DE434, DE435 adapters */
 148         && de4x5_probe(dev)
 149 #endif
 150 #ifdef CONFIG_APRICOT           /* Apricot I82596 */
 151         && apricot_probe(dev)
 152 #endif
 153 #ifdef CONFIG_EL1               /* 3c501 */
 154         && el1_probe(dev)
 155 #endif
 156 #if     defined(CONFIG_WAVELAN) /* WaveLAN */
 157         && wavelan_probe(dev)
 158 #endif  /* defined(CONFIG_WAVELAN) */
 159 #ifdef CONFIG_EL16              /* 3c507 */
 160         && el16_probe(dev)
 161 #endif
 162 #ifdef CONFIG_ELPLUS            /* 3c505 */
 163         && elplus_probe(dev)
 164 #endif
 165 #ifdef CONFIG_DE600             /* D-Link DE-600 adapter */
 166         && de600_probe(dev)
 167 #endif
 168 #ifdef CONFIG_DE620             /* D-Link DE-620 adapter */
 169         && de620_probe(dev)
 170 #endif
 171 #if defined(CONFIG_SK_G16)
 172         && SK_init(dev)
 173 #endif
 174 #ifdef CONFIG_NI52
 175         && ni52_probe(dev)
 176 #endif
 177 #ifdef CONFIG_NI65
 178         && ni65_probe(dev)
 179 #endif
 180         && 1 ) {
 181         return 1;       /* -ENODEV or -EAGAIN would be more accurate. */
 182     }
 183     return 0;
 184 }
 185 
 186 
 187 #ifdef CONFIG_NETROM
 188         extern int nr_init(struct device *);
 189         
 190         static struct device nr3_dev = { "nr3", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, nr_init, };
 191         static struct device nr2_dev = { "nr2", 0, 0, 0, 0, 0, 0, 0, 0, 0, &nr3_dev, nr_init, };
 192         static struct device nr1_dev = { "nr1", 0, 0, 0, 0, 0, 0, 0, 0, 0, &nr2_dev, nr_init, };
 193         static struct device nr0_dev = { "nr0", 0, 0, 0, 0, 0, 0, 0, 0, 0, &nr1_dev, nr_init, };
 194 
 195 #   undef NEXT_DEV
 196 #   define      NEXT_DEV        (&nr0_dev)
 197 #endif
 198 
 199 /* Run-time ATtachable (Pocket) devices have a different (not "eth#") name. */
 200 #ifdef CONFIG_ATP               /* AT-LAN-TEC (RealTek) pocket adaptor. */
 201 static struct device atp_dev = {
 202     "atp0", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, atp_init, /* ... */ };
 203 #   undef NEXT_DEV
 204 #   define NEXT_DEV     (&atp_dev)
 205 #endif
 206 
 207 #ifdef CONFIG_ARCNET
 208     extern int arcnet_probe(struct device *dev);
 209     static struct device arcnet_dev = {
 210         "arc0", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, arcnet_probe, };
 211 #   undef       NEXT_DEV
 212 #   define      NEXT_DEV        (&arcnet_dev)
 213 #endif
 214 
 215 /* The first device defaults to I/O base '0', which means autoprobe. */
 216 #ifndef ETH0_ADDR
 217 # define ETH0_ADDR 0
 218 #endif
 219 #ifndef ETH0_IRQ
 220 # define ETH0_IRQ 0
 221 #endif
 222 /* "eth0" defaults to autoprobe (== 0), other use a base of 0xffe0 (== -0x20),
 223    which means "don't probe".  These entries exist to only to provide empty
 224    slots which may be enabled at boot-time. */
 225 
 226 static struct device eth3_dev = {
 227     "eth3", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, NEXT_DEV, ethif_probe };
 228 static struct device eth2_dev = {
 229     "eth2", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, &eth3_dev, ethif_probe };
 230 static struct device eth1_dev = {
 231     "eth1", 0,0,0,0,0xffe0 /* I/O base*/, 0,0,0,0, &eth2_dev, ethif_probe };
 232 
 233 static struct device eth0_dev = {
 234     "eth0", 0, 0, 0, 0, ETH0_ADDR, ETH0_IRQ, 0, 0, 0, &eth1_dev, ethif_probe };
 235 
 236 #   undef NEXT_DEV
 237 #   define NEXT_DEV     (&eth0_dev)
 238 
 239 #if defined(PLIP) || defined(CONFIG_PLIP)
 240     extern int plip_init(struct device *);
 241     static struct device plip2_dev = {
 242         "plip2", 0, 0, 0, 0, 0x278, 2, 0, 0, 0, NEXT_DEV, plip_init, };
 243     static struct device plip1_dev = {
 244         "plip1", 0, 0, 0, 0, 0x378, 7, 0, 0, 0, &plip2_dev, plip_init, };
 245     static struct device plip0_dev = {
 246         "plip0", 0, 0, 0, 0, 0x3BC, 5, 0, 0, 0, &plip1_dev, plip_init, };
 247 #   undef NEXT_DEV
 248 #   define NEXT_DEV     (&plip0_dev)
 249 #endif  /* PLIP */
 250 
 251 #if defined(SLIP) || defined(CONFIG_SLIP)
 252         /* To be exact, this node just hooks the initialization
 253            routines to the device structures.                   */
 254 extern int slip_init_ctrl_dev(struct device *);
 255 static struct device slip_bootstrap = {
 256   "slip_proto", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, slip_init_ctrl_dev, };
 257 #undef NEXT_DEV
 258 #define NEXT_DEV (&slip_bootstrap)
 259 #endif  /* SLIP */
 260   
 261 #if defined(CONFIG_PPP)
 262 extern int ppp_init(struct device *);
 263 static struct device ppp_bootstrap = {
 264     "ppp_proto", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, ppp_init, };
 265 #undef NEXT_DEV
 266 #define NEXT_DEV (&ppp_bootstrap)
 267 #endif   /* PPP */
 268 
 269 #ifdef CONFIG_DUMMY
 270     extern int dummy_init(struct device *dev);
 271     static struct device dummy_dev = {
 272         "dummy", 0x0, 0x0, 0x0, 0x0, 0, 0, 0, 0, 0, NEXT_DEV, dummy_init, };
 273 #   undef       NEXT_DEV
 274 #   define      NEXT_DEV        (&dummy_dev)
 275 #endif
 276 
 277 #ifdef CONFIG_EQUALIZER
 278 extern int eql_init(struct device *dev);
 279 struct device eql_dev = {
 280   "eql",                        /* Master device for IP traffic load 
 281                                    balancing */
 282   0x0, 0x0, 0x0, 0x0,           /* recv end/start; mem end/start */
 283   0,                            /* base I/O address */
 284   0,                            /* IRQ */
 285   0, 0, 0,                      /* flags */
 286   NEXT_DEV,                     /* next device */
 287   eql_init                      /* set up the rest */
 288 };
 289 #   undef       NEXT_DEV
 290 #   define      NEXT_DEV        (&eql_dev)
 291 #endif
 292 
 293 #ifdef CONFIG_IBMTR 
 294 
 295     extern int tok_probe(struct device *dev);
 296     static struct device ibmtr_dev1 = {
 297         "tr1",                  /* IBM Token Ring (Non-DMA) Interface */
 298         0x0,                    /* recv memory end                      */
 299         0x0,                    /* recv memory start                    */
 300         0x0,                    /* memory end                           */
 301         0x0,                    /* memory start                         */
 302         0xa24,                  /* base I/O address                     */
 303         0,                      /* IRQ                                  */
 304         0, 0, 0,                /* flags                                */
 305         NEXT_DEV,               /* next device                          */
 306         tok_probe               /* ??? Token_init should set up the rest        */
 307     };
 308 #   undef       NEXT_DEV
 309 #   define      NEXT_DEV        (&ibmtr_dev1)
 310 
 311 
 312     static struct device ibmtr_dev0 = {
 313         "tr0",                  /* IBM Token Ring (Non-DMA) Interface */
 314         0x0,                    /* recv memory end                      */
 315         0x0,                    /* recv memory start                    */
 316         0x0,                    /* memory end                           */
 317         0x0,                    /* memory start                         */
 318         0xa20,                  /* base I/O address                     */
 319         0,                      /* IRQ                                  */
 320         0, 0, 0,                /* flags                                */
 321         NEXT_DEV,               /* next device                          */
 322         tok_probe               /* ??? Token_init should set up the rest        */
 323     };
 324 #   undef       NEXT_DEV
 325 #   define      NEXT_DEV        (&ibmtr_dev0)
 326 
 327 #endif 
 328 #ifdef CONFIG_NET_IPIP
 329 #ifdef CONFIG_IP_FORWARD
 330         extern int tunnel_init(struct device *);
 331         
 332         static struct device tunnel_dev1 = 
 333         {
 334                 "tunl1",                /* IPIP tunnel                          */
 335                 0x0,                    /* recv memory end                      */
 336                 0x0,                    /* recv memory start                    */
 337                 0x0,                    /* memory end                           */
 338                 0x0,                    /* memory start                         */
 339                 0x0,                    /* base I/O address                     */
 340                 0,                      /* IRQ                                  */
 341                 0, 0, 0,                /* flags                                */
 342                 NEXT_DEV,               /* next device                          */
 343                 tunnel_init             /* Fill in the details                  */
 344         };
 345 
 346         static struct device tunnel_dev0 = 
 347         {
 348                 "tunl0",                /* IPIP tunnel                          */
 349                 0x0,                    /* recv memory end                      */
 350                 0x0,                    /* recv memory start                    */
 351                 0x0,                    /* memory end                           */
 352                 0x0,                    /* memory start                         */
 353                 0x0,                    /* base I/O address                     */
 354                 0,                      /* IRQ                                  */
 355                 0, 0, 0,                /* flags                                */
 356                 &tunnel_dev1,           /* next device                          */
 357                 tunnel_init             /* Fill in the details                  */
 358     };
 359 #   undef       NEXT_DEV
 360 #   define      NEXT_DEV        (&tunnel_dev0)
 361 
 362 #endif 
 363 #endif
 364         
 365 extern int loopback_init(struct device *dev);
 366 struct device loopback_dev = {
 367         "lo",                   /* Software Loopback interface          */
 368         0x0,                    /* recv memory end                      */
 369         0x0,                    /* recv memory start                    */
 370         0x0,                    /* memory end                           */
 371         0x0,                    /* memory start                         */
 372         0,                      /* base I/O address                     */
 373         0,                      /* IRQ                                  */
 374         0, 0, 0,                /* flags                                */
 375         NEXT_DEV,               /* next device                          */
 376         loopback_init           /* loopback_init should set up the rest */
 377 };
 378 
 379 struct device *dev_base = &loopback_dev;

/* [previous][next][first][last][top][bottom][index][help] */