]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DuetPkg/FSVariable/FSVariable.h
IntelFsp2Pkg: Removing FSP Data Table
[mirror_edk2.git] / DuetPkg / FSVariable / FSVariable.h
index c046fe91ea3a75a7324227310cb82c05afa7fa6d..cc39323e97d84ce5315a644a55b05b75f1b039df 100644 (file)
@@ -1,7 +1,13 @@
 /*++\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
+Caution: This file is used for Duet platform only, do not use them in real platform.\r
+All variable code, variable metadata, and variable data used by Duet platform are on \r
+disk. They can be changed by user. BIOS is not able to protoect those.\r
+Duet trusts all meta data from disk. If variable code, variable metadata and variable\r
+data is modified in inproper way, the behavior is undefined.\r
+\r
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
 http://opensource.org/licenses/bsd-license.php                                            \r
@@ -28,6 +34,7 @@ Abstract:
 #include <Library/BaseLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/UefiRuntimeLib.h>\r
 #include <Library/DebugLib.h>\r
@@ -38,7 +45,8 @@ Abstract:
 \r
 #include <Guid/HobList.h>\r
 #include <Guid/FlashMapHob.h>\r
-\r
+#include <Guid/VariableFormat.h>\r
+#include <Guid/GlobalVariable.h>\r
 #include <Protocol/Variable.h>\r
 #include <Protocol/VariableWrite.h>\r
 #include <Protocol/SimpleFileSystem.h>\r
@@ -46,21 +54,15 @@ Abstract:
 \r
 \r
 #include "EfiFlashMap.h"\r
-#include "VariableFormat.h"\r
 #include "VariableStorage.h"\r
 \r
-#define VOLATILE_VARIABLE_STORE_SIZE  (64 * 1024)\r
-#define VARIABLE_SCRATCH_SIZE         (4 * 1024)\r
+#define VOLATILE_VARIABLE_STORE_SIZE  FixedPcdGet32(PcdVariableStoreSize)\r
+#define VARIABLE_SCRATCH_SIZE         MAX(FixedPcdGet32(PcdMaxVariableSize), FixedPcdGet32(PcdMaxHardwareErrorVariableSize))\r
 #define VARIABLE_RECLAIM_THRESHOLD    (1024)\r
-\r
-//\r
-// Define GET_PAD_SIZE to optimize compiler\r
-//\r
-#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))\r
-#define GET_PAD_SIZE(a) (0)\r
-#else\r
-#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))\r
-#endif\r
+///\r
+/// The size of a 3 character ISO639 language code.\r
+///\r
+#define ISO_639_2_ENTRY_SIZE    3\r
 \r
 #define GET_VARIABLE_NAME_PTR(a)  (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
 \r
@@ -94,6 +96,12 @@ typedef struct {
   VOID               *VariableBase[MaxType];        // Start address of variable storage\r
   UINTN              LastVariableOffset[MaxType];   // The position to write new variable to (index from VariableBase)\r
   VOID               *Scratch;                      // Buffer used during reclaim\r
+  UINTN              CommonVariableTotalSize;\r
+  UINTN              HwErrVariableTotalSize;\r
+  CHAR8              *PlatformLangCodes;\r
+  CHAR8              *LangCodes;\r
+  CHAR8              *PlatformLang;\r
+  CHAR8              Lang[ISO_639_2_ENTRY_SIZE + 1];\r
 } VARIABLE_GLOBAL;\r
 \r
 //\r
@@ -116,7 +124,7 @@ VariableClassAddressChangeEvent (
 \r
 EFI_STATUS\r
 EFIAPI\r
-GetVariable (\r
+DuetGetVariable (\r
   IN      CHAR16            *VariableName,\r
   IN      EFI_GUID          *VendorGuid,\r
   OUT     UINT32            *Attributes OPTIONAL,\r
@@ -142,7 +150,6 @@ SetVariable (
   IN VOID                    *Data\r
   );\r
 \r
-#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
 EFI_STATUS\r
 EFIAPI\r
 QueryVariableInfo (\r
@@ -151,6 +158,5 @@ QueryVariableInfo (
   OUT UINT64                 *RemainingVariableStorageSize,\r
   OUT UINT64                 *MaximumVariableSize\r
   );\r
-#endif // EFI_SPECIFICATION_VERSION >= 0x00020000\r
 \r
 #endif\r