OvmfPkg/AmdSev: assign and reserve the Sev Secret area

Create a one page secret area in the MEMFD and reserve the area with a
boot time HOB.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3077
Signed-off-by: James Bottomley <jejb@linux.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20201130202819.3910-6-jejb@linux.ibm.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
[lersek@redhat.com: s/protect/reserve/g in the commit message, at Ard's
 and James's suggestion]
This commit is contained in:
James Bottomley
2020-11-30 12:28:18 -08:00
committed by mergify[bot]
parent 224752eced
commit bff2811c6d
4 changed files with 65 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
/** @file
SEV Secret boot time HOB placement
Copyright (C) 2020 James Bottomley, IBM Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <PiPei.h>
#include <Library/HobLib.h>
#include <Library/PcdLib.h>
EFI_STATUS
EFIAPI
InitializeSecretPei (
IN EFI_PEI_FILE_HANDLE FileHandle,
IN CONST EFI_PEI_SERVICES **PeiServices
)
{
BuildMemoryAllocationHob (
PcdGet32 (PcdSevLaunchSecretBase),
PcdGet32 (PcdSevLaunchSecretSize),
EfiBootServicesData
);
return EFI_SUCCESS;
}