make oldconfig will rebuild these...
[linux-2.4.21-pre4.git] / include / asm-ia64 / sal.h
1 #ifndef _ASM_IA64_SAL_H
2 #define _ASM_IA64_SAL_H
3
4 /*
5  * System Abstraction Layer definitions.
6  *
7  * This is based on version 2.5 of the manual "IA-64 System
8  * Abstraction Layer".
9  *
10  * Copyright (C) 2001 Intel
11  * Copyright (C) 2002 Jenna Hall <jenna.s.hall@intel.com>
12  * Copyright (C) 2001 Fred Lewis <frederick.v.lewis@intel.com>
13  * Copyright (C) 1998, 1999, 2001 Hewlett-Packard Co
14  * Copyright (C) 1998, 1999, 2001 David Mosberger-Tang <davidm@hpl.hp.com>
15  * Copyright (C) 1999 Srinivasa Prasad Thirumalachar <sprasad@sprasad.engr.sgi.com>
16  *
17  * 02/01/04 J. Hall Updated Error Record Structures to conform to July 2001
18  *                  revision of the SAL spec.
19  * 01/01/03 fvlewis Updated Error Record Structures to conform with Nov. 2000
20  *                  revision of the SAL spec.
21  * 99/09/29 davidm      Updated for SAL 2.6.
22  * 00/03/29 cfleck      Updated SAL Error Logging info for processor (SAL 2.6) 
23  *                      (plus examples of platform error info structures from smariset @ Intel)
24  */
25
26 #include <linux/spinlock.h>
27 #include <linux/efi.h>
28
29 #include <asm/pal.h>
30 #include <asm/system.h>
31 #include <asm/fpu.h>
32
33 extern spinlock_t sal_lock;
34
35 /* SAL spec _requires_ eight args for each call. */
36 #define __SAL_CALL(result,a0,a1,a2,a3,a4,a5,a6,a7)      \
37         result = (*ia64_sal)(a0,a1,a2,a3,a4,a5,a6,a7)
38
39 # define SAL_CALL(result,args...) do {                  \
40         unsigned long flags;                            \
41         struct ia64_fpreg fr[6];                        \
42         ia64_save_scratch_fpregs(fr);                   \
43         spin_lock_irqsave(&sal_lock, flags);            \
44         __SAL_CALL(result,args);                        \
45         spin_unlock_irqrestore(&sal_lock, flags);       \
46         ia64_load_scratch_fpregs(fr);                   \
47 } while (0)
48
49 #define SAL_SET_VECTORS                 0x01000000
50 #define SAL_GET_STATE_INFO              0x01000001
51 #define SAL_GET_STATE_INFO_SIZE         0x01000002
52 #define SAL_CLEAR_STATE_INFO            0x01000003
53 #define SAL_MC_RENDEZ                   0x01000004
54 #define SAL_MC_SET_PARAMS               0x01000005
55 #define SAL_REGISTER_PHYSICAL_ADDR      0x01000006
56
57 #define SAL_CACHE_FLUSH                 0x01000008
58 #define SAL_CACHE_INIT                  0x01000009
59 #define SAL_PCI_CONFIG_READ             0x01000010
60 #define SAL_PCI_CONFIG_WRITE            0x01000011
61 #define SAL_FREQ_BASE                   0x01000012
62
63 #define SAL_UPDATE_PAL                  0x01000020
64
65 struct ia64_sal_retval {
66         /*
67          * A zero status value indicates call completed without error.
68          * A negative status value indicates reason of call failure.
69          * A positive status value indicates success but an
70          * informational value should be printed (e.g., "reboot for
71          * change to take effect").
72          */
73         s64 status;
74         u64 v0;
75         u64 v1;
76         u64 v2;
77 };
78
79 typedef struct ia64_sal_retval (*ia64_sal_handler) (u64, ...);
80
81 enum {
82         SAL_FREQ_BASE_PLATFORM = 0,
83         SAL_FREQ_BASE_INTERVAL_TIMER = 1,
84         SAL_FREQ_BASE_REALTIME_CLOCK = 2
85 };
86
87 /*
88  * The SAL system table is followed by a variable number of variable
89  * length descriptors.  The structure of these descriptors follows
90  * below.
91  * The defininition follows SAL specs from July 2000
92  */
93 struct ia64_sal_systab {
94         u8 signature[4];        /* should be "SST_" */
95         u32 size;               /* size of this table in bytes */
96         u8 sal_rev_minor;
97         u8 sal_rev_major;
98         u16 entry_count;        /* # of entries in variable portion */
99         u8 checksum;
100         u8 reserved1[7];
101         u8 sal_a_rev_minor;
102         u8 sal_a_rev_major;
103         u8 sal_b_rev_minor;
104         u8 sal_b_rev_major;
105         /* oem_id & product_id: terminating NUL is missing if string is exactly 32 bytes long. */
106         u8 oem_id[32];
107         u8 product_id[32];      /* ASCII product id  */
108         u8 reserved2[8];
109 };
110
111 enum sal_systab_entry_type {
112         SAL_DESC_ENTRY_POINT = 0,
113         SAL_DESC_MEMORY = 1,
114         SAL_DESC_PLATFORM_FEATURE = 2,
115         SAL_DESC_TR = 3,
116         SAL_DESC_PTC = 4,
117         SAL_DESC_AP_WAKEUP = 5
118 };
119
120 /*
121  * Entry type:  Size:
122  *      0       48
123  *      1       32
124  *      2       16
125  *      3       32
126  *      4       16
127  *      5       16
128  */
129 #define SAL_DESC_SIZE(type)     "\060\040\020\040\020\020"[(unsigned) type]
130
131 typedef struct ia64_sal_desc_entry_point {
132         u8 type;
133         u8 reserved1[7];
134         u64 pal_proc;
135         u64 sal_proc;
136         u64 gp;
137         u8 reserved2[16];
138 }ia64_sal_desc_entry_point_t;
139
140 typedef struct ia64_sal_desc_memory {
141         u8 type;
142         u8 used_by_sal; /* needs to be mapped for SAL? */
143         u8 mem_attr;            /* current memory attribute setting */
144         u8 access_rights;       /* access rights set up by SAL */
145         u8 mem_attr_mask;       /* mask of supported memory attributes */
146         u8 reserved1;
147         u8 mem_type;            /* memory type */
148         u8 mem_usage;           /* memory usage */
149         u64 addr;               /* physical address of memory */
150         u32 length;     /* length (multiple of 4KB pages) */
151         u32 reserved2;
152         u8 oem_reserved[8];
153 } ia64_sal_desc_memory_t;
154
155 #define IA64_SAL_PLATFORM_FEATURE_BUS_LOCK              (1 << 0)
156 #define IA64_SAL_PLATFORM_FEATURE_IRQ_REDIR_HINT        (1 << 1)
157 #define IA64_SAL_PLATFORM_FEATURE_IPI_REDIR_HINT        (1 << 2)
158 #define IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT             (1 << 3)
159
160 typedef struct ia64_sal_desc_platform_feature {
161         u8 type;
162         u8 feature_mask;
163         u8 reserved1[14];
164 } ia64_sal_desc_platform_feature_t;
165
166 typedef struct ia64_sal_desc_tr {
167         u8 type;
168         u8 tr_type;             /* 0 == instruction, 1 == data */
169         u8 regnum;              /* translation register number */
170         u8 reserved1[5];
171         u64 addr;               /* virtual address of area covered */
172         u64 page_size;          /* encoded page size */
173         u8 reserved2[8];
174 } ia64_sal_desc_tr_t;
175
176 typedef struct ia64_sal_desc_ptc {
177         u8 type;
178         u8 reserved1[3];
179         u32 num_domains;        /* # of coherence domains */
180         u64 domain_info;        /* physical address of domain info table */
181 } ia64_sal_desc_ptc_t;
182
183 typedef struct ia64_sal_ptc_domain_info {
184         u64 proc_count;         /* number of processors in domain */
185         u64 proc_list;          /* physical address of LID array */
186 } ia64_sal_ptc_domain_info_t;
187
188 typedef struct ia64_sal_ptc_domain_proc_entry {
189         u64 id  : 8;            /* id of processor */
190         u64 eid : 8;            /* eid of processor */
191 } ia64_sal_ptc_domain_proc_entry_t;
192
193
194 #define IA64_SAL_AP_EXTERNAL_INT 0
195
196 typedef struct ia64_sal_desc_ap_wakeup {
197         u8 type;
198         u8 mechanism;           /* 0 == external interrupt */
199         u8 reserved1[6];
200         u64 vector;             /* interrupt vector in range 0x10-0xff */
201 } ia64_sal_desc_ap_wakeup_t ;
202
203 extern ia64_sal_handler ia64_sal;
204 extern struct ia64_sal_desc_ptc *ia64_ptc_domain_info;
205
206 extern const char *ia64_sal_strerror (long status);
207 extern void ia64_sal_init (struct ia64_sal_systab *sal_systab);
208
209 /* SAL information type encodings */
210 enum {
211         SAL_INFO_TYPE_MCA       =               0,      /* Machine check abort information */
212         SAL_INFO_TYPE_INIT      =               1,      /* Init information */
213         SAL_INFO_TYPE_CMC   =       2,  /* Corrected machine check information */
214         SAL_INFO_TYPE_CPE   =       3   /* Corrected platform error information */
215 };
216
217 /* Encodings for machine check parameter types */
218 enum {
219         SAL_MC_PARAM_RENDEZ_INT         =       1,      /* Rendezevous interrupt */
220         SAL_MC_PARAM_RENDEZ_WAKEUP  =   2,  /* Wakeup */
221         SAL_MC_PARAM_CPE_INT        =   3   /* Corrected Platform Error Int */
222 };
223
224 /* Encodings for rendezvous mechanisms */
225 enum {
226         SAL_MC_PARAM_MECHANISM_INT      =       1,      /* Use interrupt */
227         SAL_MC_PARAM_MECHANISM_MEM      =       2       /* Use memory synchronization variable*/
228 };
229
230 /* Encodings for vectors which can be registered by the OS with SAL */
231 enum {
232         SAL_VECTOR_OS_MCA               = 0,
233         SAL_VECTOR_OS_INIT              = 1,
234         SAL_VECTOR_OS_BOOT_RENDEZ       = 2
235 };
236
237 /* Encodings for mca_opt parameter sent to SAL_MC_SET_PARAMS */
238 #define SAL_MC_PARAM_RZ_ALWAYS          0x1
239 #define SAL_MC_PARAM_BINIT_ESCALATE     0x10
240
241 /*
242 ** Definition of the SAL Error Log from the SAL spec
243 */
244
245 /* SAL Error Record Section GUID Definitions */
246 #define SAL_PROC_DEV_ERR_SECT_GUID  \
247     EFI_GUID ( 0xe429faf1, 0x3cb7, 0x11d4,  0xbc, 0xa7, 0x0, 0x80, \
248                     0xc7, 0x3c, 0x88, 0x81 )
249 #define SAL_PLAT_MEM_DEV_ERR_SECT_GUID  \
250     EFI_GUID(  0xe429faf2, 0x3cb7, 0x11d4,  0xbc, 0xa7, 0x0, 0x80, \
251                     0xc7, 0x3c, 0x88, 0x81 )
252 #define SAL_PLAT_SEL_DEV_ERR_SECT_GUID  \
253     EFI_GUID(  0xe429faf3, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
254                     0xc7, 0x3c, 0x88, 0x81 )
255 #define SAL_PLAT_PCI_BUS_ERR_SECT_GUID  \
256     EFI_GUID(  0xe429faf4, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
257                     0xc7, 0x3c, 0x88, 0x81 )
258 #define SAL_PLAT_SMBIOS_DEV_ERR_SECT_GUID  \
259     EFI_GUID(  0xe429faf5, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
260                     0xc7, 0x3c, 0x88, 0x81 )
261 #define SAL_PLAT_PCI_COMP_ERR_SECT_GUID  \
262     EFI_GUID(  0xe429faf6, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
263                     0xc7, 0x3c, 0x88, 0x81 )
264 #define SAL_PLAT_SPECIFIC_ERR_SECT_GUID  \
265     EFI_GUID(  0xe429faf7, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
266                     0xc7, 0x3c, 0x88, 0x81 )
267 #define SAL_PLAT_HOST_CTLR_ERR_SECT_GUID  \
268     EFI_GUID(  0xe429faf8, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
269                     0xc7, 0x3c, 0x88, 0x81 )
270 #define SAL_PLAT_BUS_ERR_SECT_GUID  \
271     EFI_GUID(  0xe429faf9, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
272                     0xc7, 0x3c, 0x88, 0x81 )
273
274 #define MAX_CACHE_ERRORS                        6
275 #define MAX_TLB_ERRORS                          6
276 #define MAX_BUS_ERRORS                          1
277
278 /* Definition of version  according to SAL spec for logging purposes */
279 typedef struct sal_log_revision
280 {
281     u8  minor;              /* BCD (0..99) */
282     u8  major;              /* BCD (0..99) */
283 } sal_log_revision_t;
284
285 /* Definition of timestamp according to SAL spec for logging purposes */
286 typedef struct sal_log_timestamp
287 {
288         u8 slh_second;          /* Second (0..59) */
289     u8 slh_minute;      /* Minute (0..59) */
290     u8 slh_hour;        /* Hour (0..23) */
291     u8 slh_reserved;
292     u8 slh_day;         /* Day (1..31) */
293     u8 slh_month;       /* Month (1..12) */
294     u8 slh_year;        /* Year (00..99) */
295     u8 slh_century;     /* Century (19, 20, 21, ...) */
296 } sal_log_timestamp_t;
297
298 /* Definition of log record  header structures */
299 typedef struct sal_log_record_header
300 {
301     u64                 id;             /* Unique monotonically increasing ID */
302     sal_log_revision_t  revision;       /* Major and Minor revision of header */
303     u16                 severity;       /* Error Severity */
304     u32                 len;            /* Length of this error log in bytes */
305     sal_log_timestamp_t timestamp;      /* Timestamp */
306     efi_guid_t          platform_guid;  /* Unique OEM Platform ID */
307 } sal_log_record_header_t;
308
309 /* Definition of log section header structures */
310 typedef struct sal_log_sec_header
311 {
312     efi_guid_t          guid;       /* Unique Section ID */
313     sal_log_revision_t  revision;   /* Major and Minor revision of Section */
314     u16                 reserved;
315     u32                 len;        /* Section length */
316 } sal_log_section_hdr_t;
317
318 typedef struct sal_log_mod_error_info
319 {
320     struct
321     {
322         u64 check_info              : 1,
323             requestor_identifier    : 1,
324             responder_identifier    : 1,
325             target_identifier       : 1,
326             precise_ip              : 1,
327             reserved                : 59;
328     } valid;
329     u64 check_info;
330     u64 requestor_identifier;
331     u64 responder_identifier;
332     u64 target_identifier;
333     u64 precise_ip;
334 } sal_log_mod_error_info_t;
335
336 typedef struct sal_processor_static_info
337 {
338     struct
339     {
340         u64 minstate        : 1,
341             br              : 1,
342             cr              : 1,
343             ar              : 1,
344             rr              : 1,
345             fr              : 1,
346             reserved        : 58;
347     } valid;
348     pal_min_state_area_t    min_state_area;
349     u64                     br[8];
350     u64                     cr[128];
351     u64                     ar[128];
352     u64                     rr[8];
353     struct ia64_fpreg       fr[128];
354 } sal_processor_static_info_t;
355
356 typedef struct sal_log_processor_info
357 {
358     sal_log_section_hdr_t       header;
359     struct
360     {
361         u64 proc_error_map      : 1,
362             proc_state_param    : 1,
363             proc_cr_lid         : 1,
364             psi_static_struct   : 1,
365             num_cache_check     : 4,
366             num_tlb_check       : 4,
367             num_bus_check       : 4,
368             num_reg_file_check  : 4,
369             num_ms_check        : 4,
370             cpuid_info          : 1,
371             reserved1           : 39;
372     } valid;
373     u64                         proc_error_map;
374     u64                         proc_state_parameter;
375     u64                         proc_cr_lid;
376     sal_log_mod_error_info_t    cache_check_info[16];
377     sal_log_mod_error_info_t    tlb_check_info[16];
378     sal_log_mod_error_info_t    bus_check_info[16];
379     sal_log_mod_error_info_t    reg_file_check_info[16];
380     sal_log_mod_error_info_t    ms_check_info[16];
381     struct
382     {
383         u64 regs[5];
384         u64 reserved;
385     } cpuid_info;
386     sal_processor_static_info_t processor_static_info;
387 } sal_log_processor_info_t;
388
389 /* platform error log structures */
390
391 typedef struct sal_log_mem_dev_err_info
392 {
393     sal_log_section_hdr_t   header;
394     struct
395     {
396         u64 error_status    : 1,
397             physical_addr   : 1,
398             addr_mask       : 1,
399             node            : 1,
400             card            : 1,
401             module          : 1,
402             bank            : 1,
403             device          : 1,
404             row             : 1,
405             column          : 1,
406             bit_position    : 1,
407             requestor_id    : 1,
408             responder_id    : 1,
409             target_id       : 1,
410             bus_spec_data   : 1,
411             oem_id          : 1,
412             oem_data        : 1,
413             reserved        : 47;
414     } valid;
415     u64             error_status;
416     u64             physical_addr;
417     u64             addr_mask;
418     u16             node;
419     u16             card;
420     u16             module;
421     u16             bank;
422     u16             device;
423     u16             row;
424     u16             column;
425     u16             bit_position;
426     u64             requestor_id;
427     u64             responder_id;
428     u64             target_id;
429     u64             bus_spec_data;
430     u8              oem_id[16];
431     u8              oem_data[1];        /* Variable length data */
432 } sal_log_mem_dev_err_info_t;
433
434 typedef struct sal_log_sel_dev_err_info
435 {
436     sal_log_section_hdr_t   header;
437     struct
438     {
439         u64 record_id       : 1,
440             record_type     : 1,
441             generator_id    : 1,
442             evm_rev         : 1,
443             sensor_type     : 1,
444             sensor_num      : 1,
445             event_dir       : 1,
446             event_data1     : 1,
447             event_data2     : 1,
448             event_data3     : 1,
449             reserved        : 54;
450     } valid;
451     u16             record_id;
452     u8              record_type;
453     u8              timestamp[4];
454     u16             generator_id;
455     u8              evm_rev;
456     u8              sensor_type;
457     u8              sensor_num;
458     u8              event_dir;
459     u8              event_data1;
460     u8              event_data2;
461     u8              event_data3;
462 } sal_log_sel_dev_err_info_t;
463
464 typedef struct sal_log_pci_bus_err_info
465 {
466     sal_log_section_hdr_t   header;
467     struct
468     {
469         u64 err_status      : 1,
470             err_type        : 1,
471             bus_id          : 1,
472             bus_address     : 1,
473             bus_data        : 1,
474             bus_cmd         : 1,
475             requestor_id    : 1,
476             responder_id    : 1,
477             target_id       : 1,
478             oem_data        : 1,
479             reserved        : 54;
480     } valid;
481     u64             err_status;
482     u16             err_type;
483     u16             bus_id;
484     u32             reserved;
485     u64             bus_address;
486     u64             bus_data;
487     u64             bus_cmd;
488     u64             requestor_id;
489     u64             responder_id;
490     u64             target_id;
491     u8              oem_data[1];        /* Variable length data */
492 } sal_log_pci_bus_err_info_t;
493
494 typedef struct sal_log_smbios_dev_err_info
495 {
496     sal_log_section_hdr_t   header;
497     struct
498     {
499         u64 event_type      : 1,
500             length          : 1,
501             time_stamp      : 1,
502             data            : 1,
503             reserved1       : 60;
504     } valid;
505     u8              event_type;
506     u8              length;
507     u8              time_stamp[6];
508     u8              data[1];  // data of variable length, length == slsmb_length
509 } sal_log_smbios_dev_err_info_t;
510
511 typedef struct sal_log_pci_comp_err_info
512 {
513     sal_log_section_hdr_t   header;
514     struct
515     {
516         u64 err_status      : 1,
517             comp_info       : 1,
518             num_mem_regs    : 1,
519             num_io_regs     : 1,
520             reg_data_pairs  : 1,
521             oem_data        : 1,
522             reserved        : 58;
523     } valid;
524     u64             err_status;
525     struct
526     {
527         u16 vendor_id;
528         u16 device_id;
529         u8  class_code[3];
530         u8  func_num;
531         u8  dev_num;
532         u8  bus_num;
533         u8  seg_num;
534         u8  reserved[5];
535     }               comp_info;
536     u32             num_mem_regs;
537     u32             num_io_regs;
538     u64             reg_data_pairs[1];
539     /* array of address/data register pairs is num_mem_regs + num_io_regs
540        elements long.  Each array element consists of a u64 address followed
541        by a u64 data value.  The oem_data array immediately follows the the
542        reg_data_pairs array */
543     u8              oem_data[1];        /* Variable length data */
544 } sal_log_pci_comp_err_info_t;
545
546 typedef struct sal_log_plat_specific_err_info
547 {
548     sal_log_section_hdr_t   header;
549     struct
550     {
551         u64 err_status      : 1,
552             guid            : 1,
553             oem_data        : 1,
554             reserved        : 61;
555     } valid;
556     u64             err_status;
557     efi_guid_t      guid;
558     u8              oem_data[1];      /* platform specific variable length data */
559 } sal_log_plat_specific_err_info_t;
560
561 typedef struct sal_log_host_ctlr_err_info
562 {
563     sal_log_section_hdr_t   header;
564     struct
565     {
566         u64 err_status      : 1,
567             requestor_id    : 1,
568             responder_id    : 1,
569             target_id       : 1,
570             bus_spec_data   : 1,
571             oem_data        : 1,
572             reserved        : 58;
573     } valid;
574     u64             err_status;
575     u64             requestor_id;
576     u64             responder_id;
577     u64             target_id;
578     u64             bus_spec_data;
579     u8              oem_data[1];        /* Variable length OEM data */
580 } sal_log_host_ctlr_err_info_t;
581
582 typedef struct sal_log_plat_bus_err_info
583 {
584     sal_log_section_hdr_t   header;
585     struct
586     {
587         u64 err_status      : 1,
588             requestor_id    : 1,
589             responder_id    : 1,
590             target_id       : 1,
591             bus_spec_data   : 1,
592             oem_data        : 1,
593             reserved        : 58;
594     } valid;
595     u64             err_status;
596     u64             requestor_id;
597     u64             responder_id;
598     u64             target_id;
599     u64             bus_spec_data;
600     u8              oem_data[1];        /* Variable length OEM data */
601 } sal_log_plat_bus_err_info_t;
602
603 /* Overall platform error section structure */
604 typedef union sal_log_platform_err_info
605 {
606     sal_log_mem_dev_err_info_t          mem_dev_err;
607     sal_log_sel_dev_err_info_t          sel_dev_err;
608     sal_log_pci_bus_err_info_t          pci_bus_err;
609     sal_log_smbios_dev_err_info_t       smbios_dev_err;
610     sal_log_pci_comp_err_info_t         pci_comp_err;
611     sal_log_plat_specific_err_info_t    plat_specific_err;
612     sal_log_host_ctlr_err_info_t        host_ctlr_err;
613     sal_log_plat_bus_err_info_t         plat_bus_err;
614 } sal_log_platform_err_info_t;
615
616 /* SAL log over-all, multi-section error record structure (processor+platform) */
617 typedef struct err_rec
618 {
619     sal_log_record_header_t     sal_elog_header;
620     sal_log_processor_info_t    proc_err;
621     sal_log_platform_err_info_t plat_err;
622     u8                          oem_data_pad[1024];
623 } ia64_err_rec_t;
624
625 /*
626  * Now define a couple of inline functions for improved type checking
627  * and convenience.
628  */
629 static inline long
630 ia64_sal_freq_base (unsigned long which, unsigned long *ticks_per_second,
631                     unsigned long *drift_info)
632 {
633         struct ia64_sal_retval isrv;
634
635         SAL_CALL(isrv, SAL_FREQ_BASE, which, 0, 0, 0, 0, 0, 0);
636         *ticks_per_second = isrv.v0;
637         *drift_info = isrv.v1;
638         return isrv.status;
639 }
640
641 /* Flush all the processor and platform level instruction and/or data caches */
642 static inline s64
643 ia64_sal_cache_flush (u64 cache_type)
644 {
645         struct ia64_sal_retval isrv;
646         SAL_CALL(isrv, SAL_CACHE_FLUSH, cache_type, 0, 0, 0, 0, 0, 0);
647         return isrv.status;
648 }
649
650
651         
652 /* Initialize all the processor and platform level instruction and data caches */
653 static inline s64
654 ia64_sal_cache_init (void)
655 {
656         struct ia64_sal_retval isrv;
657         SAL_CALL(isrv, SAL_CACHE_INIT, 0, 0, 0, 0, 0, 0, 0);
658         return isrv.status;
659 }
660
661 /* Clear the processor and platform information logged by SAL with respect to the 
662  * machine state at the time of MCA's, INITs, CMCs, or CPEs.
663  */
664 static inline s64
665 ia64_sal_clear_state_info (u64 sal_info_type)
666 {
667         struct ia64_sal_retval isrv;
668     SAL_CALL(isrv, SAL_CLEAR_STATE_INFO, sal_info_type, 0,
669              0, 0, 0, 0, 0);
670         return isrv.status;
671 }
672
673
674 /* Get the processor and platform information logged by SAL with respect to the machine
675  * state at the time of the MCAs, INITs, CMCs, or CPEs.
676  */
677 static inline u64
678 ia64_sal_get_state_info (u64 sal_info_type, u64 *sal_info)
679 {
680         struct ia64_sal_retval isrv;
681         SAL_CALL(isrv, SAL_GET_STATE_INFO, sal_info_type, 0,
682                  sal_info, 0, 0, 0, 0);
683         if (isrv.status)
684                 return 0;
685
686         return isrv.v0;
687 }       
688 /* Get the maximum size of the information logged by SAL with respect to the machine 
689  * state at the time of MCAs, INITs, CMCs, or CPEs.
690  */
691 static inline u64
692 ia64_sal_get_state_info_size (u64 sal_info_type)
693 {
694         struct ia64_sal_retval isrv;
695     SAL_CALL(isrv, SAL_GET_STATE_INFO_SIZE, sal_info_type, 0,
696              0, 0, 0, 0, 0);
697         if (isrv.status)
698                 return 0;
699         return isrv.v0;
700 }
701
702 /* Causes the processor to go into a spin loop within SAL where SAL awaits a wakeup
703  * from the monarch processor.
704  */
705 static inline s64
706 ia64_sal_mc_rendez (void)
707 {
708         struct ia64_sal_retval isrv;
709         SAL_CALL(isrv, SAL_MC_RENDEZ, 0, 0, 0, 0, 0, 0, 0);
710         return isrv.status;
711 }
712
713 /* Allow the OS to specify the interrupt number to be used by SAL to interrupt OS during
714  * the machine check rendezvous sequence as well as the mechanism to wake up the 
715  * non-monarch processor at the end of machine check processing.
716  */
717 static inline s64
718 ia64_sal_mc_set_params (u64 param_type, u64 i_or_m, u64 i_or_m_val, u64 timeout, u64 rz_always)
719 {
720         struct ia64_sal_retval isrv;
721         SAL_CALL(isrv, SAL_MC_SET_PARAMS, param_type, i_or_m, i_or_m_val, timeout, rz_always, 0, 0);
722         return isrv.status;
723 }
724
725 /* Read from PCI configuration space */
726 static inline s64
727 ia64_sal_pci_config_read (u64 pci_config_addr, u64 size, u64 *value)
728 {
729         struct ia64_sal_retval isrv;
730         SAL_CALL(isrv, SAL_PCI_CONFIG_READ, pci_config_addr, size, 0, 0, 0, 0, 0);
731         if (value)
732                 *value = isrv.v0;
733         return isrv.status;
734 }
735
736 /* Write to PCI configuration space */
737 static inline s64
738 ia64_sal_pci_config_write (u64 pci_config_addr, u64 size, u64 value)
739 {
740         struct ia64_sal_retval isrv;
741         SAL_CALL(isrv, SAL_PCI_CONFIG_WRITE, pci_config_addr, size, value,
742                  0, 0, 0, 0);
743         return isrv.status;
744 }
745
746 /*
747  * Register physical addresses of locations needed by SAL when SAL
748  * procedures are invoked in virtual mode.
749  */
750 static inline s64
751 ia64_sal_register_physical_addr (u64 phys_entry, u64 phys_addr)
752 {
753         struct ia64_sal_retval isrv;
754         SAL_CALL(isrv, SAL_REGISTER_PHYSICAL_ADDR, phys_entry, phys_addr,
755                  0, 0, 0, 0, 0);
756         return isrv.status;
757 }
758
759 /* Register software dependent code locations within SAL. These locations are handlers
760  * or entry points where SAL will pass control for the specified event. These event
761  * handlers are for the bott rendezvous, MCAs and INIT scenarios.
762  */
763 static inline s64
764 ia64_sal_set_vectors (u64 vector_type,
765                       u64 handler_addr1, u64 gp1, u64 handler_len1,
766                       u64 handler_addr2, u64 gp2, u64 handler_len2)
767 {
768         struct ia64_sal_retval isrv;
769         SAL_CALL(isrv, SAL_SET_VECTORS, vector_type,
770                         handler_addr1, gp1, handler_len1,
771                         handler_addr2, gp2, handler_len2);                      
772
773         return isrv.status;
774 }               
775 /* Update the contents of PAL block in the non-volatile storage device */
776 static inline s64
777 ia64_sal_update_pal (u64 param_buf, u64 scratch_buf, u64 scratch_buf_size,
778                      u64 *error_code, u64 *scratch_buf_size_needed)
779 {
780         struct ia64_sal_retval isrv;
781         SAL_CALL(isrv, SAL_UPDATE_PAL, param_buf, scratch_buf, scratch_buf_size,
782                  0, 0, 0, 0);
783         if (error_code)
784                 *error_code = isrv.v0;
785         if (scratch_buf_size_needed)
786                 *scratch_buf_size_needed = isrv.v1;
787         return isrv.status;
788 }
789
790 extern unsigned long sal_platform_features;
791
792 #endif /* _ASM_IA64_PAL_H */