Space.c 18.4 KB
Newer Older
Linus Torvalds's avatar
Linus Torvalds committed
1 2 3 4 5 6 7 8 9 10 11
/*
 * INET		An implementation of the TCP/IP protocol suite for the LINUX
 *		operating system.  INET is implemented using the  BSD Socket
 *		interface as the means of communication with the user level.
 *
 *		Holds initial configuration information for devices.
 *
 * Version:	@(#)Space.c	1.0.7	08/12/93
 *
 * Authors:	Ross Biro, <bir7@leland.Stanford.Edu>
 *		Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
Linus Torvalds's avatar
Linus Torvalds committed
12
 *		Donald J. Becker, <becker@scyld.com>
Linus Torvalds's avatar
Linus Torvalds committed
13 14
 *
 * Changelog:
15 16
 *		Paul Gortmaker (03/2002)
		- struct init cleanup, enable multiple ISA autoprobes.
Linus Torvalds's avatar
Linus Torvalds committed
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
 *		Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 09/1999
 *		- fix sbni: s/device/net_device/
 *		Paul Gortmaker (06/98): 
 *		 - sort probes in a sane way, make sure all (safe) probes
 *		   get run once & failed autoprobes don't autoprobe again.
 *
 *	FIXME:
 *		Phase out placeholder dev entries put in the linked list
 *		here in favour of drivers using init_etherdev(NULL, ...)
 *		combined with a single find_all_devs() function (for 2.3)
 *
 *		This program is free software; you can redistribute it and/or
 *		modify it under the terms of the GNU General Public License
 *		as published by the Free Software Foundation; either version
 *		2 of the License, or (at your option) any later version.
 */
#include <linux/config.h>
#include <linux/netdevice.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/netlink.h>
#include <linux/divert.h>

#define	NEXT_DEV	NULL


/* A unified ethernet device probe.  This is the easiest way to have every
   ethernet adaptor have the name "eth[0123...]".
   */

extern int ne2_probe(struct net_device *dev);
extern int hp100_probe(struct net_device *dev);
extern int ultra_probe(struct net_device *dev);
extern int ultra32_probe(struct net_device *dev);
extern int ultramca_probe(struct net_device *dev);
extern int wd_probe(struct net_device *dev);
extern int el2_probe(struct net_device *dev);
extern int ne_probe(struct net_device *dev);
extern int hp_probe(struct net_device *dev);
extern int hp_plus_probe(struct net_device *dev);
extern int znet_probe(struct net_device *);
extern int express_probe(struct net_device *);
extern int eepro_probe(struct net_device *);
extern int el3_probe(struct net_device *);
extern int at1500_probe(struct net_device *);
extern int at1700_probe(struct net_device *);
extern int fmv18x_probe(struct net_device *);
extern int eth16i_probe(struct net_device *);
extern int depca_probe(struct net_device *);
extern int i82596_probe(struct net_device *);
extern int ewrk3_probe(struct net_device *);
extern int de4x5_probe(struct net_device *);
extern int el1_probe(struct net_device *);
extern int wavelan_probe(struct net_device *);
extern int arlan_probe(struct net_device *);
extern int el16_probe(struct net_device *);
extern int elmc_probe(struct net_device *);
extern int skmca_probe(struct net_device *);
extern int elplus_probe(struct net_device *);
extern int ac3200_probe(struct net_device *);
extern int es_probe(struct net_device *);
extern int lne390_probe(struct net_device *);
extern int ne3210_probe(struct net_device *);
extern int e2100_probe(struct net_device *);
extern int ni5010_probe(struct net_device *);
extern int ni52_probe(struct net_device *);
extern int ni65_probe(struct net_device *);
extern int sonic_probe(struct net_device *);
extern int SK_init(struct net_device *);
extern int seeq8005_probe(struct net_device *);
extern int smc_init( struct net_device * );
extern int sgiseeq_probe(struct net_device *);
extern int atarilance_probe(struct net_device *);
extern int sun3lance_probe(struct net_device *);
91
extern int sun3_82586_probe(struct net_device *);
Linus Torvalds's avatar
Linus Torvalds committed
92 93 94 95 96 97 98 99 100 101
extern int apne_probe(struct net_device *);
extern int bionet_probe(struct net_device *);
extern int pamsnet_probe(struct net_device *);
extern int cs89x0_probe(struct net_device *dev);
extern int ethertap_probe(struct net_device *dev);
extern int hplance_probe(struct net_device *dev);
extern int bagetlance_probe(struct net_device *);
extern int mvme147lance_probe(struct net_device *dev);
extern int tc515_probe(struct net_device *dev);
extern int lance_probe(struct net_device *dev);
102
extern int mace_probe(struct net_device *dev);
Linus Torvalds's avatar
Linus Torvalds committed
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
extern int macsonic_probe(struct net_device *dev);
extern int mac8390_probe(struct net_device *dev);
extern int mac89x0_probe(struct net_device *dev);
extern int mc32_probe(struct net_device *dev);
  
