pal.h 51 KB

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