From 276be2de38a6149d190553d706ab9809192c9b66 Mon Sep 17 00:00:00 2001 From: klu2 Date: Tue, 10 Jul 2007 14:51:34 +0000 Subject: 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 --- .../FaultTolerantWriteLite/Dxe/FtwLite.c | 35 ++++------------------ .../FaultTolerantWriteLite/Dxe/FtwLite.h | 3 -- .../Universal/VariableRuntimeDxe/CommonHeader.h | 4 +-- .../Universal/VariableRuntimeDxe/Variable.c | 26 ++-------------- 4 files changed, 10 insertions(+), 58 deletions(-) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c b/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c index a2ba2b4306..38fe11d80b 100644 --- a/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c +++ b/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c @@ -634,8 +634,7 @@ InitializeFtwLite ( UINTN Offset; EFI_FV_BLOCK_MAP_ENTRY *FvbMapEntry; UINT32 LbaIndex; - EFI_PEI_HOB_POINTERS FvHob; - EFI_FLASH_MAP_ENTRY_DATA *FlashMapEntry; + // // Allocate Private data of this driver, // INCLUDING THE FtwWorkSpace[FTW_WORK_SPACE_SIZE]. @@ -666,34 +665,12 @@ InitializeFtwLite ( FtwLiteDevice->FtwWorkSpaceHeader = (EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER *) FtwLiteDevice->FtwWorkSpace; 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); - - // - // Get the FTW work space Flash Map SUB area - // - 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); - } + FtwLiteDevice->WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageFtwWorkingBase); + FtwLiteDevice->WorkSpaceLength = (UINTN) PcdGet32 (PcdFlashNvStorageFtwWorkingSize); + + FtwLiteDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageFtwSpareBase); + FtwLiteDevice->SpareAreaLength = (UINTN) PcdGet32 (PcdFlashNvStorageFtwSpareSize); ASSERT ((FtwLiteDevice->WorkSpaceLength != 0) && (FtwLiteDevice->SpareAreaLength != 0)); diff --git a/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.h b/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.h index 0701532f90..8bc122dbd3 100644 --- a/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.h +++ b/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.h @@ -38,7 +38,6 @@ Abstract: // #include #include -#include #include #include // @@ -50,10 +49,8 @@ Abstract: #include #include #include -#include #include -#include #define EFI_D_FTW_LITE EFI_D_ERROR #define EFI_D_FTW_INFO EFI_D_INFO diff --git a/MdeModulePkg/Universal/VariableRuntimeDxe/CommonHeader.h b/MdeModulePkg/Universal/VariableRuntimeDxe/CommonHeader.h index 2cb78e7d63..7148577aab 100644 --- a/MdeModulePkg/Universal/VariableRuntimeDxe/CommonHeader.h +++ b/MdeModulePkg/Universal/VariableRuntimeDxe/CommonHeader.h @@ -43,8 +43,6 @@ #include #include #include -#include -#include -#include + #endif diff --git a/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.c b/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.c index 6f663d4fe1..4322961630 100644 --- a/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.c @@ -1299,15 +1299,13 @@ Returns: EFI_PHYSICAL_ADDRESS FvVolHdr; UINT64 TempVariableStoreHeader; - UINT64 TempVariableStoreLen; + EFI_GCD_MEMORY_SPACE_DESCRIPTOR GcdDescriptor; EFI_FLASH_SUBAREA_ENTRY VariableStoreEntry; UINT64 BaseAddress; UINT64 Length; UINTN Index; UINT8 Data; - EFI_PEI_HOB_POINTERS FvHob; - EFI_FLASH_MAP_ENTRY_DATA *FlashMapEntry; mVariableModuleGlobal = AllocateRuntimePool (sizeof (ESAL_VARIABLE_GLOBAL)); if (mVariableModuleGlobal == NULL) { @@ -1343,29 +1341,11 @@ Returns: // // 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); - - // - // 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); + TempVariableStoreHeader = (UINT64) PcdGet32 (PcdFlashNvStorageVariableBase); VariableStoreEntry.Base = TempVariableStoreHeader + \ (((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (TempVariableStoreHeader)) -> HeaderLength); - VariableStoreEntry.Length = TempVariableStoreLen - \ + VariableStoreEntry.Length = (UINT64) PcdGet32 (PcdFlashNvStorageVariableSize) - \ (((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) (TempVariableStoreHeader)) -> HeaderLength); // // Mark the variable storage region of the FLASH as RUNTIME -- cgit v1.2.3