3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #include <Ipf/IpfDefines.h>
23 STATIC EXTENDED_SAL_BOOT_SERVICE_PROTOCOL
*mEsalBootService
;
28 IN EFI_HANDLE ImageHandle
,
29 IN EFI_SYSTEM_TABLE
*SystemTable
34 Status
= gBS
->LocateProtocol (&gEfiExtendedSalBootServiceProtocolGuid
, NULL
, &mEsalBootService
);
35 ASSERT_EFI_ERROR (Status
);
42 RegisterEsalFunction (
44 IN EFI_GUID
*ClassGuid
,
45 IN SAL_INTERNAL_EXTENDED_SAL_PROC Function
,
52 Register ESAL Class Function and it's asociated global.
53 This function is boot service only!
56 FunctionId - ID of function to register
57 ClassGuid - GUID of function class
58 Function - Function to register under ClassGuid/FunctionId pair
59 ModuleGlobal - Module global for Function.
62 EFI_SUCCESS - If ClassGuid/FunctionId Function was registered.
66 return mEsalBootService
->AddExtendedSalProc (
78 IN EFI_GUID
*ClassGuid
,
79 IN VOID
*ModuleGlobal
,
86 Register ESAL Class and it's asociated global.
87 This function is boot service only!
90 ClassGuid - GUID of function class
91 ModuleGlobal - Module global for Function.
92 ... - SAL_INTERNAL_EXTENDED_SAL_PROC and FunctionId pairs. NULL
93 indicates the end of the list.
96 EFI_SUCCESS - All members of ClassGuid registered
102 SAL_INTERNAL_EXTENDED_SAL_PROC Function
;
104 EFI_HANDLE NewHandle
;
106 VA_START (Args
, ModuleGlobal
);
108 Status
= EFI_SUCCESS
;
109 while (!EFI_ERROR (Status
)) {
110 Function
= (SAL_INTERNAL_EXTENDED_SAL_PROC
) VA_ARG (Args
, SAL_INTERNAL_EXTENDED_SAL_PROC
);
111 if (Function
== NULL
) {
115 FunctionId
= VA_ARG (Args
, UINT64
);
117 Status
= RegisterEsalFunction (FunctionId
, ClassGuid
, Function
, ModuleGlobal
);
120 if (EFI_ERROR (Status
)) {
125 return gBS
->InstallProtocolInterface (
128 EFI_NATIVE_INTERFACE
,
136 IN EFI_GUID
*ClassGuid
,
137 IN UINT64 FunctionId
,
150 Call module that is not linked direclty to this module. This code is IP
151 relative and hides the binding issues of virtual or physical calling. The
152 function that gets dispatched has extra arguments that include the registered
153 module global and a boolean flag to indicate if the system is in virutal mode.
156 ClassGuid - GUID of function
157 FunctionId - Function in ClassGuid to call
158 Arg2 - Argument 2 ClassGuid/FunctionId defined
159 Arg3 - Argument 3 ClassGuid/FunctionId defined
160 Arg4 - Argument 4 ClassGuid/FunctionId defined
161 Arg5 - Argument 5 ClassGuid/FunctionId defined
162 Arg6 - Argument 6 ClassGuid/FunctionId defined
163 Arg7 - Argument 7 ClassGuid/FunctionId defined
164 Arg8 - Argument 8 ClassGuid/FunctionId defined
167 Status of ClassGuid/FuncitonId
171 SAL_RETURN_REGS ReturnReg
;
172 SAL_EXTENDED_SAL_PROC EsalProc
;
174 ReturnReg
= GetEsalEntryPoint ();
175 if (ReturnReg
.Status
!= EFI_SAL_SUCCESS
) {
179 if (ReturnReg
.r11
& PSR_IT_MASK
) {
181 // Virtual mode plabel to entry point
183 EsalProc
= (SAL_EXTENDED_SAL_PROC
) ReturnReg
.r10
;
186 // Physical mode plabel to entry point
188 EsalProc
= (SAL_EXTENDED_SAL_PROC
) ReturnReg
.r9
;