PeiFspMiscUpdUpdateLib.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /** @file
  2. Implementation of Fsp Misc UPD Initialization.
  3. Copyright (c) 2019 - 2021, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #include <PiPei.h>
  7. #include <Library/DebugLib.h>
  8. #include <Library/PeiLib.h>
  9. #include <Library/ConfigBlockLib.h>
  10. #include <Library/PeiServicesLib.h>
  11. #include <FspEas.h>
  12. #include <FspmUpd.h>
  13. #include <FspsUpd.h>
  14. #include <Library/DebugLib.h>
  15. #include <Library/DebugPrintErrorLevelLib.h>
  16. #include <Library/PciLib.h>
  17. #include <Guid/MemoryOverwriteControl.h>
  18. #include <PchAccess.h>
  19. #include "PeiMiscPolicyUpdate.h"
  20. /**
  21. Performs FSP Misc UPD initialization.
  22. @param[in,out] FspmUpd Pointer to FSPM_UPD Data.
  23. @retval EFI_SUCCESS FSP UPD Data is updated.
  24. @retval EFI_NOT_FOUND An instance of gEfiPeiReadOnlyVariable2PpiGuid
  25. could not be located.
  26. @retval EFI_OUT_OF_RESOURCES Insufficent resources to allocate a memory buffer.
  27. **/
  28. EFI_STATUS
  29. EFIAPI
  30. PeiFspMiscUpdUpdatePreMem (
  31. IN OUT FSPM_UPD *FspmUpd
  32. )
  33. {
  34. EFI_STATUS Status;
  35. UINTN FspNvsBufferSize;
  36. VOID *FspNvsBufferPtr;
  37. FspNvsBufferPtr = NULL;
  38. FspNvsBufferSize = 0;
  39. Status = PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferPtr, &FspNvsBufferSize);
  40. if (Status == EFI_SUCCESS) {
  41. FspmUpd->FspmArchUpd.NvsBufferPtr = FspNvsBufferPtr;
  42. } else {
  43. DEBUG ((DEBUG_INFO, "Cannot create FSP NVS Buffer, UEFI variable does not exist (this is likely a first boot)\n"));
  44. FspmUpd->FspmArchUpd.NvsBufferPtr = NULL;
  45. }
  46. return EFI_SUCCESS;
  47. }