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.

193 lines
3.6 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. #ifndef ARCI386
  14. //
  15. // detection function prototypes
  16. //
  17. ULONG DetectMPACPI(PBOOLEAN);
  18. ULONG DetectApicACPI(PBOOLEAN);
  19. ULONG DetectPicACPI(PBOOLEAN);
  20. ULONG DetectUPMPS(PBOOLEAN);
  21. ULONG DetectMPS(PBOOLEAN);
  22. ULONG DetectTrue(PBOOLEAN);
  23. typedef struct _HAL_DETECT_ENTRY {
  24. ULONG (*DetectFunction)(PBOOLEAN);
  25. PCHAR Shortname;
  26. } HAL_DETECT_ENTRY, *PHAL_DETECT_ENTRY;
  27. HAL_DETECT_ENTRY DetectHal[] = {
  28. // First check for a HAL to match some specific hardware.
  29. DetectMPACPI, "acpiapic_mp",
  30. DetectApicACPI, "acpiapic_up",
  31. DetectPicACPI, "acpipic_up",
  32. DetectMPS, "mps_mp",
  33. DetectUPMPS, "mps_up",
  34. // Use default hal for given bus type...
  35. DetectTrue, "e_isa_up",
  36. 0, NULL, NULL
  37. };
  38. PCHAR
  39. SlDetectHal(
  40. VOID
  41. )
  42. /*++
  43. Routine Description:
  44. Determines which HAL to load and returns the filename.
  45. Arguments:
  46. None.
  47. Return Value:
  48. PCHAR - pointer to the filename of the HAL to be loaded.
  49. --*/
  50. {
  51. BOOLEAN IsMpMachine;
  52. ULONG i;
  53. PCHAR MachineShortname;
  54. //
  55. // Figure out machine and hal type.
  56. //
  57. for (i=0;;i++) {
  58. if (DetectHal[i].DetectFunction == NULL) {
  59. //
  60. // We reached the end of the list without
  61. // figuring it out!
  62. //
  63. SlFatalError(i);
  64. return(NULL);
  65. }
  66. IsMpMachine = FALSE;
  67. if ((DetectHal[i].DetectFunction)(&IsMpMachine) != 0) {
  68. //
  69. // Found the correct HAL.
  70. //
  71. MachineShortname = DetectHal[i].Shortname;
  72. break;
  73. }
  74. }
  75. return(MachineShortname);
  76. }
  77. ULONG
  78. DetectTrue(
  79. OUT PBOOLEAN IsMP
  80. )
  81. /*++
  82. Routine Description:
  83. To Return TRUE
  84. Return Value:
  85. TRUE
  86. --*/
  87. {
  88. UNREFERENCED_PARAMETER( IsMP );
  89. return TRUE;
  90. }
  91. #else // ARCI386 path...
  92. PVOID InfFile;
  93. PVOID WinntSifHandle;
  94. PCHAR
  95. SlDetectHal(
  96. VOID
  97. )
  98. /*++
  99. Routine Description:
  100. Determines the canonical short machine name for the HAL to be loaded for
  101. this machine.
  102. It does this by enumerating the [Map.Computer] section of the INF file and
  103. comparing the strings there with the computer description in the ARC tree.
  104. [Map.Computer]
  105. msjazz_up = *Jazz
  106. desksta1_up = "DESKTECH-ARCStation I"
  107. pica61_up = "PICA-61"
  108. duo_mp = *Duo
  109. [Map.Computer]
  110. DECjensen = "DEC-20Jensen"
  111. DECjensen = "DEC-10Jensen"
  112. Arguments:
  113. None.
  114. Return Value:
  115. PCHAR - pointer to canonical shortname for the machine.
  116. NULL - the type of machine could not be determined.
  117. --*/
  118. {
  119. PCONFIGURATION_COMPONENT_DATA Node;
  120. PCHAR MachineName;
  121. //
  122. // Find the system description node
  123. //
  124. Node = KeFindConfigurationEntry(BlLoaderBlock->ConfigurationRoot,
  125. SystemClass,
  126. ArcSystem,
  127. NULL);
  128. if (Node==NULL) {
  129. SlError(0);
  130. return(NULL);
  131. }
  132. MachineName = Node->ComponentEntry.Identifier;
  133. MachineName = (MachineName ? SlSearchSection("Map.Computer", MachineName) : NULL);
  134. return(MachineName);
  135. }
  136. #endif