TianoCore EDK2 master
Loading...
Searching...
No Matches
Svsm.h
Go to the documentation of this file.
1
14#ifndef SVSM_H_
15#define SVSM_H_
16
17#include <Base.h>
18#include <Uefi.h>
19#include <Library/BaseLib.h>
20
21//
22// The SVSM definitions are part of the SNP Secrets Page:
23// An SVSM is considered present if the SvsmSize field is non-zero.
24//
25typedef PACKED struct {
26 UINT8 Reserved1[320];
27
28 UINT64 SvsmBase;
29 UINT64 SvsmSize;
30 UINT64 SvsmCaa;
31 UINT32 SvsmMaxVersion;
32 UINT8 SvsmGuestVmpl;
33 UINT8 Reserved2[3];
34} SVSM_INFORMATION;
35
36typedef PACKED struct {
37 UINT8 SvsmCallPending;
38 UINT8 SvsmMemAvailable;
39 UINT8 Reserved1[6];
40
41 //
42 // The remainder of the CAA 4KB area can be used for argument
43 // passing to the SVSM.
44 //
45 UINT8 SvsmBuffer[SIZE_4KB - 8];
46} SVSM_CAA;
47
48#define SVSM_SUCCESS 0x00000000
49#define SVSM_ERR_INCOMPLETE 0x80000000
50#define SVSM_ERR_UNSUPPORTED_PROTOCOL 0x80000001
51#define SVSM_ERR_UNSUPPORTED_CALL 0x80000002
52#define SVSM_ERR_INVALID_ADDRESS 0x80000003
53#define SVSM_ERR_INVALID_FORMAT 0x80000004
54#define SVSM_ERR_INVALID_PARAMETER 0x80000005
55#define SVSM_ERR_INVALID_REQUEST 0x80000006
56#define SVSM_ERR_BUSY 0x80000007
57
58#define SVSM_ERR_PVALIDATE_FAIL_INPUT 0x80001001
59#define SVSM_ERR_PVALIDATE_FAIL_SIZE_MISMATCH 0x80001006
60#define SVSM_ERR_PVALIDATE_FAIL_NO_CHANGE 0x80001010
61
62typedef PACKED struct {
63 UINT16 Entries;
64 UINT16 Next;
65
66 UINT8 Reserved[4];
67} SVSM_PVALIDATE_HEADER;
68
69typedef union {
70 struct {
71 UINT64 PageSize : 2;
72 UINT64 Action : 1;
73 UINT64 IgnoreCf : 1;
74 UINT64 Reserved_2 : 8;
75 UINT64 Address : 52;
76 } Bits;
77 UINT64 Uint64;
79
80typedef PACKED struct {
81 SVSM_PVALIDATE_HEADER Header;
83} SVSM_PVALIDATE_REQUEST;
84
85#define SVSM_PVALIDATE_MAX_ENTRY \
86 ((sizeof (((SVSM_CAA *)0)->SvsmBuffer) - sizeof (SVSM_PVALIDATE_HEADER)) / sizeof (SVSM_PVALIDATE_ENTRY))
87
88typedef union {
89 SVSM_PVALIDATE_REQUEST PvalidateRequest;
91
92typedef union {
93 struct {
94 UINT32 CallId;
95 UINT32 Protocol;
96 } Id;
97
98 UINT64 Uint64;
100
101#endif