]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.h
Change C functions, xxxSizeOfVariable(), to MACRO, which can avoid the ICC compile...
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / RuntimeDxe / Variable.h
CommitLineData
8d3a5c82 1/*++\r
2\r
3Copyright (c) 2006 - 2007, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12Module Name:\r
13\r
14 Variable.h\r
15\r
16Abstract:\r
17\r
18--*/\r
19\r
20#ifndef _VARIABLE_H\r
21#define _VARIABLE_H\r
22\r
23#include <PiDxe.h>\r
24#include <Protocol/VariableWrite.h>\r
25#include <Protocol/FaultTolerantWriteLite.h>\r
26#include <Protocol/FirmwareVolumeBlock.h>\r
27#include <Protocol/Variable.h>\r
28#include <Library/PcdLib.h>\r
29#include <Library/UefiDriverEntryPoint.h>\r
30#include <Library/DxeServicesTableLib.h>\r
31#include <Library/UefiRuntimeLib.h>\r
32#include <Library/DebugLib.h>\r
33#include <Library/BaseMemoryLib.h>\r
34#include <Library/FvbServiceLib.h>\r
35#include <Library/UefiBootServicesTableLib.h>\r
36#include <Library/UefiLib.h>\r
37#include <Library/BaseLib.h>\r
38#include <Library/MemoryAllocationLib.h>\r
39#include <Library/HobLib.h>\r
052ad7e1
A
40#include <Guid/VariableInfo.h>\r
41#include <Guid/GlobalVariable.h>\r
3cfb790c 42#include <VariableFormat.h>\r
8d3a5c82 43\r
052ad7e1
A
44\r
45\r
8d3a5c82 46#define VARIABLE_RECLAIM_THRESHOLD (1024)\r
47\r
518d395c 48#define VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)\r
49#define SCRATCH_SIZE FixedPcdGet32(PcdMaxVariableSize)\r
8d3a5c82 50\r
51//\r
52// Define GET_PAD_SIZE to optimize compiler\r
53//\r
54#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))\r
55#define GET_PAD_SIZE(a) (0)\r
56#else\r
57#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))\r
58#endif\r
59\r
9cad030b 60#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))\r
61\r
ab5f0d6d 62#define NAMESIZE_OF_VARIABLE(Variable) \\r
63 ((((Variable)->DataSize == (UINT32) -1) || \\r
64 ((Variable)->Attributes == (UINT32) -1) || \\r
65 ((Variable)->NameSize == (UINT32) -1)) ? \\r
66 0 : \\r
67 (Variable)->NameSize \\r
68 )\r
69\r
70#define DATASIZE_OF_VARIABLE(Variable) \\r
71 ((((Variable)->DataSize == (UINT32) -1) || \\r
72 ((Variable)->Attributes == (UINT32) -1) || \\r
73 ((Variable)->NameSize == (UINT32) -1)) ? \\r
74 0 : \\r
75 (Variable)->DataSize \\r
76 )\r
77\r
8d3a5c82 78#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
79\r
8d3a5c82 80\r
81typedef struct {\r
82 VARIABLE_HEADER *CurrPtr;\r
83 VARIABLE_HEADER *EndPtr;\r
84 VARIABLE_HEADER *StartPtr;\r
85 BOOLEAN Volatile;\r
86} VARIABLE_POINTER_TRACK;\r
87\r
88typedef struct {\r
89 EFI_PHYSICAL_ADDRESS VolatileVariableBase;\r
90 EFI_PHYSICAL_ADDRESS NonVolatileVariableBase;\r
91 EFI_LOCK VariableServicesLock;\r
fdb7765f 92 UINT32 ReentrantState;\r
8d3a5c82 93} VARIABLE_GLOBAL;\r
94\r
95typedef struct {\r
052ad7e1 96 VARIABLE_GLOBAL VariableGlobal;\r
8d3a5c82 97 UINTN VolatileLastVariableOffset;\r
98 UINTN NonVolatileLastVariableOffset;\r
99 UINT32 FvbInstance;\r
052ad7e1
A
100} VARIABLE_MODULE_GLOBAL;\r
101\r
102typedef struct {\r
103 EFI_GUID *Guid;\r
104 CHAR16 *Name;\r
105 UINT32 Attributes;\r
106 UINTN DataSize;\r
107 VOID *Data;\r
108} VARIABLE_CACHE_ENTRY;\r
8d3a5c82 109\r
8d3a5c82 110\r
111//\r
112// Functions\r
113//\r
8d3a5c82 114\r
115EFI_STATUS\r
116EFIAPI\r
117VariableServiceInitialize (\r
118 IN EFI_HANDLE ImageHandle,\r
119 IN EFI_SYSTEM_TABLE *SystemTable\r
120 );\r
121\r
8d3a5c82 122\r
123EFI_STATUS\r
124FtwVariableSpace (\r
125 IN EFI_PHYSICAL_ADDRESS VariableBaseAddress,\r
126 IN UINT8 *Buffer,\r
127 IN UINTN BufferSize\r
128 );\r
129\r
130#endif\r