pal.h 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739
  1. #ifndef _ASM_IA64_PAL_H
  2. #define _ASM_IA64_PAL_H
  3. /*
  4. * Processor Abstraction Layer definitions.
  5. *
  6. * This is based on Intel IA-64 Architecture Software Developer's Manual rev 1.0
  7. * chapter 11 IA-64 Processor Abstraction Layer
  8. *
  9. * Copyright (C) 1998-2001 Hewlett-Packard Co
  10. * David Mosberger-Tang <davidm@hpl.hp.com>
  11. * Stephane Eranian <eranian@hpl.hp.com>
  12. * Copyright (C) 1999 VA Linux Systems
  13. * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
  14. * Copyright (C) 1999 Srinivasa Prasad Thirumalachar <sprasad@sprasad.engr.sgi.com>
  15. *
  16. * 99/10/01 davidm Make sure we pass zero for reserved parameters.
  17. * 00/03/07 davidm Updated pal_cache_flush() to be in sync with PAL v2.6.
  18. * 00/03/23 cfleck Modified processor min-state save area to match updated PAL & SAL info
  19. * 00/05/24 eranian Updated to latest PAL spec, fix structures bugs, added
  20. * 00/05/25 eranian Support for stack calls, and static physical calls
  21. * 00/06/18 eranian Support for stacked physical calls
  22. * 06/10/26 rja Support for Intel Itanium Architecture Software Developer's
  23. * Manual Rev 2.2 (Jan 2006)
  24. */
  25. /*
  26. * Note that some of these calls use a static-register only calling
  27. * convention which has nothing to do with the regular calling
  28. * convention.
  29. */
  30. #define PAL_CACHE_FLUSH 1 /* flush i/d cache */
  31. #define PAL_CACHE_INFO 2 /* get detailed i/d cache info */
  32. #define PAL_CACHE_INIT 3 /* initialize i/d cache */
  33. #define PAL_CACHE_SUMMARY 4 /* get summary of cache hierarchy */
  34. #define PAL_MEM_ATTRIB 5 /* list supported memory attributes */
  35. #define PAL_PTCE_INFO 6 /* purge TLB info */
  36. #define PAL_VM_INFO 7 /* return supported virtual memory features */
  37. #define PAL_VM_SUMMARY 8 /* return summary on supported vm features */
  38. #define PAL_BUS_GET_FEATURES 9 /* return processor bus interface features settings */
  39. #define PAL_BUS_SET_FEATURES 10 /* set processor bus features */
  40. #define PAL_DEBUG_INFO 11 /* get number of debug registers */
  41. #define PAL_FIXED_ADDR 12 /* get fixed component of processors's directed address */
  42. #define PAL_FREQ_BASE 13 /* base frequency of the platform */
  43. #define PAL_FREQ_RATIOS 14 /* ratio of processor, bus and ITC frequency */
  44. #define PAL_PERF_MON_INFO 15 /* return performance monitor info */
  45. #define PAL_PLATFORM_ADDR 16 /* set processor interrupt block and IO port space addr */
  46. #define PAL_PROC_GET_FEATURES 17 /* get configurable processor features & settings */
  47. #define PAL_PROC_SET_FEATURES 18 /* enable/disable configurable processor features */
  48. #define PAL_RSE_INFO 19 /* return rse information */
  49. #define PAL_VERSION 20 /* return version of PAL code */
  50. #define PAL_MC_CLEAR_LOG 21 /* clear all processor log info */
  51. #define PAL_MC_DRAIN 22 /* drain operations which could result in an MCA */
  52. #define PAL_MC_EXPECTED 23 /* set/reset expected MCA indicator */
  53. #define PAL_MC_DYNAMIC_STATE 24 /* get processor dynamic state */
  54. #define PAL_MC_ERROR_INFO 25 /* get processor MCA info and static state */
  55. #define PAL_MC_RESUME 26 /* Return to interrupted process */
  56. #define PAL_MC_REGISTER_MEM 27 /* Register memory for PAL to use during MCAs and inits */
  57. #define PAL_HALT 28 /* enter the low power HALT state */
  58. #define PAL_HALT_LIGHT 29 /* enter the low power light halt state*/
  59. #define PAL_COPY_INFO 30 /* returns info needed to relocate PAL */
  60. #define PAL_CACHE_LINE_INIT 31 /* init tags & data of cache line */
  61. #define PAL_PMI_ENTRYPOINT 32 /* register PMI memory entry points with the processor */
  62. #define PAL_ENTER_IA_32_ENV 33 /* enter IA-32 system environment */
  63. #define PAL_VM_PAGE_SIZE 34 /* return vm TC and page walker page sizes */
  64. #define PAL_MEM_FOR_TEST 37 /* get amount of memory needed for late processor test */
  65. #define PAL_CACHE_PROT_INFO 38 /* get i/d cache protection info */
  66. #define PAL_REGISTER_INFO 39 /* return AR and CR register information*/
  67. #define PAL_SHUTDOWN 40 /* enter processor shutdown state */
  68. #define PAL_PREFETCH_VISIBILITY 41 /* Make Processor Prefetches Visible */
  69. #define PAL_LOGICAL_TO_PHYSICAL 42 /* returns information on logical to physical processor mapping */
  70. #define PAL_CACHE_SHARED_INFO 43 /* returns information on caches shared by logical processor */
  71. #define PAL_GET_HW_POLICY 48 /* Get current hardware resource sharing policy */
  72. #define PAL_SET_HW_POLICY 49 /* Set current hardware resource sharing policy */
  73. #define PAL_COPY_PAL 256 /* relocate PAL procedures and PAL PMI */
  74. #define PAL_HALT_INFO 257 /* return the low power capabilities of processor */
  75. #define PAL_TEST_PROC 258 /* perform late processor self-test */
  76. #define PAL_CACHE_READ 259 /* read tag & data of cacheline for diagnostic testing */
  77. #define PAL_CACHE_WRITE 260 /* write tag & data of cacheline for diagnostic testing */
  78. #define PAL_VM_TR_READ 261 /* read contents of translation register */
  79. #define PAL_GET_PSTATE 262 /* get the current P-state */
  80. #define PAL_SET_PSTATE 263 /* set the P-state */
  81. #define PAL_BRAND_INFO 274 /* Processor branding information */
  82. #define PAL_GET_PSTATE_TYPE_LASTSET 0
  83. #define PAL_GET_PSTATE_TYPE_AVGANDRESET 1
  84. #define PAL_GET_PSTATE_TYPE_AVGNORESET 2
  85. #define PAL_GET_PSTATE_TYPE_INSTANT 3
  86. #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 hierarchy */
  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 hierarchy */
  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 hierarchy */
  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. * hierarchy.
  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. * hierarchy.
  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. #define PAL_TLB_CHECK_OP_PURGE 8
  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 hierarchy 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. /* Inform PALE_CHECK whether a machine check is expected so that PALE_CHECK willnot
  1091. * attempt to correct any expected machine checks.
  1092. */
  1093. static inline s64
  1094. ia64_pal_mc_expected (u64 expected, u64 *previous)
  1095. {
  1096. struct ia64_pal_retval iprv;
  1097. PAL_CALL(iprv, PAL_MC_EXPECTED, expected, 0, 0);
  1098. if (previous)
  1099. *previous = iprv.v0;
  1100. return iprv.status;
  1101. }
  1102. /* Register a platform dependent location with PAL to which it can save
  1103. * minimal processor state in the event of a machine check or initialization
  1104. * event.
  1105. */
  1106. static inline s64
  1107. ia64_pal_mc_register_mem (u64 physical_addr)
  1108. {
  1109. struct ia64_pal_retval iprv;
  1110. PAL_CALL(iprv, PAL_MC_REGISTER_MEM, physical_addr, 0, 0);
  1111. return iprv.status;
  1112. }
  1113. /* Restore minimal architectural processor state, set CMC interrupt if necessary
  1114. * and resume execution
  1115. */
  1116. static inline s64
  1117. ia64_pal_mc_resume (u64 set_cmci, u64 save_ptr)
  1118. {
  1119. struct ia64_pal_retval iprv;
  1120. PAL_CALL(iprv, PAL_MC_RESUME, set_cmci, save_ptr, 0);
  1121. return iprv.status;
  1122. }
  1123. /* Return the memory attributes implemented by the processor */
  1124. static inline s64
  1125. ia64_pal_mem_attrib (u64 *mem_attrib)
  1126. {
  1127. struct ia64_pal_retval iprv;
  1128. PAL_CALL(iprv, PAL_MEM_ATTRIB, 0, 0, 0);
  1129. if (mem_attrib)
  1130. *mem_attrib = iprv.v0 & 0xff;
  1131. return iprv.status;
  1132. }
  1133. /* Return the amount of memory needed for second phase of processor
  1134. * self-test and the required alignment of memory.
  1135. */
  1136. static inline s64
  1137. ia64_pal_mem_for_test (u64 *bytes_needed, u64 *alignment)
  1138. {
  1139. struct ia64_pal_retval iprv;
  1140. PAL_CALL(iprv, PAL_MEM_FOR_TEST, 0, 0, 0);
  1141. if (bytes_needed)
  1142. *bytes_needed = iprv.v0;
  1143. if (alignment)
  1144. *alignment = iprv.v1;
  1145. return iprv.status;
  1146. }
  1147. typedef union pal_perf_mon_info_u {
  1148. u64 ppmi_data;
  1149. struct {
  1150. u64 generic : 8,
  1151. width : 8,
  1152. cycles : 8,
  1153. retired : 8,
  1154. reserved : 32;
  1155. } pal_perf_mon_info_s;
  1156. } pal_perf_mon_info_u_t;
  1157. /* Return the performance monitor information about what can be counted
  1158. * and how to configure the monitors to count the desired events.
  1159. */
  1160. static inline s64
  1161. ia64_pal_perf_mon_info (u64 *pm_buffer, pal_perf_mon_info_u_t *pm_info)
  1162. {
  1163. struct ia64_pal_retval iprv;
  1164. PAL_CALL(iprv, PAL_PERF_MON_INFO, (unsigned long) pm_buffer, 0, 0);
  1165. if (pm_info)
  1166. pm_info->ppmi_data = iprv.v0;
  1167. return iprv.status;
  1168. }
  1169. /* Specifies the physical address of the processor interrupt block
  1170. * and I/O port space.
  1171. */
  1172. static inline s64
  1173. ia64_pal_platform_addr (u64 type, u64 physical_addr)
  1174. {
  1175. struct ia64_pal_retval iprv;
  1176. PAL_CALL(iprv, PAL_PLATFORM_ADDR, type, physical_addr, 0);
  1177. return iprv.status;
  1178. }
  1179. /* Set the SAL PMI entrypoint in memory */
  1180. static inline s64
  1181. ia64_pal_pmi_entrypoint (u64 sal_pmi_entry_addr)
  1182. {
  1183. struct ia64_pal_retval iprv;
  1184. PAL_CALL(iprv, PAL_PMI_ENTRYPOINT, sal_pmi_entry_addr, 0, 0);
  1185. return iprv.status;
  1186. }
  1187. struct pal_features_s;
  1188. /* Provide information about configurable processor features */
  1189. static inline s64
  1190. ia64_pal_proc_get_features (u64 *features_avail,
  1191. u64 *features_status,
  1192. u64 *features_control)
  1193. {
  1194. struct ia64_pal_retval iprv;
  1195. PAL_CALL_PHYS(iprv, PAL_PROC_GET_FEATURES, 0, 0, 0);
  1196. if (iprv.status == 0) {
  1197. *features_avail = iprv.v0;
  1198. *features_status = iprv.v1;
  1199. *features_control = iprv.v2;
  1200. }
  1201. return iprv.status;
  1202. }
  1203. /* Enable/disable processor dependent features */
  1204. static inline s64
  1205. ia64_pal_proc_set_features (u64 feature_select)
  1206. {
  1207. struct ia64_pal_retval iprv;
  1208. PAL_CALL_PHYS(iprv, PAL_PROC_SET_FEATURES, feature_select, 0, 0);
  1209. return iprv.status;
  1210. }
  1211. /*
  1212. * Put everything in a struct so we avoid the global offset table whenever
  1213. * possible.
  1214. */
  1215. typedef struct ia64_ptce_info_s {
  1216. u64 base;
  1217. u32 count[2];
  1218. u32 stride[2];
  1219. } ia64_ptce_info_t;
  1220. /* Return the information required for the architected loop used to purge
  1221. * (initialize) the entire TC
  1222. */
  1223. static inline s64
  1224. ia64_get_ptce (ia64_ptce_info_t *ptce)
  1225. {
  1226. struct ia64_pal_retval iprv;
  1227. if (!ptce)
  1228. return -1;
  1229. PAL_CALL(iprv, PAL_PTCE_INFO, 0, 0, 0);
  1230. if (iprv.status == 0) {
  1231. ptce->base = iprv.v0;
  1232. ptce->count[0] = iprv.v1 >> 32;
  1233. ptce->count[1] = iprv.v1 & 0xffffffff;
  1234. ptce->stride[0] = iprv.v2 >> 32;
  1235. ptce->stride[1] = iprv.v2 & 0xffffffff;
  1236. }
  1237. return iprv.status;
  1238. }
  1239. /* Return info about implemented application and control registers. */
  1240. static inline s64
  1241. ia64_pal_register_info (u64 info_request, u64 *reg_info_1, u64 *reg_info_2)
  1242. {
  1243. struct ia64_pal_retval iprv;
  1244. PAL_CALL(iprv, PAL_REGISTER_INFO, info_request, 0, 0);
  1245. if (reg_info_1)
  1246. *reg_info_1 = iprv.v0;
  1247. if (reg_info_2)
  1248. *reg_info_2 = iprv.v1;
  1249. return iprv.status;
  1250. }
  1251. typedef union pal_hints_u {
  1252. u64 ph_data;
  1253. struct {
  1254. u64 si : 1,
  1255. li : 1,
  1256. reserved : 62;
  1257. } pal_hints_s;
  1258. } pal_hints_u_t;
  1259. /* Return information about the register stack and RSE for this processor
  1260. * implementation.
  1261. */
  1262. static inline s64
  1263. ia64_pal_rse_info (u64 *num_phys_stacked, pal_hints_u_t *hints)
  1264. {
  1265. struct ia64_pal_retval iprv;
  1266. PAL_CALL(iprv, PAL_RSE_INFO, 0, 0, 0);
  1267. if (num_phys_stacked)
  1268. *num_phys_stacked = iprv.v0;
  1269. if (hints)
  1270. hints->ph_data = iprv.v1;
  1271. return iprv.status;
  1272. }
  1273. /*
  1274. * Set the current hardware resource sharing policy of the processor
  1275. */
  1276. static inline s64
  1277. ia64_pal_set_hw_policy (u64 policy)
  1278. {
  1279. struct ia64_pal_retval iprv;
  1280. PAL_CALL(iprv, PAL_SET_HW_POLICY, policy, 0, 0);
  1281. return iprv.status;
  1282. }
  1283. /* Cause the processor to enter SHUTDOWN state, where prefetching and execution are
  1284. * suspended, but cause cache and TLB coherency to be maintained.
  1285. * This is usually called in IA-32 mode.
  1286. */
  1287. static inline s64
  1288. ia64_pal_shutdown (void)
  1289. {
  1290. struct ia64_pal_retval iprv;
  1291. PAL_CALL(iprv, PAL_SHUTDOWN, 0, 0, 0);
  1292. return iprv.status;
  1293. }
  1294. /* Perform the second phase of processor self-test. */
  1295. static inline s64
  1296. ia64_pal_test_proc (u64 test_addr, u64 test_size, u64 attributes, u64 *self_test_state)
  1297. {
  1298. struct ia64_pal_retval iprv;
  1299. PAL_CALL(iprv, PAL_TEST_PROC, test_addr, test_size, attributes);
  1300. if (self_test_state)
  1301. *self_test_state = iprv.v0;
  1302. return iprv.status;
  1303. }
  1304. typedef union pal_version_u {
  1305. u64 pal_version_val;
  1306. struct {
  1307. u64 pv_pal_b_rev : 8;
  1308. u64 pv_pal_b_model : 8;
  1309. u64 pv_reserved1 : 8;
  1310. u64 pv_pal_vendor : 8;
  1311. u64 pv_pal_a_rev : 8;
  1312. u64 pv_pal_a_model : 8;
  1313. u64 pv_reserved2 : 16;
  1314. } pal_version_s;
  1315. } pal_version_u_t;
  1316. /*
  1317. * Return PAL version information. While the documentation states that
  1318. * PAL_VERSION can be called in either physical or virtual mode, some
  1319. * implementations only allow physical calls. We don't call it very often,
  1320. * so the overhead isn't worth eliminating.
  1321. */
  1322. static inline s64
  1323. ia64_pal_version (pal_version_u_t *pal_min_version, pal_version_u_t *pal_cur_version)
  1324. {
  1325. struct ia64_pal_retval iprv;
  1326. PAL_CALL_PHYS(iprv, PAL_VERSION, 0, 0, 0);
  1327. if (pal_min_version)
  1328. pal_min_version->pal_version_val = iprv.v0;
  1329. if (pal_cur_version)
  1330. pal_cur_version->pal_version_val = iprv.v1;
  1331. return iprv.status;
  1332. }
  1333. typedef union pal_tc_info_u {
  1334. u64 pti_val;
  1335. struct {
  1336. u64 num_sets : 8,
  1337. associativity : 8,
  1338. num_entries : 16,
  1339. pf : 1,
  1340. unified : 1,
  1341. reduce_tr : 1,
  1342. reserved : 29;
  1343. } pal_tc_info_s;
  1344. } pal_tc_info_u_t;
  1345. #define tc_reduce_tr pal_tc_info_s.reduce_tr
  1346. #define tc_unified pal_tc_info_s.unified
  1347. #define tc_pf pal_tc_info_s.pf
  1348. #define tc_num_entries pal_tc_info_s.num_entries
  1349. #define tc_associativity pal_tc_info_s.associativity
  1350. #define tc_num_sets pal_tc_info_s.num_sets
  1351. /* Return information about the virtual memory characteristics of the processor
  1352. * implementation.
  1353. */
  1354. static inline s64
  1355. ia64_pal_vm_info (u64 tc_level, u64 tc_type, pal_tc_info_u_t *tc_info, u64 *tc_pages)
  1356. {
  1357. struct ia64_pal_retval iprv;
  1358. PAL_CALL(iprv, PAL_VM_INFO, tc_level, tc_type, 0);
  1359. if (tc_info)
  1360. tc_info->pti_val = iprv.v0;
  1361. if (tc_pages)
  1362. *tc_pages = iprv.v1;
  1363. return iprv.status;
  1364. }
  1365. /* Get page size information about the virtual memory characteristics of the processor
  1366. * implementation.
  1367. */
  1368. static inline s64
  1369. ia64_pal_vm_page_size (u64 *tr_pages, u64 *vw_pages)
  1370. {
  1371. struct ia64_pal_retval iprv;
  1372. PAL_CALL(iprv, PAL_VM_PAGE_SIZE, 0, 0, 0);
  1373. if (tr_pages)
  1374. *tr_pages = iprv.v0;
  1375. if (vw_pages)
  1376. *vw_pages = iprv.v1;
  1377. return iprv.status;
  1378. }
  1379. typedef union pal_vm_info_1_u {
  1380. u64 pvi1_val;
  1381. struct {
  1382. u64 vw : 1,
  1383. phys_add_size : 7,
  1384. key_size : 8,
  1385. max_pkr : 8,
  1386. hash_tag_id : 8,
  1387. max_dtr_entry : 8,
  1388. max_itr_entry : 8,
  1389. max_unique_tcs : 8,
  1390. num_tc_levels : 8;
  1391. } pal_vm_info_1_s;
  1392. } pal_vm_info_1_u_t;
  1393. #define PAL_MAX_PURGES 0xFFFF /* all ones is means unlimited */
  1394. typedef union pal_vm_info_2_u {
  1395. u64 pvi2_val;
  1396. struct {
  1397. u64 impl_va_msb : 8,
  1398. rid_size : 8,
  1399. max_purges : 16,
  1400. reserved : 32;
  1401. } pal_vm_info_2_s;
  1402. } pal_vm_info_2_u_t;
  1403. /* Get summary information about the virtual memory characteristics of the processor
  1404. * implementation.
  1405. */
  1406. static inline s64
  1407. ia64_pal_vm_summary (pal_vm_info_1_u_t *vm_info_1, pal_vm_info_2_u_t *vm_info_2)
  1408. {
  1409. struct ia64_pal_retval iprv;
  1410. PAL_CALL(iprv, PAL_VM_SUMMARY, 0, 0, 0);
  1411. if (vm_info_1)
  1412. vm_info_1->pvi1_val = iprv.v0;
  1413. if (vm_info_2)
  1414. vm_info_2->pvi2_val = iprv.v1;
  1415. return iprv.status;
  1416. }
  1417. typedef union pal_itr_valid_u {
  1418. u64 piv_val;
  1419. struct {
  1420. u64 access_rights_valid : 1,
  1421. priv_level_valid : 1,
  1422. dirty_bit_valid : 1,
  1423. mem_attr_valid : 1,
  1424. reserved : 60;
  1425. } pal_tr_valid_s;
  1426. } pal_tr_valid_u_t;
  1427. /* Read a translation register */
  1428. static inline s64
  1429. ia64_pal_tr_read (u64 reg_num, u64 tr_type, u64 *tr_buffer, pal_tr_valid_u_t *tr_valid)
  1430. {
  1431. struct ia64_pal_retval iprv;
  1432. PAL_CALL_PHYS_STK(iprv, PAL_VM_TR_READ, reg_num, tr_type,(u64)ia64_tpa(tr_buffer));
  1433. if (tr_valid)
  1434. tr_valid->piv_val = iprv.v0;
  1435. return iprv.status;
  1436. }
  1437. /*
  1438. * PAL_PREFETCH_VISIBILITY transaction types
  1439. */
  1440. #define PAL_VISIBILITY_VIRTUAL 0
  1441. #define PAL_VISIBILITY_PHYSICAL 1
  1442. /*
  1443. * PAL_PREFETCH_VISIBILITY return codes
  1444. */
  1445. #define PAL_VISIBILITY_OK 1
  1446. #define PAL_VISIBILITY_OK_REMOTE_NEEDED 0
  1447. #define PAL_VISIBILITY_INVAL_ARG -2
  1448. #define PAL_VISIBILITY_ERROR -3
  1449. static inline s64
  1450. ia64_pal_prefetch_visibility (s64 trans_type)
  1451. {
  1452. struct ia64_pal_retval iprv;
  1453. PAL_CALL(iprv, PAL_PREFETCH_VISIBILITY, trans_type, 0, 0);
  1454. return iprv.status;
  1455. }
  1456. /* data structure for getting information on logical to physical mappings */
  1457. typedef union pal_log_overview_u {
  1458. struct {
  1459. u64 num_log :16, /* Total number of logical
  1460. * processors on this die
  1461. */
  1462. tpc :8, /* Threads per core */
  1463. reserved3 :8, /* Reserved */
  1464. cpp :8, /* Cores per processor */
  1465. reserved2 :8, /* Reserved */
  1466. ppid :8, /* Physical processor ID */
  1467. reserved1 :8; /* Reserved */
  1468. } overview_bits;
  1469. u64 overview_data;
  1470. } pal_log_overview_t;
  1471. typedef union pal_proc_n_log_info1_u{
  1472. struct {
  1473. u64 tid :16, /* Thread id */
  1474. reserved2 :16, /* Reserved */
  1475. cid :16, /* Core id */
  1476. reserved1 :16; /* Reserved */
  1477. } ppli1_bits;
  1478. u64 ppli1_data;
  1479. } pal_proc_n_log_info1_t;
  1480. typedef union pal_proc_n_log_info2_u {
  1481. struct {
  1482. u64 la :16, /* Logical address */
  1483. reserved :48; /* Reserved */
  1484. } ppli2_bits;
  1485. u64 ppli2_data;
  1486. } pal_proc_n_log_info2_t;
  1487. typedef struct pal_logical_to_physical_s
  1488. {
  1489. pal_log_overview_t overview;
  1490. pal_proc_n_log_info1_t ppli1;
  1491. pal_proc_n_log_info2_t ppli2;
  1492. } pal_logical_to_physical_t;
  1493. #define overview_num_log overview.overview_bits.num_log
  1494. #define overview_tpc overview.overview_bits.tpc
  1495. #define overview_cpp overview.overview_bits.cpp
  1496. #define overview_ppid overview.overview_bits.ppid
  1497. #define log1_tid ppli1.ppli1_bits.tid
  1498. #define log1_cid ppli1.ppli1_bits.cid
  1499. #define log2_la ppli2.ppli2_bits.la
  1500. /* Get information on logical to physical processor mappings. */
  1501. static inline s64
  1502. ia64_pal_logical_to_phys(u64 proc_number, pal_logical_to_physical_t *mapping)
  1503. {
  1504. struct ia64_pal_retval iprv;
  1505. PAL_CALL(iprv, PAL_LOGICAL_TO_PHYSICAL, proc_number, 0, 0);
  1506. if (iprv.status == PAL_STATUS_SUCCESS)
  1507. {
  1508. mapping->overview.overview_data = iprv.v0;
  1509. mapping->ppli1.ppli1_data = iprv.v1;
  1510. mapping->ppli2.ppli2_data = iprv.v2;
  1511. }
  1512. return iprv.status;
  1513. }
  1514. typedef struct pal_cache_shared_info_s
  1515. {
  1516. u64 num_shared;
  1517. pal_proc_n_log_info1_t ppli1;
  1518. pal_proc_n_log_info2_t ppli2;
  1519. } pal_cache_shared_info_t;
  1520. /* Get information on logical to physical processor mappings. */
  1521. static inline s64
  1522. ia64_pal_cache_shared_info(u64 level,
  1523. u64 type,
  1524. u64 proc_number,
  1525. pal_cache_shared_info_t *info)
  1526. {
  1527. struct ia64_pal_retval iprv;
  1528. PAL_CALL(iprv, PAL_CACHE_SHARED_INFO, level, type, proc_number);
  1529. if (iprv.status == PAL_STATUS_SUCCESS) {
  1530. info->num_shared = iprv.v0;
  1531. info->ppli1.ppli1_data = iprv.v1;
  1532. info->ppli2.ppli2_data = iprv.v2;
  1533. }
  1534. return iprv.status;
  1535. }
  1536. #endif /* __ASSEMBLY__ */
  1537. #endif /* _ASM_IA64_PAL_H */