[edk2-devel] [PATCH 3/4] MdePkg: Add NULL library for TraceHubDebugLibSysT

victorx.hsu at intel.com victorx.hsu at intel.com
Tue Jan 31 02:49:01 UTC 2023


From: VictorX Hsu <victorx.hsu at intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4144

This Library is NULL library for TraceHubDebugLibSysT.

Cc: Michael D Kinney <michael.d.kinney at intel.com>
Cc: Guo Gua <gua.guo at intel.com>
Cc: Chan Laura <laura.chan at intel.com>
Cc: Prakashan Krishnadas Veliyathuparambil <krishnadas.veliyathuparambil.prakashan at intel.com>
Cc: K N Karthik <karthik.k.n at intel.com>
Signed-off-by: VictorX Hsu <victorx.hsu at intel.com>
---
 MdePkg/Include/Library/TraceHubDebugLib.h     | 82 +++++++++++++++++++
 .../TraceHubDebugLibNull.c                    | 75 +++++++++++++++++
 .../TraceHubDebugLibNull.inf                  | 29 +++++++
 MdePkg/MdePkg.dec                             |  4 +
 MdePkg/MdePkg.dsc                             |  2 +
 5 files changed, 192 insertions(+)
 create mode 100644 MdePkg/Include/Library/TraceHubDebugLib.h
 create mode 100644 MdePkg/Library/TraceHubDebugLibNull/TraceHubDebugLibNull.c
 create mode 100644 MdePkg/Library/TraceHubDebugLibNull/TraceHubDebugLibNull.inf

diff --git a/MdePkg/Include/Library/TraceHubDebugLib.h b/MdePkg/Include/Library/TraceHubDebugLib.h
new file mode 100644
index 0000000000..2e8d70ae97
--- /dev/null
+++ b/MdePkg/Include/Library/TraceHubDebugLib.h
@@ -0,0 +1,82 @@
+/** @file
+
+Copyright (c) 2023, 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.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 Other            Failed to output Trace Hub message.
+**/
+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.
+
+  @retval EFI_SUCCESS      Data was written to Trace Hub.
+  @retval Other            Failed to output Trace Hub message.
+**/
+EFI_STATUS
+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.
+
+  @retval EFI_SUCCESS      Data was written to Trace Hub.
+  @retval Other            Failed to output Trace Hub message.
+**/
+EFI_STATUS
+EFIAPI
+TraceHubWriteCataLog64 (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT64                   Id,
+  IN UINTN                    NumberOfParams,
+  ...
+  );
+
+#endif // TRACE_HUB_DEBUG_LIB_H_
diff --git a/MdePkg/Library/TraceHubDebugLibNull/TraceHubDebugLibNull.c b/MdePkg/Library/TraceHubDebugLibNull/TraceHubDebugLibNull.c
new file mode 100644
index 0000000000..8d8f3f69e8
--- /dev/null
+++ b/MdePkg/Library/TraceHubDebugLibNull/TraceHubDebugLibNull.c
@@ -0,0 +1,75 @@
+/** @file
+
+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
+
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.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 Other            Failed to output Trace Hub message.
+**/
+EFI_STATUS
+EFIAPI
+TraceHubDebugWrite (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT8                    *Buffer,
+  IN UINTN                    NumberOfBytes
+  )
+{
+  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.
+
+  @retval EFI_SUCCESS      Data was written to Trace Hub.
+  @retval Other            Failed to output Trace Hub message.
+**/
+EFI_STATUS
+EFIAPI
+TraceHubWriteCataLog64StatusCode (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT64                   Id,
+  IN EFI_GUID                 *Guid
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+/**
+  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.
+
+  @retval EFI_SUCCESS      Data was written to Trace Hub.
+  @retval Other            Failed to output Trace Hub message.
+**/
+EFI_STATUS
+EFIAPI
+TraceHubWriteCataLog64 (
+  IN TRACE_HUB_SEVERITY_TYPE  SeverityType,
+  IN UINT64                   Id,
+  IN UINTN                    NumberOfParams,
+  ...
+  )
+{
+  return EFI_UNSUPPORTED;
+}
diff --git a/MdePkg/Library/TraceHubDebugLibNull/TraceHubDebugLibNull.inf b/MdePkg/Library/TraceHubDebugLibNull/TraceHubDebugLibNull.inf
new file mode 100644
index 0000000000..0629365b6e
--- /dev/null
+++ b/MdePkg/Library/TraceHubDebugLibNull/TraceHubDebugLibNull.inf
@@ -0,0 +1,29 @@
+## @file
+#  Null library of TraceHubDebugLib.
+#
+#  Copyright (c) 2023, 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
+#
+
+[Packages]
+  MdePkg/MdePkg.dec
+
+[Sources]
+  TraceHubDebugLibNull.c
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index bee7ac538a..1ea6a0aae6 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -289,6 +289,10 @@
   #
   MipiSysTLib|Include/Library/MipiSysTLib.h
 
+  ##  @libraryclass  Provides API to output Trace Hub debug message.
+  #
+  TraceHubDebugLib|Include/Library/TraceHubDebugLib.h
+
 [LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64]
   ##  @libraryclass  Provides services to generate random number.
   #
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index cbcf4a6047..a2b4164d84 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -35,6 +35,7 @@
 [LibraryClasses]
   SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
   MipiSysTLib|MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
+  TraceHubDebugLib|MdePkg/Library/TraceHubDebugLibNull/TraceHubDebugLibNull.inf
 
 [Components]
   MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
@@ -137,6 +138,7 @@
   MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf
   MdePkg/Library/SmmCpuRendezvousLibNull/SmmCpuRendezvousLibNull.inf
   MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
+  MdePkg/Library/TraceHubDebugLibNull/TraceHubDebugLibNull.inf
 
 [Components.IA32, Components.X64, Components.ARM, Components.AARCH64]
   #
-- 
2.28.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#99335): https://edk2.groups.io/g/devel/message/99335
Mute This Topic: https://groups.io/mt/96647471/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list