sal.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905
  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/system.h>
  38. #include <asm/fpu.h>
  39. extern spinlock_t sal_lock;
  40. /* SAL spec _requires_ eight args for each call. */
  41. #define __IA64_FW_CALL(entry,result,a0,a1,a2,a3,a4,a5,a6,a7) \
  42. result = (*entry)(a0,a1,a2,a3,a4,a5,a6,a7)
  43. # define IA64_FW_CALL(entry,result,args...) do { \
  44. unsigned long __ia64_sc_flags; \
  45. struct ia64_fpreg __ia64_sc_fr[6]; \
  46. ia64_save_scratch_fpregs(__ia64_sc_fr); \
  47. spin_lock_irqsave(&sal_lock, __ia64_sc_flags); \
  48. __IA64_FW_CALL(entry, result, args); \
  49. spin_unlock_irqrestore(&sal_lock, __ia64_sc_flags); \
  50. ia64_load_scratch_fpregs(__ia64_sc_fr); \
  51. } while (0)
  52. # define SAL_CALL(result,args...) \
  53. IA64_FW_CALL(ia64_sal, result, args);
  54. # define SAL_CALL_NOLOCK(result,args...) do { \
  55. unsigned long __ia64_scn_flags; \
  56. struct ia64_fpreg __ia64_scn_fr[6]; \
  57. ia64_save_scratch_fpregs(__ia64_scn_fr); \
  58. local_irq_save(__ia64_scn_flags); \
  59. __IA64_FW_CALL(ia64_sal, result, args); \
  60. local_irq_restore(__ia64_scn_flags); \
  61. ia64_load_scratch_fpregs(__ia64_scn_fr); \
  62. } while (0)
  63. # define SAL_CALL_REENTRANT(result,args...) do { \
  64. struct ia64_fpreg __ia64_scs_fr[6]; \
  65. ia64_save_scratch_fpregs(__ia64_scs_fr); \
  66. preempt_disable(); \
  67. __IA64_FW_CALL(ia64_sal, result, args); \
  68. preempt_enable(); \
  69. ia64_load_scratch_fpregs(__ia64_scs_fr); \
  70. } while (0)
  71. #define SAL_SET_VECTORS 0x01000000
  72. #define SAL_GET_STATE_INFO 0x01000001
  73. #define SAL_GET_STATE_INFO_SIZE 0x01000002
  74. #define SAL_CLEAR_STATE_INFO 0x01000003
  75. #define SAL_MC_RENDEZ 0x01000004
  76. #define SAL_MC_SET_PARAMS 0x01000005
  77. #define SAL_REGISTER_PHYSICAL_ADDR 0x01000006
  78. #define SAL_CACHE_FLUSH 0x01000008
  79. #define SAL_CACHE_INIT 0x01000009
  80. #define SAL_PCI_CONFIG_READ 0x01000010
  81. #define SAL_PCI_CONFIG_WRITE 0x01000011
  82. #define SAL_FREQ_BASE 0x01000012
  83. #define SAL_PHYSICAL_ID_INFO 0x01000013
  84. #define SAL_UPDATE_PAL 0x01000020
  85. struct ia64_sal_retval {
  86. /*
  87. * A zero status value indicates call completed without error.
  88. * A negative status value indicates reason of call failure.
  89. * A positive status value indicates success but an
  90. * informational value should be printed (e.g., "reboot for
  91. * change to take effect").
  92. */
  93. s64 status;
  94. u64 v0;
  95. u64 v1;
  96. u64 v2;
  97. };
  98. typedef struct ia64_sal_retval (*ia64_sal_handler) (u64, ...);
  99. enum {
  100. SAL_FREQ_BASE_PLATFORM = 0,
  101. SAL_FREQ_BASE_INTERVAL_TIMER = 1,
  102. SAL_FREQ_BASE_REALTIME_CLOCK = 2
  103. };
  104. /*
  105. * The SAL system table is followed by a variable number of variable
  106. * length descriptors. The structure of these descriptors follows
  107. * below.
  108. * The defininition follows SAL specs from July 2000
  109. */
  110. struct ia64_sal_systab {
  111. u8 signature[4]; /* should be "SST_" */
  112. u32 size; /* size of this table in bytes */
  113. u8 sal_rev_minor;
  114. u8 sal_rev_major;
  115. u16 entry_count; /* # of entries in variable portion */
  116. u8 checksum;
  117. u8 reserved1[7];
  118. u8 sal_a_rev_minor;
  119. u8 sal_a_rev_major;
  120. u8 sal_b_rev_minor;
  121. u8 sal_b_rev_major;
  122. /* oem_id & product_id: terminating NUL is missing if string is exactly 32 bytes long. */
  123. u8 oem_id[32];
  124. u8 product_id[32]; /* ASCII product id */
  125. u8 reserved2[8];
  126. };
  127. enum sal_systab_entry_type {
  128. SAL_DESC_ENTRY_POINT = 0,
  129. SAL_DESC_MEMORY = 1,
  130. SAL_DESC_PLATFORM_FEATURE = 2,
  131. SAL_DESC_TR = 3,
  132. SAL_DESC_PTC = 4,
  133. SAL_DESC_AP_WAKEUP = 5
  134. };
  135. /*
  136. * Entry type: Size:
  137. * 0 48
  138. * 1 32
  139. * 2 16
  140. * 3 32
  141. * 4 16
  142. * 5 16
  143. */
  144. #define SAL_DESC_SIZE(type) "\060\040\020\040\020\020"[(unsigned) type]
  145. typedef struct ia64_sal_desc_entry_point {
  146. u8 type;
  147. u8 reserved1[7];
  148. u64 pal_proc;
  149. u64 sal_proc;
  150. u64 gp;
  151. u8 reserved2[16];
  152. }ia64_sal_desc_entry_point_t;
  153. typedef struct ia64_sal_desc_memory {
  154. u8 type;
  155. u8 used_by_sal; /* needs to be mapped for SAL? */
  156. u8 mem_attr; /* current memory attribute setting */
  157. u8 access_rights; /* access rights set up by SAL */
  158. u8 mem_attr_mask; /* mask of supported memory attributes */
  159. u8 reserved1;
  160. u8 mem_type; /* memory type */
  161. u8 mem_usage; /* memory usage */
  162. u64 addr; /* physical address of memory */
  163. u32 length; /* length (multiple of 4KB pages) */
  164. u32 reserved2;
  165. u8 oem_reserved[8];
  166. } ia64_sal_desc_memory_t;
  167. typedef struct ia64_sal_desc_platform_feature {
  168. u8 type;
  169. u8 feature_mask;
  170. u8 reserved1[14];
  171. } ia64_sal_desc_platform_feature_t;
  172. typedef struct ia64_sal_desc_tr {
  173. u8 type;
  174. u8 tr_type; /* 0 == instruction, 1 == data */
  175. u8 regnum; /* translation register number */
  176. u8 reserved1[5];
  177. u64 addr; /* virtual address of area covered */
  178. u64 page_size; /* encoded page size */
  179. u8 reserved2[8];
  180. } ia64_sal_desc_tr_t;
  181. typedef struct ia64_sal_desc_ptc {
  182. u8 type;
  183. u8 reserved1[3];
  184. u32 num_domains; /* # of coherence domains */
  185. u64 domain_info; /* physical address of domain info table */
  186. } ia64_sal_desc_ptc_t;
  187. typedef struct ia64_sal_ptc_domain_info {
  188. u64 proc_count; /* number of processors in domain */
  189. u64 proc_list; /* physical address of LID array */
  190. } ia64_sal_ptc_domain_info_t;
  191. typedef struct ia64_sal_ptc_domain_proc_entry {
  192. u64 id : 8; /* id of processor */
  193. u64 eid : 8; /* eid of processor */
  194. } ia64_sal_ptc_domain_proc_entry_t;
  195. #define IA64_SAL_AP_EXTERNAL_INT 0
  196. typedef struct ia64_sal_desc_ap_wakeup {
  197. u8 type;
  198. u8 mechanism; /* 0 == external interrupt */
  199. u8 reserved1[6];
  200. u64 vector; /* interrupt vector in range 0x10-0xff */
  201. } ia64_sal_desc_ap_wakeup_t ;
  202. extern ia64_sal_handler ia64_sal;
  203. extern struct ia64_sal_desc_ptc *ia64_ptc_domain_info;
  204. extern unsigned short sal_revision; /* supported SAL spec revision */
  205. extern unsigned short sal_version; /* SAL version; OEM dependent */
  206. #define SAL_VERSION_CODE(major, minor) ((bin2bcd(major) << 8) | bin2bcd(minor))
  207. extern const char *ia64_sal_strerror (long status);
  208. extern void ia64_sal_init (struct ia64_sal_systab *sal_systab);
  209. /* SAL information type encodings */
  210. enum {
  211. SAL_INFO_TYPE_MCA = 0, /* Machine check abort information */
  212. SAL_INFO_TYPE_INIT = 1, /* Init information */
  213. SAL_INFO_TYPE_CMC = 2, /* Corrected machine check information */
  214. SAL_INFO_TYPE_CPE = 3 /* Corrected platform error information */
  215. };
  216. /* Encodings for machine check parameter types */
  217. enum {
  218. SAL_MC_PARAM_RENDEZ_INT = 1, /* Rendezvous interrupt */
  219. SAL_MC_PARAM_RENDEZ_WAKEUP = 2, /* Wakeup */
  220. SAL_MC_PARAM_CPE_INT = 3 /* Corrected Platform Error Int */
  221. };
  222. /* Encodings for rendezvous mechanisms */
  223. enum {
  224. SAL_MC_PARAM_MECHANISM_INT = 1, /* Use interrupt */
  225. SAL_MC_PARAM_MECHANISM_MEM = 2 /* Use memory synchronization variable*/
  226. };
  227. /* Encodings for vectors which can be registered by the OS with SAL */
  228. enum {
  229. SAL_VECTOR_OS_MCA = 0,
  230. SAL_VECTOR_OS_INIT = 1,
  231. SAL_VECTOR_OS_BOOT_RENDEZ = 2
  232. };
  233. /* Encodings for mca_opt parameter sent to SAL_MC_SET_PARAMS */
  234. #define SAL_MC_PARAM_RZ_ALWAYS 0x1
  235. #define SAL_MC_PARAM_BINIT_ESCALATE 0x10
  236. /*
  237. * Definition of the SAL Error Log from the SAL spec
  238. */
  239. /* SAL Error Record Section GUID Definitions */
  240. #define SAL_PROC_DEV_ERR_SECT_GUID \
  241. EFI_GUID(0xe429faf1, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  242. #define SAL_PLAT_MEM_DEV_ERR_SECT_GUID \
  243. EFI_GUID(0xe429faf2, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  244. #define SAL_PLAT_SEL_DEV_ERR_SECT_GUID \
  245. EFI_GUID(0xe429faf3, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  246. #define SAL_PLAT_PCI_BUS_ERR_SECT_GUID \
  247. EFI_GUID(0xe429faf4, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  248. #define SAL_PLAT_SMBIOS_DEV_ERR_SECT_GUID \
  249. EFI_GUID(0xe429faf5, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  250. #define SAL_PLAT_PCI_COMP_ERR_SECT_GUID \
  251. EFI_GUID(0xe429faf6, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  252. #define SAL_PLAT_SPECIFIC_ERR_SECT_GUID \
  253. EFI_GUID(0xe429faf7, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  254. #define SAL_PLAT_HOST_CTLR_ERR_SECT_GUID \
  255. EFI_GUID(0xe429faf8, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  256. #define SAL_PLAT_BUS_ERR_SECT_GUID \
  257. EFI_GUID(0xe429faf9, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81)
  258. #define PROCESSOR_ABSTRACTION_LAYER_OVERWRITE_GUID \
  259. EFI_GUID(0x6cb0a200, 0x893a, 0x11da, 0x96, 0xd2, 0x0, 0x10, 0x83, 0xff, \
  260. 0xca, 0x4d)
  261. #define MAX_CACHE_ERRORS 6
  262. #define MAX_TLB_ERRORS 6
  263. #define MAX_BUS_ERRORS 1
  264. /* Definition of version according to SAL spec for logging purposes */
  265. typedef struct sal_log_revision {
  266. u8 minor; /* BCD (0..99) */
  267. u8 major; /* BCD (0..99) */
  268. } sal_log_revision_t;
  269. /* Definition of timestamp according to SAL spec for logging purposes */
  270. typedef struct sal_log_timestamp {
  271. u8 slh_second; /* Second (0..59) */
  272. u8 slh_minute; /* Minute (0..59) */
  273. u8 slh_hour; /* Hour (0..23) */
  274. u8 slh_reserved;
  275. u8 slh_day; /* Day (1..31) */
  276. u8 slh_month; /* Month (1..12) */
  277. u8 slh_year; /* Year (00..99) */
  278. u8 slh_century; /* Century (19, 20, 21, ...) */
  279. } sal_log_timestamp_t;
  280. /* Definition of log record header structures */
  281. typedef struct sal_log_record_header {
  282. u64 id; /* Unique monotonically increasing ID */
  283. sal_log_revision_t revision; /* Major and Minor revision of header */
  284. u8 severity; /* Error Severity */
  285. u8 validation_bits; /* 0: platform_guid, 1: !timestamp */
  286. u32 len; /* Length of this error log in bytes */
  287. sal_log_timestamp_t timestamp; /* Timestamp */
  288. efi_guid_t platform_guid; /* Unique OEM Platform ID */
  289. } sal_log_record_header_t;
  290. #define sal_log_severity_recoverable 0
  291. #define sal_log_severity_fatal 1
  292. #define sal_log_severity_corrected 2
  293. /* Definition of log section header structures */
  294. typedef struct sal_log_sec_header {
  295. efi_guid_t guid; /* Unique Section ID */
  296. sal_log_revision_t revision; /* Major and Minor revision of Section */
  297. u16 reserved;
  298. u32 len; /* Section length */
  299. } sal_log_section_hdr_t;
  300. typedef struct sal_log_mod_error_info {
  301. struct {
  302. u64 check_info : 1,
  303. requestor_identifier : 1,
  304. responder_identifier : 1,
  305. target_identifier : 1,
  306. precise_ip : 1,
  307. reserved : 59;
  308. } valid;
  309. u64 check_info;
  310. u64 requestor_identifier;
  311. u64 responder_identifier;
  312. u64 target_identifier;
  313. u64 precise_ip;
  314. } sal_log_mod_error_info_t;
  315. typedef struct sal_processor_static_info {
  316. struct {
  317. u64 minstate : 1,
  318. br : 1,
  319. cr : 1,
  320. ar : 1,
  321. rr : 1,
  322. fr : 1,
  323. reserved : 58;
  324. } valid;
  325. pal_min_state_area_t min_state_area;
  326. u64 br[8];
  327. u64 cr[128];
  328. u64 ar[128];
  329. u64 rr[8];
  330. struct ia64_fpreg __attribute__ ((packed)) fr[128];
  331. } sal_processor_static_info_t;
  332. struct sal_cpuid_info {
  333. u64 regs[5];
  334. u64 reserved;
  335. };
  336. typedef struct sal_log_processor_info {
  337. sal_log_section_hdr_t header;
  338. struct {
  339. u64 proc_error_map : 1,
  340. proc_state_param : 1,
  341. proc_cr_lid : 1,
  342. psi_static_struct : 1,
  343. num_cache_check : 4,
  344. num_tlb_check : 4,
  345. num_bus_check : 4,
  346. num_reg_file_check : 4,
  347. num_ms_check : 4,
  348. cpuid_info : 1,
  349. reserved1 : 39;
  350. } valid;
  351. u64 proc_error_map;
  352. u64 proc_state_parameter;
  353. u64 proc_cr_lid;
  354. /*
  355. * The rest of this structure consists of variable-length arrays, which can't be
  356. * expressed in C.
  357. */
  358. sal_log_mod_error_info_t info[0];
  359. /*
  360. * This is what the rest looked like if C supported variable-length arrays:
  361. *
  362. * sal_log_mod_error_info_t cache_check_info[.valid.num_cache_check];
  363. * sal_log_mod_error_info_t tlb_check_info[.valid.num_tlb_check];
  364. * sal_log_mod_error_info_t bus_check_info[.valid.num_bus_check];
  365. * sal_log_mod_error_info_t reg_file_check_info[.valid.num_reg_file_check];
  366. * sal_log_mod_error_info_t ms_check_info[.valid.num_ms_check];
  367. * struct sal_cpuid_info cpuid_info;
  368. * sal_processor_static_info_t processor_static_info;
  369. */
  370. } sal_log_processor_info_t;
  371. /* Given a sal_log_processor_info_t pointer, return a pointer to the processor_static_info: */
  372. #define SAL_LPI_PSI_INFO(l) \
  373. ({ sal_log_processor_info_t *_l = (l); \
  374. ((sal_processor_static_info_t *) \
  375. ((char *) _l->info + ((_l->valid.num_cache_check + _l->valid.num_tlb_check \
  376. + _l->valid.num_bus_check + _l->valid.num_reg_file_check \
  377. + _l->valid.num_ms_check) * sizeof(sal_log_mod_error_info_t) \
  378. + sizeof(struct sal_cpuid_info)))); \
  379. })
  380. /* platform error log structures */
  381. typedef struct sal_log_mem_dev_err_info {
  382. sal_log_section_hdr_t header;
  383. struct {
  384. u64 error_status : 1,
  385. physical_addr : 1,
  386. addr_mask : 1,
  387. node : 1,
  388. card : 1,
  389. module : 1,
  390. bank : 1,
  391. device : 1,
  392. row : 1,
  393. column : 1,
  394. bit_position : 1,
  395. requestor_id : 1,
  396. responder_id : 1,
  397. target_id : 1,
  398. bus_spec_data : 1,
  399. oem_id : 1,
  400. oem_data : 1,
  401. reserved : 47;
  402. } valid;
  403. u64 error_status;
  404. u64 physical_addr;
  405. u64 addr_mask;
  406. u16 node;
  407. u16 card;
  408. u16 module;
  409. u16 bank;
  410. u16 device;
  411. u16 row;
  412. u16 column;
  413. u16 bit_position;
  414. u64 requestor_id;
  415. u64 responder_id;
  416. u64 target_id;
  417. u64 bus_spec_data;
  418. u8 oem_id[16];
  419. u8 oem_data[1]; /* Variable length data */
  420. } sal_log_mem_dev_err_info_t;
  421. typedef struct sal_log_sel_dev_err_info {
  422. sal_log_section_hdr_t header;
  423. struct {
  424. u64 record_id : 1,
  425. record_type : 1,
  426. generator_id : 1,
  427. evm_rev : 1,
  428. sensor_type : 1,
  429. sensor_num : 1,
  430. event_dir : 1,
  431. event_data1 : 1,
  432. event_data2 : 1,
  433. event_data3 : 1,
  434. reserved : 54;
  435. } valid;
  436. u16 record_id;
  437. u8 record_type;
  438. u8 timestamp[4];
  439. u16 generator_id;
  440. u8 evm_rev;
  441. u8 sensor_type;
  442. u8 sensor_num;
  443. u8 event_dir;
  444. u8 event_data1;
  445. u8 event_data2;
  446. u8 event_data3;
  447. } sal_log_sel_dev_err_info_t;
  448. typedef struct sal_log_pci_bus_err_info {
  449. sal_log_section_hdr_t header;
  450. struct {
  451. u64 err_status : 1,
  452. err_type : 1,
  453. bus_id : 1,
  454. bus_address : 1,
  455. bus_data : 1,
  456. bus_cmd : 1,
  457. requestor_id : 1,
  458. responder_id : 1,
  459. target_id : 1,
  460. oem_data : 1,
  461. reserved : 54;
  462. } valid;
  463. u64 err_status;
  464. u16 err_type;
  465. u16 bus_id;
  466. u32 reserved;
  467. u64 bus_address;
  468. u64 bus_data;
  469. u64 bus_cmd;
  470. u64 requestor_id;
  471. u64 responder_id;
  472. u64 target_id;
  473. u8 oem_data[1]; /* Variable length data */
  474. } sal_log_pci_bus_err_info_t;
  475. typedef struct sal_log_smbios_dev_err_info {
  476. sal_log_section_hdr_t header;
  477. struct {
  478. u64 event_type : 1,
  479. length : 1,
  480. time_stamp : 1,
  481. data : 1,
  482. reserved1 : 60;
  483. } valid;
  484. u8 event_type;
  485. u8 length;
  486. u8 time_stamp[6];
  487. u8 data[1]; /* data of variable length, length == slsmb_length */
  488. } sal_log_smbios_dev_err_info_t;
  489. typedef struct sal_log_pci_comp_err_info {
  490. sal_log_section_hdr_t header;
  491. struct {
  492. u64 err_status : 1,
  493. comp_info : 1,
  494. num_mem_regs : 1,
  495. num_io_regs : 1,
  496. reg_data_pairs : 1,
  497. oem_data : 1,
  498. reserved : 58;
  499. } valid;
  500. u64 err_status;
  501. struct {
  502. u16 vendor_id;
  503. u16 device_id;
  504. u8 class_code[3];
  505. u8 func_num;
  506. u8 dev_num;
  507. u8 bus_num;
  508. u8 seg_num;
  509. u8 reserved[5];
  510. } comp_info;
  511. u32 num_mem_regs;
  512. u32 num_io_regs;
  513. u64 reg_data_pairs[1];
  514. /*
  515. * array of address/data register pairs is num_mem_regs + num_io_regs elements
  516. * long. Each array element consists of a u64 address followed by a u64 data
  517. * value. The oem_data array immediately follows the reg_data_pairs array
  518. */
  519. u8 oem_data[1]; /* Variable length data */
  520. } sal_log_pci_comp_err_info_t;
  521. typedef struct sal_log_plat_specific_err_info {
  522. sal_log_section_hdr_t header;
  523. struct {
  524. u64 err_status : 1,
  525. guid : 1,
  526. oem_data : 1,
  527. reserved : 61;
  528. } valid;
  529. u64 err_status;
  530. efi_guid_t guid;
  531. u8 oem_data[1]; /* platform specific variable length data */
  532. } sal_log_plat_specific_err_info_t;
  533. typedef struct sal_log_host_ctlr_err_info {
  534. sal_log_section_hdr_t header;
  535. struct {
  536. u64 err_status : 1,
  537. requestor_id : 1,
  538. responder_id : 1,
  539. target_id : 1,
  540. bus_spec_data : 1,
  541. oem_data : 1,
  542. reserved : 58;
  543. } valid;
  544. u64 err_status;
  545. u64 requestor_id;
  546. u64 responder_id;
  547. u64 target_id;
  548. u64 bus_spec_data;
  549. u8 oem_data[1]; /* Variable length OEM data */
  550. } sal_log_host_ctlr_err_info_t;
  551. typedef struct sal_log_plat_bus_err_info {
  552. sal_log_section_hdr_t header;
  553. struct {
  554. u64 err_status : 1,
  555. requestor_id : 1,
  556. responder_id : 1,
  557. target_id : 1,
  558. bus_spec_data : 1,
  559. oem_data : 1,
  560. reserved : 58;
  561. } valid;
  562. u64 err_status;
  563. u64 requestor_id;
  564. u64 responder_id;
  565. u64 target_id;
  566. u64 bus_spec_data;
  567. u8 oem_data[1]; /* Variable length OEM data */
  568. } sal_log_plat_bus_err_info_t;
  569. /* Overall platform error section structure */
  570. typedef union sal_log_platform_err_info {
  571. sal_log_mem_dev_err_info_t mem_dev_err;
  572. sal_log_sel_dev_err_info_t sel_dev_err;
  573. sal_log_pci_bus_err_info_t pci_bus_err;
  574. sal_log_smbios_dev_err_info_t smbios_dev_err;
  575. sal_log_pci_comp_err_info_t pci_comp_err;
  576. sal_log_plat_specific_err_info_t plat_specific_err;
  577. sal_log_host_ctlr_err_info_t host_ctlr_err;
  578. sal_log_plat_bus_err_info_t plat_bus_err;
  579. } sal_log_platform_err_info_t;
  580. /* SAL log over-all, multi-section error record structure (processor+platform) */
  581. typedef struct err_rec {
  582. sal_log_record_header_t sal_elog_header;
  583. sal_log_processor_info_t proc_err;
  584. sal_log_platform_err_info_t plat_err;
  585. u8 oem_data_pad[1024];
  586. } ia64_err_rec_t;
  587. /*
  588. * Now define a couple of inline functions for improved type checking
  589. * and convenience.
  590. */
  591. extern s64 ia64_sal_cache_flush (u64 cache_type);
  592. extern void __init check_sal_cache_flush (void);
  593. /* Initialize all the processor and platform level instruction and data caches */
  594. static inline s64
  595. ia64_sal_cache_init (void)
  596. {
  597. struct ia64_sal_retval isrv;
  598. SAL_CALL(isrv, SAL_CACHE_INIT, 0, 0, 0, 0, 0, 0, 0);
  599. return isrv.status;
  600. }
  601. /*
  602. * Clear the processor and platform information logged by SAL with respect to the machine
  603. * state at the time of MCA's, INITs, CMCs, or CPEs.
  604. */
  605. static inline s64
  606. ia64_sal_clear_state_info (u64 sal_info_type)
  607. {
  608. struct ia64_sal_retval isrv;
  609. SAL_CALL_REENTRANT(isrv, SAL_CLEAR_STATE_INFO, sal_info_type, 0,
  610. 0, 0, 0, 0, 0);
  611. return isrv.status;
  612. }
  613. /* Get the processor and platform information logged by SAL with respect to the machine
  614. * state at the time of the MCAs, INITs, CMCs, or CPEs.
  615. */
  616. static inline u64
  617. ia64_sal_get_state_info (u64 sal_info_type, u64 *sal_info)
  618. {
  619. struct ia64_sal_retval isrv;
  620. SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO, sal_info_type, 0,
  621. sal_info, 0, 0, 0, 0);
  622. if (isrv.status)
  623. return 0;
  624. return isrv.v0;
  625. }
  626. /*
  627. * Get the maximum size of the information logged by SAL with respect to the machine state
  628. * at the time of MCAs, INITs, CMCs, or CPEs.
  629. */
  630. static inline u64
  631. ia64_sal_get_state_info_size (u64 sal_info_type)
  632. {
  633. struct ia64_sal_retval isrv;
  634. SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO_SIZE, sal_info_type, 0,
  635. 0, 0, 0, 0, 0);
  636. if (isrv.status)
  637. return 0;
  638. return isrv.v0;
  639. }
  640. /*
  641. * Causes the processor to go into a spin loop within SAL where SAL awaits a wakeup from
  642. * the monarch processor. Must not lock, because it will not return on any cpu until the
  643. * monarch processor sends a wake up.
  644. */
  645. static inline s64
  646. ia64_sal_mc_rendez (void)
  647. {
  648. struct ia64_sal_retval isrv;
  649. SAL_CALL_NOLOCK(isrv, SAL_MC_RENDEZ, 0, 0, 0, 0, 0, 0, 0);
  650. return isrv.status;
  651. }
  652. /*
  653. * Allow the OS to specify the interrupt number to be used by SAL to interrupt OS during
  654. * the machine check rendezvous sequence as well as the mechanism to wake up the
  655. * non-monarch processor at the end of machine check processing.
  656. * Returns the complete ia64_sal_retval because some calls return more than just a status
  657. * value.
  658. */
  659. static inline struct ia64_sal_retval
  660. ia64_sal_mc_set_params (u64 param_type, u64 i_or_m, u64 i_or_m_val, u64 timeout, u64 rz_always)
  661. {
  662. struct ia64_sal_retval isrv;
  663. SAL_CALL(isrv, SAL_MC_SET_PARAMS, param_type, i_or_m, i_or_m_val,
  664. timeout, rz_always, 0, 0);
  665. return isrv;
  666. }
  667. /* Read from PCI configuration space */
  668. static inline s64
  669. ia64_sal_pci_config_read (u64 pci_config_addr, int type, u64 size, u64 *value)
  670. {
  671. struct ia64_sal_retval isrv;
  672. SAL_CALL(isrv, SAL_PCI_CONFIG_READ, pci_config_addr, size, type, 0, 0, 0, 0);
  673. if (value)
  674. *value = isrv.v0;
  675. return isrv.status;
  676. }
  677. /* Write to PCI configuration space */
  678. static inline s64
  679. ia64_sal_pci_config_write (u64 pci_config_addr, int type, u64 size, u64 value)
  680. {
  681. struct ia64_sal_retval isrv;
  682. SAL_CALL(isrv, SAL_PCI_CONFIG_WRITE, pci_config_addr, size, value,
  683. type, 0, 0, 0);
  684. return isrv.status;
  685. }
  686. /*
  687. * Register physical addresses of locations needed by SAL when SAL procedures are invoked
  688. * in virtual mode.
  689. */
  690. static inline s64
  691. ia64_sal_register_physical_addr (u64 phys_entry, u64 phys_addr)
  692. {
  693. struct ia64_sal_retval isrv;
  694. SAL_CALL(isrv, SAL_REGISTER_PHYSICAL_ADDR, phys_entry, phys_addr,
  695. 0, 0, 0, 0, 0);
  696. return isrv.status;
  697. }
  698. /*
  699. * Register software dependent code locations within SAL. These locations are handlers or
  700. * entry points where SAL will pass control for the specified event. These event handlers
  701. * are for the bott rendezvous, MCAs and INIT scenarios.
  702. */
  703. static inline s64
  704. ia64_sal_set_vectors (u64 vector_type,
  705. u64 handler_addr1, u64 gp1, u64 handler_len1,
  706. u64 handler_addr2, u64 gp2, u64 handler_len2)
  707. {
  708. struct ia64_sal_retval isrv;
  709. SAL_CALL(isrv, SAL_SET_VECTORS, vector_type,
  710. handler_addr1, gp1, handler_len1,
  711. handler_addr2, gp2, handler_len2);
  712. return isrv.status;
  713. }
  714. /* Update the contents of PAL block in the non-volatile storage device */
  715. static inline s64
  716. ia64_sal_update_pal (u64 param_buf, u64 scratch_buf, u64 scratch_buf_size,
  717. u64 *error_code, u64 *scratch_buf_size_needed)
  718. {
  719. struct ia64_sal_retval isrv;
  720. SAL_CALL(isrv, SAL_UPDATE_PAL, param_buf, scratch_buf, scratch_buf_size,
  721. 0, 0, 0, 0);
  722. if (error_code)
  723. *error_code = isrv.v0;
  724. if (scratch_buf_size_needed)
  725. *scratch_buf_size_needed = isrv.v1;
  726. return isrv.status;
  727. }
  728. /* Get physical processor die mapping in the platform. */
  729. static inline s64
  730. ia64_sal_physical_id_info(u16 *splid)
  731. {
  732. struct ia64_sal_retval isrv;
  733. if (sal_revision < SAL_VERSION_CODE(3,2))
  734. return -1;
  735. SAL_CALL(isrv, SAL_PHYSICAL_ID_INFO, 0, 0, 0, 0, 0, 0, 0);
  736. if (splid)
  737. *splid = isrv.v0;
  738. return isrv.status;
  739. }
  740. extern unsigned long sal_platform_features;
  741. extern int (*salinfo_platform_oemdata)(const u8 *, u8 **, u64 *);
  742. struct sal_ret_values {
  743. long r8; long r9; long r10; long r11;
  744. };
  745. #define IA64_SAL_OEMFUNC_MIN 0x02000000
  746. #define IA64_SAL_OEMFUNC_MAX 0x03ffffff
  747. extern int ia64_sal_oemcall(struct ia64_sal_retval *, u64, u64, u64, u64, u64,
  748. u64, u64, u64);
  749. extern int ia64_sal_oemcall_nolock(struct ia64_sal_retval *, u64, u64, u64,
  750. u64, u64, u64, u64, u64);
  751. extern int ia64_sal_oemcall_reentrant(struct ia64_sal_retval *, u64, u64, u64,
  752. u64, u64, u64, u64, u64);
  753. extern long
  754. ia64_sal_freq_base (unsigned long which, unsigned long *ticks_per_second,
  755. unsigned long *drift_info);
  756. #ifdef CONFIG_HOTPLUG_CPU
  757. /*
  758. * System Abstraction Layer Specification
  759. * Section 3.2.5.1: OS_BOOT_RENDEZ to SAL return State.
  760. * Note: region regs are stored first in head.S _start. Hence they must
  761. * stay up front.
  762. */
  763. struct sal_to_os_boot {
  764. u64 rr[8]; /* Region Registers */
  765. u64 br[6]; /* br0:
  766. * return addr into SAL boot rendez routine */
  767. u64 gr1; /* SAL:GP */
  768. u64 gr12; /* SAL:SP */
  769. u64 gr13; /* SAL: Task Pointer */
  770. u64 fpsr;
  771. u64 pfs;
  772. u64 rnat;
  773. u64 unat;
  774. u64 bspstore;
  775. u64 dcr; /* Default Control Register */
  776. u64 iva;
  777. u64 pta;
  778. u64 itv;
  779. u64 pmv;
  780. u64 cmcv;
  781. u64 lrr[2];
  782. u64 gr[4];
  783. u64 pr; /* Predicate registers */
  784. u64 lc; /* Loop Count */
  785. struct ia64_fpreg fp[20];
  786. };
  787. /*
  788. * Global array allocated for NR_CPUS at boot time
  789. */
  790. extern struct sal_to_os_boot sal_boot_rendez_state[NR_CPUS];
  791. extern void ia64_jump_to_sal(struct sal_to_os_boot *);
  792. #endif
  793. extern void ia64_sal_handler_init(void *entry_point, void *gpval);
  794. #define PALO_MAX_TLB_PURGES 0xFFFF
  795. #define PALO_SIG "PALO"
  796. struct palo_table {
  797. u8 signature[4]; /* Should be "PALO" */
  798. u32 length;
  799. u8 minor_revision;
  800. u8 major_revision;
  801. u8 checksum;
  802. u8 reserved1[5];
  803. u16 max_tlb_purges;
  804. u8 reserved2[6];
  805. };
  806. #define NPTCG_FROM_PAL 0
  807. #define NPTCG_FROM_PALO 1
  808. #define NPTCG_FROM_KERNEL_PARAMETER 2
  809. #endif /* __ASSEMBLY__ */
  810. #endif /* _ASM_IA64_SAL_H */