Add INF extension Information

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7228 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2009-01-09 06:26:42 +00:00
parent b3ff502f6d
commit e561879137
22 changed files with 164 additions and 190 deletions

View File

@ -52,5 +52,5 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintEnable
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintString
gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintTimes
gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintString ## Valid when gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintEnable
gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintTimes ## Valid when gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintEnable

View File

@ -1,6 +1,6 @@
/** @file
This file defines header data structures for BMP file and default
FFS GUID Filename for BMP logo file.
This file defines BMP file header data structures.
It also defines the File GUID for default BMP logo file.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
@ -34,10 +34,10 @@ typedef struct {
UINT32 HeaderSize;
UINT32 PixelWidth;
UINT32 PixelHeight;
UINT16 Planes; /// Must be 1
UINT16 BitPerPixel; /// 1, 4, 8, or 24
UINT16 Planes; ///> Must be 1
UINT16 BitPerPixel; ///> 1, 4, 8, or 24
UINT32 CompressionType;
UINT32 ImageSize; /// Compressed image size in bytes
UINT32 ImageSize; ///> Compressed image size in bytes
UINT32 XPixelsPerMeter;
UINT32 YPixelsPerMeter;
UINT32 NumberOfColors;

View File

@ -1,7 +1,6 @@
/** @file
This file defines capsule vendor guid, capsule variable name
and capsule guid hob data structure.
This file defines capsule vendor guid for capsule variable and hob.
It also defines capsule varialbe name and capsule guid hob data structure.
They are used by EDKII implementation of capsule update across a system reset.
Copyright (c) 2006 - 2008, Intel Corporation

View File

@ -1,6 +1,6 @@
/** @file
This file defines the genenic platform guid for EFI variable.
Common drivers can use this generic guid with its variable name to specify
Generic drivers can use this guid with its variable name to specify
its EFI variable without defining another new guid.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>

View File

@ -1,5 +1,5 @@
/** @file
EDK II implementation specific HII relative definition.
EDKII extented HII IFR guid opcodes.
Copyright (c) 2006 - 2008, Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
@ -98,9 +98,9 @@ typedef struct _EFI_IFR_GUID_BANNER {
/// EFI_IFR_EXTEND_OP_BANNER
///
UINT8 ExtendOpCode;
EFI_STRING_ID Title; /// The string token for the banner title
UINT16 LineNumber; /// 1-based line number
UINT8 Alignment; /// left, center, or right-aligned
EFI_STRING_ID Title; ///< The string token for the banner title
UINT16 LineNumber; ///< 1-based line number
UINT8 Alignment; ///< left, center, or right-aligned
} EFI_IFR_GUID_BANNER;
///
@ -116,7 +116,7 @@ typedef struct _EFI_IFR_GUID_TIMEOUT {
/// EFI_IFR_EXTEND_OP_TIMEOUT
///
UINT8 ExtendOpCode;
UINT16 TimeOut; /// TimeOut Value
UINT16 TimeOut; ///< TimeOut Value
} EFI_IFR_GUID_TIMEOUT;
#define EFI_NON_DEVICE_CLASS 0x00
@ -140,7 +140,7 @@ typedef struct _EFI_IFR_GUID_CLASS {
/// EFI_IFR_EXTEND_OP_CLASS
///
UINT8 ExtendOpCode;
UINT16 Class; /// Device Class from the above
UINT16 Class; ///< Device Class from the above
} EFI_IFR_GUID_CLASS;
#define EFI_SETUP_APPLICATION_SUBCLASS 0x00
@ -161,7 +161,7 @@ typedef struct _EFI_IFR_GUID_SUBCLASS {
/// EFI_IFR_EXTEND_OP_SUBCLASS
///
UINT8 ExtendOpCode;
UINT16 SubClass; ///Sub Class type from the above
UINT16 SubClass; ///< Sub Class type from the above
} EFI_IFR_GUID_SUBCLASS;
///

View File

@ -1,5 +1,6 @@
/** @file
The variable data structure related to EDK II specific UEFI variable implementation.
The variable data structures are related to EDK II specific UEFI variable implementation.
Variable data header and Variable storage region header are defined here.
Copyright (c) 2006 - 2008 Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
@ -16,23 +17,8 @@
#define __VARIABLE_FORMAT_H__
///
/// Maximum buffer for the single variable.
///
#ifndef MAX_VARIABLE_SIZE
#define MAX_VARIABLE_SIZE FixedPcdGet32(PcdMaxVariableSize)
#endif
///
/// Maximum buffer for Hardware error record variable
///
#ifndef MAX_HARDWARE_ERROR_VARIABLE_SIZE
#define MAX_HARDWARE_ERROR_VARIABLE_SIZE FixedPcdGet32(PcdMaxHardwareErrorVariableSize)
#endif
///
/// The alignment of variable's start offset.
/// For IA32/X64 architecture, the alignment is set to 1, and
/// 8 is for IPF archtecture.
/// Alignment of variable name and data.
/// For IA32/X64 architecture, the alignment is set to 1, and 8 is for IPF archtecture.
///
#if defined (MDE_CPU_IPF)
#define ALIGNMENT 8
@ -40,10 +26,23 @@
#define ALIGNMENT 1
#endif
#define HEADER_ALIGNMENT 4
//
// Define GET_PAD_SIZE to optimize compiler
//
#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
#define GET_PAD_SIZE(a) (0)
#else
#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
#endif
///
/// Variable Store Status
/// Alignment of Variable Data Header in Variable Store region
///
#define HEADER_ALIGNMENT 4
#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))
///
/// Status of Variable Store Region
///
typedef enum {
EfiRaw,
@ -100,7 +99,7 @@ typedef struct {
#define VAR_ADDED 0x3f ///< Variable has been completely added
///
/// Variable Data Header Structure
/// Single Variable Data Header Structure
///
typedef struct {
///
@ -125,7 +124,7 @@ typedef struct {
///
UINT32 DataSize;
///
/// A unique identifier for the vendor.
/// A unique identifier for the vendor that produce and consume this varaible.
///
EFI_GUID VendorGuid;
} VARIABLE_HEADER;

View File

@ -20,8 +20,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define WORKING_BLOCK_INVALID 0x2
///
/// EFI Fault tolerant working block header
/// The header is immediately followed by the write queue.
/// EDKII Fault tolerant working block header
/// The header is immediately followed by the write queue data.
///
typedef struct {
///

View File

@ -45,6 +45,6 @@
BaseMemoryLib
[Protocols]
gEfiCrc32GuidedSectionExtractionProtocolGuid # ALWAYS CONSUMED used as Guid, not protocol service
gEfiSecurityPolicyProtocolGuid # ALWAYS CONSUMED
gEfiCrc32GuidedSectionExtractionProtocolGuid ## PRODUCED
gEfiSecurityPolicyProtocolGuid ## SOMETIMES_CONSUMED (Set platform override AUTH status if exist)

View File

@ -2,7 +2,7 @@
#
# Capsule Runtime Drivers produces two UEFI capsule runtime services.
# (UpdateCapsule, QueryCapsuleCapabilities)
# It installs the Capsule Architectural Protocol (EDKII definition) to signify
# It installs the Capsule Architectural Protocol (EDKII extension definition) to signify
# the capsule runtime services are ready.
#
# Copyright (c) 2006 - 2008, Intel Corporation. <BR>
@ -47,10 +47,10 @@
UefiRuntimeLib
[Guids]
gEfiCapsuleVendorGuid # Produce variable L"CapsuleUpdateData" for capsule updated data
gEfiCapsuleVendorGuid ## SOMETIMES_PRODUCED (Process across reset capsule image) ## Variable:L"CapsuleUpdateData" for capsule updated data
[Protocols]
gEfiCapsuleArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
gEfiCapsuleArchProtocolGuid ## PRODUCED
[FeaturePcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdSupportUpdateCapsuleReset
@ -60,4 +60,4 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule
[Depex]
gEfiVariableWriteArchProtocolGuid # Depends on variable write functionality to produce capsule data variable
gEfiVariableWriteArchProtocolGuid ## Depends on variable write functionality to produce capsule data variable

View File

@ -50,11 +50,11 @@
DevicePathLib
[Guids]
gEfiSystemNvDataFvGuid # ALWAYS_CONSUMED, Signature of Working Space Header
gEfiSystemNvDataFvGuid ## CONSUMED ## FV Signature of Working Space Header
[Protocols]
gEfiFirmwareVolumeBlockProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiFaultTolerantWriteLiteProtocolGuid # PROTOCOL ALWAYS_PRODUCED
gEfiFirmwareVolumeBlockProtocolGuid ## CONSUMED
gEfiFaultTolerantWriteLiteProtocolGuid ## PRODUCED
[Pcd.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize

View File

@ -47,13 +47,13 @@
DebugLib
[Guids]
gPcdPeiCallbackFnTableHobGuid # ALWAYS_PRODUCED Hob: GUID_EXTENSION
gPcdDataBaseHobGuid # ALWAYS_PRODUCED Hob: GUID_EXTENSION
gPcdPeiCallbackFnTableHobGuid ## RPIVATE ## Hob
gPcdDataBaseHobGuid ## PRODUCED ## Hob
gPcdDataBaseHobGuid ## CONSUMED ## Hob
[Ppis]
gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_CONSUMED
gPcdPpiGuid # PPI ALWAYS_PRODUCED
gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMED
gPcdPpiGuid ## PRODUCED
[FeaturePcd.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiPcdDatabaseSetEnabled

View File

@ -167,9 +167,8 @@ GetHiiVariable (
&Size,
NULL
);
if (Status == EFI_BUFFER_TOO_SMALL) {
Status = PeiServicesAllocatePool (Size, &Buffer);
ASSERT_EFI_ERROR (Status);
@ -187,7 +186,7 @@ GetHiiVariable (
*VariableData = Buffer;
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}

View File

@ -45,7 +45,7 @@
[Ppis]
gEfiPciCfg2PpiGuid # PPI ALWAYS_PRODUCED
gEfiPciCfg2PpiGuid ## PRODUCED
[Depex]
TRUE

View File

@ -1,20 +1,5 @@
/** @file
Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
PlatOverMngr.c
Abstract:
A UI application to offer a UI interface in device manager to let user configue
platform override protocol to override the default algorithm for matching
drivers to controllers.
@ -27,6 +12,15 @@ Abstract:
4. The UI application save all the mapping info in NV variables which will be consumed
by platform override protocol driver to publish the platform override protocol.
Copyright (c) 2007 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <PiDxe.h>
@ -119,30 +113,33 @@ ConvertComponentNameSupportLanguage (
IN CHAR8 *Language
)
{
CHAR8 *LangCode;
LangCode = NULL;
CHAR8 *LangCode;
LangCode = NULL;
//
// check the input language is English
// Check the input language is English
//
if (AsciiStrnCmp (Language, "en-", 3) != 0) {
return NULL;
}
//
// Convert Language string from RFC 3066 to ISO 639-2
//
LangCode = AllocateZeroPool(4);
AsciiStrCpy (LangCode, "eng");
//
// Check whether the converted language is supported in the SupportedLanguages list.
// Check SupportedLanguages format
//
if (AsciiStrStr (SupportedLanguages, LangCode) == NULL) {
FreePool (LangCode);
return NULL;
if (AsciiStrStr (SupportedLanguages, "en-") != NULL) {
//
// Create RFC 3066 language
//
LangCode = AllocateZeroPool(AsciiStrSize (Language));
AsciiStrCpy (LangCode, Language);
} else if (AsciiStrStr (SupportedLanguages, "en") != NULL) {
//
// Create ISO 639-2 Language
//
LangCode = AllocateZeroPool(4);
AsciiStrCpy (LangCode, "eng");
}
return LangCode;
}
@ -193,12 +190,14 @@ GetComponentName (
if (ComponentName != NULL) {
if (ComponentName->GetDriverName != NULL) {
SupportedLanguage = ConvertComponentNameSupportLanguage (ComponentName->SupportedLanguages, mLanguage);
Status = ComponentName->GetDriverName (
ComponentName,
SupportedLanguage,
&DriverName
);
FreePool (SupportedLanguage);
if (SupportedLanguage != NULL) {
Status = ComponentName->GetDriverName (
ComponentName,
SupportedLanguage,
&DriverName
);
FreePool (SupportedLanguage);
}
}
} else if (ComponentName2 != NULL) {
if (ComponentName2->GetDriverName != NULL) {
@ -555,7 +554,10 @@ GetDriverBindingHandleFromImageHandle (
if (EFI_ERROR (Status) || (DriverBindingHandleCount == 0)) {
return NULL;
}
//
// Get the first Driver Binding handle which has the specific image handle.
//
for (Index = 0; Index < DriverBindingHandleCount; Index++) {
DriverBindingInterface = NULL;
Status = gBS->OpenProtocol (
@ -576,9 +578,6 @@ GetDriverBindingHandleFromImageHandle (
}
}
//
// If no Driver Binding Protocol instance is found
//
FreePool (DriverBindingHandleBuffer);
return DriverBindingHandle;
}
@ -1301,7 +1300,7 @@ PlatOverMngrInit (
EFI_CALLBACK_INFO *CallbackInfo;
EFI_HANDLE DriverHandle;
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
//
// There should only be one HII protocol
//
@ -1341,7 +1340,7 @@ PlatOverMngrInit (
//
Status = HiiLibCreateHiiDriverHandle (&DriverHandle);
if (EFI_ERROR (Status)) {
return Status;
goto Finish;
}
CallbackInfo->DriverHandle = DriverHandle;
@ -1355,7 +1354,7 @@ PlatOverMngrInit (
&CallbackInfo->ConfigAccess
);
if (EFI_ERROR (Status)) {
return Status;
goto Finish;
}
//
@ -1377,6 +1376,10 @@ PlatOverMngrInit (
);
FreePool (PackageList);
if (EFI_ERROR (Status)) {
goto Finish;
}
//
// Locate ConfigRouting protocol
//
@ -1386,7 +1389,7 @@ PlatOverMngrInit (
(VOID **) &CallbackInfo->HiiConfigRouting
);
if (EFI_ERROR (Status)) {
return Status;
goto Finish;
}
//
@ -1411,11 +1414,24 @@ PlatOverMngrInit (
NULL,
NULL
);
if (EFI_ERROR (Status)) {
goto Finish;
}
Status = HiiDatabase->RemovePackageList (HiiDatabase, CallbackInfo->RegisteredHandle);
if (EFI_ERROR (Status)) {
return Status;
goto Finish;
}
return EFI_SUCCESS;
Finish:
if (CallbackInfo->DriverHandle != NULL) {
HiiLibDestroyHiiDriverHandle (CallbackInfo->DriverHandle);
}
if (CallbackInfo != NULL) {
FreePool (CallbackInfo);
}
return EFI_SUCCESS;
return Status;
}

View File

@ -67,21 +67,22 @@
GenericBdsLib
[Guids]
gEfiGlobalVariableGuid # Get value of variable L"PlatformLang".
# this value specifies the platform supported language string (RFC 3066)
gEfiGlobalVariableGuid ## CONSUMED ## Variable:L"PlatformLang" this variable specifies the platform supported language string (RFC 3066 format)
[Protocols]
gEfiComponentName2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiComponentNameProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiBusSpecificDriverOverrideProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiDriverBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiLoadedImageProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiLoadedImageDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiHiiDatabaseProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiFormBrowser2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiHiiConfigRoutingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiHiiConfigAccessProtocolGuid # PROTOCOL ALWAYS_PRODUCED
gEfiComponentName2ProtocolGuid ## SOMETIMES_CONSUMED (Get Driver Name if ComponentName2Protocol exists)
gEfiComponentNameProtocolGuid ## SOMETIMES_CONSUMED (Get Driver Name if ComponentNameProtocol exists and ComponentName2Protocol doesn't exist)
gEfiFirmwareVolume2ProtocolGuid ## SOMETIMES_CONSUMED (Get Driver Name from EFI UI section if ComponentName2Protocol and ComponentNameProtocol don't exist)
gEfiPciIoProtocolGuid ## SOMETIMES_CONSUMED (Find the PCI device if PciIo protocol is installed)
gEfiBusSpecificDriverOverrideProtocolGuid ## SOMETIMES_CONSUMED (Check whether the PCI device contains one or more efi drivers in its option rom by this protocol)
gEfiDriverBindingProtocolGuid ## SOMETIMES_CONSUMED
gEfiLoadedImageProtocolGuid ## SOMETIMES_CONSUMED
gEfiLoadedImageDevicePathProtocolGuid ## SOMETIMES_CONSUMED (Show the drivers in the second page that support DriverBindingProtocol, LoadedImageProtocol and LoadedImageDevicePathProtocol)
gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMED (Show the controller device in the first page that support DevicePathProtocol)
gEfiHiiDatabaseProtocolGuid ## CONSUMED
gEfiFormBrowser2ProtocolGuid ## CONSUMED
gEfiHiiConfigRoutingProtocolGuid ## CONSUMED
gEfiHiiConfigAccessProtocolGuid ## PRODUCED

View File

@ -45,5 +45,5 @@
UefiBootServicesTableLib
[Protocols]
gEfiPlatformDriverOverrideProtocolGuid # ALWAYS_PRODUCED
gEfiPlatformDriverOverrideProtocolGuid ## PRODUCED

View File

@ -39,7 +39,7 @@
DebugLib
[Protocols]
gEfiSecurityArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
gEfiSecurityArchProtocolGuid ## PRODUCED
[Depex]
TRUE

View File

@ -118,7 +118,7 @@ GetNextVariablePtr (
VarHeader = (VARIABLE_HEADER *) (GetVariableDataPtr (Variable) + Variable->DataSize + GET_PAD_SIZE (Variable->DataSize));
if (VarHeader->StartId != VARIABLE_DATA ||
(sizeof (VARIABLE_HEADER) + VarHeader->DataSize + VarHeader->NameSize) > MAX_VARIABLE_SIZE
(sizeof (VARIABLE_HEADER) + VarHeader->DataSize + VarHeader->NameSize) > FixedPcdGet32(PcdMaxVariableSize)
) {
return NULL;
}
@ -485,21 +485,21 @@ SetVariable (
}
//
// The size of the VariableName, including the Unicode Null in bytes plus
// the DataSize is limited to maximum size of MAX_HARDWARE_ERROR_VARIABLE_SIZE (32K)
// bytes for HwErrRec, and MAX_VARIABLE_SIZE (1024) bytes for the others.
// the DataSize is limited to maximum size of FixedPcdGet32(PcdMaxHardwareErrorVariableSize)
// bytes for HwErrRec, and FixedPcdGet32(PcdMaxVariableSize) bytes for the others.
//
if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {
if ((DataSize > MAX_HARDWARE_ERROR_VARIABLE_SIZE) ||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_HARDWARE_ERROR_VARIABLE_SIZE)) {
if ((DataSize > FixedPcdGet32(PcdMaxHardwareErrorVariableSize)) ||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > FixedPcdGet32(PcdMaxHardwareErrorVariableSize))) {
return EFI_INVALID_PARAMETER;
}
} else {
//
// The size of the VariableName, including the Unicode Null in bytes plus
// the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.
// the DataSize is limited to maximum size of FixedPcdGet32(PcdMaxVariableSize) bytes.
//
if ((DataSize > MAX_VARIABLE_SIZE) ||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_VARIABLE_SIZE)) {
if ((DataSize > FixedPcdGet32(PcdMaxVariableSize)) ||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > FixedPcdGet32(PcdMaxVariableSize))) {
return EFI_INVALID_PARAMETER;
}
}
@ -740,15 +740,15 @@ QueryVariableInfo (
*RemainingVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);
//
// Let *MaximumVariableSize be MAX_VARIABLE_SIZE with the exception of the variable header size.
// Let *MaximumVariableSize be FixedPcdGet32(PcdMaxVariableSize) with the exception of the variable header size.
//
*MaximumVariableSize = MAX_VARIABLE_SIZE - sizeof (VARIABLE_HEADER);
*MaximumVariableSize = FixedPcdGet32(PcdMaxVariableSize) - sizeof (VARIABLE_HEADER);
//
// Harware error record variable needs larger size.
//
if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {
*MaximumVariableSize = MAX_HARDWARE_ERROR_VARIABLE_SIZE - sizeof (VARIABLE_HEADER);
*MaximumVariableSize = FixedPcdGet32(PcdMaxHardwareErrorVariableSize) - sizeof (VARIABLE_HEADER);
}
//
@ -808,13 +808,13 @@ InitializeVariableStore (
// Allocate memory for volatile variable store
//
VariableStore = (VARIABLE_STORE_HEADER *) AllocateRuntimePool (
VARIABLE_STORE_SIZE
FixedPcdGet32(PcdVariableStoreSize)
);
if (NULL == VariableStore) {
return EFI_OUT_OF_RESOURCES;
}
SetMem (VariableStore, VARIABLE_STORE_SIZE, 0xff);
SetMem (VariableStore, FixedPcdGet32(PcdVariableStoreSize), 0xff);
//
// Variable Specific Data
@ -823,7 +823,7 @@ InitializeVariableStore (
*LastVariableOffset = sizeof (VARIABLE_STORE_HEADER);
VariableStore->Signature = VARIABLE_STORE_SIGNATURE;
VariableStore->Size = VARIABLE_STORE_SIZE;
VariableStore->Size = FixedPcdGet32(PcdVariableStoreSize);
VariableStore->Format = VARIABLE_STORE_FORMATTED;
VariableStore->State = VARIABLE_STORE_HEALTHY;
VariableStore->Reserved = 0;

View File

@ -33,18 +33,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/PcdLib.h>
#include <VariableFormat.h>
#define VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)
#define SCRATCH_SIZE FixedPcdGet32(PcdMaxVariableSize)
//
// Define GET_PAD_SIZE to optimize compiler
//
#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
#define GET_PAD_SIZE(a) (0)
#else
#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
#endif
#define GET_VARIABLE_NAME_PTR(a) (CHAR16 *) ((UINTN) (a) + sizeof (VARIABLE_HEADER))
typedef enum {

View File

@ -30,17 +30,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <VariableFormat.h>
//
// Define GET_PAD_SIZE to optimize compiler
//
#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
#define GET_PAD_SIZE(a) (0)
#else
#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
#endif
#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))
typedef struct {
VARIABLE_HEADER *CurrPtr;
VARIABLE_HEADER *EndPtr;

View File

@ -1225,21 +1225,21 @@ RuntimeServiceSetVariable (
//
// The size of the VariableName, including the Unicode Null in bytes plus
// the DataSize is limited to maximum size of MAX_HARDWARE_ERROR_VARIABLE_SIZE (32K)
// bytes for HwErrRec, and MAX_VARIABLE_SIZE (1024) bytes for the others.
// the DataSize is limited to maximum size of FixedPcdGet32(PcdMaxHardwareErrorVariableSize)
// bytes for HwErrRec, and FixedPcdGet32(PcdMaxVariableSize) bytes for the others.
//
if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {
if ((DataSize > MAX_HARDWARE_ERROR_VARIABLE_SIZE) ||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_HARDWARE_ERROR_VARIABLE_SIZE)) {
if ((DataSize > FixedPcdGet32(PcdMaxHardwareErrorVariableSize)) ||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > FixedPcdGet32(PcdMaxHardwareErrorVariableSize))) {
return EFI_INVALID_PARAMETER;
}
} else {
//
// The size of the VariableName, including the Unicode Null in bytes plus
// the DataSize is limited to maximum size of MAX_VARIABLE_SIZE (1024) bytes.
// the DataSize is limited to maximum size of FixedPcdGet32(PcdMaxVariableSize) bytes.
//
if ((DataSize > MAX_VARIABLE_SIZE) ||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > MAX_VARIABLE_SIZE)) {
if ((DataSize > FixedPcdGet32(PcdMaxVariableSize)) ||
(sizeof (VARIABLE_HEADER) + StrSize (VariableName) + DataSize > FixedPcdGet32(PcdMaxVariableSize))) {
return EFI_INVALID_PARAMETER;
}
}
@ -1391,7 +1391,7 @@ RuntimeServiceSetVariable (
//
NextVariable = GetEndPointer ((VARIABLE_STORE_HEADER *) ((UINTN) mVariableModuleGlobal->VariableGlobal.VolatileVariableBase));
SetMem (NextVariable, SCRATCH_SIZE, 0xff);
SetMem (NextVariable, FixedPcdGet32(PcdMaxVariableSize), 0xff);
NextVariable->StartId = VARIABLE_DATA;
NextVariable->Attributes = Attributes;
@ -1690,15 +1690,15 @@ RuntimeServiceQueryVariableInfo (
*RemainingVariableStorageSize = VariableStoreHeader->Size - sizeof (VARIABLE_STORE_HEADER);
//
// Let *MaximumVariableSize be MAX_VARIABLE_SIZE with the exception of the variable header size.
// Let *MaximumVariableSize be FixedPcdGet32(PcdMaxVariableSize) with the exception of the variable header size.
//
*MaximumVariableSize = MAX_VARIABLE_SIZE - sizeof (VARIABLE_HEADER);
*MaximumVariableSize = FixedPcdGet32(PcdMaxVariableSize) - sizeof (VARIABLE_HEADER);
//
// Harware error record variable needs larger size.
//
if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) == EFI_VARIABLE_HARDWARE_ERROR_RECORD) {
*MaximumVariableSize = MAX_HARDWARE_ERROR_VARIABLE_SIZE - sizeof (VARIABLE_HEADER);
*MaximumVariableSize = FixedPcdGet32(PcdMaxHardwareErrorVariableSize) - sizeof (VARIABLE_HEADER);
}
//
@ -1835,13 +1835,13 @@ VariableCommonInitialize (
//
// Allocate memory for volatile variable store
//
VolatileVariableStore = AllocateRuntimePool (VARIABLE_STORE_SIZE + SCRATCH_SIZE);
VolatileVariableStore = AllocateRuntimePool (FixedPcdGet32(PcdVariableStoreSize) + FixedPcdGet32(PcdMaxVariableSize));
if (VolatileVariableStore == NULL) {
FreePool (mVariableModuleGlobal);
return EFI_OUT_OF_RESOURCES;
}
SetMem (VolatileVariableStore, VARIABLE_STORE_SIZE + SCRATCH_SIZE, 0xff);
SetMem (VolatileVariableStore, FixedPcdGet32(PcdVariableStoreSize) + FixedPcdGet32(PcdMaxVariableSize), 0xff);
//
// Variable Specific Data
@ -1850,7 +1850,7 @@ VariableCommonInitialize (
mVariableModuleGlobal->VolatileLastVariableOffset = (UINTN) GetStartPointer (VolatileVariableStore) - (UINTN) VolatileVariableStore;
VolatileVariableStore->Signature = VARIABLE_STORE_SIGNATURE;
VolatileVariableStore->Size = VARIABLE_STORE_SIZE;
VolatileVariableStore->Size = FixedPcdGet32(PcdVariableStoreSize);
VolatileVariableStore->Format = VARIABLE_STORE_FORMATTED;
VolatileVariableStore->State = VARIABLE_STORE_HEALTHY;
VolatileVariableStore->Reserved = 0;

View File

@ -37,25 +37,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Guid/GlobalVariable.h>
#include <VariableFormat.h>
#define VARIABLE_RECLAIM_THRESHOLD (1024)
#define VARIABLE_STORE_SIZE FixedPcdGet32(PcdVariableStoreSize)
#define SCRATCH_SIZE FixedPcdGet32(PcdMaxVariableSize)
//
// Define GET_PAD_SIZE to optimize compiler
//
#if ((ALIGNMENT == 0) || (ALIGNMENT == 1))
#define GET_PAD_SIZE(a) (0)
#else
#define GET_PAD_SIZE(a) (((~a) + 1) & (ALIGNMENT - 1))
#endif
#define HEADER_ALIGN(Header) (((UINTN) (Header) + HEADER_ALIGNMENT - 1) & (~(HEADER_ALIGNMENT - 1)))
typedef struct {
VARIABLE_HEADER *CurrPtr;
VARIABLE_HEADER *EndPtr;