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.

384 lines
9.0 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. ARC_STATUS (__cdecl * RebootProcessor)(VOID);
  110. ARC_STATUS (__cdecl * DiskIOSystem)(ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG);
  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, ULONG, ULONG, ULONG, 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. ARC_STATUS (__cdecl * GetEddsSector)(EFI_HANDLE,ULONG,ULONG,ULONG,PUCHAR,UCHAR);
  124. BOOLEAN (__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 F4_KEY 0x3E00
  177. #define F5_KEY 0x3F00
  178. #define F6_KEY 0x4000
  179. #define F7_KEY 0x4100
  180. #define F8_KEY 0x4200
  181. #define F10_KEY 0x4400
  182. #define ENTER_KEY 0x000D
  183. #define ESCAPE_KEY 0x011B
  184. //
  185. // define various memory segments that are needed by the ia64 loaders
  186. //
  187. #define ROM_START_PAGE (0x0A0000 >> PAGE_SHIFT)
  188. #define ROM_END_PAGE (0x100000 >> PAGE_SHIFT)
  189. //
  190. // Define specific ranges where parts of the system should be loaded
  191. //
  192. #define BL_KERNEL_RANGE_LOW _48MB
  193. #define BL_KERNEL_RANGE_HIGH _64MB
  194. #define BL_DRIVER_RANGE_LOW _64MB
  195. #define BL_DRIVER_RANGE_HIGH _128MB
  196. #define BL_DECOMPRESS_RANGE_LOW _32MB
  197. #define BL_DECOMPRESS_RANGE_HIGH _48MB
  198. #define BL_DISK_CACHE_RANGE_LOW BlUsableBase
  199. #define BL_DISK_CACHE_RANGE_HIGH BlUsableLimit
  200. #define BL_XIPROM_RANGE_LOW BlUsableBase
  201. #define BL_XIPROM_RANGE_HIGH 0xffffffff
  202. //
  203. // x86-specific video support
  204. //
  205. VOID
  206. TextGetCursorPosition(
  207. OUT PULONG X,
  208. OUT PULONG Y
  209. );
  210. VOID
  211. TextSetCursorPosition(
  212. IN ULONG X,
  213. IN ULONG Y
  214. );
  215. VOID
  216. TextSetCurrentAttribute(
  217. IN UCHAR Attribute
  218. );
  219. UCHAR
  220. TextGetCurrentAttribute(
  221. VOID
  222. );
  223. VOID
  224. TextClearDisplay(
  225. VOID
  226. );
  227. VOID
  228. TextClearToEndOfDisplay(
  229. VOID
  230. );
  231. VOID
  232. TextClearFromStartOfLine(
  233. VOID
  234. );
  235. VOID
  236. TextClearToEndOfLine(
  237. VOID
  238. );
  239. VOID
  240. TextStringOut(
  241. IN PWCHAR String
  242. );
  243. VOID
  244. TextCharOut(
  245. IN PWCHAR pc
  246. );
  247. VOID
  248. TextFillAttribute(
  249. IN UCHAR Attribute,
  250. IN ULONG Length
  251. );
  252. #define BlPuts(str) TextStringOut(str)
  253. ULONG
  254. BlGetKey(
  255. VOID
  256. );
  257. ULONGLONG
  258. BlSetInputTimeout(
  259. ULONGLONG
  260. );
  261. ULONGLONG
  262. BlGetInputTimeout(
  263. VOID
  264. );
  265. EFI_STATUS
  266. BlWaitForInput(
  267. EFI_INPUT_KEY *Key,
  268. ULONGLONG Timeout
  269. );
  270. VOID
  271. BlInputString(
  272. IN ULONG Prompt,
  273. IN ULONG CursorX,
  274. IN ULONG CursorY,
  275. IN PUCHAR String,
  276. IN ULONG MaxLength
  277. );
  278. EFI_STATUS
  279. EfiGetVariable(
  280. IN CHAR16 *VariableName,
  281. IN EFI_GUID *VendorGuid,
  282. OUT UINT32 *Attributes OPTIONAL,
  283. IN OUT UINTN *DataSize,
  284. OUT VOID *Data
  285. );
  286. EFI_STATUS
  287. EfiSetVariable (
  288. IN CHAR16 *VariableName,
  289. IN EFI_GUID *VendorGuid,
  290. IN UINT32 Attributes,
  291. IN UINTN DataSize,
  292. IN VOID *Data
  293. );
  294. EFI_STATUS
  295. EfiGetNextVariableName (
  296. IN OUT UINTN *VariableNameSize,
  297. IN OUT CHAR16 *VariableName,
  298. IN OUT EFI_GUID *VendorGuid
  299. );
  300. PVOID
  301. FindSMBIOSTable(
  302. UCHAR RequestedTableType
  303. );
  304. VOID
  305. EfiCheckFirmwareRevision(
  306. VOID
  307. );
  308. EFI_STATUS
  309. EfiAllocateAndZeroMemory(
  310. EFI_MEMORY_TYPE MemoryType,
  311. UINTN Size,
  312. PVOID *ReturnPtr
  313. );
  314. #endif // _BLDRIA64_