Implement all four UEFI Runtime Variable services for the nonvolatile\r
and volatile storage space and install variable architecture protocol.\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, 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
#include "Variable.h"\r
\r
extern VARIABLE_STORE_HEADER *mNvVariableCache;\r
-VARIABLE_INFO_ENTRY *gVariableInfo;\r
+extern VARIABLE_INFO_ENTRY *gVariableInfo;\r
EFI_HANDLE mHandle = NULL;\r
EFI_EVENT mVirtualAddressChangeEvent = NULL;\r
-EFI_EVENT mFtwRegistration = NULL;\r
+EFI_EVENT mFtwRegistration = NULL;\r
\r
/**\r
- Return TRUE if ExitBootServices () has been called\r
+ Return TRUE if ExitBootServices () has been called.\r
\r
- @retval TRUE If ExitBootServices () has been called\r
+ @retval TRUE If ExitBootServices () has been called.\r
**/\r
BOOLEAN\r
AtRuntime (\r
EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal->PlatformLang);\r
EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase);\r
EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal->VariableGlobal.VolatileVariableBase);\r
+ EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal->VariableGlobal.HobVariableBase);\r
EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal);\r
EfiConvertPointer (0x0, (VOID **) &mNvVariableCache); \r
}\r
)\r
{\r
ReclaimForOS ();\r
+ if (FeaturePcdGet (PcdVariableCollectStatistics)) {\r
+ gBS->InstallConfigurationTable (&gEfiVariableGuid, gVariableInfo);\r
+ }\r
}\r
\r
\r
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbProtocol;\r
EFI_FAULT_TOLERANT_WRITE_PROTOCOL *FtwProtocol;\r
EFI_PHYSICAL_ADDRESS NvStorageVariableBase;\r
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor;\r
+ EFI_PHYSICAL_ADDRESS BaseAddress;\r
+ UINT64 Length;\r
+ EFI_PHYSICAL_ADDRESS VariableStoreBase;\r
+ UINT64 VariableStoreLength;\r
\r
//\r
// Ensure FTW protocol is installed.\r
return ;\r
}\r
mVariableModuleGlobal->FvbInstance = FvbProtocol;\r
+\r
+ //\r
+ // Mark the variable storage region of the FLASH as RUNTIME.\r
+ //\r
+ VariableStoreBase = mVariableModuleGlobal->VariableGlobal.NonVolatileVariableBase;\r
+ VariableStoreLength = ((VARIABLE_STORE_HEADER *)(UINTN)VariableStoreBase)->Size;\r
+ BaseAddress = VariableStoreBase & (~EFI_PAGE_MASK);\r
+ Length = VariableStoreLength + (VariableStoreBase - BaseAddress);\r
+ Length = (Length + EFI_PAGE_SIZE - 1) & (~EFI_PAGE_MASK);\r
+\r
+ Status = gDS->GetMemorySpaceDescriptor (BaseAddress, &GcdDescriptor);\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((DEBUG_WARN, "Variable driver failed to add EFI_MEMORY_RUNTIME attribute to Flash.\n"));\r
+ } else {\r
+ Status = gDS->SetMemorySpaceAttributes (\r
+ BaseAddress,\r
+ Length,\r
+ GcdDescriptor.Attributes | EFI_MEMORY_RUNTIME\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((DEBUG_WARN, "Variable driver failed to add EFI_MEMORY_RUNTIME attribute to Flash.\n"));\r
+ }\r
+ }\r
\r
Status = VariableWriteServiceInitialize ();\r
ASSERT_EFI_ERROR (Status);\r
&ReadyToBootEvent\r
);\r
\r
- if (FeaturePcdGet (PcdVariableCollectStatistics)) {\r
- gBS->InstallConfigurationTable (&gEfiVariableGuid, gVariableInfo);\r
- }\r
return EFI_SUCCESS;\r
}\r
\r