Skip to content

Commit c4bc1a9

Browse files
mxu9mergify[bot]
authored andcommitted
OvmfPkg: Add SecPeiCcProbeLib
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3974 SecPeiCcProbeLib is designed to probe the Confidential Computing guest type in SEC/PEI phase. The CC guest type was set by each CC guest at the beginning of boot up and saved in PcdOvmfWorkArea. Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Min Xu <min.m.xu@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
1 parent c05a218 commit c4bc1a9

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/** @file
2+
3+
CcProbeLib is used to probe the Confidential computing guest type.
4+
5+
Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
6+
SPDX-License-Identifier: BSD-2-Clause-Patent
7+
8+
**/
9+
10+
#include <Library/CcProbeLib.h>
11+
#include <WorkArea.h>
12+
13+
/**
14+
Probe the ConfidentialComputing Guest type. See defition of
15+
CC_GUEST_TYPE in <ConfidentialComputingGuestAttr.h>.
16+
17+
@return The guest type
18+
19+
**/
20+
UINT8
21+
EFIAPI
22+
CcProbe (
23+
VOID
24+
)
25+
{
26+
OVMF_WORK_AREA *WorkArea;
27+
28+
WorkArea = (OVMF_WORK_AREA *)FixedPcdGet32 (PcdOvmfWorkAreaBase);
29+
30+
return WorkArea != NULL ? WorkArea->Header.GuestType : CcGuestTypeNonEncrypted;
31+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## @file
2+
# CcProbeLib is used to probe Confidential Computing guest type.
3+
#
4+
# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
5+
# SPDX-License-Identifier: BSD-2-Clause-Patent
6+
#
7+
##
8+
9+
[Defines]
10+
INF_VERSION = 0x00010005
11+
BASE_NAME = SecPeiCcProbeLib
12+
FILE_GUID = 78eb7f2a-a42a-4b01-b160-5a05a0a52bac
13+
MODULE_TYPE = BASE
14+
VERSION_STRING = 1.0
15+
LIBRARY_CLASS = CcProbeLib|SEC PEIM PEI_CORE
16+
17+
[Sources]
18+
SecPeiCcProbeLib.c
19+
20+
[Packages]
21+
MdePkg/MdePkg.dec
22+
OvmfPkg/OvmfPkg.dec
23+
24+
[Pcd]
25+
gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase

0 commit comments

Comments
 (0)