]>
git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c
3 This file provides the information dump support for EHCI when in debug mode.
5 Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
6 Copyright (c) Microsoft Corporation.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
15 Dump the status byte in QTD/QH to a more friendly format.
17 @param State The state in the QTD/QH.
25 if (EHC_BIT_IS_SET (State
, QTD_STAT_DO_PING
)) {
26 DEBUG ((DEBUG_VERBOSE
, " Do_Ping"));
28 DEBUG ((DEBUG_VERBOSE
, " Do_Out"));
31 if (EHC_BIT_IS_SET (State
, QTD_STAT_DO_CS
)) {
32 DEBUG ((DEBUG_VERBOSE
, " Do_CS"));
34 DEBUG ((DEBUG_VERBOSE
, " Do_SS"));
37 if (EHC_BIT_IS_SET (State
, QTD_STAT_TRANS_ERR
)) {
38 DEBUG ((DEBUG_VERBOSE
, " Transfer_Error"));
41 if (EHC_BIT_IS_SET (State
, QTD_STAT_BABBLE_ERR
)) {
42 DEBUG ((DEBUG_VERBOSE
, " Babble_Error"));
45 if (EHC_BIT_IS_SET (State
, QTD_STAT_BUFF_ERR
)) {
46 DEBUG ((DEBUG_VERBOSE
, " Buffer_Error"));
49 if (EHC_BIT_IS_SET (State
, QTD_STAT_HALTED
)) {
50 DEBUG ((DEBUG_VERBOSE
, " Halted"));
53 if (EHC_BIT_IS_SET (State
, QTD_STAT_ACTIVE
)) {
54 DEBUG ((DEBUG_VERBOSE
, " Active"));
57 DEBUG ((DEBUG_VERBOSE
, "\n"));
62 Dump the fields of a QTD.
64 @param Qtd The QTD to dump.
65 @param Msg The message to print before the dump.
78 DEBUG ((DEBUG_VERBOSE
, Msg
));
81 DEBUG ((DEBUG_VERBOSE
, "Queue TD @ 0x%p, data length %d\n", Qtd
, (UINT32
)Qtd
->DataLen
));
85 DEBUG ((DEBUG_VERBOSE
, "Next QTD : %x\n", QtdHw
->NextQtd
));
86 DEBUG ((DEBUG_VERBOSE
, "AltNext QTD : %x\n", QtdHw
->AltNext
));
87 DEBUG ((DEBUG_VERBOSE
, "Status : %x\n", QtdHw
->Status
));
88 EhcDumpStatus (QtdHw
->Status
);
90 if (QtdHw
->Pid
== QTD_PID_SETUP
) {
91 DEBUG ((DEBUG_VERBOSE
, "PID : Setup\n"));
93 } else if (QtdHw
->Pid
== QTD_PID_INPUT
) {
94 DEBUG ((DEBUG_VERBOSE
, "PID : IN\n"));
96 } else if (QtdHw
->Pid
== QTD_PID_OUTPUT
) {
97 DEBUG ((DEBUG_VERBOSE
, "PID : OUT\n"));
101 DEBUG ((DEBUG_VERBOSE
, "Error Count : %d\n", QtdHw
->ErrCnt
));
102 DEBUG ((DEBUG_VERBOSE
, "Current Page : %d\n", QtdHw
->CurPage
));
103 DEBUG ((DEBUG_VERBOSE
, "IOC : %d\n", QtdHw
->Ioc
));
104 DEBUG ((DEBUG_VERBOSE
, "Total Bytes : %d\n", QtdHw
->TotalBytes
));
105 DEBUG ((DEBUG_VERBOSE
, "Data Toggle : %d\n", QtdHw
->DataToggle
));
107 for (Index
= 0; Index
< 5; Index
++) {
108 DEBUG ((DEBUG_VERBOSE
, "Page[%d] : 0x%x\n", (UINT32
)Index
, QtdHw
->Page
[Index
]));
116 @param Qh The queue head to dump.
117 @param Msg The message to print before the dump.
118 @param DumpBuf Whether to dump the memory buffer of the associated QTD.
134 DEBUG ((DEBUG_VERBOSE
, Msg
));
137 DEBUG ((DEBUG_VERBOSE
, "Queue head @ 0x%p, interval %ld, next qh %p\n",
138 Qh
, (UINT64
)Qh
->Interval
, Qh
->NextQh
));
142 DEBUG ((DEBUG_VERBOSE
, "Hoziontal link: %x\n", QhHw
->HorizonLink
));
143 DEBUG ((DEBUG_VERBOSE
, "Device address: %d\n", QhHw
->DeviceAddr
));
144 DEBUG ((DEBUG_VERBOSE
, "Inactive : %d\n", QhHw
->Inactive
));
145 DEBUG ((DEBUG_VERBOSE
, "EP number : %d\n", QhHw
->EpNum
));
146 DEBUG ((DEBUG_VERBOSE
, "EP speed : %d\n", QhHw
->EpSpeed
));
147 DEBUG ((DEBUG_VERBOSE
, "DT control : %d\n", QhHw
->DtCtrl
));
148 DEBUG ((DEBUG_VERBOSE
, "Reclaim head : %d\n", QhHw
->ReclaimHead
));
149 DEBUG ((DEBUG_VERBOSE
, "Max packet len: %d\n", QhHw
->MaxPacketLen
));
150 DEBUG ((DEBUG_VERBOSE
, "Ctrl EP : %d\n", QhHw
->CtrlEp
));
151 DEBUG ((DEBUG_VERBOSE
, "Nak reload : %d\n", QhHw
->NakReload
));
153 DEBUG ((DEBUG_VERBOSE
, "SMask : %x\n", QhHw
->SMask
));
154 DEBUG ((DEBUG_VERBOSE
, "CMask : %x\n", QhHw
->CMask
));
155 DEBUG ((DEBUG_VERBOSE
, "Hub address : %d\n", QhHw
->HubAddr
));
156 DEBUG ((DEBUG_VERBOSE
, "Hub port : %d\n", QhHw
->PortNum
));
157 DEBUG ((DEBUG_VERBOSE
, "Multiplier : %d\n", QhHw
->Multiplier
));
159 DEBUG ((DEBUG_VERBOSE
, "Cur QTD : %x\n", QhHw
->CurQtd
));
161 DEBUG ((DEBUG_VERBOSE
, "Next QTD : %x\n", QhHw
->NextQtd
));
162 DEBUG ((DEBUG_VERBOSE
, "AltNext QTD : %x\n", QhHw
->AltQtd
));
163 DEBUG ((DEBUG_VERBOSE
, "Status : %x\n", QhHw
->Status
));
165 EhcDumpStatus (QhHw
->Status
);
167 if (QhHw
->Pid
== QTD_PID_SETUP
) {
168 DEBUG ((DEBUG_VERBOSE
, "PID : Setup\n"));
170 } else if (QhHw
->Pid
== QTD_PID_INPUT
) {
171 DEBUG ((DEBUG_VERBOSE
, "PID : IN\n"));
173 } else if (QhHw
->Pid
== QTD_PID_OUTPUT
) {
174 DEBUG ((DEBUG_VERBOSE
, "PID : OUT\n"));
177 DEBUG ((DEBUG_VERBOSE
, "Error Count : %d\n", QhHw
->ErrCnt
));
178 DEBUG ((DEBUG_VERBOSE
, "Current Page : %d\n", QhHw
->CurPage
));
179 DEBUG ((DEBUG_VERBOSE
, "IOC : %d\n", QhHw
->Ioc
));
180 DEBUG ((DEBUG_VERBOSE
, "Total Bytes : %d\n", QhHw
->TotalBytes
));
181 DEBUG ((DEBUG_VERBOSE
, "Data Toggle : %d\n", QhHw
->DataToggle
));
183 for (Index
= 0; Index
< 5; Index
++) {
184 DEBUG ((DEBUG_VERBOSE
, "Page[%d] : 0x%x\n", Index
, QhHw
->Page
[Index
]));
187 DEBUG ((DEBUG_VERBOSE
, "\n"));
189 BASE_LIST_FOR_EACH (Entry
, &Qh
->Qtds
) {
190 Qtd
= EFI_LIST_CONTAINER (Entry
, EHC_QTD
, QtdList
);
191 EhcDumpQtd (Qtd
, NULL
);
193 if (DumpBuf
&& (Qtd
->DataLen
!= 0)) {
194 EhcDumpBuf (Qtd
->Data
, Qtd
->DataLen
);
201 Dump the buffer in the form of hex.
203 @param Buf The buffer to dump.
204 @param Len The length of buffer.
215 for (Index
= 0; Index
< Len
; Index
++) {
216 if (Index
% 16 == 0) {
217 DEBUG ((DEBUG_VERBOSE
,"\n"));
220 DEBUG ((DEBUG_VERBOSE
, "%02x ", Buf
[Index
]));
223 DEBUG ((DEBUG_VERBOSE
, "\n"));