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