\r
Abstract:\r
This file provides the information dump support for EHCI when in debug mode.\r
-You can dynamically adjust the debug level by changing variable mEhcDebugLevel\r
-and mEhcErrorLevel.\r
\r
Revision History\r
\r
\r
#include "Ehci.h"\r
\r
-#ifdef EFI_DEBUG\r
-UINTN mEhcDebugMask = USB_DEBUG_FORCE_OUTPUT;\r
-\r
-\r
-/**\r
- EHCI's debug output function. It determines whether\r
- to output by the mask and level\r
-\r
- @param Level The output level\r
- @param Format The format parameters to the print\r
- @param ... The variable length parameters after format\r
-\r
- @return None\r
-\r
-**/\r
-VOID\r
-EhciDebugPrint (\r
- IN UINTN Level,\r
- IN CHAR8 *Format,\r
- ...\r
- )\r
-{\r
-\r
- VA_LIST Marker;\r
-\r
- VA_START (Marker, Format);\r
-\r
- if (Level & mEhcDebugMask) {\r
- if (mEhcDebugMask & USB_DEBUG_FORCE_OUTPUT) {\r
- DebugVPrint (DEBUG_ERROR, Format, Marker);\r
- } else {\r
- DebugVPrint (DEBUG_INFO, Format, Marker);\r
- }\r
- }\r
-\r
- VA_END (Marker);\r
-}\r
-\r
-\r
-/**\r
- EHCI's debug output function. It determines whether\r
- to output by the mask and level\r
-\r
- @param Format The format parameters to the print\r
- @param ... The variable length parameters after format\r
-\r
- @return None\r
-\r
-**/\r
-VOID\r
-EhcDebug (\r
- IN CHAR8 *Format,\r
- ...\r
- )\r
-{\r
- VA_LIST Marker;\r
-\r
- VA_START (Marker, Format);\r
- DebugVPrint (DEBUG_INFO, Format, Marker);\r
- VA_END (Marker);\r
-}\r
-\r
-\r
-/**\r
- EHCI's error output function. It determines whether\r
- to output by the mask and level\r
-\r
- @param Format The format parameters to the print\r
- @param ... The variable length parameters after format\r
-\r
- @return None\r
-\r
-**/\r
-VOID\r
-EhcError (\r
- IN CHAR8 *Format,\r
- ...\r
- )\r
-{\r
-\r
- VA_LIST Marker;\r
-\r
- VA_START (Marker, Format);\r
- DebugVPrint (DEBUG_ERROR, Format, Marker);\r
- VA_END (Marker);\r
-}\r
-\r
-\r
/**\r
Dump the status byte in QTD/QH to a more friendly\r
format\r
\r
@param State The state in the QTD/QH\r
- @param Level The output level\r
\r
@return None\r
\r
STATIC\r
VOID\r
EhcDumpStatus (\r
- IN UINT32 State,\r
- IN UINTN Level\r
+ IN UINT32 State\r
)\r
{\r
if (EHC_BIT_IS_SET (State, QTD_STAT_DO_PING)) {\r
- EhciDebugPrint (Level, " Do_Ping");\r
+ DEBUG ((EFI_D_INFO, " Do_Ping"));\r
} else {\r
- EhciDebugPrint (Level, " Do_Out");\r
+ DEBUG ((EFI_D_INFO, " Do_Out"));\r
}\r
\r
if (EHC_BIT_IS_SET (State, QTD_STAT_DO_CS)) {\r
- EhciDebugPrint (Level, " Do_CS");\r
+ DEBUG ((EFI_D_INFO, " Do_CS"));\r
} else {\r
- EhciDebugPrint (Level, " Do_SS");\r
+ DEBUG ((EFI_D_INFO, " Do_SS"));\r
}\r
\r
if (EHC_BIT_IS_SET (State, QTD_STAT_TRANS_ERR)) {\r
- EhciDebugPrint (Level, " Transfer_Error");\r
+ DEBUG ((EFI_D_INFO, " Transfer_Error"));\r
}\r
\r
if (EHC_BIT_IS_SET (State, QTD_STAT_BABBLE_ERR)) {\r
- EhciDebugPrint (Level, " Babble_Error");\r
+ DEBUG ((EFI_D_INFO, " Babble_Error"));\r
}\r
\r
if (EHC_BIT_IS_SET (State, QTD_STAT_BUFF_ERR)) {\r
- EhciDebugPrint (Level, " Buffer_Error");\r
+ DEBUG ((EFI_D_INFO, " Buffer_Error"));\r
}\r
\r
if (EHC_BIT_IS_SET (State, QTD_STAT_HALTED)) {\r
- EhciDebugPrint (Level, " Halted");\r
+ DEBUG ((EFI_D_INFO, " Halted"));\r
}\r
\r
if (EHC_BIT_IS_SET (State, QTD_STAT_ACTIVE)) {\r
- EhciDebugPrint (Level, " Active");\r
+ DEBUG ((EFI_D_INFO, " Active"));\r
}\r
\r
- EhciDebugPrint (Level, "\n");\r
+ DEBUG ((EFI_D_INFO, "\n"));\r
}\r
\r
\r
VOID\r
EhcDumpQtd (\r
IN EHC_QTD *Qtd,\r
- IN UINT8 *Msg\r
+ IN CHAR8 *Msg\r
)\r
{\r
QTD_HW *QtdHw;\r
UINTN Index;\r
- UINTN Level;\r
-\r
- Level = EHC_DEBUG_QTD;\r
\r
if (Msg != NULL) {\r
- EhciDebugPrint (Level, Msg);\r
+ DEBUG ((EFI_D_INFO, Msg));\r
}\r
\r
- EhciDebugPrint (Level, "Queue TD @ 0x%x, data length %d\n", Qtd, Qtd->DataLen);\r
+ DEBUG ((EFI_D_INFO, "Queue TD @ 0x%x, data length %d\n", Qtd, Qtd->DataLen));\r
\r
QtdHw = &Qtd->QtdHw;\r
\r
- EhciDebugPrint (Level, "Next QTD : %x\n", QtdHw->NextQtd);\r
- EhciDebugPrint (Level, "AltNext QTD : %x\n", QtdHw->AltNext);\r
- EhciDebugPrint (Level, "Status : %x\n", QtdHw->Status);\r
- EhcDumpStatus (QtdHw->Status, Level);\r
+ DEBUG ((EFI_D_INFO, "Next QTD : %x\n", QtdHw->NextQtd));\r
+ DEBUG ((EFI_D_INFO, "AltNext QTD : %x\n", QtdHw->AltNext));\r
+ DEBUG ((EFI_D_INFO, "Status : %x\n", QtdHw->Status));\r
+ EhcDumpStatus (QtdHw->Status);\r
\r
if (QtdHw->Pid == QTD_PID_SETUP) {\r
- EhciDebugPrint (Level, "PID : Setup\n");\r
+ DEBUG ((EFI_D_INFO, "PID : Setup\n"));\r
\r
} else if (QtdHw->Pid == QTD_PID_INPUT) {\r
- EhciDebugPrint (Level, "PID : IN\n");\r
+ DEBUG ((EFI_D_INFO, "PID : IN\n"));\r
\r
} else if (QtdHw->Pid == QTD_PID_OUTPUT) {\r
- EhciDebugPrint (Level, "PID : OUT\n");\r
+ DEBUG ((EFI_D_INFO, "PID : OUT\n"));\r
\r
}\r
\r
- EhciDebugPrint (Level, "Error Count : %d\n", QtdHw->ErrCnt);\r
- EhciDebugPrint (Level, "Current Page : %d\n", QtdHw->CurPage);\r
- EhciDebugPrint (Level, "IOC : %d\n", QtdHw->IOC);\r
- EhciDebugPrint (Level, "Total Bytes : %d\n", QtdHw->TotalBytes);\r
- EhciDebugPrint (Level, "Data Toggle : %d\n", QtdHw->DataToggle);\r
+ DEBUG ((EFI_D_INFO, "Error Count : %d\n", QtdHw->ErrCnt));\r
+ DEBUG ((EFI_D_INFO, "Current Page : %d\n", QtdHw->CurPage));\r
+ DEBUG ((EFI_D_INFO, "IOC : %d\n", QtdHw->IOC));\r
+ DEBUG ((EFI_D_INFO, "Total Bytes : %d\n", QtdHw->TotalBytes));\r
+ DEBUG ((EFI_D_INFO, "Data Toggle : %d\n", QtdHw->DataToggle));\r
\r
for (Index = 0; Index < 5; Index++) {\r
- EhciDebugPrint (Level, "Page[%d] : 0x%x\n", Index, QtdHw->Page[Index]);\r
+ DEBUG ((EFI_D_INFO, "Page[%d] : 0x%x\n", Index, QtdHw->Page[Index]));\r
}\r
}\r
\r
VOID\r
EhcDumpQh (\r
IN EHC_QH *Qh,\r
- IN UINT8 *Msg,\r
+ IN CHAR8 *Msg,\r
IN BOOLEAN DumpBuf\r
)\r
{\r
QH_HW *QhHw;\r
LIST_ENTRY *Entry;\r
UINTN Index;\r
- UINTN Level;\r
-\r
- Level = EHC_DEBUG_QH;\r
\r
if (Msg != NULL) {\r
- EhciDebugPrint (Level, Msg);\r
+ DEBUG ((EFI_D_INFO, Msg));\r
}\r
\r
- EhciDebugPrint (Level, "Queue head @ 0x%x, interval %d, next qh %x\n",\r
- Qh, Qh->Interval, Qh->NextQh);\r
+ DEBUG ((EFI_D_INFO, "Queue head @ 0x%x, interval %d, next qh %x\n",\r
+ Qh, Qh->Interval, Qh->NextQh));\r
\r
QhHw = &Qh->QhHw;\r
\r
- EhciDebugPrint (Level, "Hoziontal link: %x\n", QhHw->HorizonLink);\r
- EhciDebugPrint (Level, "Device address: %d\n", QhHw->DeviceAddr);\r
- EhciDebugPrint (Level, "Inactive : %d\n", QhHw->Inactive);\r
- EhciDebugPrint (Level, "EP number : %d\n", QhHw->EpNum);\r
- EhciDebugPrint (Level, "EP speed : %d\n", QhHw->EpSpeed);\r
- EhciDebugPrint (Level, "DT control : %d\n", QhHw->DtCtrl);\r
- EhciDebugPrint (Level, "Reclaim head : %d\n", QhHw->ReclaimHead);\r
- EhciDebugPrint (Level, "Max packet len: %d\n", QhHw->MaxPacketLen);\r
- EhciDebugPrint (Level, "Ctrl EP : %d\n", QhHw->CtrlEp);\r
- EhciDebugPrint (Level, "Nak reload : %d\n", QhHw->NakReload);\r
-\r
- EhciDebugPrint (Level, "SMask : %x\n", QhHw->SMask);\r
- EhciDebugPrint (Level, "CMask : %x\n", QhHw->CMask);\r
- EhciDebugPrint (Level, "Hub address : %d\n", QhHw->HubAddr);\r
- EhciDebugPrint (Level, "Hub port : %d\n", QhHw->PortNum);\r
- EhciDebugPrint (Level, "Multiplier : %d\n", QhHw->Multiplier);\r
-\r
- EhciDebugPrint (Level, "Cur QTD : %x\n", QhHw->CurQtd);\r
-\r
- EhciDebugPrint (Level, "Next QTD : %x\n", QhHw->NextQtd);\r
- EhciDebugPrint (Level, "AltNext QTD : %x\n", QhHw->AltQtd);\r
- EhciDebugPrint (Level, "Status : %x\n", QhHw->Status);\r
- EhcDumpStatus (QhHw->Status, Level);\r
+ DEBUG ((EFI_D_INFO, "Hoziontal link: %x\n", QhHw->HorizonLink));\r
+ DEBUG ((EFI_D_INFO, "Device address: %d\n", QhHw->DeviceAddr));\r
+ DEBUG ((EFI_D_INFO, "Inactive : %d\n", QhHw->Inactive));\r
+ DEBUG ((EFI_D_INFO, "EP number : %d\n", QhHw->EpNum));\r
+ DEBUG ((EFI_D_INFO, "EP speed : %d\n", QhHw->EpSpeed));\r
+ DEBUG ((EFI_D_INFO, "DT control : %d\n", QhHw->DtCtrl));\r
+ DEBUG ((EFI_D_INFO, "Reclaim head : %d\n", QhHw->ReclaimHead));\r
+ DEBUG ((EFI_D_INFO, "Max packet len: %d\n", QhHw->MaxPacketLen));\r
+ DEBUG ((EFI_D_INFO, "Ctrl EP : %d\n", QhHw->CtrlEp));\r
+ DEBUG ((EFI_D_INFO, "Nak reload : %d\n", QhHw->NakReload));\r
+\r
+ DEBUG ((EFI_D_INFO, "SMask : %x\n", QhHw->SMask));\r
+ DEBUG ((EFI_D_INFO, "CMask : %x\n", QhHw->CMask));\r
+ DEBUG ((EFI_D_INFO, "Hub address : %d\n", QhHw->HubAddr));\r
+ DEBUG ((EFI_D_INFO, "Hub port : %d\n", QhHw->PortNum));\r
+ DEBUG ((EFI_D_INFO, "Multiplier : %d\n", QhHw->Multiplier));\r
+\r
+ DEBUG ((EFI_D_INFO, "Cur QTD : %x\n", QhHw->CurQtd));\r
+\r
+ DEBUG ((EFI_D_INFO, "Next QTD : %x\n", QhHw->NextQtd));\r
+ DEBUG ((EFI_D_INFO, "AltNext QTD : %x\n", QhHw->AltQtd));\r
+ DEBUG ((EFI_D_INFO, "Status : %x\n", QhHw->Status));\r
+\r
+ EhcDumpStatus (QhHw->Status);\r
\r
if (QhHw->Pid == QTD_PID_SETUP) {\r
- EhciDebugPrint (Level, "PID : Setup\n");\r
+ DEBUG ((EFI_D_INFO, "PID : Setup\n"));\r
\r
} else if (QhHw->Pid == QTD_PID_INPUT) {\r
- EhciDebugPrint (Level, "PID : IN\n");\r
+ DEBUG ((EFI_D_INFO, "PID : IN\n"));\r
\r
} else if (QhHw->Pid == QTD_PID_OUTPUT) {\r
- EhciDebugPrint (Level, "PID : OUT\n");\r
+ DEBUG ((EFI_D_INFO, "PID : OUT\n"));\r
}\r
\r
- EhciDebugPrint (Level, "Error Count : %d\n", QhHw->ErrCnt);\r
- EhciDebugPrint (Level, "Current Page : %d\n", QhHw->CurPage);\r
- EhciDebugPrint (Level, "IOC : %d\n", QhHw->IOC);\r
- EhciDebugPrint (Level, "Total Bytes : %d\n", QhHw->TotalBytes);\r
- EhciDebugPrint (Level, "Data Toggle : %d\n", QhHw->DataToggle);\r
+ DEBUG ((EFI_D_INFO, "Error Count : %d\n", QhHw->ErrCnt));\r
+ DEBUG ((EFI_D_INFO, "Current Page : %d\n", QhHw->CurPage));\r
+ DEBUG ((EFI_D_INFO, "IOC : %d\n", QhHw->IOC));\r
+ DEBUG ((EFI_D_INFO, "Total Bytes : %d\n", QhHw->TotalBytes));\r
+ DEBUG ((EFI_D_INFO, "Data Toggle : %d\n", QhHw->DataToggle));\r
\r
for (Index = 0; Index < 5; Index++) {\r
- EhciDebugPrint (Level, "Page[%d] : 0x%x\n", Index, QhHw->Page[Index]);\r
+ DEBUG ((EFI_D_INFO, "Page[%d] : 0x%x\n", Index, QhHw->Page[Index]));\r
}\r
\r
- EhciDebugPrint (Level, "\n");\r
+ DEBUG ((EFI_D_INFO, "\n"));\r
\r
EFI_LIST_FOR_EACH (Entry, &Qh->Qtds) {\r
Qtd = EFI_LIST_CONTAINER (Entry, EHC_QTD, QtdList);\r
\r
for (Index = 0; Index < Len; Index++) {\r
if (Index % 16 == 0) {\r
- EhciDebugPrint (EHC_DEBUG_BUF, "\n");\r
+ DEBUG ((EFI_D_INFO,"\n"));\r
}\r
\r
- EhciDebugPrint (EHC_DEBUG_BUF, "%02x ", Buf[Index]);\r
+ DEBUG ((EFI_D_INFO, "%02x ", Buf[Index]));\r
}\r
\r
- EhciDebugPrint (EHC_DEBUG_BUF, "\n");\r
+ DEBUG ((EFI_D_INFO, "\n"));\r
}\r
-\r
-#endif\r