Fv.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /** @file
  2. Build FV related hobs for platform.
  3. Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
  4. Copyright (c) 2019, Citrix Systems, Inc.
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #include "PiPei.h"
  8. #include "Platform.h"
  9. #include <Library/DebugLib.h>
  10. #include <Library/HobLib.h>
  11. #include <Library/PeiServicesLib.h>
  12. #include <Library/PcdLib.h>
  13. /**
  14. Publish PEI & DXE (Decompressed) Memory based FVs to let PEI
  15. and DXE know about them.
  16. @retval EFI_SUCCESS Platform PEI FVs were initialized successfully.
  17. **/
  18. EFI_STATUS
  19. PeiFvInitialization (
  20. VOID
  21. )
  22. {
  23. DEBUG ((DEBUG_INFO, "Platform PEI Firmware Volume Initialization\n"));
  24. //
  25. // Create a memory allocation HOB for the PEI FV.
  26. //
  27. // Allocate as ACPI NVS is S3 is supported
  28. //
  29. BuildMemoryAllocationHob (
  30. PcdGet32 (PcdOvmfPeiMemFvBase),
  31. PcdGet32 (PcdOvmfPeiMemFvSize),
  32. EfiBootServicesData
  33. );
  34. //
  35. // Let DXE know about the DXE FV
  36. //
  37. BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase), PcdGet32 (PcdOvmfDxeMemFvSize));
  38. //
  39. // Create a memory allocation HOB for the DXE FV.
  40. //
  41. // If "secure" S3 is needed, then SEC will decompress both PEI and DXE
  42. // firmware volumes at S3 resume too, hence we need to keep away the OS from
  43. // DXEFV as well. Otherwise we only need to keep away DXE itself from the
  44. // DXEFV area.
  45. //
  46. BuildMemoryAllocationHob (
  47. PcdGet32 (PcdOvmfDxeMemFvBase),
  48. PcdGet32 (PcdOvmfDxeMemFvSize),
  49. EfiBootServicesData
  50. );
  51. //
  52. // Let PEI know about the DXE FV so it can find the DXE Core
  53. //
  54. PeiServicesInstallFvInfoPpi (
  55. NULL,
  56. (VOID *)(UINTN)PcdGet32 (PcdOvmfDxeMemFvBase),
  57. PcdGet32 (PcdOvmfDxeMemFvSize),
  58. NULL,
  59. NULL
  60. );
  61. return EFI_SUCCESS;
  62. }