VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/SmmAccess/SmramInternal.h@ 105668

Last change on this file since 105668 was 99404, checked in by vboxsync, 2 years ago

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • Property svn:eol-style set to native
File size: 2.6 KB
Line 
1/** @file
2
3 Functions and types shared by the SMM accessor PEI and DXE modules.
4
5 Copyright (C) 2015, Red Hat, Inc.
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9**/
10
11#include <Pi/PiMultiPhase.h>
12
13//
14// We'll have two SMRAM ranges.
15//
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).
19//
20// The other SMRAM range is the main one, for the SMM core and the SMM drivers.
21//
22typedef enum {
23 DescIdxSmmS3ResumeState = 0,
24 DescIdxMain = 1,
25 DescIdxCount = 2
26} DESCRIPTOR_INDEX;
27
28//
29// The value of PcdQ35TsegMbytes is saved into this variable at module startup.
30//
31extern UINT16 mQ35TsegMbytes;
32
33/**
34 Save PcdQ35TsegMbytes into mQ35TsegMbytes.
35**/
36VOID
37InitQ35TsegMbytes (
38 VOID
39 );
40
41/**
42 Save PcdQ35SmramAtDefaultSmbase into mQ35SmramAtDefaultSmbase.
43**/
44VOID
45InitQ35SmramAtDefaultSmbase (
46 VOID
47 );
48
49/**
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.
53
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.
57
58 @param[out] LockState Reflects the D_LCK bit on output; TRUE iff SMRAM is
59 locked.
60 @param[out] OpenState Reflects the inverse of the T_EN bit on output; TRUE
61 iff SMRAM is open.
62**/
63VOID
64GetStates (
65 OUT BOOLEAN *LockState,
66 OUT BOOLEAN *OpenState
67 );
68
69//
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).
74//
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.
78//
79
80EFI_STATUS
81SmramAccessOpen (
82 OUT BOOLEAN *LockState,
83 OUT BOOLEAN *OpenState
84 );
85
86EFI_STATUS
87SmramAccessClose (
88 OUT BOOLEAN *LockState,
89 OUT BOOLEAN *OpenState
90 );
91
92EFI_STATUS
93SmramAccessLock (
94 OUT BOOLEAN *LockState,
95 IN OUT BOOLEAN *OpenState
96 );
97
98EFI_STATUS
99SmramAccessGetCapabilities (
100 IN BOOLEAN LockState,
101 IN BOOLEAN OpenState,
102 IN OUT UINTN *SmramMapSize,
103 IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
104 );
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette