]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Universal/EmuVariable/RuntimeDxe/Ipf/InitVariable.c
changed the Esal call function ids all over the tree
[mirror_edk2.git] / EdkModulePkg / Universal / EmuVariable / RuntimeDxe / Ipf / InitVariable.c
1 /*++
2
3 Copyright (c) 2006 - 2007, 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
8
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.
11
12 Module Name:
13
14 IpfVariable.c
15
16 Abstract:
17
18 Revision History
19
20 --*/
21
22 #include "Variable.h"
23
24 //
25 // Don't use module globals after the SetVirtualAddress map is signaled
26 //
27
28 STATIC
29 SAL_RETURN_REGS
30 EsalVariableCommonEntry (
31 IN UINT64 FunctionId,
32 IN UINT64 Arg2,
33 IN UINT64 Arg3,
34 IN UINT64 Arg4,
35 IN UINT64 Arg5,
36 IN UINT64 Arg6,
37 IN UINT64 Arg7,
38 IN UINT64 Arg8,
39 IN SAL_EXTENDED_SAL_PROC ExtendedSalProc,
40 IN BOOLEAN VirtualMode,
41 IN ESAL_VARIABLE_GLOBAL *Global
42 )
43 /*++
44
45 Routine Description:
46
47 Arguments:
48
49 Returns:
50
51 --*/
52 {
53 SAL_RETURN_REGS ReturnVal;
54
55 switch (FunctionId) {
56 case EsalGetVariableFunctionId:
57 ReturnVal.Status = GetVariable (
58 (CHAR16 *) Arg2,
59 (EFI_GUID *) Arg3,
60 (UINT32 *) Arg4,
61 (UINTN *) Arg5,
62 (VOID *) Arg6,
63 &Global->VariableGlobal[VirtualMode],
64 Global->FvbInstance
65 );
66 return ReturnVal;
67
68 case EsalGetNextVariableNameFunctionId:
69 ReturnVal.Status = GetNextVariableName (
70 (UINTN *) Arg2,
71 (CHAR16 *) Arg3,
72 (EFI_GUID *) Arg4,
73 &Global->VariableGlobal[VirtualMode],
74 Global->FvbInstance
75 );
76 return ReturnVal;
77
78 case EsalSetVariableFunctionId:
79 ReturnVal.Status = SetVariable (
80 (CHAR16 *) Arg2,
81 (EFI_GUID *) Arg3,
82 (UINT32) Arg4,
83 (UINTN) Arg5,
84 (VOID *) Arg6,
85 &Global->VariableGlobal[VirtualMode],
86 (UINTN *) &Global->VolatileLastVariableOffset,
87 (UINTN *) &Global->NonVolatileLastVariableOffset,
88 Global->FvbInstance
89 );
90 return ReturnVal;
91
92 case EsalQueryVariableInfoFunctionId:
93 ReturnVal.Status = QueryVariableInfo (
94 (UINT32) Arg2,
95 (UINT64 *) Arg3,
96 (UINT64 *) Arg4,
97 (UINT64 *) Arg5,
98 &Global->VariableGlobal[VirtualMode],
99 Global->FvbInstance
100 );
101 return ReturnVal;
102
103 default:
104 ReturnVal.Status = EFI_SAL_INVALID_ARGUMENT;
105 return ReturnVal;
106 }
107 }
108
109
110 VOID
111 VariableClassAddressChangeEvent (
112 IN EFI_EVENT Event,
113 IN VOID *Context
114 )
115 /*++
116
117 Routine Description:
118
119 Arguments:
120
121 Returns:
122
123 --*/
124 {
125 CopyMem (
126 &mVariableModuleGlobal->VariableGlobal[Virtual],
127 &mVariableModuleGlobal->VariableGlobal[Physical],
128 sizeof (VARIABLE_GLOBAL)
129 );
130
131 EfiConvertPointer (
132 0x0,
133 (VOID **) &mVariableModuleGlobal->VariableGlobal[Virtual].NonVolatileVariableBase
134 );
135 EfiConvertPointer (
136 0x0,
137 (VOID **) &mVariableModuleGlobal->VariableGlobal[Virtual].VolatileVariableBase
138 );
139 EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal);
140 }
141
142 EFI_STATUS
143 VariableServiceInitialize (
144 IN EFI_HANDLE ImageHandle,
145 IN EFI_SYSTEM_TABLE *SystemTable
146 )
147 /*++
148
149 Routine Description:
150
151 Arguments:
152
153 Returns:
154
155 --*/
156 {
157 EFI_STATUS Status;
158
159 Status = VariableCommonInitialize (ImageHandle, SystemTable);
160 ASSERT_EFI_ERROR (Status);
161
162 //
163 // Register All the Functions with Extended Sal.
164 //
165 RegisterEsalClass (
166 &gEfiExtendedSalVariableServicesProtocolGuid,
167 mVariableModuleGlobal,
168 EsalVariableCommonEntry,
169 EsalGetVariableFunctionId,
170 EsalVariableCommonEntry,
171 EsalGetNextVariableNameFunctionId,
172 EsalVariableCommonEntry,
173 EsalSetVariableFunctionId,
174 EsalVariableCommonEntry,
175 EsalQueryVariableInfoFunctionId,
176 NULL
177 );
178
179 return EFI_SUCCESS;
180 }