3 Functions and types shared by the SMM accessor PEI and DXE modules.
5 Copyright (C) 2015, Red Hat, Inc.
7 This program and the accompanying materials are licensed and made available
8 under the terms and conditions of the BSD License which accompanies this
9 distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
13 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include <Pi/PiMultiPhase.h>
20 // We'll have two SMRAM ranges.
22 // The first is a tiny one that hosts an SMM_S3_RESUME_STATE object, to be
23 // filled in by the CPU SMM driver during normal boot, for the PEI instance of
24 // the LockBox library (which will rely on the object during S3 resume).
26 // The other SMRAM range is the main one, for the SMM core and the SMM drivers.
29 DescIdxSmmS3ResumeState
= 0,
35 Read the MCH_SMRAM and ESMRAMC registers, and update the LockState and
36 OpenState fields in the PEI_SMM_ACCESS_PPI / EFI_SMM_ACCESS2_PROTOCOL object,
37 from the D_LCK and T_EN bits.
39 PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL member functions can rely on
40 the LockState and OpenState fields being up-to-date on entry, and they need
41 to restore the same invariant on exit, if they touch the bits in question.
43 @param[out] LockState Reflects the D_LCK bit on output; TRUE iff SMRAM is
45 @param[out] OpenState Reflects the inverse of the T_EN bit on output; TRUE
50 OUT BOOLEAN
*LockState
,
51 OUT BOOLEAN
*OpenState
55 // The functions below follow the PEI_SMM_ACCESS_PPI and
56 // EFI_SMM_ACCESS2_PROTOCOL member declarations. The PeiServices and This
57 // pointers are removed (TSEG doesn't depend on them), and so is the
58 // DescriptorIndex parameter (TSEG doesn't support range-wise locking).
60 // The LockState and OpenState members that are common to both
61 // PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL are taken and updated in
62 // isolation from the rest of the (non-shared) members.
67 OUT BOOLEAN
*LockState
,
68 OUT BOOLEAN
*OpenState
73 OUT BOOLEAN
*LockState
,
74 OUT BOOLEAN
*OpenState
79 OUT BOOLEAN
*LockState
,
80 IN OUT BOOLEAN
*OpenState
84 SmramAccessGetCapabilities (
87 IN OUT UINTN
*SmramMapSize
,
88 IN OUT EFI_SMRAM_DESCRIPTOR
*SmramMap