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