Space.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:20k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  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.  * Version: @(#)Space.c 1.0.7 08/12/93
  9.  *
  10.  * Authors: Ross Biro, <bir7@leland.Stanford.Edu>
  11.  * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  12.  * Donald J. Becker, <becker@scyld.com>
  13.  *
  14.  * Changelog:
  15.  * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 09/1999
  16.  * - fix sbni: s/device/net_device/
  17.  * Paul Gortmaker (06/98): 
  18.  *  - sort probes in a sane way, make sure all (safe) probes
  19.  *    get run once & failed autoprobes don't autoprobe again.
  20.  *
  21.  * FIXME:
  22.  * Phase out placeholder dev entries put in the linked list
  23.  * here in favour of drivers using init_etherdev(NULL, ...)
  24.  * combined with a single find_all_devs() function (for 2.3)
  25.  *
  26.  * This program is free software; you can redistribute it and/or
  27.  * modify it under the terms of the GNU General Public License
  28.  * as published by the Free Software Foundation; either version
  29.  * 2 of the License, or (at your option) any later version.
  30.  */
  31. #include <linux/config.h>
  32. #include <linux/netdevice.h>
  33. #include <linux/errno.h>
  34. #include <linux/init.h>
  35. #include <linux/netlink.h>
  36. #include <linux/divert.h>
  37. #define NEXT_DEV NULL
  38. /* A unified ethernet device probe.  This is the easiest way to have every
  39.    ethernet adaptor have the name "eth[0123...]".
  40.    */
  41. extern int ne2_probe(struct net_device *dev);
  42. extern int hp100_probe(struct net_device *dev);
  43. extern int ultra_probe(struct net_device *dev);
  44. extern int ultra32_probe(struct net_device *dev);
  45. extern int ultramca_probe(struct net_device *dev);
  46. extern int wd_probe(struct net_device *dev);
  47. extern int el2_probe(struct net_device *dev);
  48. extern int ne_probe(struct net_device *dev);
  49. extern int hp_probe(struct net_device *dev);
  50. extern int hp_plus_probe(struct net_device *dev);
  51. extern int znet_probe(struct net_device *);
  52. extern int express_probe(struct net_device *);
  53. extern int eepro_probe(struct net_device *);
  54. extern int el3_probe(struct net_device *);
  55. extern int at1500_probe(struct net_device *);
  56. extern int at1700_probe(struct net_device *);
  57. extern int fmv18x_probe(struct net_device *);
  58. extern int eth16i_probe(struct net_device *);
  59. extern int depca_probe(struct net_device *);
  60. extern int i82596_probe(struct net_device *);
  61. extern int ewrk3_probe(struct net_device *);
  62. extern int de4x5_probe(struct net_device *);
  63. extern int el1_probe(struct net_device *);
  64. extern int wavelan_probe(struct net_device *);
  65. extern int arlan_probe(struct net_device *);
  66. extern int el16_probe(struct net_device *);
  67. extern int elmc_probe(struct net_device *);
  68. extern int skmca_probe(struct net_device *);
  69. extern int elplus_probe(struct net_device *);
  70. extern int ac3200_probe(struct net_device *);
  71. extern int es_probe(struct net_device *);
  72. extern int lne390_probe(struct net_device *);
  73. extern int ne3210_probe(struct net_device *);
  74. extern int e2100_probe(struct net_device *);
  75. extern int ni5010_probe(struct net_device *);
  76. extern int ni52_probe(struct net_device *);
  77. extern int ni65_probe(struct net_device *);
  78. extern int sonic_probe(struct net_device *);
  79. extern int SK_init(struct net_device *);
  80. extern int seeq8005_probe(struct net_device *);
  81. extern int smc_init( struct net_device * );
  82. extern int sgiseeq_probe(struct net_device *);
  83. extern int atarilance_probe(struct net_device *);
  84. extern int sun3lance_probe(struct net_device *);
  85. extern int sun3_82586_probe(struct net_device *);
  86. extern int apne_probe(struct net_device *);
  87. extern int bionet_probe(struct net_device *);
  88. extern int pamsnet_probe(struct net_device *);
  89. extern int cs89x0_probe(struct net_device *dev);
  90. extern int ethertap_probe(struct net_device *dev);
  91. extern int hplance_probe(struct net_device *dev);
  92. extern int bagetlance_probe(struct net_device *);
  93. extern int mvme147lance_probe(struct net_device *dev);
  94. extern int tc515_probe(struct net_device *dev);
  95. extern int lance_probe(struct net_device *dev);
  96. extern int mace_probe(struct net_device *dev);
  97. extern int macsonic_probe(struct net_device *dev);
  98. extern int mac8390_probe(struct net_device *dev);
  99. extern int mac89x0_probe(struct net_device *dev);
  100. extern int mc32_probe(struct net_device *dev);
  101.   
  102. /* Detachable devices ("pocket adaptors") */
  103. extern int de600_probe(struct net_device *);
  104. extern int de620_probe(struct net_device *);
  105. /* FDDI adapters */
  106. extern int skfp_probe(struct net_device *dev);
  107. /* Fibre Channel adapters */
  108. extern int iph5526_probe(struct net_device *dev);
  109. /* SBNI adapters */
  110. extern int sbni_probe(struct net_device *);
  111. struct devprobe
  112. {
  113. int (*probe)(struct net_device *dev);
  114. int status; /* non-zero if autoprobe has failed */
  115. };
  116. /*
  117.  * probe_list walks a list of probe functions and calls each so long
  118.  * as a non-zero ioaddr is given, or as long as it hasn't already failed 
  119.  * to find a card in the past (as recorded by "status") when asked to
  120.  * autoprobe (i.e. a probe that fails to find a card when autoprobing
  121.  * will not be asked to autoprobe again).  It exits when a card is found.
  122.  */
  123. static int __init probe_list(struct net_device *dev, struct devprobe *plist)
  124. {
  125. struct devprobe *p = plist;
  126. unsigned long base_addr = dev->base_addr;
  127. #ifdef CONFIG_NET_DIVERT
  128. int ret;
  129. #endif /* CONFIG_NET_DIVERT */
  130. while (p->probe != NULL) {
  131. if (base_addr && p->probe(dev) == 0) { /* probe given addr */
  132. #ifdef CONFIG_NET_DIVERT
  133. ret = alloc_divert_blk(dev);
  134. if (ret)
  135. return ret;
  136. #endif /* CONFIG_NET_DIVERT */
  137. return 0;
  138. } else if (p->status == 0) { /* has autoprobe failed yet? */
  139. p->status = p->probe(dev); /* no, try autoprobe */
  140. if (p->status == 0) {
  141. #ifdef CONFIG_NET_DIVERT
  142. ret = alloc_divert_blk(dev);
  143. if (ret)
  144. return ret;
  145. #endif /* CONFIG_NET_DIVERT */
  146. return 0;
  147. }
  148. }
  149. p++;
  150. }
  151. return -ENODEV;
  152. }
  153. /*
  154.  * This is a bit of an artificial separation as there are PCI drivers
  155.  * that also probe for EISA cards (in the PCI group) and there are ISA
  156.  * drivers that probe for EISA cards (in the ISA group).  These are the
  157.  * EISA only driver probes, and also the legacy PCI probes
  158.  */
  159. static struct devprobe eisa_probes[] __initdata = {
  160. #ifdef CONFIG_DE4X5             /* DEC DE425, DE434, DE435 adapters */
  161. {de4x5_probe, 0},
  162. #endif
  163. #ifdef CONFIG_ULTRA32 
  164. {ultra32_probe, 0},
  165. #endif
  166. #ifdef CONFIG_AC3200
  167. {ac3200_probe, 0},
  168. #endif
  169. #ifdef CONFIG_ES3210
  170. {es_probe, 0},
  171. #endif
  172. #ifdef CONFIG_LNE390
  173. {lne390_probe, 0},
  174. #endif
  175. #ifdef CONFIG_NE3210
  176. {ne3210_probe, 0},
  177. #endif
  178. {NULL, 0},
  179. };
  180. static struct devprobe mca_probes[] __initdata = {
  181. #ifdef CONFIG_ULTRAMCA 
  182. {ultramca_probe, 0},
  183. #endif
  184. #ifdef CONFIG_NE2_MCA
  185. {ne2_probe, 0},
  186. #endif
  187. #ifdef CONFIG_ELMC /* 3c523 */
  188. {elmc_probe, 0},
  189. #endif
  190. #ifdef CONFIG_ELMC_II /* 3c527 */
  191. {mc32_probe, 0},
  192. #endif
  193. #ifdef CONFIG_SKMC              /* SKnet Microchannel */
  194.         {skmca_probe, 0},
  195. #endif
  196. {NULL, 0},
  197. };
  198. /*
  199.  * ISA probes that touch addresses < 0x400 (including those that also
  200.  * look for EISA/PCI/MCA cards in addition to ISA cards).
  201.  */
  202. static struct devprobe isa_probes[] __initdata = {
  203. #ifdef CONFIG_EL3 /* ISA, EISA, MCA 3c5x9 */
  204. {el3_probe, 0},
  205. #endif
  206. #ifdef CONFIG_HP100  /* ISA, EISA & PCI */
  207. {hp100_probe, 0},
  208. #endif
  209. #ifdef CONFIG_3C515
  210. {tc515_probe, 0},
  211. #endif
  212. #ifdef CONFIG_ULTRA 
  213. {ultra_probe, 0},
  214. #endif
  215. #ifdef CONFIG_WD80x3 
  216. {wd_probe, 0},
  217. #endif
  218. #ifdef CONFIG_EL2  /* 3c503 */
  219. {el2_probe, 0},
  220. #endif
  221. #ifdef CONFIG_HPLAN
  222. {hp_probe, 0},
  223. #endif
  224. #ifdef CONFIG_HPLAN_PLUS
  225. {hp_plus_probe, 0},
  226. #endif
  227. #ifdef CONFIG_E2100 /* Cabletron E21xx series. */
  228. {e2100_probe, 0},
  229. #endif
  230. #ifdef CONFIG_NE2000 /* ISA (use ne2k-pci for PCI cards) */
  231. {ne_probe, 0},
  232. #endif
  233. #ifdef CONFIG_LANCE /* ISA/VLB (use pcnet32 for PCI cards) */
  234. {lance_probe, 0},
  235. #endif
  236. #ifdef CONFIG_SMC9194
  237. {smc_init, 0},
  238. #endif
  239. #ifdef CONFIG_SEEQ8005 
  240. {seeq8005_probe, 0},
  241. #endif
  242. #ifdef CONFIG_AT1500
  243. {at1500_probe, 0},
  244. #endif
  245. #ifdef CONFIG_CS89x0
  246.   {cs89x0_probe, 0},
  247. #endif
  248. #ifdef CONFIG_AT1700
  249. {at1700_probe, 0},
  250. #endif
  251. #ifdef CONFIG_FMV18X /* Fujitsu FMV-181/182 */
  252. {fmv18x_probe, 0},
  253. #endif
  254. #ifdef CONFIG_ETH16I
  255. {eth16i_probe, 0}, /* ICL EtherTeam 16i/32 */
  256. #endif
  257. #ifdef CONFIG_ZNET /* Zenith Z-Note and some IBM Thinkpads. */
  258. {znet_probe, 0},
  259. #endif
  260. #ifdef CONFIG_EEXPRESS /* Intel EtherExpress */
  261. {express_probe, 0},
  262. #endif
  263. #ifdef CONFIG_EEXPRESS_PRO /* Intel EtherExpress Pro/10 */
  264. {eepro_probe, 0},
  265. #endif
  266. #ifdef CONFIG_DEPCA /* DEC DEPCA */
  267. {depca_probe, 0},
  268. #endif
  269. #ifdef CONFIG_EWRK3             /* DEC EtherWORKS 3 */
  270.      {ewrk3_probe, 0},
  271. #endif
  272. #if defined(CONFIG_APRICOT) || defined(CONFIG_MVME16x_NET) || defined(CONFIG_BVME6000_NET) /* Intel I82596 */
  273. {i82596_probe, 0},
  274. #endif
  275. #ifdef CONFIG_EL1 /* 3c501 */
  276. {el1_probe, 0},
  277. #endif
  278. #ifdef CONFIG_WAVELAN /* WaveLAN */
  279. {wavelan_probe, 0},
  280. #endif
  281. #ifdef CONFIG_ARLAN /* Aironet */
  282. {arlan_probe, 0},
  283. #endif
  284. #ifdef CONFIG_EL16 /* 3c507 */
  285. {el16_probe, 0},
  286. #endif
  287. #ifdef CONFIG_ELPLUS /* 3c505 */
  288. {elplus_probe, 0},
  289. #endif
  290. #ifdef CONFIG_SK_G16
  291. {SK_init, 0},
  292. #endif
  293. #ifdef CONFIG_NI5010
  294. {ni5010_probe, 0},
  295. #endif
  296. #ifdef CONFIG_NI52
  297. {ni52_probe, 0},
  298. #endif
  299. #ifdef CONFIG_NI65
  300. {ni65_probe, 0},
  301. #endif
  302. {NULL, 0},
  303. };
  304. static struct devprobe parport_probes[] __initdata = {
  305. #ifdef CONFIG_DE600 /* D-Link DE-600 adapter */
  306. {de600_probe, 0},
  307. #endif
  308. #ifdef CONFIG_DE620 /* D-Link DE-620 adapter */
  309. {de620_probe, 0},
  310. #endif
  311. {NULL, 0},
  312. };
  313. static struct devprobe m68k_probes[] __initdata = {
  314. #ifdef CONFIG_ATARILANCE /* Lance-based Atari ethernet boards */
  315. {atarilance_probe, 0},
  316. #endif
  317. #ifdef CONFIG_SUN3LANCE         /* sun3 onboard Lance chip */
  318. {sun3lance_probe, 0},
  319. #endif
  320. #ifdef CONFIG_SUN3_82586        /* sun3 onboard Intel 82586 chip */
  321. {sun3_82586_probe, 0},
  322. #endif
  323. #ifdef CONFIG_APNE /* A1200 PCMCIA NE2000 */
  324. {apne_probe, 0},
  325. #endif
  326. #ifdef CONFIG_ATARI_BIONET /* Atari Bionet Ethernet board */
  327. {bionet_probe, 0},
  328. #endif
  329. #ifdef CONFIG_ATARI_PAMSNET /* Atari PAMsNet Ethernet board */
  330. {pamsnet_probe, 0},
  331. #endif
  332. #ifdef CONFIG_HPLANCE /* HP300 internal Ethernet */
  333. {hplance_probe, 0},
  334. #endif
  335. #ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */
  336. {mvme147lance_probe, 0},
  337. #endif
  338. #ifdef CONFIG_MACMACE /* Mac 68k Quadra AV builtin Ethernet */
  339. {mace_probe, 0},
  340. #endif
  341. #ifdef CONFIG_MACSONIC /* Mac SONIC-based Ethernet of all sorts */ 
  342. {macsonic_probe, 0},
  343. #endif
  344. #ifdef CONFIG_MAC8390           /* NuBus NS8390-based cards */
  345. {mac8390_probe, 0},
  346. #endif
  347. #ifdef CONFIG_MAC89x0
  348.   {mac89x0_probe, 0},
  349. #endif
  350. {NULL, 0},
  351. };
  352. static struct devprobe sgi_probes[] __initdata = {
  353. #ifdef CONFIG_SGISEEQ
  354. {sgiseeq_probe, 0},
  355. #endif
  356. {NULL, 0},
  357. };
  358. static struct devprobe mips_probes[] __initdata = {
  359. #ifdef CONFIG_MIPS_JAZZ_SONIC
  360. {sonic_probe, 0},
  361. #endif
  362. #ifdef CONFIG_BAGETLANCE        /* Lance-based Baget ethernet boards */
  363.         {bagetlance_probe, 0},
  364. #endif
  365. {NULL, 0},
  366. };
  367. /*
  368.  * Unified ethernet device probe, segmented per architecture and
  369.  * per bus interface. This drives the legacy devices only for now.
  370.  */
  371.  
  372. static int __init ethif_probe(struct net_device *dev)
  373. {
  374. unsigned long base_addr = dev->base_addr;
  375. /* 
  376.  * Backwards compatibility - historically an I/O base of 1 was 
  377.  * used to indicate not to probe for this ethN interface 
  378.  */
  379. if (base_addr == 1)
  380. return 1; /* ENXIO */
  381. /* 
  382.  * The arch specific probes are 1st so that any on-board ethernet
  383.  * will be probed before other ISA/EISA/MCA/PCI bus cards.
  384.  */
  385. if (probe_list(dev, m68k_probes) == 0)
  386. return 0;
  387. if (probe_list(dev, mips_probes) == 0)
  388. return 0;
  389. if (probe_list(dev, sgi_probes) == 0)
  390. return 0;
  391. if (probe_list(dev, eisa_probes) == 0)
  392. return 0;
  393. if (probe_list(dev, mca_probes) == 0)
  394. return 0;
  395.         /*
  396.          * Backwards compatibility - an I/O of 0xffe0 was used to indicate
  397.          * that we shouldn't do a bunch of potentially risky ISA probes
  398.          * for ethN (N>1).  Since the widespread use of modules, *nobody*
  399.          * compiles a kernel with all the ISA drivers built in anymore,
  400.          * and so we should delete this check in linux 2.3 - Paul G.
  401.          */
  402. if (base_addr != 0xffe0 && probe_list(dev, isa_probes) == 0) 
  403. return 0;
  404. if (probe_list(dev, parport_probes) == 0)
  405. return 0;
  406. return -ENODEV;
  407. }
  408. #ifdef CONFIG_FDDI
  409. static int __init fddiif_probe(struct net_device *dev)
  410. {
  411.     unsigned long base_addr = dev->base_addr;
  412.     if (base_addr == 1)
  413.     return 1; /* ENXIO */
  414.     if (1
  415. #ifdef CONFIG_APFDDI
  416. && apfddi_init(dev)
  417. #endif
  418. #ifdef CONFIG_SKFP
  419. && skfp_probe(dev)
  420. #endif
  421. && 1 ) {
  422.     return 1; /* -ENODEV or -EAGAIN would be more accurate. */
  423.     }
  424.     return 0;
  425. }
  426. #endif
  427. #ifdef CONFIG_NET_FC
  428. static int fcif_probe(struct net_device *dev)
  429. {
  430. if (dev->base_addr == -1)
  431. return 1;
  432. if (1
  433. #ifdef CONFIG_IPHASE5526
  434.     && iph5526_probe(dev)
  435. #endif
  436.     && 1 ) {
  437. return 1; /* -ENODEV or -EAGAIN would be more accurate. */
  438. }
  439. return 0;
  440. }
  441. #endif  /* CONFIG_NET_FC */
  442. #ifdef CONFIG_ETHERTAP
  443.     static struct net_device tap0_dev = { "tap0", 0, 0, 0, 0, NETLINK_TAPBASE, 0, 0, 0, 0, NEXT_DEV, ethertap_probe, };
  444. #   undef NEXT_DEV
  445. #   define NEXT_DEV (&tap0_dev)
  446. #endif
  447. #ifdef CONFIG_SDLA
  448.     extern int sdla_init(struct net_device *);
  449.     static struct net_device sdla0_dev = { "sdla0", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, sdla_init, };
  450. #   undef NEXT_DEV
  451. #   define NEXT_DEV (&sdla0_dev)
  452. #endif
  453. #if defined(CONFIG_LTPC)
  454.     extern int ltpc_probe(struct net_device *);
  455.     static struct net_device dev_ltpc = {
  456.         "lt0",
  457.                 0, 0, 0, 0,
  458.                 0x0, 0,
  459.                 0, 0, 0, NEXT_DEV, ltpc_probe };
  460. #   undef NEXT_DEV
  461. #   define NEXT_DEV (&dev_ltpc)
  462. #endif  /* LTPC */
  463. #if defined(CONFIG_COPS)
  464.     extern int cops_probe(struct net_device *);
  465.     static struct net_device cops2_dev = { "lt2", 0, 0, 0, 0, 0x0, 0, 0, 0, 0, NEXT_DEV, cops_probe };
  466.     static struct net_device cops1_dev = { "lt1", 0, 0, 0, 0, 0x0, 0, 0, 0, 0, &cops2_dev, cops_probe };
  467.     static struct net_device cops0_dev = { "lt0", 0, 0, 0, 0, 0x0, 0, 0, 0, 0, &cops1_dev, cops_probe };
  468. #   undef NEXT_DEV
  469. #   define NEXT_DEV     (&cops0_dev)
  470. #endif  /* COPS */
  471. /* The first device defaults to I/O base '0', which means autoprobe. */
  472. #ifndef ETH0_ADDR
  473. # define ETH0_ADDR 0
  474. #endif
  475. #ifndef ETH0_IRQ
  476. # define ETH0_IRQ 0
  477. #endif
  478. /* "eth0" defaults to autoprobe (== 0), other use a base of 0xffe0 (== -0x20),
  479.    which means "don't do ISA probes".  Distributions don't ship kernels with
  480.    all ISA drivers compiled in anymore, so its probably no longer an issue. */
  481. #define ETH_NOPROBE_ADDR 0xffe0
  482. static struct net_device eth7_dev = {
  483.     "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, NEXT_DEV, ethif_probe };
  484. static struct net_device eth6_dev = {
  485.     "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, &eth7_dev, ethif_probe };
  486. static struct net_device eth5_dev = {
  487.     "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, &eth6_dev, ethif_probe };
  488. static struct net_device eth4_dev = {
  489.     "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, &eth5_dev, ethif_probe };
  490. static struct net_device eth3_dev = {
  491.     "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, &eth4_dev, ethif_probe };
  492. static struct net_device eth2_dev = {
  493.     "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, &eth3_dev, ethif_probe };
  494. static struct net_device eth1_dev = {
  495.     "eth%d", 0,0,0,0,ETH_NOPROBE_ADDR /* I/O base*/, 0,0,0,0, &eth2_dev, ethif_probe };
  496. static struct net_device eth0_dev = {
  497.     "eth%d", 0, 0, 0, 0, ETH0_ADDR, ETH0_IRQ, 0, 0, 0, &eth1_dev, ethif_probe };
  498. #   undef NEXT_DEV
  499. #   define NEXT_DEV (&eth0_dev)
  500. #ifdef CONFIG_TR
  501. /* Token-ring device probe */
  502. extern int ibmtr_probe(struct net_device *);
  503. extern int smctr_probe(struct net_device *);
  504. static int
  505. trif_probe(struct net_device *dev)
  506. {
  507.     if (1
  508. #ifdef CONFIG_IBMTR
  509. && ibmtr_probe(dev)
  510. #endif
  511. #ifdef CONFIG_SMCTR
  512. && smctr_probe(dev)
  513. #endif
  514. && 1 ) {
  515. return 1; /* -ENODEV or -EAGAIN would be more accurate. */
  516.     }
  517.     return 0;
  518. }
  519. static struct net_device tr7_dev = {
  520.     "tr%d",0,0,0,0,0,0,0,0,0, NEXT_DEV, trif_probe };
  521. static struct net_device tr6_dev = {
  522.     "tr%d",0,0,0,0,0,0,0,0,0, &tr7_dev, trif_probe };
  523. static struct net_device tr5_dev = {
  524.     "tr%d",0,0,0,0,0,0,0,0,0, &tr6_dev, trif_probe };
  525. static struct net_device tr4_dev = {
  526.     "tr%d",0,0,0,0,0,0,0,0,0, &tr5_dev, trif_probe };
  527. static struct net_device tr3_dev = {
  528.     "tr%d",0,0,0,0,0,0,0,0,0, &tr4_dev, trif_probe };
  529. static struct net_device tr2_dev = {
  530.     "tr%d",0,0,0,0,0,0,0,0,0, &tr3_dev, trif_probe };
  531. static struct net_device tr1_dev = {
  532.     "tr%d",0,0,0,0,0,0,0,0,0, &tr2_dev, trif_probe };
  533. static struct net_device tr0_dev = {
  534.     "tr%d",0,0,0,0,0,0,0,0,0, &tr1_dev, trif_probe };
  535. #   undef       NEXT_DEV
  536. #   define      NEXT_DEV        (&tr0_dev)
  537. #endif 
  538. #ifdef CONFIG_FDDI
  539. static struct net_device fddi7_dev =
  540. {"fddi7", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, fddiif_probe};
  541. static struct net_device fddi6_dev =
  542. {"fddi6", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi7_dev, fddiif_probe};
  543. static struct net_device fddi5_dev =
  544. {"fddi5", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi6_dev, fddiif_probe};
  545. static struct net_device fddi4_dev =
  546. {"fddi4", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi5_dev, fddiif_probe};
  547. static struct net_device fddi3_dev =
  548. {"fddi3", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi4_dev, fddiif_probe};
  549. static struct net_device fddi2_dev =
  550. {"fddi2", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi3_dev, fddiif_probe};
  551. static struct net_device fddi1_dev =
  552. {"fddi1", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi2_dev, fddiif_probe};
  553. static struct net_device fddi0_dev =
  554. {"fddi0", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fddi1_dev, fddiif_probe};
  555. #undef NEXT_DEV
  556. #define NEXT_DEV (&fddi0_dev)
  557. #endif 
  558. #ifdef CONFIG_NET_FC
  559.     static struct net_device fc1_dev = {
  560.         "fc1", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, fcif_probe};
  561. static struct net_device fc0_dev = {
  562. "fc0", 0, 0, 0, 0, 0, 0, 0, 0, 0, &fc1_dev, fcif_probe};
  563. #   undef       NEXT_DEV
  564. #   define      NEXT_DEV        (&fc0_dev)
  565. #endif
  566. #ifdef CONFIG_SBNI
  567. static struct net_device sbni7_dev =
  568. {"sbni7", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, sbni_probe};
  569. static struct net_device sbni6_dev =
  570. {"sbni6", 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni7_dev, sbni_probe};
  571. static struct net_device sbni5_dev =
  572. {"sbni5", 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni6_dev, sbni_probe};
  573. static struct net_device sbni4_dev =
  574. {"sbni4", 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni5_dev, sbni_probe};
  575. static struct net_device sbni3_dev =
  576. {"sbni3", 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni4_dev, sbni_probe};
  577. static struct net_device sbni2_dev =
  578. {"sbni2", 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni3_dev, sbni_probe};
  579. static struct net_device sbni1_dev =
  580. {"sbni1", 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni2_dev, sbni_probe};
  581. static struct net_device sbni0_dev =
  582. {"sbni0", 0, 0, 0, 0, 0, 0, 0, 0, 0, &sbni1_dev, sbni_probe};
  583. #undef NEXT_DEV
  584. #define NEXT_DEV (&sbni0_dev)
  585. #endif 
  586. /*
  587.  * The loopback device is global so it can be directly referenced
  588.  * by the network code. Also, it must be first on device list.
  589.  */
  590. extern int loopback_init(struct net_device *dev);
  591. struct net_device loopback_dev = 
  592. {"lo", 0, 0, 0, 0, 0, 0, 0, 0, 0, NEXT_DEV, loopback_init};
  593. /*
  594.  * The @dev_base list is protected by @dev_base_lock and the rtln
  595.  * semaphore.
  596.  *
  597.  * Pure readers hold dev_base_lock for reading.
  598.  *
  599.  * Writers must hold the rtnl semaphore while they loop through the
  600.  * dev_base list, and hold dev_base_lock for writing when they do the
  601.  * actual updates.  This allows pure readers to access the list even
  602.  * while a writer is preparing to update it.
  603.  *
  604.  * To put it another way, dev_base_lock is held for writing only to
  605.  * protect against pure readers; the rtnl semaphore provides the
  606.  * protection against other writers.
  607.  *
  608.  * See, for example usages, register_netdevice() and
  609.  * unregister_netdevice(), which must be called with the rtnl
  610.  * semaphore held.
  611.  */
  612. struct net_device *dev_base = &loopback_dev;
  613. rwlock_t dev_base_lock = RW_LOCK_UNLOCKED;