pal.h 52 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771
  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 heirarchy */
  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 heirarchy */
  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 heirarchy */
  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 heirarchy */
  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. * heirarchy.
  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. * heirarchy.
  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. typedef struct pal_process_state_info_s {
  321. u64 reserved1 : 2,
  322. rz : 1, /* PAL_CHECK processor
  323. * rendezvous
  324. * successful.
  325. */
  326. ra : 1, /* PAL_CHECK attempted
  327. * a rendezvous.
  328. */
  329. me : 1, /* Distinct multiple
  330. * errors occurred
  331. */
  332. mn : 1, /* Min. state save
  333. * area has been
  334. * registered with PAL
  335. */
  336. sy : 1, /* Storage integrity
  337. * synched
  338. */
  339. co : 1, /* Continuable */
  340. ci : 1, /* MC isolated */
  341. us : 1, /* Uncontained storage
  342. * damage.
  343. */
  344. hd : 1, /* Non-essential hw
  345. * lost (no loss of
  346. * functionality)
  347. * causing the
  348. * processor to run in
  349. * degraded mode.
  350. */
  351. tl : 1, /* 1 => MC occurred
  352. * after an instr was
  353. * executed but before
  354. * the trap that
  355. * resulted from instr
  356. * execution was
  357. * generated.
  358. * (Trap Lost )
  359. */
  360. mi : 1, /* More information available
  361. * call PAL_MC_ERROR_INFO
  362. */
  363. pi : 1, /* Precise instruction pointer */
  364. pm : 1, /* Precise min-state save area */
  365. dy : 1, /* Processor dynamic
  366. * state valid
  367. */
  368. in : 1, /* 0 = MC, 1 = INIT */
  369. rs : 1, /* RSE valid */
  370. cm : 1, /* MC corrected */
  371. ex : 1, /* MC is expected */
  372. cr : 1, /* Control regs valid*/
  373. pc : 1, /* Perf cntrs valid */
  374. dr : 1, /* Debug regs valid */
  375. tr : 1, /* Translation regs
  376. * valid
  377. */
  378. rr : 1, /* Region regs valid */
  379. ar : 1, /* App regs valid */
  380. br : 1, /* Branch regs valid */
  381. pr : 1, /* Predicate registers
  382. * valid
  383. */
  384. fp : 1, /* fp registers valid*/
  385. b1 : 1, /* Preserved bank one
  386. * general registers
  387. * are valid
  388. */
  389. b0 : 1, /* Preserved bank zero
  390. * general registers
  391. * are valid
  392. */
  393. gr : 1, /* General registers
  394. * are valid
  395. * (excl. banked regs)
  396. */
  397. dsize : 16, /* size of dynamic
  398. * state returned
  399. * by the processor
  400. */
  401. se : 1, /* Shared error. MCA in a
  402. shared structure */
  403. reserved2 : 10,
  404. cc : 1, /* Cache check */
  405. tc : 1, /* TLB check */
  406. bc : 1, /* Bus check */
  407. rc : 1, /* Register file check */
  408. uc : 1; /* Uarch check */
  409. } pal_processor_state_info_t;
  410. typedef struct pal_cache_check_info_s {
  411. u64 op : 4, /* Type of cache
  412. * operation that
  413. * caused the machine
  414. * check.
  415. */
  416. level : 2, /* Cache level */
  417. reserved1 : 2,
  418. dl : 1, /* Failure in data part
  419. * of cache line
  420. */
  421. tl : 1, /* Failure in tag part
  422. * of cache line
  423. */
  424. dc : 1, /* Failure in dcache */
  425. ic : 1, /* Failure in icache */
  426. mesi : 3, /* Cache line state */
  427. mv : 1, /* mesi valid */
  428. way : 5, /* Way in which the
  429. * error occurred
  430. */
  431. wiv : 1, /* Way field valid */
  432. reserved2 : 1,
  433. dp : 1, /* Data poisoned on MBE */
  434. reserved3 : 8,
  435. index : 20, /* Cache line index */
  436. reserved4 : 2,
  437. is : 1, /* instruction set (1 == ia32) */
  438. iv : 1, /* instruction set field valid */
  439. pl : 2, /* privilege level */
  440. pv : 1, /* privilege level field valid */
  441. mcc : 1, /* Machine check corrected */
  442. tv : 1, /* Target address
  443. * structure is valid
  444. */
  445. rq : 1, /* Requester identifier
  446. * structure is valid
  447. */
  448. rp : 1, /* Responder identifier
  449. * structure is valid
  450. */
  451. pi : 1; /* Precise instruction pointer
  452. * structure is valid
  453. */
  454. } pal_cache_check_info_t;
  455. typedef struct pal_tlb_check_info_s {
  456. u64 tr_slot : 8, /* Slot# of TR where
  457. * error occurred
  458. */
  459. trv : 1, /* tr_slot field is valid */
  460. reserved1 : 1,
  461. level : 2, /* TLB level where failure occurred */
  462. reserved2 : 4,
  463. dtr : 1, /* Fail in data TR */
  464. itr : 1, /* Fail in inst TR */
  465. dtc : 1, /* Fail in data TC */
  466. itc : 1, /* Fail in inst. TC */
  467. op : 4, /* Cache operation */
  468. reserved3 : 30,
  469. is : 1, /* instruction set (1 == ia32) */
  470. iv : 1, /* instruction set field valid */
  471. pl : 2, /* privilege level */
  472. pv : 1, /* privilege level field valid */
  473. mcc : 1, /* Machine check corrected */
  474. tv : 1, /* Target address
  475. * structure is valid
  476. */
  477. rq : 1, /* Requester identifier
  478. * structure is valid
  479. */
  480. rp : 1, /* Responder identifier
  481. * structure is valid
  482. */
  483. pi : 1; /* Precise instruction pointer
  484. * structure is valid
  485. */
  486. } pal_tlb_check_info_t;
  487. typedef struct pal_bus_check_info_s {
  488. u64 size : 5, /* Xaction size */
  489. ib : 1, /* Internal bus error */
  490. eb : 1, /* External bus error */
  491. cc : 1, /* Error occurred
  492. * during cache-cache
  493. * transfer.
  494. */
  495. type : 8, /* Bus xaction type*/
  496. sev : 5, /* Bus error severity*/
  497. hier : 2, /* Bus hierarchy level */
  498. dp : 1, /* Data poisoned on MBE */
  499. bsi : 8, /* Bus error status
  500. * info
  501. */
  502. reserved2 : 22,
  503. is : 1, /* instruction set (1 == ia32) */
  504. iv : 1, /* instruction set field valid */
  505. pl : 2, /* privilege level */
  506. pv : 1, /* privilege level field valid */
  507. mcc : 1, /* Machine check corrected */
  508. tv : 1, /* Target address
  509. * structure is valid
  510. */
  511. rq : 1, /* Requester identifier
  512. * structure is valid
  513. */
  514. rp : 1, /* Responder identifier
  515. * structure is valid
  516. */
  517. pi : 1; /* Precise instruction pointer
  518. * structure is valid
  519. */
  520. } pal_bus_check_info_t;
  521. typedef struct pal_reg_file_check_info_s {
  522. u64 id : 4, /* Register file identifier */
  523. op : 4, /* Type of register
  524. * operation that
  525. * caused the machine
  526. * check.
  527. */
  528. reg_num : 7, /* Register number */
  529. rnv : 1, /* reg_num valid */
  530. reserved2 : 38,
  531. is : 1, /* instruction set (1 == ia32) */
  532. iv : 1, /* instruction set field valid */
  533. pl : 2, /* privilege level */
  534. pv : 1, /* privilege level field valid */
  535. mcc : 1, /* Machine check corrected */
  536. reserved3 : 3,
  537. pi : 1; /* Precise instruction pointer
  538. * structure is valid
  539. */
  540. } pal_reg_file_check_info_t;
  541. typedef struct pal_uarch_check_info_s {
  542. u64 sid : 5, /* Structure identification */
  543. level : 3, /* Level of failure */
  544. array_id : 4, /* Array identification */
  545. op : 4, /* Type of
  546. * operation that
  547. * caused the machine
  548. * check.
  549. */
  550. way : 6, /* Way of structure */
  551. wv : 1, /* way valid */
  552. xv : 1, /* index valid */
  553. reserved1 : 8,
  554. index : 8, /* Index or set of the uarch
  555. * structure that failed.
  556. */
  557. reserved2 : 24,
  558. is : 1, /* instruction set (1 == ia32) */
  559. iv : 1, /* instruction set field valid */
  560. pl : 2, /* privilege level */
  561. pv : 1, /* privilege level field valid */
  562. mcc : 1, /* Machine check corrected */
  563. tv : 1, /* Target address
  564. * structure is valid
  565. */
  566. rq : 1, /* Requester identifier
  567. * structure is valid
  568. */
  569. rp : 1, /* Responder identifier
  570. * structure is valid
  571. */
  572. pi : 1; /* Precise instruction pointer
  573. * structure is valid
  574. */
  575. } pal_uarch_check_info_t;
  576. typedef union pal_mc_error_info_u {
  577. u64 pmei_data;
  578. pal_processor_state_info_t pme_processor;
  579. pal_cache_check_info_t pme_cache;
  580. pal_tlb_check_info_t pme_tlb;
  581. pal_bus_check_info_t pme_bus;
  582. pal_reg_file_check_info_t pme_reg_file;
  583. pal_uarch_check_info_t pme_uarch;
  584. } pal_mc_error_info_t;
  585. #define pmci_proc_unknown_check pme_processor.uc
  586. #define pmci_proc_bus_check pme_processor.bc
  587. #define pmci_proc_tlb_check pme_processor.tc
  588. #define pmci_proc_cache_check pme_processor.cc
  589. #define pmci_proc_dynamic_state_size pme_processor.dsize
  590. #define pmci_proc_gpr_valid pme_processor.gr
  591. #define pmci_proc_preserved_bank0_gpr_valid pme_processor.b0
  592. #define pmci_proc_preserved_bank1_gpr_valid pme_processor.b1
  593. #define pmci_proc_fp_valid pme_processor.fp
  594. #define pmci_proc_predicate_regs_valid pme_processor.pr
  595. #define pmci_proc_branch_regs_valid pme_processor.br
  596. #define pmci_proc_app_regs_valid pme_processor.ar
  597. #define pmci_proc_region_regs_valid pme_processor.rr
  598. #define pmci_proc_translation_regs_valid pme_processor.tr
  599. #define pmci_proc_debug_regs_valid pme_processor.dr
  600. #define pmci_proc_perf_counters_valid pme_processor.pc
  601. #define pmci_proc_control_regs_valid pme_processor.cr
  602. #define pmci_proc_machine_check_expected pme_processor.ex
  603. #define pmci_proc_machine_check_corrected pme_processor.cm
  604. #define pmci_proc_rse_valid pme_processor.rs
  605. #define pmci_proc_machine_check_or_init pme_processor.in
  606. #define pmci_proc_dynamic_state_valid pme_processor.dy
  607. #define pmci_proc_operation pme_processor.op
  608. #define pmci_proc_trap_lost pme_processor.tl
  609. #define pmci_proc_hardware_damage pme_processor.hd
  610. #define pmci_proc_uncontained_storage_damage pme_processor.us
  611. #define pmci_proc_machine_check_isolated pme_processor.ci
  612. #define pmci_proc_continuable pme_processor.co
  613. #define pmci_proc_storage_intergrity_synced pme_processor.sy
  614. #define pmci_proc_min_state_save_area_regd pme_processor.mn
  615. #define pmci_proc_distinct_multiple_errors pme_processor.me
  616. #define pmci_proc_pal_attempted_rendezvous pme_processor.ra
  617. #define pmci_proc_pal_rendezvous_complete pme_processor.rz
  618. #define pmci_cache_level pme_cache.level
  619. #define pmci_cache_line_state pme_cache.mesi
  620. #define pmci_cache_line_state_valid pme_cache.mv
  621. #define pmci_cache_line_index pme_cache.index
  622. #define pmci_cache_instr_cache_fail pme_cache.ic
  623. #define pmci_cache_data_cache_fail pme_cache.dc
  624. #define pmci_cache_line_tag_fail pme_cache.tl
  625. #define pmci_cache_line_data_fail pme_cache.dl
  626. #define pmci_cache_operation pme_cache.op
  627. #define pmci_cache_way_valid pme_cache.wv
  628. #define pmci_cache_target_address_valid pme_cache.tv
  629. #define pmci_cache_way pme_cache.way
  630. #define pmci_cache_mc pme_cache.mc
  631. #define pmci_tlb_instr_translation_cache_fail pme_tlb.itc
  632. #define pmci_tlb_data_translation_cache_fail pme_tlb.dtc
  633. #define pmci_tlb_instr_translation_reg_fail pme_tlb.itr
  634. #define pmci_tlb_data_translation_reg_fail pme_tlb.dtr
  635. #define pmci_tlb_translation_reg_slot pme_tlb.tr_slot
  636. #define pmci_tlb_mc pme_tlb.mc
  637. #define pmci_bus_status_info pme_bus.bsi
  638. #define pmci_bus_req_address_valid pme_bus.rq
  639. #define pmci_bus_resp_address_valid pme_bus.rp
  640. #define pmci_bus_target_address_valid pme_bus.tv
  641. #define pmci_bus_error_severity pme_bus.sev
  642. #define pmci_bus_transaction_type pme_bus.type
  643. #define pmci_bus_cache_cache_transfer pme_bus.cc
  644. #define pmci_bus_transaction_size pme_bus.size
  645. #define pmci_bus_internal_error pme_bus.ib
  646. #define pmci_bus_external_error pme_bus.eb
  647. #define pmci_bus_mc pme_bus.mc
  648. /*
  649. * NOTE: this min_state_save area struct only includes the 1KB
  650. * architectural state save area. The other 3 KB is scratch space
  651. * for PAL.
  652. */
  653. typedef struct pal_min_state_area_s {
  654. u64 pmsa_nat_bits; /* nat bits for saved GRs */
  655. u64 pmsa_gr[15]; /* GR1 - GR15 */
  656. u64 pmsa_bank0_gr[16]; /* GR16 - GR31 */
  657. u64 pmsa_bank1_gr[16]; /* GR16 - GR31 */
  658. u64 pmsa_pr; /* predicate registers */
  659. u64 pmsa_br0; /* branch register 0 */
  660. u64 pmsa_rsc; /* ar.rsc */
  661. u64 pmsa_iip; /* cr.iip */
  662. u64 pmsa_ipsr; /* cr.ipsr */
  663. u64 pmsa_ifs; /* cr.ifs */
  664. u64 pmsa_xip; /* previous iip */
  665. u64 pmsa_xpsr; /* previous psr */
  666. u64 pmsa_xfs; /* previous ifs */
  667. u64 pmsa_br1; /* branch register 1 */
  668. u64 pmsa_reserved[70]; /* pal_min_state_area should total to 1KB */
  669. } pal_min_state_area_t;
  670. struct ia64_pal_retval {
  671. /*
  672. * A zero status value indicates call completed without error.
  673. * A negative status value indicates reason of call failure.
  674. * A positive status value indicates success but an
  675. * informational value should be printed (e.g., "reboot for
  676. * change to take effect").
  677. */
  678. s64 status;
  679. u64 v0;
  680. u64 v1;
  681. u64 v2;
  682. };
  683. /*
  684. * Note: Currently unused PAL arguments are generally labeled
  685. * "reserved" so the value specified in the PAL documentation
  686. * (generally 0) MUST be passed. Reserved parameters are not optional
  687. * parameters.
  688. */
  689. extern struct ia64_pal_retval ia64_pal_call_static (u64, u64, u64, u64);
  690. extern struct ia64_pal_retval ia64_pal_call_stacked (u64, u64, u64, u64);
  691. extern struct ia64_pal_retval ia64_pal_call_phys_static (u64, u64, u64, u64);
  692. extern struct ia64_pal_retval ia64_pal_call_phys_stacked (u64, u64, u64, u64);
  693. extern void ia64_save_scratch_fpregs (struct ia64_fpreg *);
  694. extern void ia64_load_scratch_fpregs (struct ia64_fpreg *);
  695. #define PAL_CALL(iprv,a0,a1,a2,a3) do { \
  696. struct ia64_fpreg fr[6]; \
  697. ia64_save_scratch_fpregs(fr); \
  698. iprv = ia64_pal_call_static(a0, a1, a2, a3); \
  699. ia64_load_scratch_fpregs(fr); \
  700. } while (0)
  701. #define PAL_CALL_STK(iprv,a0,a1,a2,a3) do { \
  702. struct ia64_fpreg fr[6]; \
  703. ia64_save_scratch_fpregs(fr); \
  704. iprv = ia64_pal_call_stacked(a0, a1, a2, a3); \
  705. ia64_load_scratch_fpregs(fr); \
  706. } while (0)
  707. #define PAL_CALL_PHYS(iprv,a0,a1,a2,a3) do { \
  708. struct ia64_fpreg fr[6]; \
  709. ia64_save_scratch_fpregs(fr); \
  710. iprv = ia64_pal_call_phys_static(a0, a1, a2, a3); \
  711. ia64_load_scratch_fpregs(fr); \
  712. } while (0)
  713. #define PAL_CALL_PHYS_STK(iprv,a0,a1,a2,a3) do { \
  714. struct ia64_fpreg fr[6]; \
  715. ia64_save_scratch_fpregs(fr); \
  716. iprv = ia64_pal_call_phys_stacked(a0, a1, a2, a3); \
  717. ia64_load_scratch_fpregs(fr); \
  718. } while (0)
  719. typedef int (*ia64_pal_handler) (u64, ...);
  720. extern ia64_pal_handler ia64_pal;
  721. extern void ia64_pal_handler_init (void *);
  722. extern ia64_pal_handler ia64_pal;
  723. extern pal_cache_config_info_t l0d_cache_config_info;
  724. extern pal_cache_config_info_t l0i_cache_config_info;
  725. extern pal_cache_config_info_t l1_cache_config_info;
  726. extern pal_cache_config_info_t l2_cache_config_info;
  727. extern pal_cache_protection_info_t l0d_cache_protection_info;
  728. extern pal_cache_protection_info_t l0i_cache_protection_info;
  729. extern pal_cache_protection_info_t l1_cache_protection_info;
  730. extern pal_cache_protection_info_t l2_cache_protection_info;
  731. extern pal_cache_config_info_t pal_cache_config_info_get(pal_cache_level_t,
  732. pal_cache_type_t);
  733. extern pal_cache_protection_info_t pal_cache_protection_info_get(pal_cache_level_t,
  734. pal_cache_type_t);
  735. extern void pal_error(int);
  736. /* Useful wrappers for the current list of pal procedures */
  737. typedef union pal_bus_features_u {
  738. u64 pal_bus_features_val;
  739. struct {
  740. u64 pbf_reserved1 : 29;
  741. u64 pbf_req_bus_parking : 1;
  742. u64 pbf_bus_lock_mask : 1;
  743. u64 pbf_enable_half_xfer_rate : 1;
  744. u64 pbf_reserved2 : 20;
  745. u64 pbf_enable_shared_line_replace : 1;
  746. u64 pbf_enable_exclusive_line_replace : 1;
  747. u64 pbf_disable_xaction_queueing : 1;
  748. u64 pbf_disable_resp_err_check : 1;
  749. u64 pbf_disable_berr_check : 1;
  750. u64 pbf_disable_bus_req_internal_err_signal : 1;
  751. u64 pbf_disable_bus_req_berr_signal : 1;
  752. u64 pbf_disable_bus_init_event_check : 1;
  753. u64 pbf_disable_bus_init_event_signal : 1;
  754. u64 pbf_disable_bus_addr_err_check : 1;
  755. u64 pbf_disable_bus_addr_err_signal : 1;
  756. u64 pbf_disable_bus_data_err_check : 1;
  757. } pal_bus_features_s;
  758. } pal_bus_features_u_t;
  759. extern void pal_bus_features_print (u64);
  760. /* Provide information about configurable processor bus features */
  761. static inline s64
  762. ia64_pal_bus_get_features (pal_bus_features_u_t *features_avail,
  763. pal_bus_features_u_t *features_status,
  764. pal_bus_features_u_t *features_control)
  765. {
  766. struct ia64_pal_retval iprv;
  767. PAL_CALL_PHYS(iprv, PAL_BUS_GET_FEATURES, 0, 0, 0);
  768. if (features_avail)
  769. features_avail->pal_bus_features_val = iprv.v0;
  770. if (features_status)
  771. features_status->pal_bus_features_val = iprv.v1;
  772. if (features_control)
  773. features_control->pal_bus_features_val = iprv.v2;
  774. return iprv.status;
  775. }
  776. /* Enables/disables specific processor bus features */
  777. static inline s64
  778. ia64_pal_bus_set_features (pal_bus_features_u_t feature_select)
  779. {
  780. struct ia64_pal_retval iprv;
  781. PAL_CALL_PHYS(iprv, PAL_BUS_SET_FEATURES, feature_select.pal_bus_features_val, 0, 0);
  782. return iprv.status;
  783. }
  784. /* Get detailed cache information */
  785. static inline s64
  786. ia64_pal_cache_config_info (u64 cache_level, u64 cache_type, pal_cache_config_info_t *conf)
  787. {
  788. struct ia64_pal_retval iprv;
  789. PAL_CALL(iprv, PAL_CACHE_INFO, cache_level, cache_type, 0);
  790. if (iprv.status == 0) {
  791. conf->pcci_status = iprv.status;
  792. conf->pcci_info_1.pcci1_data = iprv.v0;
  793. conf->pcci_info_2.pcci2_data = iprv.v1;
  794. conf->pcci_reserved = iprv.v2;
  795. }
  796. return iprv.status;
  797. }
  798. /* Get detailed cche protection information */
  799. static inline s64
  800. ia64_pal_cache_prot_info (u64 cache_level, u64 cache_type, pal_cache_protection_info_t *prot)
  801. {
  802. struct ia64_pal_retval iprv;
  803. PAL_CALL(iprv, PAL_CACHE_PROT_INFO, cache_level, cache_type, 0);
  804. if (iprv.status == 0) {
  805. prot->pcpi_status = iprv.status;
  806. prot->pcp_info[0].pcpi_data = iprv.v0 & 0xffffffff;
  807. prot->pcp_info[1].pcpi_data = iprv.v0 >> 32;
  808. prot->pcp_info[2].pcpi_data = iprv.v1 & 0xffffffff;
  809. prot->pcp_info[3].pcpi_data = iprv.v1 >> 32;
  810. prot->pcp_info[4].pcpi_data = iprv.v2 & 0xffffffff;
  811. prot->pcp_info[5].pcpi_data = iprv.v2 >> 32;
  812. }
  813. return iprv.status;
  814. }
  815. /*
  816. * Flush the processor instruction or data caches. *PROGRESS must be
  817. * initialized to zero before calling this for the first time..
  818. */
  819. static inline s64
  820. ia64_pal_cache_flush (u64 cache_type, u64 invalidate, u64 *progress, u64 *vector)
  821. {
  822. struct ia64_pal_retval iprv;
  823. PAL_CALL(iprv, PAL_CACHE_FLUSH, cache_type, invalidate, *progress);
  824. if (vector)
  825. *vector = iprv.v0;
  826. *progress = iprv.v1;
  827. return iprv.status;
  828. }
  829. /* Initialize the processor controlled caches */
  830. static inline s64
  831. ia64_pal_cache_init (u64 level, u64 cache_type, u64 rest)
  832. {
  833. struct ia64_pal_retval iprv;
  834. PAL_CALL(iprv, PAL_CACHE_INIT, level, cache_type, rest);
  835. return iprv.status;
  836. }
  837. /* Initialize the tags and data of a data or unified cache line of
  838. * processor controlled cache to known values without the availability
  839. * of backing memory.
  840. */
  841. static inline s64
  842. ia64_pal_cache_line_init (u64 physical_addr, u64 data_value)
  843. {
  844. struct ia64_pal_retval iprv;
  845. PAL_CALL(iprv, PAL_CACHE_LINE_INIT, physical_addr, data_value, 0);
  846. return iprv.status;
  847. }
  848. /* Read the data and tag of a processor controlled cache line for diags */
  849. static inline s64
  850. ia64_pal_cache_read (pal_cache_line_id_u_t line_id, u64 physical_addr)
  851. {
  852. struct ia64_pal_retval iprv;
  853. PAL_CALL_PHYS_STK(iprv, PAL_CACHE_READ, line_id.pclid_data,
  854. physical_addr, 0);
  855. return iprv.status;
  856. }
  857. /* Return summary information about the heirarchy of caches controlled by the processor */
  858. static inline s64
  859. ia64_pal_cache_summary (u64 *cache_levels, u64 *unique_caches)
  860. {
  861. struct ia64_pal_retval iprv;
  862. PAL_CALL(iprv, PAL_CACHE_SUMMARY, 0, 0, 0);
  863. if (cache_levels)
  864. *cache_levels = iprv.v0;
  865. if (unique_caches)
  866. *unique_caches = iprv.v1;
  867. return iprv.status;
  868. }
  869. /* Write the data and tag of a processor-controlled cache line for diags */
  870. static inline s64
  871. ia64_pal_cache_write (pal_cache_line_id_u_t line_id, u64 physical_addr, u64 data)
  872. {
  873. struct ia64_pal_retval iprv;
  874. PAL_CALL_PHYS_STK(iprv, PAL_CACHE_WRITE, line_id.pclid_data,
  875. physical_addr, data);
  876. return iprv.status;
  877. }
  878. /* Return the parameters needed to copy relocatable PAL procedures from ROM to memory */
  879. static inline s64
  880. ia64_pal_copy_info (u64 copy_type, u64 num_procs, u64 num_iopics,
  881. u64 *buffer_size, u64 *buffer_align)
  882. {
  883. struct ia64_pal_retval iprv;
  884. PAL_CALL(iprv, PAL_COPY_INFO, copy_type, num_procs, num_iopics);
  885. if (buffer_size)
  886. *buffer_size = iprv.v0;
  887. if (buffer_align)
  888. *buffer_align = iprv.v1;
  889. return iprv.status;
  890. }
  891. /* Copy relocatable PAL procedures from ROM to memory */
  892. static inline s64
  893. ia64_pal_copy_pal (u64 target_addr, u64 alloc_size, u64 processor, u64 *pal_proc_offset)
  894. {
  895. struct ia64_pal_retval iprv;
  896. PAL_CALL(iprv, PAL_COPY_PAL, target_addr, alloc_size, processor);
  897. if (pal_proc_offset)
  898. *pal_proc_offset = iprv.v0;
  899. return iprv.status;
  900. }
  901. /* Return the number of instruction and data debug register pairs */
  902. static inline s64
  903. ia64_pal_debug_info (u64 *inst_regs, u64 *data_regs)
  904. {
  905. struct ia64_pal_retval iprv;
  906. PAL_CALL(iprv, PAL_DEBUG_INFO, 0, 0, 0);
  907. if (inst_regs)
  908. *inst_regs = iprv.v0;
  909. if (data_regs)
  910. *data_regs = iprv.v1;
  911. return iprv.status;
  912. }
  913. #ifdef TBD
  914. /* Switch from IA64-system environment to IA-32 system environment */
  915. static inline s64
  916. ia64_pal_enter_ia32_env (ia32_env1, ia32_env2, ia32_env3)
  917. {
  918. struct ia64_pal_retval iprv;
  919. PAL_CALL(iprv, PAL_ENTER_IA_32_ENV, ia32_env1, ia32_env2, ia32_env3);
  920. return iprv.status;
  921. }
  922. #endif
  923. /* Get unique geographical address of this processor on its bus */
  924. static inline s64
  925. ia64_pal_fixed_addr (u64 *global_unique_addr)
  926. {
  927. struct ia64_pal_retval iprv;
  928. PAL_CALL(iprv, PAL_FIXED_ADDR, 0, 0, 0);
  929. if (global_unique_addr)
  930. *global_unique_addr = iprv.v0;
  931. return iprv.status;
  932. }
  933. /* Get base frequency of the platform if generated by the processor */
  934. static inline s64
  935. ia64_pal_freq_base (u64 *platform_base_freq)
  936. {
  937. struct ia64_pal_retval iprv;
  938. PAL_CALL(iprv, PAL_FREQ_BASE, 0, 0, 0);
  939. if (platform_base_freq)
  940. *platform_base_freq = iprv.v0;
  941. return iprv.status;
  942. }
  943. /*
  944. * Get the ratios for processor frequency, bus frequency and interval timer to
  945. * to base frequency of the platform
  946. */
  947. static inline s64
  948. ia64_pal_freq_ratios (struct pal_freq_ratio *proc_ratio, struct pal_freq_ratio *bus_ratio,
  949. struct pal_freq_ratio *itc_ratio)
  950. {
  951. struct ia64_pal_retval iprv;
  952. PAL_CALL(iprv, PAL_FREQ_RATIOS, 0, 0, 0);
  953. if (proc_ratio)
  954. *(u64 *)proc_ratio = iprv.v0;
  955. if (bus_ratio)
  956. *(u64 *)bus_ratio = iprv.v1;
  957. if (itc_ratio)
  958. *(u64 *)itc_ratio = iprv.v2;
  959. return iprv.status;
  960. }
  961. /*
  962. * Get the current hardware resource sharing policy of the processor
  963. */
  964. static inline s64
  965. ia64_pal_get_hw_policy (u64 proc_num, u64 *cur_policy, u64 *num_impacted,
  966. u64 *la)
  967. {
  968. struct ia64_pal_retval iprv;
  969. PAL_CALL(iprv, PAL_GET_HW_POLICY, proc_num, 0, 0);
  970. if (cur_policy)
  971. *cur_policy = iprv.v0;
  972. if (num_impacted)
  973. *num_impacted = iprv.v1;
  974. if (la)
  975. *la = iprv.v2;
  976. return iprv.status;
  977. }
  978. /* Make the processor enter HALT or one of the implementation dependent low
  979. * power states where prefetching and execution are suspended and cache and
  980. * TLB coherency is not maintained.
  981. */
  982. static inline s64
  983. ia64_pal_halt (u64 halt_state)
  984. {
  985. struct ia64_pal_retval iprv;
  986. PAL_CALL(iprv, PAL_HALT, halt_state, 0, 0);
  987. return iprv.status;
  988. }
  989. typedef union pal_power_mgmt_info_u {
  990. u64 ppmi_data;
  991. struct {
  992. u64 exit_latency : 16,
  993. entry_latency : 16,
  994. power_consumption : 28,
  995. im : 1,
  996. co : 1,
  997. reserved : 2;
  998. } pal_power_mgmt_info_s;
  999. } pal_power_mgmt_info_u_t;
  1000. /* Return information about processor's optional power management capabilities. */
  1001. static inline s64
  1002. ia64_pal_halt_info (pal_power_mgmt_info_u_t *power_buf)
  1003. {
  1004. struct ia64_pal_retval iprv;
  1005. PAL_CALL_STK(iprv, PAL_HALT_INFO, (unsigned long) power_buf, 0, 0);
  1006. return iprv.status;
  1007. }
  1008. /* Get the current P-state information */
  1009. static inline s64
  1010. ia64_pal_get_pstate (u64 *pstate_index, unsigned long type)
  1011. {
  1012. struct ia64_pal_retval iprv;
  1013. PAL_CALL_STK(iprv, PAL_GET_PSTATE, type, 0, 0);
  1014. *pstate_index = iprv.v0;
  1015. return iprv.status;
  1016. }
  1017. /* Set the P-state */
  1018. static inline s64
  1019. ia64_pal_set_pstate (u64 pstate_index)
  1020. {
  1021. struct ia64_pal_retval iprv;
  1022. PAL_CALL_STK(iprv, PAL_SET_PSTATE, pstate_index, 0, 0);
  1023. return iprv.status;
  1024. }
  1025. /* Processor branding information*/
  1026. static inline s64
  1027. ia64_pal_get_brand_info (char *brand_info)
  1028. {
  1029. struct ia64_pal_retval iprv;
  1030. PAL_CALL_STK(iprv, PAL_BRAND_INFO, 0, (u64)brand_info, 0);
  1031. return iprv.status;
  1032. }
  1033. /* Cause the processor to enter LIGHT HALT state, where prefetching and execution are
  1034. * suspended, but cache and TLB coherency is maintained.
  1035. */
  1036. static inline s64
  1037. ia64_pal_halt_light (void)
  1038. {
  1039. struct ia64_pal_retval iprv;
  1040. PAL_CALL(iprv, PAL_HALT_LIGHT, 0, 0, 0);
  1041. return iprv.status;
  1042. }
  1043. /* Clear all the processor error logging registers and reset the indicator that allows
  1044. * the error logging registers to be written. This procedure also checks the pending
  1045. * machine check bit and pending INIT bit and reports their states.
  1046. */
  1047. static inline s64
  1048. ia64_pal_mc_clear_log (u64 *pending_vector)
  1049. {
  1050. struct ia64_pal_retval iprv;
  1051. PAL_CALL(iprv, PAL_MC_CLEAR_LOG, 0, 0, 0);
  1052. if (pending_vector)
  1053. *pending_vector = iprv.v0;
  1054. return iprv.status;
  1055. }
  1056. /* Ensure that all outstanding transactions in a processor are completed or that any
  1057. * MCA due to thes outstanding transaction is taken.
  1058. */
  1059. static inline s64
  1060. ia64_pal_mc_drain (void)
  1061. {
  1062. struct ia64_pal_retval iprv;
  1063. PAL_CALL(iprv, PAL_MC_DRAIN, 0, 0, 0);
  1064. return iprv.status;
  1065. }
  1066. /* Return the machine check dynamic processor state */
  1067. static inline s64
  1068. ia64_pal_mc_dynamic_state (u64 offset, u64 *size, u64 *pds)
  1069. {
  1070. struct ia64_pal_retval iprv;
  1071. PAL_CALL(iprv, PAL_MC_DYNAMIC_STATE, offset, 0, 0);
  1072. if (size)
  1073. *size = iprv.v0;
  1074. if (pds)
  1075. *pds = iprv.v1;
  1076. return iprv.status;
  1077. }
  1078. /* Return processor machine check information */
  1079. static inline s64
  1080. ia64_pal_mc_error_info (u64 info_index, u64 type_index, u64 *size, u64 *error_info)
  1081. {
  1082. struct ia64_pal_retval iprv;
  1083. PAL_CALL(iprv, PAL_MC_ERROR_INFO, info_index, type_index, 0);
  1084. if (size)
  1085. *size = iprv.v0;
  1086. if (error_info)
  1087. *error_info = iprv.v1;
  1088. return iprv.status;
  1089. }
  1090. /* Injects the requested processor error or returns info on
  1091. * supported injection capabilities for current processor implementation
  1092. */
  1093. static inline s64
  1094. ia64_pal_mc_error_inject_phys (u64 err_type_info, u64 err_struct_info,
  1095. u64 err_data_buffer, u64 *capabilities, u64 *resources)
  1096. {
  1097. struct ia64_pal_retval iprv;
  1098. PAL_CALL_PHYS_STK(iprv, PAL_MC_ERROR_INJECT, err_type_info,
  1099. err_struct_info, err_data_buffer);
  1100. if (capabilities)
  1101. *capabilities= iprv.v0;
  1102. if (resources)
  1103. *resources= iprv.v1;
  1104. return iprv.status;
  1105. }
  1106. static inline s64
  1107. ia64_pal_mc_error_inject_virt (u64 err_type_info, u64 err_struct_info,
  1108. u64 err_data_buffer, u64 *capabilities, u64 *resources)
  1109. {
  1110. struct ia64_pal_retval iprv;
  1111. PAL_CALL_STK(iprv, PAL_MC_ERROR_INJECT, err_type_info,
  1112. err_struct_info, err_data_buffer);
  1113. if (capabilities)
  1114. *capabilities= iprv.v0;
  1115. if (resources)
  1116. *resources= iprv.v1;
  1117. return iprv.status;
  1118. }
  1119. /* Inform PALE_CHECK whether a machine check is expected so that PALE_CHECK willnot
  1120. * attempt to correct any expected machine checks.
  1121. */
  1122. static inline s64
  1123. ia64_pal_mc_expected (u64 expected, u64 *previous)
  1124. {
  1125. struct ia64_pal_retval iprv;
  1126. PAL_CALL(iprv, PAL_MC_EXPECTED, expected, 0, 0);
  1127. if (previous)
  1128. *previous = iprv.v0;
  1129. return iprv.status;
  1130. }
  1131. /* Register a platform dependent location with PAL to which it can save
  1132. * minimal processor state in the event of a machine check or initialization
  1133. * event.
  1134. */
  1135. static inline s64
  1136. ia64_pal_mc_register_mem (u64 physical_addr)
  1137. {
  1138. struct ia64_pal_retval iprv;
  1139. PAL_CALL(iprv, PAL_MC_REGISTER_MEM, physical_addr, 0, 0);
  1140. return iprv.status;
  1141. }
  1142. /* Restore minimal architectural processor state, set CMC interrupt if necessary
  1143. * and resume execution
  1144. */
  1145. static inline s64
  1146. ia64_pal_mc_resume (u64 set_cmci, u64 save_ptr)
  1147. {
  1148. struct ia64_pal_retval iprv;
  1149. PAL_CALL(iprv, PAL_MC_RESUME, set_cmci, save_ptr, 0);
  1150. return iprv.status;
  1151. }
  1152. /* Return the memory attributes implemented by the processor */
  1153. static inline s64
  1154. ia64_pal_mem_attrib (u64 *mem_attrib)
  1155. {
  1156. struct ia64_pal_retval iprv;
  1157. PAL_CALL(iprv, PAL_MEM_ATTRIB, 0, 0, 0);
  1158. if (mem_attrib)
  1159. *mem_attrib = iprv.v0 & 0xff;
  1160. return iprv.status;
  1161. }
  1162. /* Return the amount of memory needed for second phase of processor
  1163. * self-test and the required alignment of memory.
  1164. */
  1165. static inline s64
  1166. ia64_pal_mem_for_test (u64 *bytes_needed, u64 *alignment)
  1167. {
  1168. struct ia64_pal_retval iprv;
  1169. PAL_CALL(iprv, PAL_MEM_FOR_TEST, 0, 0, 0);
  1170. if (bytes_needed)
  1171. *bytes_needed = iprv.v0;
  1172. if (alignment)
  1173. *alignment = iprv.v1;
  1174. return iprv.status;
  1175. }
  1176. typedef union pal_perf_mon_info_u {
  1177. u64 ppmi_data;
  1178. struct {
  1179. u64 generic : 8,
  1180. width : 8,
  1181. cycles : 8,
  1182. retired : 8,
  1183. reserved : 32;
  1184. } pal_perf_mon_info_s;
  1185. } pal_perf_mon_info_u_t;
  1186. /* Return the performance monitor information about what can be counted
  1187. * and how to configure the monitors to count the desired events.
  1188. */
  1189. static inline s64
  1190. ia64_pal_perf_mon_info (u64 *pm_buffer, pal_perf_mon_info_u_t *pm_info)
  1191. {
  1192. struct ia64_pal_retval iprv;
  1193. PAL_CALL(iprv, PAL_PERF_MON_INFO, (unsigned long) pm_buffer, 0, 0);
  1194. if (pm_info)
  1195. pm_info->ppmi_data = iprv.v0;
  1196. return iprv.status;
  1197. }
  1198. /* Specifies the physical address of the processor interrupt block
  1199. * and I/O port space.
  1200. */
  1201. static inline s64
  1202. ia64_pal_platform_addr (u64 type, u64 physical_addr)
  1203. {
  1204. struct ia64_pal_retval iprv;
  1205. PAL_CALL(iprv, PAL_PLATFORM_ADDR, type, physical_addr, 0);
  1206. return iprv.status;
  1207. }
  1208. /* Set the SAL PMI entrypoint in memory */
  1209. static inline s64
  1210. ia64_pal_pmi_entrypoint (u64 sal_pmi_entry_addr)
  1211. {
  1212. struct ia64_pal_retval iprv;
  1213. PAL_CALL(iprv, PAL_PMI_ENTRYPOINT, sal_pmi_entry_addr, 0, 0);
  1214. return iprv.status;
  1215. }
  1216. struct pal_features_s;
  1217. /* Provide information about configurable processor features */
  1218. static inline s64
  1219. ia64_pal_proc_get_features (u64 *features_avail,
  1220. u64 *features_status,
  1221. u64 *features_control)
  1222. {
  1223. struct ia64_pal_retval iprv;
  1224. PAL_CALL_PHYS(iprv, PAL_PROC_GET_FEATURES, 0, 0, 0);
  1225. if (iprv.status == 0) {
  1226. *features_avail = iprv.v0;
  1227. *features_status = iprv.v1;
  1228. *features_control = iprv.v2;
  1229. }
  1230. return iprv.status;
  1231. }
  1232. /* Enable/disable processor dependent features */
  1233. static inline s64
  1234. ia64_pal_proc_set_features (u64 feature_select)
  1235. {
  1236. struct ia64_pal_retval iprv;
  1237. PAL_CALL_PHYS(iprv, PAL_PROC_SET_FEATURES, feature_select, 0, 0);
  1238. return iprv.status;
  1239. }
  1240. /*
  1241. * Put everything in a struct so we avoid the global offset table whenever
  1242. * possible.
  1243. */
  1244. typedef struct ia64_ptce_info_s {
  1245. u64 base;
  1246. u32 count[2];
  1247. u32 stride[2];
  1248. } ia64_ptce_info_t;
  1249. /* Return the information required for the architected loop used to purge
  1250. * (initialize) the entire TC
  1251. */
  1252. static inline s64
  1253. ia64_get_ptce (ia64_ptce_info_t *ptce)
  1254. {
  1255. struct ia64_pal_retval iprv;
  1256. if (!ptce)
  1257. return -1;
  1258. PAL_CALL(iprv, PAL_PTCE_INFO, 0, 0, 0);
  1259. if (iprv.status == 0) {
  1260. ptce->base = iprv.v0;
  1261. ptce->count[0] = iprv.v1 >> 32;
  1262. ptce->count[1] = iprv.v1 & 0xffffffff;
  1263. ptce->stride[0] = iprv.v2 >> 32;
  1264. ptce->stride[1] = iprv.v2 & 0xffffffff;
  1265. }
  1266. return iprv.status;
  1267. }
  1268. /* Return info about implemented application and control registers. */
  1269. static inline s64
  1270. ia64_pal_register_info (u64 info_request, u64 *reg_info_1, u64 *reg_info_2)
  1271. {
  1272. struct ia64_pal_retval iprv;
  1273. PAL_CALL(iprv, PAL_REGISTER_INFO, info_request, 0, 0);
  1274. if (reg_info_1)
  1275. *reg_info_1 = iprv.v0;
  1276. if (reg_info_2)
  1277. *reg_info_2 = iprv.v1;
  1278. return iprv.status;
  1279. }
  1280. typedef union pal_hints_u {
  1281. u64 ph_data;
  1282. struct {
  1283. u64 si : 1,
  1284. li : 1,
  1285. reserved : 62;
  1286. } pal_hints_s;
  1287. } pal_hints_u_t;
  1288. /* Return information about the register stack and RSE for this processor
  1289. * implementation.
  1290. */
  1291. static inline s64
  1292. ia64_pal_rse_info (u64 *num_phys_stacked, pal_hints_u_t *hints)
  1293. {
  1294. struct ia64_pal_retval iprv;
  1295. PAL_CALL(iprv, PAL_RSE_INFO, 0, 0, 0);
  1296. if (num_phys_stacked)
  1297. *num_phys_stacked = iprv.v0;
  1298. if (hints)
  1299. hints->ph_data = iprv.v1;
  1300. return iprv.status;
  1301. }
  1302. /*
  1303. * Set the current hardware resource sharing policy of the processor
  1304. */
  1305. static inline s64
  1306. ia64_pal_set_hw_policy (u64 policy)
  1307. {
  1308. struct ia64_pal_retval iprv;
  1309. PAL_CALL(iprv, PAL_SET_HW_POLICY, policy, 0, 0);
  1310. return iprv.status;
  1311. }
  1312. /* Cause the processor to enter SHUTDOWN state, where prefetching and execution are
  1313. * suspended, but cause cache and TLB coherency to be maintained.
  1314. * This is usually called in IA-32 mode.
  1315. */
  1316. static inline s64
  1317. ia64_pal_shutdown (void)
  1318. {
  1319. struct ia64_pal_retval iprv;
  1320. PAL_CALL(iprv, PAL_SHUTDOWN, 0, 0, 0);
  1321. return iprv.status;
  1322. }
  1323. /* Perform the second phase of processor self-test. */
  1324. static inline s64
  1325. ia64_pal_test_proc (u64 test_addr, u64 test_size, u64 attributes, u64 *self_test_state)
  1326. {
  1327. struct ia64_pal_retval iprv;
  1328. PAL_CALL(iprv, PAL_TEST_PROC, test_addr, test_size, attributes);
  1329. if (self_test_state)
  1330. *self_test_state = iprv.v0;
  1331. return iprv.status;
  1332. }
  1333. typedef union pal_version_u {
  1334. u64 pal_version_val;
  1335. struct {
  1336. u64 pv_pal_b_rev : 8;
  1337. u64 pv_pal_b_model : 8;
  1338. u64 pv_reserved1 : 8;
  1339. u64 pv_pal_vendor : 8;
  1340. u64 pv_pal_a_rev : 8;
  1341. u64 pv_pal_a_model : 8;
  1342. u64 pv_reserved2 : 16;
  1343. } pal_version_s;
  1344. } pal_version_u_t;
  1345. /*
  1346. * Return PAL version information. While the documentation states that
  1347. * PAL_VERSION can be called in either physical or virtual mode, some
  1348. * implementations only allow physical calls. We don't call it very often,
  1349. * so the overhead isn't worth eliminating.
  1350. */
  1351. static inline s64
  1352. ia64_pal_version (pal_version_u_t *pal_min_version, pal_version_u_t *pal_cur_version)
  1353. {
  1354. struct ia64_pal_retval iprv;
  1355. PAL_CALL_PHYS(iprv, PAL_VERSION, 0, 0, 0);
  1356. if (pal_min_version)
  1357. pal_min_version->pal_version_val = iprv.v0;
  1358. if (pal_cur_version)
  1359. pal_cur_version->pal_version_val = iprv.v1;
  1360. return iprv.status;
  1361. }
  1362. typedef union pal_tc_info_u {
  1363. u64 pti_val;
  1364. struct {
  1365. u64 num_sets : 8,
  1366. associativity : 8,
  1367. num_entries : 16,
  1368. pf : 1,
  1369. unified : 1,
  1370. reduce_tr : 1,
  1371. reserved : 29;
  1372. } pal_tc_info_s;
  1373. } pal_tc_info_u_t;
  1374. #define tc_reduce_tr pal_tc_info_s.reduce_tr
  1375. #define tc_unified pal_tc_info_s.unified
  1376. #define tc_pf pal_tc_info_s.pf
  1377. #define tc_num_entries pal_tc_info_s.num_entries
  1378. #define tc_associativity pal_tc_info_s.associativity
  1379. #define tc_num_sets pal_tc_info_s.num_sets
  1380. /* Return information about the virtual memory characteristics of the processor
  1381. * implementation.
  1382. */
  1383. static inline s64
  1384. ia64_pal_vm_info (u64 tc_level, u64 tc_type, pal_tc_info_u_t *tc_info, u64 *tc_pages)
  1385. {
  1386. struct ia64_pal_retval iprv;
  1387. PAL_CALL(iprv, PAL_VM_INFO, tc_level, tc_type, 0);
  1388. if (tc_info)
  1389. tc_info->pti_val = iprv.v0;
  1390. if (tc_pages)
  1391. *tc_pages = iprv.v1;
  1392. return iprv.status;
  1393. }
  1394. /* Get page size information about the virtual memory characteristics of the processor
  1395. * implementation.
  1396. */
  1397. static inline s64
  1398. ia64_pal_vm_page_size (u64 *tr_pages, u64 *vw_pages)
  1399. {
  1400. struct ia64_pal_retval iprv;
  1401. PAL_CALL(iprv, PAL_VM_PAGE_SIZE, 0, 0, 0);
  1402. if (tr_pages)
  1403. *tr_pages = iprv.v0;
  1404. if (vw_pages)
  1405. *vw_pages = iprv.v1;
  1406. return iprv.status;
  1407. }
  1408. typedef union pal_vm_info_1_u {
  1409. u64 pvi1_val;
  1410. struct {
  1411. u64 vw : 1,
  1412. phys_add_size : 7,
  1413. key_size : 8,
  1414. max_pkr : 8,
  1415. hash_tag_id : 8,
  1416. max_dtr_entry : 8,
  1417. max_itr_entry : 8,
  1418. max_unique_tcs : 8,
  1419. num_tc_levels : 8;
  1420. } pal_vm_info_1_s;
  1421. } pal_vm_info_1_u_t;
  1422. #define PAL_MAX_PURGES 0xFFFF /* all ones is means unlimited */
  1423. typedef union pal_vm_info_2_u {
  1424. u64 pvi2_val;
  1425. struct {
  1426. u64 impl_va_msb : 8,
  1427. rid_size : 8,
  1428. max_purges : 16,
  1429. reserved : 32;
  1430. } pal_vm_info_2_s;
  1431. } pal_vm_info_2_u_t;
  1432. /* Get summary information about the virtual memory characteristics of the processor
  1433. * implementation.
  1434. */
  1435. static inline s64
  1436. ia64_pal_vm_summary (pal_vm_info_1_u_t *vm_info_1, pal_vm_info_2_u_t *vm_info_2)
  1437. {
  1438. struct ia64_pal_retval iprv;
  1439. PAL_CALL(iprv, PAL_VM_SUMMARY, 0, 0, 0);
  1440. if (vm_info_1)
  1441. vm_info_1->pvi1_val = iprv.v0;
  1442. if (vm_info_2)
  1443. vm_info_2->pvi2_val = iprv.v1;
  1444. return iprv.status;
  1445. }
  1446. typedef union pal_itr_valid_u {
  1447. u64 piv_val;
  1448. struct {
  1449. u64 access_rights_valid : 1,
  1450. priv_level_valid : 1,
  1451. dirty_bit_valid : 1,
  1452. mem_attr_valid : 1,
  1453. reserved : 60;
  1454. } pal_tr_valid_s;
  1455. } pal_tr_valid_u_t;
  1456. /* Read a translation register */
  1457. static inline s64
  1458. ia64_pal_tr_read (u64 reg_num, u64 tr_type, u64 *tr_buffer, pal_tr_valid_u_t *tr_valid)
  1459. {
  1460. struct ia64_pal_retval iprv;
  1461. PAL_CALL_PHYS_STK(iprv, PAL_VM_TR_READ, reg_num, tr_type,(u64)ia64_tpa(tr_buffer));
  1462. if (tr_valid)
  1463. tr_valid->piv_val = iprv.v0;
  1464. return iprv.status;
  1465. }
  1466. /*
  1467. * PAL_PREFETCH_VISIBILITY transaction types
  1468. */
  1469. #define PAL_VISIBILITY_VIRTUAL 0
  1470. #define PAL_VISIBILITY_PHYSICAL 1
  1471. /*
  1472. * PAL_PREFETCH_VISIBILITY return codes
  1473. */
  1474. #define PAL_VISIBILITY_OK 1
  1475. #define PAL_VISIBILITY_OK_REMOTE_NEEDED 0
  1476. #define PAL_VISIBILITY_INVAL_ARG -2
  1477. #define PAL_VISIBILITY_ERROR -3
  1478. static inline s64
  1479. ia64_pal_prefetch_visibility (s64 trans_type)
  1480. {
  1481. struct ia64_pal_retval iprv;
  1482. PAL_CALL(iprv, PAL_PREFETCH_VISIBILITY, trans_type, 0, 0);
  1483. return iprv.status;
  1484. }
  1485. /* data structure for getting information on logical to physical mappings */
  1486. typedef union pal_log_overview_u {
  1487. struct {
  1488. u64 num_log :16, /* Total number of logical
  1489. * processors on this die
  1490. */
  1491. tpc :8, /* Threads per core */
  1492. reserved3 :8, /* Reserved */
  1493. cpp :8, /* Cores per processor */
  1494. reserved2 :8, /* Reserved */
  1495. ppid :8, /* Physical processor ID */
  1496. reserved1 :8; /* Reserved */
  1497. } overview_bits;
  1498. u64 overview_data;
  1499. } pal_log_overview_t;
  1500. typedef union pal_proc_n_log_info1_u{
  1501. struct {
  1502. u64 tid :16, /* Thread id */
  1503. reserved2 :16, /* Reserved */
  1504. cid :16, /* Core id */
  1505. reserved1 :16; /* Reserved */
  1506. } ppli1_bits;
  1507. u64 ppli1_data;
  1508. } pal_proc_n_log_info1_t;
  1509. typedef union pal_proc_n_log_info2_u {
  1510. struct {
  1511. u64 la :16, /* Logical address */
  1512. reserved :48; /* Reserved */
  1513. } ppli2_bits;
  1514. u64 ppli2_data;
  1515. } pal_proc_n_log_info2_t;
  1516. typedef struct pal_logical_to_physical_s
  1517. {
  1518. pal_log_overview_t overview;
  1519. pal_proc_n_log_info1_t ppli1;
  1520. pal_proc_n_log_info2_t ppli2;
  1521. } pal_logical_to_physical_t;
  1522. #define overview_num_log overview.overview_bits.num_log
  1523. #define overview_tpc overview.overview_bits.tpc
  1524. #define overview_cpp overview.overview_bits.cpp
  1525. #define overview_ppid overview.overview_bits.ppid
  1526. #define log1_tid ppli1.ppli1_bits.tid
  1527. #define log1_cid ppli1.ppli1_bits.cid
  1528. #define log2_la ppli2.ppli2_bits.la
  1529. /* Get information on logical to physical processor mappings. */
  1530. static inline s64
  1531. ia64_pal_logical_to_phys(u64 proc_number, pal_logical_to_physical_t *mapping)
  1532. {
  1533. struct ia64_pal_retval iprv;
  1534. PAL_CALL(iprv, PAL_LOGICAL_TO_PHYSICAL, proc_number, 0, 0);
  1535. if (iprv.status == PAL_STATUS_SUCCESS)
  1536. {
  1537. mapping->overview.overview_data = iprv.v0;
  1538. mapping->ppli1.ppli1_data = iprv.v1;
  1539. mapping->ppli2.ppli2_data = iprv.v2;
  1540. }
  1541. return iprv.status;
  1542. }
  1543. typedef struct pal_cache_shared_info_s
  1544. {
  1545. u64 num_shared;
  1546. pal_proc_n_log_info1_t ppli1;
  1547. pal_proc_n_log_info2_t ppli2;
  1548. } pal_cache_shared_info_t;
  1549. /* Get information on logical to physical processor mappings. */
  1550. static inline s64
  1551. ia64_pal_cache_shared_info(u64 level,
  1552. u64 type,
  1553. u64 proc_number,
  1554. pal_cache_shared_info_t *info)
  1555. {
  1556. struct ia64_pal_retval iprv;
  1557. PAL_CALL(iprv, PAL_CACHE_SHARED_INFO, level, type, proc_number);
  1558. if (iprv.status == PAL_STATUS_SUCCESS) {
  1559. info->num_shared = iprv.v0;
  1560. info->ppli1.ppli1_data = iprv.v1;
  1561. info->ppli2.ppli2_data = iprv.v2;
  1562. }
  1563. return iprv.status;
  1564. }
  1565. #endif /* __ASSEMBLY__ */
  1566. #endif /* _ASM_IA64_PAL_H */