pal.h 51 KB

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