blob: aa23c6dff81c7cbfceffe30a1591ab0e61c88106 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/** @file
Functions and types shared by the SMM accessor PEI and DXE modules.
Copyright (C) 2015, Red Hat, Inc.
Copyright (c) 2024 Intel Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Pi/PiMultiPhase.h>
#include <Guid/SmramMemoryReserve.h>
#include <Library/HobLib.h>
//
// The value of PcdQ35TsegMbytes is saved into this variable at module startup.
//
extern UINT16 mQ35TsegMbytes;
/**
Save PcdQ35TsegMbytes into mQ35TsegMbytes.
**/
VOID
InitQ35TsegMbytes (
VOID
);
/**
Save PcdQ35SmramAtDefaultSmbase into mQ35SmramAtDefaultSmbase.
**/
VOID
InitQ35SmramAtDefaultSmbase (
VOID
);
/**
Read the MCH_SMRAM and ESMRAMC registers, and update the LockState and
OpenState fields in the PEI_SMM_ACCESS_PPI / EFI_SMM_ACCESS2_PROTOCOL object,
from the D_LCK and T_EN bits.
PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL member functions can rely on
the LockState and OpenState fields being up-to-date on entry, and they need
to restore the same invariant on exit, if they touch the bits in question.
@param[out] LockState Reflects the D_LCK bit on output; TRUE iff SMRAM is
locked.
@param[out] OpenState Reflects the inverse of the T_EN bit on output; TRUE
iff SMRAM is open.
**/
VOID
GetStates (
OUT BOOLEAN *LockState,
OUT BOOLEAN *OpenState
);
//
// The functions below follow the PEI_SMM_ACCESS_PPI and
// EFI_SMM_ACCESS2_PROTOCOL member declarations. The PeiServices and This
// pointers are removed (TSEG doesn't depend on them), and so is the
// DescriptorIndex parameter (TSEG doesn't support range-wise locking).
//
// The LockState and OpenState members that are common to both
// PEI_SMM_ACCESS_PPI and EFI_SMM_ACCESS2_PROTOCOL are taken and updated in
// isolation from the rest of the (non-shared) members.
//
EFI_STATUS
SmramAccessOpen (
OUT BOOLEAN *LockState,
OUT BOOLEAN *OpenState
);
EFI_STATUS
SmramAccessClose (
OUT BOOLEAN *LockState,
OUT BOOLEAN *OpenState
);
EFI_STATUS
SmramAccessLock (
OUT BOOLEAN *LockState,
IN OUT BOOLEAN *OpenState
);
EFI_STATUS
SmramAccessGetCapabilities (
IN OUT UINTN *SmramMapSize,
IN OUT EFI_SMRAM_DESCRIPTOR *SmramMap
);
|