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