rtuDataAnalysis.h 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326
  1. #ifndef _ASM_IA64_PAL_H
  2. #define _ASM_IA64_PAL_H
  3. /*
  4. * Processor Abstraction Layer definitions.
  5. *
  6. * This is based on Intel IA-64 Architecture Software Developer's Manual rev 1.0
  7. * chapter 11 IA-64 Processor Abstraction Layer
  8. *
  9. * Copyright (C) 1998-2001 Hewlett-Packard Co
  10. * David Mosberger-Tang <davidm@hpl.hp.com>
  11. * Stephane Eranian <eranian@hpl.hp.com>
  12. * Copyright (C) 1999 VA Linux Systems
  13. * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
  14. * Copyright (C) 1999 Srinivasa Prasad Thirumalachar <sprasad@sprasad.engr.sgi.com>
  15. * Copyright (C) 2008 Silicon Graphics, Inc. (SGI)
  16. *
  17. * 99/10/01 davidm Make sure we pass zero for reserved parameters.
  18. * 00/03/07 davidm Updated pal_cache_flush() to be in sync with PAL v2.6.
  19. * 00/03/23 cfleck Modified processor min-state save area to match updated PAL & SAL info
  20. * 00/05/24 eranian Updated to latest PAL spec, fix structures bugs, added
  21. * 00/05/25 eranian Support for stack calls, and static physical calls
  22. * 00/06/18 eranian Support for stacked physical calls
  23. * 06/10/26 rja Support for Intel Itanium Architecture Software Developer's
  24. * Manual Rev 2.2 (Jan 2006)
  25. */
  26. /*
  27. * Note that some of these calls use a static-register only calling
  28. * convention which has nothing to do with the regular calling
  29. * convention.
  30. */
  31. #define PAL_CACHE_FLUSH 1 /* flush i/d cache */
  32. #define PAL_CACHE_INFO 2 /* get detailed i/d cache info */
  33. #define PAL_CACHE_INIT 3 /* initialize i/d cache */
  34. #define PAL_CACHE_SUMMARY 4 /* get summary of cache hierarchy */
  35. #define PAL_MEM_ATTRIB 5 /* list supported memory attributes */
  36. #define PAL_PTCE_INFO 6 /* purge TLB info */
  37. #define PAL_VM_INFO 7 /* return supported virtual memory features */
  38. #define PAL_VM_SUMMARY 8 /* return summary on supported vm features */
  39. #define PAL_BUS_GET_FEATURES 9 /* return processor bus interface features settings */
  40. #define PAL_BUS_SET_FEATURES 10 /* set processor bus features */
  41. #define PAL_DEBUG_INFO 11 /* get number of debug registers */
  42. #define PAL_FIXED_ADDR 12 /* get fixed component of processors's directed address */
  43. #define PAL_FREQ_BASE 13 /* base frequency of the platform */
  44. #define PAL_FREQ_RATIOS 14 /* ratio of processor, bus and ITC frequency */
  45. #define PAL_PERF_MON_INFO 15 /* return performance monitor info */
  46. #define PAL_PLATFORM_ADDR 16 /* set processor interrupt block and IO port space addr */
  47. #define PAL_PROC_GET_FEATURES 17 /* get configurable processor features & settings */
  48. #define PAL_PROC_SET_FEATURES 18 /* enable/disable configurable processor features */
  49. #define PAL_RSE_INFO 19 /* return rse information */
  50. #define PAL_VERSION 20 /* return version of PAL code */
  51. #define PAL_MC_CLEAR_LOG 21 /* clear all processor log info */
  52. #define PAL_MC_DRAIN 22 /* drain operations which could result in an MCA */
  53. #define PAL_MC_EXPECTED 23 /* set/reset expected MCA indicator */
  54. #define PAL_MC_DYNAMIC_STATE 24 /* get processor dynamic state */
  55. #define PAL_MC_ERROR_INFO 25 /* get processor MCA info and static state */
  56. #define PAL_MC_RESUME 26 /* Return to interrupted process */
  57. #define PAL_MC_REGISTER_MEM 27 /* Register memory for PAL to use during MCAs and inits */
  58. #define PAL_HALT 28 /* enter the low power HALT state */
  59. #define PAL_HALT_LIGHT 29 /* enter the low power light halt state*/
  60. #define PAL_COPY_INFO 30 /* returns info needed to relocate PAL */
  61. #define PAL_CACHE_LINE_INIT 31 /* init tags & data of cache line */
  62. #define PAL_PMI_ENTRYPOINT 32 /* register PMI memory entry points with the processor */
  63. #define PAL_ENTER_IA_32_ENV 33 /* enter IA-32 system environment */
  64. #define PAL_VM_PAGE_SIZE 34 /* return vm TC and page walker page sizes */
  65. #define PAL_MEM_FOR_TEST 37 /* get amount of memory needed for late processor test */
  66. #define PAL_CACHE_PROT_INFO 38 /* get i/d cache protection info */
  67. #define PAL_REGISTER_INFO 39 /* return AR and CR register information*/
  68. #define PAL_SHUTDOWN 40 /* enter processor shutdown state */
  69. #define PAL_PREFETCH_VISIBILITY 41 /* Make Processor Prefetches Visible */
  70. #define PAL_LOGICAL_TO_PHYSICAL 42 /* returns information on logical to physical processor mapping */
  71. #define PAL_CACHE_SHARED_INFO 43 /* returns information on caches shared by logical processor */
  72. #define PAL_GET_HW_POLICY 48 /* Get current hardware resource sharing policy */
  73. #define PAL_SET_HW_POLICY 49 /* Set current hardware resource sharing policy */
  74. #define PAL_VP_INFO 50 /* Information about virtual processor features */
  75. #define PAL_MC_HW_TRACKING 51 /* Hardware tracking status */
  76. #define PAL_COPY_PAL 256 /* relocate PAL procedures and PAL PMI */
  77. #define PAL_HALT_INFO 257 /* return the low power capabilities of processor */
  78. #define PAL_TEST_PROC 258 /* perform late processor self-test */
  79. #define PAL_CACHE_READ 259 /* read tag & data of cacheline for diagnostic testing */
  80. #define PAL_CACHE_WRITE 260 /* write tag & data of cacheline for diagnostic testing */
  81. #define PAL_VM_TR_READ 261 /* read contents of translation register */
  82. #define PAL_GET_PSTATE 262 /* get the current P-state */
  83. #define PAL_SET_PSTATE 263 /* set the P-state */
  84. #define PAL_BRAND_INFO 274 /* Processor branding information */
  85. #define PAL_GET_PSTATE_TYPE_LASTSET 0
  86. #define PAL_GET_PSTATE_TYPE_AVGANDRESET 1
  87. #define PAL_GET_PSTATE_TYPE_AVGNORESET 2
  88. #define PAL_GET_PSTATE_TYPE_INSTANT 3
  89. #define PAL_MC_ERROR_INJECT 276 /* Injects processor error or returns injection capabilities */
  90. #ifndef __ASSEMBLY__
  91. #include <linux/types.h>
  92. #include <asm/fpu.h>
  93. /*
  94. * Data types needed to pass information into PAL procedures and
  95. * interpret information returned by them.
  96. */
  97. /* Return status from the PAL procedure */
  98. typedef s64 pal_status_t;
  99. #define PAL_STATUS_SUCCESS 0 /* No error */
  100. #define PAL_STATUS_UNIMPLEMENTED (-1) /* Unimplemented procedure */
  101. #define PAL_STATUS_EINVAL (-2) /* Invalid argument */
  102. #define PAL_STATUS_ERROR (-3) /* Error */
  103. #define PAL_STATUS_CACHE_INIT_FAIL (-4) /* Could not initialize the
  104. * specified level and type of
  105. * cache without sideeffects
  106. * and "restrict" was 1
  107. */
  108. #define PAL_STATUS_REQUIRES_MEMORY (-9) /* Call requires PAL memory buffer */
  109. /* Processor cache level in the hierarchy */
  110. typedef u64 pal_cache_level_t;
  111. #define PAL_CACHE_LEVEL_L0 0 /* L0 */
  112. #define PAL_CACHE_LEVEL_L1 1 /* L1 */
  113. #define PAL_CACHE_LEVEL_L2 2 /* L2 */
  114. /* Processor cache type at a particular level in the hierarchy */
  115. typedef u64 pal_cache_type_t;
  116. #define PAL_CACHE_TYPE_INSTRUCTION 1 /* Instruction cache */
  117. #define PAL_CACHE_TYPE_DATA 2 /* Data or unified cache */
  118. #define PAL_CACHE_TYPE_INSTRUCTION_DATA 3 /* Both Data & Instruction */
  119. #define PAL_CACHE_FLUSH_INVALIDATE 1 /* Invalidate clean lines */
  120. #define PAL_CACHE_FLUSH_CHK_INTRS 2 /* check for interrupts/mc while flushing */
  121. /* Processor cache line size in bytes */
  122. typedef int pal_cache_line_size_t;
  123. /* Processor cache line state */
  124. typedef u64 pal_cache_line_state_t;
  125. #define PAL_CACHE_LINE_STATE_INVALID 0 /* Invalid */
  126. #define PAL_CACHE_LINE_STATE_SHARED 1 /* Shared */
  127. #define PAL_CACHE_LINE_STATE_EXCLUSIVE 2 /* Exclusive */
  128. #define PAL_CACHE_LINE_STATE_MODIFIED 3 /* Modified */
  129. typedef struct pal_freq_ratio {
  130. u32 den, num; /* numerator & denominator */
  131. } itc_ratio, proc_ratio;
  132. typedef union pal_cache_config_info_1_s {
  133. struct {
  134. u64 u : 1, /* 0 Unified cache ? */
  135. at : 2, /* 2-1 Cache mem attr*/
  136. reserved : 5, /* 7-3 Reserved */
  137. associativity : 8, /* 16-8 Associativity*/
  138. line_size : 8, /* 23-17 Line size */
  139. stride : 8, /* 31-24 Stride */
  140. store_latency : 8, /*39-32 Store latency*/
  141. load_latency : 8, /* 47-40 Load latency*/
  142. store_hints : 8, /* 55-48 Store hints*/
  143. load_hints : 8; /* 63-56 Load hints */
  144. } pcci1_bits;
  145. u64 pcci1_data;
  146. } pal_cache_config_info_1_t;
  147. typedef union pal_cache_config_info_2_s {
  148. struct {
  149. u32 cache_size; /*cache size in bytes*/
  150. u32 alias_boundary : 8, /* 39-32 aliased addr
  151. * separation for max
  152. * performance.
  153. */
  154. tag_ls_bit : 8, /* 47-40 LSb of addr*/
  155. tag_ms_bit : 8, /* 55-48 MSb of addr*/
  156. reserved : 8; /* 63-56 Reserved */
  157. } pcci2_bits;
  158. u64 pcci2_data;
  159. } pal_cache_config_info_2_t;
  160. typedef struct pal_cache_config_info_s {
  161. pal_status_t pcci_status;
  162. pal_cache_config_info_1_t pcci_info_1;
  163. pal_cache_config_info_2_t pcci_info_2;
  164. u64 pcci_reserved;
  165. } pal_cache_config_info_t;
  166. #define pcci_ld_hints pcci_info_1.pcci1_bits.load_hints
  167. #define pcci_st_hints pcci_info_1.pcci1_bits.store_hints
  168. #define pcci_ld_latency pcci_info_1.pcci1_bits.load_latency
  169. #define pcci_st_latency pcci_info_1.pcci1_bits.store_latency
  170. #define pcci_stride pcci_info_1.pcci1_bits.stride
  171. #define pcci_line_size pcci_info_1.pcci1_bits.line_size
  172. #define pcci_assoc pcci_info_1.pcci1_bits.associativity
  173. #define pcci_cache_attr pcci_info_1.pcci1_bits.at
  174. #define pcci_unified pcci_info_1.pcci1_bits.u
  175. #define pcci_tag_msb pcci_info_2.pcci2_bits.tag_ms_bit
  176. #define pcci_tag_lsb pcci_info_2.pcci2_bits.tag_ls_bit
  177. #define pcci_alias_boundary pcci_info_2.pcci2_bits.alias_boundary
  178. #define pcci_cache_size pcci_info_2.pcci2_bits.cache_size
  179. /* Possible values for cache attributes */
  180. #define PAL_CACHE_ATTR_WT 0 /* Write through cache */
  181. #define PAL_CACHE_ATTR_WB 1 /* Write back cache */
  182. #define PAL_CACHE_ATTR_WT_OR_WB 2 /* Either write thru or write
  183. * back depending on TLB
  184. * memory attributes
  185. */
  186. /* Possible values for cache hints */
  187. #define PAL_CACHE_HINT_TEMP_1 0 /* Temporal level 1 */
  188. #define PAL_CACHE_HINT_NTEMP_1 1 /* Non-temporal level 1 */
  189. #define PAL_CACHE_HINT_NTEMP_ALL 3 /* Non-temporal all levels */
  190. /* Processor cache protection information */
  191. typedef union pal_cache_protection_element_u {
  192. u32 pcpi_data;
  193. struct {
  194. u32 data_bits : 8, /* # data bits covered by
  195. * each unit of protection
  196. */
  197. tagprot_lsb : 6, /* Least -do- */
  198. tagprot_msb : 6, /* Most Sig. tag address
  199. * bit that this
  200. * protection covers.
  201. */
  202. prot_bits : 6, /* # of protection bits */
  203. method : 4, /* Protection method */
  204. t_d : 2; /* Indicates which part
  205. * of the cache this
  206. * protection encoding
  207. * applies.
  208. */
  209. } pcp_info;
  210. } pal_cache_protection_element_t;
  211. #define pcpi_cache_prot_part pcp_info.t_d
  212. #define pcpi_prot_method pcp_info.method
  213. #define pcpi_prot_bits pcp_info.prot_bits
  214. #define pcpi_tagprot_msb pcp_info.tagprot_msb
  215. #define pcpi_tagprot_lsb pcp_info.tagprot_lsb
  216. #define pcpi_data_bits pcp_info.data_bits
  217. /* Processor cache part encodings */
  218. #define PAL_CACHE_PROT_PART_DATA 0 /* Data protection */
  219. #define PAL_CACHE_PROT_PART_TAG 1 /* Tag protection */
  220. #define PAL_CACHE_PROT_PART_TAG_DATA 2 /* Tag+data protection (tag is
  221. * more significant )
  222. */
  223. #define PAL_CACHE_PROT_PART_DATA_TAG 3 /* Data+tag protection (data is
  224. * more significant )
  225. */
  226. #define PAL_CACHE_PROT_PART_MAX 6
  227. typedef struct pal_cache_protection_info_s {
  228. pal_status_t pcpi_status;
  229. pal_cache_protection_element_t pcp_info[PAL_CACHE_PROT_PART_MAX];
  230. } pal_cache_protection_info_t;
  231. /* Processor cache protection method encodings */
  232. #define PAL_CACHE_PROT_METHOD_NONE 0 /* No protection */
  233. #define PAL_CACHE_PROT_METHOD_ODD_PARITY 1 /* Odd parity */
  234. #define PAL_CACHE_PROT_METHOD_EVEN_PARITY 2 /* Even parity */
  235. #define PAL_CACHE_PROT_METHOD_ECC 3 /* ECC protection */
  236. /* Processor cache line identification in the hierarchy */
  237. typedef union pal_cache_line_id_u {
  238. u64 pclid_data;
  239. struct {
  240. u64 cache_type : 8, /* 7-0 cache type */
  241. level : 8, /* 15-8 level of the
  242. * cache in the
  243. * hierarchy.
  244. */
  245. way : 8, /* 23-16 way in the set
  246. */
  247. part : 8, /* 31-24 part of the
  248. * cache
  249. */
  250. reserved : 32; /* 63-32 is reserved*/
  251. } pclid_info_read;
  252. struct {
  253. u64 cache_type : 8, /* 7-0 cache type */
  254. level : 8, /* 15-8 level of the
  255. * cache in the
  256. * hierarchy.
  257. */
  258. way : 8, /* 23-16 way in the set
  259. */
  260. part : 8, /* 31-24 part of the
  261. * cache
  262. */
  263. mesi : 8, /* 39-32 cache line
  264. * state
  265. */
  266. start : 8, /* 47-40 lsb of data to
  267. * invert
  268. */
  269. length : 8, /* 55-48 #bits to
  270. * invert
  271. */
  272. trigger : 8; /* 63-56 Trigger error
  273. * by doing a load
  274. * after the write
  275. */
  276. } pclid_info_write;
  277. } pal_cache_line_id_u_t;
  278. #define pclid_read_part pclid_info_read.part
  279. #define pclid_read_way pclid_info_read.way
  280. #define pclid_read_level pclid_info_read.level
  281. #define pclid_read_cache_type pclid_info_read.cache_type
  282. #define pclid_write_trigger pclid_info_write.trigger
  283. #define pclid_write_length pclid_info_write.length
  284. #define pclid_write_start pclid_info_write.start
  285. #define pclid_write_mesi pclid_info_write.mesi
  286. #define pclid_write_part pclid_info_write.part
  287. #define pclid_write_way pclid_info_write.way
  288. #define pclid_write_level pclid_info_write.level
  289. #define pclid_write_cache_type pclid_info_write.cache_type
  290. /* Processor cache line part encodings */
  291. #define PAL_CACHE_LINE_ID_PART_DATA 0 /* Data */
  292. #define PAL_CACHE_LINE_ID_PART_TAG 1 /* Tag */
  293. #define PAL_CACHE_LINE_ID_PART_DATA_PROT 2 /* Data protection */
  294. #define PAL_CACHE_LINE_ID_PART_TAG_PROT 3 /* Tag protection */
  295. #define PAL_CACHE_LINE_ID_PART_DATA_TAG_PROT 4 /* Data+tag
  296. * protection
  297. */
  298. typedef struct pal_cache_line_info_s {
  299. pal_status_t pcli_status; /* Return status of the read cache line
  300. * info call.
  301. */
  302. u64 pcli_data; /* 64-bit data, tag, protection bits .. */
  303. u64 pcli_data_len; /* data length in bits */
  304. pal_cache_line_state_t pcli_cache_line_state; /* mesi state */
  305. } pal_cache_line_info_t;
  306. /* Machine Check related crap */
  307. /* Pending event status bits */
  308. typedef u64 pal_mc_pending_events_t;
  309. #define PAL_MC_PENDING_MCA (1 << 0)
  310. #define PAL_MC_PENDING_INIT (1 << 1)
  311. /* Error information type */
  312. typedef u64 pal_mc_info_index_t;
  313. #define PAL_MC_INFO_PROCESSOR 0 /* Processor */
  314. #define PAL_MC_INFO_CACHE_CHECK 1 /* Cache check */
  315. #define PAL_MC_INFO_TLB_CHECK 2 /* Tlb check */
  316. #define PAL_MC_INFO_BUS_CHECK 3 /* Bus check */
  317. #define PAL_MC_INFO_REQ_ADDR 4 /* Requestor address */
  318. #define PAL_MC_INFO_RESP_ADDR 5 /* Responder address */
  319. #define PAL_MC_INFO_TARGET_ADDR 6 /* Target address */
  320. #define PAL_MC_INFO_IMPL_DEP 7 /* Implementation
  321. * dependent
  322. */
  323. #define PAL_TLB_CHECK_OP_PURGE 8
  324. typedef struct pal_process_state_info_s {
  325. u64 reserved1 : 2,
  326. rz : 1, /* PAL_CHECK processor
  327. * rendezvous
  328. * successful.
  329. */
  330. ra : 1, /* PAL_CHECK attempted
  331. * a rendezvous.
  332. */
  333. me : 1, /* Distinct multiple
  334. * errors occurred
  335. */
  336. mn : 1, /* Min. state save
  337. * area has been
  338. * registered with PAL
  339. */
  340. sy : 1, /* Storage integrity
  341. * synched
  342. */
  343. co : 1, /* Continuable */
  344. ci : 1, /* MC isolated */
  345. us : 1, /* Uncontained storage
  346. * damage.
  347. */
  348. hd : 1, /* Non-essential hw
  349. * lost (no loss of
  350. * functionality)
  351. * causing the
  352. * processor to run in
  353. * degraded mode.
  354. */
  355. tl : 1, /* 1 => MC occurred
  356. * after an instr was
  357. * executed but before
  358. * the trap that
  359. * resulted from instr
  360. * execution was
  361. * generated.
  362. * (Trap Lost )
  363. */
  364. mi : 1, /* More information available
  365. * call PAL_MC_ERROR_INFO
  366. */
  367. pi : 1, /* Precise instruction pointer */
  368. pm : 1, /* Precise min-state save area */
  369. dy : 1, /* Processor dynamic
  370. * state valid
  371. */
  372. in : 1, /* 0 = MC, 1 = INIT */
  373. rs : 1, /* RSE valid */
  374. cm : 1, /* MC corrected */
  375. ex : 1, /* MC is expected */
  376. cr : 1, /* Control regs valid*/
  377. pc : 1, /* Perf cntrs valid */
  378. dr : 1, /* Debug regs valid */
  379. tr : 1, /* Translation regs
  380. * valid
  381. */
  382. rr : 1, /* Region regs valid */
  383. ar : 1, /* App regs valid */
  384. br : 1, /* Branch regs valid */
  385. pr : 1, /* Predicate registers
  386. * valid
  387. */
  388. fp : 1, /* fp registers valid*/
  389. b1 : 1, /* Preserved bank one
  390. * general registers
  391. * are valid
  392. */
  393. b0 : 1, /* Preserved bank zero
  394. * general registers
  395. * are valid
  396. */
  397. gr : 1, /* General registers
  398. * are valid
  399. * (excl. banked regs)
  400. */
  401. dsize : 16, /* size of dynamic
  402. * state returned
  403. * by the processor
  404. */
  405. se : 1, /* Shared error. MCA in a
  406. shared structure */
  407. reserved2 : 10,
  408. cc : 1, /* Cache check */
  409. tc : 1, /* TLB check */
  410. bc : 1, /* Bus check */
  411. rc : 1, /* Register file check */
  412. uc : 1; /* Uarch check */
  413. } pal_processor_state_info_t;
  414. typedef struct pal_cache_check_info_s {
  415. u64 op : 4, /* Type of cache
  416. * operation that
  417. * caused the machine
  418. * check.
  419. */
  420. level : 2, /* Cache level */
  421. reserved1 : 2,
  422. dl : 1, /* Failure in data part
  423. * of cache line
  424. */
  425. tl : 1, /* Failure in tag part
  426. * of cache line
  427. */
  428. dc : 1, /* Failure in dcache */
  429. ic : 1, /* Failure in icache */
  430. mesi : 3, /* Cache line state */
  431. mv : 1, /* mesi valid */
  432. way : 5, /* Way in which the
  433. * error occurred
  434. */
  435. wiv : 1, /* Way field valid */
  436. reserved2 : 1,
  437. dp : 1, /* Data poisoned on MBE */
  438. reserved3 : 6,
  439. hlth : 2, /* Health indicator */
  440. index : 20, /* Cache line index */
  441. reserved4 : 2,
  442. is : 1, /* instruction set (1 == ia32) */
  443. iv : 1, /* instruction set field valid */
  444. pl : 2, /* privilege level */
  445. pv : 1, /* privilege level field valid */
  446. mcc : 1, /* Machine check corrected */
  447. tv : 1, /* Target address
  448. * structure is valid
  449. */
  450. rq : 1, /* Requester identifier
  451. * structure is valid
  452. */
  453. rp : 1, /* Responder identifier
  454. * structure is valid
  455. */
  456. pi : 1; /* Precise instruction pointer
  457. * structure is valid
  458. */
  459. } pal_cache_check_info_t;
  460. typedef struct pal_tlb_check_info_s {
  461. u64 tr_slot : 8, /* Slot# of TR where
  462. * error occurred
  463. */
  464. trv : 1, /* tr_slot field is valid */
  465. reserved1 : 1,
  466. level : 2, /* TLB level where failure occurred */
  467. reserved2 : 4,
  468. dtr : 1, /* Fail in data TR */
  469. itr : 1, /* Fail in inst TR */
  470. dtc : 1, /* Fail in data TC */
  471. itc : 1, /* Fail in inst. TC */
  472. op : 4, /* Cache operation */
  473. reserved3 : 6,
  474. hlth : 2, /* Health indicator */
  475. reserved4 : 22,
  476. is : 1, /* instruction set (1 == ia32) */
  477. iv : 1, /* instruction set field valid */
  478. pl : 2, /* privilege level */
  479. pv : 1, /* privilege level field valid */
  480. mcc : 1, /* Machine check corrected */
  481. tv : 1, /* Target address
  482. * structure is valid
  483. */
  484. rq : 1, /* Requester identifier
  485. * structure is valid
  486. */
  487. rp : 1, /* Responder identifier
  488. * structure is valid
  489. */
  490. pi : 1; /* Precise instruction pointer
  491. * structure is valid
  492. */
  493. } pal_tlb_check_info_t;
  494. typedef struct pal_bus_check_info_s {
  495. u64 size : 5, /* Xaction size */
  496. ib : 1, /* Internal bus error */
  497. eb : 1, /* External bus error */
  498. cc : 1, /* Error occurred
  499. * during cache-cache
  500. * transfer.
  501. */
  502. type : 8, /* Bus xaction type*/
  503. sev : 5, /* Bus error severity*/
  504. hier : 2, /* Bus hierarchy level */
  505. dp : 1, /* Data poisoned on MBE */
  506. bsi : 8, /* Bus error status
  507. * info
  508. */
  509. reserved2 : 22,
  510. is : 1, /* instruction set (1 == ia32) */
  511. iv : 1, /* instruction set field valid */
  512. pl : 2, /* privilege level */
  513. pv : 1, /* privilege level field valid */
  514. mcc : 1, /* Machine check corrected */
  515. tv : 1, /* Target address
  516. * structure is valid
  517. */
  518. rq : 1, /* Requester identifier
  519. * structure is valid
  520. */
  521. rp : 1, /* Responder identifier
  522. * structure is valid
  523. */
  524. pi : 1; /* Precise instruction pointer
  525. * structure is valid
  526. */
  527. } pal_bus_check_info_t;
  528. typedef struct pal_reg_file_check_info_s {
  529. u64 id : 4, /* Register file identifier */
  530. op : 4, /* Type of register
  531. * operation that
  532. * caused the machine
  533. * check.
  534. */
  535. reg_num : 7, /* Register number */
  536. rnv : 1, /* reg_num valid */
  537. reserved2 : 38,
  538. is : 1, /* instruction set (1 == ia32) */
  539. iv : 1, /* instruction set field valid */
  540. pl : 2, /* privilege level */
  541. pv : 1, /* privilege level field valid */
  542. mcc : 1, /* Machine check corrected */
  543. reserved3 : 3,
  544. pi : 1; /* Precise instruction pointer
  545. * structure is valid
  546. */
  547. } pal_reg_file_check_info_t;
  548. typedef struct pal_uarch_check_info_s {
  549. u64 sid : 5, /* Structure identification */
  550. level : 3, /* Level of failure */
  551. array_id : 4, /* Array identification */
  552. op : 4, /* Type of
  553. * operation that
  554. * caused the machine
  555. * check.
  556. */
  557. way : 6, /* Way of structure */
  558. wv : 1, /* way valid */
  559. xv : 1, /* index valid */
  560. reserved1 : 6,
  561. hlth : 2, /* Health indicator */
  562. index : 8, /* Index or set of the uarch
  563. * structure that failed.
  564. */
  565. reserved2 : 24,
  566. is : 1, /* instruction set (1 == ia32) */
  567. iv : 1, /* instruction set field valid */
  568. pl : 2, /* privilege level */
  569. pv : 1, /* privilege level field valid */
  570. mcc : 1, /* Machine check corrected */
  571. tv : 1, /* Target address
  572. * structure is valid
  573. */
  574. rq : 1, /* Requester identifier
  575. * structure is valid
  576. */
  577. rp : 1, /* Responder identifier
  578. * structure is valid
  579. */
  580. pi : 1; /* Precise instruction pointer
  581. * structure is valid
  582. */
  583. } pal_uarch_check_info_t;
  584. typedef union pal_mc_error_info_u {
  585. u64 pmei_data;
  586. pal_processor_state_info_t pme_processor;
  587. pal_cache_check_info_t pme_cache;
  588. pal_tlb_check_info_t pme_tlb;
  589. pal_bus_check_info_t pme_bus;
  590. pal_reg_file_check_info_t pme_reg_file;
  591. pal_uarch_check_info_t pme_uarch;
  592. } pal_mc_error_info_t;
  593. #define pmci_proc_unknown_check pme_processor.uc
  594. #define pmci_proc_bus_check pme_processor.bc
  595. #define pmci_proc_tlb_check pme_processor.tc
  596. #define pmci_proc_cache_check pme_processor.cc
  597. #define pmci_proc_dynamic_state_size pme_processor.dsize
  598. #define pmci_proc_gpr_valid pme_processor.gr
  599. #define pmci_proc_preserved_bank0_gpr_valid pme_processor.b0
  600. #define pmci_proc_preserved_bank1_gpr_valid pme_processor.b1
  601. #define pmci_proc_fp_valid pme_processor.fp
  602. #define pmci_proc_predicate_regs_valid pme_processor.pr
  603. #define pmci_proc_branch_regs_valid pme_processor.br
  604. #define pmci_proc_app_regs_valid pme_processor.ar
  605. #define pmci_proc_region_regs_valid pme_processor.rr
  606. #define pmci_proc_translation_regs_valid pme_processor.tr
  607. #define pmci_proc_debug_regs_valid pme_processor.dr
  608. #define pmci_proc_perf_counters_valid pme_processor.pc
  609. #define pmci_proc_control_regs_valid pme_processor.cr
  610. #define pmci_proc_machine_check_expected pme_processor.ex
  611. #define pmci_proc_machine_check_corrected pme_processor.cm
  612. #define pmci_proc_rse_valid pme_processor.rs
  613. #define pmci_proc_machine_check_or_init pme_processor.in
  614. #define pmci_proc_dynamic_state_valid pme_processor.dy
  615. #define pmci_proc_operation pme_processor.op
  616. #define pmci_proc_trap_lost pme_processor.tl
  617. #define pmci_proc_hardware_damage pme_processor.hd
  618. #define pmci_proc_uncontained_storage_damage pme_processor.us
  619. #define pmci_proc_machine_check_isolated pme_processor.ci
  620. #define pmci_proc_continuable pme_processor.co
  621. #define pmci_proc_storage_intergrity_synced pme_processor.sy
  622. #define pmci_proc_min_state_save_area_regd pme_processor.mn
  623. #define pmci_proc_distinct_multiple_errors pme_processor.me
  624. #define pmci_proc_pal_attempted_rendezvous pme_processor.ra
  625. #define pmci_proc_pal_rendezvous_complete pme_processor.rz
  626. #define pmci_cache_level pme_cache.level
  627. #define pmci_cache_line_state pme_cache.mesi
  628. #define pmci_cache_line_state_valid pme_cache.mv
  629. #define pmci_cache_line_index pme_cache.index
  630. #define pmci_cache_instr_cache_fail pme_cache.ic
  631. #define pmci_cache_data_cache_fail pme_cache.dc
  632. #define pmci_cache_line_tag_fail pme_cache.tl
  633. #define pmci_cache_line_data_fail pme_cache.dl
  634. #define pmci_cache_operation pme_cache.op
  635. #define pmci_cache_way_valid pme_cache.wv
  636. #define pmci_cache_target_address_valid pme_cache.tv
  637. #define pmci_cache_way pme_cache.way
  638. #define pmci_cache_mc pme_cache.mc
  639. #define pmci_tlb_instr_translation_cache_fail pme_tlb.itc
  640. #define pmci_tlb_data_translation_cache_fail pme_tlb.dtc
  641. #define pmci_tlb_instr_translation_reg_fail pme_tlb.itr
  642. #define pmci_tlb_data_translation_reg_fail pme_tlb.dtr
  643. #define pmci_tlb_translation_reg_slot pme_tlb.tr_slot
  644. #define pmci_tlb_mc pme_tlb.mc
  645. #define pmci_bus_status_info pme_bus.bsi
  646. #define pmci_bus_req_address_valid pme_bus.rq
  647. #define pmci_bus_resp_address_valid pme_bus.rp
  648. #define pmci_bus_target_address_valid pme_bus.tv
  649. #define pmci_bus_error_severity pme_bus.sev
  650. #define pmci_bus_transaction_type pme_bus.type
  651. #define pmci_bus_cache_cache_transfer pme_bus.cc
  652. #define pmci_bus_transaction_size pme_bus.size
  653. #define pmci_bus_internal_error pme_bus.ib
  654. #define pmci_bus_external_error pme_bus.eb
  655. #define pmci_bus_mc pme_bus.mc
  656. /*
  657. * NOTE: this min_state_save area struct only includes the 1KB
  658. * architectural state save area. The other 3 KB is scratch space
  659. * for PAL.
  660. */
  661. typedef struct pal_min_state_area_s {
  662. u64 pmsa_nat_bits; /* nat bits for saved GRs */
  663. u64 pmsa_gr[15]; /* GR1 - GR15 */
  664. u64 pmsa_bank0_gr[16]; /* GR16 - GR31 */
  665. u64 pmsa_bank1_gr[16]; /* GR16 - GR31 */
  666. u64 pmsa_pr; /* predicate registers */
  667. u64 pmsa_br0; /* branch register 0 */
  668. u64 pmsa_rsc; /* ar.rsc */
  669. u64 pmsa_iip; /* cr.iip */
  670. u64 pmsa_ipsr; /* cr.ipsr */
  671. u64 pmsa_ifs; /* cr.ifs */
  672. u64 pmsa_xip; /* previous iip */
  673. u64 pmsa_xpsr; /* previous psr */
  674. u64 pmsa_xfs; /* previous ifs */
  675. u64 pmsa_br1; /* branch register 1 */
  676. u64 pmsa_reserved[70]; /* pal_min_state_area should total to 1KB */
  677. } pal_min_state_area_t;
  678. struct ia64_pal_retval {
  679. /*
  680. * A zero status value indicates call completed without error.
  681. * A negative status value indicates reason of call failure.
  682. * A positive status value indicates success but an
  683. * informational value should be printed (e.g., "reboot for
  684. * change to take effect").
  685. */
  686. s64 status;
  687. u64 v0;
  688. u64 v1;
  689. u64 v2;
  690. };
  691. /*
  692. * Note: Currently unused PAL arguments are generally labeled
  693. * "reserved" so the value specified in the PAL documentation
  694. * (generally 0) MUST be passed. Reserved parameters are not optional
  695. * parameters.
  696. */
  697. extern struct ia64_pal_retval ia64_pal_call_static (u64, u64, u64, u64);
  698. extern struct ia64_pal_retval ia64_pal_call_stacked (u64, u64, u64, u64);
  699. extern struct ia64_pal_retval ia64_pal_call_phys_static (u64, u64, u64, u64);
  700. extern struct ia64_pal_retval ia64_pal_call_phys_stacked (u64, u64, u64, u64);
  701. extern void ia64_save_scratch_fpregs (struct ia64_fpreg *);
  702. extern void ia64_load_scratch_fpregs (struct ia64_fpreg *);
  703. #define PAL_CALL(iprv,a0,a1,a2,a3) do { \
  704. struct ia64_fpreg fr[6]; \
  705. ia64_save_scratch_fpregs(fr); \
  706. iprv = ia64_pal_call_static(a0, a1, a2, a3); \
  707. ia64_load_scratch_fpregs(fr); \
  708. } while (0)
  709. #define PAL_CALL_STK(iprv,a0,a1,a2,a3) do { \
  710. struct ia64_fpreg fr[6]; \
  711. ia64_save_scratch_fpregs(fr); \
  712. iprv = ia64_pal_call_stacked(a0, a1, a2, a3); \
  713. ia64_load_scratch_fpregs(fr); \
  714. } while (0)
  715. #define PAL_CALL_PHYS(iprv,a0,a1,a2,a3) do { \
  716. struct ia64_fpreg fr[6]; \
  717. ia64_save_scratch_fpregs(fr); \
  718. iprv = ia64_pal_call_phys_static(a0, a1, a2, a3); \
  719. ia64_load_scratch_fpregs(fr); \
  720. } while (0)
  721. #define PAL_CALL_PHYS_STK(iprv,a0,a1,a2,a3) do { \
  722. struct ia64_fpreg fr[6]; \
  723. ia64_save_scratch_fpregs(fr); \
  724. iprv = ia64_pal_call_phys_stacked(a0, a1, a2, a3); \
  725. ia64_load_scratch_fpregs(fr); \
  726. } while (0)
  727. typedef int (*ia64_pal_handler) (u64, ...);
  728. extern ia64_pal_handler ia64_pal;
  729. extern void ia64_pal_handler_init (void *);
  730. extern ia64_pal_handler ia64_pal;
  731. extern pal_cache_config_info_t l0d_cache_config_info;
  732. extern pal_cache_config_info_t l0i_cache_config_info;
  733. extern pal_cache_config_info_t l1_cache_config_info;
  734. extern pal_cache_config_info_t l2_cache_config_info;
  735. extern pal_cache_protection_info_t l0d_cache_protection_info;
  736. extern pal_cache_protection_info_t l0i_cache_protection_info;
  737. extern pal_cache_protection_info_t l1_cache_protection_info;
  738. extern pal_cache_protection_info_t l2_cache_protection_info;
  739. extern pal_cache_config_info_t pal_cache_config_info_get(pal_cache_level_t,
  740. pal_cache_type_t);
  741. extern pal_cache_protection_info_t pal_cache_protection_info_get(pal_cache_level_t,
  742. pal_cache_type_t);
  743. extern void pal_error(int);
  744. /* Useful wrappers for the current list of pal procedures */
  745. typedef union pal_bus_features_u {
  746. u64 pal_bus_features_val;
  747. struct {
  748. u64 pbf_reserved1 : 29;
  749. u64 pbf_req_bus_parking : 1;
  750. u64 pbf_bus_lock_mask : 1;
  751. u64 pbf_enable_half_xfer_rate : 1;
  752. u64 pbf_reserved2 : 20;
  753. u64 pbf_enable_shared_line_replace : 1;
  754. u64 pbf_enable_exclusive_line_replace : 1;
  755. u64 pbf_disable_xaction_queueing : 1;
  756. u64 pbf_disable_resp_err_check : 1;
  757. u64 pbf_disable_berr_check : 1;
  758. u64 pbf_disable_bus_req_internal_err_signal : 1;
  759. u64 pbf_disable_bus_req_berr_signal : 1;
  760. u64 pbf_disable_bus_init_event_check : 1;
  761. u64 pbf_disable_bus_init_event_signal : 1;
  762. u64 pbf_disable_bus_addr_err_check : 1;
  763. u64 pbf_disable_bus_addr_err_signal : 1;
  764. u64 pbf_disable_bus_data_err_check : 1;
  765. } pal_bus_features_s;
  766. } pal_bus_features_u_t;
  767. extern void pal_bus_features_print (u64);
  768. /* Provide information about configurable processor bus features */
  769. static inline s64
  770. ia64_pal_bus_get_features (pal_bus_features_u_t *features_avail,
  771. pal_bus_features_u_t *features_status,
  772. pal_bus_features_u_t *features_control)
  773. {
  774. struct ia64_pal_retval iprv;
  775. PAL_CALL_PHYS(iprv, PAL_BUS_GET_FEATURES, 0, 0, 0);
  776. if (features_avail)
  777. features_avail->pal_bus_features_val = iprv.v0;
  778. if (features_status)
  779. features_status->pal_bus_features_val = iprv.v1;
  780. if (features_control)
  781. features_control->pal_bus_features_val = iprv.v2;
  782. return iprv.status;
  783. }
  784. /* Enables/disables specific processor bus features */
  785. static inline s64
  786. ia64_pal_bus_set_features (pal_bus_features_u_t feature_select)
  787. {
  788. struct ia64_pal_retval iprv;
  789. PAL_CALL_PHYS(iprv, PAL_BUS_SET_FEATURES, feature_select.pal_bus_features_val, 0, 0);
  790. return iprv.status;
  791. }
  792. /* Get detailed cache information */
  793. static inline s64
  794. ia64_pal_cache_config_info (u64 cache_level, u64 cache_type, pal_cache_config_info_t *conf)
  795. {
  796. struct ia64_pal_retval iprv;
  797. PAL_CALL(iprv, PAL_CACHE_INFO, cache_level, cache_type, 0);
  798. if (iprv.status == 0) {
  799. conf->pcci_status = iprv.status;
  800. conf->pcci_info_1.pcci1_data = iprv.v0;
  801. conf->pcci_info_2.pcci2_data = iprv.v1;
  802. conf->pcci_reserved = iprv.v2;
  803. }
  804. return iprv.status;
  805. }
  806. /* Get detailed cche protection information */
  807. static inline s64
  808. ia64_pal_cache_prot_info (u64 cache_level, u64 cache_type, pal_cache_protection_info_t *prot)
  809. {
  810. struct ia64_pal_retval iprv;
  811. PAL_CALL(iprv, PAL_CACHE_PROT_INFO, cache_level, cache_type, 0);
  812. if (iprv.status == 0) {
  813. prot->pcpi_status = iprv.status;
  814. prot->pcp_info[0].pcpi_data = iprv.v0 & 0xffffffff;
  815. prot->pcp_info[1].pcpi_data = iprv.v0 >> 32;
  816. prot->pcp_info[2].pcpi_data = iprv.v1 & 0xffffffff;
  817. prot->pcp_info[3].pcpi_data = iprv.v1 >> 32;
  818. prot->pcp_info[4].pcpi_data = iprv.v2 & 0xffffffff;
  819. prot->pcp_info[5].pcpi_data = iprv.v2 >> 32;
  820. }
  821. return iprv.status;
  822. }
  823. /*
  824. * Flush the processor instruction or data caches. *PROGRESS must be
  825. * initialized to zero before calling this for the first time..
  826. */
  827. static inline s64
  828. ia64_pal_cache_flush (u64 cache_type, u64 invalidate, u64 *progress, u64 *vector)
  829. {
  830. struct ia64_pal_retval iprv;
  831. PAL_CALL(iprv, PAL_CACHE_FLUSH, cache_type, invalidate, *progress);
  832. if (vector)
  833. *vector = iprv.v0;
  834. *progress = iprv.v1;
  835. return iprv.status;
  836. }
  837. /* Initialize the processor controlled caches */
  838. static inline s64
  839. ia64_pal_cache_init (u64 level, u64 cache_type, u64 rest)
  840. {
  841. struct ia64_pal_retval iprv;
  842. PAL_CALL(iprv, PAL_CACHE_INIT, level, cache_type, rest);
  843. return iprv.status;
  844. }
  845. /* Initialize the tags and data of a data or unified cache line of
  846. * processor controlled cache to known values without the availability
  847. * of backing memory.
  848. */
  849. static inline s64
  850. ia64_pal_cache_line_init (u64 physical_addr, u64 data_value)
  851. {
  852. struct ia64_pal_retval iprv;
  853. PAL_CALL(iprv, PAL_CACHE_LINE_INIT, physical_addr, data_value, 0);
  854. return iprv.status;
  855. }
  856. /* Read the data and tag of a processor controlled cache line for diags */
  857. static inline s64
  858. ia64_pal_cache_read (pal_cache_line_id_u_t line_id, u64 physical_addr)
  859. {
  860. struct ia64_pal_retval iprv;
  861. PAL_CALL_PHYS_STK(iprv, PAL_CACHE_READ, line_id.pclid_data,
  862. physical_addr, 0);
  863. return iprv.status;
  864. }
  865. /* Return summary information about the hierarchy of caches controlled by the processor */
  866. static inline long ia64_pal_cache_summary(unsigned long *cache_levels,
  867. unsigned long *unique_caches)
  868. {
  869. struct ia64_pal_retval iprv;
  870. PAL_CALL(iprv, PAL_CACHE_SUMMARY, 0, 0, 0);
  871. if (cache_levels)
  872. *cache_levels = iprv.v0;
  873. if (unique_caches)
  874. *unique_caches = iprv.v1;
  875. return iprv.status;
  876. }
  877. /* Write the data and tag of a processor-controlled cache line for diags */
  878. static inline s64
  879. ia64_pal_cache_write (pal_cache_line_id_u_t line_id, u64 physical_addr, u64 data)
  880. {
  881. struct ia64_pal_retval iprv;
  882. PAL_CALL_PHYS_STK(iprv, PAL_CACHE_WRITE, line_id.pclid_data,
  883. physical_addr, data);
  884. return iprv.status;
  885. }
  886. /* Return the parameters needed to copy relocatable PAL procedures from ROM to memory */
  887. static inline s64
  888. ia64_pal_copy_info (u64 copy_type, u64 num_procs, u64 num_iopics,
  889. u64 *buffer_size, u64 *buffer_align)
  890. {
  891. struct ia64_pal_retval iprv;
  892. PAL_CALL(iprv, PAL_COPY_INFO, copy_type, num_procs, num_iopics);
  893. if (buffer_size)
  894. *buffer_size = iprv.v0;
  895. if (buffer_align)
  896. *buffer_align = iprv.v1;
  897. return iprv.status;
  898. }
  899. /* Copy relocatable PAL procedures from ROM to memory */
  900. static inline s64
  901. ia64_pal_copy_pal (u64 target_addr, u64 alloc_size, u64 processor, u64 *pal_proc_offset)
  902. {
  903. struct ia64_pal_retval iprv;
  904. PAL_CALL(iprv, PAL_COPY_PAL, target_addr, alloc_size, processor);
  905. if (pal_proc_offset)
  906. *pal_proc_offset = iprv.v0;
  907. return iprv.status;
  908. }
  909. /* Return the number of instruction and data debug register pairs */
  910. static inline long ia64_pal_debug_info(unsigned long *inst_regs,
  911. unsigned long *data_regs)
  912. {
  913. struct ia64_pal_retval iprv;
  914. PAL_CALL(iprv, PAL_DEBUG_INFO, 0, 0, 0);
  915. if (inst_regs)
  916. *inst_regs = iprv.v0;
  917. if (data_regs)
  918. *data_regs = iprv.v1;
  919. return iprv.status;
  920. }
  921. #ifdef TBD
  922. /* Switch from IA64-system environment to IA-32 system environment */
  923. static inline s64
  924. ia64_pal_enter_ia32_env (ia32_env1, ia32_env2, ia32_env3)
  925. {
  926. struct ia64_pal_retval iprv;
  927. PAL_CALL(iprv, PAL_ENTER_IA_32_ENV, ia32_env1, ia32_env2, ia32_env3);
  928. return iprv.status;
  929. }
  930. #endif
  931. /* Get unique geographical address of this processor on its bus */
  932. static inline s64
  933. ia64_pal_fixed_addr (u64 *global_unique_addr)
  934. {
  935. struct ia64_pal_retval iprv;
  936. PAL_CALL(iprv, PAL_FIXED_ADDR, 0, 0, 0);
  937. if (global_unique_addr)
  938. *global_unique_addr = iprv.v0;
  939. return iprv.status;
  940. }
  941. /* Get base frequency of the platform if generated by the processor */
  942. static inline long ia64_pal_freq_base(unsigned long *platform_base_freq)
  943. {
  944. struct ia64_pal_retval iprv;
  945. PAL_CALL(iprv, PAL_FREQ_BASE, 0, 0, 0);
  946. if (platform_base_freq)
  947. *platform_base_freq = iprv.v0;
  948. return iprv.status;
  949. }
  950. /*
  951. * Get the ratios for processor frequency, bus frequency and interval timer to
  952. * to base frequency of the platform
  953. */
  954. static inline s64
  955. ia64_pal_freq_ratios (struct pal_freq_ratio *proc_ratio, struct pal_freq_ratio *bus_ratio,
  956. struct pal_freq_ratio *itc_ratio)
  957. {
  958. struct ia64_pal_retval iprv;
  959. PAL_CALL(iprv, PAL_FREQ_RATIOS, 0, 0, 0);
  960. if (proc_ratio)
  961. *(u64 *)proc_ratio = iprv.v0;
  962. if (bus_ratio)
  963. *(u64 *)bus_ratio = iprv.v1;
  964. if (itc_ratio)
  965. *(u64 *)itc_ratio = iprv.v2;
  966. return iprv.status;
  967. }
  968. /*
  969. * Get the current hardware resource sharing policy of the processor
  970. */
  971. static inline s64
  972. ia64_pal_get_hw_policy (u64 proc_num, u64 *cur_policy, u64 *num_impacted,
  973. u64 *la)
  974. {
  975. struct ia64_pal_retval iprv;
  976. PAL_CALL(iprv, PAL_GET_HW_POLICY, proc_num, 0, 0);
  977. if (cur_policy)
  978. *cur_policy = iprv.v0;
  979. if (num_impacted)
  980. *num_impacted = iprv.v1;
  981. if (la)
  982. *la = iprv.v2;
  983. return iprv.status;
  984. }
  985. /* Make the processor enter HALT or one of the implementation dependent low
  986. * power states where prefetching and execution are suspended and cache and
  987. * TLB coherency is not maintained.
  988. */
  989. static inline s64
  990. ia64_pal_halt (u64 halt_state)
  991. {
  992. struct ia64_pal_retval iprv;
  993. PAL_CALL(iprv, PAL_HALT, halt_state, 0, 0);
  994. return iprv.status;
  995. }
  996. typedef union pal_power_mgmt_info_u {
  997. u64 ppmi_data;
  998. struct {
  999. u64 exit_latency : 16,
  1000. entry_latency : 16,
  1001. power_consumption : 28,
  1002. im : 1,
  1003. co : 1,
  1004. reserved : 2;
  1005. } pal_power_mgmt_info_s;
  1006. } pal_power_mgmt_info_u_t;
  1007. /* Return information about processor's optional power management capabilities. */
  1008. static inline s64
  1009. ia64_pal_halt_info (pal_power_mgmt_info_u_t *power_buf)
  1010. {
  1011. struct ia64_pal_retval iprv;
  1012. PAL_CALL_STK(iprv, PAL_HALT_INFO, (unsigned long) power_buf, 0, 0);
  1013. return iprv.status;
  1014. }
  1015. /* Get the current P-state information */
  1016. static inline s64
  1017. ia64_pal_get_pstate (u64 *pstate_index, unsigned long type)
  1018. {
  1019. struct ia64_pal_retval iprv;
  1020. PAL_CALL_STK(iprv, PAL_GET_PSTATE, type, 0, 0);
  1021. *pstate_index = iprv.v0;
  1022. return iprv.status;
  1023. }
  1024. /* Set the P-state */
  1025. static inline s64
  1026. ia64_pal_set_pstate (u64 pstate_index)
  1027. {
  1028. struct ia64_pal_retval iprv;
  1029. PAL_CALL_STK(iprv, PAL_SET_PSTATE, pstate_index, 0, 0);
  1030. return iprv.status;
  1031. }
  1032. /* Processor branding information*/
  1033. static inline s64
  1034. ia64_pal_get_brand_info (char *brand_info)
  1035. {
  1036. struct ia64_pal_retval iprv;
  1037. PAL_CALL_STK(iprv, PAL_BRAND_INFO, 0, (u64)brand_info, 0);
  1038. return iprv.status;
  1039. }
  1040. /* Cause the processor to enter LIGHT HALT state, where prefetching and execution are
  1041. * suspended, but cache and TLB coherency is maintained.
  1042. */
  1043. static inline s64
  1044. ia64_pal_halt_light (void)
  1045. {
  1046. struct ia64_pal_retval iprv;
  1047. PAL_CALL(iprv, PAL_HALT_LIGHT, 0, 0, 0);
  1048. return iprv.status;
  1049. }
  1050. /* Clear all the processor error logging registers and reset the indicator that allows
  1051. * the error logging registers to be written. This procedure also checks the pending
  1052. * machine check bit and pending INIT bit and reports their states.
  1053. */
  1054. static inline s64
  1055. ia64_pal_mc_clear_log (u64 *pending_vector)
  1056. {
  1057. struct ia64_pal_retval iprv;
  1058. PAL_CALL(iprv, PAL_MC_CLEAR_LOG, 0, 0, 0);
  1059. if (pending_vector)
  1060. *pending_vector = iprv.v0;
  1061. return iprv.status;
  1062. }
  1063. /* Ensure that all outstanding transactions in a processor are completed or that any
  1064. * MCA due to thes outstanding transaction is taken.
  1065. */
  1066. static inline s64
  1067. ia64_pal_mc_drain (void)
  1068. {
  1069. struct ia64_pal_retval iprv;
  1070. PAL_CALL(iprv, PAL_MC_DRAIN, 0, 0, 0);
  1071. return iprv.status;
  1072. }
  1073. /* Return the machine check dynamic processor state */
  1074. static inline s64
  1075. ia64_pal_mc_dynamic_state (u64 info_type, u64 dy_buffer, u64 *size)
  1076. {
  1077. struct ia64_pal_retval iprv;
  1078. PAL_CALL(iprv, PAL_MC_DYNAMIC_STATE, info_type, dy_buffer, 0);
  1079. if (size)
  1080. *size = iprv.v0;
  1081. return iprv.status;
  1082. }
  1083. /* Return processor machine check information */
  1084. static inline s64
  1085. ia64_pal_mc_error_info (u64 info_index, u64 type_index, u64 *size, u64 *error_info)
  1086. {
  1087. struct ia64_pal_retval iprv;
  1088. PAL_CALL(iprv, PAL_MC_ERROR_INFO, info_index, type_index, 0);
  1089. if (size)
  1090. *size = iprv.v0;
  1091. if (error_info)
  1092. *error_info = iprv.v1;
  1093. return iprv.status;
  1094. }
  1095. /* Injects the requested processor error or returns info on
  1096. * supported injection capabilities for current processor implementation
  1097. */
  1098. static inline s64
  1099. ia64_pal_mc_error_inject_phys (u64 err_type_info, u64 err_struct_info,
  1100. u64 err_data_buffer, u64 *capabilities, u64 *resources)
  1101. {
  1102. struct ia64_pal_retval iprv;
  1103. PAL_CALL_PHYS_STK(iprv, PAL_MC_ERROR_INJECT, err_type_info,
  1104. err_struct_info, err_data_buffer);
  1105. if (capabilities)
  1106. *capabilities= iprv.v0;
  1107. if (resources)
  1108. *resources= iprv.v1;
  1109. return iprv.status;
  1110. }
  1111. static inline s64
  1112. ia64_pal_mc_error_inject_virt (u64 err_type_info, u64 err_struct_info,
  1113. u64 err_data_buffer, u64 *capabilities, u64 *resources)
  1114. {
  1115. struct ia64_pal_retval iprv;
  1116. PAL_CALL_STK(iprv, PAL_MC_ERROR_INJECT, err_type_info,
  1117. err_struct_info, err_data_buffer);
  1118. if (capabilities)
  1119. *capabilities= iprv.v0;
  1120. if (resources)
  1121. *resources= iprv.v1;
  1122. return iprv.status;
  1123. }
  1124. /* Inform PALE_CHECK whether a machine check is expected so that PALE_CHECK willnot
  1125. * attempt to correct any expected machine checks.
  1126. */
  1127. static inline s64
  1128. ia64_pal_mc_expected (u64 expected, u64 *previous)
  1129. {
  1130. struct ia64_pal_retval iprv;
  1131. PAL_CALL(iprv, PAL_MC_EXPECTED, expected, 0, 0);
  1132. if (previous)
  1133. *previous = iprv.v0;
  1134. return iprv.status;
  1135. }
  1136. typedef union pal_hw_tracking_u {
  1137. u64 pht_data;
  1138. struct {
  1139. u64 itc :4, /* Instruction cache tracking */
  1140. dct :4, /* Date cache tracking */
  1141. itt :4, /* Instruction TLB tracking */
  1142. ddt :4, /* Data TLB tracking */
  1143. reserved:48;
  1144. } pal_hw_tracking_s;
  1145. } pal_hw_tracking_u_t;
  1146. /*
  1147. * Hardware tracking status.
  1148. */
  1149. static inline s64
  1150. ia64_pal_mc_hw_tracking (u64 *status)
  1151. {
  1152. struct ia64_pal_retval iprv;
  1153. PAL_CALL(iprv, PAL_MC_HW_TRACKING, 0, 0, 0);
  1154. if (status)
  1155. *status = iprv.v0;
  1156. return iprv.status;
  1157. }
  1158. /* Register a platform dependent location with PAL to which it can save
  1159. * minimal processor state in the event of a machine check or initialization
  1160. * event.
  1161. */
  1162. static inline s64
  1163. ia64_pal_mc_register_mem (u64 physical_addr, u64 size, u64 *req_size)
  1164. {
  1165. struct ia64_pal_retval iprv;
  1166. PAL_CALL(iprv, PAL_MC_REGISTER_MEM, physical_addr, size, 0);
  1167. if (req_size)
  1168. *req_size = iprv.v0;
  1169. return iprv.status;
  1170. }
  1171. /* Restore minimal architectural processor state, set CMC interrupt if necessary