Space.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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
  11. * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  12. * Donald J. Becker, <becker@scyld.com>
  13. *
  14. * Changelog:
  15. * Stephen Hemminger (09/2003)
  16. * - get rid of pre-linked dev list, dynamic device allocation
  17. * Paul Gortmaker (03/2002)
  18. * - struct init cleanup, enable multiple ISA autoprobes.
  19. * Arnaldo Carvalho de Melo <acme@conectiva.com.br> - 09/1999
  20. * - fix sbni: s/device/net_device/
  21. * Paul Gortmaker (06/98):
  22. * - sort probes in a sane way, make sure all (safe) probes
  23. * get run once & failed autoprobes don't autoprobe again.
  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/netdevice.h>
  31. #include <linux/etherdevice.h>
  32. #include <linux/errno.h>
  33. #include <linux/init.h>
  34. #include <linux/netlink.h>
  35. #include <net/Space.h>
  36. /* A unified ethernet device probe. This is the easiest way to have every
  37. ethernet adaptor have the name "eth[0123...]".
  38. */
  39. struct devprobe2 {
  40. struct net_device *(*probe)(int unit);
  41. int status; /* non-zero if autoprobe has failed */
  42. };
  43. static int __init probe_list2(int unit, struct devprobe2 *p, int autoprobe)
  44. {
  45. struct net_device *dev;
  46. for (; p->probe; p++) {
  47. if (autoprobe && p->status)
  48. continue;
  49. dev = p->probe(unit);
  50. if (!IS_ERR(dev))
  51. return 0;
  52. if (autoprobe)
  53. p->status = PTR_ERR(dev);
  54. }
  55. return -ENODEV;
  56. }
  57. /*
  58. * ISA probes that touch addresses < 0x400 (including those that also
  59. * look for EISA/PCI cards in addition to ISA cards).
  60. */
  61. static struct devprobe2 isa_probes[] __initdata = {
  62. #if defined(CONFIG_HP100) && defined(CONFIG_ISA) /* ISA, EISA */
  63. {hp100_probe, 0},
  64. #endif
  65. #ifdef CONFIG_3C515
  66. {tc515_probe, 0},
  67. #endif
  68. #ifdef CONFIG_ULTRA
  69. {ultra_probe, 0},
  70. #endif
  71. #ifdef CONFIG_WD80x3
  72. {wd_probe, 0},
  73. #endif
  74. #if defined(CONFIG_NE2000) /* ISA (use ne2k-pci for PCI cards) */
  75. {ne_probe, 0},
  76. #endif
  77. #ifdef CONFIG_LANCE /* ISA/VLB (use pcnet32 for PCI cards) */
  78. {lance_probe, 0},
  79. #endif
  80. #ifdef CONFIG_SMC9194
  81. {smc_init, 0},
  82. #endif
  83. #ifdef CONFIG_CS89x0
  84. #ifndef CONFIG_CS89x0_PLATFORM
  85. {cs89x0_probe, 0},
  86. #endif
  87. #endif
  88. #if defined(CONFIG_MVME16x_NET) || defined(CONFIG_BVME6000_NET) /* Intel I82596 */
  89. {i82596_probe, 0},
  90. #endif
  91. #ifdef CONFIG_NI65
  92. {ni65_probe, 0},
  93. #endif
  94. {NULL, 0},
  95. };
  96. static struct devprobe2 m68k_probes[] __initdata = {
  97. #ifdef CONFIG_ATARILANCE /* Lance-based Atari ethernet boards */
  98. {atarilance_probe, 0},
  99. #endif
  100. #ifdef CONFIG_SUN3LANCE /* sun3 onboard Lance chip */
  101. {sun3lance_probe, 0},
  102. #endif
  103. #ifdef CONFIG_SUN3_82586 /* sun3 onboard Intel 82586 chip */
  104. {sun3_82586_probe, 0},
  105. #endif
  106. #ifdef CONFIG_APNE /* A1200 PCMCIA NE2000 */
  107. {apne_probe, 0},
  108. #endif
  109. #ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */
  110. {mvme147lance_probe, 0},
  111. #endif
  112. #ifdef CONFIG_MAC8390 /* NuBus NS8390-based cards */
  113. {mac8390_probe, 0},
  114. #endif
  115. #ifdef CONFIG_MAC89x0
  116. {mac89x0_probe, 0},
  117. #endif
  118. {NULL, 0},
  119. };
  120. /*
  121. * Unified ethernet device probe, segmented per architecture and
  122. * per bus interface. This drives the legacy devices only for now.
  123. */
  124. static void __init ethif_probe2(int unit)
  125. {
  126. unsigned long base_addr = netdev_boot_base("eth", unit);
  127. if (base_addr == 1)
  128. return;
  129. (void)( probe_list2(unit, m68k_probes, base_addr == 0) &&
  130. probe_list2(unit, isa_probes, base_addr == 0));
  131. }
  132. /* Statically configured drivers -- order matters here. */
  133. static int __init net_olddevs_init(void)
  134. {
  135. int num;
  136. #ifdef CONFIG_SBNI
  137. for (num = 0; num < 8; ++num)
  138. sbni_probe(num);
  139. #endif
  140. for (num = 0; num < 8; ++num)
  141. ethif_probe2(num);
  142. #ifdef CONFIG_COPS
  143. cops_probe(0);
  144. cops_probe(1);
  145. cops_probe(2);
  146. #endif
  147. #ifdef CONFIG_LTPC
  148. ltpc_probe();
  149. #endif
  150. return 0;
  151. }
  152. device_initcall(net_olddevs_init);