PlatformCpuInfoDxe.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /** @file
  2. Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. Module Name:
  5. PlatformCpuInfoDxe.c
  6. Abstract:
  7. Platform Cpu Info driver to public platform related HOB data
  8. --*/
  9. #include "PlatformCpuInfoDxe.h"
  10. CHAR16 EfiPlatformCpuInfoVariable[] = L"PlatformCpuInfo";
  11. EFI_STATUS
  12. EFIAPI
  13. PlatformCpuInfoInit (
  14. IN EFI_HANDLE ImageHandle,
  15. IN EFI_SYSTEM_TABLE *SystemTable
  16. )
  17. {
  18. EFI_STATUS Status;
  19. EFI_PLATFORM_CPU_INFO *PlatformCpuInfoPtr;
  20. EFI_PEI_HOB_POINTERS GuidHob;
  21. //
  22. // Get Platform Cpu Info HOB
  23. //
  24. GuidHob.Raw = GetHobList ();
  25. while ((GuidHob.Raw = GetNextGuidHob (&gEfiPlatformCpuInfoGuid, GuidHob.Raw)) != NULL) {
  26. PlatformCpuInfoPtr = GET_GUID_HOB_DATA (GuidHob.Guid);
  27. GuidHob.Raw = GET_NEXT_HOB (GuidHob);
  28. //
  29. // Write the Platform CPU Info to volatile memory for runtime purposes.
  30. // This must be done in its own driver because SetVariable protocol is dependent on chipset,
  31. // which is dependent on CpuIo2, PlatformInfo, and Metronome.
  32. //
  33. Status = gRT->SetVariable(
  34. EfiPlatformCpuInfoVariable,
  35. &gEfiVlv2VariableGuid,
  36. EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
  37. sizeof(EFI_PLATFORM_CPU_INFO),
  38. PlatformCpuInfoPtr
  39. );
  40. if (EFI_ERROR(Status)) {
  41. return Status;
  42. }
  43. }
  44. return EFI_SUCCESS;
  45. }