pal.h 50 KB

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