2007-07-11 08:46:38 +02:00
|
|
|
/** @file
|
|
|
|
|
|
|
|
Copyright (c) 2007, Intel Corporation
|
|
|
|
All rights reserved. This program and the accompanying materials
|
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
Module Name:
|
|
|
|
|
|
|
|
EhciDebug.c
|
|
|
|
|
|
|
|
Abstract:
|
|
|
|
This file provides the information dump support for EHCI when in debug mode.
|
|
|
|
|
|
|
|
Revision History
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
|
|
#include "Ehci.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
Dump the status byte in QTD/QH to a more friendly
|
|
|
|
format
|
|
|
|
|
|
|
|
@param State The state in the QTD/QH
|
|
|
|
|
|
|
|
@return None
|
|
|
|
|
|
|
|
**/
|
|
|
|
STATIC
|
|
|
|
VOID
|
|
|
|
EhcDumpStatus (
|
2008-02-13 10:08:24 +01:00
|
|
|
IN UINT32 State
|
2007-07-11 08:46:38 +02:00
|
|
|
)
|
|
|
|
{
|
|
|
|
if (EHC_BIT_IS_SET (State, QTD_STAT_DO_PING)) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, " Do_Ping"));
|
2007-07-11 08:46:38 +02:00
|
|
|
} else {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, " Do_Out"));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (EHC_BIT_IS_SET (State, QTD_STAT_DO_CS)) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, " Do_CS"));
|
2007-07-11 08:46:38 +02:00
|
|
|
} else {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, " Do_SS"));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (EHC_BIT_IS_SET (State, QTD_STAT_TRANS_ERR)) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, " Transfer_Error"));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (EHC_BIT_IS_SET (State, QTD_STAT_BABBLE_ERR)) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, " Babble_Error"));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (EHC_BIT_IS_SET (State, QTD_STAT_BUFF_ERR)) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, " Buffer_Error"));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (EHC_BIT_IS_SET (State, QTD_STAT_HALTED)) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, " Halted"));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (EHC_BIT_IS_SET (State, QTD_STAT_ACTIVE)) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, " Active"));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "\n"));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Dump the fields of a QTD
|
|
|
|
|
|
|
|
@param Qtd The QTD to dump
|
|
|
|
@param Msg The message to print before the dump
|
|
|
|
|
|
|
|
@return None
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EhcDumpQtd (
|
|
|
|
IN EHC_QTD *Qtd,
|
2008-02-13 10:08:24 +01:00
|
|
|
IN CHAR8 *Msg
|
2007-07-11 08:46:38 +02:00
|
|
|
)
|
|
|
|
{
|
|
|
|
QTD_HW *QtdHw;
|
|
|
|
UINTN Index;
|
|
|
|
|
|
|
|
if (Msg != NULL) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, Msg));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "Queue TD @ 0x%x, data length %d\n", Qtd, Qtd->DataLen));
|
2007-07-11 08:46:38 +02:00
|
|
|
|
|
|
|
QtdHw = &Qtd->QtdHw;
|
|
|
|
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "Next QTD : %x\n", QtdHw->NextQtd));
|
|
|
|
DEBUG ((EFI_D_INFO, "AltNext QTD : %x\n", QtdHw->AltNext));
|
|
|
|
DEBUG ((EFI_D_INFO, "Status : %x\n", QtdHw->Status));
|
|
|
|
EhcDumpStatus (QtdHw->Status);
|
2007-07-11 08:46:38 +02:00
|
|
|
|
|
|
|
if (QtdHw->Pid == QTD_PID_SETUP) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "PID : Setup\n"));
|
2007-07-11 08:46:38 +02:00
|
|
|
|
|
|
|
} else if (QtdHw->Pid == QTD_PID_INPUT) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "PID : IN\n"));
|
2007-07-11 08:46:38 +02:00
|
|
|
|
|
|
|
} else if (QtdHw->Pid == QTD_PID_OUTPUT) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "PID : OUT\n"));
|
2007-07-11 08:46:38 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "Error Count : %d\n", QtdHw->ErrCnt));
|
|
|
|
DEBUG ((EFI_D_INFO, "Current Page : %d\n", QtdHw->CurPage));
|
|
|
|
DEBUG ((EFI_D_INFO, "IOC : %d\n", QtdHw->IOC));
|
|
|
|
DEBUG ((EFI_D_INFO, "Total Bytes : %d\n", QtdHw->TotalBytes));
|
|
|
|
DEBUG ((EFI_D_INFO, "Data Toggle : %d\n", QtdHw->DataToggle));
|
2007-07-11 08:46:38 +02:00
|
|
|
|
|
|
|
for (Index = 0; Index < 5; Index++) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "Page[%d] : 0x%x\n", Index, QtdHw->Page[Index]));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Dump the queue head
|
|
|
|
|
|
|
|
@param Qh The queue head to dump
|
|
|
|
@param Msg The message to print before the dump
|
|
|
|
@param DumpBuf Whether to dump the memory buffer of the associated QTD
|
|
|
|
|
|
|
|
@return None
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EhcDumpQh (
|
|
|
|
IN EHC_QH *Qh,
|
2008-02-13 10:08:24 +01:00
|
|
|
IN CHAR8 *Msg,
|
2007-07-11 08:46:38 +02:00
|
|
|
IN BOOLEAN DumpBuf
|
|
|
|
)
|
|
|
|
{
|
|
|
|
EHC_QTD *Qtd;
|
|
|
|
QH_HW *QhHw;
|
|
|
|
LIST_ENTRY *Entry;
|
|
|
|
UINTN Index;
|
|
|
|
|
|
|
|
if (Msg != NULL) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, Msg));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "Queue head @ 0x%x, interval %d, next qh %x\n",
|
|
|
|
Qh, Qh->Interval, Qh->NextQh));
|
2007-07-11 08:46:38 +02:00
|
|
|
|
|
|
|
QhHw = &Qh->QhHw;
|
|
|
|
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "Hoziontal link: %x\n", QhHw->HorizonLink));
|
|
|
|
DEBUG ((EFI_D_INFO, "Device address: %d\n", QhHw->DeviceAddr));
|
|
|
|
DEBUG ((EFI_D_INFO, "Inactive : %d\n", QhHw->Inactive));
|
|
|
|
DEBUG ((EFI_D_INFO, "EP number : %d\n", QhHw->EpNum));
|
|
|
|
DEBUG ((EFI_D_INFO, "EP speed : %d\n", QhHw->EpSpeed));
|
|
|
|
DEBUG ((EFI_D_INFO, "DT control : %d\n", QhHw->DtCtrl));
|
|
|
|
DEBUG ((EFI_D_INFO, "Reclaim head : %d\n", QhHw->ReclaimHead));
|
|
|
|
DEBUG ((EFI_D_INFO, "Max packet len: %d\n", QhHw->MaxPacketLen));
|
|
|
|
DEBUG ((EFI_D_INFO, "Ctrl EP : %d\n", QhHw->CtrlEp));
|
|
|
|
DEBUG ((EFI_D_INFO, "Nak reload : %d\n", QhHw->NakReload));
|
|
|
|
|
|
|
|
DEBUG ((EFI_D_INFO, "SMask : %x\n", QhHw->SMask));
|
|
|
|
DEBUG ((EFI_D_INFO, "CMask : %x\n", QhHw->CMask));
|
|
|
|
DEBUG ((EFI_D_INFO, "Hub address : %d\n", QhHw->HubAddr));
|
|
|
|
DEBUG ((EFI_D_INFO, "Hub port : %d\n", QhHw->PortNum));
|
|
|
|
DEBUG ((EFI_D_INFO, "Multiplier : %d\n", QhHw->Multiplier));
|
|
|
|
|
|
|
|
DEBUG ((EFI_D_INFO, "Cur QTD : %x\n", QhHw->CurQtd));
|
|
|
|
|
|
|
|
DEBUG ((EFI_D_INFO, "Next QTD : %x\n", QhHw->NextQtd));
|
|
|
|
DEBUG ((EFI_D_INFO, "AltNext QTD : %x\n", QhHw->AltQtd));
|
|
|
|
DEBUG ((EFI_D_INFO, "Status : %x\n", QhHw->Status));
|
|
|
|
|
|
|
|
EhcDumpStatus (QhHw->Status);
|
2007-07-11 08:46:38 +02:00
|
|
|
|
|
|
|
if (QhHw->Pid == QTD_PID_SETUP) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "PID : Setup\n"));
|
2007-07-11 08:46:38 +02:00
|
|
|
|
|
|
|
} else if (QhHw->Pid == QTD_PID_INPUT) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "PID : IN\n"));
|
2007-07-11 08:46:38 +02:00
|
|
|
|
|
|
|
} else if (QhHw->Pid == QTD_PID_OUTPUT) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "PID : OUT\n"));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "Error Count : %d\n", QhHw->ErrCnt));
|
|
|
|
DEBUG ((EFI_D_INFO, "Current Page : %d\n", QhHw->CurPage));
|
|
|
|
DEBUG ((EFI_D_INFO, "IOC : %d\n", QhHw->IOC));
|
|
|
|
DEBUG ((EFI_D_INFO, "Total Bytes : %d\n", QhHw->TotalBytes));
|
|
|
|
DEBUG ((EFI_D_INFO, "Data Toggle : %d\n", QhHw->DataToggle));
|
2007-07-11 08:46:38 +02:00
|
|
|
|
|
|
|
for (Index = 0; Index < 5; Index++) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "Page[%d] : 0x%x\n", Index, QhHw->Page[Index]));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "\n"));
|
2007-07-11 08:46:38 +02:00
|
|
|
|
|
|
|
EFI_LIST_FOR_EACH (Entry, &Qh->Qtds) {
|
|
|
|
Qtd = EFI_LIST_CONTAINER (Entry, EHC_QTD, QtdList);
|
|
|
|
EhcDumpQtd (Qtd, NULL);
|
|
|
|
|
|
|
|
if (DumpBuf && (Qtd->DataLen != 0)) {
|
|
|
|
EhcDumpBuf (Qtd->Data, Qtd->DataLen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
Dump the buffer in the form of hex
|
|
|
|
|
|
|
|
@param Buf The buffer to dump
|
|
|
|
@param Len The length of buffer
|
|
|
|
|
|
|
|
@return None
|
|
|
|
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EhcDumpBuf (
|
|
|
|
IN UINT8 *Buf,
|
|
|
|
IN UINTN Len
|
|
|
|
)
|
|
|
|
{
|
|
|
|
UINTN Index;
|
|
|
|
|
|
|
|
for (Index = 0; Index < Len; Index++) {
|
|
|
|
if (Index % 16 == 0) {
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO,"\n"));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "%02x ", Buf[Index]));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|
|
|
|
|
2008-02-13 10:08:24 +01:00
|
|
|
DEBUG ((EFI_D_INFO, "\n"));
|
2007-07-11 08:46:38 +02:00
|
|
|
}
|