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.

381 lines
11 KiB

  1. //
  2. //
  3. // Module name
  4. // i64fw.h
  5. // Author
  6. // Arad Rostampour ([email protected]) Mar-22-99
  7. // Description
  8. // Defines SAL/PAL data structures and prototypes
  9. //
  10. #ifndef _I64FW_H_
  11. #define _I64FW_H_
  12. #define SET_ITR_AND_DTR 3
  13. #define SET_DTR_ONLY 2
  14. #define SET_ITR_ONLY 1
  15. // TR for PAL is:
  16. // ed=1, PPN=0 (to be ORed in), RWX privledge only for ring 0, dirty/accessed bit set,
  17. // cacheable memory, present bit set.
  18. #define HAL_SAL_PAL_TR_ATTRIB TR_VALUE(1,0,3,0,1,1,0,1)
  19. #define HAL_TR_ATTRIBUTE_PPN_MASK 0x0000FFFFFFFFF000I64
  20. #define HAL_RID_MASK 0x00000000FFFFFF00I64
  21. #define HAL_RR_PS_VE 0x69
  22. #define HAL_ITIR_PPN_MASK 0x7FFF000000000000I64
  23. #define PAL_HIGHEST_STATIC_FUNCTION_ID 255
  24. #define REGULAR_MEMORY 0
  25. #define PAL_CODE_MEM 1
  26. #define SAL_CODE_MEM 4
  27. #define SAL_DATA_MEM 5
  28. #define FW_RESERVED 12
  29. #define FIRMWARE_CODE 4
  30. #define FW_SAL_PAL 0
  31. #define OEM_ID_LENGTH RTL_NUMBER_OF_FIELD( SST_HEADER, OemId )
  32. #define OEM_PRODUCT_ID_LENGTH RTL_NUMBER_OF_FIELD( SST_HEADER, ProductId )
  33. #define MASK_16KB 0xffffffffffffc000I64
  34. #define MASK_16MB 0xffffffffff000000I64
  35. #define SIZE_IN_BYTES_16KB 16384
  36. // SAL_STATUS and PAL_STATUS is a 64-bit copy of the value in ReturnValues[0]
  37. typedef LONGLONG SAL_STATUS;
  38. typedef LONGLONG PAL_STATUS;
  39. // SAL and PAL return up to 4 64-bit return values; HalpSalCall() and
  40. // HalpPalCall() will return a pointer to this structure
  41. typedef struct _SAL_PAL_RETURN_VALUES {
  42. LONGLONG ReturnValues[4];
  43. } SAL_PAL_RETURN_VALUES, *PSAL_PAL_RETURN_VALUES;
  44. typedef struct _HAL_PLATFORM_ID {
  45. ANSI_STRING VendorId;
  46. ANSI_STRING DeviceId;
  47. } HAL_PLATFORM_ID, *PHAL_PLATFORM_ID;
  48. typedef struct _SST_MEMORY_LIST {
  49. ULONGLONG PhysicalAddress;
  50. ULONGLONG VirtualAddress;
  51. ULONGLONG Length;
  52. UCHAR NeedVaReg;
  53. struct _SST_MEMORY_LIST *Next;
  54. } SST_MEMORY_LIST, *PSST_MEMORY_LIST;
  55. // Function Prototypes: SAL takes 8 arguments, PAL takes 4
  56. VOID
  57. HalpSetupTranslationRegisters(
  58. ULONGLONG VAddr,
  59. ULONGLONG PAddr,
  60. ULONG PageSize,
  61. ULONG TrNumber,
  62. ULONG RidValue,
  63. ULONG Mode
  64. );
  65. SAL_STATUS
  66. HalpSalCall(
  67. IN LONGLONG FunctionId,
  68. IN LONGLONG Arg1,
  69. IN LONGLONG Arg2,
  70. IN LONGLONG Arg3,
  71. IN LONGLONG Arg4,
  72. IN LONGLONG Arg5,
  73. IN LONGLONG Arg6,
  74. IN LONGLONG Arg7,
  75. OUT PSAL_PAL_RETURN_VALUES ReturnValues
  76. );
  77. PAL_STATUS
  78. HalpPalCall(
  79. IN LONGLONG FunctionId,
  80. IN LONGLONG Arg1,
  81. IN LONGLONG Arg2,
  82. IN LONGLONG Arg3,
  83. OUT PSAL_PAL_RETURN_VALUES ReturnValues
  84. );
  85. SAL_PAL_RETURN_VALUES
  86. HalpSalProc(
  87. LONGLONG FunctionId,
  88. LONGLONG Arg1,
  89. LONGLONG Arg2,
  90. LONGLONG Arg3,
  91. LONGLONG Arg4,
  92. LONGLONG Arg5,
  93. LONGLONG Arg6,
  94. LONGLONG Arg7
  95. );
  96. SAL_PAL_RETURN_VALUES
  97. HalpPalProc(
  98. LONGLONG FunctionId,
  99. LONGLONG Arg1,
  100. LONGLONG Arg2,
  101. LONGLONG Arg3
  102. );
  103. SAL_PAL_RETURN_VALUES
  104. HalpPalProcPhysicalStatic(
  105. LONGLONG FunctionId,
  106. LONGLONG Arg1,
  107. LONGLONG Arg2,
  108. LONGLONG Arg3
  109. );
  110. SAL_PAL_RETURN_VALUES
  111. HalpPalProcPhysicalStacked(
  112. LONGLONG FunctionId,
  113. LONGLONG Arg1,
  114. LONGLONG Arg2,
  115. LONGLONG Arg3
  116. );
  117. NTSTATUS
  118. HalpGetPlatformId(
  119. OUT PHAL_PLATFORM_ID PlatformId
  120. );
  121. VOID
  122. InternalTestSal(
  123. IN LONGLONG FunctionId,
  124. IN LONGLONG Arg1,
  125. IN LONGLONG Arg2,
  126. IN LONGLONG Arg3,
  127. IN LONGLONG Arg4,
  128. IN LONGLONG Arg5,
  129. IN LONGLONG Arg6,
  130. IN LONGLONG Arg7,
  131. OUT PSAL_PAL_RETURN_VALUES ReturnValues
  132. );
  133. VOID
  134. InternalTestPal(
  135. IN LONGLONG FunctionId,
  136. IN LONGLONG Arg1,
  137. IN LONGLONG Arg2,
  138. IN LONGLONG Arg3,
  139. OUT PSAL_PAL_RETURN_VALUES ReturnValues
  140. );
  141. // For SAL cache flush
  142. #define FLUSH_INSTRUCTION_CACHE 1
  143. #define FLUSH_DATA_CACHE 2
  144. #define FLUSH_INSTRUCTION_AND_DATA_CACHE 3
  145. #define FLUSH_COHERENT 4
  146. // iA-64 defined SAL function IDs in hex format as in the SAL spec
  147. #define SAL_SET_VECTORS 0x01000000I64
  148. #define SAL_GET_STATE_INFO 0x01000001I64
  149. #define SAL_GET_STATE_INFO_SIZE 0x01000002I64
  150. #define SAL_CLEAR_STATE_INFO 0x01000003I64
  151. #define SAL_MC_RENDEZ 0x01000004I64
  152. #define SAL_MC_SET_PARAMS 0x01000005I64
  153. #define SAL_REGISTER_VIRTUAL_ADDR 0x01000050I64
  154. #define SAL_REGISTER_PHYSICAL_ADDR 0x01000006I64
  155. #define SAL_CACHE_FLUSH 0x01000008I64
  156. #define SAL_CACHE_INIT 0x01000009I64
  157. #define SAL_PCI_CONFIG_READ 0x01000010I64
  158. #define SAL_PCI_CONFIG_WRITE 0x01000011I64
  159. #define SAL_FREQ_BASE 0x01000012I64
  160. #define SAL_UPDATE_PAL 0x01000020I64
  161. // iA-64 defined SAL return values
  162. #define SAL_STATUS_SUCCESS 0I64
  163. #define SAL_STATUS_SUCCESS_WITH_OVERFLOW 1I64
  164. #define SAL_STATUS_SUCCESS_MORE_RECORDS 3I64
  165. #define SAL_STATUS_NOT_IMPLEMENTED -1I64
  166. #define SAL_STATUS_INVALID_ARGUMENT -2I64
  167. #define SAL_STATUS_ERROR -3I64
  168. #define SAL_STATUS_VA_NOT_REGISTERED -4I64
  169. #define SAL_STATUS_NO_INFORMATION_AVAILABLE -5I64
  170. #define SAL_STATUS_INSUFFICIENT_NVM_MEMORY -6I64
  171. #define SAL_STATUS_INSUFFICIENT_SCRATCH_BUFFER -7I64
  172. #define SAL_STATUS_INVALID_INTERRUPT_VECTOR -8I64
  173. #define SAL_STATUS_PARTITION_TYPE_EXISTS -9I64
  174. #define SAL_STATUS_REQUESTED_MEMORY_UNAVAILABLE -9I64
  175. #define SAL_STATUS_UNABLE_TO_WRITE_NVM -10I64
  176. #define SAL_STATUS_INVALID_PARTITION_TYPE -11I64
  177. #define SAL_STATUS_INVALID_NVM_OBJECT_ID -12I64
  178. #define SAL_STATUS_NVM_OBJECT_MAXIMUM_PARITIONS -13I64
  179. #define SAL_STATUS_INSUFFICIENT_SPACE_FOR_WRITE -14I64
  180. #define SAL_STATUS_INSUFFICIENT_SPACE_FOR_READ -15I64
  181. #define SAL_STATUS_SCRATCH_BUFFER_REQUIRED -16I64
  182. #define SAL_STATUS_INSUFFICIENT_NVM_SPACE_FOR_SUBFUNCTION -17I64
  183. #define SAL_STATUS_INVALID_PARTITION_VALUE -18I64
  184. #define SAL_STATUS_RECORD_ORIENTED_IO_NOT_SUPPORTED -19I64
  185. #define SAL_STATUS_BAD_RECORD_FORMAT_OR_KEYWORD_VARIABLE -20I64
  186. #define SAL_SUCCESSFUL( /* SAL_PAL_RETURN_VALUE */ _rv ) (((_rv).ReturnValues[0]) >= (LONGLONG)0)
  187. //
  188. // SAL descriptor types
  189. //
  190. typedef enum {
  191. SAL_PAL_ENTRY_POINT_TYPE = 0,
  192. SST_MEMORY_DESCRIPTOR_TYPE,
  193. PLATFORM_FEATURES_TYPE,
  194. TRANSLATION_REGISTER_TYPE,
  195. PTC_COHERENCE_DOMAIN_TYPE,
  196. AP_WAKEUP_DESCRIPTOR_TYPE
  197. };
  198. //
  199. // IA64 PAL: PAL_VERSION
  200. //
  201. typedef union _PAL_VERSION_STRUCT {
  202. struct {
  203. UCHAR PAL_B_Revision;
  204. UCHAR PAL_B_Model;
  205. UCHAR PAL_Reserved1;
  206. UCHAR PAL_Vendor;
  207. UCHAR PAL_A_Revision;
  208. UCHAR PAL_A_Model;
  209. UCHAR PAL_Reserved2[2];
  210. };
  211. ULONGLONG ReturnValue;
  212. }PAL_VERSION_STRUCT, *PPAL_VERSION_STRUCT;
  213. //
  214. // IA64 SAL: SAL_REVISION definitions
  215. //
  216. typedef union _SAL_REVISION {
  217. USHORT Revision; // Major and Minor revision:
  218. struct {
  219. UCHAR Minor; // Byte0: Minor.
  220. UCHAR Major; // Byte1: Major.
  221. };
  222. } SAL_REVISION, *PSAL_REVISION;
  223. #define HALP_SAL_REVISION_2_90 0x0290 /* v2.9 */
  224. #define HALP_SAL_REVISION_MAX 0xffff
  225. //
  226. // Format of the SAL System Table (SST) Header. SAL Specs July 2000, Revision: 2.9.
  227. // The SST is followed by a variable number of entries with varying length.
  228. //
  229. typedef struct _SST_HEADER {
  230. ULONG Signature;
  231. ULONG Length;
  232. USHORT SalRev;
  233. USHORT EntryCount;
  234. UCHAR CheckSum;
  235. UCHAR Reserved1[7];
  236. USHORT Sal_A_Version;
  237. USHORT Sal_B_Version;
  238. UCHAR OemId[32];
  239. UCHAR ProductId[32];
  240. UCHAR Reserved2[8];
  241. } SST_HEADER, *PSST_HEADER;
  242. //
  243. // Global Data used by the SAL/PAL support routines
  244. //
  245. // _HALP_SAL_PAL_DATA.Flags:
  246. #define HALP_SALPAL_FIX_MCE_LOG_ID 0x1
  247. #define HALP_SALPAL_MCE_PROCESSOR_CPUIDINFO_OMITTED 0x2
  248. #define HALP_SALPAL_MCE_PROCESSOR_STATICINFO_PARTIAL 0x4
  249. #define HALP_SALPAL_FIX_MP_SAFE 0x8
  250. typedef struct _HALP_SAL_PAL_DATA {
  251. PSST_HEADER SalSystemTable;
  252. ULONGLONG PalTrBase;
  253. ULONGLONG PalTrSize;
  254. NTSTATUS Status;
  255. SAL_REVISION SalRevision; // Copy of SalSystemTable.SalRev in case we unmap SST.
  256. USHORT Flags;
  257. PAL_VERSION_STRUCT PalVersion;
  258. PUCHAR SmBiosVersion;
  259. ULONGLONG Reserved[4];
  260. } HALP_SAL_PAL_DATA, *PHALP_SAL_PAL_DATA;
  261. #define SMBIOS_STRUCT_HEADER_TYPE_FIELD 0
  262. #define SMBIOS_STRUCT_HEADER_LENGTH_FIELD 1
  263. #define SMBIOS_STRUCT_HEADER_HANDLE_FIELD 2
  264. #define SMBIOS_TYPE0_STRUCT_BIOSVER_FIELD 5
  265. //
  266. // Listing of Descriptors in the SAL System Table and their formats
  267. //
  268. typedef struct _SAL_PAL_ENTRY_POINT {
  269. UCHAR EntryType;
  270. UCHAR Reserved0[7];
  271. ULONGLONG PalEntryPoint;
  272. ULONGLONG SalEntryPoint;
  273. ULONGLONG GlobalPointer;
  274. UCHAR Reserved1[16];
  275. } SAL_PAL_ENTRY_POINT, *PSAL_PAL_ENTRY_POINT;
  276. typedef struct _SST_MEMORY_DESCRIPTOR {
  277. UCHAR EntryType;
  278. UCHAR NeedVaReg;
  279. UCHAR CurrentAttribute;
  280. UCHAR PageAccessRights;
  281. UCHAR SupportedAttribute;
  282. UCHAR Reserved1[1];
  283. UCHAR MemoryType;
  284. UCHAR MemoryUsage;
  285. ULONGLONG MemoryAddress;
  286. ULONG Length;
  287. UCHAR Reserved[4];
  288. UCHAR OemReserved[8];
  289. } SST_MEMORY_DESCRIPTOR, *PSST_MEMORY_DESCRIPTOR;
  290. typedef struct _PLATFORM_FEATURES {
  291. UCHAR EntryType;
  292. UCHAR FeatureList;
  293. UCHAR Reserved[14];
  294. } PLATFORM_FEATURES, *PPLATFORM_FEATURES;
  295. typedef struct _PTC_COHERENCE_DOMAIN {
  296. UCHAR EntryType;
  297. UCHAR Reserved[3];
  298. ULONG NumberOfDomains;
  299. ULONGLONG CoherenceDomainInfo;
  300. } PTC_COHERENCE_DOMAIN, *PPTC_COHERENCE_DOMAIN;
  301. typedef struct _COHERENCE_DOMAIN_INFO {
  302. ULONGLONG NumberOfProcessors;
  303. ULONGLONG LocalIdRegisters;
  304. } COHERENCE_DOMAIN_INFO, *PCOHERENCE_DOMAIN_INFO;
  305. typedef struct _AP_WAKEUP_DESCRIPTOR {
  306. UCHAR EntryType;
  307. UCHAR WakeupMechanism;
  308. UCHAR Reserved[6];
  309. ULONGLONG WakeupVector;
  310. } AP_WAKEUP_DESCRIPTOR, *PAP_WAKEUP_DESCRIPTOR;
  311. typedef struct _TRANSLATION_REGISTER {
  312. UCHAR EntryType;
  313. UCHAR TRType;
  314. UCHAR TRNumber;
  315. UCHAR Reserved1[5];
  316. ULONGLONG VirtualAddress;
  317. ULONGLONG PageSize;
  318. UCHAR Reserved2[8];
  319. } TRANSLATION_REGISTER, *PTRANSLATION_REGISTER;
  320. #endif // _I64FW_H_