Space.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. /* ISA probes that touch addresses < 0x400 (including those that also
  58. * look for EISA/PCI cards in addition to ISA cards).
  59. */
  60. static struct devprobe2 isa_probes[] __initdata = {
  61. #if defined(CONFIG_HP100) && defined(CONFIG_ISA) /* ISA, EISA */
  62. {hp100_probe, 0},
  63. #endif
  64. #ifdef CONFIG_3C515
  65. {tc515_probe, 0},
  66. #endif
  67. #ifdef CONFIG_ULTRA
  68. {ultra_probe, 0},
  69. #endif
  70. #ifdef CONFIG_WD80x3
  71. {wd_probe, 0},
  72. #endif
  73. #if defined(CONFIG_NE2000) /* ISA (use ne2k-pci for PCI cards) */
  74. {ne_probe, 0},
  75. #endif
  76. #ifdef CONFIG_LANCE /* ISA/VLB (use pcnet32 for PCI cards) */
  77. {lance_probe, 0},
  78. #endif
  79. #ifdef CONFIG_SMC9194
  80. {smc_init, 0},
  81. #endif
  82. #ifdef CONFIG_CS89x0
  83. #ifndef CONFIG_CS89x0_PLATFORM
  84. {cs89x0_probe, 0},
  85. #endif
  86. #endif
  87. #if defined(CONFIG_MVME16x_NET) || defined(CONFIG_BVME6000_NET) /* Intel */
  88. {i82596_probe, 0}, /* I82596 */
  89. #endif
  90. #ifdef CONFIG_NI65
  91. {ni65_probe, 0},
  92. #endif
  93. {NULL, 0},
  94. };
  95. static struct devprobe2 m68k_probes[] __initdata = {
  96. #ifdef CONFIG_ATARILANCE /* Lance-based Atari ethernet boards */
  97. {atarilance_probe, 0},
  98. #endif
  99. #ifdef CONFIG_SUN3LANCE /* sun3 onboard Lance chip */
  100. {sun3lance_probe, 0},
  101. #endif
  102. #ifdef CONFIG_SUN3_82586 /* sun3 onboard Intel 82586 chip */
  103. {sun3_82586_probe, 0},
  104. #endif
  105. #ifdef CONFIG_APNE /* A1200 PCMCIA NE2000 */
  106. {apne_probe, 0},
  107. #endif
  108. #ifdef CONFIG_MVME147_NET /* MVME147 internal Ethernet */
  109. {mvme147lance_probe, 0},
  110. #endif
  111. {NULL, 0},
  112. };
  113. /* Unified ethernet device probe, segmented per architecture and
  114. * per bus interface. This drives the legacy devices only for now.
  115. */
  116. static void __init ethif_probe2(int unit)
  117. {
  118. unsigned long base_addr = netdev_boot_base("eth", unit);
  119. if (base_addr == 1)
  120. return;
  121. (void)(probe_list2(unit, m68k_probes, base_addr == 0) &&
  122. probe_list2(unit, isa_probes, base_addr == 0));
  123. }
  124. /* Statically configured drivers -- order matters here. */
  125. static int __init net_olddevs_init(void)
  126. {
  127. int num;
  128. #ifdef CONFIG_SBNI
  129. for (num = 0; num < 8; ++num)
  130. sbni_probe(num);
  131. #endif
  132. for (num = 0; num < 8; ++num)
  133. ethif_probe2(num);
  134. #ifdef CONFIG_COPS
  135. cops_probe(0);
  136. cops_probe(1);
  137. cops_probe(2);
  138. #endif
  139. #ifdef CONFIG_LTPC
  140. ltpc_probe();
  141. #endif
  142. return 0;
  143. }
  144. device_initcall(net_olddevs_init);