MdePkg: Add CcProbeLibNull
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>
This commit is contained in:
		
							
								
								
									
										26
									
								
								MdePkg/Include/Library/CcProbeLib.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								MdePkg/Include/Library/CcProbeLib.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					/** @file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
 | 
				
			||||||
 | 
					SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef CC_PROBE_LIB_H_
 | 
				
			||||||
 | 
					#define CC_PROBE_LIB_H_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <ConfidentialComputingGuestAttr.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					  Probe the ConfidentialComputing Guest type. See defition of
 | 
				
			||||||
 | 
					  CC_GUEST_TYPE in <ConfidentialComputingGuestAttr.h>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @return The guest type
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					UINT8
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					CcProbe (
 | 
				
			||||||
 | 
					  VOID
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
							
								
								
									
										26
									
								
								MdePkg/Library/CcProbeLibNull/CcProbeLibNull.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								MdePkg/Library/CcProbeLibNull/CcProbeLibNull.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					/** @file
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Null stub of CcProbeLib
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
 | 
				
			||||||
 | 
					  SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <Library/CcProbeLib.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					  Probe the ConfidentialComputing Guest type. See defition of
 | 
				
			||||||
 | 
					  CC_GUEST_TYPE in <ConfidentialComputingGuestAttr.h>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @return The guest type
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**/
 | 
				
			||||||
 | 
					UINT8
 | 
				
			||||||
 | 
					EFIAPI
 | 
				
			||||||
 | 
					CcProbe (
 | 
				
			||||||
 | 
					  VOID
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  return CcGuestTypeNonEncrypted;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										21
									
								
								MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					## @file
 | 
				
			||||||
 | 
					# CcProbeLib null instance.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					#  Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
 | 
				
			||||||
 | 
					#  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
 | 
				
			||||||
@@ -267,6 +267,11 @@
 | 
				
			|||||||
  #
 | 
					  #
 | 
				
			||||||
  RegisterFilterLib|Include/Library/RegisterFilterLib.h
 | 
					  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]
 | 
					[LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64]
 | 
				
			||||||
  ##  @libraryclass  Provides services to generate random number.
 | 
					  ##  @libraryclass  Provides services to generate random number.
 | 
				
			||||||
  #
 | 
					  #
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -130,6 +130,7 @@
 | 
				
			|||||||
  MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
 | 
					  MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
 | 
					  MdePkg/Library/RegisterFilterLibNull/RegisterFilterLibNull.inf
 | 
				
			||||||
 | 
					  MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Components.IA32, Components.X64, Components.ARM, Components.AARCH64]
 | 
					[Components.IA32, Components.X64, Components.ARM, Components.AARCH64]
 | 
				
			||||||
  #
 | 
					  #
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user