]>
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 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 Dump the status byte in QTD/QH to a more friendly format.
22 @param State The state in the QTD/QH.
30 if (EHC_BIT_IS_SET (State
, QTD_STAT_DO_PING
)) {
31 DEBUG ((EFI_D_VERBOSE
, " Do_Ping"));
33 DEBUG ((EFI_D_VERBOSE
, " Do_Out"));
36 if (EHC_BIT_IS_SET (State
, QTD_STAT_DO_CS
)) {
37 DEBUG ((EFI_D_VERBOSE
, " Do_CS"));
39 DEBUG ((EFI_D_VERBOSE
, " Do_SS"));
42 if (EHC_BIT_IS_SET (State
, QTD_STAT_TRANS_ERR
)) {
43 DEBUG ((EFI_D_VERBOSE
, " Transfer_Error"));
46 if (EHC_BIT_IS_SET (State
, QTD_STAT_BABBLE_ERR
)) {
47 DEBUG ((EFI_D_VERBOSE
, " Babble_Error"));
50 if (EHC_BIT_IS_SET (State
, QTD_STAT_BUFF_ERR
)) {
51 DEBUG ((EFI_D_VERBOSE
, " Buffer_Error"));
54 if (EHC_BIT_IS_SET (State
, QTD_STAT_HALTED
)) {
55 DEBUG ((EFI_D_VERBOSE
, " Halted"));
58 if (EHC_BIT_IS_SET (State
, QTD_STAT_ACTIVE
)) {
59 DEBUG ((EFI_D_VERBOSE
, " Active"));
62 DEBUG ((EFI_D_VERBOSE
, "\n"));
67 Dump the fields of a QTD.
69 @param Qtd The QTD to dump.
70 @param Msg The message to print before the dump.
83 DEBUG ((EFI_D_VERBOSE
, Msg
));
86 DEBUG ((EFI_D_VERBOSE
, "Queue TD @ 0x%p, data length %d\n", Qtd
, (UINT32
)Qtd
->DataLen
));
90 DEBUG ((EFI_D_VERBOSE
, "Next QTD : %x\n", QtdHw
->NextQtd
));
91 DEBUG ((EFI_D_VERBOSE
, "AltNext QTD : %x\n", QtdHw
->AltNext
));
92 DEBUG ((EFI_D_VERBOSE
, "Status : %x\n", QtdHw
->Status
));
93 EhcDumpStatus (QtdHw
->Status
);
95 if (QtdHw
->Pid
== QTD_PID_SETUP
) {
96 DEBUG ((EFI_D_VERBOSE
, "PID : Setup\n"));
98 } else if (QtdHw
->Pid
== QTD_PID_INPUT
) {
99 DEBUG ((EFI_D_VERBOSE
, "PID : IN\n"));
101 } else if (QtdHw
->Pid
== QTD_PID_OUTPUT
) {
102 DEBUG ((EFI_D_VERBOSE
, "PID : OUT\n"));
106 DEBUG ((EFI_D_VERBOSE
, "Error Count : %d\n", QtdHw
->ErrCnt
));
107 DEBUG ((EFI_D_VERBOSE
, "Current Page : %d\n", QtdHw
->CurPage
));
108 DEBUG ((EFI_D_VERBOSE
, "IOC : %d\n", QtdHw
->Ioc
));
109 DEBUG ((EFI_D_VERBOSE
, "Total Bytes : %d\n", QtdHw
->TotalBytes
));
110 DEBUG ((EFI_D_VERBOSE
, "Data Toggle : %d\n", QtdHw
->DataToggle
));
112 for (Index
= 0; Index
< 5; Index
++) {
113 DEBUG ((EFI_D_VERBOSE
, "Page[%d] : 0x%x\n", (UINT32
)Index
, QtdHw
->Page
[Index
]));
121 @param Qh The queue head to dump.
122 @param Msg The message to print before the dump.
123 @param DumpBuf Whether to dump the memory buffer of the associated QTD.
139 DEBUG ((EFI_D_VERBOSE
, Msg
));
142 DEBUG ((EFI_D_VERBOSE
, "Queue head @ 0x%p, interval %ld, next qh %p\n",
143 Qh
, (UINT64
)Qh
->Interval
, Qh
->NextQh
));
147 DEBUG ((EFI_D_VERBOSE
, "Hoziontal link: %x\n", QhHw
->HorizonLink
));
148 DEBUG ((EFI_D_VERBOSE
, "Device address: %d\n", QhHw
->DeviceAddr
));
149 DEBUG ((EFI_D_VERBOSE
, "Inactive : %d\n", QhHw
->Inactive
));
150 DEBUG ((EFI_D_VERBOSE
, "EP number : %d\n", QhHw
->EpNum
));
151 DEBUG ((EFI_D_VERBOSE
, "EP speed : %d\n", QhHw
->EpSpeed
));
152 DEBUG ((EFI_D_VERBOSE
, "DT control : %d\n", QhHw
->DtCtrl
));
153 DEBUG ((EFI_D_VERBOSE
, "Reclaim head : %d\n", QhHw
->ReclaimHead
));
154 DEBUG ((EFI_D_VERBOSE
, "Max packet len: %d\n", QhHw
->MaxPacketLen
));
155 DEBUG ((EFI_D_VERBOSE
, "Ctrl EP : %d\n", QhHw
->CtrlEp
));
156 DEBUG ((EFI_D_VERBOSE
, "Nak reload : %d\n", QhHw
->NakReload
));
158 DEBUG ((EFI_D_VERBOSE
, "SMask : %x\n", QhHw
->SMask
));
159 DEBUG ((EFI_D_VERBOSE
, "CMask : %x\n", QhHw
->CMask
));
160 DEBUG ((EFI_D_VERBOSE
, "Hub address : %d\n", QhHw
->HubAddr
));
161 DEBUG ((EFI_D_VERBOSE
, "Hub port : %d\n", QhHw
->PortNum
));
162 DEBUG ((EFI_D_VERBOSE
, "Multiplier : %d\n", QhHw
->Multiplier
));
164 DEBUG ((EFI_D_VERBOSE
, "Cur QTD : %x\n", QhHw
->CurQtd
));
166 DEBUG ((EFI_D_VERBOSE
, "Next QTD : %x\n", QhHw
->NextQtd
));
167 DEBUG ((EFI_D_VERBOSE
, "AltNext QTD : %x\n", QhHw
->AltQtd
));
168 DEBUG ((EFI_D_VERBOSE
, "Status : %x\n", QhHw
->Status
));
170 EhcDumpStatus (QhHw
->Status
);
172 if (QhHw
->Pid
== QTD_PID_SETUP
) {
173 DEBUG ((EFI_D_VERBOSE
, "PID : Setup\n"));
175 } else if (QhHw
->Pid
== QTD_PID_INPUT
) {
176 DEBUG ((EFI_D_VERBOSE
, "PID : IN\n"));
178 } else if (QhHw
->Pid
== QTD_PID_OUTPUT
) {
179 DEBUG ((EFI_D_VERBOSE
, "PID : OUT\n"));
182 DEBUG ((EFI_D_VERBOSE
, "Error Count : %d\n", QhHw
->ErrCnt
));
183 DEBUG ((EFI_D_VERBOSE
, "Current Page : %d\n", QhHw
->CurPage
));
184 DEBUG ((EFI_D_VERBOSE
, "IOC : %d\n", QhHw
->Ioc
));
185 DEBUG ((EFI_D_VERBOSE
, "Total Bytes : %d\n", QhHw
->TotalBytes
));
186 DEBUG ((EFI_D_VERBOSE
, "Data Toggle : %d\n", QhHw
->DataToggle
));
188 for (Index
= 0; Index
< 5; Index
++) {
189 DEBUG ((EFI_D_VERBOSE
, "Page[%d] : 0x%x\n", Index
, QhHw
->Page
[Index
]));
192 DEBUG ((EFI_D_VERBOSE
, "\n"));
194 EFI_LIST_FOR_EACH (Entry
, &Qh
->Qtds
) {
195 Qtd
= EFI_LIST_CONTAINER (Entry
, EHC_QTD
, QtdList
);
196 EhcDumpQtd (Qtd
, NULL
);
198 if (DumpBuf
&& (Qtd
->DataLen
!= 0)) {
199 EhcDumpBuf (Qtd
->Data
, Qtd
->DataLen
);
206 Dump the buffer in the form of hex.
208 @param Buf The buffer to dump.
209 @param Len The length of buffer.
220 for (Index
= 0; Index
< Len
; Index
++) {
221 if (Index
% 16 == 0) {
222 DEBUG ((EFI_D_VERBOSE
,"\n"));
225 DEBUG ((EFI_D_VERBOSE
, "%02x ", Buf
[Index
]));
228 DEBUG ((EFI_D_VERBOSE
, "\n"));
232 Dump the EHCI status registers.
234 @param Ehc USB EHCI Host Controller instance
244 DEBUG ((EFI_D_VERBOSE
, " EHC_CAPLENGTH_OFFSET = 0x%08x\n", EhcReadCapRegister (Ehc
, EHC_CAPLENGTH_OFFSET
)));
245 DEBUG ((EFI_D_VERBOSE
, " EHC_HCSPARAMS_OFFSET = 0x%08x\n", EhcReadCapRegister (Ehc
, EHC_HCSPARAMS_OFFSET
)));
246 DEBUG ((EFI_D_VERBOSE
, " EHC_HCCPARAMS_OFFSET = 0x%08x\n", EhcReadCapRegister (Ehc
, EHC_HCCPARAMS_OFFSET
)));
247 DEBUG ((EFI_D_VERBOSE
, " EHC_USBCMD_OFFSET = 0x%08x\n", EhcReadOpReg (Ehc
, EHC_USBCMD_OFFSET
)));
248 DEBUG ((EFI_D_VERBOSE
, " EHC_USBSTS_OFFSET = 0x%08x\n", EhcReadOpReg (Ehc
, EHC_USBSTS_OFFSET
)));
249 DEBUG ((EFI_D_VERBOSE
, " EHC_USBINTR_OFFSET = 0x%08x\n", EhcReadOpReg (Ehc
, EHC_USBINTR_OFFSET
)));
250 DEBUG ((EFI_D_VERBOSE
, " EHC_FRINDEX_OFFSET = 0x%08x\n", EhcReadOpReg (Ehc
, EHC_FRINDEX_OFFSET
)));
251 DEBUG ((EFI_D_VERBOSE
, " EHC_CTRLDSSEG_OFFSET = 0x%08x\n", EhcReadOpReg (Ehc
, EHC_CTRLDSSEG_OFFSET
)));
252 DEBUG ((EFI_D_VERBOSE
, " EHC_FRAME_BASE_OFFSET = 0x%08x\n", EhcReadOpReg (Ehc
, EHC_FRAME_BASE_OFFSET
)));
253 DEBUG ((EFI_D_VERBOSE
, " EHC_ASYNC_HEAD_OFFSET = 0x%08x\n", EhcReadOpReg (Ehc
, EHC_ASYNC_HEAD_OFFSET
)));
254 DEBUG ((EFI_D_VERBOSE
, " EHC_CONFIG_FLAG_OFFSET = 0x%08x\n", EhcReadOpReg (Ehc
, EHC_CONFIG_FLAG_OFFSET
)));
255 for (Index
= 0; Index
< (UINT8
) (Ehc
->HcStructParams
& HCSP_NPORTS
); Index
++) {
256 DEBUG ((EFI_D_VERBOSE
, " EHC_PORT_STAT_OFFSET(%d) = 0x%08x\n", Index
, EhcReadOpReg (Ehc
, EHC_PORT_STAT_OFFSET
+ (4 * Index
))));