]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Add three sample PCD in HelloWorld application for user reference of PCD usage.
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 19 Sep 2008 05:05:40 +0000 (05:05 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 19 Sep 2008 05:05:40 +0000 (05:05 +0000)
2. PeiCore will always build FvHob for the extracted FvImage once it decompresses the new FvImage.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5930 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Application/HelloWorld/HelloWorld.c
MdeModulePkg/Application/HelloWorld/HelloWorld.inf
MdeModulePkg/Core/Pei/FwVol/FwVol.c
MdeModulePkg/MdeModulePkg.dec

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