/* Detachable devices ("pocket adaptors") */
extern int de600_probe(struct net_device *);
extern int de620_probe(struct net_device *);

/* FDDI adapters */
extern int skfp_probe(struct net_device *dev);

/* Fibre Channel adapters */
extern int iph5526_probe(struct net_device *dev);

/* SBNI adapters */
extern int sbni_probe(struct net_device *);

struct devprobe
{
	int (*probe)(struct net_device *dev);
	int status;	/* non-zero if autoprobe has failed */
};

/*
 * probe_list walks a list of probe functions and calls each so long
 * as a non-zero ioaddr is given, or as long as it hasn't already failed 
 * to find a card in the past (as recorded by "status") when asked to
 * autoprobe (i.e. a probe that fails to find a card when autoprobing
 * will not be asked to autoprobe again).  It exits when a card is found.
 */
static int __init probe_list(struct net_device *dev, struct devprobe *plist)
{
	struct devprobe *p = plist;
	unsigned long base_addr = dev->base_addr;
#ifdef CONFIG_NET_DIVERT
	int ret;
#endif /* CONFIG_NET_DIVERT */

	while (p->probe != NULL) {
		if (base_addr && p->probe(dev) == 0) {	/* probe given addr */
#ifdef CONFIG_NET_DIVERT
			ret = alloc_divert_blk(dev);
			if (ret)
				return ret;
#endif /* CONFIG_NET_DIVERT */
			return 0;
		} else if (p->status == 0) {		/* has autoprobe failed yet? */
			p->status = p->probe(dev);	/* no, try autoprobe */
			if (p->status == 0) {
#ifdef CONFIG_NET_DIVERT
				ret = alloc_divert_blk(dev);
				if (ret)
					return ret;
#endif /* CONFIG_NET_DIVERT */
				return 0;
			}
		}
		p++;
	}
	return -ENODEV;
}

/*
 * This is a bit of an artificial separation as there are PCI drivers
 * that also probe for EISA cards (in the PCI group) and there are ISA
 * drivers that probe for EISA cards (in the ISA group).  These are the
 * EISA only driver probes, and also the legacy PCI probes
 */
Linus Torvalds's avatar
Linus Torvalds committed
172
static struct devprobe eisa_probes[] __initdata = {
Linus Torvalds's avatar
Linus Torvalds committed
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
#ifdef CONFIG_DE4X5             /* DEC DE425, DE434, DE435 adapters */
	{de4x5_probe, 0},
#endif
#ifdef CONFIG_ULTRA32 
	{ultra32_probe, 0},	
#endif
#ifdef CONFIG_AC3200	
	{ac3200_probe, 0},
#endif
#ifdef CONFIG_ES3210
	{es_probe, 0},
#endif
#ifdef CONFIG_LNE390
	{lne390_probe, 0},
#endif
#ifdef CONFIG_NE3210
	{ne3210_probe, 0},
#endif
	{NULL, 0},
};


