diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index fa6dbe1129..f8015fb0b5 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -139,29 +139,29 @@ PcdMaxSizePopulateCapsule|0x0001001e|gEfiEdkModulePkgTokenSpaceGuid|UINT32|0x0 PcdMaxSizeNonPopulateCapsule|0x0001001f|gEfiEdkModulePkgTokenSpaceGuid|UINT32|0x0 PcdMaxPeiPerformanceLogEntries|0x0001002f|gEfiEdkModulePkgTokenSpaceGuid|UINT8|28 - PcdFlashNvStorageVariableBase|0x30000001|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageVariableSize|0x30000002|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageFtwSpareBase|0x30000013|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageFtwSpareSize|0x30000014|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageFtwWorkingBase|0x30000010|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageFtwWorkingSize|0x30000011|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageVariableBase|0x30000001|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageVariableSize|0x30000002|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageFtwSpareBase|0x30000013|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageFtwSpareSize|0x30000014|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageFtwWorkingBase|0x30000010|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageFtwWorkingSize|0x30000011|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 [PcdsDynamic.common] - PcdFlashNvStorageVariableBase|0x30000001|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageVariableSize|0x30000002|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageFtwSpareBase|0x30000013|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageFtwSpareSize|0x30000014|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageFtwWorkingBase|0x30000010|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageFtwWorkingSize|0x30000011|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageVariableBase|0x30000001|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageVariableSize|0x30000002|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageFtwSpareBase|0x30000013|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageFtwSpareSize|0x30000014|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageFtwWorkingBase|0x30000010|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageFtwWorkingSize|0x30000011|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 [PcdsPatchableInModule.common] PcdMaxPeiPerformanceLogEntries|0x0001002f|gEfiEdkModulePkgTokenSpaceGuid|UINT8|28 - PcdFlashNvStorageVariableBase|0x30000001|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageVariableSize|0x30000002|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageFtwSpareBase|0x30000013|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageFtwSpareSize|0x30000014|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageFtwWorkingBase|0x30000010|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 - PcdFlashNvStorageFtwWorkingSize|0x30000011|gEfiGenericPlatformTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageVariableBase|0x30000001|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageVariableSize|0x30000002|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageFtwSpareBase|0x30000013|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageFtwSpareSize|0x30000014|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageFtwWorkingBase|0x30000010|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 + PcdFlashNvStorageFtwWorkingSize|0x30000011|gEfiMdeModulePkgTokenSpaceGuid|UINT32|0x0 [PcdsFeatureFlag.IA32] diff --git a/MdeModulePkg/MdeModulePkg.dsc b/MdeModulePkg/MdeModulePkg.dsc index 649918140d..9e50c54f43 100644 --- a/MdeModulePkg/MdeModulePkg.dsc +++ b/MdeModulePkg/MdeModulePkg.dsc @@ -339,12 +339,12 @@ PcdUefiLibMaxPrintBufferSize|gEfiMdePkgTokenSpaceGuid|320 PcdMaxSizeNonPopulateCapsule|gEfiEdkModulePkgTokenSpaceGuid|0x0 PcdMaxSizePopulateCapsule|gEfiEdkModulePkgTokenSpaceGuid|0x0 - PcdFlashNvStorageFtwSpareBase|gEfiGenericPlatformTokenSpaceGuid|0x0 - PcdFlashNvStorageFtwSpareSize|gEfiGenericPlatformTokenSpaceGuid|0x0 - PcdFlashNvStorageFtwWorkingBase|gEfiGenericPlatformTokenSpaceGuid|0x0 - PcdFlashNvStorageFtwWorkingSize|gEfiGenericPlatformTokenSpaceGuid|0x0 - PcdFlashNvStorageVariableBase|gEfiGenericPlatformTokenSpaceGuid|0x0 - PcdFlashNvStorageVariableSize|gEfiGenericPlatformTokenSpaceGuid|0x0 + PcdFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid|0x0 + PcdFlashNvStorageFtwSpareSize|gEfiMdeModulePkgTokenSpaceGuid|0x0 + PcdFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid|0x0 + PcdFlashNvStorageFtwWorkingSize|gEfiMdeModulePkgTokenSpaceGuid|0x0 + PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid|0x0 + PcdFlashNvStorageVariableSize|gEfiMdeModulePkgTokenSpaceGuid|0x0 PcdMaxPeiPerformanceLogEntries|gEfiEdkModulePkgTokenSpaceGuid|28 PcdVpdBaseAddress|gEfiEdkModulePkgTokenSpaceGuid|0x0 PcdMaxPeiPcdCallBackNumberPerPcdEntry|gEfiMdeModulePkgTokenSpaceGuid|0x08 diff --git a/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c b/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c index 38fe11d80b..a2ba2b4306 100644 --- a/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c +++ b/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.c @@ -634,7 +634,8 @@ 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]. @@ -665,12 +666,34 @@ 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) { - FtwLiteDevice->WorkSpaceAddress = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageFtwWorkingBase); - FtwLiteDevice->WorkSpaceLength = (UINTN) PcdGet32 (PcdFlashNvStorageFtwWorkingSize); - - FtwLiteDevice->SpareAreaAddress = (EFI_PHYSICAL_ADDRESS) PcdGet32 (PcdFlashNvStorageFtwSpareBase); - FtwLiteDevice->SpareAreaLength = (UINTN) PcdGet32 (PcdFlashNvStorageFtwSpareSize); + 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); + } 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 8bc122dbd3..0701532f90 100644 --- a/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.h +++ b/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.h @@ -38,6 +38,7 @@ Abstract: // #include #include +#include #include #include // @@ -49,8 +50,10 @@ 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/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.inf b/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.inf index 155b4e21b6..4f47d60247 100644 --- a/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.inf +++ b/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.inf @@ -88,7 +88,7 @@ UefiDriverEntryPoint DebugLib PcdLib - + HobLib ################################################################################ # @@ -98,7 +98,7 @@ [Guids] gEfiSystemNvDataFvGuid # ALWAYS_CONSUMED - + gEfiFlashMapHobGuid ################################################################################ # @@ -125,10 +125,10 @@ ################################################################################ [PcdsDynamic.common] - PcdFlashNvStorageFtwWorkingSize|gEfiGenericPlatformTokenSpaceGuid - PcdFlashNvStorageFtwWorkingBase|gEfiGenericPlatformTokenSpaceGuid - PcdFlashNvStorageFtwSpareSize|gEfiGenericPlatformTokenSpaceGuid - PcdFlashNvStorageFtwSpareBase|gEfiGenericPlatformTokenSpaceGuid + PcdFlashNvStorageFtwWorkingSize|gEfiMdeModulePkgTokenSpaceGuid + PcdFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid + PcdFlashNvStorageFtwSpareSize|gEfiMdeModulePkgTokenSpaceGuid + PcdFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid ################################################################################ # diff --git a/MdeModulePkg/Universal/VariablePei/Variable.inf b/MdeModulePkg/Universal/VariablePei/Variable.inf index 434c2991c8..72a6b796fe 100644 --- a/MdeModulePkg/Universal/VariablePei/Variable.inf +++ b/MdeModulePkg/Universal/VariablePei/Variable.inf @@ -63,7 +63,7 @@ gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_CONSUMED [PcdsDynamic.common] - PcdFlashNvStorageVariableBase|gEfiGenericPlatformTokenSpaceGuid + PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid [Depex] TRUE diff --git a/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.inf b/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.inf index bdddbe148d..8236cd9cd8 100644 --- a/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.inf +++ b/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.inf @@ -105,8 +105,8 @@ ################################################################################ [PcdsDynamic.common] - PcdFlashNvStorageVariableSize|gEfiGenericPlatformTokenSpaceGuid - PcdFlashNvStorageVariableBase|gEfiGenericPlatformTokenSpaceGuid + PcdFlashNvStorageVariableSize|gEfiMdeModulePkgTokenSpaceGuid + PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid ################################################################################ diff --git a/Nt32Pkg/Nt32Pkg.dsc b/Nt32Pkg/Nt32Pkg.dsc index 6dcdd6b7e3..3d42131220 100644 --- a/Nt32Pkg/Nt32Pkg.dsc +++ b/Nt32Pkg/Nt32Pkg.dsc @@ -106,19 +106,22 @@ UefiBootServicesTableLib|$(WORKSPACE)/MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf HobLib|$(WORKSPACE)/MdePkg/Library/DxeHobLib/DxeHobLib.inf DevicePathLib|$(WORKSPACE)/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf - PcdLib|$(WORKSPACE)/MdePkg/Library/DxePcdLib/DxePcdLib.inf + # After tools enable the dynamic PCD, please uncomment follows library instances mapping. + #PcdLib|$(WORKSPACE)/MdePkg/Library/DxePcdLib/DxePcdLib.inf MemoryAllocationLib|$(WORKSPACE)/MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf UefiLib|$(WORKSPACE)/MdePkg/Library/UefiLib/UefiLib.inf ReportStatusCodeLib|$(WORKSPACE)/IntelFrameworkPkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf UefiRuntimeServicesTableLib|$(WORKSPACE)/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf WinNtLib|$(WORKSPACE)/Nt32Pkg/Library/DxeWinNtLib/DxeWinNtLib.inf OemHookStatusCodeLib|$(WORKSPACE)/Nt32Pkg/Library/DxeNt32OemHookStatusCodeLib/DxeNt32OemHookStatusCodeLib.inf - PcdLib|$(WORKSPACE)/MdePkg/Library/DxePcdLib/DxePcdLib.inf + # After tools enable the dynamic PCD, please uncomment follows library instances mapping. + #PcdLib|$(WORKSPACE)/MdePkg/Library/DxePcdLib/DxePcdLib.inf DebugLib|$(WORKSPACE)/MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf [LibraryClasses.common.PEIM] HobLib|$(WORKSPACE)/MdePkg/Library/PeiHobLib/PeiHobLib.inf - PcdLib|$(WORKSPACE)/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + # After tools enable the dynamic PCD, please uncomment follows library instances mapping. + #PcdLib|$(WORKSPACE)/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf IoLib|$(WORKSPACE)/MdePkg/Library/PeiIoLibCpuIo/PeiIoLibCpuIo.inf PeimEntryPoint|$(WORKSPACE)/MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf PeiServicesLib|$(WORKSPACE)/MdePkg/Library/PeiServicesLib/PeiServicesLib.inf @@ -140,13 +143,15 @@ OldPeiCoreEntryPoint|$(WORKSPACE)/MdePkg/Library/OldPeiCoreEntryPoint/OldPeiCoreEntryPoint.inf ReportStatusCodeLib|$(WORKSPACE)/IntelFrameworkPkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf PeCoffGetEntryPointLib|$(WORKSPACE)/Nt32Pkg/Library/EdkNt32PeiPeCoffGetEntryPointLib/EdkNt32PeiPeCoffGetEntryPointLib.inf - PcdLib|$(WORKSPACE)/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + # After tools enable the dynamic PCD, please uncomment follows library instances mapping. + #PcdLib|$(WORKSPACE)/MdePkg/Library/PeiPcdLib/PeiPcdLib.inf DebugLib|$(WORKSPACE)/IntelFrameworkPkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf [LibraryClasses.common.DXE_RUNTIME_DRIVER] UefiRuntimeServicesTableLib|$(WORKSPACE)/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf HobLib|$(WORKSPACE)/MdePkg/Library/DxeHobLib/DxeHobLib.inf - PcdLib|$(WORKSPACE)/MdePkg/Library/DxePcdLib/DxePcdLib.inf + # After tools enable the dynamic PCD, please uncomment follows library instances mapping. + #PcdLib|$(WORKSPACE)/MdePkg/Library/DxePcdLib/DxePcdLib.inf MemoryAllocationLib|$(WORKSPACE)/MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf UefiLib|$(WORKSPACE)/MdePkg/Library/UefiLib/UefiLib.inf UefiDriverEntryPoint|$(WORKSPACE)/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf @@ -166,7 +171,8 @@ [LibraryClasses.common.UEFI_DRIVER] UefiRuntimeServicesTableLib|$(WORKSPACE)/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf HobLib|$(WORKSPACE)/MdePkg/Library/DxeHobLib/DxeHobLib.inf - PcdLib|$(WORKSPACE)/MdePkg/Library/DxePcdLib/DxePcdLib.inf + # After tools enable the dynamic PCD, please uncomment follows library instances mapping. + #PcdLib|$(WORKSPACE)/MdePkg/Library/DxePcdLib/DxePcdLib.inf MemoryAllocationLib|$(WORKSPACE)/MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf UefiLib|$(WORKSPACE)/MdePkg/Library/UefiLib/UefiLib.inf UefiDriverEntryPoint|$(WORKSPACE)/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf @@ -185,7 +191,8 @@ [LibraryClasses.common.DXE_DRIVER] UefiRuntimeServicesTableLib|$(WORKSPACE)/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf HobLib|$(WORKSPACE)/MdePkg/Library/DxeHobLib/DxeHobLib.inf - PcdLib|$(WORKSPACE)/MdePkg/Library/DxePcdLib/DxePcdLib.inf + # After tools enable the dynamic PCD, please uncomment follows library instances mapping. + #PcdLib|$(WORKSPACE)/MdePkg/Library/DxePcdLib/DxePcdLib.inf MemoryAllocationLib|$(WORKSPACE)/MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf UefiLib|$(WORKSPACE)/MdePkg/Library/UefiLib/UefiLib.inf UefiDriverEntryPoint|$(WORKSPACE)/MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf @@ -212,7 +219,8 @@ HobLib|$(WORKSPACE)/MdePkg/Library/DxeHobLib/DxeHobLib.inf DevicePathLib|$(WORKSPACE)/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf EdkIfrSupportLib|$(WORKSPACE)/MdeModulePkg/Library/EdkIfrSupportLib/EdkIfrSupportLib.inf - PcdLib|$(WORKSPACE)/MdePkg/Library/DxePcdLib/DxePcdLib.inf + # After tools enable the dynamic PCD, please uncomment follows library instances mapping. + #PcdLib|$(WORKSPACE)/MdePkg/Library/DxePcdLib/DxePcdLib.inf MemoryAllocationLib|$(WORKSPACE)/MdePkg/Library/DxeMemoryAllocationLib/DxeMemoryAllocationLib.inf UefiLib|$(WORKSPACE)/MdePkg/Library/UefiLib/UefiLib.inf ReportStatusCodeLib|$(WORKSPACE)/IntelFrameworkPkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf @@ -262,6 +270,12 @@ PcdMaxSizeNonPopulateCapsule|gEfiEdkModulePkgTokenSpaceGuid|0x0 PcdMaxSizePopulateCapsule|gEfiEdkModulePkgTokenSpaceGuid|0x0 PcdPciIncompatibleDeviceSupportMask|gEfiIntelFrameworkModulePkgTokenSpaceGuid|0 + PcdFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid|0x0 + PcdFlashNvStorageFtwSpareSize|gEfiMdeModulePkgTokenSpaceGuid|0x280000 + PcdFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid|0x28e000 + PcdFlashNvStorageFtwWorkingSize|gEfiMdeModulePkgTokenSpaceGuid|0x2000 + PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid|0x280000 + PcdFlashNvStorageVariableSize|gEfiMdeModulePkgTokenSpaceGuid|0x00c000 [PcdsFeatureFlag.IA32] PcdPeiPcdDatabaseTraverseEnabled|gEfiEdkModulePkgTokenSpaceGuid|TRUE @@ -315,21 +329,15 @@ ################################################################################ [PcdsDynamicDefault.common.DEFAULT] - PcdFlashNvStorageFtwSpareBase|gEfiGenericPlatformTokenSpaceGuid|0x0 - PcdFlashNvStorageVariableSize|gEfiGenericPlatformTokenSpaceGuid|0x0 PcdWinNtCpuSpeed|gEfiNt32PkgTokenSpaceGuid|L"3000"|8 - PcdFlashNvStorageVariableBase|gEfiGenericPlatformTokenSpaceGuid|0x0 PcdWinNtSerialPort|gEfiNt32PkgTokenSpaceGuid|L"COM1!COM2"|18 PcdWinNtFileSystem|gEfiNt32PkgTokenSpaceGuid|L".!..\\..\\..\\..\\EdkShellBinPkg\\bin\\ia32\\Apps"|106 - PcdFlashNvStorageFtwWorkingSize|gEfiGenericPlatformTokenSpaceGuid|0x0 PcdWinNtGop|gEfiNt32PkgTokenSpaceGuid|L"UGA Window 1!UGA Window 2"|50 PcdWinNtConsole|gEfiNt32PkgTokenSpaceGuid|L"Bus Driver Console Window"|50 - PcdFlashNvStorageFtwWorkingBase|gEfiGenericPlatformTokenSpaceGuid|0x0 PcdWinNtMemorySize|gEfiNt32PkgTokenSpaceGuid|L"64!64"|10 PcdWinNtVirtualDisk|gEfiNt32PkgTokenSpaceGuid|L"FW;40960;512"|24 PcdWinNtCpuModel|gEfiNt32PkgTokenSpaceGuid|L"Intel(R) Processor Model"|48 PcdWinNtPhysicalDisk|gEfiNt32PkgTokenSpaceGuid|L"E:RW;245760;512"|30 - PcdFlashNvStorageFtwSpareSize|gEfiGenericPlatformTokenSpaceGuid|0x0 PcdWinNtUga|gEfiNt32PkgTokenSpaceGuid|L"UGA Window 1!UGA Window 2"|50 ################################################################################ @@ -365,11 +373,11 @@ $(WORKSPACE)/MdeModulePkg/Universal/Capsule/RuntimeDxe/CapsuleRuntime.inf $(WORKSPACE)/MdeModulePkg/Universal/Ebc/Dxe/Ebc.inf $(WORKSPACE)/MdeModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.inf + $(WORKSPACE)/MdeModulePkg/Universal/RuntimeDxe/Runtime.inf $(WORKSPACE)/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.inf $(WORKSPACE)/MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.inf $(WORKSPACE)/MdeModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.inf $(WORKSPACE)/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.inf - $(WORKSPACE)/MdeModulePkg/Universal/RuntimeDxe/Runtime.inf $(WORKSPACE)/MdeModulePkg/Bus/Pci/AtapiPassThruDxe/AtapiPassThru.inf $(WORKSPACE)/MdeModulePkg/Universal/WatchDogTimerDxe/WatchDogTimer.inf $(WORKSPACE)/MdeModulePkg/Universal/VariablePei/Variable.inf diff --git a/Nt32Pkg/Nt32Pkg.fdf b/Nt32Pkg/Nt32Pkg.fdf index 77845759de..09e9ce845b 100644 --- a/Nt32Pkg/Nt32Pkg.fdf +++ b/Nt32Pkg/Nt32Pkg.fdf @@ -137,11 +137,11 @@ INF $(WORKSPACE)/MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.inf INF $(WORKSPACE)/MdeModulePkg/Universal/Capsule/RuntimeDxe/CapsuleRuntime.inf INF $(WORKSPACE)/MdeModulePkg/Universal/Ebc/Dxe/Ebc.inf INF $(WORKSPACE)/MdeModulePkg/Universal/GenericMemoryTest/Dxe/NullMemoryTest.inf +INF $(WORKSPACE)/MdeModulePkg/Universal/RuntimeDxe/Runtime.inf INF $(WORKSPACE)/MdeModulePkg/Universal/FirmwareVolume/FaultTolerantWriteLite/Dxe/FtwLite.inf INF $(WORKSPACE)/MdeModulePkg/Universal/BaseMemoryTestPei/BaseMemoryTest.inf INF $(WORKSPACE)/MdeModulePkg/Universal/FirmwareVolume/GuidedSectionExtraction/Crc32SectionExtract/Dxe/Crc32SectionExtract.inf INF $(WORKSPACE)/MdeModulePkg/Universal/VariableRuntimeDxe/Variable.inf -INF $(WORKSPACE)/MdeModulePkg/Universal/RuntimeDxe/Runtime.inf INF $(WORKSPACE)/MdeModulePkg/Bus/Pci/AtapiPassThruDxe/AtapiPassThru.inf INF $(WORKSPACE)/MdeModulePkg/Universal/WatchDogTimerDxe/WatchDogTimer.inf INF $(WORKSPACE)/MdeModulePkg/Universal/VariablePei/Variable.inf diff --git a/Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriver.c b/Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriver.c index 999fb0cc5d..a0baa751e6 100644 --- a/Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriver.c +++ b/Nt32Pkg/WinNtBusDriverDxe/WinNtBusDriver.c @@ -138,22 +138,44 @@ EFI_DRIVER_BINDING_PROTOCOL gWinNtBusDriverBinding = { NULL }; -#define NT_PCD_ARRAY_SIZE (sizeof(mPcdEnvironment)/sizeof(NT_PCD_ENTRY)) +#define NT_PCD_ARRAY_SIZE (sizeof(mPcdEnvironment)/sizeof(NT_ENVIRONMENT_VARIABLE_ENTRY)) + +// +// BUGBUG: Because currently the new build tools does not support dynamic PCD +// following dynamic PCd will be hard code. After tools ready, we should +// use dynmanic PCD AQAP. +// // // Table to map NT Environment variable to the GUID that should be in // device path. // -static NT_PCD_ENTRY mPcdEnvironment[] = { - PcdToken(PcdWinNtConsole), &gEfiWinNtConsoleGuid, - PcdToken(PcdWinNtGop), &gEfiWinNtGopGuid, - PcdToken(PcdWinNtSerialPort), &gEfiWinNtSerialPortGuid, - PcdToken(PcdWinNtFileSystem), &gEfiWinNtFileSystemGuid, - PcdToken(PcdWinNtVirtualDisk), &gEfiWinNtVirtualDisksGuid, - PcdToken(PcdWinNtPhysicalDisk), &gEfiWinNtPhysicalDisksGuid, - PcdToken(PcdWinNtCpuModel), &gEfiWinNtCPUModelGuid, - PcdToken(PcdWinNtCpuSpeed), &gEfiWinNtCPUSpeedGuid, - PcdToken(PcdWinNtMemorySize), &gEfiWinNtMemoryGuid +//static NT_PCD_ENTRY mPcdEnvironment[] = { +// PcdToken(PcdWinNtConsole), &gEfiWinNtConsoleGuid, +// PcdToken(PcdWinNtGop), &gEfiWinNtGopGuid, +// PcdToken(PcdWinNtSerialPort), &gEfiWinNtSerialPortGuid, +// PcdToken(PcdWinNtFileSystem), &gEfiWinNtFileSystemGuid, +// PcdToken(PcdWinNtVirtualDisk), &gEfiWinNtVirtualDisksGuid, +// PcdToken(PcdWinNtPhysicalDisk), &gEfiWinNtPhysicalDisksGuid, +// PcdToken(PcdWinNtCpuModel), &gEfiWinNtCPUModelGuid, +// PcdToken(PcdWinNtCpuSpeed), &gEfiWinNtCPUSpeedGuid, +// PcdToken(PcdWinNtMemorySize), &gEfiWinNtMemoryGuid +//}; +typedef struct { + CHAR16 *Variable; + EFI_GUID *DevicePathGuid; +} NT_ENVIRONMENT_VARIABLE_ENTRY; + +static NT_ENVIRONMENT_VARIABLE_ENTRY mPcdEnvironment[] = { + L"Bus Driver Console Window", &gEfiWinNtConsoleGuid, + L"UGA Window 1!UGA Window 2", &gEfiWinNtGopGuid, + L"COM1!COM2", &gEfiWinNtSerialPortGuid, + L".!..\\..\\..\\..\\EdkShellBinPkg\\bin\\ia32\\Apps", &gEfiWinNtFileSystemGuid, + L"FW;40960;512", &gEfiWinNtVirtualDisksGuid, + L"E:RW;245760;512", &gEfiWinNtPhysicalDisksGuid, + L"Intel(R) Processor Model", &gEfiWinNtCPUModelGuid, + L"3000", &gEfiWinNtCPUSpeedGuid, + L"64!64", &gEfiWinNtMemoryGuid }; /** @@ -430,7 +452,8 @@ Returns: // InstallStatus = EFI_NOT_FOUND; for (Index = 0; Index < NT_PCD_ARRAY_SIZE; Index++) { - PcdTempStr = (VOID *)LibPcdGetPtr (mPcdEnvironment[Index].Token); + //PcdTempStr = (VOID *)LibPcdGetPtr (mPcdEnvironment[Index].Token); + PcdTempStr = mPcdEnvironment[Index].Variable; ASSERT (PcdTempStr != NULL); TempStrSize = StrLen (PcdTempStr); diff --git a/Nt32Pkg/WinNtFlashMapPei/FlashMap.inf b/Nt32Pkg/WinNtFlashMapPei/FlashMap.inf index bcd1367c38..bd96ed70cc 100644 --- a/Nt32Pkg/WinNtFlashMapPei/FlashMap.inf +++ b/Nt32Pkg/WinNtFlashMapPei/FlashMap.inf @@ -126,10 +126,10 @@ ################################################################################ [PcdsDynamic.common] - PcdFlashNvStorageFtwWorkingSize|gEfiGenericPlatformTokenSpaceGuid - PcdFlashNvStorageFtwWorkingBase|gEfiGenericPlatformTokenSpaceGuid - PcdFlashNvStorageFtwSpareSize|gEfiGenericPlatformTokenSpaceGuid - PcdFlashNvStorageFtwSpareBase|gEfiGenericPlatformTokenSpaceGuid - PcdFlashNvStorageVariableSize|gEfiGenericPlatformTokenSpaceGuid - PcdFlashNvStorageVariableBase|gEfiGenericPlatformTokenSpaceGuid + PcdFlashNvStorageFtwWorkingSize|gEfiMdeModulePkgTokenSpaceGuid + PcdFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid + PcdFlashNvStorageFtwSpareSize|gEfiMdeModulePkgTokenSpaceGuid + PcdFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid + PcdFlashNvStorageVariableSize|gEfiMdeModulePkgTokenSpaceGuid + PcdFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid