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.

195 lines
5.2 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 "setupldr.h"
  12. //
  13. // NOTE: SlHalDetect() has been moved to boot\lib\i386\haldtect.c
  14. //
  15. VOID
  16. SlDetectScsi(
  17. IN PSETUP_LOADER_BLOCK SetupBlock
  18. )
  19. /*++
  20. Routine Description:
  21. SCSI detection routine for x86 machines.
  22. Arguments:
  23. SetupBlock - Supplies the Setup loader block
  24. Return Value:
  25. None.
  26. --*/
  27. {
  28. PVOID SifHandle;
  29. PCHAR p;
  30. ULONG LineCount,u;
  31. PDETECTED_DEVICE ScsiDevice;
  32. ULONG Ordinal;
  33. PCHAR ScsiFileName;
  34. PCHAR ScsiDescription;
  35. SCSI_INSERT_STATUS sis;
  36. extern BOOLEAN LoadScsiMiniports;
  37. //
  38. // If winnt.sif wasn't loaded, assume it's not a winnt setup
  39. // and therefore not unattended setup, and we detect no scsi
  40. // in this case on x86.
  41. //
  42. if(WinntSifHandle == NULL) {
  43. return;
  44. } else {
  45. SifHandle = WinntSifHandle;
  46. }
  47. //
  48. // If it's a floppyless setup, then the default is to load all
  49. // known scsi miniports. If it's not a floppyless setup,
  50. // the default is to load no miniports.
  51. //
  52. p = SlGetSectionKeyIndex(SifHandle,"Data","Floppyless",0);
  53. if(p && (*p != '0')) {
  54. //
  55. // Even if no miniport drivers are loaded, we want to indicate that
  56. // we "detected scsi".
  57. //
  58. SetupBlock->ScalarValues.LoadedScsi = 1;
  59. LineCount = SlCountLinesInSection(SifHandle,"DetectedMassStorage");
  60. if(LineCount == (ULONG)(-1)) {
  61. //
  62. // Section does not exist -- load all known miniports.
  63. // Setting this flag will cause all known miniports to be loaded
  64. // (see ..\setup.c).
  65. //
  66. LoadScsiMiniports = TRUE;
  67. } else {
  68. for(u=0; u<LineCount; u++) {
  69. if((p = SlGetSectionLineIndex(SifHandle,"DetectedMassStorage",u,0)) != NULL) {
  70. //
  71. // Find this adapter's ordinal within the Scsi.Load section of txtsetup.sif
  72. //
  73. Ordinal = SlGetSectionKeyOrdinal(InfFile, "Scsi.Load", p);
  74. if(Ordinal == SL_OEM_DEVICE_ORDINAL) {
  75. continue;
  76. }
  77. //
  78. // Find the driver filename
  79. //
  80. ScsiFileName = SlGetSectionKeyIndex(InfFile,
  81. "Scsi.Load",
  82. p,
  83. SIF_FILENAME_INDEX);
  84. if(!ScsiFileName) {
  85. continue;
  86. }
  87. //
  88. // Create a new detected device entry.
  89. //
  90. if((sis = SlInsertScsiDevice(Ordinal, &ScsiDevice)) == ScsiInsertError) {
  91. SlFriendlyError(ENOMEM, "SCSI detection", 0, NULL);
  92. return;
  93. }
  94. if(sis == ScsiInsertExisting) {
  95. #if DBG
  96. //
  97. // Sanity check to make sure we're talking about the same driver
  98. //
  99. if(_stricmp(ScsiDevice->BaseDllName, ScsiFileName)) {
  100. SlError(400);
  101. return;
  102. }
  103. #endif
  104. } else {
  105. //
  106. // Find the driver description
  107. //
  108. ScsiDescription = SlGetIniValue(InfFile,
  109. "SCSI",
  110. p,
  111. p);
  112. ScsiDevice->IdString = p;
  113. ScsiDevice->Description = ScsiDescription;
  114. ScsiDevice->ThirdPartyOptionSelected = FALSE;
  115. ScsiDevice->FileTypeBits = 0;
  116. ScsiDevice->Files = NULL;
  117. ScsiDevice->BaseDllName = ScsiFileName;
  118. }
  119. }
  120. }
  121. }
  122. }
  123. }
  124. VOID
  125. SlDetectVideo(
  126. IN PSETUP_LOADER_BLOCK SetupBlock
  127. )
  128. /*++
  129. Routine Description:
  130. Video detection routine for x86 machines.
  131. Currently, no video detection is done on x86 machines, this just fills
  132. in the appropriate fields in the setuploaderblock that say "VGA"
  133. Arguments:
  134. SetupBlock - Supplies the Setup loader block
  135. Return Value:
  136. None.
  137. --*/
  138. {
  139. SetupBlock->VideoDevice.Next = NULL;
  140. SetupBlock->VideoDevice.IdString = SlCopyString(VIDEO_DEVICE_NAME);
  141. SetupBlock->VideoDevice.ThirdPartyOptionSelected = FALSE;
  142. SetupBlock->VideoDevice.FileTypeBits = 0;
  143. SetupBlock->VideoDevice.Files = NULL;
  144. SetupBlock->VideoDevice.BaseDllName = NULL;
  145. SetupBlock->Monitor = NULL;
  146. SetupBlock->MonitorId = NULL;
  147. return;
  148. }