Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MdeModulePkg: Add Trace Hub debug library
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4144 Part 2: Provide a debug library which consumed by Trace Hub to output debug message. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: VictorX Hsu <victorx.hsu@intel.com>
- Loading branch information
Showing
20 changed files
with
2,532 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/** @file | ||
Copyright (c) 2022, Intel Corporation. All rights reserved.<BR> | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef TRACE_HUB_DEBUG_LIB_H_ | ||
#define TRACE_HUB_DEBUG_LIB_H_ | ||
|
||
#include <Uefi/UefiBaseType.h> | ||
#include <Guid/StatusCodeDataTypeDebug.h> | ||
|
||
typedef enum { | ||
SeverityNone = 0, | ||
SeverityFatal = 1, | ||
SeverityError = 2, | ||
SeverityWarning = 3, | ||
SeverityNormal = 4, | ||
SeverityUser1 = 5, | ||
SeverityUser2 = 6, | ||
SeverityUser3 = 7, | ||
SeverityMax | ||
} TRACE_HUB_SEVERITY_TYPE; | ||
|
||
/** | ||
Write debug string to specified Trace Hub MMIO address. | ||
@param[in] SeverityType An error level to decide whether to enable Trace Hub data. | ||
@param[in] Buffer A pointer to the data buffer. | ||
@param[in] NumberOfBytes Number of bytes to be written. | ||
@retval EFI_SUCCESS Data was written to Trace Hub. | ||
@retval EFI_DEVICE_ERROR No available Mipi Sys-T handle. | ||
@retval Other Data failed to write to Trace Hub. | ||
**/ | ||
EFI_STATUS | ||
EFIAPI | ||
TraceHubDebugWrite ( | ||
IN TRACE_HUB_SEVERITY_TYPE SeverityType, | ||
IN UINT8 *Buffer, | ||
IN UINTN NumberOfBytes | ||
); | ||
|
||
/** | ||
Write catalog status code message to specified Trace Hub MMIO address. | ||
@param[in] SeverityType An error level to decide whether to enable Trace Hub data. | ||
@param[in] Id Catalog ID. | ||
@param[in] Guid Driver Guid. | ||
**/ | ||
VOID | ||
EFIAPI | ||
TraceHubWriteCataLog64StatusCode ( | ||
IN TRACE_HUB_SEVERITY_TYPE SeverityType, | ||
IN UINT64 Id, | ||
IN EFI_GUID *Guid | ||
); | ||
|
||
/** | ||
Write catalog message to specified Trace Hub MMIO address. | ||
@param[in] SeverityType An error level to decide whether to enable Trace Hub data. | ||
@param[in] Id Catalog ID. | ||
@param[in] NumberOfParams Number of parameters in argument list. | ||
@param[in] ... Argument list that pass to Trace Hub. | ||
**/ | ||
VOID | ||
EFIAPI | ||
TraceHubWriteCataLog64 ( | ||
IN TRACE_HUB_SEVERITY_TYPE SeverityType, | ||
IN UINT64 Id, | ||
IN UINTN NumberOfParams, | ||
... | ||
); | ||
|
||
#endif // TRACE_HUB_DEBUG_LIB_H_ |
71 changes: 71 additions & 0 deletions
71
MdeModulePkg/Library/TraceHubDebugLibNull/TraceHubDebugLibNull.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** @file | ||
Copyright (c) 2022, Intel Corporation. All rights reserved.<BR> | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#include <Base.h> | ||
#include <Library/DebugLib.h> | ||
#include <Library/TraceHubDebugLib.h> | ||
|
||
/** | ||
Write debug string to specified Trace Hub MMIO address. | ||
@param[in] SeverityType An error level to decide whether to enable Trace Hub data. | ||
@param[in] Buffer A pointer to the data buffer. | ||
@param[in] NumberOfBytes Number of bytes to be written. | ||
@retval EFI_SUCCESS Data was written to Trace Hub. | ||
@retval EFI_DEVICE_ERROR No available Mipi Sys-T handle. | ||
@retval Other Data failed to write to Trace Hub. | ||
**/ | ||
EFI_STATUS | ||
EFIAPI | ||
TraceHubDebugWrite ( | ||
IN TRACE_HUB_SEVERITY_TYPE SeverityType, | ||
IN UINT8 *Buffer, | ||
IN UINTN NumberOfBytes | ||
) | ||
{ | ||
ASSERT (Buffer != NULL || NumberOfBytes == 0); | ||
|
||
return EFI_UNSUPPORTED; | ||
} | ||
|
||
/** | ||
Write catalog status code message to specified Trace Hub MMIO address. | ||
@param[in] SeverityType An error level to decide whether to enable Trace Hub data. | ||
@param[in] Id Catalog ID. | ||
@param[in] Guid Driver Guid. | ||
**/ | ||
VOID | ||
EFIAPI | ||
TraceHubWriteCataLog64StatusCode ( | ||
IN TRACE_HUB_SEVERITY_TYPE SeverityType, | ||
IN UINT64 Id, | ||
IN EFI_GUID *Guid | ||
) | ||
{ | ||
} | ||
|
||
/** | ||
Write catalog message to specified Trace Hub MMIO address. | ||
@param[in] SeverityType An error level to decide whether to enable Trace Hub data. | ||
@param[in] Id Catalog ID. | ||
@param[in] NumberOfParams Number of parameters in argument list. | ||
@param[in] ... Argument list that pass to Trace Hub. | ||
**/ | ||
VOID | ||
EFIAPI | ||
TraceHubWriteCataLog64 ( | ||
IN TRACE_HUB_SEVERITY_TYPE SeverityType, | ||
IN UINT64 Id, | ||
IN UINTN NumberOfParams, | ||
... | ||
) | ||
{ | ||
} |
33 changes: 33 additions & 0 deletions
33
MdeModulePkg/Library/TraceHubDebugLibNull/TraceHubDebugLibNull.inf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## @file | ||
# Null library of TraceHubDebugLib. | ||
# | ||
# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR> | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
# | ||
## | ||
|
||
|
||
[Defines] | ||
INF_VERSION = 0x00010005 | ||
BASE_NAME = TraceHubDebugLibNull | ||
FILE_GUID = 16196A4E-4196-4AF4-9A6B-F4D2ACC430A8 | ||
MODULE_TYPE = BASE | ||
VERSION_STRING = 1.0 | ||
LIBRARY_CLASS = TraceHubDebugLib | ||
|
||
# | ||
# The following information is for reference only and not required by the build tools. | ||
# | ||
# VALID_ARCHITECTURES = IA32 X64 | ||
# | ||
|
||
[LibraryClasses] | ||
DebugLib | ||
|
||
[Packages] | ||
MdePkg/MdePkg.dec | ||
MdeModulePkg/MdeModulePkg.dec | ||
|
||
[Sources] | ||
TraceHubDebugLibNull.c |
47 changes: 47 additions & 0 deletions
47
MdeModulePkg/Library/TraceHubDebugLibSysT/BaseTraceHubDebugLibSyst.inf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
## @file | ||
# TraceHubDebugLib for common usage. | ||
# | ||
# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR> | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
# | ||
## | ||
|
||
[Defines] | ||
INF_VERSION = 0x00010005 | ||
BASE_NAME = BaseTraceHubDebugLibSyst | ||
FILE_GUID = 336DA571-AD65-423C-9A43-E0056E5B2D8D | ||
MODULE_TYPE = BASE | ||
VERSION_STRING = 1.0 | ||
LIBRARY_CLASS = TraceHubDebugLib | ||
|
||
# | ||
# The following information is for reference only and not required by the build tools. | ||
# | ||
# VALID_ARCHITECTURES = IA32 X64 | ||
# | ||
|
||
[LibraryClasses] | ||
PcdLib | ||
DebugLib | ||
BaseMemoryLib | ||
BaseLib | ||
|
||
[Packages] | ||
MdePkg/MdePkg.dec | ||
MdeModulePkg/MdeModulePkg.dec | ||
|
||
[Sources] | ||
MipiSystApi.c | ||
MipiSystWriter.c | ||
MipiSystPlatform.c | ||
MipiSystApi.h | ||
MipiSystMessage.h | ||
MipiSyst.h | ||
BaseTraceHubDebugSystLib.c | ||
EnableTraceHubData.c | ||
EnableTraceHubData.h | ||
|
||
[Pcd] | ||
gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugVerbosity | ||
gEfiMdeModulePkgTokenSpaceGuid.PcdTraceHubDebugAddress |
Oops, something went wrong.