]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/SmmAccess/SmramInternal.h
OvmfPkg/SmmAccess: prepare for PcdQ35TsegMbytes becoming dynamic
[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
1372f8d3
LE
34//\r
35// The value of PcdQ35TsegMbytes is saved into this variable at module startup.\r
36//\r
37extern UINT16 mQ35TsegMbytes;\r
38\r
39/**\r
40 Save PcdQ35TsegMbytes into mQ35TsegMbytes.\r
41**/\r
42VOID\r
43InitQ35TsegMbytes (\r
44 VOID\r
45 );\r
46\r
9d560947
LE
47/**\r
48 Read the MCH_SMRAM and ESMRAMC registers, and update the LockState and\r
49 OpenState fields in the PEI_SMM_ACCESS_PPI / EFI_SMM_ACCESS2_PROTOCOL object,\r
50 from the D_LCK and T_EN bits.\r
51\r
52 PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL member functions can rely on\r
53 the LockState and OpenState fields being up-to-date on entry, and they need\r
54 to restore the same invariant on exit, if they touch the bits in question.\r
55\r
56 @param[out] LockState Reflects the D_LCK bit on output; TRUE iff SMRAM is\r
57 locked.\r
58 @param[out] OpenState Reflects the inverse of the T_EN bit on output; TRUE\r
59 iff SMRAM is open.\r
60**/\r
61VOID\r
62GetStates (\r
63 OUT BOOLEAN *LockState,\r
64 OUT BOOLEAN *OpenState\r
65 );\r
66\r
67//\r
68// The functions below follow the PEI_SMM_ACCESS_PPI and\r
69// EFI_SMM_ACCESS2_PROTOCOL member declarations. The PeiServices and This\r
70// pointers are removed (TSEG doesn't depend on them), and so is the\r
71// DescriptorIndex parameter (TSEG doesn't support range-wise locking).\r
72//\r
73// The LockState and OpenState members that are common to both\r
74// PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL are taken and updated in\r
75// isolation from the rest of the (non-shared) members.\r
76//\r
77\r
78EFI_STATUS\r
79SmramAccessOpen (\r
80 OUT BOOLEAN *LockState,\r
81 OUT BOOLEAN *OpenState\r
82 );\r
83\r
84EFI_STATUS\r
85SmramAccessClose (\r
86 OUT BOOLEAN *LockState,\r
87 OUT BOOLEAN *OpenState\r
88 );\r
89\r
90EFI_STATUS\r
91SmramAccessLock (\r
92 OUT BOOLEAN *LockState,\r
93 IN OUT BOOLEAN *OpenState\r
94 );\r
95\r
96EFI_STATUS\r
97SmramAccessGetCapabilities (\r
98 IN BOOLEAN LockState,\r
99 IN BOOLEAN OpenState,\r
100 IN OUT UINTN *SmramMapSize,\r
101 IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap\r
102 );\r