]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/DebugServicePei/DebugServicePei.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Universal / DebugServicePei / DebugServicePei.c
CommitLineData
2bc82244
ZG
1/** @file\r
2 This driver installs gEdkiiDebugPpiGuid PPI to provide\r
3 debug services for PEIMs.\r
4\r
5 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
6\r
9d510e61 7 SPDX-License-Identifier: BSD-2-Clause-Patent\r
2bc82244
ZG
8\r
9**/\r
10\r
11#include <Uefi/UefiBaseType.h>\r
12#include <Library/PeimEntryPoint.h>\r
13#include <Library/PeiServicesLib.h>\r
14#include <Library/DebugLib.h>\r
15\r
16#include <Ppi/Debug.h>\r
17\r
18#include "DebugService.h"\r
19\r
20EDKII_DEBUG_PPI mDebugPpi = {\r
21 PeiDebugBPrint,\r
22 PeiDebugAssert\r
23};\r
24\r
25EFI_PEI_PPI_DESCRIPTOR mDebugServicePpi = {\r
26 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
27 &gEdkiiDebugPpiGuid,\r
28 (VOID *)&mDebugPpi\r
29};\r
30\r
31/**\r
32 Print a debug message to debug output device if the specified error level\r
33 is enabled.\r
34\r
35 @param[in] ErrorLevel The error level of the debug message.\r
36 @param[in] Format Format string for the debug message to print.\r
37 @param[in] Marker BASE_LIST marker for the variable argument list.\r
38\r
39**/\r
40VOID\r
41EFIAPI\r
42PeiDebugBPrint(\r
43 IN UINTN ErrorLevel,\r
44 IN CONST CHAR8 *Format,\r
45 IN BASE_LIST Marker\r
46 )\r
47{\r
48 DebugBPrint(ErrorLevel, Format, Marker);\r
49}\r
50\r
51/**\r
52 Print an assert message containing a filename, line number, and description.\r
53 This may be followed by a breakpoint or a dead loop.\r
54\r
55 @param[in] FileName The pointer to the name of the source file that\r
56 generated the assert condition.\r
57 @param[in] LineNumber The line number in the source file that generated\r
58 the assert condition\r
59 @param[in] Description The pointer to the description of the assert condition.\r
60\r
61**/\r
62VOID\r
63EFIAPI\r
64PeiDebugAssert(\r
65 IN CONST CHAR8 *FileName,\r
66 IN UINTN LineNumber,\r
67 IN CONST CHAR8 *Description\r
68 )\r
69{\r
70 DebugAssert(FileName, LineNumber, Description);\r
71}\r
72\r
73/**\r
74 Entry point of Debug Service PEIM\r
75\r
76 This funciton installs EDKII DEBUG PPI\r
77\r
78 @param FileHandle Handle of the file being invoked.\r
79 @param PeiServices Describes the list of possible PEI Services.\r
80\r
81 @retval EFI_SUCESS The entry point of Debug Service PEIM executes successfully.\r
82 @retval Others Some error occurs during the execution of this function.\r
83\r
84**/\r
85EFI_STATUS\r
86EFIAPI\r
87DebugSerivceInitialize (\r
88 IN EFI_PEI_FILE_HANDLE FileHandle,\r
89 IN CONST EFI_PEI_SERVICES **PeiServices\r
90 )\r
91{\r
92 return PeiServicesInstallPpi (&mDebugServicePpi);\r
93}\r
94\r