1) Use Dynamic Pcd for hold the base address and length of Flash-related block.
2) Remove flash map hob for Nt32Pkg platform git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3178 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -634,8 +634,7 @@ InitializeFtwLite (
|
|||||||
UINTN Offset;
|
UINTN Offset;
|
||||||
EFI_FV_BLOCK_MAP_ENTRY *FvbMapEntry;
|
EFI_FV_BLOCK_MAP_ENTRY *FvbMapEntry;
|
||||||
UINT32 LbaIndex;
|
UINT32 LbaIndex;
|
||||||
EFI_PEI_HOB_POINTERS FvHob;
|
|
||||||
EFI_FLASH_MAP_ENTRY_DATA *FlashMapEntry;
|
|
||||||
//
|
//
|
||||||
// Allocate Private data of this driver,
|
// Allocate Private data of this driver,
|
||||||
// INCLUDING THE FtwWorkSpace[FTW_WORK_SPACE_SIZE].
|
// INCLUDING THE FtwWorkSpace[FTW_WORK_SPACE_SIZE].
|
||||||
@ -666,34 +665,12 @@ InitializeFtwLite (
|
|||||||
FtwLiteDevice->FtwWorkSpaceHeader = (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *) FtwLiteDevice->FtwWorkSpace;
|
FtwLiteDevice->FtwWorkSpaceHeader = (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *) FtwLiteDevice->FtwWorkSpace;
|
||||||
|
|
||||||
FtwLiteDevice->FtwLastRecord = NULL;
|
FtwLiteDevice->FtwLastRecord = NULL;
|
||||||
|
|
||||||
//
|
|
||||||
// BUGBUG: Here should use Pcd after build tool support dynamic PCD
|
|
||||||
//
|
|
||||||
FtwLiteDevice->SpareAreaLength = 0;
|
|
||||||
FtwLiteDevice->WorkSpaceLength = 0;
|
|
||||||
FvHob.Raw = GetHobList ();
|
|
||||||
while ((FvHob.Raw = GetNextGuidHob (&gEfiFlashMapHobGuid, FvHob.Raw)) != NULL) {
|
|
||||||
|
|
||||||
FlashMapEntry = (EFI_FLASH_MAP_ENTRY_DATA *) GET_GUID_HOB_DATA (FvHob.Guid);
|
FtwLiteDevice->WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageFtwWorkingBase);
|
||||||
|
FtwLiteDevice->WorkSpaceLength = (UINTN) PcdGet32 (PcdFlashNvStorageFtwWorkingSize);
|
||||||
//
|
|
||||||
// Get the FTW work space Flash Map SUB area
|
FtwLiteDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageFtwSpareBase);
|
||||||
//
|
FtwLiteDevice->SpareAreaLength = (UINTN) PcdGet32 (PcdFlashNvStorageFtwSpareSize);
|
||||||
if ((FlashMapEntry->AreaType == EFI_FLASH_AREA_FTW_STATE) && (FlashMapEntry->NumEntries == 1)) {
|
|
||||||
FtwLiteDevice->WorkSpaceAddress = FlashMapEntry->Entries[0].Base;
|
|
||||||
FtwLiteDevice->WorkSpaceLength = (UINTN) FlashMapEntry->Entries[0].Length;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Get the FTW backup SUB area
|
|
||||||
//
|
|
||||||
if ((FlashMapEntry->AreaType == EFI_FLASH_AREA_FTW_BACKUP) && (FlashMapEntry->NumEntries == 1)) {
|
|
||||||
FtwLiteDevice->SpareAreaAddress = FlashMapEntry->Entries[0].Base;
|
|
||||||
FtwLiteDevice->SpareAreaLength = (UINTN) FlashMapEntry->Entries[0].Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
FvHob.Raw = GET_NEXT_HOB (FvHob);
|
|
||||||
}
|
|
||||||
|
|
||||||
ASSERT ((FtwLiteDevice->WorkSpaceLength != 0) && (FtwLiteDevice->SpareAreaLength != 0));
|
ASSERT ((FtwLiteDevice->WorkSpaceLength != 0) && (FtwLiteDevice->SpareAreaLength != 0));
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ Abstract:
|
|||||||
//
|
//
|
||||||
#include <Protocol/PciRootBridgeIo.h>
|
#include <Protocol/PciRootBridgeIo.h>
|
||||||
#include <Guid/SystemNvDataGuid.h>
|
#include <Guid/SystemNvDataGuid.h>
|
||||||
#include <Guid/FlashMapHob.h>
|
|
||||||
#include <Protocol/FaultTolerantWriteLite.h>
|
#include <Protocol/FaultTolerantWriteLite.h>
|
||||||
#include <Protocol/FirmwareVolumeBlock.h>
|
#include <Protocol/FirmwareVolumeBlock.h>
|
||||||
//
|
//
|
||||||
@ -50,10 +49,8 @@ Abstract:
|
|||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
#include <Library/HobLib.h>
|
|
||||||
|
|
||||||
#include <Common/WorkingBlockHeader.h>
|
#include <Common/WorkingBlockHeader.h>
|
||||||
#include <Common/FlashMap.h>
|
|
||||||
|
|
||||||
#define EFI_D_FTW_LITE EFI_D_ERROR
|
#define EFI_D_FTW_LITE EFI_D_ERROR
|
||||||
#define EFI_D_FTW_INFO EFI_D_INFO
|
#define EFI_D_FTW_INFO EFI_D_INFO
|
||||||
|
@ -43,8 +43,6 @@
|
|||||||
#include <Library/UefiLib.h>
|
#include <Library/UefiLib.h>
|
||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
#include <Library/MemoryAllocationLib.h>
|
#include <Library/MemoryAllocationLib.h>
|
||||||
#include <Library/HobLib.h>
|
|
||||||
#include <Common/FlashMap.h>
|
|
||||||
#include <Guid/FlashMapHob.h>
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1299,15 +1299,13 @@ Returns:
|
|||||||
EFI_PHYSICAL_ADDRESS FvVolHdr;
|
EFI_PHYSICAL_ADDRESS FvVolHdr;
|
||||||
|
|
||||||
UINT64 TempVariableStoreHeader;
|
UINT64 TempVariableStoreHeader;
|
||||||
UINT64 TempVariableStoreLen;
|
|
||||||
EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor;
|
EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor;
|
||||||
EFI_FLASH_SUBAREA_ENTRY VariableStoreEntry;
|
EFI_FLASH_SUBAREA_ENTRY VariableStoreEntry;
|
||||||
UINT64 BaseAddress;
|
UINT64 BaseAddress;
|
||||||
UINT64 Length;
|
UINT64 Length;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
UINT8 Data;
|
UINT8 Data;
|
||||||
EFI_PEI_HOB_POINTERS FvHob;
|
|
||||||
EFI_FLASH_MAP_ENTRY_DATA *FlashMapEntry;
|
|
||||||
|
|
||||||
mVariableModuleGlobal = AllocateRuntimePool (sizeof (ESAL_VARIABLE_GLOBAL));
|
mVariableModuleGlobal = AllocateRuntimePool (sizeof (ESAL_VARIABLE_GLOBAL));
|
||||||
if (mVariableModuleGlobal == NULL) {
|
if (mVariableModuleGlobal == NULL) {
|
||||||
@ -1343,29 +1341,11 @@ Returns:
|
|||||||
//
|
//
|
||||||
// Get non volatile varaible store
|
// Get non volatile varaible store
|
||||||
//
|
//
|
||||||
// BUGBUG: Here should use dynamic PCD to get NvStorageVariableBase when build tools is ready.
|
|
||||||
TempVariableStoreHeader = 0;
|
|
||||||
TempVariableStoreLen = 0;
|
|
||||||
FvHob.Raw = GetHobList ();
|
|
||||||
while ((FvHob.Raw = GetNextGuidHob (&gEfiFlashMapHobGuid, FvHob.Raw)) != NULL) {
|
|
||||||
|
|
||||||
FlashMapEntry = (EFI_FLASH_MAP_ENTRY_DATA *) GET_GUID_HOB_DATA (FvHob.Guid);
|
TempVariableStoreHeader = (UINT64) PcdGet32 (PcdFlashNvStorageVariableBase);
|
||||||
|
|
||||||
//
|
|
||||||
// Get the FTW work space Flash Map SUB area
|
|
||||||
//
|
|
||||||
if ((FlashMapEntry->AreaType == EFI_FLASH_AREA_EFI_VARIABLES) && (FlashMapEntry->NumEntries == 1)) {
|
|
||||||
TempVariableStoreHeader = FlashMapEntry->Entries[0].Base;
|
|
||||||
TempVariableStoreLen = FlashMapEntry->Entries[0].Length;
|
|
||||||
}
|
|
||||||
FvHob.Raw = GET_NEXT_HOB (FvHob);
|
|
||||||
}
|
|
||||||
ASSERT ((TempVariableStoreHeader != 0) && (TempVariableStoreLen != 0));
|
|
||||||
|
|
||||||
//TempVariableStoreHeader = (UINT64) PcdGet32 (PcdFlashNvStorageVariableBase);
|
|
||||||
VariableStoreEntry.Base = TempVariableStoreHeader + \
|
VariableStoreEntry.Base = TempVariableStoreHeader + \
|
||||||
(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (TempVariableStoreHeader)) -> HeaderLength);
|
(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (TempVariableStoreHeader)) -> HeaderLength);
|
||||||
VariableStoreEntry.Length = TempVariableStoreLen - \
|
VariableStoreEntry.Length = (UINT64) PcdGet32 (PcdFlashNvStorageVariableSize) - \
|
||||||
(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (TempVariableStoreHeader)) -> HeaderLength);
|
(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (TempVariableStoreHeader)) -> HeaderLength);
|
||||||
//
|
//
|
||||||
// Mark the variable storage region of the FLASH as RUNTIME
|
// Mark the variable storage region of the FLASH as RUNTIME
|
||||||
|
@ -262,12 +262,6 @@
|
|||||||
PcdMaxSizeNonPopulateCapsule|gEfiMdeModulePkgTokenSpaceGuid|0x0
|
PcdMaxSizeNonPopulateCapsule|gEfiMdeModulePkgTokenSpaceGuid|0x0
|
||||||
PcdMaxSizePopulateCapsule|gEfiMdeModulePkgTokenSpaceGuid|0x0
|
PcdMaxSizePopulateCapsule|gEfiMdeModulePkgTokenSpaceGuid|0x0
|
||||||
PcdPciIncompatibleDeviceSupportMask|gEfiIntelFrameworkModulePkgTokenSpaceGuid|0
|
PcdPciIncompatibleDeviceSupportMask|gEfiIntelFrameworkModulePkgTokenSpaceGuid|0
|
||||||
PcdFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid|0x0
|
|
||||||
PcdFlashNvStorageFtwSpareSize|gEfiMdeModulePkgTokenSpaceGuid|0x280000
|
|
||||||
PcdFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid|0x28e000
|
|
||||||
PcdFlashNvStorageFtwWorkingSize|gEfiMdeModulePkgTokenSpaceGuid|0x2000
|
|
||||||
PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid|0x280000
|
|
||||||
PcdFlashNvStorageVariableSize|gEfiMdeModulePkgTokenSpaceGuid|0x00c000
|
|
||||||
PcdStatusCodeValueUncorrectableMemoryError|gEfiMdePkgTokenSpaceGuid|0x0005100 # EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UNCORRECTABLE3
|
PcdStatusCodeValueUncorrectableMemoryError|gEfiMdePkgTokenSpaceGuid|0x0005100 # EFI_COMPUTING_UNIT_MEMORY | EFI_CU_MEMORY_EC_UNCORRECTABLE3
|
||||||
PcdStatusCodeValueRemoteConsoleError|gEfiMdePkgTokenSpaceGuid|0x01040006 # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_CONTROLLER_ERROR
|
PcdStatusCodeValueRemoteConsoleError|gEfiMdePkgTokenSpaceGuid|0x01040006 # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_EC_CONTROLLER_ERROR
|
||||||
PcdStatusCodeValueRemoteConsoleReset|gEfiMdePkgTokenSpaceGuid|0x01040001 # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_PC_RESET
|
PcdStatusCodeValueRemoteConsoleReset|gEfiMdePkgTokenSpaceGuid|0x01040001 # EFI_PERIPHERAL_REMOTE_CONSOLE | EFI_P_PC_RESET
|
||||||
@ -336,6 +330,12 @@
|
|||||||
PcdWinNtCpuModel|gEfiNt32PkgTokenSpaceGuid|L"Intel(R) Processor Model"|48
|
PcdWinNtCpuModel|gEfiNt32PkgTokenSpaceGuid|L"Intel(R) Processor Model"|48
|
||||||
PcdWinNtPhysicalDisk|gEfiNt32PkgTokenSpaceGuid|L"E:RW;245760;512"|30
|
PcdWinNtPhysicalDisk|gEfiNt32PkgTokenSpaceGuid|L"E:RW;245760;512"|30
|
||||||
PcdWinNtUga|gEfiNt32PkgTokenSpaceGuid|L"UGA Window 1!UGA Window 2"|50
|
PcdWinNtUga|gEfiNt32PkgTokenSpaceGuid|L"UGA Window 1!UGA Window 2"|50
|
||||||
|
PcdFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid|0x0
|
||||||
|
PcdFlashNvStorageFtwSpareSize|gEfiMdeModulePkgTokenSpaceGuid|0x280000
|
||||||
|
PcdFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid|0x28e000
|
||||||
|
PcdFlashNvStorageFtwWorkingSize|gEfiMdeModulePkgTokenSpaceGuid|0x2000
|
||||||
|
PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid|0x280000
|
||||||
|
PcdFlashNvStorageVariableSize|gEfiMdeModulePkgTokenSpaceGuid|0x00c000
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
|
@ -216,21 +216,18 @@ Returns:
|
|||||||
// PCD entry will get the information.
|
// PCD entry will get the information.
|
||||||
//
|
//
|
||||||
if (FlashHobData.AreaType == EFI_FLASH_AREA_EFI_VARIABLES) {
|
if (FlashHobData.AreaType == EFI_FLASH_AREA_EFI_VARIABLES) {
|
||||||
// BUGBUG: Tool team does not enable dynamic PCD so comment out following code
|
PcdSet32 (PcdFlashNvStorageVariableBase, (UINT32) FlashHobData.SubAreaData.Base);
|
||||||
//PcdSet32 (PcdFlashNvStorageVariableBase, (UINT32) FlashHobData.SubAreaData.Base);
|
PcdSet32 (PcdFlashNvStorageVariableSize, (UINT32) FlashHobData.SubAreaData.Length);
|
||||||
//PcdSet32 (PcdFlashNvStorageVariableSize, (UINT32) FlashHobData.SubAreaData.Length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FlashHobData.AreaType == EFI_FLASH_AREA_FTW_STATE) {
|
if (FlashHobData.AreaType == EFI_FLASH_AREA_FTW_STATE) {
|
||||||
// BUGBUG: Tool team does not enable dynamic PCD so comment out following code
|
PcdSet32 (PcdFlashNvStorageFtwWorkingBase, (UINT32) FlashHobData.SubAreaData.Base);
|
||||||
//PcdSet32 (PcdFlashNvStorageFtwWorkingBase, (UINT32) FlashHobData.SubAreaData.Base);
|
PcdSet32 (PcdFlashNvStorageFtwWorkingSize, (UINT32) FlashHobData.SubAreaData.Length);
|
||||||
//PcdSet32 (PcdFlashNvStorageFtwWorkingSize, (UINT32) FlashHobData.SubAreaData.Length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FlashHobData.AreaType == EFI_FLASH_AREA_FTW_BACKUP) {
|
if (FlashHobData.AreaType == EFI_FLASH_AREA_FTW_BACKUP) {
|
||||||
// BUGBUG: Tool team does not enable dynamic PCD so comment out following code
|
PcdSet32 (PcdFlashNvStorageFtwSpareBase, (UINT32) FlashHobData.SubAreaData.Base);
|
||||||
//PcdSet32 (PcdFlashNvStorageFtwSpareBase, (UINT32) FlashHobData.SubAreaData.Base);
|
PcdSet32 (PcdFlashNvStorageFtwSpareSize, (UINT32) FlashHobData.SubAreaData.Length);
|
||||||
//PcdSet32 (PcdFlashNvStorageFtwSpareSize, (UINT32) FlashHobData.SubAreaData.Length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (FlashHobData.AreaType) {
|
switch (FlashHobData.AreaType) {
|
||||||
@ -265,11 +262,11 @@ Returns:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildGuidDataHob (
|
//BuildGuidDataHob (
|
||||||
&gEfiFlashMapHobGuid,
|
// &gEfiFlashMapHobGuid,
|
||||||
&FlashHobData,
|
// &FlashHobData,
|
||||||
sizeof (EFI_FLASH_AREA_HOB_DATA)
|
// sizeof (EFI_FLASH_AREA_HOB_DATA)
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
|
Reference in New Issue
Block a user