DxeCpuPolicyUpdate.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /** @file
  2. This file is the library for CPU DXE Policy initialization.
  3. Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #include <Library/DxeCpuPolicyUpdateLib.h>
  7. /**
  8. This function prints the CPU DXE phase policy.
  9. @param[in] DxeCpuPolicy - CPU DXE Policy protocol
  10. **/
  11. VOID
  12. CpuDxePrintPolicyProtocol (
  13. IN DXE_CPU_POLICY_PROTOCOL *DxeCpuPolicy
  14. )
  15. {
  16. DEBUG_CODE_BEGIN ();
  17. DEBUG ((DEBUG_INFO, "\n------------------------ CPU Policy (DXE) print BEGIN -----------------\n"));
  18. DEBUG ((DEBUG_INFO, "Revision : %x\n", DxeCpuPolicy->Revision));
  19. ASSERT (DxeCpuPolicy->Revision == DXE_CPU_POLICY_PROTOCOL_REVISION);
  20. DEBUG ((DEBUG_INFO, "\n------------------------ CPU_DXE_CONFIG -----------------\n"));
  21. DEBUG ((DEBUG_INFO, "EnableDts : %x\n", DxeCpuPolicy->EnableDts));
  22. DEBUG ((DEBUG_INFO, "\n------------------------ CPU Policy (DXE) print END -----------------\n"));
  23. DEBUG_CODE_END ();
  24. }
  25. /**
  26. Get data for CPU policy from setup options.
  27. @param[in] DxeCpuPolicy The pointer to get CPU Policy protocol instance
  28. @retval EFI_SUCCESS Operation success.
  29. **/
  30. EFI_STATUS
  31. EFIAPI
  32. UpdateDxeSiCpuPolicy (
  33. IN OUT DXE_CPU_POLICY_PROTOCOL *DxeCpuPolicy
  34. )
  35. {
  36. return EFI_SUCCESS;
  37. }
  38. /**
  39. CpuInstallPolicyProtocol installs CPU Policy.
  40. While installed, RC assumes the Policy is ready and finalized. So please update and override
  41. any setting before calling this function.
  42. @param[in] ImageHandle Image handle of this driver.
  43. @param[in] DxeCpuPolicy The pointer to CPU Policy Protocol instance
  44. @retval EFI_SUCCESS The policy is installed.
  45. @retval EFI_OUT_OF_RESOURCES Insufficient resources to create buffer
  46. **/
  47. EFI_STATUS
  48. EFIAPI
  49. CpuInstallPolicyProtocol (
  50. IN EFI_HANDLE ImageHandle,
  51. IN DXE_CPU_POLICY_PROTOCOL *DxeCpuPolicy
  52. )
  53. {
  54. EFI_STATUS Status;
  55. ///
  56. /// Print CPU DXE Policy
  57. ///
  58. CpuDxePrintPolicyProtocol(DxeCpuPolicy);
  59. ///
  60. /// Install the DXE_CPU_POLICY_PROTOCOL interface
  61. ///
  62. Status = gBS->InstallMultipleProtocolInterfaces (
  63. &ImageHandle,
  64. &gDxeCpuPolicyProtocolGuid,
  65. DxeCpuPolicy,
  66. NULL
  67. );
  68. ASSERT_EFI_ERROR (Status);
  69. return Status;
  70. }