]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Universal/Variable/RuntimeDxe/Ipf/InitVariable.c
Partially make EdkModulePkg pass intel IPF compiler with /W4 /WX switched on.
[mirror_edk2.git] / EdkModulePkg / Universal / Variable / RuntimeDxe / Ipf / InitVariable.c
1 /*++
2
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
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 extern ESAL_VARIABLE_GLOBAL *mVariableModuleGlobal;
28
29 STATIC
30 SAL_RETURN_REGS
31 EsalVariableCommonEntry (
32 IN UINT64 FunctionId,
33 IN UINT64 Arg2,
34 IN UINT64 Arg3,
35 IN UINT64 Arg4,
36 IN UINT64 Arg5,
37 IN UINT64 Arg6,
38 IN UINT64 Arg7,
39 IN UINT64 Arg8,
40 IN SAL_EXTENDED_SAL_PROC ExtendedSalProc,
41 IN BOOLEAN VirtualMode,
42 IN ESAL_VARIABLE_GLOBAL *Global
43 )
44 /*++
45
46 Routine Description:
47
48 Arguments:
49
50 Returns:
51
52 --*/
53 {
54 SAL_RETURN_REGS ReturnVal;
55
56 switch (FunctionId) {
57 case EsalGetVariable:
58 ReturnVal.Status = GetVariable (
59 (CHAR16 *) Arg2,
60 (EFI_GUID *) Arg3,
61 (UINT32 *) Arg4,
62 (UINTN *) Arg5,
63 (VOID *) Arg6,
64 &Global->VariableBase[VirtualMode],
65 Global->FvbInstance
66 );
67 return ReturnVal;
68
69 case EsalGetNextVariableName:
70 ReturnVal.Status = GetNextVariableName (
71 (UINTN *) Arg2,
72 (CHAR16 *) Arg3,
73 (EFI_GUID *) Arg4,
74 &Global->VariableBase[VirtualMode],
75 Global->FvbInstance
76 );
77 return ReturnVal;
78
79 case EsalSetVariable:
80 ReturnVal.Status = SetVariable (
81 (CHAR16 *) Arg2,
82 (EFI_GUID *) Arg3,
83 (UINT32) Arg4,
84 (UINTN) Arg5,
85 (VOID *) Arg6,
86 &Global->VariableBase[VirtualMode],
87 (UINTN *) &Global->VolatileLastVariableOffset,
88 (UINTN *) &Global->NonVolatileLastVariableOffset,
89 Global->FvbInstance
90 );
91 return ReturnVal;
92
93 #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
94 case EsalQueryVariableInfo:
95 ReturnVal.Status = QueryVariableInfo (
96 (UINT32) Arg2,
97 (UINT64 *) Arg3,
98 (UINT64 *) Arg4,
99 (UINT64 *) Arg5,
100 &Global->VariableBase[VirtualMode],
101 Global->FvbInstance
102 );
103 return ReturnVal;
104 #endif
105
106 default:
107 ReturnVal.Status = EFI_SAL_INVALID_ARGUMENT;
108 return ReturnVal;
109 }
110 }
111
112
113 VOID
114 VariableClassAddressChangeEvent (
115 IN EFI_EVENT Event,
116 IN VOID *Context
117 )
118 /*++
119
120 Routine Description:
121
122 Arguments:
123
124 Returns:
125
126 --*/
127 {
128 CopyMem (
129 &mVariableModuleGlobal->VariableBase[Virtual],
130 &mVariableModuleGlobal->VariableBase[Physical],
131 sizeof (VARIABLE_GLOBAL)
132 );
133
134 EfiConvertPointer (
135 0x0,
136 (VOID **) &mVariableModuleGlobal->VariableBase[Virtual].NonVolatileVariableBase
137 );
138 EfiConvertPointer (
139 0x0,
140 (VOID **) &mVariableModuleGlobal->VariableBase[Virtual].VolatileVariableBase
141 );
142 EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal);
143 }
144
145 EFI_STATUS
146 VariableServiceInitialize (
147 IN EFI_HANDLE ImageHandle,
148 IN EFI_SYSTEM_TABLE *SystemTable
149 )
150 /*++
151
152 Routine Description:
153
154 Arguments:
155
156 Returns:
157
158 --*/
159 {
160 EFI_STATUS Status;
161
162 Status = VariableCommonInitialize (ImageHandle, SystemTable);
163 ASSERT_EFI_ERROR (Status);
164
165 //
166 // Register All the Functions with Extended Sal.
167 //
168 RegisterEsalClass (
169 &gEfiExtendedSalVariableServicesProtocolGuid,
170 mVariableModuleGlobal,
171 EsalVariableCommonEntry,
172 EsalGetVariable,
173 EsalVariableCommonEntry,
174 EsalGetNextVariableName,
175 EsalVariableCommonEntry,
176 EsalSetVariable,
177 #if (EFI_SPECIFICATION_VERSION >= 0x00020000)
178 EsalVariableCommonEntry,
179 EsalQueryVariableInfo,
180 #endif
181 NULL
182 );
183
184 return EFI_SUCCESS;
185 }