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
);
41 RegisterEsalFunction (
43 IN EFI_GUID
*ClassGuid
,
44 IN SAL_INTERNAL_EXTENDED_SAL_PROC Function
,
51 Register ESAL Class Function and it's asociated global.
52 This function is boot service only!
55 FunctionId - ID of function to register
56 ClassGuid - GUID of function class
57 Function - Function to register under ClassGuid/FunctionId pair
58 ModuleGlobal - Module global for Function.
61 EFI_SUCCESS - If ClassGuid/FunctionId Function was registered.
65 return mEsalBootService
->AddExtendedSalProc (
76 IN EFI_GUID
*ClassGuid
,
77 IN VOID
*ModuleGlobal
,
84 Register ESAL Class and it's asociated global.
85 This function is boot service only!
88 ClassGuid - GUID of function class
89 ModuleGlobal - Module global for Function.
90 ... - SAL_INTERNAL_EXTENDED_SAL_PROC and FunctionId pairs. NULL
91 indicates the end of the list.
94 EFI_SUCCESS - All members of ClassGuid registered
100 SAL_INTERNAL_EXTENDED_SAL_PROC Function
;
102 EFI_HANDLE NewHandle
;
104 VA_START (Args
, ModuleGlobal
);
106 Status
= EFI_SUCCESS
;
107 while (!EFI_ERROR (Status
)) {
108 Function
= (SAL_INTERNAL_EXTENDED_SAL_PROC
) VA_ARG (Args
, SAL_INTERNAL_EXTENDED_SAL_PROC
);
109 if (Function
== NULL
) {
113 FunctionId
= VA_ARG (Args
, UINT64
);
115 Status
= RegisterEsalFunction (FunctionId
, ClassGuid
, Function
, ModuleGlobal
);
118 if (EFI_ERROR (Status
)) {
123 return gBS
->InstallProtocolInterface (
126 EFI_NATIVE_INTERFACE
,
133 IN EFI_GUID
*ClassGuid
,
134 IN UINT64 FunctionId
,
147 Call module that is not linked direclty to this module. This code is IP
148 relative and hides the binding issues of virtual or physical calling. The
149 function that gets dispatched has extra arguments that include the registered
150 module global and a boolean flag to indicate if the system is in virutal mode.
153 ClassGuid - GUID of function
154 FunctionId - Function in ClassGuid to call
155 Arg2 - Argument 2 ClassGuid/FunctionId defined
156 Arg3 - Argument 3 ClassGuid/FunctionId defined
157 Arg4 - Argument 4 ClassGuid/FunctionId defined
158 Arg5 - Argument 5 ClassGuid/FunctionId defined
159 Arg6 - Argument 6 ClassGuid/FunctionId defined
160 Arg7 - Argument 7 ClassGuid/FunctionId defined
161 Arg8 - Argument 8 ClassGuid/FunctionId defined
164 Status of ClassGuid/FuncitonId
168 SAL_RETURN_REGS ReturnReg
;
169 SAL_EXTENDED_SAL_PROC EsalProc
;
171 ReturnReg
= GetEsalEntryPoint ();
172 if (ReturnReg
.Status
!= EFI_SAL_SUCCESS
) {
176 if (ReturnReg
.r11
& PSR_IT_MASK
) {
178 // Virtual mode plabel to entry point
180 EsalProc
= (SAL_EXTENDED_SAL_PROC
) ReturnReg
.r10
;
183 // Physical mode plabel to entry point
185 EsalProc
= (SAL_EXTENDED_SAL_PROC
) ReturnReg
.r9
;