Source code of Windows XP (NT5)
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.

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