1 | /** @file
|
---|
2 | Defines the defitions used by TDX in OvmfPkg.
|
---|
3 |
|
---|
4 | Copyright (c) 2020 - 2021, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef OVMF_INTEL_TDX_H_
|
---|
10 | #define OVMF_INTEL_TDX_H_
|
---|
11 |
|
---|
12 | #include <PiPei.h>
|
---|
13 | #include <Library/BaseLib.h>
|
---|
14 | #include <Uefi/UefiSpec.h>
|
---|
15 | #include <Uefi/UefiBaseType.h>
|
---|
16 |
|
---|
17 | #define MP_CPU_PROTECTED_MODE_MAILBOX_APICID_INVALID 0xFFFFFFFF
|
---|
18 | #define MP_CPU_PROTECTED_MODE_MAILBOX_APICID_BROADCAST 0xFFFFFFFE
|
---|
19 |
|
---|
20 | typedef enum {
|
---|
21 | MpProtectedModeWakeupCommandNoop = 0,
|
---|
22 | MpProtectedModeWakeupCommandWakeup = 1,
|
---|
23 | MpProtectedModeWakeupCommandSleep = 2,
|
---|
24 | MpProtectedModeWakeupCommandAcceptPages = 3,
|
---|
25 | } MP_CPU_PROTECTED_MODE_WAKEUP_CMD;
|
---|
26 |
|
---|
27 | #pragma pack(1)
|
---|
28 |
|
---|
29 | //
|
---|
30 | // Describes the CPU MAILBOX control structure use to
|
---|
31 | // wakeup cpus spinning in long mode
|
---|
32 | //
|
---|
33 | typedef struct {
|
---|
34 | UINT16 Command;
|
---|
35 | UINT16 Resv;
|
---|
36 | UINT32 ApicId;
|
---|
37 | UINT64 WakeUpVector;
|
---|
38 | UINT8 ResvForOs[2032];
|
---|
39 | //
|
---|
40 | // Arguments available for wakeup code
|
---|
41 | //
|
---|
42 | UINT64 WakeUpArgs1;
|
---|
43 | UINT64 WakeUpArgs2;
|
---|
44 | UINT64 WakeUpArgs3;
|
---|
45 | UINT64 WakeUpArgs4;
|
---|
46 | UINT8 Pad1[0xe0];
|
---|
47 | UINT64 NumCpusArriving;
|
---|
48 | UINT8 Pad2[0xf8];
|
---|
49 | UINT64 NumCpusExiting;
|
---|
50 | UINT32 Tallies[256];
|
---|
51 | UINT8 Errors[256];
|
---|
52 | UINT8 Pad3[0xf8];
|
---|
53 | } MP_WAKEUP_MAILBOX;
|
---|
54 |
|
---|
55 | //
|
---|
56 | // AP relocation code information including code address and size,
|
---|
57 | // this structure will be shared be C code and assembly code.
|
---|
58 | // It is natural aligned by design.
|
---|
59 | //
|
---|
60 | typedef struct {
|
---|
61 | UINT8 *RelocateApLoopFuncAddress;
|
---|
62 | UINTN RelocateApLoopFuncSize;
|
---|
63 | } MP_RELOCATION_MAP;
|
---|
64 |
|
---|
65 | #pragma pack()
|
---|
66 |
|
---|
67 | #endif
|
---|