Linus Torvalds's avatar
Linus Torvalds committed
195
static struct devprobe mca_probes[] __initdata = {
Linus Torvalds's avatar
Linus Torvalds committed
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
#ifdef CONFIG_ULTRAMCA 
	{ultramca_probe, 0},
#endif
#ifdef CONFIG_NE2_MCA
	{ne2_probe, 0},
#endif
#ifdef CONFIG_ELMC		/* 3c523 */
	{elmc_probe, 0},
#endif
#ifdef CONFIG_ELMC_II		/* 3c527 */
	{mc32_probe, 0},
#endif
#ifdef CONFIG_SKMC              /* SKnet Microchannel */
        {skmca_probe, 0},
#endif
	{NULL, 0},
};

/*
 * ISA probes that touch addresses < 0x400 (including those that also
 * look for EISA/PCI/MCA cards in addition to ISA cards).
 */
Linus Torvalds's avatar
Linus Torvalds committed
218
static struct devprobe isa_probes[] __initdata = {
Linus Torvalds's avatar
Linus Torvalds committed
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
#ifdef CONFIG_EL3		/* ISA, EISA, MCA 3c5x9 */
	{el3_probe, 0},
#endif
#ifdef CONFIG_HP100 		/* ISA, EISA & PCI */
	{hp100_probe, 0},
#endif	
#ifdef CONFIG_3C515
	{tc515_probe, 0},
#endif
#ifdef CONFIG_ULTRA 
	{ultra_probe, 0},
#endif
#ifdef CONFIG_WD80x3 
	{wd_probe, 0},
#endif
#ifdef CONFIG_EL2 		/* 3c503 */
	{el2_probe, 0},
#endif
#ifdef CONFIG_HPLAN
	{hp_probe, 0},
#endif
#ifdef CONFIG_HPLAN_PLUS
	{hp_plus_probe, 0},
#endif
#ifdef CONFIG_E2100		/* Cabletron E21xx series. */
	{e2100_probe, 0},
#endif
#ifdef CONFIG_NE2000		/* ISA (use ne2k-pci for PCI cards) */
	{ne_probe, 0},
#endif
#ifdef CONFIG_LANCE		/* ISA/VLB (use pcnet32 for PCI cards) */
	{lance_probe, 0},
#endif
#ifdef CONFIG_SMC9194
	{smc_init, 0},
#endif
#ifdef CONFIG_SEEQ8005 
	{seeq8005_probe, 0},
#endif
#ifdef CONFIG_AT1500
	{at1500_probe, 0},
#endif
#ifdef CONFIG_CS89x0
 	{cs89x0_probe, 0},
#endif
#ifdef CONFIG_AT1700
	{at1700_probe, 0},
#endif
#ifdef CONFIG_FMV18X		/* Fujitsu FMV-181/182 */
	{fmv18x_probe, 0},
#endif
#ifdef CONFIG_ETH16I
	{eth16i_probe, 0},	/* ICL EtherTeam 16i/32 */
#endif
#ifdef CONFIG_ZNET		/* Zenith Z-Note and some IBM Thinkpads. */
	{znet_probe, 0},
#endif
#ifdef CONFIG_EEXPRESS		/* Intel EtherExpress */
	{express_probe, 0},
#endif
#ifdef CONFIG_EEXPRESS_PRO	/* Intel EtherExpress Pro/10 */
	{eepro_probe, 0},
#endif
#ifdef CONFIG_DEPCA		/* DEC DEPCA */
	{depca_probe, 0},
#endif
#ifdef CONFIG_EWRK3             /* DEC EtherWORKS 3 */
    	{ewrk3_probe, 0},
#endif
#if defined(CONFIG_APRICOT) || defined(CONFIG_MVME16x_NET) || defined(CONFIG_BVME6000_NET)	/* Intel I82596 */
	{i82596_probe, 0},
#endif
#ifdef CONFIG_EL1		/* 3c501 */
	{el1_probe, 0},
#endif
#ifdef CONFIG_WAVELAN		/* WaveLAN */
	{wavelan_probe, 0},
#endif
#ifdef CONFIG_ARLAN		/* Aironet */
	{arlan_probe, 0},
#endif
#ifdef CONFIG_EL16		/* 3c507 */
	{el16_probe, 0},
#endif
#ifdef CONFIG_ELPLUS		/* 3c505 */
	{elplus_probe, 0},
#endif
#ifdef CONFIG_SK_G16
	{SK_init, 0},
#endif
#ifdef CONFIG_NI5010
	{ni5010_probe, 0},
#endif
#ifdef CONFIG_NI52
	{ni52_probe, 0},
#endif
#ifdef CONFIG_NI65
	{ni65_probe, 0},
#endif
	{NULL, 0},
};

