OvmfPkg: Add CcProbeLib

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3902

This is the OvmfPkg specific CcProbeLib. It checks the Ovmf WorkArea
(PcdOvmfWorkAreaBase) to return the guest type.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
This commit is contained in:
Min Xu 2022-04-19 08:26:25 +08:00 committed by mergify[bot]
parent 74a3eb975d
commit 2f44d77c68
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,31 @@
/** @file
CcProbeLib is used to probe the Confidential computing guest type.
Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Library/CcProbeLib.h>
#include <WorkArea.h>
/**
Probe the ConfidentialComputing Guest type. See defition of
CC_GUEST_TYPE in <ConfidentialComputingGuestAttr.h>.
@return The guest type
**/
UINT8
EFIAPI
CcProbe (
VOID
)
{
OVMF_WORK_AREA *WorkArea;
WorkArea = (OVMF_WORK_AREA *)FixedPcdGet32 (PcdOvmfWorkAreaBase);
return WorkArea != NULL ? WorkArea->Header.GuestType : CcGuestTypeNonEncrypted;
}

View File

@ -0,0 +1,25 @@
## @file
# CcProbeLib is used to probe Confidential Computing guest type.
#
# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = CcProbeLib
FILE_GUID = 05184ec9-abb0-4491-8584-e388639a7c48
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = CcProbeLib
[Sources]
CcProbeLib.c
[Packages]
MdePkg/MdePkg.dec
OvmfPkg/OvmfPkg.dec
[Pcd]
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase