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>
15
16#include "SnpPageStateChange.h"
17#include "VirtualMemory.h"
18
19STATIC VOID *mPscBuffer = NULL;
20
28VOID
29EFIAPI
31 IN PHYSICAL_ADDRESS BaseAddress,
32 IN UINTN NumPages
33 )
34{
35 EFI_STATUS Status;
36
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) {
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}
UINT64 UINTN
VOID EFIAPI CpuDeadLoop(VOID)
Definition: CpuDeadLoop.c:25
VOID EFIAPI MemEncryptSevSnpPreValidateSystemRam(IN PHYSICAL_ADDRESS BaseAddress, IN UINTN NumPages)
VOID *EFIAPI AllocateReservedPages(IN UINTN Pages)
#define NULL
Definition: Base.h:319
#define STATIC
Definition: Base.h:264
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
BOOLEAN EFIAPI MemEncryptSevSnpIsEnabled(VOID)
RETURN_STATUS EFIAPI InternalMemEncryptSevCreateIdentityMap1G(IN PHYSICAL_ADDRESS Cr3BaseAddress, IN PHYSICAL_ADDRESS PhysicalAddress, IN UINTN Length)
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)
#define EFI_PAGES_TO_SIZE(Pages)
Definition: UefiBaseType.h:213
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29