Linus Torvalds's avatar
Linus Torvalds committed
321
static struct devprobe parport_probes[] __initdata = {
Linus Torvalds's avatar
Linus Torvalds committed
322 323 324 325 326 327 328 329 330
#ifdef CONFIG_DE600		/* D-Link DE-600 adapter */
	{de600_probe, 0},
#endif
#ifdef CONFIG_DE620		/* D-Link DE-620 adapter */
	{de620_probe, 0},
#endif
	{NULL, 0},
};

Linus Torvalds's avatar
Linus Torvalds committed
331
static struct devprobe m68k_probes[] __initdata = {
Linus Torvalds's avatar
Linus Torvalds committed
332 333 334 335 336 337
#ifdef CONFIG_ATARILANCE	/* Lance-based Atari ethernet boards */
	{atarilance_probe, 0},
#endif
#ifdef CONFIG_SUN3LANCE         /* sun3 onboard Lance chip */
	{sun3lance_probe, 0},
#endif
338 339 340
#ifdef CONFIG_SUN3_82586        /* sun3 onboard Intel 82586 chip */
	{sun3_82586_probe, 0},
#endif
Linus Torvalds's avatar
Linus Torvalds committed
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356
#ifdef CONFIG_APNE		/* A1200 PCMCIA NE2000 */
	{apne_probe, 0},
#endif
#ifdef CONFIG_ATARI_BIONET	/* Atari Bionet Ethernet board */
	{bionet_probe, 0},
#endif
#ifdef CONFIG_ATARI_PAMSNET	/* Atari PAMsNet Ethernet board */
	{pamsnet_probe, 0},
#endif
#ifdef CONFIG_HPLANCE		/* HP300 internal Ethernet */
	{hplance_probe, 0},
#endif
#ifdef CONFIG_MVME147_NET	/* MVME147 internal Ethernet */
	{mvme147lance_probe, 0},
#endif
#ifdef CONFIG_MACMACE		/* Mac 68k Quadra AV builtin Ethernet */
357
	{mace_probe, 0},
Linus Torvalds's avatar
Linus Torvalds committed
358 359 360 361 362 363 364 365 366 367 368 369 370 371
#endif
#ifdef CONFIG_MACSONIC		/* Mac SONIC-based Ethernet of all sorts */ 
	{macsonic_probe, 0},
#endif
#ifdef CONFIG_MAC8390           /* NuBus NS8390-based cards */
	{mac8390_probe, 0},
#endif
#ifdef CONFIG_MAC89x0
 	{mac89x0_probe, 0},
#endif
	{NULL, 0},
};


Linus Torvalds's avatar
Linus Torvalds committed
372
static struct devprobe sgi_probes[] __initdata = {
Linus Torvalds's avatar
Linus Torvalds committed
373 374 375 376 377 378
#ifdef CONFIG_SGISEEQ
	{sgiseeq_probe, 0},
#endif
	{NULL, 0},
};

Linus Torvalds's avatar
Linus Torvalds committed
379
static struct devprobe mips_probes[] __initdata = {
Linus Torvalds's avatar
Linus Torvalds committed
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418
#ifdef CONFIG_MIPS_JAZZ_SONIC
	{sonic_probe, 0},
#endif
#ifdef CONFIG_BAGETLANCE        /* Lance-based Baget ethernet boards */
        {bagetlance_probe, 0},
#endif
	{NULL, 0},
};

