pal.h 52 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773
  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. *
  16. * 99/10/01 davidm Make sure we pass zero for reserved parameters.
  17. * 00/03/07 davidm Updated pal_cache_flush() to be in sync with PAL v2.6.
  18. * 00/03/23 cfleck Modified processor min-state save area to match updated PAL & SAL info
  19. * 00/05/24 eranian Updated to latest PAL spec, fix structures bugs, added
  20. * 00/05/25 eranian Support for stack calls, and static physical calls
  21. * 00/06/18 eranian Support for stacked physical calls
  22. * 06/10/26 rja Support for Intel Itanium Architecture Software Developer's
  23. * Manual Rev 2.2 (Jan 2006)
  24. */
  25. /*
  26. * Note that some of these calls use a static-register only calling
  27. * convention which has nothing to do with the regular calling
  28. * convention.
  29. */
  30. #define PAL_CACHE_FLUSH 1 /* flush i/d cache */
  31. #define PAL_CACHE_INFO 2 /* get detailed i/d cache info */
  32. #define PAL_CACHE_INIT 3 /* initialize i/d cache */
  33. #define PAL_CACHE_SUMMARY 4 /* get summary of cache hierarchy */
  34. #define PAL_MEM_ATTRIB 5 /* list supported memory attributes */
  35. #define PAL_PTCE_INFO 6 /* purge TLB info */
  36. #define PAL_VM_INFO 7 /* return supported virtual memory features */
  37. #define PAL_VM_SUMMARY 8 /* return summary on supported vm features */
  38. #define PAL_BUS_GET_FEATURES 9 /* return processor bus interface features settings */
  39. #define PAL_BUS_SET_FEATURES 10 /* set processor bus features */
  40. #define PAL_DEBUG_INFO 11 /* get number of debug registers */
  41. #define PAL_FIXED_ADDR 12 /* get fixed component of processors's directed address */
  42. #define PAL_FREQ_BASE 13 /* base frequency of the platform */
  43. #define PAL_FREQ_RATIOS 14 /* ratio of processor, bus and ITC frequency */
  44. #define PAL_PERF_MON_INFO 15 /* return performance monitor info */
  45. #define PAL_PLATFORM_ADDR 16 /* set processor interrupt block and IO port space addr */
  46. #define PAL_PROC_GET_FEATURES 17 /* get configurable processor features & settings */
  47. #define PAL_PROC_SET_FEATURES 18 /* enable/disable configurable processor features */
  48. #define PAL_RSE_INFO 19 /* return rse information */
  49. #define PAL_VERSION 20 /* return version of PAL code */
  50. #define PAL_MC_CLEAR_LOG 21 /* clear all processor log info */
  51. #define PAL_MC_DRAIN 22 /* drain operations which could result in an MCA */
  52. #define PAL_MC_EXPECTED 23 /* set/reset expected MCA indicator */
  53. #define PAL_MC_DYNAMIC_STATE 24 /* get processor dynamic state */
  54. #define PAL_MC_ERROR_INFO 25 /* get processor MCA info and static state */
  55. #define PAL_MC_RESUME 26 /* Return to interrupted process */
  56. #define PAL_MC_REGISTER_MEM 27 /* Register memory for PAL to use during MCAs and inits */
  57. #define PAL_HALT 28 /* enter the low power HALT state */
  58. #define PAL_HALT_LIGHT 29 /* enter the low power light halt state*/
  59. #define PAL_COPY_INFO 30 /* returns info needed to relocate PAL */
  60. #define PAL_CACHE_LINE_INIT 31 /* init tags & data of cache line */
  61. #define PAL_PMI_ENTRYPOINT 32 /* register PMI memory entry points with the processor */
  62. #define PAL_ENTER_IA_32_ENV 33 /* enter IA-32 system environment */
  63. #define PAL_VM_PAGE_SIZE 34 /* return vm TC and page walker page sizes */
  64. #define PAL_MEM_FOR_TEST 37 /* get amount of memory needed for late processor test */
  65. #define PAL_CACHE_PROT_INFO 38 /* get i/d cache protection info */
  66. #define PAL_REGISTER_INFO 39 /* return AR and CR register information*/
  67. #define PAL_SHUTDOWN 40 /* enter processor shutdown state */
  68. #define PAL_PREFETCH_VISIBILITY 41 /* Make Processor Prefetches Visible */
  69. #define PAL_LOGICAL_TO_PHYSICAL 42 /* returns information on logical to physical processor mapping */
  70. #define PAL_CACHE_SHARED_INFO 43 /* returns information on caches shared by logical processor */
  71. #define PAL_GET_HW_POLICY 48 /* Get current hardware resource sharing policy */
  72. #define PAL_SET_HW_POLICY 49 /* Set current hardware resource sharing policy */
  73. #define PAL_COPY_PAL 256 /* relocate PAL procedures and PAL PMI */
  74. #define PAL_HALT_INFO 257 /* return the low power capabilities of processor */
  75. #define PAL_TEST_PROC 258 /* perform late processor self-test */
  76. #define PAL_CACHE_READ 259 /* read tag & data of cacheline for diagnostic testing */
  77. #define PAL_CACHE_WRITE 260 /* write tag & data of cacheline for diagnostic testing */
  78. #define PAL_VM_TR_READ 261 /* read contents of translation register */
  79. #define PAL_GET_PSTATE 262 /* get the current P-state */
  80. #define PAL_SET_PSTATE 263 /* set the P-state */
  81. #define PAL_BRAND_INFO 274 /* Processor branding information */
  82. #define PAL_GET_PSTATE_TYPE_LASTSET 0
  83. #define PAL_GET_PSTATE_TYPE_AVGANDRESET 1
  84. #define PAL_GET_PSTATE_TYPE_AVGNORESET 2
  85. #define PAL_GET_PSTATE_TYPE_INSTANT 3
  86. #define PAL_MC_ERROR_INJECT 276 /* Injects processor error or returns injection capabilities */
  87. #ifndef __ASSEMBLY__
  88. #include <linux/types.h>
  89. #include <asm/fpu.h>
  90. /*
  91. * Data types needed to pass information into PAL procedures and
  92. * interpret information returned by them.
  93. */
  94. /* Return status from the PAL procedure */
  95. typedef s64 pal_status_t;
  96. #define PAL_STATUS_SUCCESS 0 /* No error */
  97. #define PAL_STATUS_UNIMPLEMENTED (-1) /* Unimplemented procedure */
  98. #define PAL_STATUS_EINVAL (-2) /* Invalid argument */
  99. #define PAL_STATUS_ERROR (-3) /* Error */
  100. #define PAL_STATUS_CACHE_INIT_FAIL (-4) /* Could not initialize the
  101. * specified level and type of
  102. * cache without sideeffects
  103. * and "restrict" was 1
  104. */
  105. #define PAL_STATUS_REQUIRES_MEMORY (-9) /* Call requires PAL memory buffer */
  106. /* Processor cache level in the hierarchy */
  107. typedef u64 pal_cache_level_t;
  108. #define PAL_CACHE_LEVEL_L0 0 /* L0 */
  109. #define PAL_CACHE_LEVEL_L1 1 /* L1 */
  110. #define PAL_CACHE_LEVEL_L2 2 /* L2 */
  111. /* Processor cache type at a particular level in the hierarchy */
  112. typedef u64 pal_cache_type_t;
  113. #define PAL_CACHE_TYPE_INSTRUCTION 1 /* Instruction cache */
  114. #define PAL_CACHE_TYPE_DATA 2 /* Data or unified cache */
  115. #define PAL_CACHE_TYPE_INSTRUCTION_DATA 3 /* Both Data & Instruction */
  116. #define PAL_CACHE_FLUSH_INVALIDATE 1 /* Invalidate clean lines */
  117. #define PAL_CACHE_FLUSH_CHK_INTRS 2 /* check for interrupts/mc while flushing */
  118. /* Processor cache line size in bytes */
  119. typedef int pal_cache_line_size_t;
  120. /* Processor cache line state */
  121. typedef u64 pal_cache_line_state_t;
  122. #define PAL_CACHE_LINE_STATE_INVALID 0 /* Invalid */
  123. #define PAL_CACHE_LINE_STATE_SHARED 1 /* Shared */
  124. #define PAL_CACHE_LINE_STATE_EXCLUSIVE 2 /* Exclusive */
  125. #define PAL_CACHE_LINE_STATE_MODIFIED 3 /* Modified */
  126. typedef struct pal_freq_ratio {
  127. u32 den, num; /* numerator & denominator */
  128. } itc_ratio, proc_ratio;
  129. typedef union pal_cache_config_info_1_s {
  130. struct {
  131. u64 u : 1, /* 0 Unified cache ? */
  132. at : 2, /* 2-1 Cache mem attr*/
  133. reserved : 5, /* 7-3 Reserved */
  134. associativity : 8, /* 16-8 Associativity*/
  135. line_size : 8, /* 23-17 Line size */
  136. stride : 8, /* 31-24 Stride */
  137. store_latency : 8, /*39-32 Store latency*/
  138. load_latency : 8, /* 47-40 Load latency*/
  139. store_hints : 8, /* 55-48 Store hints*/
  140. load_hints : 8; /* 63-56 Load hints */
  141. } pcci1_bits;
  142. u64 pcci1_data;
  143. } pal_cache_config_info_1_t;
  144. typedef union pal_cache_config_info_2_s {
  145. struct {
  146. u32 cache_size; /*cache size in bytes*/
  147. u32 alias_boundary : 8, /* 39-32 aliased addr
  148. * separation for max
  149. * performance.
  150. */
  151. tag_ls_bit : 8, /* 47-40 LSb of addr*/
  152. tag_ms_bit : 8, /* 55-48 MSb of addr*/
  153. reserved : 8; /* 63-56 Reserved */
  154. } pcci2_bits;
  155. u64 pcci2_data;
  156. } pal_cache_config_info_2_t;
  157. typedef struct pal_cache_config_info_s {
  158. pal_status_t pcci_status;
  159. pal_cache_config_info_1_t pcci_info_1;
  160. pal_cache_config_info_2_t pcci_info_2;
  161. u64 pcci_reserved;
  162. } pal_cache_config_info_t;
  163. #define pcci_ld_hints pcci_info_1.pcci1_bits.load_hints
  164. #define pcci_st_hints pcci_info_1.pcci1_bits.store_hints
  165. #define pcci_ld_latency pcci_info_1.pcci1_bits.load_latency
  166. #define pcci_st_latency pcci_info_1.pcci1_bits.store_latency
  167. #define pcci_stride pcci_info_1.pcci1_bits.stride
  168. #define pcci_line_size pcci_info_1.pcci1_bits.line_size
  169. #define pcci_assoc pcci_info_1.pcci1_bits.associativity
  170. #define pcci_cache_attr pcci_info_1.pcci1_bits.at
  171. #define pcci_unified pcci_info_1.pcci1_bits.u
  172. #define pcci_tag_msb pcci_info_2.pcci2_bits.tag_ms_bit
  173. #define pcci_tag_lsb pcci_info_2.pcci2_bits.tag_ls_bit
  174. #define pcci_alias_boundary pcci_info_2.pcci2_bits.alias_boundary
  175. #define pcci_cache_size pcci_info_2.pcci2_bits.cache_size
  176. /* Possible values for cache attributes */
  177. #define PAL_CACHE_ATTR_WT 0 /* Write through cache */
  178. #define PAL_CACHE_ATTR_WB 1 /* Write back cache */
  179. #define PAL_CACHE_ATTR_WT_OR_WB 2 /* Either write thru or write
  180. * back depending on TLB
  181. * memory attributes
  182. */
  183. /* Possible values for cache hints */
  184. #define PAL_CACHE_HINT_TEMP_1 0 /* Temporal level 1 */
  185. #define PAL_CACHE_HINT_NTEMP_1 1 /* Non-temporal level 1 */
  186. #define PAL_CACHE_HINT_NTEMP_ALL 3 /* Non-temporal all levels */
  187. /* Processor cache protection information */
  188. typedef union pal_cache_protection_element_u {
  189. u32 pcpi_data;
  190. struct {
  191. u32 data_bits : 8, /* # data bits covered by
  192. * each unit of protection
  193. */
  194. tagprot_lsb : 6, /* Least -do- */
  195. tagprot_msb : 6, /* Most Sig. tag address
  196. * bit that this
  197. * protection covers.
  198. */
  199. prot_bits : 6, /* # of protection bits */
  200. method : 4, /* Protection method */
  201. t_d : 2; /* Indicates which part
  202. * of the cache this
  203. * protection encoding
  204. * applies.
  205. */
  206. } pcp_info;
  207. } pal_cache_protection_element_t;
  208. #define pcpi_cache_prot_part pcp_info.t_d
  209. #define pcpi_prot_method pcp_info.method
  210. #define pcpi_prot_bits pcp_info.prot_bits
  211. #define pcpi_tagprot_msb pcp_info.tagprot_msb
  212. #define pcpi_tagprot_lsb pcp_info.tagprot_lsb
  213. #define pcpi_data_bits pcp_info.data_bits
  214. /* Processor cache part encodings */
  215. #define PAL_CACHE_PROT_PART_DATA 0 /* Data protection */
  216. #define PAL_CACHE_PROT_PART_TAG 1 /* Tag protection */
  217. #define PAL_CACHE_PROT_PART_TAG_DATA 2 /* Tag+data protection (tag is
  218. * more significant )
  219. */
  220. #define PAL_CACHE_PROT_PART_DATA_TAG 3 /* Data+tag protection (data is
  221. * more significant )
  222. */
  223. #define PAL_CACHE_PROT_PART_MAX 6
  224. typedef struct pal_cache_protection_info_s {
  225. pal_status_t pcpi_status;
  226. pal_cache_protection_element_t pcp_info[PAL_CACHE_PROT_PART_MAX];
  227. } pal_cache_protection_info_t;
  228. /* Processor cache protection method encodings */
  229. #define PAL_CACHE_PROT_METHOD_NONE 0 /* No protection */
  230. #define PAL_CACHE_PROT_METHOD_ODD_PARITY 1 /* Odd parity */
  231. #define PAL_CACHE_PROT_METHOD_EVEN_PARITY 2 /* Even parity */
  232. #define PAL_CACHE_PROT_METHOD_ECC 3 /* ECC protection */
  233. /* Processor cache line identification in the hierarchy */
  234. typedef union pal_cache_line_id_u {
  235. u64 pclid_data;
  236. struct {
  237. u64 cache_type : 8, /* 7-0 cache type */
  238. level : 8, /* 15-8 level of the
  239. * cache in the
  240. * hierarchy.
  241. */
  242. way : 8, /* 23-16 way in the set
  243. */
  244. part : 8, /* 31-24 part of the
  245. * cache
  246. */
  247. reserved : 32; /* 63-32 is reserved*/
  248. } pclid_info_read;
  249. struct {
  250. u64 cache_type : 8, /* 7-0 cache type */
  251. level : 8, /* 15-8 level of the
  252. * cache in the
  253. * hierarchy.
  254. */
  255. way : 8, /* 23-16 way in the set
  256. */
  257. part : 8, /* 31-24 part of the
  258. * cache
  259. */
  260. mesi : 8, /* 39-32 cache line
  261. * state
  262. */
  263. start : 8, /* 47-40 lsb of data to
  264. * invert
  265. */
  266. length : 8, /* 55-48 #bits to
  267. * invert
  268. */
  269. trigger : 8; /* 63-56 Trigger error
  270. * by doing a load
  271. * after the write
  272. */
  273. } pclid_info_write;
  274. } pal_cache_line_id_u_t;
  275. #define pclid_read_part pclid_info_read.part
  276. #define pclid_read_way pclid_info_read.way
  277. #define pclid_read_level pclid_info_read.level
  278. #define pclid_read_cache_type pclid_info_read.cache_type
  279. #define pclid_write_trigger pclid_info_write.trigger
  280. #define pclid_write_length pclid_info_write.length
  281. #define pclid_write_start pclid_info_write.start
  282. #define pclid_write_mesi pclid_info_write.mesi
  283. #define pclid_write_part pclid_info_write.part
  284. #define pclid_write_way pclid_info_write.way
  285. #define pclid_write_level pclid_info_write.level
  286. #define pclid_write_cache_type pclid_info_write.cache_type
  287. /* Processor cache line part encodings */
  288. #define PAL_CACHE_LINE_ID_PART_DATA 0 /* Data */
  289. #define PAL_CACHE_LINE_ID_PART_TAG 1 /* Tag */
  290. #define PAL_CACHE_LINE_ID_PART_DATA_PROT 2 /* Data protection */
  291. #define PAL_CACHE_LINE_ID_PART_TAG_PROT 3 /* Tag protection */
  292. #define PAL_CACHE_LINE_ID_PART_DATA_TAG_PROT 4 /* Data+tag
  293. * protection
  294. */
  295. typedef struct pal_cache_line_info_s {
  296. pal_status_t pcli_status; /* Return status of the read cache line
  297. * info call.
  298. */
  299. u64 pcli_data; /* 64-bit data, tag, protection bits .. */
  300. u64 pcli_data_len; /* data length in bits */
  301. pal_cache_line_state_t pcli_cache_line_state; /* mesi state */
  302. } pal_cache_line_info_t;
  303. /* Machine Check related crap */
  304. /* Pending event status bits */
  305. typedef u64 pal_mc_pending_events_t;
  306. #define PAL_MC_PENDING_MCA (1 << 0)
  307. #define PAL_MC_PENDING_INIT (1 << 1)
  308. /* Error information type */
  309. typedef u64 pal_mc_info_index_t;
  310. #define PAL_MC_INFO_PROCESSOR 0 /* Processor */
  311. #define PAL_MC_INFO_CACHE_CHECK 1 /* Cache check */
  312. #define PAL_MC_INFO_TLB_CHECK 2 /* Tlb check */
  313. #define PAL_MC_INFO_BUS_CHECK 3 /* Bus check */
  314. #define PAL_MC_INFO_REQ_ADDR 4 /* Requestor address */
  315. #define PAL_MC_INFO_RESP_ADDR 5 /* Responder address */
  316. #define PAL_MC_INFO_TARGET_ADDR 6 /* Target address */
  317. #define PAL_MC_INFO_IMPL_DEP 7 /* Implementation
  318. * dependent
  319. */
  320. #define PAL_TLB_CHECK_OP_PURGE 8
  321. typedef struct pal_process_state_info_s {
  322. u64 reserved1 : 2,
  323. rz : 1, /* PAL_CHECK processor
  324. * rendezvous
  325. * successful.
  326. */
  327. ra : 1, /* PAL_CHECK attempted
  328. * a rendezvous.
  329. */
  330. me : 1, /* Distinct multiple
  331. * errors occurred
  332. */
  333. mn : 1, /* Min. state save
  334. * area has been
  335. * registered with PAL
  336. */
  337. sy : 1, /* Storage integrity
  338. * synched
  339. */
  340. co : 1, /* Continuable */
  341. ci : 1, /* MC isolated */
  342. us : 1, /* Uncontained storage
  343. * damage.
  344. */
  345. hd : 1, /* Non-essential hw
  346. * lost (no loss of
  347. * functionality)
  348. * causing the
  349. * processor to run in
  350. * degraded mode.
  351. */
  352. tl : 1, /* 1 => MC occurred
  353. * after an instr was
  354. * executed but before
  355. * the trap that
  356. * resulted from instr
  357. * execution was
  358. * generated.
  359. * (Trap Lost )
  360. */
  361. mi : 1, /* More information available
  362. * call PAL_MC_ERROR_INFO
  363. */
  364. pi : 1, /* Precise instruction pointer */
  365. pm : 1, /* Precise min-state save area */
  366. dy : 1, /* Processor dynamic
  367. * state valid
  368. */
  369. in : 1, /* 0 = MC, 1 = INIT */
  370. rs : 1, /* RSE valid */
  371. cm : 1, /* MC corrected */
  372. ex : 1, /* MC is expected */
  373. cr : 1, /* Control regs valid*/
  374. pc : 1, /* Perf cntrs valid */
  375. dr : 1, /* Debug regs valid */
  376. tr : 1, /* Translation regs
  377. * valid
  378. */
  379. rr : 1, /* Region regs valid */
  380. ar : 1, /* App regs valid */
  381. br : 1, /* Branch regs valid */
  382. pr : 1, /* Predicate registers
  383. * valid
  384. */
  385. fp : 1, /* fp registers valid*/
  386. b1 : 1, /* Preserved bank one
  387. * general registers
  388. * are valid
  389. */
  390. b0 : 1, /* Preserved bank zero
  391. * general registers
  392. * are valid
  393. */
  394. gr : 1, /* General registers
  395. * are valid
  396. * (excl. banked regs)
  397. */
  398. dsize : 16, /* size of dynamic
  399. * state returned
  400. * by the processor
  401. */
  402. se : 1, /* Shared error. MCA in a
  403. shared structure */
  404. reserved2 : 10,
  405. cc : 1, /* Cache check */
  406. tc : 1, /* TLB check */
  407. bc : 1, /* Bus check */
  408. rc : 1, /* Register file check */
  409. uc : 1; /* Uarch check */
  410. } pal_processor_state_info_t;
  411. typedef struct pal_cache_check_info_s {
  412. u64 op : 4, /* Type of cache
  413. * operation that
  414. * caused the machine
  415. * check.
  416. */
  417. level : 2, /* Cache level */
  418. reserved1 : 2,
  419. dl : 1, /* Failure in data part
  420. * of cache line
  421. */
  422. tl : 1, /* Failure in tag part
  423. * of cache line
  424. */
  425. dc : 1, /* Failure in dcache */
  426. ic : 1, /* Failure in icache */
  427. mesi : 3, /* Cache line state */
  428. mv : 1, /* mesi valid */
  429. way : 5, /* Way in which the
  430. * error occurred
  431. */
  432. wiv : 1, /* Way field valid */
  433. reserved2 : 1,
  434. dp : 1, /* Data poisoned on MBE */
  435. reserved3 : 8,
  436. index : 20, /* Cache line index */
  437. reserved4 : 2,
  438. is : 1, /* instruction set (1 == ia32) */
  439. iv : 1, /* instruction set field valid */
  440. pl : 2, /* privilege level */
  441. pv : 1, /* privilege level field valid */
  442. mcc : 1, /* Machine check corrected */
  443. tv : 1, /* Target address
  444. * structure is valid
  445. */
  446. rq : 1, /* Requester identifier
  447. * structure is valid
  448. */
  449. rp : 1, /* Responder identifier
  450. * structure is valid
  451. */
  452. pi : 1; /* Precise instruction pointer
  453. * structure is valid
  454. */
  455. } pal_cache_check_info_t;
  456. typedef struct pal_tlb_check_info_s {
  457. u64 tr_slot : 8, /* Slot# of TR where
  458. * error occurred
  459. */
  460. trv : 1, /* tr_slot field is valid */
  461. reserved1 : 1,
  462. level : 2, /* TLB level where failure occurred */
  463. reserved2 : 4,
  464. dtr : 1, /* Fail in data TR */
  465. itr : 1, /* Fail in inst TR */
  466. dtc : 1, /* Fail in data TC */
  467. itc : 1, /* Fail in inst. TC */
  468. op : 4, /* Cache operation */
  469. reserved3 : 30,
  470. is : 1, /* instruction set (1 == ia32) */
  471. iv : 1, /* instruction set field valid */
  472. pl : 2, /* privilege level */
  473. pv : 1, /* privilege level field valid */
  474. mcc : 1, /* Machine check corrected */
  475. tv : 1, /* Target address
  476. * structure is valid
  477. */
  478. rq : 1, /* Requester identifier
  479. * structure is valid
  480. */
  481. rp : 1, /* Responder identifier
  482. * structure is valid
  483. */
  484. pi : 1; /* Precise instruction pointer
  485. * structure is valid
  486. */
  487. } pal_tlb_check_info_t;
  488. typedef struct pal_bus_check_info_s {
  489. u64 size : 5, /* Xaction size */
  490. ib : 1, /* Internal bus error */
  491. eb : 1, /* External bus error */
  492. cc : 1, /* Error occurred
  493. * during cache-cache
  494. * transfer.
  495. */
  496. type : 8, /* Bus xaction type*/
  497. sev : 5, /* Bus error severity*/
  498. hier : 2, /* Bus hierarchy level */
  499. dp : 1, /* Data poisoned on MBE */
  500. bsi : 8, /* Bus error status
  501. * info
  502. */
  503. reserved2 : 22,
  504. is : 1, /* instruction set (1 == ia32) */
  505. iv : 1, /* instruction set field valid */
  506. pl : 2, /* privilege level */
  507. pv : 1, /* privilege level field valid */
  508. mcc : 1, /* Machine check corrected */
  509. tv : 1, /* Target address
  510. * structure is valid
  511. */
  512. rq : 1, /* Requester identifier
  513. * structure is valid
  514. */
  515. rp : 1, /* Responder identifier
  516. * structure is valid
  517. */
  518. pi : 1; /* Precise instruction pointer
  519. * structure is valid
  520. */
  521. } pal_bus_check_info_t;
  522. typedef struct pal_reg_file_check_info_s {
  523. u64 id : 4, /* Register file identifier */
  524. op : 4, /* Type of register
  525. * operation that
  526. * caused the machine
  527. * check.
  528. */
  529. reg_num : 7, /* Register number */
  530. rnv : 1, /* reg_num valid */
  531. reserved2 : 38,
  532. is : 1, /* instruction set (1 == ia32) */
  533. iv : 1, /* instruction set field valid */
  534. pl : 2, /* privilege level */
  535. pv : 1, /* privilege level field valid */
  536. mcc : 1, /* Machine check corrected */
  537. reserved3 : 3,
  538. pi : 1; /* Precise instruction pointer
  539. * structure is valid
  540. */
  541. } pal_reg_file_check_info_t;
  542. typedef struct pal_uarch_check_info_s {
  543. u64 sid : 5, /* Structure identification */
  544. level : 3, /* Level of failure */
  545. array_id : 4, /* Array identification */
  546. op : 4, /* Type of
  547. * operation that
  548. * caused the machine
  549. * check.
  550. */
  551. way : 6, /* Way of structure */
  552. wv : 1, /* way valid */
  553. xv : 1, /* index valid */
  554. reserved1 : 8,
  555. index : 8, /* Index or set of the uarch
  556. * structure that failed.
  557. */
  558. reserved2 : 24,
  559. is : 1, /* instruction set (1 == ia32) */
  560. iv : 1, /* instruction set field valid */
  561. pl : 2, /* privilege level */
  562. pv : 1, /* privilege level field valid */
  563. mcc : 1, /* Machine check corrected */
  564. tv : 1, /* Target address
  565. * structure is valid
  566. */
  567. rq : 1, /* Requester identifier
  568. * structure is valid
  569. */
  570. rp : 1, /* Responder identifier
  571. * structure is valid
  572. */
  573. pi : 1; /* Precise instruction pointer
  574. * structure is valid
  575. */
  576. } pal_uarch_check_info_t;
  577. typedef union pal_mc_error_info_u {
  578. u64 pmei_data;
  579. pal_processor_state_info_t pme_processor;
  580. pal_cache_check_info_t pme_cache;
  581. pal_tlb_check_info_t pme_tlb;
  582. pal_bus_check_info_t pme_bus;
  583. pal_reg_file_check_info_t pme_reg_file;
  584. pal_uarch_check_info_t pme_uarch;
  585. } pal_mc_error_info_t;
  586. #define pmci_proc_unknown_check pme_processor.uc
  587. #define pmci_proc_bus_check pme_processor.bc
  588. #define pmci_proc_tlb_check pme_processor.tc
  589. #define pmci_proc_cache_check pme_processor.cc
  590. #define pmci_proc_dynamic_state_size pme_processor.dsize
  591. #define pmci_proc_gpr_valid pme_processor.gr
  592. #define pmci_proc_preserved_bank0_gpr_valid pme_processor.b0
  593. #define pmci_proc_preserved_bank1_gpr_valid pme_processor.b1
  594. #define pmci_proc_fp_valid pme_processor.fp
  595. #define pmci_proc_predicate_regs_valid pme_processor.pr
  596. #define pmci_proc_branch_regs_valid pme_processor.br
  597. #define pmci_proc_app_regs_valid pme_processor.ar
  598. #define pmci_proc_region_regs_valid pme_processor.rr
  599. #define pmci_proc_translation_regs_valid pme_processor.tr
  600. #define pmci_proc_debug_regs_valid pme_processor.dr
  601. #define pmci_proc_perf_counters_valid pme_processor.pc
  602. #define pmci_proc_control_regs_valid pme_processor.cr
  603. #define pmci_proc_machine_check_expected pme_processor.ex
  604. #define pmci_proc_machine_check_corrected pme_processor.cm
  605. #define pmci_proc_rse_valid pme_processor.rs
  606. #define pmci_proc_machine_check_or_init pme_processor.in
  607. #define pmci_proc_dynamic_state_valid pme_processor.dy
  608. #define pmci_proc_operation pme_processor.op
  609. #define pmci_proc_trap_lost pme_processor.tl
  610. #define pmci_proc_hardware_damage pme_processor.hd
  611. #define pmci_proc_uncontained_storage_damage pme_processor.us
  612. #define pmci_proc_machine_check_isolated pme_processor.ci
  613. #define pmci_proc_continuable pme_processor.co
  614. #define pmci_proc_storage_intergrity_synced pme_processor.sy
  615. #define pmci_proc_min_state_save_area_regd pme_processor.mn
  616. #define pmci_proc_distinct_multiple_errors pme_processor.me
  617. #define pmci_proc_pal_attempted_rendezvous pme_processor.ra
  618. #define pmci_proc_pal_rendezvous_complete pme_processor.rz
  619. #define pmci_cache_level pme_cache.level
  620. #define pmci_cache_line_state pme_cache.mesi
  621. #define pmci_cache_line_state_valid pme_cache.mv
  622. #define pmci_cache_line_index pme_cache.index
  623. #define pmci_cache_instr_cache_fail pme_cache.ic
  624. #define pmci_cache_data_cache_fail pme_cache.dc
  625. #define pmci_cache_line_tag_fail pme_cache.tl
  626. #define pmci_cache_line_data_fail pme_cache.dl
  627. #define pmci_cache_operation pme_cache.op
  628. #define pmci_cache_way_valid pme_cache.wv
  629. #define pmci_cache_target_address_valid pme_cache.tv
  630. #define pmci_cache_way pme_cache.way
  631. #define pmci_cache_mc pme_cache.mc
  632. #define pmci_tlb_instr_translation_cache_fail pme_tlb.itc
  633. #define pmci_tlb_data_translation_cache_fail pme_tlb.dtc
  634. #define pmci_tlb_instr_translation_reg_fail pme_tlb.itr
  635. #define pmci_tlb_data_translation_reg_fail pme_tlb.dtr
  636. #define pmci_tlb_translation_reg_slot pme_tlb.tr_slot
  637. #define pmci_tlb_mc pme_tlb.mc
  638. #define pmci_bus_status_info pme_bus.bsi
  639. #define pmci_bus_req_address_valid pme_bus.rq
  640. #define pmci_bus_resp_address_valid pme_bus.rp
  641. #define pmci_bus_target_address_valid pme_bus.tv
  642. #define pmci_bus_error_severity pme_bus.sev
  643. #define pmci_bus_transaction_type pme_bus.type
  644. #define pmci_bus_cache_cache_transfer pme_bus.cc
  645. #define pmci_bus_transaction_size pme_bus.size
  646. #define pmci_bus_internal_error pme_bus.ib
  647. #define pmci_bus_external_error pme_bus.eb
  648. #define pmci_bus_mc pme_bus.mc
  649. /*
  650. * NOTE: this min_state_save area struct only includes the 1KB
  651. * architectural state save area. The other 3 KB is scratch space
  652. * for PAL.
  653. */
  654. typedef struct pal_min_state_area_s {
  655. u64 pmsa_nat_bits; /* nat bits for saved GRs */
  656. u64 pmsa_gr[15]; /* GR1 - GR15 */
  657. u64 pmsa_bank0_gr[16]; /* GR16 - GR31 */
  658. u64 pmsa_bank1_gr[16]; /* GR16 - GR31 */
  659. u64 pmsa_pr; /* predicate registers */
  660. u64 pmsa_br0; /* branch register 0 */
  661. u64 pmsa_rsc; /* ar.rsc */
  662. u64 pmsa_iip; /* cr.iip */
  663. u64 pmsa_ipsr; /* cr.ipsr */
  664. u64 pmsa_ifs; /* cr.ifs */
  665. u64 pmsa_xip; /* previous iip */
  666. u64 pmsa_xpsr; /* previous psr */
  667. u64 pmsa_xfs; /* previous ifs */
  668. u64 pmsa_br1; /* branch register 1 */
  669. u64 pmsa_reserved[70]; /* pal_min_state_area should total to 1KB */
  670. } pal_min_state_area_t;
  671. struct ia64_pal_retval {
  672. /*
  673. * A zero status value indicates call completed without error.
  674. * A negative status value indicates reason of call failure.
  675. * A positive status value indicates success but an
  676. * informational value should be printed (e.g., "reboot for
  677. * change to take effect").
  678. */
  679. s64 status;
  680. u64 v0;
  681. u64 v1;
  682. u64 v2;
  683. };
  684. /*
  685. * Note: Currently unused PAL arguments are generally labeled
  686. * "reserved" so the value specified in the PAL documentation
  687. * (generally 0) MUST be passed. Reserved parameters are not optional
  688. * parameters.
  689. */
  690. extern struct ia64_pal_retval ia64_pal_call_static (u64, u64, u64, u64);
  691. extern struct ia64_pal_retval ia64_pal_call_stacked (u64, u64, u64, u64);
  692. extern struct ia64_pal_retval ia64_pal_call_phys_static (u64, u64, u64, u64);
  693. extern struct ia64_pal_retval ia64_pal_call_phys_stacked (u64, u64, u64, u64);
  694. extern void ia64_save_scratch_fpregs (struct ia64_fpreg *);
  695. extern void ia64_load_scratch_fpregs (struct ia64_fpreg *);
  696. #define PAL_CALL(iprv,a0,a1,a2,a3) do { \
  697. struct ia64_fpreg fr[6]; \
  698. ia64_save_scratch_fpregs(fr); \
  699. iprv = ia64_pal_call_static(a0, a1, a2, a3); \
  700. ia64_load_scratch_fpregs(fr); \
  701. } while (0)
  702. #define PAL_CALL_STK(iprv,a0,a1,a2,a3) do { \
  703. struct ia64_fpreg fr[6]; \
  704. ia64_save_scratch_fpregs(fr); \
  705. iprv = ia64_pal_call_stacked(a0, a1, a2, a3); \
  706. ia64_load_scratch_fpregs(fr); \
  707. } while (0)
  708. #define PAL_CALL_PHYS(iprv,a0,a1,a2,a3) do { \
  709. struct ia64_fpreg fr[6]; \
  710. ia64_save_scratch_fpregs(fr); \
  711. iprv = ia64_pal_call_phys_static(a0, a1, a2, a3); \
  712. ia64_load_scratch_fpregs(fr); \
  713. } while (0)
  714. #define PAL_CALL_PHYS_STK(iprv,a0,a1,a2,a3) do { \
  715. struct ia64_fpreg fr[6]; \
  716. ia64_save_scratch_fpregs(fr); \
  717. iprv = ia64_pal_call_phys_stacked(a0, a1, a2, a3); \
  718. ia64_load_scratch_fpregs(fr); \
  719. } while (0)
  720. typedef int (*ia64_pal_handler) (u64, ...);
  721. extern ia64_pal_handler ia64_pal;
  722. extern void ia64_pal_handler_init (void *);
  723. extern ia64_pal_handler ia64_pal;
  724. extern pal_cache_config_info_t l0d_cache_config_info;
  725. extern pal_cache_config_info_t l0i_cache_config_info;
  726. extern pal_cache_config_info_t l1_cache_config_info;
  727. extern pal_cache_config_info_t l2_cache_config_info;
  728. extern pal_cache_protection_info_t l0d_cache_protection_info;
  729. extern pal_cache_protection_info_t l0i_cache_protection_info;
  730. extern pal_cache_protection_info_t l1_cache_protection_info;
  731. extern pal_cache_protection_info_t l2_cache_protection_info;
  732. extern pal_cache_config_info_t pal_cache_config_info_get(pal_cache_level_t,
  733. pal_cache_type_t);
  734. extern pal_cache_protection_info_t pal_cache_protection_info_get(pal_cache_level_t,
  735. pal_cache_type_t);
  736. extern void pal_error(int);
  737. /* Useful wrappers for the current list of pal procedures */
  738. typedef union pal_bus_features_u {
  739. u64 pal_bus_features_val;
  740. struct {
  741. u64 pbf_reserved1 : 29;
  742. u64 pbf_req_bus_parking : 1;
  743. u64 pbf_bus_lock_mask : 1;
  744. u64 pbf_enable_half_xfer_rate : 1;
  745. u64 pbf_reserved2 : 20;
  746. u64 pbf_enable_shared_line_replace : 1;
  747. u64 pbf_enable_exclusive_line_replace : 1;
  748. u64 pbf_disable_xaction_queueing : 1;
  749. u64 pbf_disable_resp_err_check : 1;
  750. u64 pbf_disable_berr_check : 1;
  751. u64 pbf_disable_bus_req_internal_err_signal : 1;
  752. u64 pbf_disable_bus_req_berr_signal : 1;
  753. u64 pbf_disable_bus_init_event_check : 1;
  754. u64 pbf_disable_bus_init_event_signal : 1;
  755. u64 pbf_disable_bus_addr_err_check : 1;
  756. u64 pbf_disable_bus_addr_err_signal : 1;
  757. u64 pbf_disable_bus_data_err_check : 1;
  758. } pal_bus_features_s;
  759. } pal_bus_features_u_t;
  760. extern void pal_bus_features_print (u64);
  761. /* Provide information about configurable processor bus features */
  762. static inline s64
  763. ia64_pal_bus_get_features (pal_bus_features_u_t *features_avail,
  764. pal_bus_features_u_t *features_status,
  765. pal_bus_features_u_t *features_control)
  766. {
  767. struct ia64_pal_retval iprv;
  768. PAL_CALL_PHYS(iprv, PAL_BUS_GET_FEATURES, 0, 0, 0);
  769. if (features_avail)
  770. features_avail->pal_bus_features_val = iprv.v0;
  771. if (features_status)
  772. features_status->pal_bus_features_val = iprv.v1;
  773. if (features_control)
  774. features_control->pal_bus_features_val = iprv.v2;
  775. return iprv.status;
  776. }
  777. /* Enables/disables specific processor bus features */
  778. static inline s64
  779. ia64_pal_bus_set_features (pal_bus_features_u_t feature_select)
  780. {
  781. struct ia64_pal_retval iprv;
  782. PAL_CALL_PHYS(iprv, PAL_BUS_SET_FEATURES, feature_select.pal_bus_features_val, 0, 0);
  783. return iprv.status;
  784. }
  785. /* Get detailed cache information */
  786. static inline s64
  787. ia64_pal_cache_config_info (u64 cache_level, u64 cache_type, pal_cache_config_info_t *conf)
  788. {
  789. struct ia64_pal_retval iprv;
  790. PAL_CALL(iprv, PAL_CACHE_INFO, cache_level, cache_type, 0);
  791. if (iprv.status == 0) {
  792. conf->pcci_status = iprv.status;
  793. conf->pcci_info_1.pcci1_data = iprv.v0;
  794. conf->pcci_info_2.pcci2_data = iprv.v1;
  795. conf->pcci_reserved = iprv.v2;
  796. }
  797. return iprv.status;
  798. }
  799. /* Get detailed cche protection information */
  800. static inline s64
  801. ia64_pal_cache_prot_info (u64 cache_level, u64 cache_type, pal_cache_protection_info_t *prot)
  802. {
  803. struct ia64_pal_retval iprv;
  804. PAL_CALL(iprv, PAL_CACHE_PROT_INFO, cache_level, cache_type, 0);
  805. if (iprv.status == 0) {
  806. prot->pcpi_status = iprv.status;
  807. prot->pcp_info[0].pcpi_data = iprv.v0 & 0xffffffff;
  808. prot->pcp_info[1].pcpi_data = iprv.v0 >> 32;
  809. prot->pcp_info[2].pcpi_data = iprv.v1 & 0xffffffff;
  810. prot->pcp_info[3].pcpi_data = iprv.v1 >> 32;
  811. prot->pcp_info[4].pcpi_data = iprv.v2 & 0xffffffff;
  812. prot->pcp_info[5].pcpi_data = iprv.v2 >> 32;
  813. }
  814. return iprv.status;
  815. }
  816. /*
  817. * Flush the processor instruction or data caches. *PROGRESS must be
  818. * initialized to zero before calling this for the first time..
  819. */
  820. static inline s64
  821. ia64_pal_cache_flush (u64 cache_type, u64 invalidate, u64 *progress, u64 *vector)
  822. {
  823. struct ia64_pal_retval iprv;
  824. PAL_CALL(iprv, PAL_CACHE_FLUSH, cache_type, invalidate, *progress);
  825. if (vector)
  826. *vector = iprv.v0;
  827. *progress = iprv.v1;
  828. return iprv.status;
  829. }
  830. /* Initialize the processor controlled caches */
  831. static inline s64
  832. ia64_pal_cache_init (u64 level, u64 cache_type, u64 rest)
  833. {
  834. struct ia64_pal_retval iprv;
  835. PAL_CALL(iprv, PAL_CACHE_INIT, level, cache_type, rest);
  836. return iprv.status;
  837. }
  838. /* Initialize the tags and data of a data or unified cache line of
  839. * processor controlled cache to known values without the availability
  840. * of backing memory.
  841. */
  842. static inline s64
  843. ia64_pal_cache_line_init (u64 physical_addr, u64 data_value)
  844. {
  845. struct ia64_pal_retval iprv;
  846. PAL_CALL(iprv, PAL_CACHE_LINE_INIT, physical_addr, data_value, 0);
  847. return iprv.status;
  848. }
  849. /* Read the data and tag of a processor controlled cache line for diags */
  850. static inline s64
  851. ia64_pal_cache_read (pal_cache_line_id_u_t line_id, u64 physical_addr)
  852. {
  853. struct ia64_pal_retval iprv;
  854. PAL_CALL_PHYS_STK(iprv, PAL_CACHE_READ, line_id.pclid_data,
  855. physical_addr, 0);
  856. return iprv.status;
  857. }
  858. /* Return summary information about the hierarchy of caches controlled by the processor */
  859. static inline s64
  860. ia64_pal_cache_summary (u64 *cache_levels, u64 *unique_caches)
  861. {
  862. struct ia64_pal_retval iprv;
  863. PAL_CALL(iprv, PAL_CACHE_SUMMARY, 0, 0, 0);
  864. if (cache_levels)
  865. *cache_levels = iprv.v0;
  866. if (unique_caches)
  867. *unique_caches = iprv.v1;
  868. return iprv.status;
  869. }
  870. /* Write the data and tag of a processor-controlled cache line for diags */
  871. static inline s64
  872. ia64_pal_cache_write (pal_cache_line_id_u_t line_id, u64 physical_addr, u64 data)
  873. {
  874. struct ia64_pal_retval iprv;
  875. PAL_CALL_PHYS_STK(iprv, PAL_CACHE_WRITE, line_id.pclid_data,
  876. physical_addr, data);
  877. return iprv.status;
  878. }
  879. /* Return the parameters needed to copy relocatable PAL procedures from ROM to memory */
  880. static inline s64
  881. ia64_pal_copy_info (u64 copy_type, u64 num_procs, u64 num_iopics,
  882. u64 *buffer_size, u64 *buffer_align)
  883. {
  884. struct ia64_pal_retval iprv;
  885. PAL_CALL(iprv, PAL_COPY_INFO, copy_type, num_procs, num_iopics);
  886. if (buffer_size)
  887. *buffer_size = iprv.v0;
  888. if (buffer_align)
  889. *buffer_align = iprv.v1;
  890. return iprv.status;
  891. }
  892. /* Copy relocatable PAL procedures from ROM to memory */
  893. static inline s64
  894. ia64_pal_copy_pal (u64 target_addr, u64 alloc_size, u64 processor, u64 *pal_proc_offset)
  895. {
  896. struct ia64_pal_retval iprv;
  897. PAL_CALL(iprv, PAL_COPY_PAL, target_addr, alloc_size, processor);
  898. if (pal_proc_offset)
  899. *pal_proc_offset = iprv.v0;
  900. return iprv.status;
  901. }
  902. /* Return the number of instruction and data debug register pairs */
  903. static inline s64
  904. ia64_pal_debug_info (u64 *inst_regs, u64 *data_regs)
  905. {
  906. struct ia64_pal_retval iprv;
  907. PAL_CALL(iprv, PAL_DEBUG_INFO, 0, 0, 0);
  908. if (inst_regs)
  909. *inst_regs = iprv.v0;
  910. if (data_regs)
  911. *data_regs = iprv.v1;
  912. return iprv.status;
  913. }
  914. #ifdef TBD
  915. /* Switch from IA64-system environment to IA-32 system environment */
  916. static inline s64
  917. ia64_pal_enter_ia32_env (ia32_env1, ia32_env2, ia32_env3)
  918. {
  919. struct ia64_pal_retval iprv;
  920. PAL_CALL(iprv, PAL_ENTER_IA_32_ENV, ia32_env1, ia32_env2, ia32_env3);
  921. return iprv.status;
  922. }
  923. #endif
  924. /* Get unique geographical address of this processor on its bus */
  925. static inline s64
  926. ia64_pal_fixed_addr (u64 *global_unique_addr)
  927. {
  928. struct ia64_pal_retval iprv;
  929. PAL_CALL(iprv, PAL_FIXED_ADDR, 0, 0, 0);
  930. if (global_unique_addr)
  931. *global_unique_addr = iprv.v0;
  932. return iprv.status;
  933. }
  934. /* Get base frequency of the platform if generated by the processor */
  935. static inline s64
  936. ia64_pal_freq_base (u64 *platform_base_freq)
  937. {
  938. struct ia64_pal_retval iprv;
  939. PAL_CALL(iprv, PAL_FREQ_BASE, 0, 0, 0);
  940. if (platform_base_freq)
  941. *platform_base_freq = iprv.v0;
  942. return iprv.status;
  943. }
  944. /*
  945. * Get the ratios for processor frequency, bus frequency and interval timer to
  946. * to base frequency of the platform
  947. */
  948. static inline s64
  949. ia64_pal_freq_ratios (struct pal_freq_ratio *proc_ratio, struct pal_freq_ratio *bus_ratio,
  950. struct pal_freq_ratio *itc_ratio)
  951. {
  952. struct ia64_pal_retval iprv;
  953. PAL_CALL(iprv, PAL_FREQ_RATIOS, 0, 0, 0);
  954. if (proc_ratio)
  955. *(u64 *)proc_ratio = iprv.v0;
  956. if (bus_ratio)
  957. *(u64 *)bus_ratio = iprv.v1;
  958. if (itc_ratio)
  959. *(u64 *)itc_ratio = iprv.v2;
  960. return iprv.status;
  961. }
  962. /*
  963. * Get the current hardware resource sharing policy of the processor
  964. */
  965. static inline s64
  966. ia64_pal_get_hw_policy (u64 proc_num, u64 *cur_policy, u64 *num_impacted,
  967. u64 *la)
  968. {
  969. struct ia64_pal_retval iprv;
  970. PAL_CALL(iprv, PAL_GET_HW_POLICY, proc_num, 0, 0);
  971. if (cur_policy)
  972. *cur_policy = iprv.v0;
  973. if (num_impacted)
  974. *num_impacted = iprv.v1;
  975. if (la)
  976. *la = iprv.v2;
  977. return iprv.status;
  978. }
  979. /* Make the processor enter HALT or one of the implementation dependent low
  980. * power states where prefetching and execution are suspended and cache and
  981. * TLB coherency is not maintained.
  982. */
  983. static inline s64
  984. ia64_pal_halt (u64 halt_state)
  985. {
  986. struct ia64_pal_retval iprv;
  987. PAL_CALL(iprv, PAL_HALT, halt_state, 0, 0);
  988. return iprv.status;
  989. }
  990. typedef union pal_power_mgmt_info_u {
  991. u64 ppmi_data;
  992. struct {
  993. u64 exit_latency : 16,
  994. entry_latency : 16,
  995. power_consumption : 28,
  996. im : 1,
  997. co : 1,
  998. reserved : 2;
  999. } pal_power_mgmt_info_s;
  1000. } pal_power_mgmt_info_u_t;
  1001. /* Return information about processor's optional power management capabilities. */
  1002. static inline s64
  1003. ia64_pal_halt_info (pal_power_mgmt_info_u_t *power_buf)
  1004. {
  1005. struct ia64_pal_retval iprv;
  1006. PAL_CALL_STK(iprv, PAL_HALT_INFO, (unsigned long) power_buf, 0, 0);
  1007. return iprv.status;
  1008. }
  1009. /* Get the current P-state information */
  1010. static inline s64
  1011. ia64_pal_get_pstate (u64 *pstate_index, unsigned long type)
  1012. {
  1013. struct ia64_pal_retval iprv;
  1014. PAL_CALL_STK(iprv, PAL_GET_PSTATE, type, 0, 0);
  1015. *pstate_index = iprv.v0;
  1016. return iprv.status;
  1017. }
  1018. /* Set the P-state */
  1019. static inline s64
  1020. ia64_pal_set_pstate (u64 pstate_index)
  1021. {
  1022. struct ia64_pal_retval iprv;
  1023. PAL_CALL_STK(iprv, PAL_SET_PSTATE, pstate_index, 0, 0);
  1024. return iprv.status;
  1025. }
  1026. /* Processor branding information*/
  1027. static inline s64
  1028. ia64_pal_get_brand_info (char *brand_info)
  1029. {
  1030. struct ia64_pal_retval iprv;
  1031. PAL_CALL_STK(iprv, PAL_BRAND_INFO, 0, (u64)brand_info, 0);
  1032. return iprv.status;
  1033. }
  1034. /* Cause the processor to enter LIGHT HALT state, where prefetching and execution are
  1035. * suspended, but cache and TLB coherency is maintained.
  1036. */
  1037. static inline s64
  1038. ia64_pal_halt_light (void)
  1039. {
  1040. struct ia64_pal_retval iprv;
  1041. PAL_CALL(iprv, PAL_HALT_LIGHT, 0, 0, 0);
  1042. return iprv.status;
  1043. }
  1044. /* Clear all the processor error logging registers and reset the indicator that allows
  1045. * the error logging registers to be written. This procedure also checks the pending
  1046. * machine check bit and pending INIT bit and reports their states.
  1047. */
  1048. static inline s64
  1049. ia64_pal_mc_clear_log (u64 *pending_vector)
  1050. {
  1051. struct ia64_pal_retval iprv;
  1052. PAL_CALL(iprv, PAL_MC_CLEAR_LOG, 0, 0, 0);
  1053. if (pending_vector)
  1054. *pending_vector = iprv.v0;
  1055. return iprv.status;
  1056. }
  1057. /* Ensure that all outstanding transactions in a processor are completed or that any
  1058. * MCA due to thes outstanding transaction is taken.
  1059. */
  1060. static inline s64
  1061. ia64_pal_mc_drain (void)
  1062. {
  1063. struct ia64_pal_retval iprv;
  1064. PAL_CALL(iprv, PAL_MC_DRAIN, 0, 0, 0);
  1065. return iprv.status;
  1066. }
  1067. /* Return the machine check dynamic processor state */
  1068. static inline s64
  1069. ia64_pal_mc_dynamic_state (u64 offset, u64 *size, u64 *pds)
  1070. {
  1071. struct ia64_pal_retval iprv;
  1072. PAL_CALL(iprv, PAL_MC_DYNAMIC_STATE, offset, 0, 0);
  1073. if (size)
  1074. *size = iprv.v0;
  1075. if (pds)
  1076. *pds = iprv.v1;
  1077. return iprv.status;
  1078. }
  1079. /* Return processor machine check information */
  1080. static inline s64
  1081. ia64_pal_mc_error_info (u64 info_index, u64 type_index, u64 *size, u64 *error_info)
  1082. {
  1083. struct ia64_pal_retval iprv;
  1084. PAL_CALL(iprv, PAL_MC_ERROR_INFO, info_index, type_index, 0);
  1085. if (size)
  1086. *size = iprv.v0;
  1087. if (error_info)
  1088. *error_info = iprv.v1;
  1089. return iprv.status;
  1090. }
  1091. /* Injects the requested processor error or returns info on
  1092. * supported injection capabilities for current processor implementation
  1093. */
  1094. static inline s64
  1095. ia64_pal_mc_error_inject_phys (u64 err_type_info, u64 err_struct_info,
  1096. u64 err_data_buffer, u64 *capabilities, u64 *resources)
  1097. {
  1098. struct ia64_pal_retval iprv;
  1099. PAL_CALL_PHYS_STK(iprv, PAL_MC_ERROR_INJECT, err_type_info,
  1100. err_struct_info, err_data_buffer);
  1101. if (capabilities)
  1102. *capabilities= iprv.v0;
  1103. if (resources)
  1104. *resources= iprv.v1;
  1105. return iprv.status;
  1106. }
  1107. static inline s64
  1108. ia64_pal_mc_error_inject_virt (u64 err_type_info, u64 err_struct_info,
  1109. u64 err_data_buffer, u64 *capabilities, u64 *resources)
  1110. {
  1111. struct ia64_pal_retval iprv;
  1112. PAL_CALL_STK(iprv, PAL_MC_ERROR_INJECT, err_type_info,
  1113. err_struct_info, err_data_buffer);
  1114. if (capabilities)
  1115. *capabilities= iprv.v0;
  1116. if (resources)
  1117. *resources= iprv.v1;
  1118. return iprv.status;
  1119. }
  1120. /* Inform PALE_CHECK whether a machine check is expected so that PALE_CHECK willnot
  1121. * attempt to correct any expected machine checks.
  1122. */
  1123. static inline s64
  1124. ia64_pal_mc_expected (u64 expected, u64 *previous)
  1125. {
  1126. struct ia64_pal_retval iprv;
  1127. PAL_CALL(iprv, PAL_MC_EXPECTED, expected, 0, 0);
  1128. if (previous)
  1129. *previous = iprv.v0;
  1130. return iprv.status;
  1131. }
  1132. /* Register a platform dependent location with PAL to which it can save
  1133. * minimal processor state in the event of a machine check or initialization
  1134. * event.
  1135. */
  1136. static inline s64
  1137. ia64_pal_mc_register_mem (u64 physical_addr)
  1138. {
  1139. struct ia64_pal_retval iprv;
  1140. PAL_CALL(iprv, PAL_MC_REGISTER_MEM, physical_addr, 0, 0);
  1141. return iprv.status;
  1142. }
  1143. /* Restore minimal architectural processor state, set CMC interrupt if necessary
  1144. * and resume execution
  1145. */
  1146. static inline s64
  1147. ia64_pal_mc_resume (u64 set_cmci, u64 save_ptr)
  1148. {
  1149. struct ia64_pal_retval iprv;
  1150. PAL_CALL(iprv, PAL_MC_RESUME, set_cmci, save_ptr, 0);
  1151. return iprv.status;
  1152. }
  1153. /* Return the memory attributes implemented by the processor */
  1154. static inline s64
  1155. ia64_pal_mem_attrib (u64 *mem_attrib)
  1156. {
  1157. struct ia64_pal_retval iprv;
  1158. PAL_CALL(iprv, PAL_MEM_ATTRIB, 0, 0, 0);
  1159. if (mem_attrib)
  1160. *mem_attrib = iprv.v0 & 0xff;
  1161. return iprv.status;
  1162. }
  1163. /* Return the amount of memory needed for second phase of processor
  1164. * self-test and the required alignment of memory.
  1165. */
  1166. static inline s64
  1167. ia64_pal_mem_for_test (u64 *bytes_needed, u64 *alignment)
  1168. {
  1169. struct ia64_pal_retval iprv;
  1170. PAL_CALL(iprv, PAL_MEM_FOR_TEST, 0, 0, 0);
  1171. if (bytes_needed)
  1172. *bytes_needed = iprv.v0;
  1173. if (alignment)
  1174. *alignment = iprv.v1;
  1175. return iprv.status;
  1176. }
  1177. typedef union pal_perf_mon_info_u {
  1178. u64 ppmi_data;
  1179. struct {
  1180. u64 generic : 8,
  1181. width : 8,
  1182. cycles : 8,
  1183. retired : 8,
  1184. reserved : 32;
  1185. } pal_perf_mon_info_s;
  1186. } pal_perf_mon_info_u_t;
  1187. /* Return the performance monitor information about what can be counted
  1188. * and how to configure the monitors to count the desired events.
  1189. */
  1190. static inline s64
  1191. ia64_pal_perf_mon_info (u64 *pm_buffer, pal_perf_mon_info_u_t *pm_info)
  1192. {
  1193. struct ia64_pal_retval iprv;
  1194. PAL_CALL(iprv, PAL_PERF_MON_INFO, (unsigned long) pm_buffer, 0, 0);
  1195. if (pm_info)
  1196. pm_info->ppmi_data = iprv.v0;
  1197. return iprv.status;
  1198. }
  1199. /* Specifies the physical address of the processor interrupt block
  1200. * and I/O port space.
  1201. */
  1202. static inline s64
  1203. ia64_pal_platform_addr (u64 type, u64 physical_addr)
  1204. {
  1205. struct ia64_pal_retval iprv;
  1206. PAL_CALL(iprv, PAL_PLATFORM_ADDR, type, physical_addr, 0);
  1207. return iprv.status;
  1208. }
  1209. /* Set the SAL PMI entrypoint in memory */
  1210. static inline s64
  1211. ia64_pal_pmi_entrypoint (u64 sal_pmi_entry_addr)
  1212. {
  1213. struct ia64_pal_retval iprv;
  1214. PAL_CALL(iprv, PAL_PMI_ENTRYPOINT, sal_pmi_entry_addr, 0, 0);
  1215. return iprv.status;
  1216. }
  1217. struct pal_features_s;
  1218. /* Provide information about configurable processor features */
  1219. static inline s64
  1220. ia64_pal_proc_get_features (u64 *features_avail,
  1221. u64 *features_status,
  1222. u64 *features_control,
  1223. u64 features_set)
  1224. {
  1225. struct ia64_pal_retval iprv;
  1226. PAL_CALL_PHYS(iprv, PAL_PROC_GET_FEATURES, 0, features_set, 0);
  1227. if (iprv.status == 0) {
  1228. *features_avail = iprv.v0;
  1229. *features_status = iprv.v1;
  1230. *features_control = iprv.v2;
  1231. }
  1232. return iprv.status;
  1233. }
  1234. /* Enable/disable processor dependent features */
  1235. static inline s64
  1236. ia64_pal_proc_set_features (u64 feature_select)
  1237. {
  1238. struct ia64_pal_retval iprv;
  1239. PAL_CALL_PHYS(iprv, PAL_PROC_SET_FEATURES, feature_select, 0, 0);
  1240. return iprv.status;
  1241. }
  1242. /*
  1243. * Put everything in a struct so we avoid the global offset table whenever
  1244. * possible.
  1245. */
  1246. typedef struct ia64_ptce_info_s {
  1247. u64 base;
  1248. u32 count[2];
  1249. u32 stride[2];
  1250. } ia64_ptce_info_t;
  1251. /* Return the information required for the architected loop used to purge
  1252. * (initialize) the entire TC
  1253. */
  1254. static inline s64
  1255. ia64_get_ptce (ia64_ptce_info_t *ptce)
  1256. {
  1257. struct ia64_pal_retval iprv;
  1258. if (!ptce)
  1259. return -1;
  1260. PAL_CALL(iprv, PAL_PTCE_INFO, 0, 0, 0);
  1261. if (iprv.status == 0) {
  1262. ptce->base = iprv.v0;
  1263. ptce->count[0] = iprv.v1 >> 32;
  1264. ptce->count[1] = iprv.v1 & 0xffffffff;
  1265. ptce->stride[0] = iprv.v2 >> 32;
  1266. ptce->stride[1] = iprv.v2 & 0xffffffff;
  1267. }
  1268. return iprv.status;
  1269. }
  1270. /* Return info about implemented application and control registers. */
  1271. static inline s64
  1272. ia64_pal_register_info (u64 info_request, u64 *reg_info_1, u64 *reg_info_2)
  1273. {
  1274. struct ia64_pal_retval iprv;
  1275. PAL_CALL(iprv, PAL_REGISTER_INFO, info_request, 0, 0);
  1276. if (reg_info_1)
  1277. *reg_info_1 = iprv.v0;
  1278. if (reg_info_2)
  1279. *reg_info_2 = iprv.v1;
  1280. return iprv.status;
  1281. }
  1282. typedef union pal_hints_u {
  1283. u64 ph_data;
  1284. struct {
  1285. u64 si : 1,
  1286. li : 1,
  1287. reserved : 62;
  1288. } pal_hints_s;
  1289. } pal_hints_u_t;
  1290. /* Return information about the register stack and RSE for this processor
  1291. * implementation.
  1292. */
  1293. static inline s64
  1294. ia64_pal_rse_info (u64 *num_phys_stacked, pal_hints_u_t *hints)
  1295. {
  1296. struct ia64_pal_retval iprv;
  1297. PAL_CALL(iprv, PAL_RSE_INFO, 0, 0, 0);
  1298. if (num_phys_stacked)
  1299. *num_phys_stacked = iprv.v0;
  1300. if (hints)
  1301. hints->ph_data = iprv.v1;
  1302. return iprv.status;
  1303. }
  1304. /*
  1305. * Set the current hardware resource sharing policy of the processor
  1306. */
  1307. static inline s64
  1308. ia64_pal_set_hw_policy (u64 policy)
  1309. {
  1310. struct ia64_pal_retval iprv;
  1311. PAL_CALL(iprv, PAL_SET_HW_POLICY, policy, 0, 0);
  1312. return iprv.status;
  1313. }
  1314. /* Cause the processor to enter SHUTDOWN state, where prefetching and execution are
  1315. * suspended, but cause cache and TLB coherency to be maintained.
  1316. * This is usually called in IA-32 mode.
  1317. */
  1318. static inline s64
  1319. ia64_pal_shutdown (void)
  1320. {
  1321. struct ia64_pal_retval iprv;
  1322. PAL_CALL(iprv, PAL_SHUTDOWN, 0, 0, 0);
  1323. return iprv.status;
  1324. }
  1325. /* Perform the second phase of processor self-test. */
  1326. static inline s64
  1327. ia64_pal_test_proc (u64 test_addr, u64 test_size, u64 attributes, u64 *self_test_state)
  1328. {
  1329. struct ia64_pal_retval iprv;
  1330. PAL_CALL(iprv, PAL_TEST_PROC, test_addr, test_size, attributes);
  1331. if (self_test_state)
  1332. *self_test_state = iprv.v0;
  1333. return iprv.status;
  1334. }
  1335. typedef union pal_version_u {
  1336. u64 pal_version_val;
  1337. struct {
  1338. u64 pv_pal_b_rev : 8;
  1339. u64 pv_pal_b_model : 8;
  1340. u64 pv_reserved1 : 8;
  1341. u64 pv_pal_vendor : 8;
  1342. u64 pv_pal_a_rev : 8;
  1343. u64 pv_pal_a_model : 8;
  1344. u64 pv_reserved2 : 16;
  1345. } pal_version_s;
  1346. } pal_version_u_t;
  1347. /*
  1348. * Return PAL version information. While the documentation states that
  1349. * PAL_VERSION can be called in either physical or virtual mode, some
  1350. * implementations only allow physical calls. We don't call it very often,
  1351. * so the overhead isn't worth eliminating.
  1352. */
  1353. static inline s64
  1354. ia64_pal_version (pal_version_u_t *pal_min_version, pal_version_u_t *pal_cur_version)
  1355. {
  1356. struct ia64_pal_retval iprv;
  1357. PAL_CALL_PHYS(iprv, PAL_VERSION, 0, 0, 0);
  1358. if (pal_min_version)
  1359. pal_min_version->pal_version_val = iprv.v0;
  1360. if (pal_cur_version)
  1361. pal_cur_version->pal_version_val = iprv.v1;
  1362. return iprv.status;
  1363. }
  1364. typedef union pal_tc_info_u {
  1365. u64 pti_val;
  1366. struct {
  1367. u64 num_sets : 8,
  1368. associativity : 8,
  1369. num_entries : 16,
  1370. pf : 1,
  1371. unified : 1,
  1372. reduce_tr : 1,
  1373. reserved : 29;
  1374. } pal_tc_info_s;
  1375. } pal_tc_info_u_t;
  1376. #define tc_reduce_tr pal_tc_info_s.reduce_tr
  1377. #define tc_unified pal_tc_info_s.unified
  1378. #define tc_pf pal_tc_info_s.pf
  1379. #define tc_num_entries pal_tc_info_s.num_entries
  1380. #define tc_associativity pal_tc_info_s.associativity
  1381. #define tc_num_sets pal_tc_info_s.num_sets
  1382. /* Return information about the virtual memory characteristics of the processor
  1383. * implementation.
  1384. */
  1385. static inline s64
  1386. ia64_pal_vm_info (u64 tc_level, u64 tc_type, pal_tc_info_u_t *tc_info, u64 *tc_pages)
  1387. {
  1388. struct ia64_pal_retval iprv;
  1389. PAL_CALL(iprv, PAL_VM_INFO, tc_level, tc_type, 0);
  1390. if (tc_info)
  1391. tc_info->pti_val = iprv.v0;
  1392. if (tc_pages)
  1393. *tc_pages = iprv.v1;
  1394. return iprv.status;
  1395. }
  1396. /* Get page size information about the virtual memory characteristics of the processor
  1397. * implementation.
  1398. */
  1399. static inline s64
  1400. ia64_pal_vm_page_size (u64 *tr_pages, u64 *vw_pages)
  1401. {
  1402. struct ia64_pal_retval iprv;
  1403. PAL_CALL(iprv, PAL_VM_PAGE_SIZE, 0, 0, 0);
  1404. if (tr_pages)
  1405. *tr_pages = iprv.v0;
  1406. if (vw_pages)
  1407. *vw_pages = iprv.v1;
  1408. return iprv.status;
  1409. }
  1410. typedef union pal_vm_info_1_u {
  1411. u64 pvi1_val;
  1412. struct {
  1413. u64 vw : 1,
  1414. phys_add_size : 7,
  1415. key_size : 8,
  1416. max_pkr : 8,
  1417. hash_tag_id : 8,
  1418. max_dtr_entry : 8,
  1419. max_itr_entry : 8,
  1420. max_unique_tcs : 8,
  1421. num_tc_levels : 8;
  1422. } pal_vm_info_1_s;
  1423. } pal_vm_info_1_u_t;
  1424. #define PAL_MAX_PURGES 0xFFFF /* all ones is means unlimited */
  1425. typedef union pal_vm_info_2_u {
  1426. u64 pvi2_val;
  1427. struct {
  1428. u64 impl_va_msb : 8,
  1429. rid_size : 8,
  1430. max_purges : 16,
  1431. reserved : 32;
  1432. } pal_vm_info_2_s;
  1433. } pal_vm_info_2_u_t;
  1434. /* Get summary information about the virtual memory characteristics of the processor
  1435. * implementation.
  1436. */
  1437. static inline s64
  1438. ia64_pal_vm_summary (pal_vm_info_1_u_t *vm_info_1, pal_vm_info_2_u_t *vm_info_2)
  1439. {
  1440. struct ia64_pal_retval iprv;
  1441. PAL_CALL(iprv, PAL_VM_SUMMARY, 0, 0, 0);
  1442. if (vm_info_1)
  1443. vm_info_1->pvi1_val = iprv.v0;
  1444. if (vm_info_2)
  1445. vm_info_2->pvi2_val = iprv.v1;
  1446. return iprv.status;
  1447. }
  1448. typedef union pal_itr_valid_u {
  1449. u64 piv_val;
  1450. struct {
  1451. u64 access_rights_valid : 1,
  1452. priv_level_valid : 1,
  1453. dirty_bit_valid : 1,
  1454. mem_attr_valid : 1,
  1455. reserved : 60;
  1456. } pal_tr_valid_s;
  1457. } pal_tr_valid_u_t;
  1458. /* Read a translation register */
  1459. static inline s64
  1460. ia64_pal_tr_read (u64 reg_num, u64 tr_type, u64 *tr_buffer, pal_tr_valid_u_t *tr_valid)
  1461. {
  1462. struct ia64_pal_retval iprv;
  1463. PAL_CALL_PHYS_STK(iprv, PAL_VM_TR_READ, reg_num, tr_type,(u64)ia64_tpa(tr_buffer));
  1464. if (tr_valid)
  1465. tr_valid->piv_val = iprv.v0;
  1466. return iprv.status;
  1467. }
  1468. /*
  1469. * PAL_PREFETCH_VISIBILITY transaction types
  1470. */
  1471. #define PAL_VISIBILITY_VIRTUAL 0
  1472. #define PAL_VISIBILITY_PHYSICAL 1
  1473. /*
  1474. * PAL_PREFETCH_VISIBILITY return codes
  1475. */
  1476. #define PAL_VISIBILITY_OK 1
  1477. #define PAL_VISIBILITY_OK_REMOTE_NEEDED 0
  1478. #define PAL_VISIBILITY_INVAL_ARG -2
  1479. #define PAL_VISIBILITY_ERROR -3
  1480. static inline s64
  1481. ia64_pal_prefetch_visibility (s64 trans_type)
  1482. {
  1483. struct ia64_pal_retval iprv;
  1484. PAL_CALL(iprv, PAL_PREFETCH_VISIBILITY, trans_type, 0, 0);
  1485. return iprv.status;
  1486. }
  1487. /* data structure for getting information on logical to physical mappings */
  1488. typedef union pal_log_overview_u {
  1489. struct {
  1490. u64 num_log :16, /* Total number of logical
  1491. * processors on this die
  1492. */
  1493. tpc :8, /* Threads per core */
  1494. reserved3 :8, /* Reserved */
  1495. cpp :8, /* Cores per processor */
  1496. reserved2 :8, /* Reserved */
  1497. ppid :8, /* Physical processor ID */
  1498. reserved1 :8; /* Reserved */
  1499. } overview_bits;
  1500. u64 overview_data;
  1501. } pal_log_overview_t;
  1502. typedef union pal_proc_n_log_info1_u{
  1503. struct {
  1504. u64 tid :16, /* Thread id */
  1505. reserved2 :16, /* Reserved */
  1506. cid :16, /* Core id */
  1507. reserved1 :16; /* Reserved */
  1508. } ppli1_bits;
  1509. u64 ppli1_data;
  1510. } pal_proc_n_log_info1_t;
  1511. typedef union pal_proc_n_log_info2_u {
  1512. struct {
  1513. u64 la :16, /* Logical address */
  1514. reserved :48; /* Reserved */
  1515. } ppli2_bits;
  1516. u64 ppli2_data;
  1517. } pal_proc_n_log_info2_t;
  1518. typedef struct pal_logical_to_physical_s
  1519. {
  1520. pal_log_overview_t overview;
  1521. pal_proc_n_log_info1_t ppli1;
  1522. pal_proc_n_log_info2_t ppli2;
  1523. } pal_logical_to_physical_t;
  1524. #define overview_num_log overview.overview_bits.num_log
  1525. #define overview_tpc overview.overview_bits.tpc
  1526. #define overview_cpp overview.overview_bits.cpp
  1527. #define overview_ppid overview.overview_bits.ppid
  1528. #define log1_tid ppli1.ppli1_bits.tid
  1529. #define log1_cid ppli1.ppli1_bits.cid
  1530. #define log2_la ppli2.ppli2_bits.la
  1531. /* Get information on logical to physical processor mappings. */
  1532. static inline s64
  1533. ia64_pal_logical_to_phys(u64 proc_number, pal_logical_to_physical_t *mapping)
  1534. {
  1535. struct ia64_pal_retval iprv;
  1536. PAL_CALL(iprv, PAL_LOGICAL_TO_PHYSICAL, proc_number, 0, 0);
  1537. if (iprv.status == PAL_STATUS_SUCCESS)
  1538. {
  1539. mapping->overview.overview_data = iprv.v0;
  1540. mapping->ppli1.ppli1_data = iprv.v1;
  1541. mapping->ppli2.ppli2_data = iprv.v2;
  1542. }
  1543. return iprv.status;
  1544. }
  1545. typedef struct pal_cache_shared_info_s
  1546. {
  1547. u64 num_shared;
  1548. pal_proc_n_log_info1_t ppli1;
  1549. pal_proc_n_log_info2_t ppli2;
  1550. } pal_cache_shared_info_t;
  1551. /* Get information on logical to physical processor mappings. */
  1552. static inline s64
  1553. ia64_pal_cache_shared_info(u64 level,
  1554. u64 type,
  1555. u64 proc_number,
  1556. pal_cache_shared_info_t *info)
  1557. {
  1558. struct ia64_pal_retval iprv;
  1559. PAL_CALL(iprv, PAL_CACHE_SHARED_INFO, level, type, proc_number);
  1560. if (iprv.status == PAL_STATUS_SUCCESS) {
  1561. info->num_shared = iprv.v0;
  1562. info->ppli1.ppli1_data = iprv.v1;
  1563. info->ppli2.ppli2_data = iprv.v2;
  1564. }
  1565. return iprv.status;
  1566. }
  1567. #endif /* __ASSEMBLY__ */
  1568. #endif /* _ASM_IA64_PAL_H */