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