AmdSev.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /** @file
  2. File defines the Sec routines for the AMD SEV
  3. Copyright (c) 2021, Advanced Micro Devices, Inc. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef _AMD_SEV_SEC_INTERNAL_H__
  7. #define _AMD_SEV_SEC_INTERNAL_H__
  8. /**
  9. Handle an SEV-ES/GHCB protocol check failure.
  10. Notify the hypervisor using the VMGEXIT instruction that the SEV-ES guest
  11. wishes to be terminated.
  12. @param[in] ReasonCode Reason code to provide to the hypervisor for the
  13. termination request.
  14. **/
  15. VOID
  16. SevEsProtocolFailure (
  17. IN UINT8 ReasonCode
  18. );
  19. /**
  20. Validate the SEV-ES/GHCB protocol level.
  21. Verify that the level of SEV-ES/GHCB protocol supported by the hypervisor
  22. and the guest intersect. If they don't intersect, request termination.
  23. **/
  24. VOID
  25. SevEsProtocolCheck (
  26. VOID
  27. );
  28. /**
  29. Determine if the SEV is active.
  30. During the early booting, GuestType is set in the work area. Verify that it
  31. is an SEV guest.
  32. @retval TRUE SEV is enabled
  33. @retval FALSE SEV is not enabled
  34. **/
  35. BOOLEAN
  36. IsSevGuest (
  37. VOID
  38. );
  39. /**
  40. Determine if SEV-ES is active.
  41. During early booting, SEV-ES support code will set a flag to indicate that
  42. SEV-ES is enabled. Return the value of this flag as an indicator that SEV-ES
  43. is enabled.
  44. @retval TRUE SEV-ES is enabled
  45. @retval FALSE SEV-ES is not enabled
  46. **/
  47. BOOLEAN
  48. SevEsIsEnabled (
  49. VOID
  50. );
  51. /**
  52. Validate System RAM used for decompressing the PEI and DXE firmware volumes
  53. when SEV-SNP is active. The PCDs SecValidatedStart and SecValidatedEnd are
  54. set in OvmfPkg/FvmainCompactScratchEnd.fdf.inc.
  55. **/
  56. VOID
  57. SecValidateSystemRam (
  58. VOID
  59. );
  60. /**
  61. Determine if SEV-SNP is active.
  62. @retval TRUE SEV-SNP is enabled
  63. @retval FALSE SEV-SNP is not enabled
  64. **/
  65. BOOLEAN
  66. SevSnpIsEnabled (
  67. VOID
  68. );
  69. #endif