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