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.

384 lines
8.8 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. bldria64.h
  5. Abstract:
  6. Contains definitions and prototypes specific to the IA64 NTLDR.
  7. Author:
  8. John Vert (jvert) 20-Dec-1993
  9. Revision History:
  10. --*/
  11. #ifndef _BLDRIA64_
  12. #define _BLDRIA64_
  13. #include "bldr.h"
  14. #include "bootefi.h"
  15. #include "efi.h"
  16. VOID
  17. AEInitializeStall(
  18. VOID
  19. );
  20. ARC_STATUS
  21. AEInitializeIo(
  22. IN ULONG DriveId
  23. );
  24. //
  25. // FIX: this routine is currently broken on IA64.
  26. //
  27. PVOID
  28. FwAllocateHeap(
  29. IN ULONG Size
  30. );
  31. PCHAR
  32. BlSelectKernel(
  33. VOID
  34. );
  35. BOOLEAN
  36. BlDetectHardware(
  37. IN ULONG DriveId,
  38. IN PCHAR LoadOptions
  39. );
  40. VOID
  41. BlStartup(
  42. IN PCHAR PartitionName
  43. );
  44. #ifndef EFI
  45. //
  46. // Arc routines for supporting common VGA I/O routines
  47. //
  48. #define ARC_DISPLAY_CLEAR_ESCAPE "\033[2J"
  49. #define ARC_DISPLAY_CLEAR() { \
  50. ULONG LocalCount; \
  51. ArcWrite(BlConsoleOutDeviceId, ARC_DISPLAY_CLEAR_ESCAPE, \
  52. sizeof(ARC_DISPLAY_CLEAR_ESCAPE) - 1, &LocalCount); \
  53. }
  54. #define ARC_DISPLAY_CLEAR_TO_EOD() { \
  55. ULONG LocalCount; \
  56. ArcWrite(BlConsoleOutDeviceId, "\033[0J", sizeof("\033[0J") - 1, &LocalCount); \
  57. }
  58. #define ARC_DISPLAY_CLEAR_TO_EOL() { \
  59. ULONG LocalCount; \
  60. ArcWrite(BlConsoleOutDeviceId, "\033[0K", sizeof("\033[0K") - 1, &LocalCount); \
  61. }
  62. #define ARC_DISPLAY_ATTRIBUTES_OFF() { \
  63. ULONG LocalCount; \
  64. ArcWrite(BlConsoleOutDeviceId, "\033[0m", sizeof("\033[0m") - 1, &LocalCount); \
  65. }
  66. #define ARC_DISPLAY_INVERSE_VIDEO() { \
  67. ULONG LocalCount; \
  68. ArcWrite(BlConsoleOutDeviceId, "\033[7m", sizeof("\033[7m") - 1, &LocalCount); \
  69. }
  70. #define ARC_DISPLAY_SET_COLOR(c) { \
  71. ULONG LocalCount; \
  72. UCHAR LocalBuffer[40]; \
  73. sprintf(LocalBuffer, "\033[%sm", c); \
  74. ArcWrite(BlConsoleOutDeviceId, LocalBuffer, strlen(LocalBuffer), &LocalCount); \
  75. }
  76. #define ARC_DISPLAY_POSITION_CURSOR(x, y) { \
  77. ULONG LocalCount; \
  78. UCHAR LocalBuffer[40]; \
  79. sprintf(LocalBuffer, "\033[%d;%dH", y + 1, x + 1); \
  80. ArcWrite(BlConsoleOutDeviceId, LocalBuffer, strlen(LocalBuffer), &LocalCount); \
  81. }
  82. #endif
  83. //
  84. // headless routines
  85. //
  86. extern BOOLEAN BlTerminalConnected;
  87. extern ULONG BlTerminalDeviceId;
  88. extern ULONG BlTerminalDelay;
  89. LOGICAL
  90. BlTerminalAttached(
  91. IN ULONG TerminalDeviceId
  92. );
  93. // E X T E R N A L S E R V I C E S T A B L E
  94. //
  95. // External Services Table - machine dependent services
  96. // like reading a sector from the disk and finding out how
  97. // much memory is installed are provided by a lower level
  98. // module or a ROM BIOS. The EST provides entry points
  99. // for the OS loader.
  100. //
  101. //**
  102. // NOTE WELL
  103. // The offsets of entries in this structure MUST MATCH
  104. // the offsets of BOTH the ExportEntryTable in ....\startup\i386\sudata.asm
  105. // AND ...\startrom\i386\sudata.asm. You must change all 3
  106. // locations together.
  107. //**
  108. typedef struct _EXTERNAL_SERVICES_TABLE {
  109. VOID (__cdecl * RebootProcessor)(VOID);
  110. NTSTATUS (__cdecl * DiskIOSystem)(UCHAR,UCHAR,USHORT,USHORT,UCHAR,UCHAR,PUCHAR);
  111. ULONG (__cdecl * GetKey)(VOID);
  112. ULONG (__cdecl * GetCounter)(VOID);
  113. VOID (__cdecl * Reboot)(ULONG);
  114. ULONG (__cdecl * AbiosServices)(USHORT,PUCHAR,PUCHAR,PUCHAR,PUCHAR,USHORT,USHORT);
  115. VOID (__cdecl * DetectHardware)(ULONG, ULONG, PVOID, PULONG, PCHAR, ULONG);
  116. VOID (__cdecl * HardwareCursor)(ULONG,ULONG);
  117. VOID (__cdecl * GetDateTime)(PULONG,PULONG);
  118. VOID (__cdecl * ComPort)(LONG,ULONG,UCHAR);
  119. BOOLEAN (__cdecl * IsMcaMachine)(VOID);
  120. ULONG (__cdecl * GetStallCount)(VOID);
  121. VOID (__cdecl * InitializeDisplayForNt)(VOID);
  122. VOID (__cdecl * GetMemoryDescriptor)(P820FRAME);
  123. NTSTATUS (__cdecl * GetEddsSector)(ULONGLONG,ULONG,ULONG,USHORT,PUCHAR,UCHAR);
  124. NTSTATUS (__cdecl * GetElToritoStatus)(PUCHAR,UCHAR);
  125. BOOLEAN (__cdecl * GetExtendedInt13Params)(PUCHAR,UCHAR);
  126. USHORT (__cdecl * NetPcRomServices)(ULONG,PVOID);
  127. VOID (__cdecl * ApmAttemptReconnect)(VOID);
  128. ULONG (__cdecl * BiosRedirectService)(ULONG);
  129. } EXTERNAL_SERVICES_TABLE, *PEXTERNAL_SERVICES_TABLE;
  130. extern PEXTERNAL_SERVICES_TABLE ExternalServicesTable;
  131. //**
  132. // SEE NOTE AT TOP OF STRUCTURE
  133. //**
  134. //
  135. // External Services Macros
  136. //
  137. #define REBOOT_PROCESSOR (*ExternalServicesTable->RebootProcessor)
  138. #define GET_SECTOR (*ExternalServicesTable->DiskIOSystem)
  139. #define RESET_DISK (*ExternalServicesTable->DiskIOSystem)
  140. #define BIOS_IO (*ExternalServicesTable->DiskIOSystem)
  141. #define GET_KEY (*ExternalServicesTable->GetKey)
  142. #define GET_COUNTER (*ExternalServicesTable->GetCounter)
  143. #define REBOOT (*ExternalServicesTable->Reboot)
  144. #define ABIOS_SERVICES (*ExternalServicesTable->AbiosServices)
  145. #define DETECT_HARDWARE (*ExternalServicesTable->DetectHardware)
  146. #define HW_CURSOR (*ExternalServicesTable->HardwareCursor)
  147. #define GET_DATETIME (*ExternalServicesTable->GetDateTime)
  148. #define COMPORT (*ExternalServicesTable->ComPort)
  149. #define ISMCA (*ExternalServicesTable->IsMcaMachine)
  150. #define GET_STALL_COUNT (*ExternalServicesTable->GetStallCount)
  151. #define SETUP_DISPLAY_FOR_NT (*ExternalServicesTable->InitializeDisplayForNt)
  152. #define GET_MEMORY_DESCRIPTOR (*ExternalServicesTable->GetMemoryDescriptor)
  153. #define GET_EDDS_SECTOR (*ExternalServicesTable->GetEddsSector)
  154. #define GET_ELTORITO_STATUS (*ExternalServicesTable->GetElToritoStatus)
  155. #define GET_XINT13_PARAMS (*ExternalServicesTable->GetExtendedInt13Params)
  156. #define NETPC_ROM_SERVICES (*ExternalServicesTable->NetPcRomServices)
  157. #define APM_ATTEMPT_RECONNECT (*ExternalServicesTable->ApmAttemptReconnect)
  158. #define BIOS_REDIRECT_SERVICE (*ExternalServicesTable->BiosRedirectService)
  159. //
  160. // Define special key input values
  161. //
  162. #define DOWN_ARROW 0x5000
  163. #define UP_ARROW 0x4800
  164. #define HOME_KEY 0x4700
  165. #define END_KEY 0x4F00
  166. #define LEFT_KEY 0x4B00
  167. #define RIGHT_KEY 0x4D00
  168. #define INS_KEY 0x5200
  169. #define DEL_KEY 0x5300
  170. #define BKSP_KEY 0x0E08
  171. #define TAB_KEY 0x0009
  172. #define BACKTAB_KEY 0x0F00
  173. #define F1_KEY 0x3B00
  174. #define F2_KEY 0x3C00
  175. #define F3_KEY 0x3D00
  176. #define F5_KEY 0x3F00
  177. #define F6_KEY 0x4000
  178. #define F7_KEY 0x4100
  179. #define F8_KEY 0x4200
  180. #define F10_KEY 0x4400
  181. #define ENTER_KEY 0x000D
  182. #define ESCAPE_KEY 0x011B
  183. //
  184. // define various memory segments that are needed by the ia64 loaders
  185. //
  186. //
  187. // 1-megabyte boundary line (in pages)
  188. //
  189. #define _1MB ((ULONG)0x100000 >> PAGE_SHIFT)
  190. //
  191. // 16-megabyte boundary line (in pages)
  192. //
  193. #define _16MB ((ULONG)0x1000000 >> PAGE_SHIFT)
  194. //
  195. // 48-megabyte boundary line (in pages)
  196. //
  197. #define _48MB ((ULONG)0x3000000 >> PAGE_SHIFT)
  198. #define _64MB ((ULONG)0x4000000 >> PAGE_SHIFT)
  199. #define _80MB ((ULONG)0x5000000 >> PAGE_SHIFT)
  200. //
  201. // Bogus memory line. (We don't ever want to use the memory that is in
  202. // the 0x40 pages just under the 80MB line.)
  203. //
  204. #define _80MB_BOGUS (((ULONG)0x5000000-0x80000) >> PAGE_SHIFT)
  205. #define ROM_START_PAGE (0x0A0000 >> PAGE_SHIFT)
  206. #define ROM_END_PAGE (0x100000 >> PAGE_SHIFT)
  207. //
  208. // Define specific ranges where parts of the system should be loaded
  209. //
  210. #define BL_KERNEL_RANGE_LOW _48MB
  211. #define BL_KERNEL_RANGE_HIGH _64MB
  212. #define BL_DRIVER_RANGE_LOW _16MB
  213. #define BL_DRIVER_RANGE_HIGH _48MB
  214. #define BL_DECOMPRESS_RANGE_LOW _64MB
  215. #define BL_DECOMPRESS_RANGE_HIGH _80MB
  216. #define BL_DISK_CACHE_RANGE_LOW BlUsableBase
  217. #define BL_DISK_CACHE_RANGE_HIGH BlUsableLimit
  218. #define BL_XIPROM_RANGE_LOW BlUsableBase
  219. #define BL_XIPROM_RANGE_HIGH 0xffffffff
  220. //
  221. // x86-specific video support
  222. //
  223. VOID
  224. TextGetCursorPosition(
  225. OUT PULONG X,
  226. OUT PULONG Y
  227. );
  228. VOID
  229. TextSetCursorPosition(
  230. IN ULONG X,
  231. IN ULONG Y
  232. );
  233. VOID
  234. TextSetCurrentAttribute(
  235. IN UCHAR Attribute
  236. );
  237. UCHAR
  238. TextGetCurrentAttribute(
  239. VOID
  240. );
  241. VOID
  242. TextClearDisplay(
  243. VOID
  244. );
  245. VOID
  246. TextClearToEndOfDisplay(
  247. VOID
  248. );
  249. VOID
  250. TextClearFromStartOfLine(
  251. VOID
  252. );
  253. VOID
  254. TextClearToEndOfLine(
  255. VOID
  256. );
  257. VOID
  258. TextStringOut(
  259. IN PWCHAR String
  260. );
  261. VOID
  262. TextCharOut(
  263. IN PWCHAR pc
  264. );
  265. VOID
  266. TextFillAttribute(
  267. IN UCHAR Attribute,
  268. IN ULONG Length
  269. );
  270. #define BlPuts(str) TextStringOut(str)
  271. ULONG
  272. BlGetKey(
  273. VOID
  274. );
  275. VOID
  276. BlInputString(
  277. IN ULONG Prompt,
  278. IN ULONG CursorX,
  279. IN ULONG CursorY,
  280. IN PUCHAR String,
  281. IN ULONG MaxLength
  282. );
  283. EFI_STATUS
  284. EfiGetVariable(
  285. IN CHAR16 *VariableName,
  286. IN EFI_GUID *VendorGuid,
  287. OUT UINT32 *Attributes OPTIONAL,
  288. IN OUT UINTN *DataSize,
  289. OUT VOID *Data
  290. );
  291. EFI_STATUS
  292. EfiSetVariable (
  293. IN CHAR16 *VariableName,
  294. IN EFI_GUID *VendorGuid,
  295. IN UINT32 Attributes,
  296. IN UINTN DataSize,
  297. IN VOID *Data
  298. );
  299. EFI_STATUS
  300. EfiGetNextVariableName (
  301. IN OUT UINTN *VariableNameSize,
  302. IN OUT CHAR16 *VariableName,
  303. IN OUT EFI_GUID *VendorGuid
  304. );
  305. PVOID
  306. FindSMBIOSTable(
  307. UCHAR RequestedTableType
  308. );
  309. VOID
  310. EfiCheckFirmwareRevision(
  311. VOID
  312. );
  313. #endif // _BLDRIA64_