]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/SmmAccess/SmramInternal.h
SecurityPkg: Add TPM PTP support in TPM2 device lib.
[mirror_edk2.git] / OvmfPkg / SmmAccess / SmramInternal.h
CommitLineData
9d560947
LE
1/** @file\r
2\r
3 Functions and types shared by the SMM accessor PEI and DXE modules.\r
4\r
5 Copyright (C) 2015, Red Hat, Inc.\r
6\r
7 This program and the accompanying materials are licensed and made available\r
8 under the terms and conditions of the BSD License which accompanies this\r
9 distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
13 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#include <Pi/PiMultiPhase.h>\r
18\r
19//\r
20// We'll have two SMRAM ranges.\r
21//\r
22// The first is a tiny one that hosts an SMM_S3_RESUME_STATE object, to be\r
23// filled in by the CPU SMM driver during normal boot, for the PEI instance of\r
24// the LockBox library (which will rely on the object during S3 resume).\r
25//\r
26// The other SMRAM range is the main one, for the SMM core and the SMM drivers.\r
27//\r
28typedef enum {\r
29 DescIdxSmmS3ResumeState = 0,\r
30 DescIdxMain = 1,\r
31 DescIdxCount = 2\r
32} DESCRIPTOR_INDEX;\r
33\r
34/**\r
35 Read the MCH_SMRAM and ESMRAMC registers, and update the LockState and\r
36 OpenState fields in the PEI_SMM_ACCESS_PPI / EFI_SMM_ACCESS2_PROTOCOL object,\r
37 from the D_LCK and T_EN bits.\r
38\r
39 PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL member functions can rely on\r
40 the LockState and OpenState fields being up-to-date on entry, and they need\r
41 to restore the same invariant on exit, if they touch the bits in question.\r
42\r
43 @param[out] LockState Reflects the D_LCK bit on output; TRUE iff SMRAM is\r
44 locked.\r
45 @param[out] OpenState Reflects the inverse of the T_EN bit on output; TRUE\r
46 iff SMRAM is open.\r
47**/\r
48VOID\r
49GetStates (\r
50 OUT BOOLEAN *LockState,\r
51 OUT BOOLEAN *OpenState\r
52 );\r
53\r
54//\r
55// The functions below follow the PEI_SMM_ACCESS_PPI and\r
56// EFI_SMM_ACCESS2_PROTOCOL member declarations. The PeiServices and This\r
57// pointers are removed (TSEG doesn't depend on them), and so is the\r
58// DescriptorIndex parameter (TSEG doesn't support range-wise locking).\r
59//\r
60// The LockState and OpenState members that are common to both\r
61// PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL are taken and updated in\r
62// isolation from the rest of the (non-shared) members.\r
63//\r
64\r
65EFI_STATUS\r
66SmramAccessOpen (\r
67 OUT BOOLEAN *LockState,\r
68 OUT BOOLEAN *OpenState\r
69 );\r
70\r
71EFI_STATUS\r
72SmramAccessClose (\r
73 OUT BOOLEAN *LockState,\r
74 OUT BOOLEAN *OpenState\r
75 );\r
76\r
77EFI_STATUS\r
78SmramAccessLock (\r
79 OUT BOOLEAN *LockState,\r
80 IN OUT BOOLEAN *OpenState\r
81 );\r
82\r
83EFI_STATUS\r
84SmramAccessGetCapabilities (\r
85 IN BOOLEAN LockState,\r
86 IN BOOLEAN OpenState,\r
87 IN OUT UINTN *SmramMapSize,\r
88 IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap\r
89 );\r