1 /** @file
2   The header file for TCG SMM driver.
3 
4 Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution.  The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9 
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef __TCG_SMM_H__
16 #define __TCG_SMM_H__
17 
18 #include <PiDxe.h>
19 #include <IndustryStandard/Acpi.h>
20 #include <IndustryStandard/UefiTcgPlatform.h>
21 
22 #include <Guid/PhysicalPresenceData.h>
23 #include <Guid/MemoryOverwriteControl.h>
24 #include <Guid/TpmInstance.h>
25 
26 #include <Protocol/SmmSwDispatch2.h>
27 #include <Protocol/AcpiTable.h>
28 #include <Protocol/SmmVariable.h>
29 
30 #include <Library/BaseLib.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/DebugLib.h>
33 #include <Library/SmmServicesTableLib.h>
34 #include <Library/UefiDriverEntryPoint.h>
35 #include <Library/UefiBootServicesTableLib.h>
36 #include <Library/DxeServicesLib.h>
37 #include <Library/TpmMeasurementLib.h>
38 #include <Library/PcdLib.h>
39 #include <Library/TcgPpVendorLib.h>
40 
41 #pragma pack(1)
42 typedef struct {
43   UINT8                  SoftwareSmi;
44   UINT32                 Parameter;
45   UINT32                 Response;
46   UINT32                 Request;
47   UINT32                 LastRequest;
48   UINT32                 ReturnCode;
49 } PHYSICAL_PRESENCE_NVS;
50 
51 typedef struct {
52   UINT8                  SoftwareSmi;
53   UINT32                 Parameter;
54   UINT32                 Request;
55   UINT32                 ReturnCode;
56 } MEMORY_CLEAR_NVS;
57 
58 typedef struct {
59   PHYSICAL_PRESENCE_NVS  PhysicalPresence;
60   MEMORY_CLEAR_NVS       MemoryClear;
61 } TCG_NVS;
62 
63 typedef struct {
64   UINT8                  OpRegionOp;
65   UINT32                 NameString;
66   UINT8                  RegionSpace;
67   UINT8                  DWordPrefix;
68   UINT32                 RegionOffset;
69   UINT8                  BytePrefix;
70   UINT8                  RegionLen;
71 } AML_OP_REGION_32_8;
72 #pragma pack()
73 
74 //
75 // The definition for TCG physical presence ACPI function
76 //
77 #define ACPI_FUNCTION_GET_PHYSICAL_PRESENCE_INTERFACE_VERSION      1
78 #define ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS                       2
79 #define ACPI_FUNCTION_GET_PENDING_REQUEST_BY_OS                    3
80 #define ACPI_FUNCTION_GET_PLATFORM_ACTION_TO_TRANSITION_TO_BIOS    4
81 #define ACPI_FUNCTION_RETURN_REQUEST_RESPONSE_TO_OS                5
82 #define ACPI_FUNCTION_SUBMIT_PREFERRED_USER_LANGUAGE               6
83 #define ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2                     7
84 #define ACPI_FUNCTION_GET_USER_CONFIRMATION_STATUS_FOR_REQUEST     8
85 
86 //
87 // The return code for Return TPM Operation Response to OS Environment
88 //
89 #define PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS                   0
90 #define PP_RETURN_TPM_OPERATION_RESPONSE_FAILURE                   1
91 
92 //
93 // The definition for TCG MOR
94 //
95 #define ACPI_FUNCTION_DSM_MEMORY_CLEAR_INTERFACE                   1
96 #define ACPI_FUNCTION_PTS_CLEAR_MOR_BIT                            2
97 
98 //
99 // The return code for Memory Clear Interface Functions
100 //
101 #define MOR_REQUEST_SUCCESS                                        0
102 #define MOR_REQUEST_GENERAL_FAILURE                                1
103 
104 #endif  // __TCG_SMM_H__
105