3 Functions and types shared by the SMM accessor PEI and DXE modules.
5 Copyright (C) 2015, Red Hat, Inc.
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #include <Pi/PiMultiPhase.h>
14 // We'll have two SMRAM ranges.
16 // The first is a tiny one that hosts an SMM_S3_RESUME_STATE object, to be
17 // filled in by the CPU SMM driver during normal boot, for the PEI instance of
18 // the LockBox library (which will rely on the object during S3 resume).
20 // The other SMRAM range is the main one, for the SMM core and the SMM drivers.
23 DescIdxSmmS3ResumeState
= 0,
29 // The value of PcdQ35TsegMbytes is saved into this variable at module startup.
31 extern UINT16 mQ35TsegMbytes
;
34 Save PcdQ35TsegMbytes into mQ35TsegMbytes.
42 Read the MCH_SMRAM and ESMRAMC registers, and update the LockState and
43 OpenState fields in the PEI_SMM_ACCESS_PPI / EFI_SMM_ACCESS2_PROTOCOL object,
44 from the D_LCK and T_EN bits.
46 PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL member functions can rely on
47 the LockState and OpenState fields being up-to-date on entry, and they need
48 to restore the same invariant on exit, if they touch the bits in question.
50 @param[out] LockState Reflects the D_LCK bit on output; TRUE iff SMRAM is
52 @param[out] OpenState Reflects the inverse of the T_EN bit on output; TRUE
57 OUT BOOLEAN
*LockState
,
58 OUT BOOLEAN
*OpenState
62 // The functions below follow the PEI_SMM_ACCESS_PPI and
63 // EFI_SMM_ACCESS2_PROTOCOL member declarations. The PeiServices and This
64 // pointers are removed (TSEG doesn't depend on them), and so is the
65 // DescriptorIndex parameter (TSEG doesn't support range-wise locking).
67 // The LockState and OpenState members that are common to both
68 // PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL are taken and updated in
69 // isolation from the rest of the (non-shared) members.
74 OUT BOOLEAN
*LockState
,
75 OUT BOOLEAN
*OpenState
80 OUT BOOLEAN
*LockState
,
81 OUT BOOLEAN
*OpenState
86 OUT BOOLEAN
*LockState
,
87 IN OUT BOOLEAN
*OpenState
91 SmramAccessGetCapabilities (
94 IN OUT UINTN
*SmramMapSize
,
95 IN OUT EFI_SMRAM_DESCRIPTOR
*SmramMap