diff --git a/MdeModulePkg/Application/HelloWorld/HelloWorld.c b/MdeModulePkg/Application/HelloWorld/HelloWorld.c index 4106753492..b1d16f76a0 100644 --- a/MdeModulePkg/Application/HelloWorld/HelloWorld.c +++ b/MdeModulePkg/Application/HelloWorld/HelloWorld.c @@ -13,6 +13,7 @@ **/ #include +#include #include #include #include @@ -37,10 +38,19 @@ UefiMain ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) - { + UINT32 Index; + + Index = 0; - Print ((CHAR16 *)L"UEFI Hello World!\n"); + // + // Three PCD type (FeatureFlag, UINT32 and String) are used as the sample. + // + if (FeaturePcdGet (PcdHelloWorldPrintEnable)) { + for (Index = 0; Index < PcdGet32 (PcdHelloWorldPrintTimes); Index ++) { + Print ((CHAR16*)PcdGetPtr (PcdHelloWorldPrintString)); + } + } return EFI_SUCCESS; } diff --git a/MdeModulePkg/Application/HelloWorld/HelloWorld.inf b/MdeModulePkg/Application/HelloWorld/HelloWorld.inf index a92bd5a966..5b4a51590d 100644 --- a/MdeModulePkg/Application/HelloWorld/HelloWorld.inf +++ b/MdeModulePkg/Application/HelloWorld/HelloWorld.inf @@ -31,18 +31,29 @@ # VALID_ARCHITECTURES = IA32 X64 IPF EBC # -[Sources.common] +[Sources] HelloWorld.c - [Packages] MdePkg/MdePkg.dec - + MdeModulePkg/MdeModulePkg.dec [LibraryClasses] UefiBootServicesTableLib UefiApplicationEntryPoint UefiLib DebugLib + PcdLib +[Guids] +[Ppis] + +[Protocols] + +[FeaturePcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintEnable + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintString + gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintTimes diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/MdeModulePkg/Core/Pei/FwVol/FwVol.c index 884029f438..37ddb797fe 100644 --- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c @@ -923,22 +923,11 @@ ProcessFvFile ( // // Inform the extracted FvImage to Fv HOB consumer phase, i.e. DXE phase - // based on its parent Fvimage is informed or not. - // If FvHob of its parent fvimage is built, the extracted FvImage will be built also. - // Or, the extracted FvImage will not be built. // - HobPtr.Raw = GetHobList (); - while ((HobPtr.Raw = GetNextHob (EFI_HOB_TYPE_FV, HobPtr.Raw)) != NULL) { - if (((EFI_PHYSICAL_ADDRESS) (UINTN)FvFileHandle > HobPtr.FirmwareVolume->BaseAddress) && - ((EFI_PHYSICAL_ADDRESS) (UINTN)FvFileHandle < HobPtr.FirmwareVolume->BaseAddress + HobPtr.FirmwareVolume->Length)) { - BuildFvHob ( - (EFI_PHYSICAL_ADDRESS) (UINTN) FvImageInfo.FvStart, - FvImageInfo.FvSize - ); - break; - } - HobPtr.Raw = GET_NEXT_HOB (HobPtr); - } + BuildFvHob ( + (EFI_PHYSICAL_ADDRESS) (UINTN) FvImageInfo.FvStart, + FvImageInfo.FvSize + ); // // Makes the encapsulated volume show up in DXE phase to skip processing of diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 50882937ca..7dcb1f133b 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -294,6 +294,12 @@ ## IF TRUE, the PeiCore will handle the framework FvHob and install FvInfo PPI for it. gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkFvHobCompatibilitySupport|FALSE|BOOLEAN|0x00012009 + + ## + # IF TRUE, HelloWorld Application will print the verbose information. + # This PCD is a sample to explain FeatureFlag PCD usage. + ## + gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintEnable|TRUE|BOOLEAN|0x0001200a [PcdsFixedAtBuild.common] ## Dynamic type PCD can be registered callback function for Pcd setting action. @@ -363,6 +369,18 @@ ## Error level for hardware recorder. gEfiMdeModulePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel|1|UINT16|0x40000002 + + ## + # This PCD defines the print string. + # This PCD is a sample to explain FixedAtBuild String PCD usage. + ## + gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintString|L"UEFI Hello World!\n"|VOID*|0x40000004 + + ## + # This PCD defines the times to print hello world string. + # This PCD is a sample to explain FixedAtBuild UINT32 PCD usage. + ## + gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintTimes|1|UINT32|0x40000005 [PcdsFixedAtBuild.IA32] ## Default EFI boot path name for IA32 architecture, this path is relative to @@ -410,6 +428,18 @@ ## Error level for hardware recorder. gEfiMdeModulePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel|1|UINT16|0x40000002 + ## + # This PCD defines the print string. + # This PCD is a sample to explain Dynamic PCD usage. + ## + gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintString|L"UEFI Hello World!\n"|VOID*|0x40000004 + + ## + # This PCD defines the times to print hello world string. + # This PCD is a sample to explain Dynamic UINT32 PCD usage. + ## + gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintTimes|1|UINT32|0x40000005 + [PcdsPatchableInModule.common] ## Maximun number of performance log entries during PEI phase. gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries|40|UINT8|0x0001002f @@ -439,6 +469,12 @@ ## Error level for hardware recorder. gEfiMdeModulePkgTokenSpaceGuid.PcdHardwareErrorRecordLevel|1|UINT16|0x40000002 + ## + # This PCD defines the times to print hello world string. + # This PCD is a sample to explain Patchable UINT32 PCD usage. + ## + gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintTimes|1|UINT32|0x40000005 + [PcdsFeatureFlag.IA32] ## If TRUE, the DXE IPL will load a 64-bit DxeCore. gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|TRUE|BOOLEAN|0x0001003b