1) Use Dynamic Pcd for hold the base address and length of Flash-related block.
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 10 Jul 2007 14:51:34 +0000 (14:51 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 10 Jul 2007 14:51:34 +0000 (14:51 +0000)
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

MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c
MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.h
MdeModulePkg/Universal/VariableRuntimeDxe/CommonHeader.h
MdeModulePkg/Universal/VariableRuntimeDxe/Variable.c
Nt32Pkg/Nt32Pkg.dsc
Nt32Pkg/WinNtFlashMapPei/FlashMap.c

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