sal.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917
  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;
  335. } valid;
  336. pal_min_state_area_t min_state_area;
  337. u64 br[8];
  338. u64 cr[128];
  339. u64 ar[128];
  340. u64 rr[8];
  341. struct ia64_fpreg __attribute__ ((packed)) fr[128];
  342. } sal_processor_static_info_t;
  343. struct sal_cpuid_info {
  344. u64 regs[5];
  345. u64 reserved;
  346. };
  347. typedef struct sal_log_processor_info {
  348. sal_log_section_hdr_t header;
  349. struct {
  350. u64 proc_error_map : 1,
  351. proc_state_param : 1,
  352. proc_cr_lid : 1,
  353. psi_static_struct : 1,
  354. num_cache_check : 4,
  355. num_tlb_check : 4,
  356. num_bus_check : 4,
  357. num_reg_file_check : 4,
  358. num_ms_check : 4,
  359. cpuid_info : 1,
  360. reserved1 : 39;
  361. } valid;
  362. u64 proc_error_map;
  363. u64 proc_state_parameter;
  364. u64 proc_cr_lid;
  365. /*
  366. * The rest of this structure consists of variable-length arrays, which can't be
  367. * expressed in C.
  368. */
  369. sal_log_mod_error_info_t info[0];
  370. /*
  371. * This is what the rest looked like if C supported variable-length arrays:
  372. *
  373. * sal_log_mod_error_info_t cache_check_info[.valid.num_cache_check];
  374. * sal_log_mod_error_info_t tlb_check_info[.valid.num_tlb_check];
  375. * sal_log_mod_error_info_t bus_check_info[.valid.num_bus_check];
  376. * sal_log_mod_error_info_t reg_file_check_info[.valid.num_reg_file_check];
  377. * sal_log_mod_error_info_t ms_check_info[.valid.num_ms_check];
  378. * struct sal_cpuid_info cpuid_info;
  379. * sal_processor_static_info_t processor_static_info;
  380. */
  381. } sal_log_processor_info_t;
  382. /* Given a sal_log_processor_info_t pointer, return a pointer to the processor_static_info: */
  383. #define SAL_LPI_PSI_INFO(l) \
  384. ({ sal_log_processor_info_t *_l = (l); \
  385. ((sal_processor_static_info_t *) \
  386. ((char *) _l->info + ((_l->valid.num_cache_check + _l->valid.num_tlb_check \
  387. + _l->valid.num_bus_check + _l->valid.num_reg_file_check \
  388. + _l->valid.num_ms_check) * sizeof(sal_log_mod_error_info_t) \
  389. + sizeof(struct sal_cpuid_info)))); \
  390. })
  391. /* platform error log structures */
  392. typedef struct sal_log_mem_dev_err_info {
  393. sal_log_section_hdr_t header;
  394. struct {
  395. u64 error_status : 1,
  396. physical_addr : 1,
  397. addr_mask : 1,
  398. node : 1,
  399. card : 1,
  400. module : 1,
  401. bank : 1,
  402. device : 1,
  403. row : 1,
  404. column : 1,
  405. bit_position : 1,
  406. requestor_id : 1,
  407. responder_id : 1,
  408. target_id : 1,
  409. bus_spec_data : 1,
  410. oem_id : 1,
  411. oem_data : 1,
  412. reserved : 47;
  413. } valid;
  414. u64 error_status;
  415. u64 physical_addr;
  416. u64 addr_mask;
  417. u16 node;
  418. u16 card;
  419. u16 module;
  420. u16 bank;
  421. u16 device;
  422. u16 row;
  423. u16 column;
  424. u16 bit_position;
  425. u64 requestor_id;
  426. u64 responder_id;
  427. u64 target_id;
  428. u64 bus_spec_data;
  429. u8 oem_id[16];
  430. u8 oem_data[1]; /* Variable length data */
  431. } sal_log_mem_dev_err_info_t;
  432. typedef struct sal_log_sel_dev_err_info {
  433. sal_log_section_hdr_t header;
  434. struct {
  435. u64 record_id : 1,
  436. record_type : 1,
  437. generator_id : 1,
  438. evm_rev : 1,
  439. sensor_type : 1,
  440. sensor_num : 1,
  441. event_dir : 1,
  442. event_data1 : 1,
  443. event_data2 : 1,
  444. event_data3 : 1,
  445. reserved : 54;
  446. } valid;
  447. u16 record_id;
  448. u8 record_type;
  449. u8 timestamp[4];
  450. u16 generator_id;
  451. u8 evm_rev;
  452. u8 sensor_type;
  453. u8 sensor_num;
  454. u8 event_dir;
  455. u8 event_data1;
  456. u8 event_data2;
  457. u8 event_data3;
  458. } sal_log_sel_dev_err_info_t;
  459. typedef struct sal_log_pci_bus_err_info {
  460. sal_log_section_hdr_t header;
  461. struct {
  462. u64 err_status : 1,
  463. err_type : 1,
  464. bus_id : 1,
  465. bus_address : 1,
  466. bus_data : 1,
  467. bus_cmd : 1,
  468. requestor_id : 1,
  469. responder_id : 1,
  470. target_id : 1,
  471. oem_data : 1,
  472. reserved : 54;
  473. } valid;
  474. u64 err_status;
  475. u16 err_type;
  476. u16 bus_id;
  477. u32 reserved;
  478. u64 bus_address;
  479. u64 bus_data;
  480. u64 bus_cmd;
  481. u64 requestor_id;
  482. u64 responder_id;
  483. u64 target_id;
  484. u8 oem_data[1]; /* Variable length data */
  485. } sal_log_pci_bus_err_info_t;
  486. typedef struct sal_log_smbios_dev_err_info {
  487. sal_log_section_hdr_t header;
  488. struct {
  489. u64 event_type : 1,
  490. length : 1,
  491. time_stamp : 1,
  492. data : 1,
  493. reserved1 : 60;
  494. } valid;
  495. u8 event_type;
  496. u8 length;
  497. u8 time_stamp[6];
  498. u8 data[1]; /* data of variable length, length == slsmb_length */
  499. } sal_log_smbios_dev_err_info_t;
  500. typedef struct sal_log_pci_comp_err_info {
  501. sal_log_section_hdr_t header;
  502. struct {
  503. u64 err_status : 1,
  504. comp_info : 1,
  505. num_mem_regs : 1,
  506. num_io_regs : 1,
  507. reg_data_pairs : 1,
  508. oem_data : 1,
  509. reserved : 58;
  510. } valid;
  511. u64 err_status;
  512. struct {
  513. u16 vendor_id;
  514. u16 device_id;
  515. u8 class_code[3];
  516. u8 func_num;
  517. u8 dev_num;
  518. u8 bus_num;
  519. u8 seg_num;
  520. u8 reserved[5];
  521. } comp_info;
  522. u32 num_mem_regs;
  523. u32 num_io_regs;
  524. u64 reg_data_pairs[1];
  525. /*
  526. * array of address/data register pairs is num_mem_regs + num_io_regs elements
  527. * long. Each array element consists of a u64 address followed by a u64 data
  528. * value. The oem_data array immediately follows the reg_data_pairs array
  529. */
  530. u8 oem_data[1]; /* Variable length data */
  531. } sal_log_pci_comp_err_info_t;
  532. typedef struct sal_log_plat_specific_err_info {
  533. sal_log_section_hdr_t header;
  534. struct {
  535. u64 err_status : 1,
  536. guid : 1,
  537. oem_data : 1,
  538. reserved : 61;
  539. } valid;
  540. u64 err_status;
  541. efi_guid_t guid;
  542. u8 oem_data[1]; /* platform specific variable length data */
  543. } sal_log_plat_specific_err_info_t;
  544. typedef struct sal_log_host_ctlr_err_info {
  545. sal_log_section_hdr_t header;
  546. struct {
  547. u64 err_status : 1,
  548. requestor_id : 1,
  549. responder_id : 1,
  550. target_id : 1,
  551. bus_spec_data : 1,
  552. oem_data : 1,
  553. reserved : 58;
  554. } valid;
  555. u64 err_status;
  556. u64 requestor_id;
  557. u64 responder_id;
  558. u64 target_id;
  559. u64 bus_spec_data;
  560. u8 oem_data[1]; /* Variable length OEM data */
  561. } sal_log_host_ctlr_err_info_t;
  562. typedef struct sal_log_plat_bus_err_info {
  563. sal_log_section_hdr_t header;
  564. struct {
  565. u64 err_status : 1,
  566. requestor_id : 1,
  567. responder_id : 1,
  568. target_id : 1,
  569. bus_spec_data : 1,
  570. oem_data : 1,
  571. reserved : 58;
  572. } valid;
  573. u64 err_status;
  574. u64 requestor_id;
  575. u64 responder_id;
  576. u64 target_id;
  577. u64 bus_spec_data;
  578. u8 oem_data[1]; /* Variable length OEM data */
  579. } sal_log_plat_bus_err_info_t;
  580. /* Overall platform error section structure */
  581. typedef union sal_log_platform_err_info {
  582. sal_log_mem_dev_err_info_t mem_dev_err;
  583. sal_log_sel_dev_err_info_t sel_dev_err;
  584. sal_log_pci_bus_err_info_t pci_bus_err;
  585. sal_log_smbios_dev_err_info_t smbios_dev_err;
  586. sal_log_pci_comp_err_info_t pci_comp_err;
  587. sal_log_plat_specific_err_info_t plat_specific_err;
  588. sal_log_host_ctlr_err_info_t host_ctlr_err;
  589. sal_log_plat_bus_err_info_t plat_bus_err;
  590. } sal_log_platform_err_info_t;
  591. /* SAL log over-all, multi-section error record structure (processor+platform) */
  592. typedef struct err_rec {
  593. sal_log_record_header_t sal_elog_header;
  594. sal_log_processor_info_t proc_err;
  595. sal_log_platform_err_info_t plat_err;
  596. u8 oem_data_pad[1024];
  597. } ia64_err_rec_t;
  598. /*
  599. * Now define a couple of inline functions for improved type checking
  600. * and convenience.
  601. */
  602. extern s64 ia64_sal_cache_flush (u64 cache_type);
  603. extern void __init check_sal_cache_flush (void);
  604. /* Initialize all the processor and platform level instruction and data caches */
  605. static inline s64
  606. ia64_sal_cache_init (void)
  607. {
  608. struct ia64_sal_retval isrv;
  609. SAL_CALL(isrv, SAL_CACHE_INIT, 0, 0, 0, 0, 0, 0, 0);
  610. return isrv.status;
  611. }
  612. /*
  613. * Clear the processor and platform information logged by SAL with respect to the machine
  614. * state at the time of MCA's, INITs, CMCs, or CPEs.
  615. */
  616. static inline s64
  617. ia64_sal_clear_state_info (u64 sal_info_type)
  618. {
  619. struct ia64_sal_retval isrv;
  620. SAL_CALL_REENTRANT(isrv, SAL_CLEAR_STATE_INFO, sal_info_type, 0,
  621. 0, 0, 0, 0, 0);
  622. return isrv.status;
  623. }
  624. /* Get the processor and platform information logged by SAL with respect to the machine
  625. * state at the time of the MCAs, INITs, CMCs, or CPEs.
  626. */
  627. static inline u64
  628. ia64_sal_get_state_info (u64 sal_info_type, u64 *sal_info)
  629. {
  630. struct ia64_sal_retval isrv;
  631. SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO, sal_info_type, 0,
  632. sal_info, 0, 0, 0, 0);
  633. if (isrv.status)
  634. return 0;
  635. return isrv.v0;
  636. }
  637. /*
  638. * Get the maximum size of the information logged by SAL with respect to the machine state
  639. * at the time of MCAs, INITs, CMCs, or CPEs.
  640. */
  641. static inline u64
  642. ia64_sal_get_state_info_size (u64 sal_info_type)
  643. {
  644. struct ia64_sal_retval isrv;
  645. SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO_SIZE, sal_info_type, 0,
  646. 0, 0, 0, 0, 0);
  647. if (isrv.status)
  648. return 0;
  649. return isrv.v0;
  650. }
  651. /*
  652. * Causes the processor to go into a spin loop within SAL where SAL awaits a wakeup from
  653. * the monarch processor. Must not lock, because it will not return on any cpu until the
  654. * monarch processor sends a wake up.
  655. */
  656. static inline s64
  657. ia64_sal_mc_rendez (void)
  658. {
  659. struct ia64_sal_retval isrv;
  660. SAL_CALL_NOLOCK(isrv, SAL_MC_RENDEZ, 0, 0, 0, 0, 0, 0, 0);
  661. return isrv.status;
  662. }
  663. /*
  664. * Allow the OS to specify the interrupt number to be used by SAL to interrupt OS during
  665. * the machine check rendezvous sequence as well as the mechanism to wake up the
  666. * non-monarch processor at the end of machine check processing.
  667. * Returns the complete ia64_sal_retval because some calls return more than just a status
  668. * value.
  669. */
  670. static inline struct ia64_sal_retval
  671. ia64_sal_mc_set_params (u64 param_type, u64 i_or_m, u64 i_or_m_val, u64 timeout, u64 rz_always)
  672. {
  673. struct ia64_sal_retval isrv;
  674. SAL_CALL(isrv, SAL_MC_SET_PARAMS, param_type, i_or_m, i_or_m_val,
  675. timeout, rz_always, 0, 0);
  676. return isrv;
  677. }
  678. /* Read from PCI configuration space */
  679. static inline s64
  680. ia64_sal_pci_config_read (u64 pci_config_addr, int type, u64 size, u64 *value)
  681. {
  682. struct ia64_sal_retval isrv;
  683. SAL_CALL(isrv, SAL_PCI_CONFIG_READ, pci_config_addr, size, type, 0, 0, 0, 0);
  684. if (value)
  685. *value = isrv.v0;
  686. return isrv.status;
  687. }
  688. /* Write to PCI configuration space */
  689. static inline s64
  690. ia64_sal_pci_config_write (u64 pci_config_addr, int type, u64 size, u64 value)
  691. {
  692. struct ia64_sal_retval isrv;
  693. SAL_CALL(isrv, SAL_PCI_CONFIG_WRITE, pci_config_addr, size, value,
  694. type, 0, 0, 0);
  695. return isrv.status;
  696. }
  697. /*
  698. * Register physical addresses of locations needed by SAL when SAL procedures are invoked
  699. * in virtual mode.
  700. */
  701. static inline s64
  702. ia64_sal_register_physical_addr (u64 phys_entry, u64 phys_addr)
  703. {
  704. struct ia64_sal_retval isrv;
  705. SAL_CALL(isrv, SAL_REGISTER_PHYSICAL_ADDR, phys_entry, phys_addr,
  706. 0, 0, 0, 0, 0);
  707. return isrv.status;
  708. }
  709. /*
  710. * Register software dependent code locations within SAL. These locations are handlers or
  711. * entry points where SAL will pass control for the specified event. These event handlers
  712. * are for the bott rendezvous, MCAs and INIT scenarios.
  713. */
  714. static inline s64
  715. ia64_sal_set_vectors (u64 vector_type,
  716. u64 handler_addr1, u64 gp1, u64 handler_len1,
  717. u64 handler_addr2, u64 gp2, u64 handler_len2)
  718. {
  719. struct ia64_sal_retval isrv;
  720. SAL_CALL(isrv, SAL_SET_VECTORS, vector_type,
  721. handler_addr1, gp1, handler_len1,
  722. handler_addr2, gp2, handler_len2);
  723. return isrv.status;
  724. }
  725. /* Update the contents of PAL block in the non-volatile storage device */
  726. static inline s64
  727. ia64_sal_update_pal (u64 param_buf, u64 scratch_buf, u64 scratch_buf_size,
  728. u64 *error_code, u64 *scratch_buf_size_needed)
  729. {
  730. struct ia64_sal_retval isrv;
  731. SAL_CALL(isrv, SAL_UPDATE_PAL, param_buf, scratch_buf, scratch_buf_size,
  732. 0, 0, 0, 0);
  733. if (error_code)
  734. *error_code = isrv.v0;
  735. if (scratch_buf_size_needed)
  736. *scratch_buf_size_needed = isrv.v1;
  737. return isrv.status;
  738. }
  739. /* Get physical processor die mapping in the platform. */
  740. static inline s64
  741. ia64_sal_physical_id_info(u16 *splid)
  742. {
  743. struct ia64_sal_retval isrv;
  744. if (sal_revision < SAL_VERSION_CODE(3,2))
  745. return -1;
  746. SAL_CALL(isrv, SAL_PHYSICAL_ID_INFO, 0, 0, 0, 0, 0, 0, 0);
  747. if (splid)
  748. *splid = isrv.v0;
  749. return isrv.status;
  750. }
  751. extern unsigned long sal_platform_features;
  752. extern int (*salinfo_platform_oemdata)(const u8 *, u8 **, u64 *);
  753. struct sal_ret_values {
  754. long r8; long r9; long r10; long r11;
  755. };
  756. #define IA64_SAL_OEMFUNC_MIN 0x02000000
  757. #define IA64_SAL_OEMFUNC_MAX 0x03ffffff
  758. extern int ia64_sal_oemcall(struct ia64_sal_retval *, u64, u64, u64, u64, u64,
  759. u64, u64, u64);
  760. extern int ia64_sal_oemcall_nolock(struct ia64_sal_retval *, u64, u64, u64,
  761. u64, u64, u64, u64, u64);
  762. extern int ia64_sal_oemcall_reentrant(struct ia64_sal_retval *, u64, u64, u64,
  763. u64, u64, u64, u64, u64);
  764. extern long
  765. ia64_sal_freq_base (unsigned long which, unsigned long *ticks_per_second,
  766. unsigned long *drift_info);
  767. #ifdef CONFIG_HOTPLUG_CPU
  768. /*
  769. * System Abstraction Layer Specification
  770. * Section 3.2.5.1: OS_BOOT_RENDEZ to SAL return State.
  771. * Note: region regs are stored first in head.S _start. Hence they must
  772. * stay up front.
  773. */
  774. struct sal_to_os_boot {
  775. u64 rr[8]; /* Region Registers */
  776. u64 br[6]; /* br0:
  777. * return addr into SAL boot rendez routine */
  778. u64 gr1; /* SAL:GP */
  779. u64 gr12; /* SAL:SP */
  780. u64 gr13; /* SAL: Task Pointer */
  781. u64 fpsr;
  782. u64 pfs;
  783. u64 rnat;
  784. u64 unat;
  785. u64 bspstore;
  786. u64 dcr; /* Default Control Register */
  787. u64 iva;
  788. u64 pta;
  789. u64 itv;
  790. u64 pmv;
  791. u64 cmcv;
  792. u64 lrr[2];
  793. u64 gr[4];
  794. u64 pr; /* Predicate registers */
  795. u64 lc; /* Loop Count */
  796. struct ia64_fpreg fp[20];
  797. };
  798. /*
  799. * Global array allocated for NR_CPUS at boot time
  800. */
  801. extern struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS];
  802. extern void ia64_jump_to_sal(struct sal_to_os_boot *);
  803. #endif
  804. extern void ia64_sal_handler_init(void *entry_point, void *gpval);
  805. #define PALO_MAX_TLB_PURGES 0xFFFF
  806. #define PALO_SIG "PALO"
  807. struct palo_table {
  808. u8 signature[4]; /* Should be "PALO" */
  809. u32 length;
  810. u8 minor_revision;
  811. u8 major_revision;
  812. u8 checksum;
  813. u8 reserved1[5];
  814. u16 max_tlb_purges;
  815. u8 reserved2[6];
  816. };
  817. #define NPTCG_FROM_PAL 0
  818. #define NPTCG_FROM_PALO 1
  819. #define NPTCG_FROM_KERNEL_PARAMETER 2
  820. #endif /* __ASSEMBLY__ */
  821. #endif /* _ASM_IA64_SAL_H */