]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Pci/UhciDxe/UhciDebug.c
Update to support to produce Component Name and & Component Name 2 protocol based...
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / UhciDxe / UhciDebug.c
CommitLineData
913cb9dc 1/** @file\r
2\r
3Copyright (c) 2007, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12Module Name:\r
13\r
14 UhciDebug.c\r
15\r
16Abstract:\r
17\r
18 This file provides the information dump support for Uhci when in debug mode.\r
19 You can dynamically adjust the debug level by changing variable gEHCDebugLevel\r
20 and gEHCErrorLevel.\r
21\r
22Revision History\r
23\r
24\r
25**/\r
26\r
27#include "Uhci.h"\r
28#include "UhciDebug.h"\r
29\r
30#ifdef EFI_DEBUG\r
31\r
32UINTN mUhciDebugMask = USB_DEBUG_FORCE_OUTPUT;\r
33\r
34\r
35/**\r
36 Debug debug print interface for UHCI\r
37\r
38 @param Format String to use for the print, followed by print arguments\r
39\r
40 @return None\r
41\r
42**/\r
43VOID\r
44UhciDebug (\r
45 IN CHAR8 *Format,\r
46 ...\r
47 )\r
48{\r
49 VA_LIST Marker;\r
50\r
51 VA_START (Marker, Format);\r
52 DebugVPrint (DEBUG_INFO, Format, Marker);\r
53 VA_END (Marker);\r
54}\r
55\r
56\r
57/**\r
58 Debug error print interface for UHCI\r
59\r
60 @param Format String to use for the print, followed by print arguments\r
61\r
62 @return None\r
63\r
64**/\r
65VOID\r
66UhciError (\r
67 IN CHAR8 *Format,\r
68 ...\r
69 )\r
70{\r
71 VA_LIST Marker;\r
72\r
73 VA_START (Marker, Format);\r
74 DebugVPrint (DEBUG_ERROR, Format, Marker);\r
75 VA_END (Marker);\r
76}\r
77\r
78\r
79\r
80/**\r
81 Debug print interface for UHCI\r
82\r
83 @param Level Level to control debug print\r
84 @param Format String to use for the print, followed by print arguments\r
85\r
86 @return None\r
87\r
88**/\r
89VOID\r
90UhciDebugPrint (\r
91 IN UINTN Level,\r
92 IN CHAR8 *Format,\r
93 ...\r
94 )\r
95{\r
96 VA_LIST Marker;\r
97\r
98 VA_START (Marker, Format);\r
99\r
100 if (Level & mUhciDebugMask) {\r
101 if (mUhciDebugMask & USB_DEBUG_FORCE_OUTPUT) {\r
102 DebugVPrint (DEBUG_ERROR, Format, Marker);\r
103 } else {\r
104 DebugVPrint (DEBUG_INFO, Format, Marker);\r
105 }\r
106 }\r
107\r
108 VA_END (Marker);\r
109}\r
110\r
111\r
112/**\r
113 Dump the content of QH structure\r
114\r
115 @param QhSw Pointer to software QH structure\r
116\r
117 @return None\r
118\r
119**/\r
120VOID\r
121UhciDumpQh (\r
122 IN UHCI_QH_SW *QhSw\r
123 )\r
124{\r
125 UINTN Level;\r
126\r
127 Level = UHCI_DEBUG_QH;\r
128\r
129 UhciDebugPrint (Level, "&QhSw @ 0x%x\n", QhSw);\r
130 UhciDebugPrint (Level, "QhSw.NextQh - 0x%x\n", QhSw->NextQh);\r
131 UhciDebugPrint (Level, "QhSw.TDs - 0x%x\n", QhSw->TDs);\r
132 UhciDebugPrint (Level, "QhSw.QhHw:\n");\r
133 UhciDebugPrint (Level, " Horizon Link - %x\n", QhSw->QhHw.HorizonLink);\r
134 UhciDebugPrint (Level, " Vertical Link - %x\n\n", QhSw->QhHw.VerticalLink);\r
135}\r
136\r
137\r
138/**\r
139 Dump the content of TD structure.\r
140\r
141 @param TdSw Pointer to software TD structure\r
142 @param IsCur Whether dump the whole list, or only dump the current TD\r
143\r
144 @return None\r
145\r
146**/\r
147VOID\r
148UhciDumpTds (\r
149 IN UHCI_TD_SW *TdSw\r
150 )\r
151{\r
152 UHCI_TD_SW *CurTdSw;\r
153 UINTN Level;\r
154\r
155 Level = UHCI_DEBUG_TD;\r
156 CurTdSw = TdSw;\r
157\r
158 while (CurTdSw != NULL) {\r
159 UhciDebugPrint (Level, "TdSw @ 0x%x\n", CurTdSw);\r
160 UhciDebugPrint (Level, "TdSw.NextTd - 0x%x\n", CurTdSw->NextTd);\r
161 UhciDebugPrint (Level, "TdSw.DataLen - %d\n", CurTdSw->DataLen);\r
162 UhciDebugPrint (Level, "TdSw.Data - 0x%x\n", CurTdSw->Data);\r
163 UhciDebugPrint (Level, "TdHw:\n");\r
164 UhciDebugPrint (Level, " NextLink - 0x%x\n", CurTdSw->TdHw.NextLink);\r
165 UhciDebugPrint (Level, " ActualLen - %d\n", CurTdSw->TdHw.ActualLen);\r
166 UhciDebugPrint (Level, " Status - 0x%x\n", CurTdSw->TdHw.Status);\r
167 UhciDebugPrint (Level, " IOC - %d\n", CurTdSw->TdHw.IntOnCpl);\r
168 UhciDebugPrint (Level, " IsIsoCh - %d\n", CurTdSw->TdHw.IsIsoch);\r
169 UhciDebugPrint (Level, " LowSpeed - %d\n", CurTdSw->TdHw.LowSpeed);\r
170 UhciDebugPrint (Level, " ErrorCount - %d\n", CurTdSw->TdHw.ErrorCount);\r
171 UhciDebugPrint (Level, " ShortPacket - %d\n", CurTdSw->TdHw.ShortPacket);\r
172 UhciDebugPrint (Level, " PidCode - 0x%x\n", CurTdSw->TdHw.PidCode);\r
173 UhciDebugPrint (Level, " DevAddr - %d\n", CurTdSw->TdHw.DeviceAddr);\r
174 UhciDebugPrint (Level, " EndPoint - %d\n", CurTdSw->TdHw.EndPoint);\r
175 UhciDebugPrint (Level, " DataToggle - %d\n", CurTdSw->TdHw.DataToggle);\r
176 UhciDebugPrint (Level, " MaxPacketLen - %d\n", CurTdSw->TdHw.MaxPacketLen);\r
177 UhciDebugPrint (Level, " DataBuffer - 0x%x\n\n",CurTdSw->TdHw.DataBuffer);\r
178\r
179 CurTdSw = CurTdSw->NextTd;\r
180 }\r
181}\r
182\r
183#endif\r