/*
 * Unified ethernet device probe, segmented per architecture and
 * per bus interface. This drives the legacy devices only for now.
 */
 
static int __init ethif_probe(struct net_device *dev)
{
	unsigned long base_addr = dev->base_addr;

	/* 
	 * Backwards compatibility - historically an I/O base of 1 was 
	 * used to indicate not to probe for this ethN interface 
	 */
	if (base_addr == 1)
		return 1;		/* ENXIO */

	/* 
	 * The arch specific probes are 1st so that any on-board ethernet
	 * will be probed before other ISA/EISA/MCA/PCI bus cards.
	 */
	if (probe_list(dev, m68k_probes) == 0)
		return 0;
	if (probe_list(dev, mips_probes) == 0)
		return 0;
	if (probe_list(dev, sgi_probes) == 0)
		return 0;
	if (probe_list(dev, eisa_probes) == 0)
		return 0;
	if (probe_list(dev, mca_probes) == 0)
		return 0;
419
	if (probe_list(dev, isa_probes) == 0) 
Linus Torvalds's avatar
Linus Torvalds committed
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
		return 0;
	if (probe_list(dev, parport_probes) == 0)
		return 0;
	return -ENODEV;
}

#ifdef CONFIG_FDDI
static int __init fddiif_probe(struct net_device *dev)
{
    unsigned long base_addr = dev->base_addr;

    if (base_addr == 1)
	    return 1;		/* ENXIO */

    if (1
#ifdef CONFIG_APFDDI
	&& apfddi_init(dev)
#endif
#ifdef CONFIG_SKFP
	&& skfp_probe(dev)
#endif
	&& 1 ) {
	    return 1;	/* -ENODEV or -EAGAIN would be more accurate. */
    }
    return 0;
}
#endif


#ifdef CONFIG_NET_FC
static int fcif_probe(struct net_device *dev)
{
	if (dev->base_addr == -1)
		return 1;

	if (1
#ifdef CONFIG_IPHASE5526
	    && iph5526_probe(dev)
#endif
	    && 1 ) {
		return 1; /* -ENODEV or -EAGAIN would be more accurate. */
	}
	return 0;
}
#endif  /* CONFIG_NET_FC */


#ifdef CONFIG_ETHERTAP
468 469 470 471 472 473 474 475
static struct net_device tap0_dev = {
	name:		"tap0",
	base_addr:	NETLINK_TAPBASE,
	next:		NEXT_DEV,
	init:		ethertap_probe,
};
#undef NEXT_DEV
#define NEXT_DEV	(&tap0_dev)
Linus Torvalds's avatar
Linus Torvalds committed
476 477 478
#endif

#ifdef CONFIG_SDLA
479 480 481 482 483 484 485 486
extern int sdla_init(struct net_device *);
static struct net_device sdla0_dev = {
	name:		 "sdla0",
	next:		 NEXT_DEV,
	init:		 sdla_init,
};
#undef NEXT_DEV
#define NEXT_DEV	(&sdla0_dev)
Linus Torvalds's avatar
Linus Torvalds committed
487 488 489
#endif

#if defined(CONFIG_LTPC)
490 491 492 493 494 495 496 497
extern int ltpc_probe(struct net_device *);
static struct net_device dev_ltpc = {
	name:		"lt0",
	next:		NEXT_DEV,
	init:		ltpc_probe
};
#undef NEXT_DEV
#define NEXT_DEV	(&dev_ltpc)
Linus Torvalds's avatar
Linus Torvalds committed
498 499 500
#endif  /* LTPC */

#if defined(CONFIG_COPS)
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518
extern int cops_probe(struct net_device *);
static struct net_device cops2_dev = {
	name:		"lt2",
	next:		NEXT_DEV,
	init:		cops_probe,
};
static struct net_device cops1_dev = {
	name:		"lt1",
	next:		&cops2_dev,
	init:		cops_probe,
};
static struct net_device cops0_dev = {
	name:		"lt0",
	next:		&cops1_dev,
	init:		cops_probe,
};
#undef NEXT_DEV
#define NEXT_DEV     (&cops0_dev)
Linus Torvalds's avatar
Linus Torvalds committed
519 520 521
#endif  /* COPS */

