From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.25369.1650164497717213024 for ; Sat, 16 Apr 2022 20:01:47 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=Vm5dc/9r; spf=pass (domain: intel.com, ip: 192.55.52.43, 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=1650164505; x=1681700505; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GGJOkiVkrFGwwcXbxErVBg1VnTrCjC3F7ORrPk+5OfI=; b=Vm5dc/9r2P2xGNiG0Z9v7On1kk9l9xW4gDby5em06VfvD8cFo/yIdTgl CS0YvcjvNKryFu7Gt1XlwmUsKGZxNrBwC4C22cVSs8I6BUmmh8kwxBQ1Q e2wlGN5CqASByZ1SuRLKsgS3AyHCdDxXlTWCWI8nOuu1yC8HuUPSPXGf3 R6F2FyD+3GC22V4RFUkAHJ5jbDXJWYw+/WXU4PhOTreVt8WN7tgGnCk0q Kw9je+JSFQ8D4d8kr+Aq0syTjZyAnLYz9WsrN3ShDGVXTB1lFmVa7kgB3 4jrvCddcVNfx7n4TvKpZwWJt/TVh+J9MCrg3MiVqfCqXTIESMixrXHPEL g==; X-IronPort-AV: E=McAfee;i="6400,9594,10318"; a="349806253" X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="349806253" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:45 -0700 X-IronPort-AV: E=Sophos;i="5.90,266,1643702400"; d="scan'208";a="575044331" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.29.191]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2022 20:01:42 -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 V3 4/7] OvmfPkg: Add CcProbeLib Date: Sun, 17 Apr 2022 11:01:10 +0800 Message-Id: <9b76a0c7fb98c84f4df2ad904bf3fa516551fa1a.1650163941.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