PeiFspMiscUpdUpdateLib.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /** @file
  2. Implementation of Fsp Misc UPD Initialization.
  3. Copyright (c) 2020 - 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/PcdLib.h>
  9. #include <Library/PeiLib.h>
  10. #include <Library/ConfigBlockLib.h>
  11. #include <Library/PeiServicesLib.h>
  12. #include <FspEas.h>
  13. #include <FspmUpd.h>
  14. #include <FspsUpd.h>
  15. #include <Library/DebugLib.h>
  16. #include <Library/DebugPrintErrorLevelLib.h>
  17. #include <Library/PciLib.h>
  18. #include <Guid/MemoryOverwriteControl.h>
  19. #include <PchAccess.h>
  20. #include <Platform.h>
  21. #include "PeiMiscPolicyUpdate.h"
  22. /**
  23. Performs FSP Misc UPD initialization.
  24. @param[in,out] FspmUpd Pointer to FSPM_UPD Data.
  25. @retval EFI_SUCCESS FSP UPD Data is updated.
  26. @retval EFI_NOT_FOUND An instance of gEfiPeiReadOnlyVariable2PpiGuid
  27. could not be located.
  28. @retval EFI_OUT_OF_RESOURCES Insufficent resources to allocate a memory buffer.
  29. **/
  30. EFI_STATUS
  31. EFIAPI
  32. PeiFspMiscUpdUpdatePreMem (
  33. IN OUT FSPM_UPD *FspmUpd
  34. )
  35. {
  36. EFI_STATUS Status;
  37. UINTN FspNvsBufferSize;
  38. VOID *FspNvsBufferPtr;
  39. FspNvsBufferPtr = NULL;
  40. FspNvsBufferSize = 0;
  41. Status = PeiGetLargeVariable (L"FspNvsBuffer", &gFspNvsBufferVariableGuid, &FspNvsBufferPtr, &FspNvsBufferSize);
  42. if (Status == EFI_SUCCESS) {
  43. FspmUpd->FspmArchUpd.NvsBufferPtr = FspNvsBufferPtr;
  44. } else {
  45. DEBUG ((DEBUG_INFO, "Cannot create FSP NVS Buffer, UEFI variable does not exist (this is likely a first boot)\n"));
  46. FspmUpd->FspmArchUpd.NvsBufferPtr = NULL;
  47. }
  48. FspmUpd->FspmConfig.TsegSize = FixedPcdGet32 (PcdTsegSize);
  49. FspmUpd->FspmConfig.CpuRatio = 0;
  50. FspmUpd->FspmConfig.CaVrefConfig = PcdGet8 (PcdMrcCaVrefConfig);
  51. FspmUpd->FspmConfig.PlatformMemorySize = PEI_MIN_MEMORY_SIZE;
  52. FspmUpd->FspmConfig.PcdSerialDebugLevel = 3;
  53. FspmUpd->FspmConfig.SafeMode = 0;
  54. FspmUpd->FspmConfig.PeciC10Reset = 0;
  55. return EFI_SUCCESS;
  56. }