liquidLevelOperation.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. #ifndef _ASM_IA64_SAL_H
  2. #define _ASM_IA64_SAL_H
  3. /*
  4. * System Abstraction Layer definitions.
  5. *
  6. * This is based on version 2.5 of the manual "IA-64 System
  7. * Abstraction Layer".
  8. *
  9. * Copyright (C) 2001 Intel
  10. * Copyright (C) 2002 Jenna Hall <jenna.s.hall@intel.com>
  11. * Copyright (C) 2001 Fred Lewis <frederick.v.lewis@intel.com>
  12. * Copyright (C) 1998, 1999, 2001, 2003 Hewlett-Packard Co
  13. * David Mosberger-Tang <davidm@hpl.hp.com>
  14. * Copyright (C) 1999 Srinivasa Prasad Thirumalachar <sprasad@sprasad.engr.sgi.com>
  15. *
  16. * 02/01/04 J. Hall Updated Error Record Structures to conform to July 2001
  17. * revision of the SAL spec.
  18. * 01/01/03 fvlewis Updated Error Record Structures to conform with Nov. 2000
  19. * revision of the SAL spec.
  20. * 99/09/29 davidm Updated for SAL 2.6.
  21. * 00/03/29 cfleck Updated SAL Error Logging info for processor (SAL 2.6)
  22. * (plus examples of platform error info structures from smariset @ Intel)
  23. */
  24. #define IA64_SAL_PLATFORM_FEATURE_BUS_LOCK_BIT 0
  25. #define IA64_SAL_PLATFORM_FEATURE_IRQ_REDIR_HINT_BIT 1
  26. #define IA64_SAL_PLATFORM_FEATURE_IPI_REDIR_HINT_BIT 2
  27. #define IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT_BIT 3
  28. #define IA64_SAL_PLATFORM_FEATURE_BUS_LOCK (1<<IA64_SAL_PLATFORM_FEATURE_BUS_LOCK_BIT)
  29. #define IA64_SAL_PLATFORM_FEATURE_IRQ_REDIR_HINT (1<<IA64_SAL_PLATFORM_FEATURE_IRQ_REDIR_HINT_BIT)
  30. #define IA64_SAL_PLATFORM_FEATURE_IPI_REDIR_HINT (1<<IA64_SAL_PLATFORM_FEATURE_IPI_REDIR_HINT_BIT)
  31. #define IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT (1<<IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT_BIT)
  32. #ifndef __ASSEMBLY__
  33. #include <linux/bcd.h>
  34. #include <linux/spinlock.h>
  35. #include <linux/efi.h>
  36. #include <asm/pal.h>
  37. #include <asm/fpu.h>
  38. extern spinlock_t sal_lock;
  39. /* SAL spec _requires_ eight args for each call. */
  40. #define __IA64_FW_CALL(entry,result,a0,a1,a2,a3,a4,a5,a6,a7) \
  41. result = (*entry)(a0,a1,a2,a3,a4,a5,a6,a7)
  42. # define IA64_FW_CALL(entry,result,args...) do { \
  43. unsigned long __ia64_sc_flags; \
  44. struct ia64_fpreg __ia64_sc_fr[6]; \
  45. ia64_save_scratch_fpregs(__ia64_sc_fr); \
  46. spin_lock_irqsave(&sal_lock, __ia64_sc_flags); \
  47. __IA64_FW_CALL(entry, result, args); \
  48. spin_unlock_irqrestore(&sal_lock, __ia64_sc_flags); \
  49. ia64_load_scratch_fpregs(__ia64_sc_fr); \
  50. } while (0)
  51. # define SAL_CALL(result,args...) \
  52. IA64_FW_CALL(ia64_sal, result, args);
  53. # define SAL_CALL_NOLOCK(result,args...) do { \
  54. unsigned long __ia64_scn_flags; \
  55. struct ia64_fpreg __ia64_scn_fr[6]; \
  56. ia64_save_scratch_fpregs(__ia64_scn_fr); \
  57. local_irq_save(__ia64_scn_flags); \
  58. __IA64_FW_CALL(ia64_sal, result, args); \
  59. local_irq_restore(__ia64_scn_flags); \
  60. ia64_load_scratch_fpregs(__ia64_scn_fr); \
  61. } while (0)
  62. # define SAL_CALL_REENTRANT(result,args...) do { \
  63. struct ia64_fpreg __ia64_scs_fr[6]; \
  64. ia64_save_scratch_fpregs(__ia64_scs_fr); \
  65. preempt_disable(); \
  66. __IA64_FW_CALL(ia64_sal, result, args); \
  67. preempt_enable(); \
  68. ia64_load_scratch_fpregs(__ia64_scs_fr); \
  69. } while (0)
  70. #define SAL_SET_VECTORS 0x01000000
  71. #define SAL_GET_STATE_INFO 0x01000001
  72. #define SAL_GET_STATE_INFO_SIZE 0x01000002
  73. #define SAL_CLEAR_STATE_INFO 0x01000003
  74. #define SAL_MC_RENDEZ 0x01000004
  75. #define SAL_MC_SET_PARAMS 0x01000005
  76. #define SAL_REGISTER_PHYSICAL_ADDR 0x01000006
  77. #define SAL_CACHE_FLUSH 0x01000008
  78. #define SAL_CACHE_INIT 0x01000009
  79. #define SAL_PCI_CONFIG_READ 0x01000010
  80. #define SAL_PCI_CONFIG_WRITE 0x01000011
  81. #define SAL_FREQ_BASE 0x01000012
  82. #define SAL_PHYSICAL_ID_INFO 0x01000013
  83. #define SAL_UPDATE_PAL 0x01000020
  84. struct ia64_sal_retval {
  85. /*
  86. * A zero status value indicates call completed without error.
  87. * A negative status value indicates reason of call failure.
  88. * A positive status value indicates success but an
  89. * informational value should be printed (e.g., "reboot for
  90. * change to take effect").
  91. */
  92. long status;
  93. unsigned long v0;
  94. unsigned long v1;
  95. unsigned long v2;
  96. };
  97. typedef struct ia64_sal_retval (*ia64_sal_handler) (u64, ...);
  98. enum {
  99. SAL_FREQ_BASE_PLATFORM = 0,
  100. SAL_FREQ_BASE_INTERVAL_TIMER = 1,
  101. SAL_FREQ_BASE_REALTIME_CLOCK = 2
  102. };
  103. /*
  104. * The SAL system table is followed by a variable number of variable
  105. * length descriptors. The structure of these descriptors follows
  106. * below.
  107. * The defininition follows SAL specs from July 2000
  108. */
  109. struct ia64_sal_systab {
  110. u8 signature[4]; /* should be "SST_" */
  111. u32 size; /* size of this table in bytes */
  112. u8 sal_rev_minor;
  113. u8 sal_rev_major;
  114. u16 entry_count; /* # of entries in variable portion */
  115. u8 checksum;
  116. u8 reserved1[7];
  117. u8 sal_a_rev_minor;
  118. u8 sal_a_rev_major;
  119. u8 sal_b_rev_minor;
  120. u8 sal_b_rev_major;
  121. /* oem_id & product_id: terminating NUL is missing if string is exactly 32 bytes long. */
  122. u8 oem_id[32];
  123. u8 product_id[32]; /* ASCII product id */
  124. u8 reserved2[8];
  125. };
  126. enum sal_systab_entry_type {
  127. SAL_DESC_ENTRY_POINT = 0,
  128. SAL_DESC_MEMORY = 1,
  129. SAL_DESC_PLATFORM_FEATURE = 2,
  130. SAL_DESC_TR = 3,
  131. SAL_DESC_PTC = 4,
  132. SAL_DESC_AP_WAKEUP = 5
  133. };
  134. /*
  135. * Entry type: Size:
  136. * 0 48
  137. * 1 32
  138. * 2 16
  139. * 3 32
  140. * 4 16
  141. * 5 16
  142. */
  143. #define SAL_DESC_SIZE(type) "\060\040\020\040\020\020"[(unsigned) type]
  144. typedef struct ia64_sal_desc_entry_point {
  145. u8 type;
  146. u8 reserved1[7];
  147. u64 pal_proc;
  148. u64 sal_proc;
  149. u64 gp;
  150. u8 reserved2[16];
  151. }ia64_sal_desc_entry_point_t;
  152. typedef struct ia64_sal_desc_memory {
  153. u8 type;
  154. u8 used_by_sal; /* needs to be mapped for SAL? */
  155. u8 mem_attr; /* current memory attribute setting */
  156. u8 access_rights; /* access rights set up by SAL */
  157. u8 mem_attr_mask; /* mask of supported memory attributes */
  158. u8 reserved1;
  159. u8 mem_type; /* memory type */
  160. u8 mem_usage; /* memory usage */
  161. u64 addr; /* physical address of memory */
  162. u32 length; /* length (multiple of 4KB pages) */
  163. u32 reserved2;
  164. u8 oem_reserved[8];
  165. } ia64_sal_desc_memory_t;
  166. typedef struct ia64_sal_desc_platform_feature {
  167. u8 type;
  168. u8 feature_mask;
  169. u8 reserved1[14];
  170. } ia64_sal_desc_platform_feature_t;
  171. typedef struct ia64_sal_desc_tr {
  172. u8 type;
  173. u8 tr_type; /* 0 == instruction, 1 == data */
  174. u8 regnum; /* translation register number */
  175. u8 reserved1[5];
  176. u64 addr; /* virtual address of area covered */
  177. u64 page_size; /* encoded page size */
  178. u8 reserved2[8];
  179. } ia64_sal_desc_tr_t;
  180. typedef struct ia64_sal_desc_ptc {
  181. u8 type;
  182. u8 reserved1[3];
  183. u32 num_domains; /* # of coherence domains */
  184. u64 domain_info; /* physical address of domain info table */
  185. } ia64_sal_desc_ptc_t;
  186. typedef struct ia64_sal_ptc_domain_info {
  187. u64 proc_count; /* number of processors in domain */
  188. u64 proc_list; /* physical address of LID array */
  189. } ia64_sal_ptc_domain_info_t;
  190. typedef struct ia64_sal_ptc_domain_proc_entry {
  191. u64 id : 8; /* id of processor */
  192. u64 eid : 8; /* eid of processor */
  193. } ia64_sal_ptc_domain_proc_entry_t;
  194. #define IA64_SAL_AP_EXTERNAL_INT 0
  195. typedef struct ia64_sal_desc_ap_wakeup {
  196. u8 type;
  197. u8 mechanism; /* 0 == external interrupt */
  198. u8 reserved1[6];
  199. u64 vector; /* interrupt vector in range 0x10-0xff */
  200. } ia64_sal_desc_ap_wakeup_t ;
  201. extern ia64_sal_handler ia64_sal;
  202. extern struct ia64_sal_desc_ptc *ia64_ptc_domain_info;
  203. extern unsigned short sal_revision; /* supported SAL spec revision */
  204. extern unsigned short sal_version; /* SAL version; OEM dependent */
  205. #define SAL_VERSION_CODE(major, minor) ((bin2bcd(major) << 8) | bin2bcd(minor))
  206. extern const char *ia64_sal_strerror (long status);
  207. extern void ia64_sal_init (struct ia64_sal_systab *sal_systab);
  208. /* SAL information type encodings */
  209. enum {
  210. SAL_INFO_TYPE_MCA = 0, /* Machine check abort information */
  211. SAL_INFO_TYPE_INIT = 1, /* Init information */
  212. SAL_INFO_TYPE_CMC = 2, /* Corrected machine check information */
  213. SAL_INFO_TYPE_CPE = 3 /* Corrected platform error information */
  214. };
  215. /* Encodings for machine check parameter types */
  216. enum {
  217. SAL_MC_PARAM_RENDEZ_INT = 1, /* Rendezvous interrupt */
  218. SAL_MC_PARAM_RENDEZ_WAKEUP = 2, /* Wakeup */
  219. SAL_MC_PARAM_CPE_INT = 3 /* Corrected Platform Error Int */
  220. };
  221. /* Encodings for rendezvous mechanisms */
  222. enum {
  223. SAL_MC_PARAM_MECHANISM_INT = 1, /* Use interrupt */
  224. SAL_MC_PARAM_MECHANISM_MEM = 2 /* Use memory synchronization variable*/
  225. };
  226. /* Encodings for vectors which can be registered by the OS with SAL */
  227. enum {
  228. SAL_VECTOR_OS_MCA = 0,
  229. SAL_VECTOR_OS_INIT = 1,
  230. SAL_VECTOR_OS_BOOT_RENDEZ = 2
  231. };
  232. /* Encodings for mca_opt parameter sent to SAL_MC_SET_PARAMS */
  233. #define SAL_MC_PARAM_RZ_ALWAYS 0x1
  234. #define SAL_MC_PARAM_BINIT_ESCALATE 0x10
  235. /*
  236. * Definition of the SAL Error Log from the SAL spec
  237. */
  238. /* SAL Error Record Section GUID Definitions */
  239. #define SAL_PROC_DEV_ERR_SECT_GUID \
  240. EFI_GUID(0xe429faf1, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  241. #define SAL_PLAT_MEM_DEV_ERR_SECT_GUID \
  242. EFI_GUID(0xe429faf2, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  243. #define SAL_PLAT_SEL_DEV_ERR_SECT_GUID \
  244. EFI_GUID(0xe429faf3, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  245. #define SAL_PLAT_PCI_BUS_ERR_SECT_GUID \
  246. EFI_GUID(0xe429faf4, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  247. #define SAL_PLAT_SMBIOS_DEV_ERR_SECT_GUID \
  248. EFI_GUID(0xe429faf5, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  249. #define SAL_PLAT_PCI_COMP_ERR_SECT_GUID \
  250. EFI_GUID(0xe429faf6, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  251. #define SAL_PLAT_SPECIFIC_ERR_SECT_GUID \
  252. EFI_GUID(0xe429faf7, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  253. #define SAL_PLAT_HOST_CTLR_ERR_SECT_GUID \
  254. EFI_GUID(0xe429faf8, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  255. #define SAL_PLAT_BUS_ERR_SECT_GUID \
  256. EFI_GUID(0xe429faf9, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  257. #define PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID \
  258. EFI_GUID(0x6cb0a200, 0x893a, 0x11da, 0x96, 0xd2, 0x0, 0x10, 0x83, 0xff, \
  259. 0xca, 0x4d)
  260. #define MAX_CACHE_ERRORS 6
  261. #define MAX_TLB_ERRORS 6
  262. #define MAX_BUS_ERRORS 1
  263. /* Definition of version according to SAL spec for logging purposes */
  264. typedef struct sal_log_revision {
  265. u8 minor; /* BCD (0..99) */
  266. u8 major; /* BCD (0..99) */
  267. } sal_log_revision_t;
  268. /* Definition of timestamp according to SAL spec for logging purposes */
  269. typedef struct sal_log_timestamp {
  270. u8 slh_second; /* Second (0..59) */
  271. u8 slh_minute; /* Minute (0..59) */
  272. u8 slh_hour; /* Hour (0..23) */
  273. u8 slh_reserved;
  274. u8 slh_day; /* Day (1..31) */
  275. u8 slh_month; /* Month (1..12) */
  276. u8 slh_year; /* Year (00..99) */
  277. u8 slh_century; /* Century (19, 20, 21, ...) */
  278. } sal_log_timestamp_t;
  279. /* Definition of log record header structures */
  280. typedef struct sal_log_record_header {
  281. u64 id; /* Unique monotonically increasing ID */
  282. sal_log_revision_t revision; /* Major and Minor revision of header */
  283. u8 severity; /* Error Severity */
  284. u8 validation_bits; /* 0: platform_guid, 1: !timestamp */
  285. u32 len; /* Length of this error log in bytes */
  286. sal_log_timestamp_t timestamp; /* Timestamp */
  287. efi_guid_t platform_guid; /* Unique OEM Platform ID */
  288. } sal_log_record_header_t;
  289. #define sal_log_severity_recoverable 0
  290. #define sal_log_severity_fatal 1
  291. #define sal_log_severity_corrected 2
  292. /*
  293. * Error Recovery Info (ERI) bit decode. From SAL Spec section B.2.2 Table B-3
  294. * Error Section Error_Recovery_Info Field Definition.
  295. */
  296. #define ERI_NOT_VALID 0x0 /* Error Recovery Field is not valid */
  297. #define ERI_NOT_ACCESSIBLE 0x30 /* Resource not accessible */
  298. #define ERI_CONTAINMENT_WARN 0x22 /* Corrupt data propagated */
  299. #define ERI_UNCORRECTED_ERROR 0x20 /* Uncorrected error */
  300. #define ERI_COMPONENT_RESET 0x24 /* Component must be reset */
  301. #define ERI_CORR_ERROR_LOG 0x21 /* Corrected error, needs logging */
  302. #define ERI_CORR_ERROR_THRESH 0x29 /* Corrected error threshold exceeded */
  303. /* Definition of log section header structures */
  304. typedef struct sal_log_sec_header {
  305. efi_guid_t guid; /* Unique Section ID */
  306. sal_log_revision_t revision; /* Major and Minor revision of Section */
  307. u8 error_recovery_info; /* Platform error recovery status */
  308. u8 reserved;
  309. u32 len; /* Section length */
  310. } sal_log_section_hdr_t;
  311. typedef struct sal_log_mod_error_info {
  312. struct {
  313. u64 check_info : 1,
  314. requestor_identifier : 1,
  315. responder_identifier : 1,
  316. target_identifier : 1,
  317. precise_ip : 1,
  318. reserved : 59;
  319. } valid;
  320. u64 check_info;
  321. u64 requestor_identifier;
  322. u64 responder_identifier;
  323. u64 target_identifier;
  324. u64 precise_ip;
  325. } sal_log_mod_error_info_t;
  326. typedef struct sal_processor_static_info {
  327. struct {
  328. u64 minstate : 1,
  329. br : 1,
  330. cr : 1,
  331. ar : 1,
  332. rr : 1,
  333. fr : 1,
  334. reserved : 58;