1. Added EFI_MEDIA_CHANGED and EFI_INVALID_PARAMETER returns in UsbMassReadBlocks().
2. Use DEBUG () to replace some native debug function in USB stack modules. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4689 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -81,7 +81,7 @@ EhcGetCapability (
|
||||
*PortNumber = (UINT8) (Ehc->HcStructParams & HCSP_NPORTS);
|
||||
*Is64BitCapable = (UINT8) (Ehc->HcCapParams & HCCP_64BIT);
|
||||
|
||||
EHC_DEBUG (("EhcGetCapability: %d ports, 64 bit %d\n", *PortNumber, *Is64BitCapable));
|
||||
DEBUG ((EFI_D_INFO, "EhcGetCapability: %d ports, 64 bit %d\n", *PortNumber, *Is64BitCapable));
|
||||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return EFI_SUCCESS;
|
||||
@@ -161,7 +161,7 @@ EhcReset (
|
||||
}
|
||||
|
||||
ON_EXIT:
|
||||
EHC_DEBUG (("EhcReset: exit status %r\n", Status));
|
||||
DEBUG ((EFI_D_INFO, "EhcReset: exit status %r\n", Status));
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return Status;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ EhcGetState (
|
||||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
EHC_DEBUG (("EhcGetState: current state %d\n", *State));
|
||||
DEBUG ((EFI_D_INFO, "EhcGetState: current state %d\n", *State));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ EhcSetState (
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
EHC_DEBUG (("EhcSetState: exit status %r\n", Status));
|
||||
DEBUG ((EFI_D_INFO, "EhcSetState: exit status %r\n", Status));
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return Status;
|
||||
}
|
||||
@@ -450,7 +450,7 @@ EhcSetRootHubPortFeature (
|
||||
Status = EhcRunHC (Ehc, EHC_GENERIC_TIMEOUT);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_DEBUG (("EhcSetRootHubPortFeature :failed to start HC - %r\n", Status));
|
||||
DEBUG ((EFI_D_INFO, "EhcSetRootHubPortFeature :failed to start HC - %r\n", Status));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -480,7 +480,7 @@ EhcSetRootHubPortFeature (
|
||||
}
|
||||
|
||||
ON_EXIT:
|
||||
EHC_DEBUG (("EhcSetRootHubPortFeature: exit status %r\n", Status));
|
||||
DEBUG ((EFI_D_INFO, "EhcSetRootHubPortFeature: exit status %r\n", Status));
|
||||
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return Status;
|
||||
@@ -608,7 +608,7 @@ EhcClearRootHubPortFeature (
|
||||
}
|
||||
|
||||
ON_EXIT:
|
||||
EHC_DEBUG (("EhcClearRootHubPortFeature: exit status %r\n", Status));
|
||||
DEBUG ((EFI_D_INFO, "EhcClearRootHubPortFeature: exit status %r\n", Status));
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
return Status;
|
||||
}
|
||||
@@ -700,7 +700,7 @@ EhcControlTransfer (
|
||||
*TransferResult = EFI_USB_ERR_SYSTEM;
|
||||
|
||||
if (EhcIsHalt (Ehc) || EhcIsSysError (Ehc)) {
|
||||
EHC_ERROR (("EhcControlTransfer: HC halted at entrance\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcControlTransfer: HC halted at entrance\n"));
|
||||
|
||||
EhcAckAllInterrupt (Ehc);
|
||||
goto ON_EXIT;
|
||||
@@ -736,7 +736,7 @@ EhcControlTransfer (
|
||||
);
|
||||
|
||||
if (Urb == NULL) {
|
||||
EHC_ERROR (("EhcControlTransfer: failed to create URB"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcControlTransfer: failed to create URB"));
|
||||
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto ON_EXIT;
|
||||
@@ -765,7 +765,7 @@ ON_EXIT:
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcControlTransfer: error - %r, transfer - %x\n", Status, *TransferResult));
|
||||
DEBUG ((EFI_D_ERROR, "EhcControlTransfer: error - %r, transfer - %x\n", Status, *TransferResult));
|
||||
}
|
||||
|
||||
return Status;
|
||||
@@ -851,7 +851,7 @@ EhcBulkTransfer (
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
|
||||
if (EhcIsHalt (Ehc) || EhcIsSysError (Ehc)) {
|
||||
EHC_ERROR (("EhcBulkTransfer: HC is halted\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcBulkTransfer: HC is halted\n"));
|
||||
|
||||
EhcAckAllInterrupt (Ehc);
|
||||
goto ON_EXIT;
|
||||
@@ -881,7 +881,7 @@ EhcBulkTransfer (
|
||||
);
|
||||
|
||||
if (Urb == NULL) {
|
||||
EHC_ERROR (("EhcBulkTransfer: failed to create URB\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcBulkTransfer: failed to create URB\n"));
|
||||
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto ON_EXIT;
|
||||
@@ -907,7 +907,7 @@ ON_EXIT:
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcBulkTransfer: error - %r, transfer - %x\n", Status, *TransferResult));
|
||||
DEBUG ((EFI_D_ERROR, "EhcBulkTransfer: error - %r, transfer - %x\n", Status, *TransferResult));
|
||||
}
|
||||
|
||||
return Status;
|
||||
@@ -998,14 +998,14 @@ EhcAsyncInterruptTransfer (
|
||||
if (!IsNewTransfer) {
|
||||
Status = EhciDelAsyncIntTransfer (Ehc, DeviceAddress, EndPointAddress, DataToggle);
|
||||
|
||||
EHC_DEBUG (("EhcAsyncInterruptTransfer: remove old transfer - %r\n", Status));
|
||||
DEBUG ((EFI_D_INFO, "EhcAsyncInterruptTransfer: remove old transfer - %r\n", Status));
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
if (EhcIsHalt (Ehc) || EhcIsSysError (Ehc)) {
|
||||
EHC_ERROR (("EhcAsyncInterruptTransfer: HC is halt\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcAsyncInterruptTransfer: HC is halt\n"));
|
||||
EhcAckAllInterrupt (Ehc);
|
||||
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
@@ -1017,7 +1017,7 @@ EhcAsyncInterruptTransfer (
|
||||
Data = AllocatePool (DataLength);
|
||||
|
||||
if (Data == NULL) {
|
||||
EHC_ERROR (("EhcAsyncInterruptTransfer: failed to allocate buffer\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcAsyncInterruptTransfer: failed to allocate buffer\n"));
|
||||
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto ON_EXIT;
|
||||
@@ -1041,7 +1041,7 @@ EhcAsyncInterruptTransfer (
|
||||
);
|
||||
|
||||
if (Urb == NULL) {
|
||||
EHC_ERROR (("EhcAsyncInterruptTransfer: failed to create URB\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcAsyncInterruptTransfer: failed to create URB\n"));
|
||||
|
||||
gBS->FreePool (Data);
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
@@ -1141,7 +1141,7 @@ EhcSyncInterruptTransfer (
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
|
||||
if (EhcIsHalt (Ehc) || EhcIsSysError (Ehc)) {
|
||||
EHC_ERROR (("EhcSyncInterruptTransfer: HC is halt\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcSyncInterruptTransfer: HC is halt\n"));
|
||||
|
||||
EhcAckAllInterrupt (Ehc);
|
||||
goto ON_EXIT;
|
||||
@@ -1167,7 +1167,7 @@ EhcSyncInterruptTransfer (
|
||||
);
|
||||
|
||||
if (Urb == NULL) {
|
||||
EHC_ERROR (("EhcSyncInterruptTransfer: failed to create URB\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcSyncInterruptTransfer: failed to create URB\n"));
|
||||
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto ON_EXIT;
|
||||
@@ -1190,7 +1190,7 @@ ON_EXIT:
|
||||
gBS->RestoreTPL (OldTpl);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcSyncInterruptTransfer: error - %r, transfer - %x\n", Status, *TransferResult));
|
||||
DEBUG ((EFI_D_ERROR, "EhcSyncInterruptTransfer: error - %r, transfer - %x\n", Status, *TransferResult));
|
||||
}
|
||||
|
||||
return Status;
|
||||
@@ -1448,7 +1448,7 @@ EhcCreateUsb2Hc (
|
||||
Ehc->HcCapParams = EhcReadCapRegister (Ehc, EHC_HCCPARAMS_OFFSET);
|
||||
Ehc->CapLen = EhcReadCapRegister (Ehc, EHC_CAPLENGTH_OFFSET) & 0x0FF;
|
||||
|
||||
EHC_DEBUG (("EhcCreateUsb2Hc: capability length %d\n", Ehc->CapLen));
|
||||
DEBUG ((EFI_D_INFO, "EhcCreateUsb2Hc: capability length %d\n", Ehc->CapLen));
|
||||
|
||||
//
|
||||
// Create AsyncRequest Polling Timer
|
||||
@@ -1511,7 +1511,7 @@ EhcDriverBindingStart (
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcDriverBindingStart: failed to open PCI_IO\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcDriverBindingStart: failed to open PCI_IO\n"));
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
@@ -1548,7 +1548,7 @@ EhcDriverBindingStart (
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcDriverBindingStart: failed to enable controller\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcDriverBindingStart: failed to enable controller\n"));
|
||||
goto CLOSE_PCIIO;
|
||||
}
|
||||
|
||||
@@ -1558,7 +1558,7 @@ EhcDriverBindingStart (
|
||||
Ehc = EhcCreateUsb2Hc (PciIo, OriginalPciAttributes);
|
||||
|
||||
if (Ehc == NULL) {
|
||||
EHC_ERROR (("EhcDriverBindingStart: failed to create USB2_HC\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcDriverBindingStart: failed to create USB2_HC\n"));
|
||||
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto CLOSE_PCIIO;
|
||||
@@ -1572,7 +1572,7 @@ EhcDriverBindingStart (
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcDriverBindingStart: failed to install USB2_HC Protocol\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcDriverBindingStart: failed to install USB2_HC Protocol\n"));
|
||||
goto FREE_POOL;
|
||||
}
|
||||
|
||||
@@ -1585,7 +1585,7 @@ EhcDriverBindingStart (
|
||||
Status = EhcInitHC (Ehc);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcDriverBindingStart: failed to init host controller\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcDriverBindingStart: failed to init host controller\n"));
|
||||
goto UNINSTALL_USBHC;
|
||||
}
|
||||
|
||||
@@ -1595,7 +1595,7 @@ EhcDriverBindingStart (
|
||||
Status = gBS->SetTimer (Ehc->PollTimer, TimerPeriodic, EHC_ASYNC_POLL_INTERVAL);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcDriverBindingStart: failed to start async interrupt monitor\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcDriverBindingStart: failed to start async interrupt monitor\n"));
|
||||
|
||||
EhcHaltHC (Ehc, EHC_GENERIC_TIMEOUT);
|
||||
goto UNINSTALL_USBHC;
|
||||
@@ -1621,7 +1621,7 @@ EhcDriverBindingStart (
|
||||
);
|
||||
|
||||
|
||||
EHC_DEBUG (("EhcDriverBindingStart: EHCI started for controller @ %x\n", Controller));
|
||||
DEBUG ((EFI_D_INFO, "EhcDriverBindingStart: EHCI started for controller @ %x\n", Controller));
|
||||
return EFI_SUCCESS;
|
||||
|
||||
UNINSTALL_USBHC:
|
||||
|
@@ -15,8 +15,6 @@ Module Name:
|
||||
|
||||
Abstract:
|
||||
This file provides the information dump support for EHCI when in debug mode.
|
||||
You can dynamically adjust the debug level by changing variable mEhcDebugLevel
|
||||
and mEhcErrorLevel.
|
||||
|
||||
Revision History
|
||||
|
||||
@@ -25,100 +23,11 @@ Revision History
|
||||
|
||||
#include "Ehci.h"
|
||||
|
||||
#ifdef EFI_DEBUG
|
||||
UINTN mEhcDebugMask = USB_DEBUG_FORCE_OUTPUT;
|
||||
|
||||
|
||||
/**
|
||||
EHCI's debug output function. It determines whether
|
||||
to output by the mask and level
|
||||
|
||||
@param Level The output level
|
||||
@param Format The format parameters to the print
|
||||
@param ... The variable length parameters after format
|
||||
|
||||
@return None
|
||||
|
||||
**/
|
||||
VOID
|
||||
EhciDebugPrint (
|
||||
IN UINTN Level,
|
||||
IN CHAR8 *Format,
|
||||
...
|
||||
)
|
||||
{
|
||||
|
||||
VA_LIST Marker;
|
||||
|
||||
VA_START (Marker, Format);
|
||||
|
||||
if (Level & mEhcDebugMask) {
|
||||
if (mEhcDebugMask & USB_DEBUG_FORCE_OUTPUT) {
|
||||
DebugVPrint (DEBUG_ERROR, Format, Marker);
|
||||
} else {
|
||||
DebugVPrint (DEBUG_INFO, Format, Marker);
|
||||
}
|
||||
}
|
||||
|
||||
VA_END (Marker);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
EHCI's debug output function. It determines whether
|
||||
to output by the mask and level
|
||||
|
||||
@param Format The format parameters to the print
|
||||
@param ... The variable length parameters after format
|
||||
|
||||
@return None
|
||||
|
||||
**/
|
||||
VOID
|
||||
EhcDebug (
|
||||
IN CHAR8 *Format,
|
||||
...
|
||||
)
|
||||
{
|
||||
VA_LIST Marker;
|
||||
|
||||
VA_START (Marker, Format);
|
||||
DebugVPrint (DEBUG_INFO, Format, Marker);
|
||||
VA_END (Marker);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
EHCI's error output function. It determines whether
|
||||
to output by the mask and level
|
||||
|
||||
@param Format The format parameters to the print
|
||||
@param ... The variable length parameters after format
|
||||
|
||||
@return None
|
||||
|
||||
**/
|
||||
VOID
|
||||
EhcError (
|
||||
IN CHAR8 *Format,
|
||||
...
|
||||
)
|
||||
{
|
||||
|
||||
VA_LIST Marker;
|
||||
|
||||
VA_START (Marker, Format);
|
||||
DebugVPrint (DEBUG_ERROR, Format, Marker);
|
||||
VA_END (Marker);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Dump the status byte in QTD/QH to a more friendly
|
||||
format
|
||||
|
||||
@param State The state in the QTD/QH
|
||||
@param Level The output level
|
||||
|
||||
@return None
|
||||
|
||||
@@ -126,43 +35,42 @@ EhcError (
|
||||
STATIC
|
||||
VOID
|
||||
EhcDumpStatus (
|
||||
IN UINT32 State,
|
||||
IN UINTN Level
|
||||
IN UINT32 State
|
||||
)
|
||||
{
|
||||
if (EHC_BIT_IS_SET (State, QTD_STAT_DO_PING)) {
|
||||
EhciDebugPrint (Level, " Do_Ping");
|
||||
DEBUG ((EFI_D_INFO, " Do_Ping"));
|
||||
} else {
|
||||
EhciDebugPrint (Level, " Do_Out");
|
||||
DEBUG ((EFI_D_INFO, " Do_Out"));
|
||||
}
|
||||
|
||||
if (EHC_BIT_IS_SET (State, QTD_STAT_DO_CS)) {
|
||||
EhciDebugPrint (Level, " Do_CS");
|
||||
DEBUG ((EFI_D_INFO, " Do_CS"));
|
||||
} else {
|
||||
EhciDebugPrint (Level, " Do_SS");
|
||||
DEBUG ((EFI_D_INFO, " Do_SS"));
|
||||
}
|
||||
|
||||
if (EHC_BIT_IS_SET (State, QTD_STAT_TRANS_ERR)) {
|
||||
EhciDebugPrint (Level, " Transfer_Error");
|
||||
DEBUG ((EFI_D_INFO, " Transfer_Error"));
|
||||
}
|
||||
|
||||
if (EHC_BIT_IS_SET (State, QTD_STAT_BABBLE_ERR)) {
|
||||
EhciDebugPrint (Level, " Babble_Error");
|
||||
DEBUG ((EFI_D_INFO, " Babble_Error"));
|
||||
}
|
||||
|
||||
if (EHC_BIT_IS_SET (State, QTD_STAT_BUFF_ERR)) {
|
||||
EhciDebugPrint (Level, " Buffer_Error");
|
||||
DEBUG ((EFI_D_INFO, " Buffer_Error"));
|
||||
}
|
||||
|
||||
if (EHC_BIT_IS_SET (State, QTD_STAT_HALTED)) {
|
||||
EhciDebugPrint (Level, " Halted");
|
||||
DEBUG ((EFI_D_INFO, " Halted"));
|
||||
}
|
||||
|
||||
if (EHC_BIT_IS_SET (State, QTD_STAT_ACTIVE)) {
|
||||
EhciDebugPrint (Level, " Active");
|
||||
DEBUG ((EFI_D_INFO, " Active"));
|
||||
}
|
||||
|
||||
EhciDebugPrint (Level, "\n");
|
||||
DEBUG ((EFI_D_INFO, "\n"));
|
||||
}
|
||||
|
||||
|
||||
@@ -178,47 +86,44 @@ EhcDumpStatus (
|
||||
VOID
|
||||
EhcDumpQtd (
|
||||
IN EHC_QTD *Qtd,
|
||||
IN UINT8 *Msg
|
||||
IN CHAR8 *Msg
|
||||
)
|
||||
{
|
||||
QTD_HW *QtdHw;
|
||||
UINTN Index;
|
||||
UINTN Level;
|
||||
|
||||
Level = EHC_DEBUG_QTD;
|
||||
|
||||
if (Msg != NULL) {
|
||||
EhciDebugPrint (Level, Msg);
|
||||
DEBUG ((EFI_D_INFO, Msg));
|
||||
}
|
||||
|
||||
EhciDebugPrint (Level, "Queue TD @ 0x%x, data length %d\n", Qtd, Qtd->DataLen);
|
||||
DEBUG ((EFI_D_INFO, "Queue TD @ 0x%x, data length %d\n", Qtd, Qtd->DataLen));
|
||||
|
||||
QtdHw = &Qtd->QtdHw;
|
||||
|
||||
EhciDebugPrint (Level, "Next QTD : %x\n", QtdHw->NextQtd);
|
||||
EhciDebugPrint (Level, "AltNext QTD : %x\n", QtdHw->AltNext);
|
||||
EhciDebugPrint (Level, "Status : %x\n", QtdHw->Status);
|
||||
EhcDumpStatus (QtdHw->Status, Level);
|
||||
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);
|
||||
|
||||
if (QtdHw->Pid == QTD_PID_SETUP) {
|
||||
EhciDebugPrint (Level, "PID : Setup\n");
|
||||
DEBUG ((EFI_D_INFO, "PID : Setup\n"));
|
||||
|
||||
} else if (QtdHw->Pid == QTD_PID_INPUT) {
|
||||
EhciDebugPrint (Level, "PID : IN\n");
|
||||
DEBUG ((EFI_D_INFO, "PID : IN\n"));
|
||||
|
||||
} else if (QtdHw->Pid == QTD_PID_OUTPUT) {
|
||||
EhciDebugPrint (Level, "PID : OUT\n");
|
||||
DEBUG ((EFI_D_INFO, "PID : OUT\n"));
|
||||
|
||||
}
|
||||
|
||||
EhciDebugPrint (Level, "Error Count : %d\n", QtdHw->ErrCnt);
|
||||
EhciDebugPrint (Level, "Current Page : %d\n", QtdHw->CurPage);
|
||||
EhciDebugPrint (Level, "IOC : %d\n", QtdHw->IOC);
|
||||
EhciDebugPrint (Level, "Total Bytes : %d\n", QtdHw->TotalBytes);
|
||||
EhciDebugPrint (Level, "Data Toggle : %d\n", QtdHw->DataToggle);
|
||||
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));
|
||||
|
||||
for (Index = 0; Index < 5; Index++) {
|
||||
EhciDebugPrint (Level, "Page[%d] : 0x%x\n", Index, QtdHw->Page[Index]);
|
||||
DEBUG ((EFI_D_INFO, "Page[%d] : 0x%x\n", Index, QtdHw->Page[Index]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +141,7 @@ EhcDumpQtd (
|
||||
VOID
|
||||
EhcDumpQh (
|
||||
IN EHC_QH *Qh,
|
||||
IN UINT8 *Msg,
|
||||
IN CHAR8 *Msg,
|
||||
IN BOOLEAN DumpBuf
|
||||
)
|
||||
{
|
||||
@@ -244,64 +149,62 @@ EhcDumpQh (
|
||||
QH_HW *QhHw;
|
||||
LIST_ENTRY *Entry;
|
||||
UINTN Index;
|
||||
UINTN Level;
|
||||
|
||||
Level = EHC_DEBUG_QH;
|
||||
|
||||
if (Msg != NULL) {
|
||||
EhciDebugPrint (Level, Msg);
|
||||
DEBUG ((EFI_D_INFO, Msg));
|
||||
}
|
||||
|
||||
EhciDebugPrint (Level, "Queue head @ 0x%x, interval %d, next qh %x\n",
|
||||
Qh, Qh->Interval, Qh->NextQh);
|
||||
DEBUG ((EFI_D_INFO, "Queue head @ 0x%x, interval %d, next qh %x\n",
|
||||
Qh, Qh->Interval, Qh->NextQh));
|
||||
|
||||
QhHw = &Qh->QhHw;
|
||||
|
||||
EhciDebugPrint (Level, "Hoziontal link: %x\n", QhHw->HorizonLink);
|
||||
EhciDebugPrint (Level, "Device address: %d\n", QhHw->DeviceAddr);
|
||||
EhciDebugPrint (Level, "Inactive : %d\n", QhHw->Inactive);
|
||||
EhciDebugPrint (Level, "EP number : %d\n", QhHw->EpNum);
|
||||
EhciDebugPrint (Level, "EP speed : %d\n", QhHw->EpSpeed);
|
||||
EhciDebugPrint (Level, "DT control : %d\n", QhHw->DtCtrl);
|
||||
EhciDebugPrint (Level, "Reclaim head : %d\n", QhHw->ReclaimHead);
|
||||
EhciDebugPrint (Level, "Max packet len: %d\n", QhHw->MaxPacketLen);
|
||||
EhciDebugPrint (Level, "Ctrl EP : %d\n", QhHw->CtrlEp);
|
||||
EhciDebugPrint (Level, "Nak reload : %d\n", QhHw->NakReload);
|
||||
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));
|
||||
|
||||
EhciDebugPrint (Level, "SMask : %x\n", QhHw->SMask);
|
||||
EhciDebugPrint (Level, "CMask : %x\n", QhHw->CMask);
|
||||
EhciDebugPrint (Level, "Hub address : %d\n", QhHw->HubAddr);
|
||||
EhciDebugPrint (Level, "Hub port : %d\n", QhHw->PortNum);
|
||||
EhciDebugPrint (Level, "Multiplier : %d\n", QhHw->Multiplier);
|
||||
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));
|
||||
|
||||
EhciDebugPrint (Level, "Cur QTD : %x\n", QhHw->CurQtd);
|
||||
DEBUG ((EFI_D_INFO, "Cur QTD : %x\n", QhHw->CurQtd));
|
||||
|
||||
EhciDebugPrint (Level, "Next QTD : %x\n", QhHw->NextQtd);
|
||||
EhciDebugPrint (Level, "AltNext QTD : %x\n", QhHw->AltQtd);
|
||||
EhciDebugPrint (Level, "Status : %x\n", QhHw->Status);
|
||||
EhcDumpStatus (QhHw->Status, Level);
|
||||
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);
|
||||
|
||||
if (QhHw->Pid == QTD_PID_SETUP) {
|
||||
EhciDebugPrint (Level, "PID : Setup\n");
|
||||
DEBUG ((EFI_D_INFO, "PID : Setup\n"));
|
||||
|
||||
} else if (QhHw->Pid == QTD_PID_INPUT) {
|
||||
EhciDebugPrint (Level, "PID : IN\n");
|
||||
DEBUG ((EFI_D_INFO, "PID : IN\n"));
|
||||
|
||||
} else if (QhHw->Pid == QTD_PID_OUTPUT) {
|
||||
EhciDebugPrint (Level, "PID : OUT\n");
|
||||
DEBUG ((EFI_D_INFO, "PID : OUT\n"));
|
||||
}
|
||||
|
||||
EhciDebugPrint (Level, "Error Count : %d\n", QhHw->ErrCnt);
|
||||
EhciDebugPrint (Level, "Current Page : %d\n", QhHw->CurPage);
|
||||
EhciDebugPrint (Level, "IOC : %d\n", QhHw->IOC);
|
||||
EhciDebugPrint (Level, "Total Bytes : %d\n", QhHw->TotalBytes);
|
||||
EhciDebugPrint (Level, "Data Toggle : %d\n", QhHw->DataToggle);
|
||||
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));
|
||||
|
||||
for (Index = 0; Index < 5; Index++) {
|
||||
EhciDebugPrint (Level, "Page[%d] : 0x%x\n", Index, QhHw->Page[Index]);
|
||||
DEBUG ((EFI_D_INFO, "Page[%d] : 0x%x\n", Index, QhHw->Page[Index]));
|
||||
}
|
||||
|
||||
EhciDebugPrint (Level, "\n");
|
||||
DEBUG ((EFI_D_INFO, "\n"));
|
||||
|
||||
EFI_LIST_FOR_EACH (Entry, &Qh->Qtds) {
|
||||
Qtd = EFI_LIST_CONTAINER (Entry, EHC_QTD, QtdList);
|
||||
@@ -333,13 +236,11 @@ EhcDumpBuf (
|
||||
|
||||
for (Index = 0; Index < Len; Index++) {
|
||||
if (Index % 16 == 0) {
|
||||
EhciDebugPrint (EHC_DEBUG_BUF, "\n");
|
||||
DEBUG ((EFI_D_INFO,"\n"));
|
||||
}
|
||||
|
||||
EhciDebugPrint (EHC_DEBUG_BUF, "%02x ", Buf[Index]);
|
||||
DEBUG ((EFI_D_INFO, "%02x ", Buf[Index]));
|
||||
}
|
||||
|
||||
EhciDebugPrint (EHC_DEBUG_BUF, "\n");
|
||||
DEBUG ((EFI_D_INFO, "\n"));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -25,73 +25,6 @@ Revision History
|
||||
#define _EFI_EHCI_DEBUG_H_
|
||||
|
||||
|
||||
enum {
|
||||
USB_DEBUG_FORCE_OUTPUT = (UINTN)(1 << 0),
|
||||
|
||||
EHC_DEBUG_QH = (UINTN)(1 << 8),
|
||||
EHC_DEBUG_QTD = (UINTN)(1 << 9),
|
||||
EHC_DEBUG_BUF = (UINTN)(1 << 10)
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
EHCI's debug output function. It determines whether
|
||||
to output by the mask and level
|
||||
|
||||
@param Level The output level
|
||||
@param Format The format parameters to the print
|
||||
@param ... The variable length parameters after format
|
||||
|
||||
@return None
|
||||
|
||||
**/
|
||||
VOID
|
||||
EhciDebugPrint (
|
||||
IN UINTN Level,
|
||||
IN CHAR8 *Format,
|
||||
...
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
/**
|
||||
EHCI's debug output function. It determines whether
|
||||
to output by the mask and level
|
||||
|
||||
@param Format The format parameters to the print
|
||||
@param ... The variable length parameters after format
|
||||
|
||||
@return None
|
||||
|
||||
**/
|
||||
VOID
|
||||
EhcDebug (
|
||||
IN CHAR8 *Format,
|
||||
...
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
EHCI's error output function. It determines whether
|
||||
to output by the mask and level
|
||||
|
||||
@param Format The format parameters to the print
|
||||
@param ... The variable length parameters after format
|
||||
|
||||
@return None
|
||||
|
||||
**/
|
||||
VOID
|
||||
EhcError (
|
||||
IN CHAR8 *Format,
|
||||
...
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Dump the fields of a QTD
|
||||
|
||||
@@ -104,7 +37,7 @@ EhcError (
|
||||
VOID
|
||||
EhcDumpQtd (
|
||||
IN EHC_QTD *Qtd,
|
||||
IN UINT8 *Msg
|
||||
IN CHAR8 *Msg
|
||||
)
|
||||
;
|
||||
|
||||
@@ -123,7 +56,7 @@ EhcDumpQtd (
|
||||
VOID
|
||||
EhcDumpQh (
|
||||
IN EHC_QH *Qh,
|
||||
IN UINT8 *Msg,
|
||||
IN CHAR8 *Msg,
|
||||
IN BOOLEAN DumpBuf
|
||||
)
|
||||
;
|
||||
@@ -146,18 +79,4 @@ EhcDumpBuf (
|
||||
)
|
||||
;
|
||||
|
||||
#ifdef EFI_DEBUG
|
||||
#define EHC_DEBUG(arg) EhcDebug arg
|
||||
#define EHC_ERROR(arg) EhcError arg
|
||||
#define EHC_DUMP_QH(arg) EhcDumpQh arg
|
||||
#define EHC_DUMP_QTD(arg) EhcDumpQtd arg
|
||||
#define EHC_DUMP_BUF(arg) EhcDumpBuf arg
|
||||
#else
|
||||
#define EHC_DEBUG(arg)
|
||||
#define EHC_ERROR(arg)
|
||||
#define EHC_DUMP_QH(arg)
|
||||
#define EHC_DUMP_QTD(arg)
|
||||
#define EHC_DUMP_BUF(arg)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -54,7 +54,7 @@ EhcReadCapRegister (
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcReadCapRegister: Pci Io read error - %r at %d\n", Status, Offset));
|
||||
DEBUG ((EFI_D_ERROR, "EhcReadCapRegister: Pci Io read error - %r at %d\n", Status, Offset));
|
||||
Data = 0xFFFF;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ EhcReadOpReg (
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcReadOpReg: Pci Io Read error - %r at %d\n", Status, Offset));
|
||||
DEBUG ((EFI_D_ERROR, "EhcReadOpReg: Pci Io Read error - %r at %d\n", Status, Offset));
|
||||
Data = 0xFFFF;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ EhcWriteOpReg (
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcWriteOpReg: Pci Io Write error: %r at %d\n", Status, Offset));
|
||||
DEBUG ((EFI_D_ERROR, "EhcWriteOpReg: Pci Io Write error: %r at %d\n", Status, Offset));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ EhcClearLegacySupport (
|
||||
UINT32 Value;
|
||||
UINT32 TimeOut;
|
||||
|
||||
EHC_DEBUG (("EhcClearLegacySupport: called to clear legacy support\n"));
|
||||
DEBUG ((EFI_D_INFO, "EhcClearLegacySupport: called to clear legacy support\n"));
|
||||
|
||||
PciIo = Ehc->PciIo;
|
||||
ExtendCap = (Ehc->HcCapParams >> 8) & 0xFF;
|
||||
@@ -622,14 +622,14 @@ EhcInitHC (
|
||||
Status = EhcEnablePeriodSchd (Ehc, EHC_GENERIC_TIMEOUT);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcInitHC: failed to enable period schedule\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcInitHC: failed to enable period schedule\n"));
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = EhcEnableAsyncSchd (Ehc, EHC_GENERIC_TIMEOUT);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcInitHC: failed to enable async schedule\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcInitHC: failed to enable async schedule\n"));
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@@ -345,7 +345,7 @@ EhcUnlinkQhFromAsync (
|
||||
Status = EhcSetAndWaitDoorBell (Ehc, EHC_GENERIC_TIMEOUT);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcUnlinkQhFromAsync: Failed to synchronize with doorbell\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcUnlinkQhFromAsync: Failed to synchronize with doorbell\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -598,7 +598,7 @@ EhcCheckUrbResult (
|
||||
}
|
||||
|
||||
if ((QtdHw->TotalBytes != 0) && (QtdHw->Pid == QTD_PID_INPUT)) {
|
||||
EHC_DUMP_QH ((Urb->Qh, "Short packet read", FALSE));
|
||||
EhcDumpQh (Urb->Qh, "Short packet read", FALSE);
|
||||
|
||||
//
|
||||
// Short packet read condition. If it isn't a setup transfer,
|
||||
@@ -607,13 +607,13 @@ EhcCheckUrbResult (
|
||||
// Status Stage of the setup transfer to get the finial result
|
||||
//
|
||||
if (QtdHw->AltNext == QTD_LINK (Ehc->ShortReadStop, FALSE)) {
|
||||
EHC_DEBUG (("EhcCheckUrbResult: Short packet read, break\n"));
|
||||
DEBUG ((EFI_D_INFO, "EhcCheckUrbResult: Short packet read, break\n"));
|
||||
|
||||
Finished = TRUE;
|
||||
goto ON_EXIT;
|
||||
}
|
||||
|
||||
EHC_DEBUG (("EhcCheckUrbResult: Short packet read, continue\n"));
|
||||
DEBUG ((EFI_D_INFO, "EhcCheckUrbResult: Short packet read, continue\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -673,14 +673,14 @@ EhcExecTransfer (
|
||||
}
|
||||
|
||||
if (!Finished) {
|
||||
EHC_ERROR (("EhcExecTransfer: transfer not finished in %dms\n", TimeOut));
|
||||
EHC_DUMP_QH ((Urb->Qh, NULL, FALSE));
|
||||
DEBUG ((EFI_D_ERROR, "EhcExecTransfer: transfer not finished in %dms\n", TimeOut));
|
||||
EhcDumpQh (Urb->Qh, NULL, FALSE);
|
||||
|
||||
Status = EFI_TIMEOUT;
|
||||
|
||||
} else if (Urb->Result != EFI_USB_NOERROR) {
|
||||
EHC_ERROR (("EhcExecTransfer: transfer failed with %x\n", Urb->Result));
|
||||
EHC_DUMP_QH ((Urb->Qh, NULL, FALSE));
|
||||
DEBUG ((EFI_D_ERROR, "EhcExecTransfer: transfer failed with %x\n", Urb->Result));
|
||||
EhcDumpQh (Urb->Qh, NULL, FALSE);
|
||||
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
}
|
||||
@@ -781,14 +781,14 @@ EhcFlushAsyncIntMap (
|
||||
|
||||
Routine Description:
|
||||
|
||||
Flush data from PCI controller specific address to mapped system
|
||||
Flush data from PCI controller specific address to mapped system
|
||||
memory address.
|
||||
|
||||
Arguments:
|
||||
|
||||
Ehc - The EHCI device
|
||||
Urb - The URB to unmap
|
||||
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_SUCCESS - Success to flush data to mapped system memory
|
||||
@@ -811,7 +811,7 @@ Returns:
|
||||
} else {
|
||||
MapOp = EfiPciIoOperationBusMasterRead;
|
||||
}
|
||||
|
||||
|
||||
Status = PciIo->Unmap (PciIo, Urb->DataMap);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto ON_ERROR;
|
||||
@@ -953,14 +953,14 @@ EhcMoniteAsyncRequests (
|
||||
}
|
||||
|
||||
//
|
||||
// Flush any PCI posted write transactions from a PCI host
|
||||
// Flush any PCI posted write transactions from a PCI host
|
||||
// bridge to system memory.
|
||||
//
|
||||
Status = EhcFlushAsyncIntMap (Ehc, Urb);
|
||||
if (EFI_ERROR (Status)) {
|
||||
EHC_ERROR (("EhcMoniteAsyncRequests: Fail to Flush AsyncInt Mapped Memeory\n"));
|
||||
DEBUG ((EFI_D_ERROR, "EhcMoniteAsyncRequests: Fail to Flush AsyncInt Mapped Memeory\n"));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Allocate a buffer then copy the transferred data for user.
|
||||
// If failed to allocate the buffer, update the URB for next
|
||||
|
@@ -24,9 +24,6 @@ Revision History
|
||||
#include "Ehci.h"
|
||||
|
||||
|
||||
UINTN mUsbHcDebugLevel = DEBUG_INFO;
|
||||
|
||||
|
||||
/**
|
||||
Allocate a block of memory to be used by the buffer pool
|
||||
|
||||
@@ -117,9 +114,6 @@ UsbHcAllocMemBlock (
|
||||
Block->Buf = (UINT8 *) ((UINTN) MappedAddr);
|
||||
Block->Mapping = Mapping;
|
||||
|
||||
DEBUG ((mUsbHcDebugLevel, "UsbHcAllocMemBlock: block %x created with buffer %x\n",
|
||||
Block, Block->Buf));
|
||||
|
||||
return Block;
|
||||
|
||||
FREE_BUFFER:
|
||||
@@ -455,7 +449,7 @@ UsbHcAllocateMem (
|
||||
NewBlock = UsbHcAllocMemBlock (Pool, Pages);
|
||||
|
||||
if (NewBlock == NULL) {
|
||||
DEBUG ((mUsbHcDebugLevel, "UsbHcAllocateMem: failed to allocate block\n"));
|
||||
DEBUG ((EFI_D_INFO, "UsbHcAllocateMem: failed to allocate block\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -539,8 +533,6 @@ UsbHcFreeMem (
|
||||
// Release the current memory block if it is empty and not the head
|
||||
//
|
||||
if ((Block != Head) && UsbHcIsMemBlockEmpty (Block)) {
|
||||
DEBUG ((mUsbHcDebugLevel, "UsbHcFreeMem: block %x is empty, recycle\n", Block));
|
||||
|
||||
UsbHcUnlinkMemBlock (Head, Block);
|
||||
UsbHcFreeMemBlock (Pool, Block);
|
||||
}
|
||||
|
Reference in New Issue
Block a user