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:32 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=AQI49E59; 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=1649981252; x=1681517252; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lRYMItHUDfppib6rhQ28hCxKJi9ib6Ym5XpYiuYmu6Q=; b=AQI49E59oDc+ZKhCxNU9z971H/1QqQhSG8HBylrhSx3t9u7S6ZSl7rqm nzGU+YsmQCpOF45HkLq/HWYEfzT52JV5NQ8D+4JhnWBm6ewOCpHoBqa0W LFIqz4uDnGTiC98ST9D8BmSZjUsOAYLQt8k28V3Jfl2uMpTQm7YNNoqiJ YWhth9XIXy+zM0JtkAtOoB9ihJmG1gAAr2TgQ6XKzYcDPkyyIKMXehJpx lC8GRAYIZVW7CnhyjjYoUHGyUDGmAGeSBwGwEa5iR8ppKD1HeM986Ki/v 9Llavi9Pg02wX8LR5UZ3pfXZ6dfpWZ+jDUiaAM6n+hsBmTuchX2KKBPib A==; X-IronPort-AV: E=McAfee;i="6400,9594,10317"; a="262504566" X-IronPort-AV: E=Sophos;i="5.90,261,1643702400"; d="scan'208";a="262504566" 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:31 -0700 X-IronPort-AV: E=Sophos;i="5.90,261,1643702400"; d="scan'208";a="552923295" 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:29 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , Michael D Kinney , Liming Gao , Zhiguang Liu , James Bottomley , Jiewen Yao , Gerd Hoffmann Subject: [PATCH V2 3/6] MdePkg: Add CcProbeLib Date: Fri, 15 Apr 2022 08:07:06 +0800 Message-Id: <4fbb2c1f48800e80c24b23d0198e30835240f9d5.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 CcProbeLib is used to probe the Confidential Computing guest type. This library is designed to run on SEC / PEI / DXE phases. A null instance of the library always returns CCGuestTypeNonEncrypted. A platform specific CcProbeLib will be implemented, for example, in OvmfPkg. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: James Bottomley Cc: Jiewen Yao Cc: Gerd Hoffmann Signed-off-by: Min Xu --- MdePkg/Include/Library/CcProbeLib.h | 26 +++++++++++++++++++ .../Library/CcProbeLibNull/CcProbeLibNull.c | 26 +++++++++++++++++++ .../Library/CcProbeLibNull/CcProbeLibNull.inf | 21 +++++++++++++++ MdePkg/MdePkg.dec | 5 ++++ MdePkg/MdePkg.dsc | 1 + 5 files changed, 79 insertions(+) create mode 100644 MdePkg/Include/Library/CcProbeLib.h create mode 100644 MdePkg/Library/CcProbeLibNull/CcProbeLibNull.c create mode 100644 MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf diff --git a/MdePkg/Include/Library/CcProbeLib.h b/MdePkg/Include/Library/CcProbeLib.h new file mode 100644 index 000000000000..2857dddfb2d3 --- /dev/null +++ b/MdePkg/Include/Library/CcProbeLib.h @@ -0,0 +1,26 @@ +/** @file + +Copyright (c) 2022, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef CC_PROBE_LIB_H_ +#define CC_PROBE_LIB_H_ + +#include + +/** + Probe the ConfidentialComputing Guest type. See defition of + CC_GUEST_TYPE in . + + @return The guest type + +**/ +UINT8 +EFIAPI +CcProbe ( + VOID + ); + +#endif diff --git a/MdePkg/Library/CcProbeLibNull/CcProbeLibNull.c b/MdePkg/Library/CcProbeLibNull/CcProbeLibNull.c new file mode 100644 index 000000000000..152d900eb099 --- /dev/null +++ b/MdePkg/Library/CcProbeLibNull/CcProbeLibNull.c @@ -0,0 +1,26 @@ +/** @file + + Null stub of CcProbeLib + + Copyright (c) 2022, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/** + Probe the ConfidentialComputing Guest type. See defition of + CC_GUEST_TYPE in . + + @return The guest type + +**/ +UINT8 +EFIAPI +CcProbe ( + VOID + ) +{ + return CCGuestTypeNonEncrypted; +} diff --git a/MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf b/MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf new file mode 100644 index 000000000000..f37c25f73439 --- /dev/null +++ b/MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf @@ -0,0 +1,21 @@ +## @file +# CcProbeLib null instance. +# +# Copyright (c) 2022, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = CcProbeLibNull + FILE_GUID = B15D67FE-0DAC-4316-8E26-8A6b85E43782 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = CcProbeLib + +[Sources] + CcProbeLibNull.c + +[Packages] + MdePkg/MdePkg.dec diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 1934c9840423..faeb28c80cbd 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -267,6 +267,11 @@ # RegisterFilterLib|Include/Library/RegisterFilterLib.h + ## @libraryclass This library provides interfances to probe ConfidentialComputing guest type. + # + # + CcProbeLib|Include/Library/CcProbeLib.h + [LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64] ## @libraryclass Provides services to generate random number. # diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc index d6a7af412be7..c8d282882ec1 100644 --- a/MdePkg/MdePkg.dsc +++ b/MdePkg/MdePkg.dsc @@ -130,6 +130,7 @@ MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf + MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf [Components.IA32, Components.X64, Components.ARM, Components.AARCH64] # -- 2.29.2.windows.2