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.

177 lines
3.4 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. initx86.c
  5. Abstract:
  6. Does any x86-specific initialization, then starts the common ARC osloader
  7. Author:
  8. John Vert (jvert) 4-Nov-1993
  9. Revision History:
  10. --*/
  11. #include "bldria64.h"
  12. #include "msg.h"
  13. #include "efi.h"
  14. #include "stdio.h"
  15. extern EFI_SYSTEM_TABLE *EfiST;
  16. VOID
  17. BlInitializeTerminal(
  18. VOID
  19. );
  20. UCHAR BootPartitionName[80];
  21. UCHAR KernelBootDevice[80];
  22. UCHAR OsLoadFilename[100];
  23. UCHAR OsLoaderFilename[100];
  24. UCHAR SystemPartition[100];
  25. UCHAR OsLoadPartition[100];
  26. UCHAR OsLoadOptions[100];
  27. UCHAR ConsoleInputName[50];
  28. UCHAR MyBuffer[SECTOR_SIZE+32];
  29. UCHAR ConsoleOutputName[50];
  30. UCHAR X86SystemPartition[sizeof("x86systempartition=") + sizeof(BootPartitionName)];
  31. VOID
  32. BlStartup(
  33. IN PCHAR PartitionName
  34. )
  35. /*++
  36. Routine Description:
  37. Does x86-specific initialization, particularly presenting the boot.ini
  38. menu and running NTDETECT, then calls to the common osloader.
  39. Arguments:
  40. PartitionName - Supplies the ARC name of the partition (or floppy) that
  41. setupldr was loaded from.
  42. Return Value:
  43. Does not return
  44. --*/
  45. {
  46. ULONG Argc = 0;
  47. PUCHAR Argv[10];
  48. ARC_STATUS Status;
  49. ULONG BootFileId;
  50. PCHAR BootFile;
  51. ULONG Read;
  52. PCHAR p;
  53. ULONG i;
  54. ULONG DriveId;
  55. ULONG FileSize;
  56. ULONG Count;
  57. LARGE_INTEGER SeekPosition;
  58. PCHAR LoadOptions = NULL;
  59. BOOLEAN UseTimeOut=TRUE;
  60. BOOLEAN AlreadyInitialized = FALSE;
  61. extern BOOLEAN FwDescriptorsValid;
  62. //
  63. // Initialize ARC StdIo functionality
  64. //
  65. strcpy(ConsoleInputName,"consolein=multi(0)key(0)keyboard(0)");
  66. strcpy(ConsoleOutputName,"consoleout=multi(0)video(0)monitor(0)");
  67. Argv[0]=ConsoleInputName;
  68. Argv[1]=ConsoleOutputName;
  69. BlInitStdio (2, Argv);
  70. //
  71. // Initialize any dumb terminal that may be connected.
  72. //
  73. BlInitializeTerminal();
  74. //
  75. // The main functionality of the OS chooser.
  76. //
  77. BlOsLoader( Argc, Argv, NULL );
  78. //
  79. // If we ever come back here, just wait to reboot.
  80. //
  81. if (BlIsTerminalConnected()) {
  82. if (BlTerminalHandleLoaderFailure()) {
  83. ArcRestart();
  84. }
  85. } else {
  86. REBOOT(0);
  87. }
  88. }
  89. VOID
  90. BlInitializeTerminal(
  91. VOID
  92. )
  93. /*++
  94. Routine Description:
  95. Does initialization of a dumb terminal connected to a serial port.
  96. Arguments:
  97. None.
  98. Return Value:
  99. None.
  100. --*/
  101. {
  102. //
  103. // Try to initialize the headless port.
  104. //
  105. BlInitializeHeadlessPort();
  106. if( LoaderRedirectionInformation.PortNumber == 0 ) {
  107. //
  108. // we didn't get anything from the BIOS. See if StartROM
  109. // was redirecting.
  110. //
  111. #if 0
  112. if( (BOOLEAN)(BIOS_REDIRECT_SERVICE(1) != -1) ) {
  113. //
  114. // He is. Pick up his settings.
  115. //
  116. RtlZeroMemory( LoaderRedirectionInformation, sizeof(HEADLESS_LOADER_BLOCK) );
  117. LoaderRedirectionInformation.PortNumber = (ULONG)BIOS_REDIRECT_SERVICE(1);
  118. LoaderRedirectionInformation.BaudRate = (ULONG)BIOS_REDIRECT_SERVICE(2);
  119. LoaderRedirectionInformation.Parity = (BOOLEAN)BIOS_REDIRECT_SERVICE(3);
  120. LoaderRedirectionInformation.StopBits = (UCHAR)BIOS_REDIRECT_SERVICE(4);
  121. //
  122. // Now try again, this time with feeling...
  123. //
  124. BlInitializeHeadlessPort();
  125. }
  126. #endif
  127. }
  128. }