static struct net_device eth7_dev = {
522 523 524 525
	name:		"eth%d",
	next:		NEXT_DEV,
	init:		ethif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
526
static struct net_device eth6_dev = {
527 528 529 530
	name:		"eth%d",
	next:		&eth7_dev,
	init:		ethif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
531
static struct net_device eth5_dev = {
532 533 534 535
	name:		"eth%d",
	next:		&eth6_dev,
	init:		ethif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
536
static struct net_device eth4_dev = {
537 538 539 540
	name:		"eth%d",
	next:		&eth5_dev,
	init:		ethif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
541
static struct net_device eth3_dev = {
542 543 544 545
	name:		"eth%d",
	next:		&eth4_dev,
	init:		ethif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
546
static struct net_device eth2_dev = {
547 548 549 550
	name:		"eth%d",
	next:		&eth3_dev,
	init:		ethif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
551
static struct net_device eth1_dev = {
552 553 554 555
	name:		"eth%d",
	next:		&eth2_dev,
	init:		ethif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
556
static struct net_device eth0_dev = {
557 558 559 560
	name:		"eth%d",
	next:		&eth1_dev,
	init:		ethif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
561

562 563
#undef NEXT_DEV
#define NEXT_DEV	(&eth0_dev)
Linus Torvalds's avatar
Linus Torvalds committed
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587



#ifdef CONFIG_TR
/* Token-ring device probe */
extern int ibmtr_probe(struct net_device *);
extern int smctr_probe(struct net_device *);

static int
trif_probe(struct net_device *dev)
{
    if (1
#ifdef CONFIG_IBMTR
	&& ibmtr_probe(dev)
#endif
#ifdef CONFIG_SMCTR
	&& smctr_probe(dev)
#endif
	&& 1 ) {
	return 1;	/* -ENODEV or -EAGAIN would be more accurate. */
    }
    return 0;
}
static struct net_device tr7_dev = {
588 589 590 591
	name:		"tr%d",
	next:		NEXT_DEV,
	init:		trif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
592
static struct net_device tr6_dev = {
593 594 595 596
	name:		"tr%d",
	next:		&tr7_dev,
	init:		trif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
597
static struct net_device tr5_dev = {
598 599 600 601
	name:		"tr%d",
	next:		&tr6_dev,
	init:		trif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
602
static struct net_device tr4_dev = {
603 604 605 606
	name:		"tr%d",
	next:		&tr5_dev,
	init:		trif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
607
static struct net_device tr3_dev = {
608 609 610 611
	name:		"tr%d",
	next:		&tr4_dev,
	init:		trif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
612
static struct net_device tr2_dev = {
613 614 615 616
	name:		"tr%d",
	next:		&tr3_dev,
	init:		trif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
617
static struct net_device tr1_dev = {
618 619 620 621
	name:		"tr%d",
	next:		&tr2_dev,
	init:		trif_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
622
static struct net_device tr0_dev = {
623 624 625 626 627 628
	name:		"tr%d",
	next:		&tr1_dev,
	init:		trif_probe,
};
#undef       NEXT_DEV
#define      NEXT_DEV        (&tr0_dev)
Linus Torvalds's avatar
Linus Torvalds committed
629 630 631 632

#endif 

#ifdef CONFIG_FDDI
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672
static struct net_device fddi7_dev = {
	name:		"fddi7",
	next:		 NEXT_DEV,
	init:		fddiif_probe
};
static struct net_device fddi6_dev = {
	name:		"fddi6",
	next:		&fddi7_dev,
	init:		fddiif_probe
};
static struct net_device fddi5_dev = {
	name:		"fddi5",
	next:		&fddi6_dev,
	init:		fddiif_probe
};
static struct net_device fddi4_dev = {
	name:		"fddi4",
	next:		&fddi5_dev,
	init:		fddiif_probe
};
static struct net_device fddi3_dev = {
	name:		"fddi3",
	next:		&fddi4_dev,
	init:		fddiif_probe
};
static struct net_device fddi2_dev = {
	name:		"fddi2",
	next:		&fddi3_dev,
	init:		fddiif_probe
};
static struct net_device fddi1_dev = {
	name:		"fddi1",
	next:		&fddi2_dev,
	init:		fddiif_probe
};
static struct net_device fddi0_dev = {
	name:		"fddi0",
	next:		&fddi1_dev,
	init:		fddiif_probe
};
Linus Torvalds's avatar
Linus Torvalds committed
673 674 675 676 677 678
#undef	NEXT_DEV
#define	NEXT_DEV	(&fddi0_dev)
#endif 


#ifdef CONFIG_NET_FC
679 680 681 682 683 684 685 686 687 688 689 690
static struct net_device fc1_dev = {
	name:		"fc1",
	next:		NEXT_DEV,
	init:		fcif_probe
};
static struct net_device fc0_dev = {
	name:		"fc0",
	next:		 &fc1_dev,
	init:		fcif_probe
};
#undef       NEXT_DEV
#define      NEXT_DEV        (&fc0_dev)
Linus Torvalds's avatar
Linus Torvalds committed
691 692 693 694
#endif


#ifdef CONFIG_SBNI
695 696 697 698 699
static struct net_device sbni7_dev = {
	name:		"sbni7",
	next:		NEXT_DEV,
	init:		sbni_probe,
};
700
static struct net_device sbni6_dev = {
701 702 703 704
	name:		"sbni6",
	next:		&sbni7_dev,
	init:		sbni_probe,
};
705
static struct net_device sbni5_dev = {
706 707 708 709
	name:		"sbni5",
	next:		&sbni6_dev,
	init:		sbni_probe,
};
710
static struct net_device sbni4_dev = {
711 712 713 714
	name:		"sbni4",
	next:		&sbni5_dev,
	init:		sbni_probe,
};
715
static struct net_device sbni3_dev = {
716 717 718 719
	name:		"sbni3",
	next:		&sbni4_dev,
	init:		sbni_probe,
};
720
static struct net_device sbni2_dev = {
721 722 723 724
	name:		"sbni2",
	next:		&sbni3_dev,
	init:		sbni_probe,
};
725
static struct net_device sbni1_dev = {
726 727 728 729
	name:		"sbni1",
	next:		&sbni2_dev,
	init:		sbni_probe,
};
730
static struct net_device sbni0_dev = {
731 732 733 734
	name:		"sbni0",
	next:		&sbni1_dev,
	init:		sbni_probe,
};
Linus Torvalds's avatar
Linus Torvalds committed
735 736 737 738 739 740 741 742 743 744 745

#undef	NEXT_DEV
#define	NEXT_DEV	(&sbni0_dev)
#endif 
	
/*
 *	The loopback device is global so it can be directly referenced
 *	by the network code. Also, it must be first on device list.
 */

extern int loopback_init(struct net_device *dev);
746 747 748 749 750
struct net_device loopback_dev = {
	name:		"lo",
	next:		NEXT_DEV,
	init:		loopback_init
};
Linus Torvalds's avatar
Linus Torvalds committed
751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773

/*
 * The @dev_base list is protected by @dev_base_lock and the rtln
 * semaphore.
 *
 * Pure readers hold dev_base_lock for reading.
 *
 * Writers must hold the rtnl semaphore while they loop through the
 * dev_base list, and hold dev_base_lock for writing when they do the
 * actual updates.  This allows pure readers to access the list even
 * while a writer is preparing to update it.
 *
 * To put it another way, dev_base_lock is held for writing only to
 * protect against pure readers; the rtnl semaphore provides the
 * protection against other writers.
 *
 * See, for example usages, register_netdevice() and
 * unregister_netdevice(), which must be called with the rtnl
 * semaphore held.
 */
struct net_device *dev_base = &loopback_dev;
rwlock_t dev_base_lock = RW_LOCK_UNLOCKED;