TianoCore EDK2
master
Loading...
Searching...
No Matches
DxeSnpSystemRamValidate.c
Go to the documentation of this file.
1
11
#include <
Uefi/UefiBaseType.h
>
12
#include <
Library/BaseLib.h
>
13
#include <
Library/DebugLib.h
>
14
#include <
Library/MemEncryptSevLib.h
>
15
16
#include "
SnpPageStateChange.h
"
17
#include "
VirtualMemory.h
"
18
19
STATIC
VOID *mPscBuffer =
NULL
;
20
28
VOID
29
EFIAPI
30
MemEncryptSevSnpPreValidateSystemRam
(
31
IN
PHYSICAL_ADDRESS BaseAddress,
32
IN
UINTN
NumPages
33
)
34
{
35
EFI_STATUS
Status;
36
37
if
(!
MemEncryptSevSnpIsEnabled
()) {
38
return
;
39
}
40
41
// DXE pre-validation may happen with the memory accept protocol.
42
// The protocol should only be called outside the prevalidated ranges
43
// that the PEI stage code explicitly skips. Specifically, only memory
44
// ranges that are classified as unaccepted.
45
if
(BaseAddress >= SIZE_4GB) {
46
Status =
InternalMemEncryptSevCreateIdentityMap1G
(
47
0,
48
BaseAddress,
49
EFI_PAGES_TO_SIZE
(NumPages)
50
);
51
if
(EFI_ERROR (Status)) {
52
ASSERT (
FALSE
);
53
CpuDeadLoop
();
54
}
55
}
56
57
if
(mPscBuffer ==
NULL
) {
58
mPscBuffer =
AllocateReservedPages
(1);
59
ASSERT (mPscBuffer !=
NULL
);
60
}
61
62
InternalSetPageState
(BaseAddress, NumPages, SevSnpPagePrivate,
TRUE
, mPscBuffer, EFI_PAGE_SIZE);
63
}
UINTN
UINT64 UINTN
Definition:
ProcessorBind.h:112
BaseLib.h
CpuDeadLoop
VOID EFIAPI CpuDeadLoop(VOID)
Definition:
CpuDeadLoop.c:25
MemEncryptSevSnpPreValidateSystemRam
VOID EFIAPI MemEncryptSevSnpPreValidateSystemRam(IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
Definition:
DxeSnpSystemRamValidate.c:30
AllocateReservedPages
VOID *EFIAPI AllocateReservedPages(IN UINTN Pages)
Definition:
MemoryAllocationLib.c:114
NULL
#define NULL
Definition:
Base.h:319
STATIC
#define STATIC
Definition:
Base.h:264
TRUE
#define TRUE
Definition:
Base.h:301
FALSE
#define FALSE
Definition:
Base.h:307
IN
#define IN
Definition:
Base.h:279
DebugLib.h
MemEncryptSevLib.h
MemEncryptSevSnpIsEnabled
BOOLEAN EFIAPI MemEncryptSevSnpIsEnabled(VOID)
Definition:
DxeMemEncryptSevLibInternal.c:113
InternalMemEncryptSevCreateIdentityMap1G
RETURN_STATUS EFIAPI InternalMemEncryptSevCreateIdentityMap1G(IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS PhysicalAddress, IN UINTN Length)
Definition:
PeiDxeVirtualMemory.c:555
SnpPageStateChange.h
InternalSetPageState
VOID InternalSetPageState(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages, IN SEV_SNP_PAGE_STATE State, IN BOOLEAN UseLargeEntry, IN VOID *PscBuffer, IN UINTN PscBufferSize)
Definition:
SnpPageStateChangeInternal.c:225
UefiBaseType.h
EFI_PAGES_TO_SIZE
#define EFI_PAGES_TO_SIZE(Pages)
Definition:
UefiBaseType.h:213
EFI_STATUS
RETURN_STATUS EFI_STATUS
Definition:
UefiBaseType.h:29
VirtualMemory.h
OvmfPkg
Library
BaseMemEncryptSevLib
X64
DxeSnpSystemRamValidate.c
Generated on Fri Nov 15 2024 18:01:20 for TianoCore EDK2 by
1.9.6