Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

217 lines
5.3 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. detecthw.c
  5. Abstract:
  6. Routines for determining which drivers/HAL need to be loaded.
  7. Author:
  8. John Vert (jvert) 20-Oct-1993
  9. Revision History:
  10. --*/
  11. #include "haldtect.h"
  12. #include <stdlib.h>
  13. //
  14. // detection function prototypes
  15. //
  16. #if 0
  17. ULONG DetectPicACPI_NEC98(PBOOLEAN);
  18. ULONG DetectMPS_NEC98(PBOOLEAN);
  19. ULONG DetectUPMPS_NEC98(PBOOLEAN);
  20. ULONG DetectTmr_NEC98(PBOOLEAN);
  21. ULONG DetectNonTmr_NEC98(PBOOLEAN);
  22. ULONG DetectSystemPro(PBOOLEAN);
  23. ULONG DetectWyse7(PBOOLEAN);
  24. ULONG NCRDeterminePlatform(PBOOLEAN);
  25. ULONG Detect486CStep(PBOOLEAN);
  26. ULONG DetectOlivettiMp(PBOOLEAN);
  27. ULONG DetectAST(PBOOLEAN);
  28. ULONG DetectCbusII(PBOOLEAN);
  29. ULONG DetectMPACPI(PBOOLEAN);
  30. ULONG DetectApicACPI(PBOOLEAN);
  31. ULONG DetectPicACPI(PBOOLEAN);
  32. ULONG DetectUPMPS(PBOOLEAN);
  33. ULONG DetectMPS(PBOOLEAN);
  34. #endif
  35. ULONG DetectTrue(PBOOLEAN);
  36. typedef struct _HAL_DETECT_ENTRY {
  37. INTERFACE_TYPE BusType;
  38. ULONG (*DetectFunction)(PBOOLEAN);
  39. PCHAR Shortname;
  40. } HAL_DETECT_ENTRY, *PHAL_DETECT_ENTRY;
  41. HAL_DETECT_ENTRY DetectHal[] = {
  42. #if 0
  43. // First check for a HAL to match some specific hardware.
  44. Isa, DetectPicACPI_NEC98, "nec98acpipic_up",
  45. Isa, DetectMPS_NEC98, "nec98mps_mp",
  46. Isa, DetectUPMPS_NEC98, "nec98mps_up",
  47. Isa, DetectTmr_NEC98, "nec98tmr_up",
  48. Isa, DetectNonTmr_NEC98, "nec98Notmr_up",
  49. MicroChannel, NCRDeterminePlatform, "ncr3x_mp",
  50. Eisa, DetectCbusII, "cbus2_mp",
  51. Isa, DetectCbusII, "cbus2_mp",
  52. MicroChannel, DetectCbusII, "cbusmc_mp",
  53. Eisa, DetectMPACPI, "acpiapic_mp",
  54. Isa, DetectMPACPI, "acpiapic_mp",
  55. Eisa, DetectApicACPI, "acpiapic_up",
  56. Isa, DetectApicACPI, "acpiapic_up",
  57. Isa, DetectPicACPI, "acpipic_up",
  58. Eisa, DetectMPS, "mps_mp",
  59. Isa, DetectMPS, "mps_mp",
  60. MicroChannel, DetectMPS, "mps_mca_mp",
  61. Eisa, DetectUPMPS, "mps_up",
  62. Isa, DetectUPMPS, "mps_up",
  63. Eisa, DetectSystemPro, "syspro_mp", // check SystemPro last
  64. // Before using default HAL make sure we don't need a special one
  65. Isa, Detect486CStep, "486c_up",
  66. Eisa, Detect486CStep, "486c_up",
  67. // Use default hal for given bus type...
  68. Isa, DetectTrue, "e_isa_up",
  69. Eisa, DetectTrue, "e_isa_up",
  70. MicroChannel, DetectTrue, "mca_up",
  71. #endif
  72. Isa, DetectTrue, "acpipic_up",
  73. Eisa, DetectTrue, "acpipic_up",
  74. MicroChannel, DetectTrue, "acpipic_up",
  75. 0, NULL, NULL
  76. };
  77. PCHAR
  78. SlDetectHal(
  79. VOID
  80. )
  81. /*++
  82. Routine Description:
  83. Determines which HAL to load and returns the filename.
  84. Arguments:
  85. None.
  86. Return Value:
  87. PCHAR - pointer to the filename of the HAL to be loaded.
  88. --*/
  89. {
  90. PCONFIGURATION_COMPONENT_DATA Adapter;
  91. INTERFACE_TYPE BusType;
  92. BOOLEAN IsMpMachine;
  93. ULONG i;
  94. PCHAR MachineShortname;
  95. //
  96. // Determine the bus type by searching the ARC configuration tree
  97. //
  98. BusType = Isa;
  99. //
  100. // Check for Eisa
  101. //
  102. Adapter = KeFindConfigurationEntry(BlLoaderBlock->ConfigurationRoot,
  103. AdapterClass,
  104. EisaAdapter,
  105. NULL);
  106. if (Adapter != NULL) {
  107. BusType = Eisa;
  108. }
  109. //
  110. // Check for MCA
  111. //
  112. Adapter = NULL;
  113. for (; ;) {
  114. Adapter = KeFindConfigurationNextEntry (
  115. BlLoaderBlock->ConfigurationRoot,
  116. AdapterClass,
  117. MultiFunctionAdapter,
  118. NULL,
  119. &Adapter
  120. );
  121. if (!Adapter) {
  122. break;
  123. }
  124. if (_stricmp(Adapter->ComponentEntry.Identifier,"MCA")==0) {
  125. BusType = MicroChannel;
  126. break;
  127. }
  128. }
  129. //
  130. // Now go figure out machine and hal type.
  131. //
  132. for (i=0;;i++) {
  133. if (DetectHal[i].DetectFunction == NULL) {
  134. //
  135. // We reached the end of the list without
  136. // figuring it out!
  137. //
  138. SlFatalError(i);
  139. return(NULL);
  140. }
  141. if ((DetectHal[i].BusType == BusType) ||
  142. (DetectHal[i].BusType == Internal)) {
  143. IsMpMachine = FALSE;
  144. if ((DetectHal[i].DetectFunction)(&IsMpMachine) != 0) {
  145. //
  146. // Found the correct HAL.
  147. //
  148. MachineShortname = DetectHal[i].Shortname;
  149. break;
  150. }
  151. }
  152. }
  153. return(MachineShortname);
  154. }
  155. ULONG
  156. DetectTrue(
  157. OUT PBOOLEAN IsMP
  158. )
  159. /*++
  160. Routine Description:
  161. To Return TRUE
  162. Return Value:
  163. TRUE
  164. --*/
  165. {
  166. UNREFERENCED_PARAMETER( IsMP );
  167. return TRUE;
  168. }