]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/SmmAccess/SmramInternal.h
OvmfPkg: Apply uncrustify changes
[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
b26f0cf9 7 SPDX-License-Identifier: BSD-2-Clause-Patent\r
9d560947
LE
8\r
9**/\r
10\r
11#include <Pi/PiMultiPhase.h>\r
12\r
13//\r
14// We'll have two SMRAM ranges.\r
15//\r
16// The first is a tiny one that hosts an SMM_S3_RESUME_STATE object, to be\r
17// filled in by the CPU SMM driver during normal boot, for the PEI instance of\r
18// the LockBox library (which will rely on the object during S3 resume).\r
19//\r
20// The other SMRAM range is the main one, for the SMM core and the SMM drivers.\r
21//\r
22typedef enum {\r
23 DescIdxSmmS3ResumeState = 0,\r
24 DescIdxMain = 1,\r
25 DescIdxCount = 2\r
26} DESCRIPTOR_INDEX;\r
27\r
1372f8d3
LE
28//\r
29// The value of PcdQ35TsegMbytes is saved into this variable at module startup.\r
30//\r
ac0a286f 31extern UINT16 mQ35TsegMbytes;\r
1372f8d3
LE
32\r
33/**\r
34 Save PcdQ35TsegMbytes into mQ35TsegMbytes.\r
35**/\r
36VOID\r
37InitQ35TsegMbytes (\r
38 VOID\r
39 );\r
40\r
9108fc17
LE
41/**\r
42 Save PcdQ35SmramAtDefaultSmbase into mQ35SmramAtDefaultSmbase.\r
43**/\r
44VOID\r
45InitQ35SmramAtDefaultSmbase (\r
46 VOID\r
47 );\r
48\r
9d560947
LE
49/**\r
50 Read the MCH_SMRAM and ESMRAMC registers, and update the LockState and\r
51 OpenState fields in the PEI_SMM_ACCESS_PPI / EFI_SMM_ACCESS2_PROTOCOL object,\r
52 from the D_LCK and T_EN bits.\r
53\r
54 PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL member functions can rely on\r
55 the LockState and OpenState fields being up-to-date on entry, and they need\r
56 to restore the same invariant on exit, if they touch the bits in question.\r
57\r
58 @param[out] LockState Reflects the D_LCK bit on output; TRUE iff SMRAM is\r
59 locked.\r
60 @param[out] OpenState Reflects the inverse of the T_EN bit on output; TRUE\r
61 iff SMRAM is open.\r
62**/\r
63VOID\r
64GetStates (\r
ac0a286f
MK
65 OUT BOOLEAN *LockState,\r
66 OUT BOOLEAN *OpenState\r
9d560947
LE
67 );\r
68\r
69//\r
70// The functions below follow the PEI_SMM_ACCESS_PPI and\r
71// EFI_SMM_ACCESS2_PROTOCOL member declarations. The PeiServices and This\r
72// pointers are removed (TSEG doesn't depend on them), and so is the\r
73// DescriptorIndex parameter (TSEG doesn't support range-wise locking).\r
74//\r
75// The LockState and OpenState members that are common to both\r
76// PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL are taken and updated in\r
77// isolation from the rest of the (non-shared) members.\r
78//\r
79\r
80EFI_STATUS\r
81SmramAccessOpen (\r
ac0a286f
MK
82 OUT BOOLEAN *LockState,\r
83 OUT BOOLEAN *OpenState\r
9d560947
LE
84 );\r
85\r
86EFI_STATUS\r
87SmramAccessClose (\r
ac0a286f
MK
88 OUT BOOLEAN *LockState,\r
89 OUT BOOLEAN *OpenState\r
9d560947
LE
90 );\r
91\r
92EFI_STATUS\r
93SmramAccessLock (\r
ac0a286f
MK
94 OUT BOOLEAN *LockState,\r
95 IN OUT BOOLEAN *OpenState\r
9d560947
LE
96 );\r
97\r
98EFI_STATUS\r
99SmramAccessGetCapabilities (\r
ac0a286f
MK
100 IN BOOLEAN LockState,\r
101 IN BOOLEAN OpenState,\r
102 IN OUT UINTN *SmramMapSize,\r
103 IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap\r
9d560947 104 );\r