Windows NT 4.0 source code leak
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.

307 lines
5.0 KiB

4 years ago
  1. /*++
  2. Copyright (c) 1991, 1992 Microsoft Corporation
  3. Module Name:
  4. jzsetup.c
  5. Abstract:
  6. This program loads up the Jazz non-volatile ram.
  7. Author:
  8. David M. Robinson (davidro) 9-Aug-1991
  9. Revision History:
  10. --*/
  11. #include "jzsetup.h"
  12. //
  13. // Routine prototypes.
  14. //
  15. BOOLEAN
  16. JzInitializationMenu(
  17. VOID
  18. );
  19. VOID
  20. JzBootMenu(
  21. VOID
  22. );
  23. VOID
  24. JzEnvironmentMenu(
  25. VOID
  26. );
  27. //
  28. // Static data.
  29. //
  30. ULONG ScsiHostId;
  31. PCHAR Banner1 = " JAZZ Setup Program Version 0.17";
  32. PCHAR Banner2 = " Copyright (c) 1993 Microsoft Corporation";
  33. ULONG
  34. JzInitializeScsiHostId (
  35. VOID
  36. )
  37. /*++
  38. Routine Description:
  39. This routine gets the ScsiHostId from the configuration database if if
  40. exists.
  41. Arguments:
  42. None.
  43. Return Value:
  44. The ScsiHostId is read from the ScsiController configuration component
  45. if it exists. If not, a value of 7 is returned.
  46. --*/
  47. {
  48. PCONFIGURATION_COMPONENT Component;
  49. PCM_SCSI_DEVICE_DATA ScsiDeviceData;
  50. UCHAR Buffer[sizeof(CM_PARTIAL_RESOURCE_LIST) +
  51. (sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) * 5) +
  52. sizeof(CM_SCSI_DEVICE_DATA)];
  53. PCM_PARTIAL_RESOURCE_LIST Descriptor = (PCM_PARTIAL_RESOURCE_LIST)&Buffer;
  54. ULONG Count;
  55. if (((Component = ArcGetComponent("scsi(0)")) != NULL) &&
  56. (Component->Class == AdapterClass) && (Component->Type == ScsiAdapter) &&
  57. (ArcGetConfigurationData((PVOID)Descriptor, Component) == ESUCCESS) &&
  58. ((Count = Descriptor->Count) < 6)) {
  59. ScsiDeviceData = (PCM_SCSI_DEVICE_DATA)&Descriptor->PartialDescriptors[Count];
  60. if (ScsiDeviceData->HostIdentifier > 7) {
  61. return(7);
  62. } else {
  63. return(ScsiDeviceData->HostIdentifier);
  64. }
  65. }
  66. return(7);
  67. }
  68. VOID
  69. JzSetup (
  70. VOID
  71. )
  72. /*++
  73. Routine Description:
  74. This routine is the top level of the setup program.
  75. Arguments:
  76. None.
  77. Return Value:
  78. None.
  79. --*/
  80. {
  81. BOOLEAN Reboot;
  82. LONG DefaultChoice = 0;
  83. //
  84. // Setup is running.
  85. //
  86. SetupIsRunning = TRUE;
  87. //
  88. // Initialize the ScsiHostId Value.
  89. //
  90. ScsiHostId = JzInitializeScsiHostId();
  91. //
  92. // Set up the screen.
  93. //
  94. JzSetScreenAttributes( TRUE, FALSE, FALSE);
  95. JzSetScreenColor(ArcColorWhite, ArcColorBlue);
  96. //
  97. // Loop on choices until exit is selected.
  98. //
  99. Reboot = FALSE;
  100. while (TRUE) {
  101. DefaultChoice = JzGetSelection(JzSetupChoices,
  102. NUMBER_OF_JZ_SETUP_CHOICES,
  103. DefaultChoice);
  104. //
  105. // If the escape key was pressed, exit.
  106. //
  107. if (DefaultChoice == -1) {
  108. DefaultChoice = 0x7fffffff;
  109. }
  110. //
  111. // Switch based on the action.
  112. //
  113. switch (DefaultChoice) {
  114. //
  115. // Change or initialize the configuration.
  116. //
  117. case 0:
  118. Reboot = Reboot || JzInitializationMenu();
  119. break;
  120. //
  121. // Manage the boot process.
  122. //
  123. case 1:
  124. JzBootMenu();
  125. break;
  126. //
  127. // Exit.
  128. //
  129. default:
  130. if (Reboot) {
  131. ArcReboot();
  132. }
  133. return;
  134. }
  135. }
  136. }
  137. BOOLEAN
  138. JzInitializationMenu(
  139. VOID
  140. )
  141. /*++
  142. Routine Description:
  143. This routine displays the configuration menu.
  144. Arguments:
  145. None.
  146. Return Value:
  147. If a system reboot is required, TRUE is returned, otherwise FALSE is
  148. returned.
  149. --*/
  150. {
  151. BOOLEAN Reboot;
  152. LONG DefaultChoice = 0;
  153. //
  154. // Loop on choices until exit is selected.
  155. //
  156. Reboot = FALSE;
  157. while (TRUE) {
  158. DefaultChoice = JzGetSelection(ConfigurationChoices,
  159. NUMBER_OF_CONFIGURATION_CHOICES,
  160. DefaultChoice);
  161. //
  162. // If the escape key was pressed, return.
  163. //
  164. if (DefaultChoice == -1) {
  165. DefaultChoice = 0x7fffffff;
  166. }
  167. //
  168. // Switch based on the action.
  169. //
  170. switch (DefaultChoice) {
  171. //
  172. // Load default configuration.
  173. //
  174. case 0:
  175. Reboot = Reboot || JzMakeDefaultConfiguration();
  176. break;
  177. //
  178. // Load default environment.
  179. //
  180. case 1:
  181. JzMakeDefaultEnvironment();
  182. break;
  183. //
  184. // Edit an environment variable
  185. //
  186. case 2:
  187. JzEditVariable();
  188. break;
  189. //
  190. // Set the RTC.
  191. //
  192. case 3:
  193. JzSetTime();
  194. break;
  195. //
  196. // Change the ethernet address.
  197. //
  198. case 4:
  199. JzSetEthernet();
  200. break;
  201. //
  202. // Run the debug monitor.
  203. //
  204. case 5:
  205. SetupIsRunning = FALSE;
  206. ArcEnterInteractiveMode();
  207. SetupIsRunning = TRUE;
  208. break;
  209. //
  210. // Return to main menu.
  211. //
  212. default:
  213. return(Reboot);
  214. }
  215. }
  216. }