--- /dev/null
+/** @file\r
+ Header file of Debug services instances.\r
+\r
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+#ifndef __DEBUG_SERVICE_H__\r
+#define __DEBUG_SERVICE_H__\r
+\r
+#include <Ppi/Debug.h>\r
+\r
+/**\r
+ Print a debug message to debug output device if the specified error level\r
+ is enabled.\r
+\r
+ @param[in] ErrorLevel The error level of the debug message.\r
+ @param[in] Format Format string for the debug message to print.\r
+ @param[in] Marker BASE_LIST marker for the variable argument list.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+PeiDebugBPrint(\r
+ IN UINTN ErrorLevel,\r
+ IN CONST CHAR8 *Format,\r
+ IN BASE_LIST Marker\r
+ );\r
+\r
+/**\r
+ Prints an assert message containing a filename, line number, and description.\r
+ This may be followed by a breakpoint or a dead loop.\r
+\r
+ @param[in] FileName The pointer to the name of the source file that\r
+ generated the assert condition.\r
+ @param[in] LineNumber The line number in the source file that generated\r
+ the assert condition\r
+ @param[in] Description The pointer to the description of the assert condition.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+PeiDebugAssert(\r
+ IN CONST CHAR8 *FileName,\r
+ IN UINTN LineNumber,\r
+ IN CONST CHAR8 *Description\r
+ );\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ This driver installs gEdkiiDebugPpiGuid PPI to provide\r
+ debug services for PEIMs.\r
+\r
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <Uefi/UefiBaseType.h>\r
+#include <Library/PeimEntryPoint.h>\r
+#include <Library/PeiServicesLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+#include <Ppi/Debug.h>\r
+\r
+#include "DebugService.h"\r
+\r
+EDKII_DEBUG_PPI mDebugPpi = {\r
+ PeiDebugBPrint,\r
+ PeiDebugAssert\r
+};\r
+\r
+EFI_PEI_PPI_DESCRIPTOR mDebugServicePpi = {\r
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
+ &gEdkiiDebugPpiGuid,\r
+ (VOID *)&mDebugPpi\r
+};\r
+\r
+/**\r
+ Print a debug message to debug output device if the specified error level\r
+ is enabled.\r
+\r
+ @param[in] ErrorLevel The error level of the debug message.\r
+ @param[in] Format Format string for the debug message to print.\r
+ @param[in] Marker BASE_LIST marker for the variable argument list.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+PeiDebugBPrint(\r
+ IN UINTN ErrorLevel,\r
+ IN CONST CHAR8 *Format,\r
+ IN BASE_LIST Marker\r
+ )\r
+{\r
+ DebugBPrint(ErrorLevel, Format, Marker);\r
+}\r
+\r
+/**\r
+ Print an assert message containing a filename, line number, and description.\r
+ This may be followed by a breakpoint or a dead loop.\r
+\r
+ @param[in] FileName The pointer to the name of the source file that\r
+ generated the assert condition.\r
+ @param[in] LineNumber The line number in the source file that generated\r
+ the assert condition\r
+ @param[in] Description The pointer to the description of the assert condition.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+PeiDebugAssert(\r
+ IN CONST CHAR8 *FileName,\r
+ IN UINTN LineNumber,\r
+ IN CONST CHAR8 *Description\r
+ )\r
+{\r
+ DebugAssert(FileName, LineNumber, Description);\r
+}\r
+\r
+/**\r
+ Entry point of Debug Service PEIM\r
+\r
+ This funciton installs EDKII DEBUG PPI\r
+\r
+ @param FileHandle Handle of the file being invoked.\r
+ @param PeiServices Describes the list of possible PEI Services.\r
+\r
+ @retval EFI_SUCESS The entry point of Debug Service PEIM executes successfully.\r
+ @retval Others Some error occurs during the execution of this function.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DebugSerivceInitialize (\r
+ IN EFI_PEI_FILE_HANDLE FileHandle,\r
+ IN CONST EFI_PEI_SERVICES **PeiServices\r
+ )\r
+{\r
+ return PeiServicesInstallPpi (&mDebugServicePpi);\r
+}\r
+\r
--- /dev/null
+## @file\r
+# Debug services for PEI phase\r
+#\r
+# This module installs gEdkiiDebugPpiGuid PPI to provide\r
+# debug services for PEIMs.\r
+#\r
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+#\r
+# This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+##\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = DebugServicePei\r
+ MODULE_UNI_FILE = DebugServicePei.uni\r
+ FILE_GUID = B73F81B9-1DFC-487C-824C-0509EE2B0128\r
+ MODULE_TYPE = PEIM\r
+ VERSION_STRING = 1.0\r
+\r
+ ENTRY_POINT = DebugSerivceInitialize\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 EBC\r
+#\r
+\r
+[Sources]\r
+ DebugServicePei.c\r
+ DebugService.h\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ MdeModulePkg/MdeModulePkg.dec\r
+\r
+[LibraryClasses]\r
+ PeimEntryPoint\r
+ PeiServicesLib\r
+ DebugLib\r
+\r
+[Ppis]\r
+ gEdkiiDebugPpiGuid ## PRODUCE\r
+\r
+[Depex]\r
+ TRUE\r
+\r
--- /dev/null
+///** @file\r
+// This driver installs gEdkiiDebugPpiGuid PPI to provide\r
+// debug services for PEIMs.\r
+//\r
+// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+//\r
+// This program and the accompanying materials\r
+// are licensed and made available under the terms and conditions of the BSD License\r
+// which accompanies this distribution. The full text of the license may be found at\r
+// http://opensource.org/licenses/bsd-license.php\r
+//\r
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+//\r
+//**/\r
+\r
+#string STR_MODULE_ABSTRACT #language en-US "Provide debug services at PEI phase."\r
+\r
+#string STR_MODULE_DESCRIPTION #language en-US "It produces gEdkiiDebugPpiGuid to print message to debug output device"\r
+\r