Fv.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /** @file
  2. Build FV related hobs for platform.
  3. Copyright (c) 2022 Loongson Technology Corporation Limited. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #include "PiPei.h"
  7. #include "Platform.h"
  8. #include <Library/DebugLib.h>
  9. #include <Library/HobLib.h>
  10. #include <Library/PeiServicesLib.h>
  11. #include <Library/PcdLib.h>
  12. /**
  13. Publish PEI & DXE (Decompressed) Memory based FVs to let PEI
  14. and DXE know about them.
  15. @retval EFI_SUCCESS Platform PEI FVs were initialized successfully.
  16. **/
  17. EFI_STATUS
  18. PeiFvInitialization (
  19. VOID
  20. )
  21. {
  22. DEBUG ((DEBUG_INFO, "Platform PEI Firmware Volume Initialization\n"));
  23. //
  24. // Create a memory allocation HOB for the PEI FV.
  25. //
  26. BuildMemoryAllocationHob (
  27. PcdGet64 (PcdSecPeiTempRamBase),
  28. PcdGet32 (PcdSecPeiTempRamSize),
  29. EfiBootServicesData
  30. );
  31. //
  32. // Let DXE know about the DXE FV
  33. //
  34. BuildFvHob (PcdGet64 (PcdFlashDxeFvBase), PcdGet32 (PcdFlashDxeFvSize));
  35. //
  36. // Let PEI know about the DXE FV so it can find the DXE Core
  37. //
  38. DEBUG ((DEBUG_INFO, "DXEFV base:%p size:%x\n", (VOID *) (UINTN)PcdGet64 (PcdFlashDxeFvBase),
  39. PcdGet32 (PcdFlashDxeFvSize)));
  40. PeiServicesInstallFvInfoPpi (
  41. NULL,
  42. (VOID *) (UINTN)PcdGet64 (PcdFlashDxeFvBase),
  43. PcdGet32 (PcdFlashDxeFvSize),
  44. NULL,
  45. NULL
  46. );
  47. return EFI_SUCCESS;
  48. }