]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | \r | |
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 - 2010, Intel Corporation. All rights reserved.<BR>\r | |
7 | 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 | |
15 | **/\r | |
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/FaultTolerantWrite.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/UefiBootServicesTableLib.h>\r | |
32 | #include <Library/UefiLib.h>\r | |
33 | #include <Library/BaseLib.h>\r | |
34 | #include <Library/SynchronizationLib.h>\r | |
35 | #include <Library/MemoryAllocationLib.h>\r | |
36 | #include <Guid/GlobalVariable.h>\r | |
37 | #include <Guid/EventGroup.h>\r | |
38 | #include <Guid/VariableFormat.h>\r | |
39 | \r | |
40 | #define VARIABLE_RECLAIM_THRESHOLD (1024)\r | |
41 | \r | |
42 | ///\r | |
43 | /// The size of a 3 character ISO639 language code.\r | |
44 | ///\r | |
45 | #define ISO_639_2_ENTRY_SIZE 3\r | |
46 | \r | |
47 | typedef struct {\r | |
48 | VARIABLE_HEADER *CurrPtr;\r | |
49 | VARIABLE_HEADER *EndPtr;\r | |
50 | VARIABLE_HEADER *StartPtr;\r | |
51 | BOOLEAN Volatile;\r | |
52 | } VARIABLE_POINTER_TRACK;\r | |
53 | \r | |
54 | typedef struct {\r | |
55 | EFI_PHYSICAL_ADDRESS VolatileVariableBase;\r | |
56 | EFI_PHYSICAL_ADDRESS NonVolatileVariableBase;\r | |
57 | EFI_LOCK VariableServicesLock;\r | |
58 | UINT32 ReentrantState;\r | |
59 | } VARIABLE_GLOBAL;\r | |
60 | \r | |
61 | typedef struct {\r | |
62 | VARIABLE_GLOBAL VariableGlobal;\r | |
63 | UINTN VolatileLastVariableOffset;\r | |
64 | UINTN NonVolatileLastVariableOffset;\r | |
65 | UINTN CommonVariableTotalSize;\r | |
66 | UINTN HwErrVariableTotalSize;\r | |
67 | CHAR8 *PlatformLangCodes;\r | |
68 | CHAR8 *LangCodes;\r | |
69 | CHAR8 *PlatformLang;\r | |
70 | CHAR8 Lang[ISO_639_2_ENTRY_SIZE + 1];\r | |
71 | EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbInstance;\r | |
72 | } VARIABLE_MODULE_GLOBAL;\r | |
73 | \r | |
74 | typedef struct {\r | |
75 | EFI_GUID *Guid;\r | |
76 | CHAR16 *Name;\r | |
77 | UINT32 Attributes;\r | |
78 | UINTN DataSize;\r | |
79 | VOID *Data;\r | |
80 | } VARIABLE_CACHE_ENTRY;\r | |
81 | \r | |
82 | /**\r | |
83 | Writes a buffer to variable storage space, in the working block.\r | |
84 | \r | |
85 | This function writes a buffer to variable storage space into firmware\r | |
86 | volume block device. The destination is specified by parameter\r | |
87 | VariableBase. Fault Tolerant Write protocol is used for writing.\r | |
88 | \r | |
89 | @param VariableBase Base address of variable to write\r | |
90 | @param Buffer Point to the data buffer\r | |
91 | @param BufferSize The number of bytes of the data Buffer\r | |
92 | \r | |
93 | @retval EFI_SUCCESS The function completed successfully\r | |
94 | @retval EFI_NOT_FOUND Fail to locate Fault Tolerant Write protocol\r | |
95 | @retval EFI_ABORTED The function could not complete successfully\r | |
96 | \r | |
97 | **/\r | |
98 | EFI_STATUS\r | |
99 | FtwVariableSpace (\r | |
100 | IN EFI_PHYSICAL_ADDRESS VariableBase,\r | |
101 | IN UINT8 *Buffer,\r | |
102 | IN UINTN BufferSize\r | |
103 | );\r | |
104 | \r | |
105 | \r | |
106 | #endif\r |