]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg: Add CcProbeLibNull
authorMin Xu <min.m.xu@intel.com>
Tue, 19 Apr 2022 00:26:24 +0000 (08:26 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 19 Apr 2022 01:26:08 +0000 (01:26 +0000)
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 <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: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
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>
MdePkg/Include/Library/CcProbeLib.h [new file with mode: 0644]
MdePkg/Library/CcProbeLibNull/CcProbeLibNull.c [new file with mode: 0644]
MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf [new file with mode: 0644]
MdePkg/MdePkg.dec
MdePkg/MdePkg.dsc

diff --git a/MdePkg/Include/Library/CcProbeLib.h b/MdePkg/Include/Library/CcProbeLib.h
new file mode 100644 (file)
index 0000000..2857ddd
--- /dev/null
@@ -0,0 +1,26 @@
+/** @file\r
+\r
+Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef CC_PROBE_LIB_H_\r
+#define CC_PROBE_LIB_H_\r
+\r
+#include <ConfidentialComputingGuestAttr.h>\r
+\r
+/**\r
+  Probe the ConfidentialComputing Guest type. See defition of\r
+  CC_GUEST_TYPE in <ConfidentialComputingGuestAttr.h>.\r
+\r
+  @return The guest type\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+CcProbe (\r
+  VOID\r
+  );\r
+\r
+#endif\r
diff --git a/MdePkg/Library/CcProbeLibNull/CcProbeLibNull.c b/MdePkg/Library/CcProbeLibNull/CcProbeLibNull.c
new file mode 100644 (file)
index 0000000..ca4111d
--- /dev/null
@@ -0,0 +1,26 @@
+/** @file\r
+\r
+  Null stub of CcProbeLib\r
+\r
+  Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <Library/CcProbeLib.h>\r
+\r
+/**\r
+  Probe the ConfidentialComputing Guest type. See defition of\r
+  CC_GUEST_TYPE in <ConfidentialComputingGuestAttr.h>.\r
+\r
+  @return The guest type\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+CcProbe (\r
+  VOID\r
+  )\r
+{\r
+  return CcGuestTypeNonEncrypted;\r
+}\r
diff --git a/MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf b/MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf
new file mode 100644 (file)
index 0000000..f37c25f
--- /dev/null
@@ -0,0 +1,21 @@
+## @file\r
+# CcProbeLib null instance.\r
+#\r
+#  Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r
+#  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = CcProbeLibNull\r
+  FILE_GUID                      = B15D67FE-0DAC-4316-8E26-8A6b85E43782\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = CcProbeLib\r
+\r
+[Sources]\r
+  CcProbeLibNull.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
index 1934c98404239b8f247122775a7538fdf32f2062..faeb28c80cbdec33bcdb6bc4b160fcc7cae39a0e 100644 (file)
   #\r
   RegisterFilterLib|Include/Library/RegisterFilterLib.h\r
 \r
+  ##  @libraryclass  This library provides interfances to probe ConfidentialComputing guest type.\r
+  #\r
+  #\r
+  CcProbeLib|Include/Library/CcProbeLib.h\r
+\r
 [LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64]\r
   ##  @libraryclass  Provides services to generate random number.\r
   #\r
index d6a7af412be74ae07ad9134665a0b862670579b8..c8d282882ec18fd58fdd7b6e42320907027fb03e 100644 (file)
   MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf\r
 \r
   MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf\r
+  MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf\r
 \r
 [Components.IA32, Components.X64, Components.ARM, Components.AARCH64]\r
   #\r