]> xenbits.xensource.com Git - ovmf.git/commitdiff
MdePkg: Add MipiSysTLib library
authorGua Guo <gua.guo@intel.com>
Wed, 10 May 2023 20:42:57 +0000 (04:42 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 11 May 2023 07:26:38 +0000 (07:26 +0000)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4144

This Library provides functions consuming MIPI SYS-T submodule.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Guo Gua <gua.guo@intel.com>
Cc: Chan Laura <laura.chan@intel.com>
Cc: Prakashan Krishnadas Veliyathuparambil <krishnadas.veliyathuparambil.prakashan@intel.com>
Cc: K N Karthik <karthik.k.n@intel.com>
Signed-off-by: Guo Gua <gua.guo@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: K N Karthik <karthik.k.n@intel.com>
Reviewed-by: Chan Laura <laura.chan@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
MdePkg/Include/Library/MipiSysTLib.h [new file with mode: 0644]
MdePkg/Library/MipiSysTLib/GenMipiSystH.py [new file with mode: 0644]
MdePkg/Library/MipiSysTLib/MipiSysTLib.c [new file with mode: 0644]
MdePkg/Library/MipiSysTLib/MipiSysTLib.inf [new file with mode: 0644]
MdePkg/Library/MipiSysTLib/Platform.c [new file with mode: 0644]
MdePkg/Library/MipiSysTLib/Platform.h [new file with mode: 0644]
MdePkg/Library/MipiSysTLib/Readme.md [new file with mode: 0644]
MdePkg/Library/MipiSysTLib/mipi_syst.h [new file with mode: 0644]
MdePkg/MdePkg.ci.yaml
MdePkg/MdePkg.dec
MdePkg/MdePkg.dsc

diff --git a/MdePkg/Include/Library/MipiSysTLib.h b/MdePkg/Include/Library/MipiSysTLib.h
new file mode 100644 (file)
index 0000000..4ced1c0
--- /dev/null
@@ -0,0 +1,66 @@
+/** @file\r
+This header file declares functions consuming MIPI Sys-T submodule.\r
+\r
+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>\r
+\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef MIPI_SYST_LIB_H_\r
+#define MIPI_SYST_LIB_H_\r
+\r
+/**\r
+  Invoke initialization function in Mipi Sys-T module to initialize Mipi Sys-T handle.\r
+\r
+  @param[in, out]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+\r
+  @retval RETURN_SUCCESS      MIPI_SYST_HANDLE instance was initialized.\r
+  @retval Other               MIPI_SYST_HANDLE instance was not initialized.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+InitMipiSystHandle (\r
+  IN OUT VOID  *MipiSystHandle\r
+  );\r
+\r
+/**\r
+  Invoke write_debug_string function in Mipi Sys-T module.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Severity        Severity type of input message.\r
+  @param[in]  Len             Length of data buffer.\r
+  @param[in]  Str             A pointer to data buffer.\r
+\r
+  @retval RETURN_SUCCESS               Data in buffer was processed.\r
+  @retval RETURN_ABORTED               No data need to be written to Trace Hub.\r
+  @retval RETURN_INVALID_PARAMETER     On entry, MipiSystHandle or Str is a NULL pointer.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+MipiSystWriteDebug (\r
+  IN        VOID    *MipiSystHandle,\r
+  IN        UINT32  Severity,\r
+  IN        UINT16  Len,\r
+  IN CONST  CHAR8   *Str\r
+  );\r
+\r
+/**\r
+  Invoke catalog_write_message function in Mipi Sys-T module.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Severity        Severity type of input message.\r
+  @param[in]  CatId           Catalog Id.\r
+\r
+  @retval RETURN_SUCCESS               Data in buffer was processed.\r
+  @retval RETURN_INVALID_PARAMETER     On entry, MipiSystHandle is a NULL pointer.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+MipiSystWriteCatalog (\r
+  IN  VOID    *MipiSystHandle,\r
+  IN  UINT32  Severity,\r
+  IN  UINT64  CatId\r
+  );\r
+\r
+#endif // MIPI_SYST_LIB_H_\r
diff --git a/MdePkg/Library/MipiSysTLib/GenMipiSystH.py b/MdePkg/Library/MipiSysTLib/GenMipiSystH.py
new file mode 100644 (file)
index 0000000..ee48285
--- /dev/null
@@ -0,0 +1,132 @@
+## @file\r
+#  This python script update content from mipi_syst.h.in in mipi sys-T submodule\r
+#  and generate it as mipi_syst.h. mipi_syst.h include necessary data structure and\r
+#  definition that will be consumed by MipiSysTLib itself, mipi sys-T submodule\r
+#  and other library.\r
+#\r
+#  This script needs to be done once by a developer when adding some\r
+#  project-relating definition or a new version of mipi_syst.h.in is released.\r
+#  Normal users do not need to do this, since the resulting file is stored\r
+#  in the EDK2 git repository.\r
+#\r
+#  Customize structures mentioned below to generate updated mipi_syst.h file:\r
+#  1. ExistingValueToBeReplaced\r
+#       -> To replace existing value in mipi_syst.h.in to newer one.\r
+#  2. ExistingDefinitionToBeRemoved\r
+#       -> To #undef a existing definition in mipi_syst.h.in.\r
+#  3. NewItemToBeAdded\r
+#       -> Items in this structure will be placed at the end of mipi_syst.h as a customized section.\r
+#\r
+#  Run GenMipiSystH.py without any parameters as normal python script after customizing.\r
+#\r
+#  Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>\r
+#\r
+#  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+import os\r
+import re\r
+\r
+#\r
+# A existing value to be customized should place this structure\r
+# Definitions in this customizable structure will be processed by ReplaceOldValue()\r
+# e.g:\r
+#   Before: @SYST_CFG_VERSION_MAJOR@\r
+#   After: 1\r
+#\r
+ExistingValueToBeReplaced = [\r
+    ["@SYST_CFG_VERSION_MAJOR@", "1"],      # Major version\r
+    ["@SYST_CFG_VERSION_MINOR@", "0"],      # Minor version\r
+    ["@SYST_CFG_VERSION_PATCH@", "0"],      # Patch version\r
+    ["@SYST_CFG_CONFORMANCE_LEVEL@", "30"], # Feature level of mipi sys-T submodule\r
+    ["mipi_syst/platform.h", "Platform.h"],\r
+]\r
+\r
+#\r
+# A existing definition to be removed should place this structure\r
+# Definitions in this customizable structure will be processed by RemoveDefinition()\r
+# e.g:\r
+#   Before:\r
+#       #define MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA\r
+#   After:\r
+#       #define MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA\r
+#       #undef MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA\r
+#\r
+ExistingDefinitionToBeRemoved = [\r
+    "MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA",\r
+    "MIPI_SYST_PCFG_ENABLE_HEAP_MEMORY",\r
+    "MIPI_SYST_PCFG_ENABLE_PRINTF_API",\r
+    "MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD",\r
+    "MIPI_SYST_PCFG_ENABLE_LOCATION_ADDRESS",\r
+]\r
+\r
+#\r
+# Items in this structure will be placed at the end of mipi_syst.h as a customized section.\r
+#\r
+NewItemToBeAdded = [\r
+    "typedef struct mipi_syst_handle_flags MIPI_SYST_HANDLE_FLAGS;",\r
+    "typedef struct mipi_syst_msg_tag MIPI_SYST_MSG_TAG;",\r
+    "typedef struct mipi_syst_guid MIPI_SYST_GUID;",\r
+    "typedef enum mipi_syst_severity MIPI_SYST_SEVERITY;",\r
+    "typedef struct mipi_syst_handle MIPI_SYST_HANDLE;",\r
+    "typedef struct mipi_syst_header MIPI_SYST_HEADER;",\r
+]\r
+\r
+def ProcessSpecialCharacter(Str):\r
+    Str = Str.rstrip(" \n")\r
+    Str = Str.replace("\t", "  ")\r
+    Str += "\n"\r
+    return Str\r
+\r
+def ReplaceOldValue(Str):\r
+    for i in range(len(ExistingValueToBeReplaced)):\r
+        Result = re.search(ExistingValueToBeReplaced[i][0], Str)\r
+        if Result is not None:\r
+            Str = Str.replace(ExistingValueToBeReplaced[i][0], ExistingValueToBeReplaced[i][1])\r
+            break\r
+    return Str\r
+\r
+def RemoveDefinition(Str):\r
+    Result = re.search("\*", Str)\r
+    if Result is None:\r
+        for i in range(len(ExistingDefinitionToBeRemoved)):\r
+            Result = re.search(ExistingDefinitionToBeRemoved[i], Str)\r
+            if Result is not None:\r
+                Result = re.search("defined", Str)\r
+                if Result is None:\r
+                    Str = Str + "#undef " + ExistingDefinitionToBeRemoved[i]\r
+                    break\r
+    return Str\r
+\r
+def main():\r
+    MipiSystHSrcDir = "mipisyst/library/include/mipi_syst.h.in"\r
+    MipiSystHRealSrcDir = os.path.join(os.getcwd(), os.path.normpath(MipiSystHSrcDir))\r
+    MipiSystHRealDstDir = os.path.join(os.getcwd(), "mipi_syst.h")\r
+\r
+    #\r
+    # Read content from mipi_syst.h.in and process each line by demand\r
+    #\r
+    with open(MipiSystHRealSrcDir, "r") as rfObj:\r
+        SrcFile = rfObj.readlines()\r
+        for lineIndex in range(len(SrcFile)):\r
+            SrcFile[lineIndex] = ProcessSpecialCharacter(SrcFile[lineIndex])\r
+            SrcFile[lineIndex] = ReplaceOldValue(SrcFile[lineIndex])\r
+            SrcFile[lineIndex] = RemoveDefinition(SrcFile[lineIndex])\r
+\r
+    #\r
+    # Typedef a structure or enum type\r
+    #\r
+    i = -1\r
+    for struct in NewItemToBeAdded:\r
+        struct += "\n"\r
+        SrcFile.insert(i, struct)\r
+        i -= 1\r
+\r
+    #\r
+    # Save edited content to mipi_syst.h\r
+    #\r
+    with open(MipiSystHRealDstDir, "w") as wfObj:\r
+        wfObj.writelines(SrcFile)\r
+\r
+if __name__ == '__main__':\r
+    main()\r
diff --git a/MdePkg/Library/MipiSysTLib/MipiSysTLib.c b/MdePkg/Library/MipiSysTLib/MipiSysTLib.c
new file mode 100644 (file)
index 0000000..3a15a2a
--- /dev/null
@@ -0,0 +1,123 @@
+/** @file\r
+This file provide functions to communicate with mipi sys-T submodule.\r
+\r
+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>\r
+\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <Base.h>\r
+#include "mipi_syst.h"\r
+\r
+/**\r
+  Invoke initialization function in Mipi Sys-T module to initialize Mipi Sys-T handle.\r
+\r
+  @param[in, out]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+\r
+  @retval RETURN_SUCCESS      MIPI_SYST_HANDLE instance was initialized.\r
+  @retval Other               MIPI_SYST_HANDLE instance was not initialized.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+InitMipiSystHandle (\r
+  IN OUT VOID  *MipiSystHandle\r
+  )\r
+{\r
+  MIPI_SYST_HANDLE  *MipiSystH;\r
+\r
+  MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;\r
+  if (MipiSystH == NULL) {\r
+    return RETURN_INVALID_PARAMETER;\r
+  }\r
+\r
+  mipi_syst_init (MipiSystH->systh_header, 0, NULL);\r
+\r
+  return RETURN_SUCCESS;\r
+}\r
+\r
+/**\r
+  Invoke write_debug_string function in Mipi Sys-T module.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Severity        Severity type of input message.\r
+  @param[in]  Len             Length of data buffer.\r
+  @param[in]  Str             A pointer to data buffer.\r
+\r
+  @retval RETURN_SUCCESS               Data in buffer was processed.\r
+  @retval RETURN_ABORTED               No data need to be written to Trace Hub.\r
+  @retval RETURN_INVALID_PARAMETER     On entry, MipiSystHandle or Str is a NULL pointer.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+MipiSystWriteDebug (\r
+  IN        MIPI_SYST_HANDLE  *MipiSystHandle,\r
+  IN        UINT32            Severity,\r
+  IN        UINT16            Len,\r
+  IN CONST  CHAR8             *Str\r
+  )\r
+{\r
+  MIPI_SYST_HANDLE  *MipiSystH;\r
+\r
+  MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;\r
+  if (MipiSystH == NULL) {\r
+    return RETURN_INVALID_PARAMETER;\r
+  }\r
+\r
+  if (Len == 0) {\r
+    //\r
+    // No data need to be written to Trace Hub\r
+    //\r
+    return RETURN_ABORTED;\r
+  }\r
+\r
+  if (Str == NULL) {\r
+    return RETURN_INVALID_PARAMETER;\r
+  }\r
+\r
+  mipi_syst_write_debug_string (\r
+    MipiSystH,\r
+    MIPI_SYST_NOLOCATION,\r
+    MIPI_SYST_STRING_GENERIC,\r
+    Severity,\r
+    Len,\r
+    Str\r
+    );\r
+\r
+  return RETURN_SUCCESS;\r
+}\r
+\r
+/**\r
+  Invoke catalog_write_message function in Mipi Sys-T module.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Severity        Severity type of input message.\r
+  @param[in]  CatId           Catalog Id.\r
+\r
+  @retval RETURN_SUCCESS               Data in buffer was processed.\r
+  @retval RETURN_INVALID_PARAMETER     On entry, MipiSystHandle is a NULL pointer.\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+MipiSystWriteCatalog (\r
+  IN  MIPI_SYST_HANDLE  *MipiSystHandle,\r
+  IN  UINT32            Severity,\r
+  IN  UINT64            CatId\r
+  )\r
+{\r
+  MIPI_SYST_HANDLE  *MipiSystH;\r
+\r
+  MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;\r
+  if (MipiSystH == NULL) {\r
+    return RETURN_INVALID_PARAMETER;\r
+  }\r
+\r
+  mipi_syst_write_catalog64_message (\r
+    MipiSystH,\r
+    MIPI_SYST_NOLOCATION,\r
+    Severity,\r
+    CatId\r
+    );\r
+\r
+  return RETURN_SUCCESS;\r
+}\r
diff --git a/MdePkg/Library/MipiSysTLib/MipiSysTLib.inf b/MdePkg/Library/MipiSysTLib/MipiSysTLib.inf
new file mode 100644 (file)
index 0000000..f2e7215
--- /dev/null
@@ -0,0 +1,52 @@
+## @file\r
+#  A library providing funcitons to communicate with mipi sys-T submodule.\r
+#\r
+#  Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>\r
+#\r
+#  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = MipiSysTLib\r
+  FILE_GUID                      = A58B0510-9E6D-4747-95D8-E5B8AF4633E6\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = MipiSysTLib\r
+\r
+  DEFINE MIPI_HEADER_PATH        = mipisyst/library/include/mipi_syst\r
+  DEFINE MIPI_SOURCE_PATH        = mipisyst/library/src\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64\r
+#\r
+\r
+[LibraryClasses]\r
+  IoLib\r
+  BaseMemoryLib\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+\r
+[Sources]\r
+  MipiSysTLib.c\r
+  mipi_syst.h\r
+  Platform.c\r
+  Platform.h\r
+  $(MIPI_HEADER_PATH)/api.h\r
+  $(MIPI_HEADER_PATH)/crc32.h\r
+  $(MIPI_HEADER_PATH)/compiler.h\r
+  $(MIPI_HEADER_PATH)/message.h\r
+  $(MIPI_HEADER_PATH)/inline.h\r
+  $(MIPI_SOURCE_PATH)/mipi_syst_init.c\r
+  $(MIPI_SOURCE_PATH)/mipi_syst_api.c\r
+  $(MIPI_SOURCE_PATH)/mipi_syst_crc32.c\r
+  $(MIPI_SOURCE_PATH)/mipi_syst_writer.c\r
+  $(MIPI_SOURCE_PATH)/mipi_syst_inline.c\r
+  $(MIPI_SOURCE_PATH)/mipi_syst_compiler.c\r
+\r
+[BuildOptions]\r
+  *_*_*_CC_FLAGS  = -DMIPI_SYST_STATIC\r
diff --git a/MdePkg/Library/MipiSysTLib/Platform.c b/MdePkg/Library/MipiSysTLib/Platform.c
new file mode 100644 (file)
index 0000000..90a524b
--- /dev/null
@@ -0,0 +1,164 @@
+/** @file\r
+This file defines functions that output Trace Hub message.\r
+\r
+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>\r
+\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <Base.h>\r
+#include <Library/IoLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include "mipi_syst.h"\r
+\r
+/**\r
+  Write 4 bytes to Trace Hub MMIO addr + 0x10.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Data            Data to be written.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteD32Ts (\r
+  IN  VOID    *MipiSystHandle,\r
+  IN  UINT32  Data\r
+  )\r
+{\r
+  MIPI_SYST_HANDLE  *MipiSystH;\r
+\r
+  MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;\r
+  MmioWrite32 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x10), Data);\r
+}\r
+\r
+/**\r
+  Write 4 bytes to Trace Hub MMIO addr + 0x18.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Data            Data to be written.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteD32Mts (\r
+  IN  VOID    *MipiSystHandle,\r
+  IN  UINT32  Data\r
+  )\r
+{\r
+  MIPI_SYST_HANDLE  *MipiSystH;\r
+\r
+  MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;\r
+  MmioWrite32 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x18), Data);\r
+}\r
+\r
+/**\r
+  Write 8 bytes to Trace Hub MMIO addr + 0x18.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Data            Data to be written.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteD64Mts (\r
+  IN  VOID    *MipiSystHandle,\r
+  IN  UINT64  Data\r
+  )\r
+{\r
+  MIPI_SYST_HANDLE  *MipiSystH;\r
+\r
+  MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;\r
+  MmioWrite64 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x18), Data);\r
+}\r
+\r
+/**\r
+  Write 1 byte to Trace Hub MMIO addr + 0x0.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Data            Data to be written.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteD8 (\r
+  IN  VOID   *MipiSystHandle,\r
+  IN  UINT8  Data\r
+  )\r
+{\r
+  MIPI_SYST_HANDLE  *MipiSystH;\r
+\r
+  MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;\r
+  MmioWrite8 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x0), Data);\r
+}\r
+\r
+/**\r
+  Write 2 bytes to Trace Hub MMIO mmio addr + 0x0.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Data            Data to be written.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteD16 (\r
+  IN  VOID    *MipiSystHandle,\r
+  IN  UINT16  Data\r
+  )\r
+{\r
+  MIPI_SYST_HANDLE  *MipiSystH;\r
+\r
+  MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;\r
+  MmioWrite16 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x0), Data);\r
+}\r
+\r
+/**\r
+  Write 4 bytes to Trace Hub MMIO addr + 0x0.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Data            Data to be written.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteD32 (\r
+  IN  VOID    *MipiSystHandle,\r
+  IN  UINT32  Data\r
+  )\r
+{\r
+  MIPI_SYST_HANDLE  *MipiSystH;\r
+\r
+  MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;\r
+  MmioWrite32 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x0), Data);\r
+}\r
+\r
+/**\r
+  Write 8 bytes to Trace Hub MMIO addr + 0x0.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Data            Data to be written.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteD64 (\r
+  IN  VOID    *MipiSystHandle,\r
+  IN  UINT64  Data\r
+  )\r
+{\r
+  MIPI_SYST_HANDLE  *MipiSystH;\r
+\r
+  MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;\r
+  MmioWrite64 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x0), Data);\r
+}\r
+\r
+/**\r
+  Clear data in Trace Hub MMIO addr + 0x30.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteFlag (\r
+  IN  VOID  *MipiSystHandle\r
+  )\r
+{\r
+  MIPI_SYST_HANDLE  *MipiSystH;\r
+\r
+  MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle;\r
+\r
+  MmioWrite32 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x30), 0x0);\r
+}\r
diff --git a/MdePkg/Library/MipiSysTLib/Platform.h b/MdePkg/Library/MipiSysTLib/Platform.h
new file mode 100644 (file)
index 0000000..ac77edf
--- /dev/null
@@ -0,0 +1,138 @@
+/** @file\r
+This header file declares functions and structures.\r
+\r
+Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>\r
+\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#ifndef MIPI_SYST_PLATFORM_H_\r
+#define MIPI_SYST_PLATFORM_H_\r
+\r
+typedef struct {\r
+  UINT64    MmioAddr;\r
+} TRACE_HUB_PLATFORM_SYST_DATA;\r
+\r
+struct mipi_syst_platform_handle {\r
+  TRACE_HUB_PLATFORM_SYST_DATA    TraceHubPlatformData;\r
+};\r
+\r
+/**\r
+  Write 4 bytes to Trace Hub MMIO addr + 0x10.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Data            Data to be written.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteD32Ts (\r
+  IN  VOID    *MipiSystHandle,\r
+  IN  UINT32  Data\r
+  );\r
+\r
+/**\r
+  Write 4 bytes to Trace Hub MMIO addr + 0x18.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Data            Data to be written.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteD32Mts (\r
+  IN  VOID    *MipiSystHandle,\r
+  IN  UINT32  Data\r
+  );\r
+\r
+/**\r
+  Write 8 bytes to Trace Hub MMIO addr + 0x18.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Data            Data to be written.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteD64Mts (\r
+  IN  VOID    *MipiSystHandle,\r
+  IN  UINT64  Data\r
+  );\r
+\r
+/**\r
+  Write 1 byte to Trace Hub MMIO addr + 0x0.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Data            Data to be written.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteD8 (\r
+  IN  VOID   *MipiSystHandle,\r
+  IN  UINT8  Data\r
+  );\r
+\r
+/**\r
+  Write 2 bytes to Trace Hub MMIO mmio addr + 0x0.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Data            Data to be written.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteD16 (\r
+  IN  VOID    *MipiSystHandle,\r
+  IN  UINT16  Data\r
+  );\r
+\r
+/**\r
+  Write 4 bytes to Trace Hub MMIO addr + 0x0.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Data            Data to be written.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteD32 (\r
+  IN  VOID    *MipiSystHandle,\r
+  IN  UINT32  Data\r
+  );\r
+\r
+/**\r
+  Write 8 bytes to Trace Hub MMIO addr + 0x0.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+  @param[in]  Data            Data to be written.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteD64 (\r
+  IN  VOID    *MipiSystHandle,\r
+  IN  UINT64  Data\r
+  );\r
+\r
+/**\r
+  Clear data in Trace Hub MMIO addr + 0x30.\r
+\r
+  @param[in]  MipiSystHandle  A pointer to MIPI_SYST_HANDLE structure.\r
+**/\r
+VOID\r
+EFIAPI\r
+MipiSystWriteFlag (\r
+  IN  VOID  *MipiSystHandle\r
+  );\r
+\r
+#define MIPI_SYST_PLATFORM_CLOCK()  1000 // (unit: MicroSecond)\r
+\r
+#ifndef MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA\r
+#define MIPI_SYST_OUTPUT_D32TS(MipiSystHandle, Data)   MipiSystWriteD32Ts ((MipiSystHandle), (Data))\r
+#define MIPI_SYST_OUTPUT_D32MTS(MipiSystHandle, Data)  MipiSystWriteD32Mts ((MipiSystHandle), (Data))\r
+#define MIPI_SYST_OUTPUT_D64MTS(MipiSystHandle, Data)  MipiSystWriteD64Mts ((MipiSystHandle), (Data))\r
+#define MIPI_SYST_OUTPUT_D8(MipiSystHandle, Data)      MipiSystWriteD8 ((MipiSystHandle), (Data))\r
+#define MIPI_SYST_OUTPUT_D16(MipiSystHandle, Data)     MipiSystWriteD16 ((MipiSystHandle), (Data))\r
+#define MIPI_SYST_OUTPUT_D32(MipiSystHandle, Data)     MipiSystWriteD32 ((MipiSystHandle), (Data))\r
+  #if defined (MIPI_SYST_PCFG_ENABLE_64BIT_IO)\r
+#define MIPI_SYST_OUTPUT_D64(MipiSystHandle, Data)  MipiSystWriteD64 ((MipiSystHandle), (Data))\r
+  #endif\r
+#define MIPI_SYST_OUTPUT_FLAG(MipiSystHandle)  MipiSystWriteFlag ((MipiSystHandle))\r
+#endif\r
+\r
+#endif // MIPI_SYST_PLATFORM_H_\r
diff --git a/MdePkg/Library/MipiSysTLib/Readme.md b/MdePkg/Library/MipiSysTLib/Readme.md
new file mode 100644 (file)
index 0000000..2e5df01
--- /dev/null
@@ -0,0 +1,25 @@
+## Introduction of MipiSysTLib ##\r
+MipiSysTLib library is a upper level library consuming MIPI SYS-T submodule.\r
+It provides MIPI-related APIs in EDK2 format to be consumed.\r
+\r
+## MipiSysTLib Version ##\r
+EDK2 supports building with v1.1+edk2 official version which was fully validated.\r
+\r
+## HOW to Install MipiSysTLib for UEFI Building ##\r
+MIPI SYS-T repository was added as a submodule of EDK2 project. Please\r
+refer to edk2/Readme.md for how to clone the code.\r
+\r
+## About GenMipiSystH.py ##\r
+"GenMipiSystH.py" is a Python script which is used for customizing the\r
+mipi_syst.h.in in mipi sys-T repository. The resulting file, mipi_syst.h, will\r
+be put to same folder level as this script.\r
+```\r
+  mipisyst submodule                        MipiSysTLib library\r
+|---------------------| GenMipiSystH.py   |---------------------|\r
+|   mipi_syst.h.in    |-----------------> |   mipi_syst.h       |\r
+|---------------------|                   |---------------------|\r
+```\r
+This script needs to be done once by a developer when adding some\r
+project-related definition or a new version of mipi_syst.h.in was released.\r
+Normal users do not need to do this, since the resulting file is stored\r
+in the EDK2 git repository.\r
diff --git a/MdePkg/Library/MipiSysTLib/mipi_syst.h b/MdePkg/Library/MipiSysTLib/mipi_syst.h
new file mode 100644 (file)
index 0000000..3cf67a1
--- /dev/null
@@ -0,0 +1,789 @@
+/*\r
+Copyright (c) 2018, MIPI Alliance, Inc.\r
+All rights reserved.\r
+\r
+Redistribution and use in source and binary forms, with or without\r
+modification, are permitted provided that the following conditions\r
+are met:\r
+\r
+* Redistributions of source code must retain the above copyright\r
+  notice, this list of conditions and the following disclaimer.\r
+\r
+* Redistributions in binary form must reproduce the above copyright\r
+  notice, this list of conditions and the following disclaimer in\r
+  the documentation and/or other materials provided with the\r
+  distribution.\r
+\r
+* Neither the name of the copyright holder nor the names of its\r
+  contributors may be used to endorse or promote products derived\r
+  from this software without specific prior written permission.\r
+\r
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\r
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\r
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+*/\r
+\r
+/*\r
+ * Contributors:\r
+ * Norbert Schulz (Intel Corporation) - Initial API and implementation\r
+ */\r
+\r
+#ifndef MIPI_SYST_H_INCLUDED\r
+#define MIPI_SYST_H_INCLUDED\r
+\r
+/* SyS-T API version information\r
+ */\r
+#define MIPI_SYST_VERSION_MAJOR 1   /**< Major version, incremented if API changes */\r
+#define MIPI_SYST_VERSION_MINOR 0   /**< Minor version, incremented on compatible extensions */\r
+#define MIPI_SYST_VERSION_PATCH 0   /**< Patch for existing major, minor, usually 0 */\r
+\r
+/** Define SyS-T API conformance level\r
+ *\r
+ * 10 = minimal (only short events)\r
+ * 20 = low overhead  (exluding varag functions and CRC32)\r
+ * 30 = full implementation\r
+ */\r
+#define MIPI_SYST_CONFORMANCE_LEVEL 30\r
+\r
+/** Compute SYS-T version value\r
+ *\r
+ * Used to compare SYS-T Major.Minor.patch versions numerically at runtime.\r
+ *\r
+ * @param ma major version number\r
+ * @param mi minor version number\r
+ * @param p patch version number\r
+ *\r
+ * Example:\r
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}\r
+ *\r
+ * #if  MIPI_SYST_VERSION_CODE >= MIPI_SYST_MAKE_VERSION_CODE(1,5,0)\r
+ *     // do what only >= 1.5.x supports\r
+ * #endif\r
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+ */\r
+#define MIPI_SYST_MAKE_VERSION_CODE(ma, mi, p) (((ma) << 16) | ((mi)<<8) | (p))\r
+\r
+/** Numeric SYS-T version code */\r
+#define MIPI_SYST_VERSION_CODE MIPI_SYST_MAKE_VERSION_CODE(\\r
+  MIPI_SYST_VERSION_MAJOR,\\r
+  MIPI_SYST_VERSION_MINOR,\\r
+  MIPI_SYST_VERSION_PATCH)\r
+\r
+/* Macros to trick numeric values like __LINE__ into a string\r
+ */\r
+#define _MIPI_SYST_STRINGIFY(x) #x\r
+#define _MIPI_SYST_CPP_TOSTR(x) _MIPI_SYST_STRINGIFY(x)\r
+\r
+#define _MIPI_SYST_VERSION_STRING(a, b, c)\\r
+  _MIPI_SYST_CPP_TOSTR(a)"."_MIPI_SYST_CPP_TOSTR(b)"."_MIPI_SYST_CPP_TOSTR(c)\r
+\r
+/** Textual version string */\r
+#define MIPI_SYST_VERSION_STRING \\r
+  _MIPI_SYST_VERSION_STRING(\\r
+    MIPI_SYST_VERSION_MAJOR,\\r
+    MIPI_SYST_VERSION_MINOR,\\r
+    MIPI_SYST_VERSION_PATCH)\r
+\r
+#ifndef MIPI_SYST_COMPILER_INCLUDED\r
+#include "mipi_syst/compiler.h"\r
+#endif\r
+\r
+/* String hash macros for compile time computation of catalog ID's.\r
+ * Notes:\r
+ *    These macros will only be used with optimized builds, otherwise\r
+ *    a lot of runtime code will be generated.\r
+ *\r
+ *    Only the last 64 bytes of the string are considered for hashing\r
+ */\r
+#define _MIPI_SYST_HASH1(s,i,x,l)  (x*65599u+(mipi_syst_u8)s[(i)<(l)?((l)-1-(i)):(l)])\r
+#define _MIPI_SYST_HASH4(s,i,x,l)  _MIPI_SYST_HASH1(s,i,_MIPI_SYST_HASH1(s,i+1,_MIPI_SYST_HASH1(s,i+2,_MIPI_SYST_HASH1(s,i+3,x,l),l),l),l)\r
+#define _MIPI_SYST_HASH16(s,i,x,l) _MIPI_SYST_HASH4(s,i,_MIPI_SYST_HASH4(s,i+4,_MIPI_SYST_HASH4(s,i+8,_MIPI_SYST_HASH4(s,i+12,x,l),l),l),l)\r
+#define _MIPI_SYST_HASH64(s,i,x,l) _MIPI_SYST_HASH16(s,i,_MIPI_SYST_HASH16(s,i+16,_MIPI_SYST_HASH16(s,i+32,_MIPI_SYST_HASH16(s,i+48,x,l),l),l),l)\r
+\r
+#define _MIPI_SYST_HASH_x65599(s,l) ((mipi_syst_u32)_MIPI_SYST_HASH64(s,0,0,l))\r
+\r
+#define _MIPI_SYST_HASH_AT_CPP_TIME(str, offset) (_MIPI_SYST_HASH_x65599(str, sizeof(str)-1) + (offset))\r
+#define _MIPI_SYST_HASH_AT_RUN_TIME(str, offset) (mipi_syst_hash_x65599(str, sizeof(str)-1) + (offset))\r
+\r
+#if defined(_MIPI_SYST_OPTIMIZER_ON)\r
+#define MIPI_SYST_HASH(a, b) _MIPI_SYST_HASH_AT_CPP_TIME((a), (b))\r
+#else\r
+#define MIPI_SYST_HASH(a, b) _MIPI_SYST_HASH_AT_RUN_TIME((a),(b))\r
+#endif\r
+\r
+#if defined(__cplusplus)\r
+extern "C" {\r
+#endif\r
+\r
+/** Major Message Types\r
+ */\r
+enum mipi_syst_msgtype {\r
+  MIPI_SYST_TYPE_BUILD = 0,          /**< client build id message   */\r
+  MIPI_SYST_TYPE_SHORT32 = 1,        /**< value only message        */\r
+  MIPI_SYST_TYPE_STRING = 2,         /**< text message output       */\r
+  MIPI_SYST_TYPE_CATALOG = 3,        /**< catalog message output    */\r
+  MIPI_SYST_TYPE_RAW = 6,            /**< raw binary data           */\r
+  MIPI_SYST_TYPE_SHORT64 = 7,        /**<  value only message       */\r
+  MIPI_SYST_TYPE_CLOCK = 8,          /**< clock sync message        */\r
+\r
+  MIPI_SYST_TYPE_MAX\r
+};\r
+\r
+/** MIPI_SYST_TYPE_DEBUG_STRING Sub-Types\r
+ */\r
+enum mipi_syst_subtype_string {\r
+  MIPI_SYST_STRING_GENERIC = 1,        /**< string generic debug         */\r
+  MIPI_SYST_STRING_FUNCTIONENTER = 2,  /**< string is function name      */\r
+  MIPI_SYST_STRING_FUNCTIONEXIT = 3,   /**< string is function name      */\r
+  MIPI_SYST_STRING_INVALIDPARAM = 5,   /**< invalid SyS-T APIcall        */\r
+  MIPI_SYST_STRING_ASSERT = 7,         /**< Software Assert: failure     */\r
+  MIPI_SYST_STRING_PRINTF_32 = 11,     /**< printf with 32-bit packing   */\r
+  MIPI_SYST_STRING_PRINTF_64 = 12,     /**< printf with 64-bit packing   */\r
+\r
+  MIPI_SYST_STRING_MAX\r
+};\r
+\r
+/** MIPI_SYST_TYPE_CATALOG Sub-Types\r
+ */\r
+enum mipi_syst_subtype_catalog {\r
+  MIPI_SYST_CATALOG_ID32_P32 = 1,   /**< 32-bit catalog ID, 32-bit packing */\r
+  MIPI_SYST_CATALOG_ID64_P32 = 2,   /**< 64-bit catalog ID, 32-bit packing */\r
+  MIPI_SYST_CATALOG_ID32_P64 = 5,   /**< 32-bit catalog ID, 64-bit packing */\r
+  MIPI_SYST_CATALOG_ID64_P64 = 6,   /**< 64-bit catalog ID, 64-bit packing */\r
+\r
+  MIPI_SYST_CATALOG_MAX\r
+};\r
+\r
+/** MIPI_SYST_TYPE_CLOCK Sub-Types\r
+ */\r
+enum mipi_syst_subtype_clock{\r
+  MIPI_SYST_CLOCK_TRANSPORT_SYNC   =  1,  /**< SyS-T clock & frequency sync  */\r
+  MIPI_SYST_CLOCK_MAX\r
+};\r
+\r
+enum mipi_syst_subtype_build {\r
+  MIPI_SYST_BUILD_ID_COMPACT32  = 0, /**< compact32  build id       */\r
+  MIPI_SYST_BUILD_ID_COMPACT64  = 1, /**< compact64  build id       */\r
+  MIPI_SYST_BUILD_ID_LONG       = 2, /**< normal build  message     */\r
+  MIPI_SYST_BUILD_MAX\r
+};\r
+\r
+struct mipi_syst_header;\r
+struct mipi_syst_handle;\r
+struct mipi_syst_scatter_prog;\r
+\r
+/** 128-bit GUID style message origin ID */\r
+struct mipi_syst_guid {\r
+  union {\r
+    mipi_syst_u8  b[16];\r
+    mipi_syst_u64 ll[2];\r
+  } u;\r
+};\r
+\r
+/** GUID initializer code\r
+ *\r
+ * This macro simplifies converting a GUID from its string representation\r
+ * into the mipi_syst_guid data structure. The following example shows\r
+ * how the values from a GUID string are used with the macro. Each numeric\r
+ * component from the GUID string gets converted into a hex value parameter\r
+ * when invoking the macro.\r
+ *\r
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}\r
+ *\r
+ *  // Guid: f614b99d-99a1-4c04-8c30-90999ab5fe05\r
+ *\r
+ *   struct mipi_syst_guid guid =\r
+ *      MIPI_SYST_GEN_GUID(0xf614b99d, 0x99a1, 0x4c04, 0x8c30, 0x90999ab5fe05);\r
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+ */\r
+#define MIPI_SYST_GEN_GUID(l1, w1, w2, w3, l2) \\r
+  {{\\r
+    (mipi_syst_u8)((mipi_syst_u32)(l1) >> 24), \\r
+    (mipi_syst_u8)((mipi_syst_u32)(l1) >> 16), \\r
+    (mipi_syst_u8)((mipi_syst_u32)(l1) >>  8), \\r
+    (mipi_syst_u8)((mipi_syst_u32)(l1) >>  0), \\r
+    (mipi_syst_u8)((mipi_syst_u16)(w1) >>  8), \\r
+    (mipi_syst_u8)((mipi_syst_u16)(w1) >>  0), \\r
+    (mipi_syst_u8)((mipi_syst_u16)(w2) >>  8), \\r
+    (mipi_syst_u8)((mipi_syst_u16)(w2) >>  0), \\r
+    (mipi_syst_u8)((mipi_syst_u16)(w3) >>  8), \\r
+    (mipi_syst_u8)((mipi_syst_u16)(w3) >>  0), \\r
+    (mipi_syst_u8)((mipi_syst_u64)(l2) >> 40), \\r
+    (mipi_syst_u8)((mipi_syst_u64)(l2) >> 32), \\r
+    (mipi_syst_u8)((mipi_syst_u64)(l2) >> 24), \\r
+    (mipi_syst_u8)((mipi_syst_u64)(l2) >> 16), \\r
+    (mipi_syst_u8)((mipi_syst_u64)(l2) >>  8), \\r
+    (mipi_syst_u8)((mipi_syst_u64)(l2) >>  0)  \\r
+  }}\r
+\r
+ /** SyS-T client origin data\r
+  *\r
+  * This structure holds the GUID or header origin and unit data\r
+  * used by SyS-T handles. The structure gets passed into the handle\r
+  * creation functions to initialize the values that identify clients.\r
+  * @see MIPI_SYST_SET_HANDLE_GUID_UNIT\r
+  * @see MIPI_SYST_SET_HANDLE_MODULE_UNIT\r
+  * @see MIPI_SYST_SET_HANDLE_ORIGIN\r
+  */\r
+struct mipi_syst_origin {\r
+  struct mipi_syst_guid  guid;    /**< origin GUID or module value */\r
+  mipi_syst_u16   unit;           /**< unit value                  */\r
+};\r
+\r
+/** Origin structure initializer code using GUID\r
+*\r
+* This macro simplifies initializing a mipi_syst_origin structure. The\r
+* first 5 parameters are GUID values as used by the MIPI_SYST_GEN_GUID\r
+* macro. The last parameter is the unit value (11-Bits).\r
+* @see MIPI_SYST_GEN_GUID\r
+*\r
+*\r
+* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}\r
+*\r
+*  // Guid: {494E5443-B659-45AF-B786-9DB0786248AE}\r
+\r
+*\r
+*   struct mipi_syst_origin = origin\r
+*      MIPI_SYST_GEN_ORIGIN_GUID(\r
+*        0x494E5443, 0xB659, 0x45AF, 0xB786, 0x9DB0786248AE,\r
+*        0x1);\r
+* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+*/\r
+#define MIPI_SYST_GEN_ORIGIN_GUID(l1, w1, w2, w3, l2 , u) \\r
+  {\\r
+    MIPI_SYST_GEN_GUID(l1, w1, w2, w3, l2) ,\\r
+    u\\r
+  }\r
+\r
+/** Origin structure initializer code using header module value\r
+*\r
+* This macro simplifies initializing a mipi_syst_origin structure. The\r
+* first parameter is the header origin value (7-Bits). The second parameter\r
+* is the unit value (4-bits)\r
+* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.c}\r
+*\r
+*  // Guid: {494E5443-B659-45AF-B786-9DB0786248AE}\r
+\r
+*   #define MODULE_X 0x10\r
+*   struct mipi_syst_origin =\r
+*      MIPI_SYST_GEN_ORIGIN_MODULE(MODULE_X, 0x1);\r
+* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r
+*/\r
+#define MIPI_SYST_GEN_ORIGIN_MODULE(m , u) \\r
+  {\\r
+    MIPI_SYST_GEN_GUID(0,0,0, ((mipi_syst_u16)(m & 0x7F)) << 8, 0 ),\\r
+    u\\r
+  }\r
+/**\r
+ * Global state initialization hook definition\r
+ *\r
+ * This function gets called in the context of the mipi_syst_init() API\r
+ * function after the generic state members of the global state\r
+ * structure syst_hdr have been setup. It's purpose is to initialize the\r
+ * platform dependent portion of the state and other necessary\r
+ * platform specific initialization steps.\r
+ *\r
+ * @param systh Pointer to global state structure\r
+ * @param p user defined value or pointer to data\r
+ * @see  mipi_syst_header\r
+ */\r
+typedef void (MIPI_SYST_CALLCONV *mipi_syst_inithook_t)(struct mipi_syst_header *systh,\r
+    const void *p);\r
+\r
+/**\r
+ * Global state destroy hook definition\r
+ *\r
+ * This function gets called in the context of the mipi_syst_destroy() API\r
+ * function before the generic state members of the global state\r
+ * structure syst_hdr have been destroyed. Its purpose is to free resources\r
+ * used by the platform dependent portion of the global state.\r
+ *\r
+ * @param systh Pointer to global state structure\r
+ */\r
+typedef void (MIPI_SYST_CALLCONV *mipi_syst_destroyhook_t)(struct mipi_syst_header *systh);\r
+\r
+/**\r
+ * SyS-T handle state initialization hook definition\r
+ *\r
+ * This function gets called in the context of IO handle generation.\r
+ * Its purpose is to initialize the platform dependent portion of\r
+*  the handle and other necessary platform specific initialization steps.\r
+ *\r
+ * @param systh Pointer to new SyS-T handle\r
+ * @see syst_handle_t\r
+ */\r
+typedef void (*mipi_syst_inithandle_hook_t)(struct mipi_syst_handle *systh);\r
+\r
+/**\r
+ * SyS-T handle state release hook definition\r
+ *\r
+ * This function gets called when a handle is about to be destroyed..\r
+ * Its purpose is to free any resources allocated during the handle\r
+ * generation.\r
+ *\r
+ * @param systh Pointer to handle that is destroyed\r
+ * @see syst_handle_t\r
+ */\r
+typedef void (*mipi_syst_releasehandle_hook_t)(struct mipi_syst_handle *systh);\r
+\r
+/**\r
+ * Low level message write routine definition\r
+ *\r
+ * This function is called at the end of an instrumentation API to output\r
+ * the raw message data.\r
+ *\r
+ * @param systh pointer to a SyS-T handle structure used in the API call,\r
+ * @param scatterprog pointer to a list of scatter write instructions that\r
+ *                    encodes how to convert the descriptor pointer by\r
+ *                    pdesc into raw binary data. This list doesn't include\r
+ *                    the mandatory first 32 tag byte value pointed by pdesc.\r
+ * @param pdesc pointer to a message descriptor, which containing at least\r
+ *              the 32-bit message tag data\r
+ */\r
+typedef void (*mipi_syst_msg_write_t)(\r
+    struct mipi_syst_handle *systh,\r
+    struct mipi_syst_scatter_prog *scatterprog,\r
+    const void *pdesc);\r
+\r
+#ifdef __cplusplus\r
+} /* extern C */\r
+#endif\r
+#ifndef MIPI_SYST_PLATFORM_INCLUDED\r
+\r
+/**\r
+ * @defgroup PCFG_Config  Platform Feature Configuration Defines\r
+ *\r
+ * Defines to customize the SyS-T feature set to match the platform needs.\r
+ *\r
+ * Each optional library feature can be disabled by not defining the related\r
+ * MIPI_SYST_PCFG_ENABLE define. Removing unused features in this way reduces\r
+ * both memory footprint and runtime overhead of SyS-T.\r
+ */\r
+\r
+/**\r
+ * @defgroup PCFG_Global Platform Wide Configuration\r
+ * @ingroup  PCFG_Config\r
+ *\r
+ * These defines enable global features in the SyS-T library.\r
+ * @{\r
+ */\r
+\r
+\r
+ /**\r
+ * Extend Platform global SyS-T data state\r
+ *\r
+ * This define extends the global SyS-T state data structure\r
+ * mipi_syst_header with platform private content. A platform typically\r
+ * stores data for SyS-T handle creation processing in this structure.\r
+ *\r
+ * Note: This data is not touched by the library code itself, but typically\r
+ * is used by platform  hook functions for handle creation and destruction.\r
+ * **These hook function calls are not lock protected and may happen\r
+ * concurrently!**  The hook functions need to implement locking if they\r
+ *  modify the platform state data.\r
+ *\r
+ * The platform example uses #mipi_syst_platform_state as data state extension.\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA\r
+#undef MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA\r
+/**\r
+ * Extend SyS-T handle data state\r
+ *\r
+ * This define extends the SyS-T handle state data structure\r
+ * mipi_syst_handle with platform private content. A platform typically\r
+ * stores data for fast trace hardware access in the handle data, for\r
+ * example a volatile pointer to an MMIO space.\r
+ *\r
+ * The platform example uses #mipi_syst_platform_handle as handle state\r
+ * extension.\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_PLATFORM_HANDLE_DATA\r
+\r
+/**\r
+ * Enable HEAP usage for handle generation\r
+ *\r
+ * This macro tells the SyS-T library to enable the heap allocation handle\r
+ * creation API #MIPI_SYST_ALLOC_HANDLE.\r
+ * The platform must provide the macros #MIPI_SYST_HEAP_MALLOC and\r
+ * #MIPI_SYST_HEAP_FREE to point SyS-T to the platform malloc and free\r
+ * functions.\r
+ *\r
+ * Note: In OS kernel space environments, you must use unpaged memory\r
+ * allocation functions.\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_HEAP_MEMORY\r
+#undef MIPI_SYST_PCFG_ENABLE_HEAP_MEMORY\r
+/* MSVC and GNU compiler 64-bit mode */\r
+\r
+/**\r
+ * Enable 64-bit instruction addresses\r
+ *\r
+ * Set this define if running in 64-bit code address space.\r
+ */\r
+#if defined(_WIN64) || defined(__x86_64__) || defined (__LP64__)\r
+#define MIPI_SYST_PCFG_ENABLE_64BIT_ADDR\r
+#endif\r
+/**\r
+ * Enable atomic 64-bit write operations\r
+ *\r
+ * Set this define if your platform supports an atomic 64-bit data write\r
+ * operation. This results in fewer MMIO accesses.The SyS-T library\r
+ * defaults to 2 consecutive 32-Bit writes otherwise.\r
+ */\r
+#if defined(_WIN64) || defined(__x86_64__) || defined (__LP64__)\r
+#define MIPI_SYST_PCFG_ENABLE_64BIT_IO\r
+#endif\r
+\r
+/**\r
+ * Enable helper function code inlining\r
+ *\r
+ * Set this define if speed is more important than code size on your platform.\r
+ * It causes several helper function to get inlined, producing faster, but\r
+ * also larger, code.\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_INLINE\r
+\r
+/** @} */\r
+\r
+/**\r
+ * @defgroup PCFG_ApiSet Supported API sets\r
+ * @ingroup  PCFG_Config\r
+ *\r
+ * These defines enable API sets in the SyS-T library. They are set by default\r
+ * depending on the SyS-T API conformance level. The level is specified using\r
+ * the define #MIPI_SYST_CONFORMANCE_LEVEL.\r
+ * @{\r
+ */\r
+\r
+#if MIPI_SYST_CONFORMANCE_LEVEL > 10\r
+ /**\r
+ * Use SyS-T scatter write output function\r
+ *\r
+ * The library comes with an output routine that is intended to write data out\r
+ * to an MMIO space. It simplifies a SyS-T platform integration as\r
+ * only low-level access macros must be provided for outputting data. These\r
+ * macros follow MIPI System Trace Protocol (STP) naming convention, also\r
+ * non STP generators can use this interface.\r
+ *\r
+ * These low level output macros are:\r
+ *\r
+ * #MIPI_SYST_OUTPUT_D32MTS, #MIPI_SYST_OUTPUT_D64MTS,\r
+ * #MIPI_SYST_OUTPUT_D32TS, #MIPI_SYST_OUTPUT_D64,\r
+ * #MIPI_SYST_OUTPUT_D32, #MIPI_SYST_OUTPUT_D16, #MIPI_SYST_OUTPUT_D8 and\r
+ * #MIPI_SYST_OUTPUT_FLAG\r
+ *\r
+ * Note: This version of the write function always starts messages\r
+ * using a 32-bit timestamped record also other sized timestamped\r
+ * packets are allowed by the SyS-T specification.\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_DEFAULT_SCATTER_WRITE\r
+\r
+/**\r
+ * Enable the Catalog API for 32-Bit Catalog IDs.\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_CATID32_API\r
+\r
+/**\r
+ * Enable the Catalog API for 64-Bit Catalog IDs.\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_CATID64_API\r
+\r
+/**\r
+ * Enable plain UTF-8 string output APIs.\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_STRING_API\r
+\r
+/**\r
+ * Enable raw data output APIs\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_WRITE_API\r
+\r
+/**\r
+ * Enable Build API\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_BUILD_API\r
+#endif /* MIPI_SYST_CONFORMANCE_LEVEL > 10 */\r
+\r
+#if  MIPI_SYST_CONFORMANCE_LEVEL > 20\r
+ /**\r
+ * Enable printf API support\r
+ *\r
+ * Note:\r
+ * Enabling printf requires compiler var_arg support as defined by the\r
+ * header files stdarg.h stddef.h.\r
+ */\r
+\r
+#define MIPI_SYST_PCFG_ENABLE_PRINTF_API\r
+#undef MIPI_SYST_PCFG_ENABLE_PRINTF_API\r
+/**\r
+ * Maximum size of printf payload in bytes.\r
+ * Adjust this value if larger strings shall be supported by the library.\r
+ * The buffer space is located in stack memory when calling one of the printf\r
+ * style APIs.\r
+ */\r
+#define MIPI_SYST_PCFG_PRINTF_ARGBUF_SIZE 1024\r
+\r
+#endif /* #if MIPI_SYST_CONFORMANCE_LEVEL > 20 */\r
+\r
+/* @} */\r
+\r
+/**\r
+ * @defgroup PCFG_Message Optional Message Attributes\r
+ * @ingroup  PCFG_Config\r
+ *\r
+ * These defines enable optional message components. They are set by default\r
+ * depending on the SyS-T API conformance level. The level is specified using\r
+ * the define #MIPI_SYST_CONFORMANCE_LEVEL.\r
+ * @{\r
+ */\r
+\r
+#if MIPI_SYST_CONFORMANCE_LEVEL > 10\r
+/**\r
+ * Enable 128-bit origin GUID support.\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_ORIGIN_GUID\r
+\r
+/**\r
+ * Enable the API variants that send file:line ID pair location records.\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD\r
+#undef MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD\r
+/**\r
+ * Enable the API variants that send the address of the instrumentation location.\r
+ *\r
+ * This API requires #MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD to be set as well.\r
+ * It uses its own define as it additionally requires the function\r
+ * @ref mipi_syst_return_addr() to be implemented for your platform.\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_LOCATION_ADDRESS\r
+#undef MIPI_SYST_PCFG_ENABLE_LOCATION_ADDRESS\r
+/**\r
+ * Enable protocol timestamp.\r
+ *\r
+ * This option adds a timestamp into the SyS-T protocol. This\r
+ * option is used if the SyS-T protocol is not embedded into a hardware\r
+ * timestamped trace protocol like MIPI STP or if the HW timestamp cannot\r
+ * be used for other reasons. Setting this option creates the need to define\r
+ * the macros #MIPI_SYST_PLATFORM_CLOCK and #MIPI_SYST_PLATFORM_FREQ to\r
+ *  return a 64-bit clock tick value and its frequency.\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_TIMESTAMP\r
+\r
+#if defined(_DOXYGEN_)  /*  only for doxygen, remove the #if to enable */\r
+ /**\r
+ * Enable generation of length field\r
+ *\r
+ * Set this define if the message data shall include the optional length\r
+ * field that indicates how many payload bytes follow.\r
+ */\r
+#define MIPI_SYST_PCFG_LENGTH_FIELD\r
+#endif\r
+\r
+#endif\r
+\r
+#if MIPI_SYST_CONFORMANCE_LEVEL > 20\r
+/**\r
+ * Enable message data CRC32 generation.\r
+ */\r
+#define MIPI_SYST_PCFG_ENABLE_CHECKSUM\r
+\r
+#endif /* #if MIPI_SYST_CONFORMANCE_LEVEL */\r
+\r
+/** @} */\r
+\r
+#include "Platform.h"\r
+#endif\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+#if defined(MIPI_SYST_PCFG_ENABLE_INLINE)\r
+#define MIPI_SYST_INLINE static MIPI_SYST_CC_INLINE\r
+#else\r
+#define MIPI_SYST_INLINE MIPI_SYST_EXPORT\r
+#endif\r
+\r
+/** SyS-T global state structure.\r
+ * This structure is holding the global SyS-T library state\r
+ */\r
+struct mipi_syst_header {\r
+  mipi_syst_u32 systh_version; /**< SyS-T version ID            */\r
+\r
+#if defined(MIPI_SYST_PCFG_ENABLE_PLATFORM_HANDLE_DATA)\r
+  mipi_syst_inithandle_hook_t systh_inith;       /**< handle init hook function*/\r
+  mipi_syst_releasehandle_hook_t systh_releaseh; /**< handle release hook      */\r
+#endif\r
+\r
+#if MIPI_SYST_CONFORMANCE_LEVEL > 10\r
+  mipi_syst_msg_write_t systh_writer;            /**< message output routine   */\r
+#endif\r
+#if defined(MIPI_SYST_PCFG_ENABLE_PLATFORM_STATE_DATA)\r
+  struct mipi_syst_platform_state systh_platform;\r
+  /**< platform specific state    */\r
+#endif\r
+};\r
+\r
+/**\r
+ * Message data header tag definition\r
+ *\r
+ * Each SyS-T message starts with a 32-bit message tag. The tag defines the\r
+ * message originator and decoding information for the data following\r
+ * the tag.\r
+ */\r
+\r
+struct mipi_syst_msg_tag {\r
+#if defined(MIPI_SYST_BIG_ENDIAN)\r
+  mipi_syst_u32 et_res31 : 1;    /**< reserved for future use        */\r
+  mipi_syst_u32 et_res30 : 1;    /**< reserved for future use        */\r
+  mipi_syst_u32 et_subtype : 6;  /**< type dependent sub category    */\r
+  mipi_syst_u32 et_guid : 1;     /**< 128-bit GUID present           */\r
+  mipi_syst_u32 et_modunit : 11; /**< unit for GUID or module:unit   */\r
+  mipi_syst_u32 et_timestamp : 1;/**< indicate 64-bit timestamp      */\r
+  mipi_syst_u32 et_chksum : 1;   /**< indicate 32-bit CRC            */\r
+  mipi_syst_u32 et_length : 1;   /**< indicate length field          */\r
+  mipi_syst_u32 et_location : 1; /**< indicate location information  */\r
+  mipi_syst_u32 et_res7 : 1;     /**< reserved for future use        */\r
+  mipi_syst_u32 et_severity : 3; /**< severity level of message      */\r
+  mipi_syst_u32 et_type : 4;     /**< SyS-T message type ID          */\r
+#else\r
+  mipi_syst_u32 et_type : 4;     /**< SyS-T message type ID          */\r
+  mipi_syst_u32 et_severity : 3; /**< severity level of message      */\r
+  mipi_syst_u32 et_res7 : 1;     /**< reserved for future use        */\r
+  mipi_syst_u32 et_location : 1; /**< indicate location information  */\r
+  mipi_syst_u32 et_length : 1;   /**< indicate length field          */\r
+  mipi_syst_u32 et_chksum : 1;   /**< indicate 32-bit CRC            */\r
+  mipi_syst_u32 et_timestamp : 1;/**< indicate 64-bit timestamp      */\r
+  mipi_syst_u32 et_modunit : 11; /**< unit for GUID or module:unit   */\r
+  mipi_syst_u32 et_guid : 1;     /**< 128-bit GUID present           */\r
+  mipi_syst_u32 et_subtype : 6;  /**< type dependent sub category    */\r
+  mipi_syst_u32 et_res30 : 1;    /**< reserved for future use        */\r
+  mipi_syst_u32 et_res31 : 1;    /**< reserved for future use        */\r
+#endif\r
+};\r
+#define _MIPI_SYST_MK_MODUNIT_ORIGIN(m,u) (((u) & 0xF)|(m<<4))\r
+\r
+/**\r
+ * Message severity level enumeration\r
+ */\r
+enum mipi_syst_severity {\r
+  MIPI_SYST_SEVERITY_MAX = 0,    /**< no assigned severity       */\r
+  MIPI_SYST_SEVERITY_FATAL = 1,  /**< critical error level       */\r
+  MIPI_SYST_SEVERITY_ERROR = 2,  /**< error message level        */\r
+  MIPI_SYST_SEVERITY_WARNING = 3,/**< warning message level      */\r
+  MIPI_SYST_SEVERITY_INFO = 4,   /**< information message level  */\r
+  MIPI_SYST_SEVERITY_USER1 = 5,  /**< user defined level 5       */\r
+  MIPI_SYST_SEVERITY_USER2 = 6,  /**< user defined level 6       */\r
+  MIPI_SYST_SEVERITY_DEBUG = 7   /**< debug information level    */\r
+};\r
+\r
+/**\r
+ * Location information inside a message (64-bit format)\r
+ * Location is either the source position of the instrumentation call, or\r
+ * the call instruction pointer value.\r
+ */\r
+union mipi_syst_msglocation32 {\r
+  struct {\r
+#if defined(MIPI_SYST_BIG_ENDIAN)\r
+    mipi_syst_u16 etls_lineNo; /**< line number in file       */\r
+    mipi_syst_u16 etls_fileID; /**< ID of instrumented file   */\r
+#else\r
+    mipi_syst_u16 etls_fileID; /**< ID of instrumented file   */\r
+    mipi_syst_u16 etls_lineNo; /**< line number in file       */\r
+#endif\r
+  } etls_source_location;\r
+\r
+  mipi_syst_u32 etls_code_location:32; /**< instruction pointer value */\r
+};\r
+\r
+/**\r
+ * Location information inside a message (32-bit format)\r
+ * Location is either the source position of the instrumentation call, or\r
+ * the call instruction pointer value.\r
+ */\r
+union mipi_syst_msglocation64 {\r
+  struct {\r
+#if defined(MIPI_SYST_BIG_ENDIAN)\r
+    mipi_syst_u32 etls_lineNo; /**< line number in file       */\r
+    mipi_syst_u32 etls_fileID; /**< ID of instrumented file   */\r
+#else\r
+    mipi_syst_u32 etls_fileID; /**< ID of instrumented file   */\r
+    mipi_syst_u32 etls_lineNo; /**< line number in file       */\r
+#endif\r
+  } etls_source_location;\r
+  mipi_syst_u64 etls_code_location; /**< instruction pointer value */\r
+};\r
+\r
+/**\r
+ * Location information record descriptor\r
+ */\r
+struct mipi_syst_msglocation {\r
+  /** Message format\r
+   * 0 = 16-Bit file and 16-Bit line (total: 32-bit)\r
+   * 1 = 32-Bit file and 32-Bit line (total: 64-bit)\r
+   * 2 = 32-bit code address\r
+   * 3 = 64-bit code address\r
+   */\r
+  mipi_syst_u8 el_format;\r
+  union {\r
+    union mipi_syst_msglocation32 loc32; /**< data for 32-bit variant  */\r
+    union mipi_syst_msglocation64 loc64; /**< data for 64-bit variant  */\r
+  } el_u;\r
+};\r
+\r
+/** internal handle state flags\r
+ */\r
+struct mipi_syst_handle_flags {\r
+  mipi_syst_u32 shf_alloc:1; /**< set to 1 if heap allocated handle */\r
+};\r
+\r
+/** SyS-T connection handle state structure\r
+ *\r
+ * This structure connects the instrumentation API with the underlying SyS-T\r
+ * infrastructure. It plays a similar role to a FILE * in traditional\r
+ * C file IO.\r
+ */\r
+ struct mipi_syst_handle {\r
+  struct mipi_syst_header* systh_header;     /**< global state            */\r
+  struct mipi_syst_handle_flags systh_flags; /**< handle state            */\r
+  struct mipi_syst_msg_tag systh_tag;        /**< tag flags               */\r
+\r
+#if defined(MIPI_SYST_PCFG_ENABLE_ORIGIN_GUID)\r
+  struct mipi_syst_guid systh_guid;          /**< module GUID             */\r
+#endif\r
+\r
+#if defined(MIPI_SYST_PCFG_ENABLE_LOCATION_RECORD)\r
+  struct mipi_syst_msglocation systh_location;   /**< location record     */\r
+#endif\r
+\r
+  mipi_syst_u32 systh_param_count;          /**< number of parameters     */\r
+  mipi_syst_u32 systh_param[6];             /**< catalog msg parameters   */\r
+\r
+#if defined(MIPI_SYST_PCFG_ENABLE_PLATFORM_HANDLE_DATA)\r
+  struct mipi_syst_platform_handle systh_platform;\r
+            /**< platform specific state  */\r
+#endif\r
+};\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern C */\r
+#endif\r
+#ifndef MIPI_SYST_API_INCLUDED\r
+#include "mipi_syst/api.h"\r
+#endif\r
+\r
+typedef struct mipi_syst_header MIPI_SYST_HEADER;\r
+typedef struct mipi_syst_handle MIPI_SYST_HANDLE;\r
+typedef enum mipi_syst_severity MIPI_SYST_SEVERITY;\r
+typedef struct mipi_syst_guid MIPI_SYST_GUID;\r
+typedef struct mipi_syst_msg_tag MIPI_SYST_MSG_TAG;\r
+typedef struct mipi_syst_handle_flags MIPI_SYST_HANDLE_FLAGS;\r
+#endif\r
index 035c34b3adfe552be04befebc23fd1182f485967..f024b48685ef2c6c47151d2cfdb1fa6e33c8e624 100644 (file)
 {\r
     ## options defined .pytool/Plugin/LicenseCheck\r
     "LicenseCheck": {\r
-        "IgnoreFiles": []\r
+        "IgnoreFiles": [\r
+            # This file is copied from mipi sys-T submodule and generated by python script with customization.\r
+            "Library/MipiSysTLib/mipi_syst.h"\r
+        ]\r
     },\r
     "EccCheck": {\r
         ## Exception sample looks like below:\r
@@ -68,7 +71,8 @@
             "Include/Library/SafeIntLib.h",\r
             "Include/Protocol/DebugSupport.h",\r
             "Test/UnitTest/Library/BaseSafeIntLib/TestBaseSafeIntLib.c",\r
-            "Library/BaseFdtLib"\r
+            "Library/BaseFdtLib",\r
+            "Library/MipiSysTLib/mipi_syst.h"\r
         ]\r
     },\r
     ## options defined ci/Plugin/CompilerPlugin\r
         "IgnoreStandardPaths": [],   # Standard Plugin defined paths that should be ignore\r
         "AdditionalIncludePaths": [] # Additional paths to spell check (wildcards supported)\r
     },\r
