1 /** @file
2 This library implements the SAL Library Class using Extended SAL functions
3
4 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include <PiDxe.h>
16
17 #include <Protocol/ExtendedSalServiceClasses.h>
18
19 #include <Library/SalLib.h>
20 #include <Library/ExtendedSalLib.h>
21
22 /**
23 Makes a SAL procedure call.
24
25 This is a wrapper function to make a SAL procedure call.
26 No parameter checking is performed on the 8 input parameters,
27 but there are some common rules that the caller should follow
28 when making a SAL call. Any address passed to SAL as buffers
29 for return parameters must be 8-byte aligned. Unaligned
30 addresses may cause undefined results. For those parameters
31 defined as reserved or some fields defined as reserved must be
32 zero filled or the invalid argument return value may be returned
33 or undefined result may occur during the execution of the procedure.
34 This function is only available on IPF.
35
36 @param Index The SAL procedure Index number
37 @param Arg2 The 2nd parameter for SAL procedure calls
38 @param Arg3 The 3rd parameter for SAL procedure calls
39 @param Arg4 The 4th parameter for SAL procedure calls
40 @param Arg5 The 5th parameter for SAL procedure calls
41 @param Arg6 The 6th parameter for SAL procedure calls
42 @param Arg7 The 7th parameter for SAL procedure calls
43 @param Arg8 The 8th parameter for SAL procedure calls
44
45 @return SAL returned registers.
46
47 **/
48 SAL_RETURN_REGS
49 EFIAPI
SalCall(IN UINT64 Index,IN UINT64 Arg2,IN UINT64 Arg3,IN UINT64 Arg4,IN UINT64 Arg5,IN UINT64 Arg6,IN UINT64 Arg7,IN UINT64 Arg8)50 SalCall (
51 IN UINT64 Index,
52 IN UINT64 Arg2,
53 IN UINT64 Arg3,
54 IN UINT64 Arg4,
55 IN UINT64 Arg5,
56 IN UINT64 Arg6,
57 IN UINT64 Arg7,
58 IN UINT64 Arg8
59 )
60 {
61 SAL_RETURN_REGS Regs;
62
63 //
64 // Initial all members in this structure.
65 //
66 Regs.r9 = 0;
67 Regs.r10 = 0;
68 Regs.r11 = 0;
69 Regs.Status = EFI_SAL_INVALID_ARGUMENT;
70
71 switch (Index) {
72 case EFI_SAL_SET_VECTORS:
73 return EsalCall (
74 EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_LO,
75 EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_HI,
76 SalSetVectorsFunctionId,
77 Arg2,
78 Arg3,
79 Arg4,
80 Arg5,
81 Arg6,
82 Arg7,
83 Arg8
84 );
85 break;
86
87 case EFI_SAL_GET_STATE_INFO:
88 return EsalCall (
89 EFI_EXTENDED_SAL_MCA_LOG_SERVICES_PROTOCOL_GUID_LO,
90 EFI_EXTENDED_SAL_MCA_LOG_SERVICES_PROTOCOL_GUID_HI,
91 SalGetStateInfoFunctionId,
92 Arg2,
93 Arg3,
94 Arg4,
95 Arg5,
96 Arg6,
97 Arg7,
98 Arg8
99 );
100 break;
101
102 case EFI_SAL_GET_STATE_INFO_SIZE:
103 return EsalCall (
104 EFI_EXTENDED_SAL_MCA_LOG_SERVICES_PROTOCOL_GUID_LO,
105 EFI_EXTENDED_SAL_MCA_LOG_SERVICES_PROTOCOL_GUID_HI,
106 SalGetStateInfoSizeFunctionId,
107 Arg2,
108 Arg3,
109 Arg4,
110 Arg5,
111 Arg6,
112 Arg7,
113 Arg8
114 );
115 break;
116
117 case EFI_SAL_CLEAR_STATE_INFO:
118 return EsalCall (
119 EFI_EXTENDED_SAL_MCA_LOG_SERVICES_PROTOCOL_GUID_LO,
120 EFI_EXTENDED_SAL_MCA_LOG_SERVICES_PROTOCOL_GUID_HI,
121 SalClearStateInfoFunctionId,
122 Arg2,
123 Arg3,
124 Arg4,
125 Arg5,
126 Arg6,
127 Arg7,
128 Arg8
129 );
130 break;
131
132 case EFI_SAL_MC_RENDEZ:
133 return EsalCall (
134 EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_LO,
135 EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_HI,
136 SalMcRendezFunctionId,
137 Arg2,
138 Arg3,
139 Arg4,
140 Arg5,
141 Arg6,
142 Arg7,
143 Arg8
144 );
145 break;
146
147 case EFI_SAL_MC_SET_PARAMS:
148 return EsalCall (
149 EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_LO,
150 EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_HI,
151 SalMcSetParamsFunctionId,
152 Arg2,
153 Arg3,
154 Arg4,
155 Arg5,
156 Arg6,
157 Arg7,
158 Arg8
159 );
160 break;
161
162 case EFI_SAL_REGISTER_PHYSICAL_ADDR:
163 return EsalCall (
164 EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_LO,
165 EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_HI,
166 EsalRegisterPhysicalAddrFunctionId,
167 Arg2,
168 Arg3,
169 Arg4,
170 Arg5,
171 Arg6,
172 Arg7,
173 Arg8
174 );
175 break;
176
177 case EFI_SAL_CACHE_FLUSH:
178 return EsalCall (
179 EFI_EXTENDED_SAL_CACHE_SERVICES_PROTOCOL_GUID_LO,
180 EFI_EXTENDED_SAL_CACHE_SERVICES_PROTOCOL_GUID_HI,
181 SalCacheFlushFunctionId,
182 Arg2,
183 Arg3,
184 Arg4,
185 Arg5,
186 Arg6,
187 Arg7,
188 Arg8
189 );
190 break;
191
192 case EFI_SAL_CACHE_INIT:
193 return EsalCall (
194 EFI_EXTENDED_SAL_CACHE_SERVICES_PROTOCOL_GUID_LO,
195 EFI_EXTENDED_SAL_CACHE_SERVICES_PROTOCOL_GUID_HI,
196 SalCacheInitFunctionId,
197 Arg2,
198 Arg3,
199 Arg4,
200 Arg5,
201 Arg6,
202 Arg7,
203 Arg8
204 );
205 break;
206
207 case EFI_SAL_PCI_CONFIG_READ:
208 return EsalCall (
209 EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID_LO,
210 EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID_HI,
211 SalPciConfigReadFunctionId,
212 Arg2,
213 Arg3,
214 Arg4,
215 Arg5,
216 Arg6,
217 Arg7,
218 Arg8
219 );
220 break;
221
222 case EFI_SAL_PCI_CONFIG_WRITE:
223 return EsalCall (
224 EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID_LO,
225 EFI_EXTENDED_SAL_PCI_SERVICES_PROTOCOL_GUID_HI,
226 SalPciConfigWriteFunctionId,
227 Arg2,
228 Arg3,
229 Arg4,
230 Arg5,
231 Arg6,
232 Arg7,
233 Arg8
234 );
235 break;
236
237 case EFI_SAL_FREQ_BASE:
238 return EsalCall (
239 EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_LO,
240 EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_HI,
241 EsalGetPlatformBaseFreqFunctionId,
242 Arg2,
243 Arg3,
244 Arg4,
245 Arg5,
246 Arg6,
247 Arg7,
248 Arg8
249 );
250 break;
251
252 case EFI_SAL_PHYSICAL_ID_INFO:
253 return EsalCall (
254 EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_LO,
255 EFI_EXTENDED_SAL_BASE_SERVICES_PROTOCOL_GUID_HI,
256 EsalPhysicalIdInfoFunctionId,
257 Arg2,
258 Arg3,
259 Arg4,
260 Arg5,
261 Arg6,
262 Arg7,
263 Arg8
264 );
265 break;
266
267 case EFI_SAL_UPDATE_PAL:
268 return EsalCall (
269 EFI_EXTENDED_SAL_PAL_SERVICES_PROTOCOL_GUID_LO,
270 EFI_EXTENDED_SAL_PAL_SERVICES_PROTOCOL_GUID_HI,
271 EsalUpdatePalFunctionId,
272 Arg2,
273 Arg3,
274 Arg4,
275 Arg5,
276 Arg6,
277 Arg7,
278 Arg8
279 );
280 break;
281
282 default:
283 return Regs;
284 break;
285 }
286 }
287