WorkArea.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /** @file
  2. Work Area structure definition
  3. Copyright (c) 2021, AMD Inc.
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef __OVMF_WORK_AREA_H__
  7. #define __OVMF_WORK_AREA_H__
  8. #include <ConfidentialComputingGuestAttr.h>
  9. //
  10. // Confidential computing work area header definition. Any change
  11. // to the structure need to be kept in sync with the
  12. // PcdOvmfConfidentialComputingWorkAreaHeader.
  13. //
  14. // PcdOvmfConfidentialComputingWorkAreaHeader ==
  15. // sizeof (CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER)
  16. // PcdOvmfConfidentialComputingWorkAreaHeader defined in:
  17. // OvmfPkg/OvmfPkg.dec
  18. // OvmfPkg/OvmfPkgDefines.fdf.inc
  19. typedef struct _CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER {
  20. UINT8 GuestType;
  21. UINT8 Reserved1[3];
  22. } CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER;
  23. //
  24. // Internal structure for holding SEV-ES information needed during SEC phase
  25. // and valid only during SEC phase and early PEI during platform
  26. // initialization.
  27. //
  28. // This structure is also used by assembler files:
  29. // OvmfPkg/ResetVector/ResetVector.nasmb
  30. // OvmfPkg/ResetVector/Ia32/PageTables64.asm
  31. // OvmfPkg/ResetVector/Ia32/Flat32ToFlat64.asm
  32. // any changes must stay in sync with its usage.
  33. //
  34. typedef struct _SEC_SEV_ES_WORK_AREA {
  35. //
  36. // Hold the SevStatus MSR value read by OvmfPkg/ResetVector/Ia32/AmdSev.c
  37. //
  38. UINT64 SevStatusMsrValue;
  39. UINT64 RandomData;
  40. UINT64 EncryptionMask;
  41. //
  42. // Indicator that the VC handler is called. It is used during the SevFeature
  43. // detection in OvmfPkg/ResetVector/Ia32/AmdSev.c
  44. //
  45. UINT8 ReceivedVc;
  46. } SEC_SEV_ES_WORK_AREA;
  47. //
  48. // The SEV work area definition.
  49. //
  50. typedef struct _SEV_WORK_AREA {
  51. CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER Header;
  52. SEC_SEV_ES_WORK_AREA SevEsWorkArea;
  53. } SEV_WORK_AREA;
  54. //
  55. // The TDX work area definition
  56. //
  57. typedef struct _SEC_TDX_WORK_AREA {
  58. UINT32 PageTableReady;
  59. UINT32 Gpaw;
  60. UINT64 HobList;
  61. } SEC_TDX_WORK_AREA;
  62. typedef struct _TDX_WORK_AREA {
  63. CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER Header;
  64. SEC_TDX_WORK_AREA SecTdxWorkArea;
  65. } TDX_WORK_AREA;
  66. typedef union {
  67. CONFIDENTIAL_COMPUTING_WORK_AREA_HEADER Header;
  68. SEV_WORK_AREA SevWorkArea;
  69. TDX_WORK_AREA TdxWorkArea;
  70. } OVMF_WORK_AREA;
  71. #endif