]> git.proxmox.com Git - mirror_edk2.git/blob - DuetPkg/FSVariable/FSVariable.h
Remove EFI_SPECIFICATION_VERSION macro reference in code.
[mirror_edk2.git] / DuetPkg / FSVariable / FSVariable.h
1 /*++
2
3 Copyright (c) 2006 - 2010, 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 FSVariable.h
15
16 Abstract:
17
18 --*/
19
20 #ifndef _FS_VARIABLE_H
21 #define _FS_VARIABLE_H
22
23 //
24 // Statements that include other header files
25 //
26 #include <PiDxe.h>
27
28 #include <Library/BaseLib.h>
29 #include <Library/PcdLib.h>
30 #include <Library/BaseMemoryLib.h>
31 #include <Library/UefiBootServicesTableLib.h>
32 #include <Library/UefiRuntimeLib.h>
33 #include <Library/DebugLib.h>
34 #include <Library/UefiLib.h>
35 #include <Library/HobLib.h>
36 #include <Library/DxeServicesTableLib.h>
37 #include <Library/DevicePathLib.h>
38
39 #include <Guid/HobList.h>
40 #include <Guid/FlashMapHob.h>
41 #include <Guid/VariableFormat.h>
42 #include <Guid/GlobalVariable.h>
43 #include <Protocol/Variable.h>
44 #include <Protocol/VariableWrite.h>
45 #include <Protocol/SimpleFileSystem.h>
46 #include <Protocol/BlockIo.h>
47
48
49 #include "EfiFlashMap.h"
50 #include "VariableStorage.h"
51
52 #define VOLATILE_VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)
53 #define VARIABLE_SCRATCH_SIZE MAX(FixedPcdGet32(PcdMaxVariableSize), FixedPcdGet32(PcdMaxHardwareErrorVariableSize))
54 #define VARIABLE_RECLAIM_THRESHOLD (1024)
55 ///
56 /// The size of a 3 character ISO639 language code.
57 ///
58 #define ISO_639_2_ENTRY_SIZE 3
59
60 #define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
61
62 typedef enum {
63 Physical,
64 Virtual
65 } VARIABLE_POINTER_TYPE;
66
67 typedef enum {
68 NonVolatile,
69 Volatile,
70 MaxType
71 } VARIABLE_STORAGE_TYPE;
72
73 typedef struct {
74 VARIABLE_HEADER *CurrPtr;
75 VARIABLE_HEADER *EndPtr;
76 VARIABLE_HEADER *StartPtr;
77 VARIABLE_STORAGE_TYPE Type;
78 } VARIABLE_POINTER_TRACK;
79
80 #define VARIABLE_MEMBER_OFFSET(Member, StartOffset) \
81 ( sizeof (VARIABLE_STORE_HEADER) + (StartOffset) + \
82 (UINTN) ((UINT8 *) &((VARIABLE_HEADER*) 0)->Member - (UINT8 *) &((VARIABLE_HEADER*) 0)->StartId) \
83 )
84
85
86 typedef struct {
87 EFI_EVENT_NOTIFY GoVirtualChildEvent[MaxType];
88 VARIABLE_STORAGE *VariableStore[MaxType]; // Instance of VariableStorage
89 VOID *VariableBase[MaxType]; // Start address of variable storage
90 UINTN LastVariableOffset[MaxType]; // The position to write new variable to (index from VariableBase)
91 VOID *Scratch; // Buffer used during reclaim
92 UINTN CommonVariableTotalSize;
93 UINTN HwErrVariableTotalSize;
94 CHAR8 PlatformLangCodes[256]; //Pre-allocate 256 bytes space to accommodate the PlatformlangCodes.
95 CHAR8 LangCodes[256]; //Pre-allocate 256 bytes space to accommodate the langCodes.
96 CHAR8 PlatformLang[8]; //Pre-allocate 8 bytes space to accommodate the Platformlang variable.
97 CHAR8 Lang[4]; //Pre-allocate 4 bytes space to accommodate the lang variable.
98 } VARIABLE_GLOBAL;
99
100 //
101 // Functions
102 //
103
104 EFI_STATUS
105 EFIAPI
106 VariableServiceInitialize (
107 IN EFI_HANDLE ImageHandle,
108 IN EFI_SYSTEM_TABLE *SystemTable
109 );
110
111 VOID
112 EFIAPI
113 VariableClassAddressChangeEvent (
114 IN EFI_EVENT Event,
115 IN VOID *Context
116 );
117
118 EFI_STATUS
119 EFIAPI
120 DuetGetVariable (
121 IN CHAR16 *VariableName,
122 IN EFI_GUID *VendorGuid,
123 OUT UINT32 *Attributes OPTIONAL,
124 IN OUT UINTN *DataSize,
125 OUT VOID *Data
126 );
127
128 EFI_STATUS
129 EFIAPI
130 GetNextVariableName (
131 IN OUT UINTN *VariableNameSize,
132 IN OUT CHAR16 *VariableName,
133 IN OUT EFI_GUID *VendorGuid
134 );
135
136 EFI_STATUS
137 EFIAPI
138 SetVariable (
139 IN CHAR16 *VariableName,
140 IN EFI_GUID *VendorGuid,
141 IN UINT32 Attributes,
142 IN UINTN DataSize,
143 IN VOID *Data
144 );
145
146 EFI_STATUS
147 EFIAPI
148 QueryVariableInfo (
149 IN UINT32 Attributes,
150 OUT UINT64 *MaximumVariableStorageSize,
151 OUT UINT64 *RemainingVariableStorageSize,
152 OUT UINT64 *MaximumVariableSize
153 );
154
155 #endif