2 * System Abstraction Layer (SAL) interface routines.
4 * Copyright (C) 1998, 1999, 2001, 2003 Hewlett-Packard Co
5 * David Mosberger-Tang <davidm@hpl.hp.com>
6 * Copyright (C) 1999 VA Linux Systems
7 * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
9 #include <linux/config.h>
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/smp.h>
14 #include <linux/spinlock.h>
15 #include <linux/string.h>
21 spinlock_t sal_lock __cacheline_aligned = SPIN_LOCK_UNLOCKED;
22 unsigned long sal_platform_features;
25 void *addr; /* function entry point */
26 void *gpval; /* gp value to use */
30 default_handler (void)
35 ia64_sal_handler ia64_sal = (ia64_sal_handler) default_handler;
36 ia64_sal_desc_ptc_t *ia64_ptc_domain_info;
39 ia64_sal_strerror (long status)
43 case 0: str = "Call completed without error"; break;
44 case 1: str = "Effect a warm boot of the system to complete "
46 case -1: str = "Not implemented"; break;
47 case -2: str = "Invalid argument"; break;
48 case -3: str = "Call completed with error"; break;
49 case -4: str = "Virtual address not registered"; break;
50 case -5: str = "No information available"; break;
51 case -6: str = "Insufficient space to add the entry"; break;
52 case -7: str = "Invalid entry_addr value"; break;
53 case -8: str = "Invalid interrupt vector"; break;
54 case -9: str = "Requested memory not available"; break;
55 case -10: str = "Unable to write to the NVM device"; break;
56 case -11: str = "Invalid partition type specified"; break;
57 case -12: str = "Invalid NVM_Object id specified"; break;
58 case -13: str = "NVM_Object already has the maximum number "
59 "of partitions"; break;
60 case -14: str = "Insufficient space in partition for the "
61 "requested write sub-function"; break;
62 case -15: str = "Insufficient data buffer space for the "
63 "requested read record sub-function"; break;
64 case -16: str = "Scratch buffer required for the write/delete "
65 "sub-function"; break;
66 case -17: str = "Insufficient space in the NVM_Object for the "
67 "requested create sub-function"; break;
68 case -18: str = "Invalid value specified in the partition_rec "
70 case -19: str = "Record oriented I/O not supported for this "
72 case -20: str = "Bad format of record to be written or "
73 "required keyword variable not "
75 default: str = "Unknown SAL status code"; break;
81 ia64_sal_handler_init (void *entry_point, void *gpval)
83 /* fill in the SAL procedure descriptor and point ia64_sal to it: */
84 pdesc.addr = entry_point;
86 ia64_sal = (ia64_sal_handler) &pdesc;
91 ia64_sal_init (struct ia64_sal_systab *systab)
93 unsigned long min, max;
95 struct ia64_sal_desc_entry_point *ep;
99 printk(KERN_WARNING "Hmm, no SAL System Table.\n");
103 if (strncmp(systab->signature, "SST_", 4) != 0)
104 printk(KERN_ERR "bad signature in system table!");
107 * revisions are coded in BCD, so %x does the job for us
109 printk(KERN_INFO "SAL v%x.%02x: oem=%.32s, product=%.32s\n",
110 systab->sal_rev_major, systab->sal_rev_minor,
111 systab->oem_id, systab->product_id);
116 p = (char *) (systab + 1);
117 for (i = 0; i < systab->entry_count; i++) {
119 * The first byte of each entry type contains the type desciptor.
122 case SAL_DESC_ENTRY_POINT:
123 ep = (struct ia64_sal_desc_entry_point *) p;
124 printk(KERN_INFO "SAL: entry: pal_proc=0x%lx, sal_proc=0x%lx\n",
125 ep->pal_proc, ep->sal_proc);
126 ia64_pal_handler_init(__va(ep->pal_proc));
127 ia64_sal_handler_init(__va(ep->sal_proc), __va(ep->gp));
131 ia64_ptc_domain_info = (ia64_sal_desc_ptc_t *)p;
134 case SAL_DESC_AP_WAKEUP:
137 struct ia64_sal_desc_ap_wakeup *ap = (void *) p;
139 switch (ap->mechanism) {
140 case IA64_SAL_AP_EXTERNAL_INT:
141 ap_wakeup_vector = ap->vector;
142 printk(KERN_INFO "SAL: AP wakeup using external interrupt "
143 "vector 0x%lx\n", ap_wakeup_vector);
147 printk(KERN_ERR "SAL: AP wakeup mechanism unsupported!\n");
153 case SAL_DESC_PLATFORM_FEATURE:
155 struct ia64_sal_desc_platform_feature *pf = (void *) p;
156 sal_platform_features = pf->feature_mask;
157 printk(KERN_INFO "SAL: Platform features ");
159 if (pf->feature_mask & IA64_SAL_PLATFORM_FEATURE_BUS_LOCK)
161 if (pf->feature_mask & IA64_SAL_PLATFORM_FEATURE_IRQ_REDIR_HINT) {
162 printk("IRQ_Redirection ");
165 smp_int_redirect &= ~SMP_IRQ_REDIRECTION;
167 smp_int_redirect |= SMP_IRQ_REDIRECTION;
170 if (pf->feature_mask & IA64_SAL_PLATFORM_FEATURE_IPI_REDIR_HINT) {
171 printk("IPI_Redirection ");
174 smp_int_redirect &= ~SMP_IPI_REDIRECTION;
176 smp_int_redirect |= SMP_IPI_REDIRECTION;
179 if (pf->feature_mask & IA64_SAL_PLATFORM_FEATURE_ITC_DRIFT)
180 printk("ITC_Drift ");
186 p += SAL_DESC_SIZE(*p);