]> git.proxmox.com Git - mirror_edk2.git/blob - SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / SecurityPkg / Tcg / Tcg2Smm / Tcg2Smm.h
1 /** @file
2 The header file for Tcg2 SMM driver.
3
4 Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) Microsoft Corporation.
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef __TCG2_SMM_H__
11 #define __TCG2_SMM_H__
12
13 #include <PiMm.h>
14
15 #include <Guid/MemoryOverwriteControl.h>
16 #include <Guid/TpmInstance.h>
17 #include <Guid/TpmNvsMm.h>
18
19 #include <Protocol/MmReadyToLock.h>
20 #include <Protocol/SmmSwDispatch2.h>
21 #include <Protocol/AcpiTable.h>
22 #include <Protocol/SmmVariable.h>
23 #include <Protocol/Tcg2Protocol.h>
24
25 #include <Library/BaseLib.h>
26 #include <Library/BaseMemoryLib.h>
27 #include <Library/DebugLib.h>
28 #include <Library/MmServicesTableLib.h>
29 #include <Library/Tpm2CommandLib.h>
30 #include <Library/Tcg2PhysicalPresenceLib.h>
31 #include <Library/IoLib.h>
32 #include <Library/PcdLib.h>
33 #include <Library/Tpm2DeviceLib.h>
34
35 #include <IndustryStandard/TpmPtp.h>
36
37 //
38 // The definition for TCG MOR
39 //
40 #define ACPI_FUNCTION_DSM_MEMORY_CLEAR_INTERFACE 1
41 #define ACPI_FUNCTION_PTS_CLEAR_MOR_BIT 2
42
43 //
44 // The return code for Memory Clear Interface Functions
45 //
46 #define MOR_REQUEST_SUCCESS 0
47 #define MOR_REQUEST_GENERAL_FAILURE 1
48
49 /**
50 Notify the system that the SMM variable driver is ready.
51 **/
52 VOID
53 Tcg2NotifyMmReady (
54 VOID
55 );
56
57 /**
58 This function is an abstraction layer for implementation specific Mm buffer validation routine.
59
60 @param Buffer The buffer start address to be checked.
61 @param Length The buffer length to be checked.
62
63 @retval TRUE This buffer is valid per processor architecture and not overlap with SMRAM.
64 @retval FALSE This buffer is not valid per processor architecture or overlap with SMRAM.
65 **/
66 BOOLEAN
67 IsBufferOutsideMmValid (
68 IN EFI_PHYSICAL_ADDRESS Buffer,
69 IN UINT64 Length
70 );
71
72 /**
73 The driver's common initialization routine.
74
75 It install callbacks for TPM physical presence and MemoryClear, and locate
76 SMM variable to be used in the callback function.
77
78 @retval EFI_SUCCESS The entry point is executed successfully.
79 @retval Others Some error occurs when executing this entry point.
80
81 **/
82 EFI_STATUS
83 InitializeTcgCommon (
84 VOID
85 );
86
87 #endif // __TCG_SMM_H__