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.

157 lines
2.8 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. //
  83. // typical case. wait for user to press a key and then
  84. // restart
  85. //
  86. while(!BlGetKey());
  87. }
  88. else {
  89. //
  90. // headless case. present user with mini sac
  91. //
  92. while(!BlTerminalHandleLoaderFailure());
  93. }
  94. ArcRestart();
  95. }
  96. VOID
  97. BlInitializeTerminal(
  98. VOID
  99. )
  100. /*++
  101. Routine Description:
  102. Does initialization of a dumb terminal connected to a serial port.
  103. Arguments:
  104. None.
  105. Return Value:
  106. None.
  107. --*/
  108. {
  109. //
  110. // Try to initialize the headless port.
  111. //
  112. BlInitializeHeadlessPort();
  113. }