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 Save PcdQ35SmramAtDefaultSmbase into mQ35SmramAtDefaultSmbase.
45 InitQ35SmramAtDefaultSmbase (
50 Read the MCH_SMRAM and ESMRAMC registers, and update the LockState and
51 OpenState fields in the PEI_SMM_ACCESS_PPI / EFI_SMM_ACCESS2_PROTOCOL object,
52 from the D_LCK and T_EN bits.
54 PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL member functions can rely on
55 the LockState and OpenState fields being up-to-date on entry, and they need
56 to restore the same invariant on exit, if they touch the bits in question.
58 @param[out] LockState Reflects the D_LCK bit on output; TRUE iff SMRAM is
60 @param[out] OpenState Reflects the inverse of the T_EN bit on output; TRUE
65 OUT BOOLEAN
*LockState
,
66 OUT BOOLEAN
*OpenState
70 // The functions below follow the PEI_SMM_ACCESS_PPI and
71 // EFI_SMM_ACCESS2_PROTOCOL member declarations. The PeiServices and This
72 // pointers are removed (TSEG doesn't depend on them), and so is the
73 // DescriptorIndex parameter (TSEG doesn't support range-wise locking).
75 // The LockState and OpenState members that are common to both
76 // PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL are taken and updated in
77 // isolation from the rest of the (non-shared) members.
82 OUT BOOLEAN
*LockState
,
83 OUT BOOLEAN
*OpenState
88 OUT BOOLEAN
*LockState
,
89 OUT BOOLEAN
*OpenState
94 OUT BOOLEAN
*LockState
,
95 IN OUT BOOLEAN
*OpenState
99 SmramAccessGetCapabilities (
100 IN BOOLEAN LockState
,
101 IN BOOLEAN OpenState
,
102 IN OUT UINTN
*SmramMapSize
,
103 IN OUT EFI_SMRAM_DESCRIPTOR
*SmramMap