]> git.proxmox.com Git - mirror_edk2.git/blame - DynamicTablesPkg/Library/Common/AmlLib/AmlDbgPrint/AmlDbgPrint.h
DynamicTablesPkg: Apply uncrustify changes
[mirror_edk2.git] / DynamicTablesPkg / Library / Common / AmlLib / AmlDbgPrint / AmlDbgPrint.h
CommitLineData
340f8f45
PG
1/** @file\r
2 AML Debug Print.\r
3\r
4 Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. <BR>\r
5 Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>\r
6\r
7 SPDX-License-Identifier: BSD-2-Clause-Patent\r
8**/\r
9\r
10#ifndef AML_PRINT_H_\r
11#define AML_PRINT_H_\r
12\r
13/* This header file does not include internal Node definition,\r
14 i.e. AML_ROOT_NODE, AML_OBJECT_NODE, etc. The node definitions\r
15 must be included by the caller file. The function prototypes must\r
16 only expose AML_NODE_HANDLE, AML_ROOT_NODE_HANDLE, etc. node\r
17 definitions.\r
18 This allows to keep the functions defined here both internal and\r
19 potentially external. If necessary, any function of this file can\r
20 be exposed externally.\r
21 The Api folder is internal to the AmlLib, but should only use these\r
22 functions. They provide a "safe" way to interact with the AmlLib.\r
23*/\r
24\r
25#if !defined (MDEPKG_NDEBUG)\r
26\r
731c67e1 27 #include <AmlInclude.h>\r
340f8f45
PG
28\r
29/**\r
30 @defgroup DbgPrintApis Print APIs for debugging.\r
31 @ingroup AMLLib\r
32 @{\r
33 Print APIs provide a way to print:\r
34 - A buffer;\r
35 - A (root/object/data) node;\r
36 - An AML tree/branch;\r
37 - The AML NameSpace from the root node.\r
38 @}\r
39*/\r
40\r
41/** This function performs a raw data dump of the ACPI table.\r
42\r
43 @param [in] Ptr Pointer to the start of the table buffer.\r
44 @param [in] Length The length of the buffer.\r
45**/\r
46VOID\r
47EFIAPI\r
e18bc21d 48AmlDbgDumpRaw (\r
731c67e1
MK
49 IN CONST UINT8 *Ptr,\r
50 IN UINT32 Length\r
340f8f45
PG
51 );\r
52\r
53/** Print Size chars at Buffer address.\r
54\r
55 @ingroup DbgPrintApis\r
56\r
57 @param [in] ErrorLevel Error level for the DEBUG macro.\r
58 @param [in] Buffer Buffer containing the chars.\r
59 @param [in] Size Number of chars to print.\r
60**/\r
61VOID\r
62EFIAPI\r
63AmlDbgPrintChars (\r
731c67e1
MK
64 IN UINT32 ErrorLevel,\r
65 IN CONST CHAR8 *Buffer,\r
66 IN UINT32 Size\r
340f8f45
PG
67 );\r
68\r
69/** Print an AML NameSeg.\r
70 Don't print trailing underscores ('_').\r
71\r
72 @param [in] Buffer Buffer containing an AML NameSeg.\r
73**/\r
74VOID\r
75EFIAPI\r
76AmlDbgPrintNameSeg (\r
731c67e1 77 IN CONST CHAR8 *Buffer\r
340f8f45
PG
78 );\r
79\r
80/** Print an AML NameString.\r
81\r
82 @param [in] Buffer Buffer containing an AML NameString.\r
83 @param [in] NewLine Print a newline char at the end of the NameString.\r
84**/\r
85VOID\r
86EFIAPI\r
87AmlDbgPrintNameString (\r
731c67e1
MK
88 IN CONST CHAR8 *Buffer,\r
89 IN BOOLEAN NewLine\r
340f8f45
PG
90 );\r
91\r
92/** Print Node information.\r
93\r
94 @ingroup DbgPrintApis\r
95\r
96 @param [in] Node Pointer to the Node to print.\r
97 Can be a root/object/data node.\r
98**/\r
99VOID\r
100EFIAPI\r
101AmlDbgPrintNode (\r
731c67e1 102 IN AML_NODE_HANDLE Node\r
340f8f45
PG
103 );\r
104\r
105/** Recursively print the subtree under the Node.\r
106\r
107 @ingroup DbgPrintApis\r
108\r
109 @param [in] Node Pointer to the root of the subtree to print.\r
110 Can be a root/object/data node.\r
111**/\r
112VOID\r
113EFIAPI\r
114AmlDbgPrintTree (\r
731c67e1 115 IN AML_NODE_HANDLE Node\r
340f8f45
PG
116 );\r
117\r
118/** Print the absolute pathnames in the AML namespace of\r
119 all the nodes in the tree starting from the Root node.\r
120\r
121 @ingroup DbgPrintApis\r
122\r
123 @param [in] RootNode Pointer to a root node.\r
124\r
125 @retval EFI_SUCCESS The function completed successfully.\r
126 @retval EFI_BUFFER_TOO_SMALL No space left in the buffer.\r
127 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
128 @retval EFI_OUT_OF_RESOURCES Out of memory.\r
129**/\r
130EFI_STATUS\r
131EFIAPI\r
132AmlDbgPrintNameSpace (\r
133 IN AML_ROOT_NODE_HANDLE RootNode\r
134 );\r
135\r
e18bc21d
SM
136/* Macros to encapsulate Aml Debug Print APIs.\r
137*/\r
138\r
139#define AMLDBG_DUMP_RAW(Ptr, Length) \\r
140 AmlDbgDumpRaw (Ptr, Length)\r
141\r
142#define AMLDBG_PRINT_CHARS(ErrorLevel, Buffer, Size) \\r
143 AmlDbgPrintChars (ErrorLevel, Buffer, Size)\r
144\r
145#define AMLDBG_PRINT_NAMESEG(Buffer) \\r
146 AmlDbgPrintNameSeg (Buffer)\r
147\r
731c67e1 148#define AMLDBG_PRINT_NAMESTR(Buffer, NewLine) \\r
e18bc21d
SM
149 AmlDbgPrintNameString (Buffer,NewLine)\r
150\r
151#define AMLDBG_PRINT_NODE(Node) \\r
152 AmlDbgPrintNode (Node)\r
153\r
154#define AMLDBG_PRINT_TREE(Node) \\r
155 AmlDbgPrintTree (Node)\r
156\r
157#define AMLDBG_PRINT_NAMESPACE(RootNode) \\r
158 AmlDbgPrintNameSpace (RootNode)\r
159\r
340f8f45
PG
160#else\r
161\r
e18bc21d 162#define AMLDBG_DUMP_RAW(Ptr, Length)\r
340f8f45 163\r
e18bc21d 164#define AMLDBG_PRINT_CHARS(ErrorLevel, Buffer, Size)\r
340f8f45 165\r
e18bc21d 166#define AMLDBG_PRINT_NAMESEG(Buffer)\r
340f8f45 167\r
731c67e1 168#define AMLDBG_PRINT_NAMESTR(Buffer, NewLine)\r
340f8f45 169\r
e18bc21d 170#define AMLDBG_PRINT_NODE(Node)\r
340f8f45 171\r
e18bc21d 172#define AMLDBG_PRINT_TREE(Node)\r
340f8f45 173\r
e18bc21d 174#define AMLDBG_PRINT_NAMESPACE(RootNode)\r
340f8f45
PG
175\r
176#endif // MDEPKG_NDEBUG\r
177\r
178#endif // AML_PRINT_H_\r