+\r
     # options defined in .pytool/Plugin/UncrustifyCheck\r
     "UncrustifyCheck": {\r
         "IgnoreFiles": [\r
             "Library/BaseFdtLib/stddef.h",\r
             "Library/BaseFdtLib/stdint.h",\r
             "Library/BaseFdtLib/stdlib.h",\r
-            "Library/BaseFdtLib/string.h"\r
+            "Library/BaseFdtLib/string.h",\r
+            "mipi_syst.h"\r
         ]\r
     }\r
 }\r
index d6c4179b2a48852b32e2cc567799c76bb2f2ccff..597f4f7137f9e2bcb964850e87e5343fdeed15ef 100644 (file)
@@ -28,6 +28,7 @@
   Include\r
   Test/UnitTest/Include\r
   Test/Mock/Include\r
+  Library/MipiSysTLib/mipisyst/library/include\r
 \r
 [Includes.IA32]\r
   Include/Ia32\r
   #\r
   FdtLib|Include/Library/FdtLib.h\r
 \r
+  ##  @libraryclass  Provides general mipi sys-T services.\r
+  #\r
+  MipiSysTLib|Include/Library/MipiSysTLib.h\r
+\r
+  ##  @libraryclass  Provides API to output Trace Hub debug message.\r
+  #\r
+  TraceHubDebugSysTLib|Include/Library/TraceHubDebugSysTLib.h\r
+\r
 [LibraryClasses.IA32, LibraryClasses.X64, LibraryClasses.AARCH64]\r
   ##  @libraryclass  Provides services to generate random number.\r
   #\r
index b38c863812c174d48430cda0cacc1b756f7e3dd1..902a39cffcebad9255d5453a1bb24eec52945d11 100644 (file)
   MdePkg/Library/MmServicesTableLib/MmServicesTableLib.inf\r
   MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf\r
   MdePkg/Library/TdxLib/TdxLib.inf\r
+  MdePkg/Library/MipiSysTLib/MipiSysTLib.inf\r
 \r
 [Components.EBC]\r
   MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf\r