1 #ifndef _ASM_IA64_PAL_H
 
   2 #define _ASM_IA64_PAL_H
 
   5  * Processor Abstraction Layer definitions.
 
   7  * This is based on Intel IA-64 Architecture Software Developer's Manual rev 1.0
 
   8  * chapter 11 IA-64 Processor Abstraction Layer
 
  10  * Copyright (C) 1998-2001 Hewlett-Packard Co
 
  11  *      David Mosberger-Tang <davidm@hpl.hp.com>
 
  12  *      Stephane Eranian <eranian@hpl.hp.com>
 
  13  * Copyright (C) 1999 VA Linux Systems
 
  14  * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
 
  15  * Copyright (C) 1999 Srinivasa Prasad Thirumalachar <sprasad@sprasad.engr.sgi.com>
 
  17  * 99/10/01     davidm  Make sure we pass zero for reserved parameters.
 
  18  * 00/03/07     davidm  Updated pal_cache_flush() to be in sync with PAL v2.6.
 
  19  * 00/03/23     cfleck  Modified processor min-state save area to match updated PAL & SAL info
 
  20  * 00/05/24     eranian Updated to latest PAL spec, fix structures bugs, added
 
  21  * 00/05/25     eranian Support for stack calls, and static physical calls
 
  22  * 00/06/18     eranian Support for stacked physical calls
 
  26  * Note that some of these calls use a static-register only calling
 
  27  * convention which has nothing to do with the regular calling
 
  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 */
 
  65 #define PAL_MEM_FOR_TEST        37      /* get amount of memory needed for late processor test */
 
  66 #define PAL_CACHE_PROT_INFO     38      /* get i/d cache protection info */
 
  67 #define PAL_REGISTER_INFO       39      /* return AR and CR register information*/
 
  68 #define PAL_SHUTDOWN            40      /* enter processor shutdown state */
 
  69 #define PAL_PREFETCH_VISIBILITY 41      /* Make Processor Prefetches Visible */
 
  70 #define PAL_LOGICAL_TO_PHYSICAL 42      /* returns information on logical to physical processor mapping */
 
  72 #define PAL_COPY_PAL            256     /* relocate PAL procedures and PAL PMI */
 
  73 #define PAL_HALT_INFO           257     /* return the low power capabilities of processor */
 
  74 #define PAL_TEST_PROC           258     /* perform late processor self-test */
 
  75 #define PAL_CACHE_READ          259     /* read tag & data of cacheline for diagnostic testing */
 
  76 #define PAL_CACHE_WRITE         260     /* write tag & data of cacheline for diagnostic testing */
 
  77 #define PAL_VM_TR_READ          261     /* read contents of translation register */
 
  78 #define PAL_GET_PSTATE          262     /* get the current P-state */
 
  79 #define PAL_SET_PSTATE          263     /* set the P-state */
 
  83 #include <linux/types.h>
 
  87  * Data types needed to pass information into PAL procedures and
 
  88  * interpret information returned by them.
 
  91 /* Return status from the PAL procedure */
 
  92 typedef s64                             pal_status_t;
 
  94 #define PAL_STATUS_SUCCESS              0       /* No error */
 
  95 #define PAL_STATUS_UNIMPLEMENTED        (-1)    /* Unimplemented procedure */
 
  96 #define PAL_STATUS_EINVAL               (-2)    /* Invalid argument */
 
  97 #define PAL_STATUS_ERROR                (-3)    /* Error */
 
  98 #define PAL_STATUS_CACHE_INIT_FAIL      (-4)    /* Could not initialize the
 
  99                                                  * specified level and type of
 
 100                                                  * cache without sideeffects
 
 101                                                  * and "restrict" was 1
 
 104 /* Processor cache level in the heirarchy */
 
 105 typedef u64                             pal_cache_level_t;
 
 106 #define PAL_CACHE_LEVEL_L0              0       /* L0 */
 
 107 #define PAL_CACHE_LEVEL_L1              1       /* L1 */
 
 108 #define PAL_CACHE_LEVEL_L2              2       /* L2 */
 
 111 /* Processor cache type at a particular level in the heirarchy */
 
 113 typedef u64                             pal_cache_type_t;
 
 114 #define PAL_CACHE_TYPE_INSTRUCTION      1       /* Instruction cache */
 
 115 #define PAL_CACHE_TYPE_DATA             2       /* Data or unified cache */
 
 116 #define PAL_CACHE_TYPE_INSTRUCTION_DATA 3       /* Both Data & Instruction */
 
 119 #define PAL_CACHE_FLUSH_INVALIDATE      1       /* Invalidate clean lines */
 
 120 #define PAL_CACHE_FLUSH_CHK_INTRS       2       /* check for interrupts/mc while flushing */
 
 122 /* Processor cache line size in bytes  */
 
 123 typedef int                             pal_cache_line_size_t;
 
 125 /* Processor cache line state */
 
 126 typedef u64                             pal_cache_line_state_t;
 
 127 #define PAL_CACHE_LINE_STATE_INVALID    0       /* Invalid */
 
 128 #define PAL_CACHE_LINE_STATE_SHARED     1       /* Shared */
 
 129 #define PAL_CACHE_LINE_STATE_EXCLUSIVE  2       /* Exclusive */
 
 130 #define PAL_CACHE_LINE_STATE_MODIFIED   3       /* Modified */
 
 132 typedef struct pal_freq_ratio {
 
 133         u64 den : 32, num : 32; /* numerator & denominator */
 
 134 } itc_ratio, proc_ratio;
 
 136 typedef union  pal_cache_config_info_1_s {
 
 138                 u64             u               : 1,    /* 0 Unified cache ? */
 
 139                                 at              : 2,    /* 2-1 Cache mem attr*/
 
 140                                 reserved        : 5,    /* 7-3 Reserved */
 
 141                                 associativity   : 8,    /* 16-8 Associativity*/
 
 142                                 line_size       : 8,    /* 23-17 Line size */
 
 143                                 stride          : 8,    /* 31-24 Stride */
 
 144                                 store_latency   : 8,    /*39-32 Store latency*/
 
 145                                 load_latency    : 8,    /* 47-40 Load latency*/
 
 146                                 store_hints     : 8,    /* 55-48 Store hints*/
 
 147                                 load_hints      : 8;    /* 63-56 Load hints */
 
 150 } pal_cache_config_info_1_t;
 
 152 typedef union  pal_cache_config_info_2_s {
 
 154                 u64             cache_size      : 32,   /*cache size in bytes*/
 
 157                                 alias_boundary  : 8,    /* 39-32 aliased addr
 
 161                                 tag_ls_bit      : 8,    /* 47-40 LSb of addr*/
 
 162                                 tag_ms_bit      : 8,    /* 55-48 MSb of addr*/
 
 163                                 reserved        : 8;    /* 63-56 Reserved */
 
 166 } pal_cache_config_info_2_t;
 
 169 typedef struct pal_cache_config_info_s {
 
 170         pal_status_t                    pcci_status;
 
 171         pal_cache_config_info_1_t       pcci_info_1;
 
 172         pal_cache_config_info_2_t       pcci_info_2;
 
 174 } pal_cache_config_info_t;
 
 176 #define pcci_ld_hints           pcci_info_1.pcci1_bits.load_hints
 
 177 #define pcci_st_hints           pcci_info_1.pcci1_bits.store_hints
 
 178 #define pcci_ld_latency         pcci_info_1.pcci1_bits.load_latency
 
 179 #define pcci_st_latency         pcci_info_1.pcci1_bits.store_latency
 
 180 #define pcci_stride             pcci_info_1.pcci1_bits.stride
 
 181 #define pcci_line_size          pcci_info_1.pcci1_bits.line_size
 
 182 #define pcci_assoc              pcci_info_1.pcci1_bits.associativity
 
 183 #define pcci_cache_attr         pcci_info_1.pcci1_bits.at
 
 184 #define pcci_unified            pcci_info_1.pcci1_bits.u
 
 185 #define pcci_tag_msb            pcci_info_2.pcci2_bits.tag_ms_bit
 
 186 #define pcci_tag_lsb            pcci_info_2.pcci2_bits.tag_ls_bit
 
 187 #define pcci_alias_boundary     pcci_info_2.pcci2_bits.alias_boundary
 
 188 #define pcci_cache_size         pcci_info_2.pcci2_bits.cache_size
 
 192 /* Possible values for cache attributes */
 
 194 #define PAL_CACHE_ATTR_WT               0       /* Write through cache */
 
 195 #define PAL_CACHE_ATTR_WB               1       /* Write back cache */
 
 196 #define PAL_CACHE_ATTR_WT_OR_WB         2       /* Either write thru or write
 
 197                                                  * back depending on TLB
 
 202 /* Possible values for cache hints */
 
 204 #define PAL_CACHE_HINT_TEMP_1           0       /* Temporal level 1 */
 
 205 #define PAL_CACHE_HINT_NTEMP_1          1       /* Non-temporal level 1 */
 
 206 #define PAL_CACHE_HINT_NTEMP_ALL        3       /* Non-temporal all levels */
 
 208 /* Processor cache protection  information */
 
 209 typedef union pal_cache_protection_element_u {
 
 212                 u32             data_bits       : 8, /* # data bits covered by
 
 213                                                       * each unit of protection
 
 216                                 tagprot_lsb     : 6, /* Least -do- */
 
 217                                 tagprot_msb     : 6, /* Most Sig. tag address
 
 221                                 prot_bits       : 6, /* # of protection bits */
 
 222                                 method          : 4, /* Protection method */
 
 223                                 t_d             : 2; /* Indicates which part
 
 225                                                       * protection encoding
 
 229 } pal_cache_protection_element_t;
 
 231 #define pcpi_cache_prot_part    pcp_info.t_d
 
 232 #define pcpi_prot_method        pcp_info.method
 
 233 #define pcpi_prot_bits          pcp_info.prot_bits
 
 234 #define pcpi_tagprot_msb        pcp_info.tagprot_msb
 
 235 #define pcpi_tagprot_lsb        pcp_info.tagprot_lsb
 
 236 #define pcpi_data_bits          pcp_info.data_bits
 
 238 /* Processor cache part encodings */
 
 239 #define PAL_CACHE_PROT_PART_DATA        0       /* Data protection  */
 
 240 #define PAL_CACHE_PROT_PART_TAG         1       /* Tag  protection */
 
 241 #define PAL_CACHE_PROT_PART_TAG_DATA    2       /* Tag+data protection (tag is
 
 244 #define PAL_CACHE_PROT_PART_DATA_TAG    3       /* Data+tag protection (data is
 
 247 #define PAL_CACHE_PROT_PART_MAX         6
 
 250 typedef struct pal_cache_protection_info_s {
 
 251         pal_status_t                    pcpi_status;
 
 252         pal_cache_protection_element_t  pcp_info[PAL_CACHE_PROT_PART_MAX];
 
 253 } pal_cache_protection_info_t;
 
 256 /* Processor cache protection method encodings */
 
 257 #define PAL_CACHE_PROT_METHOD_NONE              0       /* No protection */
 
 258 #define PAL_CACHE_PROT_METHOD_ODD_PARITY        1       /* Odd parity */
 
 259 #define PAL_CACHE_PROT_METHOD_EVEN_PARITY       2       /* Even parity */
 
 260 #define PAL_CACHE_PROT_METHOD_ECC               3       /* ECC protection */
 
 263 /* Processor cache line identification in the heirarchy */
 
 264 typedef union pal_cache_line_id_u {
 
 267                 u64             cache_type      : 8,    /* 7-0 cache type */
 
 268                                 level           : 8,    /* 15-8 level of the
 
 272                                 way             : 8,    /* 23-16 way in the set
 
 274                                 part            : 8,    /* 31-24 part of the
 
 277                                 reserved        : 32;   /* 63-32 is reserved*/
 
 280                 u64             cache_type      : 8,    /* 7-0 cache type */
 
 281                                 level           : 8,    /* 15-8 level of the
 
 285                                 way             : 8,    /* 23-16 way in the set
 
 287                                 part            : 8,    /* 31-24 part of the
 
 290                                 mesi            : 8,    /* 39-32 cache line
 
 293                                 start           : 8,    /* 47-40 lsb of data to
 
 296                                 length          : 8,    /* 55-48 #bits to
 
 299                                 trigger         : 8;    /* 63-56 Trigger error
 
 305 } pal_cache_line_id_u_t;
 
 307 #define pclid_read_part         pclid_info_read.part
 
 308 #define pclid_read_way          pclid_info_read.way
 
 309 #define pclid_read_level        pclid_info_read.level
 
 310 #define pclid_read_cache_type   pclid_info_read.cache_type
 
 312 #define pclid_write_trigger     pclid_info_write.trigger
 
 313 #define pclid_write_length      pclid_info_write.length
 
 314 #define pclid_write_start       pclid_info_write.start
 
 315 #define pclid_write_mesi        pclid_info_write.mesi
 
 316 #define pclid_write_part        pclid_info_write.part
 
 317 #define pclid_write_way         pclid_info_write.way
 
 318 #define pclid_write_level       pclid_info_write.level
 
 319 #define pclid_write_cache_type  pclid_info_write.cache_type
 
 321 /* Processor cache line part encodings */
 
 322 #define PAL_CACHE_LINE_ID_PART_DATA             0       /* Data */
 
 323 #define PAL_CACHE_LINE_ID_PART_TAG              1       /* Tag */
 
 324 #define PAL_CACHE_LINE_ID_PART_DATA_PROT        2       /* Data protection */
 
 325 #define PAL_CACHE_LINE_ID_PART_TAG_PROT         3       /* Tag protection */
 
 326 #define PAL_CACHE_LINE_ID_PART_DATA_TAG_PROT    4       /* Data+tag
 
 329 typedef struct pal_cache_line_info_s {
 
 330         pal_status_t            pcli_status;            /* Return status of the read cache line
 
 333         u64                     pcli_data;              /* 64-bit data, tag, protection bits .. */
 
 334         u64                     pcli_data_len;          /* data length in bits */
 
 335         pal_cache_line_state_t  pcli_cache_line_state;  /* mesi state */
 
 337 } pal_cache_line_info_t;
 
 340 /* Machine Check related crap */
 
 342 /* Pending event status bits  */
 
 343 typedef u64                                     pal_mc_pending_events_t;
 
 345 #define PAL_MC_PENDING_MCA                      (1 << 0)
 
 346 #define PAL_MC_PENDING_INIT                     (1 << 1)
 
 348 /* Error information type */
 
 349 typedef u64                                     pal_mc_info_index_t;
 
 351 #define PAL_MC_INFO_PROCESSOR                   0       /* Processor */
 
 352 #define PAL_MC_INFO_CACHE_CHECK                 1       /* Cache check */
 
 353 #define PAL_MC_INFO_TLB_CHECK                   2       /* Tlb check */
 
 354 #define PAL_MC_INFO_BUS_CHECK                   3       /* Bus check */
 
 355 #define PAL_MC_INFO_REQ_ADDR                    4       /* Requestor address */
 
 356 #define PAL_MC_INFO_RESP_ADDR                   5       /* Responder address */
 
 357 #define PAL_MC_INFO_TARGET_ADDR                 6       /* Target address */
 
 358 #define PAL_MC_INFO_IMPL_DEP                    7       /* Implementation
 
 363 typedef struct pal_process_state_info_s {
 
 365                         rz              : 1,    /* PAL_CHECK processor
 
 370                         ra              : 1,    /* PAL_CHECK attempted
 
 373                         me              : 1,    /* Distinct multiple
 
 377                         mn              : 1,    /* Min. state save
 
 379                                                  * registered with PAL
 
 382                         sy              : 1,    /* Storage integrity
 
 387                         co              : 1,    /* Continuable */
 
 388                         ci              : 1,    /* MC isolated */
 
 389                         us              : 1,    /* Uncontained storage
 
 394                         hd              : 1,    /* Non-essential hw
 
 398                                                  * processor to run in
 
 402                         tl              : 1,    /* 1 => MC occurred
 
 404                                                  * executed but before
 
 406                                                  * resulted from instr
 
 411                         mi              : 1,    /* More information available
 
 412                                                  * call PAL_MC_ERROR_INFO
 
 414                         pi              : 1,    /* Precise instruction pointer */
 
 415                         pm              : 1,    /* Precise min-state save area */
 
 417                         dy              : 1,    /* Processor dynamic
 
 422                         in              : 1,    /* 0 = MC, 1 = INIT */
 
 423                         rs              : 1,    /* RSE valid */
 
 424                         cm              : 1,    /* MC corrected */
 
 425                         ex              : 1,    /* MC is expected */
 
 426                         cr              : 1,    /* Control regs valid*/
 
 427                         pc              : 1,    /* Perf cntrs valid */
 
 428                         dr              : 1,    /* Debug regs valid */
 
 429                         tr              : 1,    /* Translation regs
 
 432                         rr              : 1,    /* Region regs valid */
 
 433                         ar              : 1,    /* App regs valid */
 
 434                         br              : 1,    /* Branch regs valid */
 
 435                         pr              : 1,    /* Predicate registers
 
 439                         fp              : 1,    /* fp registers valid*/
 
 440                         b1              : 1,    /* Preserved bank one
 
 444                         b0              : 1,    /* Preserved bank zero
 
 448                         gr              : 1,    /* General registers
 
 450                                                  * (excl. banked regs)
 
 452                         dsize           : 16,   /* size of dynamic
 
 458                         cc              : 1,    /* Cache check */
 
 459                         tc              : 1,    /* TLB check */
 
 460                         bc              : 1,    /* Bus check */
 
 461                         rc              : 1,    /* Register file check */
 
 462                         uc              : 1;    /* Uarch check */
 
 464 } pal_processor_state_info_t;
 
 466 typedef struct pal_cache_check_info_s {
 
 467         u64             op              : 4,    /* Type of cache
 
 472                         level           : 2,    /* Cache level */
 
 474                         dl              : 1,    /* Failure in data part
 
 477                         tl              : 1,    /* Failure in tag part
 
 480                         dc              : 1,    /* Failure in dcache */
 
 481                         ic              : 1,    /* Failure in icache */
 
 482                         mesi            : 3,    /* Cache line state */
 
 483                         mv              : 1,    /* mesi valid */
 
 484                         way             : 5,    /* Way in which the
 
 487                         wiv             : 1,    /* Way field valid */
 
 490                         index           : 20,   /* Cache line index */
 
 493                         is              : 1,    /* instruction set (1 == ia32) */
 
 494                         iv              : 1,    /* instruction set field valid */
 
 495                         pl              : 2,    /* privilege level */
 
 496                         pv              : 1,    /* privilege level field valid */
 
 497                         mcc             : 1,    /* Machine check corrected */
 
 498                         tv              : 1,    /* Target address
 
 501                         rq              : 1,    /* Requester identifier
 
 504                         rp              : 1,    /* Responder identifier
 
 507                         pi              : 1;    /* Precise instruction pointer
 
 510 } pal_cache_check_info_t;
 
 512 typedef struct pal_tlb_check_info_s {
 
 514         u64             tr_slot         : 8,    /* Slot# of TR where
 
 517                         trv             : 1,    /* tr_slot field is valid */
 
 519                         level           : 2,    /* TLB level where failure occurred */
 
 521                         dtr             : 1,    /* Fail in data TR */
 
 522                         itr             : 1,    /* Fail in inst TR */
 
 523                         dtc             : 1,    /* Fail in data TC */
 
 524                         itc             : 1,    /* Fail in inst. TC */
 
 525                         op              : 4,    /* Cache operation */
 
 528                         is              : 1,    /* instruction set (1 == ia32) */
 
 529                         iv              : 1,    /* instruction set field valid */
 
 530                         pl              : 2,    /* privilege level */
 
 531                         pv              : 1,    /* privilege level field valid */
 
 532                         mcc             : 1,    /* Machine check corrected */
 
 533                         tv              : 1,    /* Target address
 
 536                         rq              : 1,    /* Requester identifier
 
 539                         rp              : 1,    /* Responder identifier
 
 542                         pi              : 1;    /* Precise instruction pointer
 
 545 } pal_tlb_check_info_t;
 
 547 typedef struct pal_bus_check_info_s {
 
 548         u64             size            : 5,    /* Xaction size */
 
 549                         ib              : 1,    /* Internal bus error */
 
 550                         eb              : 1,    /* External bus error */
 
 551                         cc              : 1,    /* Error occurred
 
 555                         type            : 8,    /* Bus xaction type*/
 
 556                         sev             : 5,    /* Bus error severity*/
 
 557                         hier            : 2,    /* Bus hierarchy level */
 
 559                         bsi             : 8,    /* Bus error status
 
 564                         is              : 1,    /* instruction set (1 == ia32) */
 
 565                         iv              : 1,    /* instruction set field valid */
 
 566                         pl              : 2,    /* privilege level */
 
 567                         pv              : 1,    /* privilege level field valid */
 
 568                         mcc             : 1,    /* Machine check corrected */
 
 569                         tv              : 1,    /* Target address
 
 572                         rq              : 1,    /* Requester identifier
 
 575                         rp              : 1,    /* Responder identifier
 
 578                         pi              : 1;    /* Precise instruction pointer
 
 581 } pal_bus_check_info_t;
 
 583 typedef struct pal_reg_file_check_info_s {
 
 584         u64             id              : 4,    /* Register file identifier */
 
 585                         op              : 4,    /* Type of register
 
 590                         reg_num         : 7,    /* Register number */
 
 591                         rnv             : 1,    /* reg_num valid */
 
 594                         is              : 1,    /* instruction set (1 == ia32) */
 
 595                         iv              : 1,    /* instruction set field valid */
 
 596                         pl              : 2,    /* privilege level */
 
 597                         pv              : 1,    /* privilege level field valid */
 
 598                         mcc             : 1,    /* Machine check corrected */
 
 600                         pi              : 1;    /* Precise instruction pointer
 
 603 } pal_reg_file_check_info_t;
 
 605 typedef struct pal_uarch_check_info_s {
 
 606         u64             sid             : 5,    /* Structure identification */
 
 607                         level           : 3,    /* Level of failure */
 
 608                         array_id        : 4,    /* Array identification */
 
 614                         way             : 6,    /* Way of structure */
 
 615                         wv              : 1,    /* way valid */
 
 616                         xv              : 1,    /* index valid */
 
 618                         index           : 8,    /* Index or set of the uarch
 
 619                                                  * structure that failed.
 
 623                         is              : 1,    /* instruction set (1 == ia32) */
 
 624                         iv              : 1,    /* instruction set field valid */
 
 625                         pl              : 2,    /* privilege level */
 
 626                         pv              : 1,    /* privilege level field valid */
 
 627                         mcc             : 1,    /* Machine check corrected */
 
 628                         tv              : 1,    /* Target address
 
 631                         rq              : 1,    /* Requester identifier
 
 634                         rp              : 1,    /* Responder identifier
 
 637                         pi              : 1;    /* Precise instruction pointer
 
 640 } pal_uarch_check_info_t;
 
 642 typedef union pal_mc_error_info_u {
 
 644         pal_processor_state_info_t      pme_processor;
 
 645         pal_cache_check_info_t          pme_cache;
 
 646         pal_tlb_check_info_t            pme_tlb;
 
 647         pal_bus_check_info_t            pme_bus;
 
 648         pal_reg_file_check_info_t       pme_reg_file;
 
 649         pal_uarch_check_info_t          pme_uarch;
 
 650 } pal_mc_error_info_t;
 
 652 #define pmci_proc_unknown_check                 pme_processor.uc
 
 653 #define pmci_proc_bus_check                     pme_processor.bc
 
 654 #define pmci_proc_tlb_check                     pme_processor.tc
 
 655 #define pmci_proc_cache_check                   pme_processor.cc
 
 656 #define pmci_proc_dynamic_state_size            pme_processor.dsize
 
 657 #define pmci_proc_gpr_valid                     pme_processor.gr
 
 658 #define pmci_proc_preserved_bank0_gpr_valid     pme_processor.b0
 
 659 #define pmci_proc_preserved_bank1_gpr_valid     pme_processor.b1
 
 660 #define pmci_proc_fp_valid                      pme_processor.fp
 
 661 #define pmci_proc_predicate_regs_valid          pme_processor.pr
 
 662 #define pmci_proc_branch_regs_valid             pme_processor.br
 
 663 #define pmci_proc_app_regs_valid                pme_processor.ar
 
 664 #define pmci_proc_region_regs_valid             pme_processor.rr
 
 665 #define pmci_proc_translation_regs_valid        pme_processor.tr
 
 666 #define pmci_proc_debug_regs_valid              pme_processor.dr
 
 667 #define pmci_proc_perf_counters_valid           pme_processor.pc
 
 668 #define pmci_proc_control_regs_valid            pme_processor.cr
 
 669 #define pmci_proc_machine_check_expected        pme_processor.ex
 
 670 #define pmci_proc_machine_check_corrected       pme_processor.cm
 
 671 #define pmci_proc_rse_valid                     pme_processor.rs
 
 672 #define pmci_proc_machine_check_or_init         pme_processor.in
 
 673 #define pmci_proc_dynamic_state_valid           pme_processor.dy
 
 674 #define pmci_proc_operation                     pme_processor.op
 
 675 #define pmci_proc_trap_lost                     pme_processor.tl
 
 676 #define pmci_proc_hardware_damage               pme_processor.hd
 
 677 #define pmci_proc_uncontained_storage_damage    pme_processor.us
 
 678 #define pmci_proc_machine_check_isolated        pme_processor.ci
 
 679 #define pmci_proc_continuable                   pme_processor.co
 
 680 #define pmci_proc_storage_intergrity_synced     pme_processor.sy
 
 681 #define pmci_proc_min_state_save_area_regd      pme_processor.mn
 
 682 #define pmci_proc_distinct_multiple_errors      pme_processor.me
 
 683 #define pmci_proc_pal_attempted_rendezvous      pme_processor.ra
 
 684 #define pmci_proc_pal_rendezvous_complete       pme_processor.rz
 
 687 #define pmci_cache_level                        pme_cache.level
 
 688 #define pmci_cache_line_state                   pme_cache.mesi
 
 689 #define pmci_cache_line_state_valid             pme_cache.mv
 
 690 #define pmci_cache_line_index                   pme_cache.index
 
 691 #define pmci_cache_instr_cache_fail             pme_cache.ic
 
 692 #define pmci_cache_data_cache_fail              pme_cache.dc
 
 693 #define pmci_cache_line_tag_fail                pme_cache.tl
 
 694 #define pmci_cache_line_data_fail               pme_cache.dl
 
 695 #define pmci_cache_operation                    pme_cache.op
 
 696 #define pmci_cache_way_valid                    pme_cache.wv
 
 697 #define pmci_cache_target_address_valid         pme_cache.tv
 
 698 #define pmci_cache_way                          pme_cache.way
 
 699 #define pmci_cache_mc                           pme_cache.mc
 
 701 #define pmci_tlb_instr_translation_cache_fail   pme_tlb.itc
 
 702 #define pmci_tlb_data_translation_cache_fail    pme_tlb.dtc
 
 703 #define pmci_tlb_instr_translation_reg_fail     pme_tlb.itr
 
 704 #define pmci_tlb_data_translation_reg_fail      pme_tlb.dtr
 
 705 #define pmci_tlb_translation_reg_slot           pme_tlb.tr_slot
 
 706 #define pmci_tlb_mc                             pme_tlb.mc
 
 708 #define pmci_bus_status_info                    pme_bus.bsi
 
 709 #define pmci_bus_req_address_valid              pme_bus.rq
 
 710 #define pmci_bus_resp_address_valid             pme_bus.rp
 
 711 #define pmci_bus_target_address_valid           pme_bus.tv
 
 712 #define pmci_bus_error_severity                 pme_bus.sev
 
 713 #define pmci_bus_transaction_type               pme_bus.type
 
 714 #define pmci_bus_cache_cache_transfer           pme_bus.cc
 
 715 #define pmci_bus_transaction_size               pme_bus.size
 
 716 #define pmci_bus_internal_error                 pme_bus.ib
 
 717 #define pmci_bus_external_error                 pme_bus.eb
 
 718 #define pmci_bus_mc                             pme_bus.mc
 
 721  * NOTE: this min_state_save area struct only includes the 1KB
 
 722  * architectural state save area.  The other 3 KB is scratch space
 
 726 typedef struct pal_min_state_area_s {
 
 727         u64     pmsa_nat_bits;          /* nat bits for saved GRs  */
 
 728         u64     pmsa_gr[15];            /* GR1  - GR15             */
 
 729         u64     pmsa_bank0_gr[16];      /* GR16 - GR31             */
 
 730         u64     pmsa_bank1_gr[16];      /* GR16 - GR31             */
 
 731         u64     pmsa_pr;                /* predicate registers     */
 
 732         u64     pmsa_br0;               /* branch register 0       */
 
 733         u64     pmsa_rsc;               /* ar.rsc                  */
 
 734         u64     pmsa_iip;               /* cr.iip                  */
 
 735         u64     pmsa_ipsr;              /* cr.ipsr                 */
 
 736         u64     pmsa_ifs;               /* cr.ifs                  */
 
 737         u64     pmsa_xip;               /* previous iip            */
 
 738         u64     pmsa_xpsr;              /* previous psr            */
 
 739         u64     pmsa_xfs;               /* previous ifs            */
 
 740         u64     pmsa_br1;               /* branch register 1       */
 
 741         u64     pmsa_reserved[70];      /* pal_min_state_area should total to 1KB */
 
 742 } pal_min_state_area_t;
 
 745 struct ia64_pal_retval {
 
 747          * A zero status value indicates call completed without error.
 
 748          * A negative status value indicates reason of call failure.
 
 749          * A positive status value indicates success but an
 
 750          * informational value should be printed (e.g., "reboot for
 
 751          * change to take effect").
 
 760  * Note: Currently unused PAL arguments are generally labeled
 
 761  * "reserved" so the value specified in the PAL documentation
 
 762  * (generally 0) MUST be passed.  Reserved parameters are not optional
 
 765 extern struct ia64_pal_retval ia64_pal_call_static (u64, u64, u64, u64, u64);
 
 766 extern struct ia64_pal_retval ia64_pal_call_stacked (u64, u64, u64, u64);
 
 767 extern struct ia64_pal_retval ia64_pal_call_phys_static (u64, u64, u64, u64);
 
 768 extern struct ia64_pal_retval ia64_pal_call_phys_stacked (u64, u64, u64, u64);
 
 769 extern void ia64_save_scratch_fpregs (struct ia64_fpreg *);
 
 770 extern void ia64_load_scratch_fpregs (struct ia64_fpreg *);
 
 772 #define PAL_CALL(iprv,a0,a1,a2,a3) do {                 \
 
 773         struct ia64_fpreg fr[6];                        \
 
 774         ia64_save_scratch_fpregs(fr);                   \
 
 775         iprv = ia64_pal_call_static(a0, a1, a2, a3, 0); \
 
 776         ia64_load_scratch_fpregs(fr);                   \
 
 779 #define PAL_CALL_IC_OFF(iprv,a0,a1,a2,a3) do {          \
 
 780         struct ia64_fpreg fr[6];                        \
 
 781         ia64_save_scratch_fpregs(fr);                   \
 
 782         iprv = ia64_pal_call_static(a0, a1, a2, a3, 1); \
 
 783         ia64_load_scratch_fpregs(fr);                   \
 
 786 #define PAL_CALL_STK(iprv,a0,a1,a2,a3) do {             \
 
 787         struct ia64_fpreg fr[6];                        \
 
 788         ia64_save_scratch_fpregs(fr);                   \
 
 789         iprv = ia64_pal_call_stacked(a0, a1, a2, a3);   \
 
 790         ia64_load_scratch_fpregs(fr);                   \
 
 793 #define PAL_CALL_PHYS(iprv,a0,a1,a2,a3) do {                    \
 
 794         struct ia64_fpreg fr[6];                                \
 
 795         ia64_save_scratch_fpregs(fr);                           \
 
 796         iprv = ia64_pal_call_phys_static(a0, a1, a2, a3);       \
 
 797         ia64_load_scratch_fpregs(fr);                           \
 
 800 #define PAL_CALL_PHYS_STK(iprv,a0,a1,a2,a3) do {                \
 
 801         struct ia64_fpreg fr[6];                                \
 
 802         ia64_save_scratch_fpregs(fr);                           \
 
 803         iprv = ia64_pal_call_phys_stacked(a0, a1, a2, a3);      \
 
 804         ia64_load_scratch_fpregs(fr);                           \
 
 807 typedef int (*ia64_pal_handler) (u64, ...);
 
 808 extern ia64_pal_handler ia64_pal;
 
 809 extern void ia64_pal_handler_init (void *);
 
 811 extern ia64_pal_handler ia64_pal;
 
 813 extern pal_cache_config_info_t          l0d_cache_config_info;
 
 814 extern pal_cache_config_info_t          l0i_cache_config_info;
 
 815 extern pal_cache_config_info_t          l1_cache_config_info;
 
 816 extern pal_cache_config_info_t          l2_cache_config_info;
 
 818 extern pal_cache_protection_info_t      l0d_cache_protection_info;
 
 819 extern pal_cache_protection_info_t      l0i_cache_protection_info;
 
 820 extern pal_cache_protection_info_t      l1_cache_protection_info;
 
 821 extern pal_cache_protection_info_t      l2_cache_protection_info;
 
 823 extern pal_cache_config_info_t          pal_cache_config_info_get(pal_cache_level_t,
 
 826 extern pal_cache_protection_info_t      pal_cache_protection_info_get(pal_cache_level_t,
 
 830 extern void                             pal_error(int);
 
 833 /* Useful wrappers for the current list of pal procedures */
 
 835 typedef union pal_bus_features_u {
 
 836         u64     pal_bus_features_val;
 
 838                 u64     pbf_reserved1                           :       29;
 
 839                 u64     pbf_req_bus_parking                     :       1;
 
 840                 u64     pbf_bus_lock_mask                       :       1;
 
 841                 u64     pbf_enable_half_xfer_rate               :       1;
 
 842                 u64     pbf_reserved2                           :       22;
 
 843                 u64     pbf_disable_xaction_queueing            :       1;
 
 844                 u64     pbf_disable_resp_err_check              :       1;
 
 845                 u64     pbf_disable_berr_check                  :       1;
 
 846                 u64     pbf_disable_bus_req_internal_err_signal :       1;
 
 847                 u64     pbf_disable_bus_req_berr_signal         :       1;
 
 848                 u64     pbf_disable_bus_init_event_check        :       1;
 
 849                 u64     pbf_disable_bus_init_event_signal       :       1;
 
 850                 u64     pbf_disable_bus_addr_err_check          :       1;
 
 851                 u64     pbf_disable_bus_addr_err_signal         :       1;
 
 852                 u64     pbf_disable_bus_data_err_check          :       1;
 
 853         } pal_bus_features_s;
 
 854 } pal_bus_features_u_t;
 
 856 extern void pal_bus_features_print (u64);
 
 858 /* Provide information about configurable processor bus features */
 
 860 ia64_pal_bus_get_features (pal_bus_features_u_t *features_avail,
 
 861                            pal_bus_features_u_t *features_status,
 
 862                            pal_bus_features_u_t *features_control)
 
 864         struct ia64_pal_retval iprv;
 
 865         PAL_CALL_PHYS(iprv, PAL_BUS_GET_FEATURES, 0, 0, 0);
 
 867                 features_avail->pal_bus_features_val = iprv.v0;
 
 869                 features_status->pal_bus_features_val = iprv.v1;
 
 870         if (features_control)
 
 871                 features_control->pal_bus_features_val = iprv.v2;
 
 875 /* Enables/disables specific processor bus features */
 
 877 ia64_pal_bus_set_features (pal_bus_features_u_t feature_select)
 
 879         struct ia64_pal_retval iprv;
 
 880         PAL_CALL_PHYS(iprv, PAL_BUS_SET_FEATURES, feature_select.pal_bus_features_val, 0, 0);
 
 884 /* Get detailed cache information */
 
 886 ia64_pal_cache_config_info (u64 cache_level, u64 cache_type, pal_cache_config_info_t *conf)
 
 888         struct ia64_pal_retval iprv;
 
 890         PAL_CALL(iprv, PAL_CACHE_INFO, cache_level, cache_type, 0);
 
 892         if (iprv.status == 0) {
 
 893                 conf->pcci_status                 = iprv.status;
 
 894                 conf->pcci_info_1.pcci1_data      = iprv.v0;
 
 895                 conf->pcci_info_2.pcci2_data      = iprv.v1;
 
 896                 conf->pcci_reserved               = iprv.v2;
 
 902 /* Get detailed cche protection information */
 
 904 ia64_pal_cache_prot_info (u64 cache_level, u64 cache_type, pal_cache_protection_info_t *prot)
 
 906         struct ia64_pal_retval iprv;
 
 908         PAL_CALL(iprv, PAL_CACHE_PROT_INFO, cache_level, cache_type, 0);
 
 910         if (iprv.status == 0) {
 
 911                 prot->pcpi_status           = iprv.status;
 
 912                 prot->pcp_info[0].pcpi_data = iprv.v0 & 0xffffffff;
 
 913                 prot->pcp_info[1].pcpi_data = iprv.v0 >> 32;
 
 914                 prot->pcp_info[2].pcpi_data = iprv.v1 & 0xffffffff;
 
 915                 prot->pcp_info[3].pcpi_data = iprv.v1 >> 32;
 
 916                 prot->pcp_info[4].pcpi_data = iprv.v2 & 0xffffffff;
 
 917                 prot->pcp_info[5].pcpi_data = iprv.v2 >> 32;
 
 923  * Flush the processor instruction or data caches.  *PROGRESS must be
 
 924  * initialized to zero before calling this for the first time..
 
 927 ia64_pal_cache_flush (u64 cache_type, u64 invalidate, u64 *progress, u64 *vector)
 
 929         struct ia64_pal_retval iprv;
 
 930         PAL_CALL(iprv, PAL_CACHE_FLUSH, cache_type, invalidate, *progress);
 
 938 /* Initialize the processor controlled caches */
 
 940 ia64_pal_cache_init (u64 level, u64 cache_type, u64 rest)
 
 942         struct ia64_pal_retval iprv;
 
 943         PAL_CALL(iprv, PAL_CACHE_INIT, level, cache_type, rest);
 
 947 /* Initialize the tags and data of a data or unified cache line of
 
 948  * processor controlled cache to known values without the availability
 
 952 ia64_pal_cache_line_init (u64 physical_addr, u64 data_value)
 
 954         struct ia64_pal_retval iprv;
 
 955         PAL_CALL(iprv, PAL_CACHE_LINE_INIT, physical_addr, data_value, 0);
 
 960 /* Read the data and tag of a processor controlled cache line for diags */
 
 962 ia64_pal_cache_read (pal_cache_line_id_u_t line_id, u64 physical_addr)
 
 964         struct ia64_pal_retval iprv;
 
 965         PAL_CALL(iprv, PAL_CACHE_READ, line_id.pclid_data, physical_addr, 0);
 
 969 /* Return summary information about the heirarchy of caches controlled by the processor */
 
 971 ia64_pal_cache_summary (u64 *cache_levels, u64 *unique_caches)
 
 973         struct ia64_pal_retval iprv;
 
 974         PAL_CALL(iprv, PAL_CACHE_SUMMARY, 0, 0, 0);
 
 976                 *cache_levels = iprv.v0;
 
 978                 *unique_caches = iprv.v1;
 
 982 /* Write the data and tag of a processor-controlled cache line for diags */
 
 984 ia64_pal_cache_write (pal_cache_line_id_u_t line_id, u64 physical_addr, u64 data)
 
 986         struct ia64_pal_retval iprv;
 
 987         PAL_CALL(iprv, PAL_CACHE_WRITE, line_id.pclid_data, physical_addr, data);
 
 992 /* Return the parameters needed to copy relocatable PAL procedures from ROM to memory */
 
 994 ia64_pal_copy_info (u64 copy_type, u64 num_procs, u64 num_iopics,
 
 995                     u64 *buffer_size, u64 *buffer_align)
 
 997         struct ia64_pal_retval iprv;
 
 998         PAL_CALL(iprv, PAL_COPY_INFO, copy_type, num_procs, num_iopics);
 
1000                 *buffer_size = iprv.v0;
 
1002                 *buffer_align = iprv.v1;
 
1006 /* Copy relocatable PAL procedures from ROM to memory */
 
1008 ia64_pal_copy_pal (u64 target_addr, u64 alloc_size, u64 processor, u64 *pal_proc_offset)
 
1010         struct ia64_pal_retval iprv;
 
1011         PAL_CALL(iprv, PAL_COPY_PAL, target_addr, alloc_size, processor);
 
1012         if (pal_proc_offset)
 
1013                 *pal_proc_offset = iprv.v0;
 
1017 /* Return the number of instruction and data debug register pairs */
 
1019 ia64_pal_debug_info (u64 *inst_regs,  u64 *data_regs)
 
1021         struct ia64_pal_retval iprv;
 
1022         PAL_CALL(iprv, PAL_DEBUG_INFO, 0, 0, 0);
 
1024                 *inst_regs = iprv.v0;
 
1026                 *data_regs = iprv.v1;
 
1032 /* Switch from IA64-system environment to IA-32 system environment */
 
1034 ia64_pal_enter_ia32_env (ia32_env1, ia32_env2, ia32_env3)
 
1036         struct ia64_pal_retval iprv;
 
1037         PAL_CALL(iprv, PAL_ENTER_IA_32_ENV, ia32_env1, ia32_env2, ia32_env3);
 
1042 /* Get unique geographical address of this processor on its bus */
 
1044 ia64_pal_fixed_addr (u64 *global_unique_addr)
 
1046         struct ia64_pal_retval iprv;
 
1047         PAL_CALL(iprv, PAL_FIXED_ADDR, 0, 0, 0);
 
1048         if (global_unique_addr)
 
1049                 *global_unique_addr = iprv.v0;
 
1053 /* Get base frequency of the platform if generated by the processor */
 
1055 ia64_pal_freq_base (u64 *platform_base_freq)
 
1057         struct ia64_pal_retval iprv;
 
1058         PAL_CALL(iprv, PAL_FREQ_BASE, 0, 0, 0);
 
1059         if (platform_base_freq)
 
1060                 *platform_base_freq = iprv.v0;
 
1065  * Get the ratios for processor frequency, bus frequency and interval timer to
 
1066  * to base frequency of the platform
 
1069 ia64_pal_freq_ratios (struct pal_freq_ratio *proc_ratio, struct pal_freq_ratio *bus_ratio,
 
1070                       struct pal_freq_ratio *itc_ratio)
 
1072         struct ia64_pal_retval iprv;
 
1073         PAL_CALL(iprv, PAL_FREQ_RATIOS, 0, 0, 0);
 
1075                 *(u64 *)proc_ratio = iprv.v0;
 
1077                 *(u64 *)bus_ratio = iprv.v1;
 
1079                 *(u64 *)itc_ratio = iprv.v2;
 
1083 /* Make the processor enter HALT or one of the implementation dependent low
 
1084  * power states where prefetching and execution are suspended and cache and
 
1085  * TLB coherency is not maintained.
 
1088 ia64_pal_halt (u64 halt_state)
 
1090         struct ia64_pal_retval iprv;
 
1091         PAL_CALL(iprv, PAL_HALT, halt_state, 0, 0);
 
1095 typedef union pal_power_mgmt_info_u {
 
1098                u64              exit_latency            : 16,
 
1100                                 power_consumption       : 28,
 
1104         } pal_power_mgmt_info_s;
 
1105 } pal_power_mgmt_info_u_t;
 
1107 /* Return information about processor's optional power management capabilities. */
 
1109 ia64_pal_halt_info (pal_power_mgmt_info_u_t *power_buf)
 
1111         struct ia64_pal_retval iprv;
 
1112         PAL_CALL_STK(iprv, PAL_HALT_INFO, (unsigned long) power_buf, 0, 0);
 
1116 /* Get the current P-state information */
 
1118 ia64_pal_get_pstate (u64 *pstate_index)
 
1120         struct ia64_pal_retval iprv;
 
1121         PAL_CALL_STK(iprv, PAL_GET_PSTATE, 0, 0, 0);
 
1122         *pstate_index = iprv.v0;
 
1126 /* Set the P-state */
 
1128 ia64_pal_set_pstate (u64 pstate_index)
 
1130         struct ia64_pal_retval iprv;
 
1131         PAL_CALL_STK(iprv, PAL_SET_PSTATE, pstate_index, 0, 0);
 
1135 /* Cause the processor to enter LIGHT HALT state, where prefetching and execution are
 
1136  * suspended, but cache and TLB coherency is maintained.
 
1139 ia64_pal_halt_light (void)
 
1141         struct ia64_pal_retval iprv;
 
1142         PAL_CALL(iprv, PAL_HALT_LIGHT, 0, 0, 0);
 
1146 /* Clear all the processor error logging   registers and reset the indicator that allows
 
1147  * the error logging registers to be written. This procedure also checks the pending
 
1148  * machine check bit and pending INIT bit and reports their states.
 
1151 ia64_pal_mc_clear_log (u64 *pending_vector)
 
1153         struct ia64_pal_retval iprv;
 
1154         PAL_CALL(iprv, PAL_MC_CLEAR_LOG, 0, 0, 0);
 
1156                 *pending_vector = iprv.v0;
 
1160 /* Ensure that all outstanding transactions in a processor are completed or that any
 
1161  * MCA due to thes outstanding transaction is taken.
 
1164 ia64_pal_mc_drain (void)
 
1166         struct ia64_pal_retval iprv;
 
1167         PAL_CALL(iprv, PAL_MC_DRAIN, 0, 0, 0);
 
1171 /* Return the machine check dynamic processor state */
 
1173 ia64_pal_mc_dynamic_state (u64 offset, u64 *size, u64 *pds)
 
1175         struct ia64_pal_retval iprv;
 
1176         PAL_CALL(iprv, PAL_MC_DYNAMIC_STATE, offset, 0, 0);
 
1184 /* Return processor machine check information */
 
1186 ia64_pal_mc_error_info (u64 info_index, u64 type_index, u64 *size, u64 *error_info)
 
1188         struct ia64_pal_retval iprv;
 
1189         PAL_CALL(iprv, PAL_MC_ERROR_INFO, info_index, type_index, 0);
 
1193                 *error_info = iprv.v1;
 
1197 /* Inform PALE_CHECK whether a machine check is expected so that PALE_CHECK willnot
 
1198  * attempt to correct any expected machine checks.
 
1201 ia64_pal_mc_expected (u64 expected, u64 *previous)
 
1203         struct ia64_pal_retval iprv;
 
1204         PAL_CALL(iprv, PAL_MC_EXPECTED, expected, 0, 0);
 
1206                 *previous = iprv.v0;
 
1210 /* Register a platform dependent location with PAL to which it can save
 
1211  * minimal processor state in the event of a machine check or initialization
 
1215 ia64_pal_mc_register_mem (u64 physical_addr)
 
1217         struct ia64_pal_retval iprv;
 
1218         PAL_CALL(iprv, PAL_MC_REGISTER_MEM, physical_addr, 0, 0);
 
1222 /* Restore minimal architectural processor state, set CMC interrupt if necessary
 
1223  * and resume execution
 
1226 ia64_pal_mc_resume (u64 set_cmci, u64 save_ptr)
 
1228         struct ia64_pal_retval iprv;
 
1229         PAL_CALL(iprv, PAL_MC_RESUME, set_cmci, save_ptr, 0);
 
1233 /* Return the memory attributes implemented by the processor */
 
1235 ia64_pal_mem_attrib (u64 *mem_attrib)
 
1237         struct ia64_pal_retval iprv;
 
1238         PAL_CALL(iprv, PAL_MEM_ATTRIB, 0, 0, 0);
 
1240                 *mem_attrib = iprv.v0 & 0xff;
 
1244 /* Return the amount of memory needed for second phase of processor
 
1245  * self-test and the required alignment of memory.
 
1248 ia64_pal_mem_for_test (u64 *bytes_needed, u64 *alignment)
 
1250         struct ia64_pal_retval iprv;
 
1251         PAL_CALL(iprv, PAL_MEM_FOR_TEST, 0, 0, 0);
 
1253                 *bytes_needed = iprv.v0;
 
1255                 *alignment = iprv.v1;
 
1259 typedef union pal_perf_mon_info_u {
 
1267         } pal_perf_mon_info_s;
 
1268 } pal_perf_mon_info_u_t;
 
1270 /* Return the performance monitor information about what can be counted
 
1271  * and how to configure the monitors to count the desired events.
 
1274 ia64_pal_perf_mon_info (u64 *pm_buffer, pal_perf_mon_info_u_t *pm_info)
 
1276         struct ia64_pal_retval iprv;
 
1277         PAL_CALL(iprv, PAL_PERF_MON_INFO, (unsigned long) pm_buffer, 0, 0);
 
1279                 pm_info->ppmi_data = iprv.v0;
 
1283 /* Specifies the physical address of the processor interrupt block
 
1284  * and I/O port space.
 
1287 ia64_pal_platform_addr (u64 type, u64 physical_addr)
 
1289         struct ia64_pal_retval iprv;
 
1290         PAL_CALL(iprv, PAL_PLATFORM_ADDR, type, physical_addr, 0);
 
1294 /* Set the SAL PMI entrypoint in memory */
 
1296 ia64_pal_pmi_entrypoint (u64 sal_pmi_entry_addr)
 
1298         struct ia64_pal_retval iprv;
 
1299         PAL_CALL(iprv, PAL_PMI_ENTRYPOINT, sal_pmi_entry_addr, 0, 0);
 
1303 struct pal_features_s;
 
1304 /* Provide information about configurable processor features */
 
1306 ia64_pal_proc_get_features (u64 *features_avail,
 
1307                             u64 *features_status,
 
1308                             u64 *features_control)
 
1310         struct ia64_pal_retval iprv;
 
1311         PAL_CALL_PHYS(iprv, PAL_PROC_GET_FEATURES, 0, 0, 0);
 
1312         if (iprv.status == 0) {
 
1313                 *features_avail   = iprv.v0;
 
1314                 *features_status  = iprv.v1;
 
1315                 *features_control = iprv.v2;
 
1320 /* Enable/disable processor dependent features */
 
1322 ia64_pal_proc_set_features (u64 feature_select)
 
1324         struct ia64_pal_retval iprv;
 
1325         PAL_CALL_PHYS(iprv, PAL_PROC_SET_FEATURES, feature_select, 0, 0);
 
1330  * Put everything in a struct so we avoid the global offset table whenever
 
1333 typedef struct ia64_ptce_info_s {
 
1339 /* Return the information required for the architected loop used to purge
 
1340  * (initialize) the entire TC
 
1343 ia64_get_ptce (ia64_ptce_info_t *ptce)
 
1345         struct ia64_pal_retval iprv;
 
1350         PAL_CALL(iprv, PAL_PTCE_INFO, 0, 0, 0);
 
1351         if (iprv.status == 0) {
 
1352                 ptce->base = iprv.v0;
 
1353                 ptce->count[0] = iprv.v1 >> 32;
 
1354                 ptce->count[1] = iprv.v1 & 0xffffffff;
 
1355                 ptce->stride[0] = iprv.v2 >> 32;
 
1356                 ptce->stride[1] = iprv.v2 & 0xffffffff;
 
1361 /* Return info about implemented application and control registers. */
 
1363 ia64_pal_register_info (u64 info_request, u64 *reg_info_1, u64 *reg_info_2)
 
1365         struct ia64_pal_retval iprv;
 
1366         PAL_CALL(iprv, PAL_REGISTER_INFO, info_request, 0, 0);
 
1368                 *reg_info_1 = iprv.v0;
 
1370                 *reg_info_2 = iprv.v1;
 
1374 typedef union pal_hints_u {
 
1383 /* Return information about the register stack and RSE for this processor
 
1387 ia64_pal_rse_info (u64 *num_phys_stacked, pal_hints_u_t *hints)
 
1389         struct ia64_pal_retval iprv;
 
1390         PAL_CALL(iprv, PAL_RSE_INFO, 0, 0, 0);
 
1391         if (num_phys_stacked)
 
1392                 *num_phys_stacked = iprv.v0;
 
1394                 hints->ph_data = iprv.v1;
 
1398 /* Cause the processor to enter SHUTDOWN state, where prefetching and execution are
 
1399  * suspended, but cause cache and TLB coherency to be maintained.
 
1400  * This is usually called in IA-32 mode.
 
1403 ia64_pal_shutdown (void)
 
1405         struct ia64_pal_retval iprv;
 
1406         PAL_CALL(iprv, PAL_SHUTDOWN, 0, 0, 0);
 
1410 /* Perform the second phase of processor self-test. */
 
1412 ia64_pal_test_proc (u64 test_addr, u64 test_size, u64 attributes, u64 *self_test_state)
 
1414         struct ia64_pal_retval iprv;
 
1415         PAL_CALL(iprv, PAL_TEST_PROC, test_addr, test_size, attributes);
 
1416         if (self_test_state)
 
1417                 *self_test_state = iprv.v0;
 
1421 typedef union  pal_version_u {
 
1422         u64     pal_version_val;
 
1424                 u64     pv_pal_b_rev            :       8;
 
1425                 u64     pv_pal_b_model          :       8;
 
1426                 u64     pv_reserved1            :       8;
 
1427                 u64     pv_pal_vendor           :       8;
 
1428                 u64     pv_pal_a_rev            :       8;
 
1429                 u64     pv_pal_a_model          :       8;
 
1430                 u64     pv_reserved2            :       16;
 
1435 /* Return PAL version information */
 
1437 ia64_pal_version (pal_version_u_t *pal_min_version, pal_version_u_t *pal_cur_version)
 
1439         struct ia64_pal_retval iprv;
 
1440         PAL_CALL_PHYS(iprv, PAL_VERSION, 0, 0, 0);
 
1441         if (pal_min_version)
 
1442                 pal_min_version->pal_version_val = iprv.v0;
 
1444         if (pal_cur_version)
 
1445                 pal_cur_version->pal_version_val = iprv.v1;
 
1450 typedef union pal_tc_info_u {
 
1463 #define tc_reduce_tr            pal_tc_info_s.reduce_tr
 
1464 #define tc_unified              pal_tc_info_s.unified
 
1465 #define tc_pf                   pal_tc_info_s.pf
 
1466 #define tc_num_entries          pal_tc_info_s.num_entries
 
1467 #define tc_associativity        pal_tc_info_s.associativity
 
1468 #define tc_num_sets             pal_tc_info_s.num_sets
 
1471 /* Return information about the virtual memory characteristics of the processor
 
1475 ia64_pal_vm_info (u64 tc_level, u64 tc_type,  pal_tc_info_u_t *tc_info, u64 *tc_pages)
 
1477         struct ia64_pal_retval iprv;
 
1478         PAL_CALL(iprv, PAL_VM_INFO, tc_level, tc_type, 0);
 
1480                 tc_info->pti_val = iprv.v0;
 
1482                 *tc_pages = iprv.v1;
 
1486 /* Get page size information about the virtual memory characteristics of the processor
 
1490 ia64_pal_vm_page_size (u64 *tr_pages, u64 *vw_pages)
 
1492         struct ia64_pal_retval iprv;
 
1493         PAL_CALL(iprv, PAL_VM_PAGE_SIZE, 0, 0, 0);
 
1495                 *tr_pages = iprv.v0;
 
1497                 *vw_pages = iprv.v1;
 
1501 typedef union pal_vm_info_1_u {
 
1514 } pal_vm_info_1_u_t;
 
1516 typedef union pal_vm_info_2_u {
 
1519                 u64             impl_va_msb     : 8,
 
1523 } pal_vm_info_2_u_t;
 
1525 /* Get summary information about the virtual memory characteristics of the processor
 
1529 ia64_pal_vm_summary (pal_vm_info_1_u_t *vm_info_1, pal_vm_info_2_u_t *vm_info_2)
 
1531         struct ia64_pal_retval iprv;
 
1532         PAL_CALL(iprv, PAL_VM_SUMMARY, 0, 0, 0);
 
1534                 vm_info_1->pvi1_val = iprv.v0;
 
1536                 vm_info_2->pvi2_val = iprv.v1;
 
1540 typedef union pal_itr_valid_u {
 
1543                u64              access_rights_valid     : 1,
 
1544                                 priv_level_valid        : 1,
 
1545                                 dirty_bit_valid         : 1,
 
1551 /* Read a translation register */
 
1553 ia64_pal_tr_read (u64 reg_num, u64 tr_type, u64 *tr_buffer, pal_tr_valid_u_t *tr_valid)
 
1555         struct ia64_pal_retval iprv;
 
1556         PAL_CALL_PHYS_STK(iprv, PAL_VM_TR_READ, reg_num, tr_type,(u64)ia64_tpa(tr_buffer));
 
1558                 tr_valid->piv_val = iprv.v0;
 
1563  * PAL_PREFETCH_VISIBILITY transaction types
 
1565 #define PAL_VISIBILITY_VIRTUAL          0
 
1566 #define PAL_VISIBILITY_PHYSICAL         1
 
1569  * PAL_PREFETCH_VISIBILITY return codes
 
1571 #define PAL_VISIBILITY_OK               1
 
1572 #define PAL_VISIBILITY_OK_REMOTE_NEEDED 0
 
1573 #define PAL_VISIBILITY_INVAL_ARG        -2
 
1574 #define PAL_VISIBILITY_ERROR            -3
 
1577 ia64_pal_prefetch_visibility (s64 trans_type)
 
1579         struct ia64_pal_retval iprv;
 
1580         PAL_CALL(iprv, PAL_PREFETCH_VISIBILITY, trans_type, 0, 0);
 
1584 /* data structure for getting information on logical to physical mappings */
 
1585 typedef union pal_log_overview_u {
 
1587                 u64     num_log         :16,    /* Total number of logical
 
1588                                                  * processors on this die
 
1590                         tpc             :8,     /* Threads per core */
 
1591                         reserved3       :8,     /* Reserved */
 
1592                         cpp             :8,     /* Cores per processor */
 
1593                         reserved2       :8,     /* Reserved */
 
1594                         ppid            :8,     /* Physical processor ID */
 
1595                         reserved1       :8;     /* Reserved */
 
1598 } pal_log_overview_t;
 
1600 typedef union pal_proc_n_log_info1_u{
 
1602                 u64     tid             :16,    /* Thread id */
 
1603                         reserved2       :16,    /* Reserved */
 
1604                         cid             :16,    /* Core id */
 
1605                         reserved1       :16;    /* Reserved */
 
1608 } pal_proc_n_log_info1_t;
 
1610 typedef union pal_proc_n_log_info2_u {
 
1612                 u64     la              :16,    /* Logical address */
 
1613                         reserved        :48;    /* Reserved */
 
1616 } pal_proc_n_log_info2_t;
 
1618 typedef struct pal_logical_to_physical_s
 
1620         pal_log_overview_t overview;
 
1621         pal_proc_n_log_info1_t ppli1;
 
1622         pal_proc_n_log_info2_t ppli2;
 
1623 } pal_logical_to_physical_t;
 
1625 #define overview_num_log        overview.overview_bits.num_log
 
1626 #define overview_tpc            overview.overview_bits.tpc
 
1627 #define overview_cpp            overview.overview_bits.cpp
 
1628 #define overview_ppid           overview.overview_bits.ppid
 
1629 #define log1_tid                ppli1.ppli1_bits.tid
 
1630 #define log1_cid                ppli1.ppli1_bits.cid
 
1631 #define log2_la                 ppli2.ppli2_bits.la
 
1633 /* Get information on logical to physical processor mappings. */
 
1635 ia64_pal_logical_to_phys(u64 proc_number, pal_logical_to_physical_t *mapping)
 
1637         struct ia64_pal_retval iprv;
 
1639         PAL_CALL(iprv, PAL_LOGICAL_TO_PHYSICAL, proc_number, 0, 0);
 
1641         if (iprv.status == PAL_STATUS_SUCCESS)
 
1643                 if (proc_number == 0)
 
1644                         mapping->overview.overview_data = iprv.v0;
 
1645                 mapping->ppli1.ppli1_data = iprv.v1;
 
1646                 mapping->ppli2.ppli2_data = iprv.v2;
 
1651 #endif /* __ASSEMBLY__ */
 
1653 #endif /* _ASM_IA64_PAL_H */