From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web08.1927.1649981244283090489 for ; Thu, 14 Apr 2022 17:07:35 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=WlnAyQT0; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649981255; x=1681517255; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GGJOkiVkrFGwwcXbxErVBg1VnTrCjC3F7ORrPk+5OfI=; b=WlnAyQT0BepBvWb+W2YjMiKLR+4jzaUrWptkAwxL2O+zebwD+W/grAID AnSAczUX5NWTy5op/ZoyqQxucTFOtTNv25gIJETCT/+xWTZw8rdgNs98u c5/hhrDkS3eD4oaKvVzjHmW4QpWjuDVPrGCuxa677KYFYKM3lfnXcw+0K ik1qoBdmeRzGzauyZX3xsouXbpKLiI7DdHOCkzk/1MTbM7WdlmHOGfpj2 LSKCjA1xiyMHylN7yo2YAnLwzhvNRzGpR6ugPx9z98mNsnRCVLOzXF33F u2PBNuEk8yaE8AjmZm0D07AuxcaEx8AZtDHOz4qjBxPeBM+b0oR9hmGEN g==; X-IronPort-AV: E=McAfee;i="6400,9594,10317"; a="262504581" X-IronPort-AV: E=Sophos;i="5.90,261,1643702400"; d="scan'208";a="262504581" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2022 17:07:35 -0700 X-IronPort-AV: E=Sophos;i="5.90,261,1643702400"; d="scan'208";a="552923323" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.249.168.38]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2022 17:07:31 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Michael D Kinney , Liming Gao , Zhiguang Liu , James Bottomley , James Bottomley , Jiewen Yao , Gerd Hoffmann , Brijesh Singh , Erdem Aktas , Tom Lendacky Subject: [PATCH V2 4/6] OvmfPkg: Add CcProbeLib Date: Fri, 15 Apr 2022 08:07:07 +0800 Message-Id: <195e8aa1b61fc1dbc5084d1287d6f779482556e6.1649980548.git.min.m.xu@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Cc: Liming Gao Cc: Zhiguang Liu Cc: James Bottomley Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Cc: Brijesh Singh Cc: Erdem Aktas Cc: Tom Lendacky Signed-off-by: Min Xu --- OvmfPkg/Library/CcProbeLib/CcProbeLib.c | 31 +++++++++++++++++++++++ OvmfPkg/Library/CcProbeLib/CcProbeLib.inf | 25 ++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 OvmfPkg/Library/CcProbeLib/CcProbeLib.c create mode 100644 OvmfPkg/Library/CcProbeLib/CcProbeLib.inf diff --git a/OvmfPkg/Library/CcProbeLib/CcProbeLib.c b/OvmfPkg/Library/CcProbeLib/CcProbeLib.c new file mode 100644 index 000000000000..b4babcb423f7 --- /dev/null +++ b/OvmfPkg/Library/CcProbeLib/CcProbeLib.c @@ -0,0 +1,31 @@ +/** @file + + CcProbeLib is used to probe the Confidential computing guest type. + + Copyright (c) 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +/** + Probe the ConfidentialComputing Guest type. See defition of + CC_GUEST_TYPE in . + + @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; +} diff --git a/OvmfPkg/Library/CcProbeLib/CcProbeLib.inf b/OvmfPkg/Library/CcProbeLib/CcProbeLib.inf new file mode 100644 index 000000000000..5300c9ba2644 --- /dev/null +++ b/OvmfPkg/Library/CcProbeLib/CcProbeLib.inf @@ -0,0 +1,25 @@ +## @file +# CcProbeLib is used to probe Confidential Computing guest type. +# +# Copyright (c) 2022, Intel Corporation. All rights reserved.
+# 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 -- 2.29.2.windows.2