您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

config.c 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /*
  2. * This program is free software; you can redistribute it and/or
  3. * modify it under the terms of the GNU General Public License as
  4. * published by the Free Software Foundation; either version 2, or (at
  5. * your option) any later version.
  6. */
  7. #include "etherboot.h"
  8. #include "nic.h"
  9. #ifdef BUILD_SERIAL
  10. #include ".buildserial.h"
  11. #define xstr(s) str(s)
  12. #define str(s) #s
  13. #endif
  14. void print_config(void)
  15. {
  16. printf( "Etherboot " VERSION
  17. #ifdef BUILD_SERIAL
  18. " [build "
  19. #ifdef BUILD_ID
  20. BUILD_ID " "
  21. #endif
  22. "#" xstr(BUILD_SERIAL_NUM) "]"
  23. #endif /* BUILD_SERIAL */
  24. " (GPL) http://etherboot.org\n"
  25. "Drivers: " );
  26. #ifdef CONFIG_PCI
  27. pci_enumerate();
  28. #endif
  29. #ifdef CONFIG_ISA
  30. isa_enumerate();
  31. #endif
  32. printf( " Images: "
  33. #ifdef TAGGED_IMAGE
  34. "NBI "
  35. #endif
  36. #ifdef ELF64_IMAGE
  37. "ELF64 "
  38. #endif
  39. #ifdef ELF_IMAGE
  40. "ELF "
  41. #endif
  42. #ifdef COFF_IMAGE
  43. "COFF "
  44. #endif
  45. #ifdef IMAGE_FREEBSD
  46. "FreeBSD "
  47. #endif
  48. #ifdef IMAGE_MULTIBOOT
  49. "Multiboot "
  50. #endif
  51. #ifdef AOUT_IMAGE
  52. "a.out "
  53. #endif
  54. #ifdef WINCE_IMAGE
  55. "WINCE "
  56. #endif
  57. #ifdef PXE_IMAGE
  58. "PXE "
  59. #endif
  60. #ifdef PXE_EXPORT /* All possible exports */
  61. " Exports: "
  62. #ifdef PXE_EXPORT
  63. "PXE "
  64. #endif
  65. #endif /* All possible exports */
  66. " "
  67. );
  68. #if (BOOTP_SERVER != 67) || (BOOTP_CLIENT != 68)
  69. printf( "[DHCP ports %d and %d] ",
  70. BOOTP_SERVER, BOOTP_CLIENT);
  71. #endif
  72. putchar('\n');
  73. printf( "Protocols: "
  74. #ifdef RARP_NOT_BOOTP
  75. "RARP "
  76. #else
  77. # ifndef NO_DHCP_SUPPORT
  78. "DHCP "
  79. # else
  80. "BOOTP "
  81. # endif
  82. #endif
  83. #ifdef DOWNLOAD_PROTO_TFTP
  84. "TFTP "
  85. #endif
  86. #ifdef DOWNLOAD_PROTO_NFS
  87. "NFS "
  88. #endif
  89. #ifdef DOWNLOAD_PROTO_SLAM
  90. "SLAM "
  91. #endif
  92. #ifdef DOWNLOAD_PROTO_TFTM
  93. "TFTM "
  94. #endif
  95. #ifdef DOWNLOAD_PROTO_HTTP
  96. "HTTP "
  97. #endif
  98. #ifdef PROTO_LACP
  99. "LACP "
  100. #endif
  101. #ifdef DNS_RESOLVER
  102. "DNS "
  103. #endif
  104. "\n");
  105. }
  106. static const char *driver_name[] = {
  107. "nic",
  108. "disk",
  109. "floppy",
  110. };
  111. int probe(struct dev *dev)
  112. {
  113. const char *type_name;
  114. type_name = "";
  115. if ((dev->type >= 0) &&
  116. ((unsigned)dev->type < sizeof(driver_name)/sizeof(driver_name[0]))) {
  117. type_name = driver_name[dev->type];
  118. }
  119. if (dev->how_probe == PROBE_FIRST) {
  120. dev->to_probe = PROBE_PCI;
  121. memset(&dev->state, 0, sizeof(dev->state));
  122. }
  123. if (dev->to_probe == PROBE_PCI) {
  124. #ifdef CONFIG_PCI
  125. dev->how_probe = pci_probe(dev, type_name);
  126. #else
  127. dev->how_probe = PROBE_FAILED;
  128. #endif
  129. if (dev->how_probe == PROBE_FAILED) {
  130. dev->to_probe = PROBE_ISA;
  131. }
  132. }
  133. if (dev->to_probe == PROBE_ISA) {
  134. #ifdef CONFIG_ISA
  135. dev->how_probe = isa_probe(dev, type_name);
  136. #else
  137. dev->how_probe = PROBE_FAILED;
  138. #endif
  139. if (dev->how_probe == PROBE_FAILED) {
  140. dev->to_probe = PROBE_NONE;
  141. }
  142. }
  143. if ((dev->to_probe != PROBE_PCI) &&
  144. (dev->to_probe != PROBE_ISA)) {
  145. dev->how_probe = PROBE_FAILED;
  146. }
  147. return dev->how_probe;
  148. }
  149. void disable(struct dev *dev)
  150. {
  151. if (dev->disable) {
  152. dev->disable(dev);
  153. dev->disable = 0;
  154. }
  155. }