--- /dev/null
+/** @file\r
+ Module produces EFI_FIRMWARE_VOLUME_INFO_PPI based on each FV HOB if no such PPI exist for the FV.\r
+\r
+ UEFI PI Spec supersedes Intel's Framework Specs. \r
+ EFI_FIRMWARE_VOLUME_INFO_PPI defined in PI spec is required by PI PEI core to dispatch PEIMs or find DXE core\r
+ in the FV.\r
+ This module produces produces EFI_FIRMWARE_VOLUME_INFO_PPI based on each FV HOB if no such PPI exist for the FV.\r
+ This module is used on platform when both of these two conditions are true:\r
+ 1) Framework platform module produces FV HOB but does not build EFI_FIRMWARE_VOLUME_INFO_PPI.\r
+ 2) The platform has PI PEI core that cosumes EFI_FIRMWARE_VOLUME_INFO_PPI to dispatch PEIMs or DXE core\r
+ in FVs other than Boot Fimware Volume.\r
+\r
+Copyright (c) 2008 Intel Corporation. <BR>\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Module Name:\r
+\r
+**/\r
+\r
+#include <PiPei.h>\r
+#include <Ppi/FirmwareVolumeInfo.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/PeiServicesTablePointerLib.h>\r
+#include <Library/PeiServicesLib.h>\r
+#include <Library/HobLib.h>\r
+#include <Library/PeiPiLib.h>\r
+\r
+\r
+/**\r
+ Check if there is a matching EFI_PEI_FIRMWARE_VOLUME_INFO_PPI for the FV described by FvHob.\r
+\r
+ This function located all existing instance of EFI_PEI_FIRMWARE_VOLUME_INFO_PPI in the platform.\r
+ Then it compare the base address of the FVs found with that of FvHob. If a matching base address is\r
+ found, the function return TRUE. Otherwise, FALSE is returned.\r
+\r
+ If a matching base address of FV is found but the length of FV does not match, then ASSERT ().\r
+\r
+ @param FvHob The FV Hob.\r
+\r
+ @retval TRUE A instance of EFI_PEI_FIRMWARE_VOLUME_INFO_PPI is already installed.\r
+\r
+**/\r
+BOOLEAN\r
+FvInfoPpiInstalled (\r
+ EFI_HOB_FIRMWARE_VOLUME * FvHob\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ UINTN Idx;\r
+ EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;\r
+\r
+ for (Idx = 0; ; Idx++) {\r
+ Status = PeiServicesLocatePpi (\r
+ &gEfiPeiFirmwareVolumeInfoPpiGuid,\r
+ Idx,\r
+ NULL,\r
+ (VOID **) &FvInfoPpi\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ if (FvHob->BaseAddress == (EFI_PHYSICAL_ADDRESS) (UINTN) FvInfoPpi->FvInfo) {\r
+ ASSERT (FvHob->Length == (UINT64) FvInfoPpi->FvInfoSize);\r
+ return TRUE;\r
+ }\r
+ } else {\r
+ break;\r
+ }\r
+ }\r
+\r
+ return FALSE;\r
+}\r
+\r
+/**\r
+ PEIM's standard entry point.\r
+ \r
+ @param FfsHeader Image's header\r
+ @param PeiServices Pointer of EFI_PEI_SERVICES\r
+ @return EFI_SUCESS This entry point always return successfully.\r
+ \r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+FvHobtoFvInfoThunkEntry (\r
+ IN EFI_PEI_FILE_HANDLE FfsHeader,\r
+ IN CONST EFI_PEI_SERVICES **PeiServices\r
+ )\r
+{\r
+ EFI_PEI_HOB_POINTERS HobPointer;\r
+ \r
+ for (HobPointer.Raw = GetNextHob (EFI_HOB_TYPE_FV, GetHobList ());\r
+ HobPointer.Raw != NULL;\r
+ HobPointer.Raw = GetNextHob (EFI_HOB_TYPE_FV, GET_NEXT_HOB (HobPointer))) {\r
+ if (!FvInfoPpiInstalled (HobPointer.FirmwareVolume)) {\r
+ PiLibInstallFvInfoPpi (\r
+ &(((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) HobPointer.FirmwareVolume->BaseAddress)->FileSystemGuid),\r
+ (VOID *) (UINTN) HobPointer.FirmwareVolume->BaseAddress,\r
+ (UINT32) HobPointer.FirmwareVolume->Length,\r
+ NULL,\r
+ NULL\r
+ );\r
+ }\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
--- /dev/null
+#/** @file\r
+# Module produces EFI_FIRMWARE_VOLUME_INFO_PPI based on each FV HOB if no such PPI exist for the FV.\r
+#\r
+# UEFI PI Spec supersedes Intel's Framework Specs. \r
+# EFI_FIRMWARE_VOLUME_INFO_PPI defined in PI spec is required by PI PEI core to dispatch PEIMs or find DXE cores\r
+# in the FV.\r
+# This module produces produces EFI_FIRMWARE_VOLUME_INFO_PPI based on each FV HOB if no such PPI exist for the FV.\r
+# This module is used on platform when both of these two conditions are true:\r
+# 1) Framework platform module produces FV HOB but does not build EFI_FIRMWARE_VOLUME_INFO_PPI.\r
+# 2) The platform has PI PEI core that cosumes EFI_FIRMWARE_VOLUME_INFO_PPI to dispatch PEIMs in FVs other\r
+# than Boot Fimware Volume.\r
+#\r
+#\r
+# Copyright (c) 2007, Intel Corporation\r
+#\r
+# All rights reserved. This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+#**/\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = FvHobToFvInfoThunk\r
+ FILE_GUID = 9E00A9F6-B88E-4ab5-A825-15970E12731A\r
+ MODULE_TYPE = PEIM\r
+ VERSION_STRING = 1.0\r
+ EDK_RELEASE_VERSION = 0x00020000\r
+ EFI_SPECIFICATION_VERSION = 0x00020000\r
+\r
+ ENTRY_POINT = FvHobtoFvInfoThunkEntry\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources.common]\r
+ FvHobtoFvInfoThunk.c\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ IntelFrameworkPkg/IntelFrameworkPkg.dec\r
+\r
+[LibraryClasses]\r
+ PeimEntryPoint\r
+ PeiServicesLib\r
+ PeiServicesTablePointerLib\r
+ DebugLib\r
+ HobLib\r
+ PeiPiLib\r
+\r
+[Ppis]\r
+ gEfiPeiFirmwareVolumeInfoPpiGuid\r
+\r
+[Depex]\r
+ gEfiPeiMemoryDiscoveredPpiGuid\r