gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintEnable\r
\r
[Pcd]\r
- gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintString\r
- gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintTimes\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintString ## Valid when gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintEnable\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintTimes ## Valid when gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintEnable\r
/** @file\r
- This file defines header data structures for BMP file and default\r
- FFS GUID Filename for BMP logo file. \r
+ This file defines BMP file header data structures.\r
+ It also defines the File GUID for default BMP logo file.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
UINT32 HeaderSize;\r
UINT32 PixelWidth;\r
UINT32 PixelHeight;\r
- UINT16 Planes; /// Must be 1\r
- UINT16 BitPerPixel; /// 1, 4, 8, or 24\r
+ UINT16 Planes; ///> Must be 1\r
+ UINT16 BitPerPixel; ///> 1, 4, 8, or 24\r
UINT32 CompressionType;\r
- UINT32 ImageSize; /// Compressed image size in bytes\r
+ UINT32 ImageSize; ///> Compressed image size in bytes\r
UINT32 XPixelsPerMeter;\r
UINT32 YPixelsPerMeter;\r
UINT32 NumberOfColors;\r
/** @file\r
-\r
- This file defines capsule vendor guid, capsule variable name \r
- and capsule guid hob data structure. \r
+ This file defines capsule vendor guid for capsule variable and hob.\r
+ It also defines capsule varialbe name and capsule guid hob data structure. \r
They are used by EDKII implementation of capsule update across a system reset.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation\r
/** @file\r
This file defines the genenic platform guid for EFI variable.\r
- Common drivers can use this generic guid with its variable name to specify \r
+ Generic drivers can use this guid with its variable name to specify \r
its EFI variable without defining another new guid.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
/** @file\r
- EDK II implementation specific HII relative definition.\r
+ EDKII extented HII IFR guid opcodes.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
/// EFI_IFR_EXTEND_OP_BANNER\r
///\r
UINT8 ExtendOpCode;\r
- EFI_STRING_ID Title; /// The string token for the banner title\r
- UINT16 LineNumber; /// 1-based line number\r
- UINT8 Alignment; /// left, center, or right-aligned\r
+ EFI_STRING_ID Title; ///< The string token for the banner title\r
+ UINT16 LineNumber; ///< 1-based line number\r
+ UINT8 Alignment; ///< left, center, or right-aligned\r
} EFI_IFR_GUID_BANNER;\r
\r
///\r
/// EFI_IFR_EXTEND_OP_TIMEOUT\r
///\r
UINT8 ExtendOpCode;\r
- UINT16 TimeOut; /// TimeOut Value\r
+ UINT16 TimeOut; ///< TimeOut Value\r
} EFI_IFR_GUID_TIMEOUT;\r
\r
#define EFI_NON_DEVICE_CLASS 0x00\r
/// EFI_IFR_EXTEND_OP_CLASS\r
///\r
UINT8 ExtendOpCode;\r
- UINT16 Class; /// Device Class from the above\r
+ UINT16 Class; ///< Device Class from the above\r
} EFI_IFR_GUID_CLASS;\r
\r
#define EFI_SETUP_APPLICATION_SUBCLASS 0x00\r
/// EFI_IFR_EXTEND_OP_SUBCLASS\r
///\r
UINT8 ExtendOpCode;\r
- UINT16 SubClass; ///Sub Class type from the above\r
+ UINT16 SubClass; ///< Sub Class type from the above\r
} EFI_IFR_GUID_SUBCLASS;\r
\r
///\r
/** @file\r
- The variable data structure related to EDK II specific UEFI variable implementation.\r
+ The variable data structures are related to EDK II specific UEFI variable implementation.\r
+ Variable data header and Variable storage region header are defined here.\r
\r
Copyright (c) 2006 - 2008 Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
#define __VARIABLE_FORMAT_H__\r
\r
///\r
-/// Maximum buffer for the single variable.\r
-///\r
-#ifndef MAX_VARIABLE_SIZE\r
-#define MAX_VARIABLE_SIZE FixedPcdGet32(PcdMaxVariableSize)\r
-#endif\r
-\r
-///\r
-/// Maximum buffer for Hardware error record variable\r
-///\r
-#ifndef MAX_HARDWARE_ERROR_VARIABLE_SIZE\r
-#define MAX_HARDWARE_ERROR_VARIABLE_SIZE FixedPcdGet32(PcdMaxHardwareErrorVariableSize)\r
-#endif\r
-\r
-///\r
-/// The alignment of variable's start offset.\r
-/// For IA32/X64 architecture, the alignment is set to 1, and\r
-/// 8 is for IPF archtecture.\r
+/// Alignment of variable name and data.\r
+/// For IA32/X64 architecture, the alignment is set to 1, and 8 is for IPF archtecture.\r
///\r
#if defined (MDE_CPU_IPF)\r
#define ALIGNMENT 8\r
#define ALIGNMENT 1\r
#endif\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
+///\r
+/// Alignment of Variable Data Header in Variable Store region\r
+///\r
#define HEADER_ALIGNMENT 4\r
+#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))\r
\r
///\r
-/// Variable Store Status\r
+/// Status of Variable Store Region\r
///\r
typedef enum {\r
EfiRaw,\r
#define VAR_ADDED 0x3f ///< Variable has been completely added\r
\r
///\r
-/// Variable Data Header Structure\r
+/// Single Variable Data Header Structure\r
///\r
typedef struct {\r
///\r
///\r
UINT32 DataSize;\r
///\r
- /// A unique identifier for the vendor.\r
+ /// A unique identifier for the vendor that produce and consume this varaible.\r
///\r
EFI_GUID VendorGuid;\r
} VARIABLE_HEADER;\r
#define WORKING_BLOCK_INVALID 0x2\r
\r
///\r
-/// EFI Fault tolerant working block header\r
-/// The header is immediately followed by the write queue.\r
+/// EDKII Fault tolerant working block header\r
+/// The header is immediately followed by the write queue data.\r
///\r
typedef struct {\r
///\r
BaseMemoryLib\r
\r
[Protocols]\r
- gEfiCrc32GuidedSectionExtractionProtocolGuid # ALWAYS CONSUMED used as Guid, not protocol service\r
- gEfiSecurityPolicyProtocolGuid # ALWAYS CONSUMED\r
+ gEfiCrc32GuidedSectionExtractionProtocolGuid ## PRODUCED\r
+ gEfiSecurityPolicyProtocolGuid ## SOMETIMES_CONSUMED (Set platform override AUTH status if exist)\r
\ No newline at end of file
# \r
# Capsule Runtime Drivers produces two UEFI capsule runtime services.\r
# (UpdateCapsule, QueryCapsuleCapabilities)\r
-# It installs the Capsule Architectural Protocol (EDKII definition) to signify \r
+# It installs the Capsule Architectural Protocol (EDKII extension definition) to signify \r
# the capsule runtime services are ready.\r
# \r
# Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
UefiRuntimeLib\r
\r
[Guids]\r
- gEfiCapsuleVendorGuid # Produce variable L"CapsuleUpdateData" for capsule updated data\r
+ gEfiCapsuleVendorGuid ## SOMETIMES_PRODUCED (Process across reset capsule image) ## Variable:L"CapsuleUpdateData" for capsule updated data\r
\r
[Protocols]\r
- gEfiCapsuleArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED\r
+ gEfiCapsuleArchProtocolGuid ## PRODUCED\r
\r
[FeaturePcd]\r
gEfiMdeModulePkgTokenSpaceGuid.PcdSupportUpdateCapsuleReset\r
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule\r
\r
[Depex]\r
- gEfiVariableWriteArchProtocolGuid # Depends on variable write functionality to produce capsule data variable\r
+ gEfiVariableWriteArchProtocolGuid ## Depends on variable write functionality to produce capsule data variable\r
DevicePathLib\r
\r
[Guids]\r
- gEfiSystemNvDataFvGuid # ALWAYS_CONSUMED, Signature of Working Space Header\r
+ gEfiSystemNvDataFvGuid ## CONSUMED ## FV Signature of Working Space Header\r
\r
[Protocols]\r
- gEfiFirmwareVolumeBlockProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
- gEfiFaultTolerantWriteLiteProtocolGuid # PROTOCOL ALWAYS_PRODUCED\r
+ gEfiFirmwareVolumeBlockProtocolGuid ## CONSUMED\r
+ gEfiFaultTolerantWriteLiteProtocolGuid ## PRODUCED\r
\r
[Pcd.common]\r
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize\r
DebugLib\r
\r
[Guids]\r
- gPcdPeiCallbackFnTableHobGuid # ALWAYS_PRODUCED Hob: GUID_EXTENSION\r
- gPcdDataBaseHobGuid # ALWAYS_PRODUCED Hob: GUID_EXTENSION\r
-\r
+ gPcdPeiCallbackFnTableHobGuid ## RPIVATE ## Hob\r
+ gPcdDataBaseHobGuid ## PRODUCED ## Hob\r
+ gPcdDataBaseHobGuid ## CONSUMED ## Hob\r
\r
[Ppis]\r
- gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_CONSUMED\r
- gPcdPpiGuid # PPI ALWAYS_PRODUCED\r
+ gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMED\r
+ gPcdPpiGuid ## PRODUCED\r
\r
[FeaturePcd.common]\r
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiPcdDatabaseSetEnabled\r
&Size,\r
NULL\r
);\r
- if (Status == EFI_BUFFER_TOO_SMALL) {\r
-\r
\r
+ if (Status == EFI_BUFFER_TOO_SMALL) {\r
Status = PeiServicesAllocatePool (Size, &Buffer);\r
ASSERT_EFI_ERROR (Status);\r
\r
*VariableData = Buffer;\r
\r
return EFI_SUCCESS;\r
- } \r
+ }\r
\r
return EFI_NOT_FOUND;\r
}\r
\r
\r
[Ppis]\r
- gEfiPciCfg2PpiGuid # PPI ALWAYS_PRODUCED\r
+ gEfiPciCfg2PpiGuid ## PRODUCED\r
\r
[Depex]\r
TRUE\r
/** @file\r
\r
-Copyright (c) 2007 - 2008, Intel Corporation\r
-All rights reserved. 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
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-Module Name:\r
-\r
- PlatOverMngr.c\r
-\r
-Abstract:\r
-\r
A UI application to offer a UI interface in device manager to let user configue\r
platform override protocol to override the default algorithm for matching\r
drivers to controllers.\r
4. The UI application save all the mapping info in NV variables which will be consumed\r
by platform override protocol driver to publish the platform override protocol.\r
\r
+Copyright (c) 2007 - 2008, Intel Corporation\r
+All rights reserved. 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
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
**/\r
\r
#include <PiDxe.h>\r
IN CHAR8 *Language\r
)\r
{\r
- CHAR8 *LangCode;\r
- LangCode = NULL;\r
+ CHAR8 *LangCode;\r
+ LangCode = NULL;\r
\r
//\r
- // check the input language is English\r
+ // Check the input language is English\r
//\r
if (AsciiStrnCmp (Language, "en-", 3) != 0) {\r
return NULL;\r
}\r
-\r
- //\r
- // Convert Language string from RFC 3066 to ISO 639-2\r
- //\r
- LangCode = AllocateZeroPool(4);\r
- AsciiStrCpy (LangCode, "eng");\r
\r
//\r
- // Check whether the converted language is supported in the SupportedLanguages list.\r
+ // Check SupportedLanguages format\r
//\r
- if (AsciiStrStr (SupportedLanguages, LangCode) == NULL) {\r
- FreePool (LangCode);\r
- return NULL;\r
+ if (AsciiStrStr (SupportedLanguages, "en-") != NULL) {\r
+ //\r
+ // Create RFC 3066 language\r
+ //\r
+ LangCode = AllocateZeroPool(AsciiStrSize (Language));\r
+ AsciiStrCpy (LangCode, Language);\r
+ } else if (AsciiStrStr (SupportedLanguages, "en") != NULL) {\r
+ //\r
+ // Create ISO 639-2 Language\r
+ //\r
+ LangCode = AllocateZeroPool(4);\r
+ AsciiStrCpy (LangCode, "eng"); \r
}\r
-\r
+ \r
return LangCode;\r
}\r
\r
if (ComponentName != NULL) {\r
if (ComponentName->GetDriverName != NULL) {\r
SupportedLanguage = ConvertComponentNameSupportLanguage (ComponentName->SupportedLanguages, mLanguage);\r
- Status = ComponentName->GetDriverName (\r
- ComponentName,\r
- SupportedLanguage,\r
- &DriverName\r
- );\r
- FreePool (SupportedLanguage);\r
+ if (SupportedLanguage != NULL) {\r
+ Status = ComponentName->GetDriverName (\r
+ ComponentName,\r
+ SupportedLanguage,\r
+ &DriverName\r
+ );\r
+ FreePool (SupportedLanguage);\r
+ }\r
}\r
} else if (ComponentName2 != NULL) {\r
if (ComponentName2->GetDriverName != NULL) {\r
if (EFI_ERROR (Status) || (DriverBindingHandleCount == 0)) {\r
return NULL;\r
}\r
-\r
+ \r
+ //\r
+ // Get the first Driver Binding handle which has the specific image handle.\r
+ //\r
for (Index = 0; Index < DriverBindingHandleCount; Index++) {\r
DriverBindingInterface = NULL;\r
Status = gBS->OpenProtocol (\r
}\r
}\r
\r
- //\r
- // If no Driver Binding Protocol instance is found\r
- //\r
FreePool (DriverBindingHandleBuffer);\r
return DriverBindingHandle;\r
}\r
EFI_CALLBACK_INFO *CallbackInfo;\r
EFI_HANDLE DriverHandle;\r
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;\r
-\r
+ \r
//\r
// There should only be one HII protocol\r
//\r
//\r
Status = HiiLibCreateHiiDriverHandle (&DriverHandle);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Finish;\r
}\r
CallbackInfo->DriverHandle = DriverHandle;\r
\r
&CallbackInfo->ConfigAccess\r
);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Finish;\r
}\r
\r
//\r
);\r
FreePool (PackageList);\r
\r
+ if (EFI_ERROR (Status)) {\r
+ goto Finish;\r
+ }\r
+\r
//\r
// Locate ConfigRouting protocol\r
//\r
(VOID **) &CallbackInfo->HiiConfigRouting\r
);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Finish;\r
}\r
\r
//\r
NULL,\r
NULL\r
);\r
+ if (EFI_ERROR (Status)) {\r
+ goto Finish;\r
+ }\r
\r
Status = HiiDatabase->RemovePackageList (HiiDatabase, CallbackInfo->RegisteredHandle);\r
if (EFI_ERROR (Status)) {\r
- return Status;\r
+ goto Finish;\r
}\r
-\r
+ \r
return EFI_SUCCESS;\r
+\r
+Finish:\r
+ if (CallbackInfo->DriverHandle != NULL) {\r
+ HiiLibDestroyHiiDriverHandle (CallbackInfo->DriverHandle);\r
+ }\r
+ if (CallbackInfo != NULL) {\r
+ FreePool (CallbackInfo);\r
+ }\r
+\r
+ return Status;\r
}\r
GenericBdsLib\r
\r
[Guids]\r
- gEfiGlobalVariableGuid # Get value of variable L"PlatformLang". \r
- # this value specifies the platform supported language string (RFC 3066)\r
+ gEfiGlobalVariableGuid ## CONSUMED ## Variable:L"PlatformLang" this variable specifies the platform supported language string (RFC 3066 format)\r
\r
[Protocols]\r
- gEfiComponentName2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
- gEfiComponentNameProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
- gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
- gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
- gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
- gEfiBusSpecificDriverOverrideProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
- gEfiDriverBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
- gEfiLoadedImageProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
- gEfiLoadedImageDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
- gEfiHiiDatabaseProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
- gEfiFormBrowser2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
- gEfiHiiConfigRoutingProtocolGuid # PROTOCOL ALWAYS_CONSUMED\r
- gEfiHiiConfigAccessProtocolGuid # PROTOCOL ALWAYS_PRODUCED\r
+ gEfiComponentName2ProtocolGuid ## SOMETIMES_CONSUMED (Get Driver Name if ComponentName2Protocol exists)\r
+ gEfiComponentNameProtocolGuid ## SOMETIMES_CONSUMED (Get Driver Name if ComponentNameProtocol exists and ComponentName2Protocol doesn't exist)\r
+ gEfiFirmwareVolume2ProtocolGuid ## SOMETIMES_CONSUMED (Get Driver Name from EFI UI section if ComponentName2Protocol and ComponentNameProtocol don't exist)\r
+ gEfiPciIoProtocolGuid ## SOMETIMES_CONSUMED (Find the PCI device if PciIo protocol is installed)\r
+ gEfiBusSpecificDriverOverrideProtocolGuid ## SOMETIMES_CONSUMED (Check whether the PCI device contains one or more efi drivers in its option rom by this protocol) \r
+\r
+ gEfiDriverBindingProtocolGuid ## SOMETIMES_CONSUMED\r
+ gEfiLoadedImageProtocolGuid ## SOMETIMES_CONSUMED\r
+ gEfiLoadedImageDevicePathProtocolGuid ## SOMETIMES_CONSUMED (Show the drivers in the second page that support DriverBindingProtocol, LoadedImageProtocol and LoadedImageDevicePathProtocol)\r
+ gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMED (Show the controller device in the first page that support DevicePathProtocol)\r
+\r
+ gEfiHiiDatabaseProtocolGuid ## CONSUMED\r
+ gEfiFormBrowser2ProtocolGuid ## CONSUMED\r
+ gEfiHiiConfigRoutingProtocolGuid ## CONSUMED\r
+ gEfiHiiConfigAccessProtocolGuid ## PRODUCED\r
\ No newline at end of file
UefiBootServicesTableLib\r
\r
[Protocols]\r
- gEfiPlatformDriverOverrideProtocolGuid # ALWAYS_PRODUCED\r
+ gEfiPlatformDriverOverrideProtocolGuid ## PRODUCED\r
\ No newline at end of file
DebugLib\r
\r
[Protocols]\r
- gEfiSecurityArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED\r
+ gEfiSecurityArchProtocolGuid ## PRODUCED\r
\r
[Depex]\r
TRUE\r
VarHeader = (VARIABLE_HEADER *) (GetVariableDataPtr (Variable) + Variable->DataSize + GET_PAD_SIZE (Variable->DataSize));\r
\r
if (VarHeader->StartId != VARIABLE_DATA ||\r
- (sizeof (VARIABLE_HEADER) + VarHeader->DataSize + VarHeader->NameSize) > MAX_VARIABLE_SIZE\r
+ (sizeof (VARIABLE_HEADER) + VarHeader->DataSize + VarHeader->NameSize) > FixedPcdGet32(PcdMaxVariableSize)\r
) {\r
return NULL;\r
}\r
}\r
//\r
// The size of the VariableName, including the Unicode Null in bytes plus\r
- // the DataSize is limited to maximum size of MAX_HARDWARE_ERROR_VARIABLE_SIZE (32K)\r
- // bytes for HwErrRec, and MAX_VARIABLE_SIZE (1024) bytes for the others.\r
+ // the DataSize is limited to maximum size of FixedPcdGet32(PcdMaxHardwareErrorVariableSize)\r
+ // bytes for HwErrRec, and FixedPcdGet32(PcdMaxVariableSize) bytes for the others.\r
//\r
if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {\r
- if ((DataSize > MAX_HARDWARE_ERROR_VARIABLE_SIZE) || \r
- (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_HARDWARE_ERROR_VARIABLE_SIZE)) {\r
+ if ((DataSize > FixedPcdGet32(PcdMaxHardwareErrorVariableSize)) || \r
+ (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > FixedPcdGet32(PcdMaxHardwareErrorVariableSize))) {\r
return EFI_INVALID_PARAMETER;\r
} \r
} else {\r
//\r
// The size of the VariableName, including the Unicode Null in bytes plus\r
- // the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.\r
+ // the DataSize is limited to maximum size of FixedPcdGet32(PcdMaxVariableSize) bytes.\r
//\r
- if ((DataSize > MAX_VARIABLE_SIZE) ||\r
- (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_VARIABLE_SIZE)) {\r
+ if ((DataSize > FixedPcdGet32(PcdMaxVariableSize)) ||\r
+ (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > FixedPcdGet32(PcdMaxVariableSize))) {\r
return EFI_INVALID_PARAMETER;\r
} \r
} \r
*RemainingVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);\r
\r
//\r
- // Let *MaximumVariableSize be MAX_VARIABLE_SIZE with the exception of the variable header size.\r
+ // Let *MaximumVariableSize be FixedPcdGet32(PcdMaxVariableSize) with the exception of the variable header size.\r
//\r
- *MaximumVariableSize = MAX_VARIABLE_SIZE - sizeof (VARIABLE_HEADER);\r
+ *MaximumVariableSize = FixedPcdGet32(PcdMaxVariableSize) - sizeof (VARIABLE_HEADER);\r
\r
//\r
// Harware error record variable needs larger size.\r
//\r
if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {\r
- *MaximumVariableSize = MAX_HARDWARE_ERROR_VARIABLE_SIZE - sizeof (VARIABLE_HEADER);\r
+ *MaximumVariableSize = FixedPcdGet32(PcdMaxHardwareErrorVariableSize) - sizeof (VARIABLE_HEADER);\r
}\r
\r
//\r
// Allocate memory for volatile variable store\r
//\r
VariableStore = (VARIABLE_STORE_HEADER *) AllocateRuntimePool (\r
- VARIABLE_STORE_SIZE\r
+ FixedPcdGet32(PcdVariableStoreSize)\r
);\r
if (NULL == VariableStore) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- SetMem (VariableStore, VARIABLE_STORE_SIZE, 0xff);\r
+ SetMem (VariableStore, FixedPcdGet32(PcdVariableStoreSize), 0xff);\r
\r
//\r
// Variable Specific Data\r
*LastVariableOffset = sizeof (VARIABLE_STORE_HEADER);\r
\r
VariableStore->Signature = VARIABLE_STORE_SIGNATURE;\r
- VariableStore->Size = VARIABLE_STORE_SIZE;\r
+ VariableStore->Size = FixedPcdGet32(PcdVariableStoreSize);\r
VariableStore->Format = VARIABLE_STORE_FORMATTED;\r
VariableStore->State = VARIABLE_STORE_HEALTHY;\r
VariableStore->Reserved = 0;\r
#include <Library/PcdLib.h>\r
#include <VariableFormat.h>\r
\r
-#define VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)\r
-#define SCRATCH_SIZE FixedPcdGet32(PcdMaxVariableSize)\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
#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))\r
\r
typedef enum {\r
\r
#include <VariableFormat.h>\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
-#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))\r
-\r
typedef struct {\r
VARIABLE_HEADER *CurrPtr;\r
VARIABLE_HEADER *EndPtr;\r
\r
//\r
// The size of the VariableName, including the Unicode Null in bytes plus\r
- // the DataSize is limited to maximum size of MAX_HARDWARE_ERROR_VARIABLE_SIZE (32K)\r
- // bytes for HwErrRec, and MAX_VARIABLE_SIZE (1024) bytes for the others.\r
+ // the DataSize is limited to maximum size of FixedPcdGet32(PcdMaxHardwareErrorVariableSize)\r
+ // bytes for HwErrRec, and FixedPcdGet32(PcdMaxVariableSize) bytes for the others.\r
//\r
if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {\r
- if ((DataSize > MAX_HARDWARE_ERROR_VARIABLE_SIZE) || \r
- (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_HARDWARE_ERROR_VARIABLE_SIZE)) {\r
+ if ((DataSize > FixedPcdGet32(PcdMaxHardwareErrorVariableSize)) || \r
+ (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > FixedPcdGet32(PcdMaxHardwareErrorVariableSize))) {\r
return EFI_INVALID_PARAMETER;\r
} \r
} else {\r
//\r
// The size of the VariableName, including the Unicode Null in bytes plus\r
- // the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.\r
+ // the DataSize is limited to maximum size of FixedPcdGet32(PcdMaxVariableSize) bytes.\r
//\r
- if ((DataSize > MAX_VARIABLE_SIZE) ||\r
- (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_VARIABLE_SIZE)) {\r
+ if ((DataSize > FixedPcdGet32(PcdMaxVariableSize)) ||\r
+ (sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > FixedPcdGet32(PcdMaxVariableSize))) {\r
return EFI_INVALID_PARAMETER;\r
} \r
} \r
//\r
NextVariable = GetEndPointer ((VARIABLE_STORE_HEADER *) ((UINTN) mVariableModuleGlobal->VariableGlobal.VolatileVariableBase));\r
\r
- SetMem (NextVariable, SCRATCH_SIZE, 0xff);\r
+ SetMem (NextVariable, FixedPcdGet32(PcdMaxVariableSize), 0xff);\r
\r
NextVariable->StartId = VARIABLE_DATA;\r
NextVariable->Attributes = Attributes;\r
*RemainingVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);\r
\r
//\r
- // Let *MaximumVariableSize be MAX_VARIABLE_SIZE with the exception of the variable header size.\r
+ // Let *MaximumVariableSize be FixedPcdGet32(PcdMaxVariableSize) with the exception of the variable header size.\r
//\r
- *MaximumVariableSize = MAX_VARIABLE_SIZE - sizeof (VARIABLE_HEADER);\r
+ *MaximumVariableSize = FixedPcdGet32(PcdMaxVariableSize) - sizeof (VARIABLE_HEADER);\r
\r
//\r
// Harware error record variable needs larger size.\r
//\r
if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {\r
- *MaximumVariableSize = MAX_HARDWARE_ERROR_VARIABLE_SIZE - sizeof (VARIABLE_HEADER);\r
+ *MaximumVariableSize = FixedPcdGet32(PcdMaxHardwareErrorVariableSize) - sizeof (VARIABLE_HEADER);\r
}\r
\r
//\r
//\r
// Allocate memory for volatile variable store\r
//\r
- VolatileVariableStore = AllocateRuntimePool (VARIABLE_STORE_SIZE + SCRATCH_SIZE);\r
+ VolatileVariableStore = AllocateRuntimePool (FixedPcdGet32(PcdVariableStoreSize) + FixedPcdGet32(PcdMaxVariableSize));\r
if (VolatileVariableStore == NULL) {\r
FreePool (mVariableModuleGlobal);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- SetMem (VolatileVariableStore, VARIABLE_STORE_SIZE + SCRATCH_SIZE, 0xff);\r
+ SetMem (VolatileVariableStore, FixedPcdGet32(PcdVariableStoreSize) + FixedPcdGet32(PcdMaxVariableSize), 0xff);\r
\r
//\r
// Variable Specific Data\r
mVariableModuleGlobal->VolatileLastVariableOffset = (UINTN) GetStartPointer (VolatileVariableStore) - (UINTN) VolatileVariableStore;\r
\r
VolatileVariableStore->Signature = VARIABLE_STORE_SIGNATURE;\r
- VolatileVariableStore->Size = VARIABLE_STORE_SIZE;\r
+ VolatileVariableStore->Size = FixedPcdGet32(PcdVariableStoreSize);\r
VolatileVariableStore->Format = VARIABLE_STORE_FORMATTED;\r
VolatileVariableStore->State = VARIABLE_STORE_HEALTHY;\r
VolatileVariableStore->Reserved = 0;\r
#include <Guid/GlobalVariable.h>\r
#include <VariableFormat.h>\r
\r
-\r
-\r
#define VARIABLE_RECLAIM_THRESHOLD (1024)\r
\r
-#define VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)\r
-#define SCRATCH_SIZE FixedPcdGet32(PcdMaxVariableSize)\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
-#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))\r
-\r
-\r
typedef struct {\r
VARIABLE_HEADER *CurrPtr;\r
VARIABLE_HEADER *EndPtr;\r