diff options
-rw-r--r-- | MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c | 56 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c | 235 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.h | 85 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c | 12 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c | 28 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/EhciDxe/UsbHcMem.c | 10 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c | 4 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/UhciDxe/UhciDebug.c | 140 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/UhciDxe/UhciDebug.h | 76 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c | 10 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.c | 20 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c | 10 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMass.h | 4 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c | 20 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c | 27 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassCbi.c | 9 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c | 85 |
17 files changed, 239 insertions, 592 deletions
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c index e37cf71..e8fb112 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c +++ b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c @@ -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:
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c index 086cdbc..25a4dbf 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c +++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c @@ -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);
-
- 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);
-
- EhciDebugPrint (Level, "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, "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);
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
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.h b/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.h index 4df8e9e..3dd4074 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.h +++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.h @@ -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
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c index 45b6df5..b40b011 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c +++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciReg.c @@ -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;
}
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c index 349b5c2..60b095f 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c +++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c @@ -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
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/UsbHcMem.c b/MdeModulePkg/Bus/Pci/EhciDxe/UsbHcMem.c index c1b0f49..d038ebc 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/UsbHcMem.c +++ b/MdeModulePkg/Bus/Pci/EhciDxe/UsbHcMem.c @@ -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);
}
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c index 7f43517..d129af8 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c +++ b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c @@ -320,7 +320,7 @@ Uhci2GetCapability ( Uhc->RootPorts = *PortNumber;
- UHCI_DEBUG (("Uhci2GetCapability: %d ports\n", Uhc->RootPorts));
+ DEBUG ((EFI_D_INFO, "Uhci2GetCapability: %d ports\n", Uhc->RootPorts));
return EFI_SUCCESS;
}
@@ -376,7 +376,7 @@ Uhci2GetRootHubPortStatus ( }
if (PortSC & USBPORTSC_SUSP) {
- UHCI_DEBUG (("Uhci2GetRootHubPortStatus: port %d is suspended\n", PortNumber));
+ DEBUG ((EFI_D_INFO, "Uhci2GetRootHubPortStatus: port %d is suspended\n", PortNumber));
PortStatus->PortStatus |= USB_PORT_STAT_SUSPEND;
}
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UhciDebug.c b/MdeModulePkg/Bus/Pci/UhciDxe/UhciDebug.c index d47314f..117bef2 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/UhciDebug.c +++ b/MdeModulePkg/Bus/Pci/UhciDxe/UhciDebug.c @@ -16,8 +16,6 @@ Module Name: Abstract:
This file provides the information dump support for Uhci when in debug mode.
- You can dynamically adjust the debug level by changing variable gEHCDebugLevel
- and gEHCErrorLevel.
Revision History
@@ -27,87 +25,6 @@ Revision History #include "Uhci.h"
#include "UhciDebug.h"
-#ifdef EFI_DEBUG
-
-UINTN mUhciDebugMask = USB_DEBUG_FORCE_OUTPUT;
-
-
-/**
- Debug debug print interface for UHCI
-
- @param Format String to use for the print, followed by print arguments
-
- @return None
-
-**/
-VOID
-UhciDebug (
- IN CHAR8 *Format,
- ...
- )
-{
- VA_LIST Marker;
-
- VA_START (Marker, Format);
- DebugVPrint (DEBUG_INFO, Format, Marker);
- VA_END (Marker);
-}
-
-
-/**
- Debug error print interface for UHCI
-
- @param Format String to use for the print, followed by print arguments
-
- @return None
-
-**/
-VOID
-UhciError (
- IN CHAR8 *Format,
- ...
- )
-{
- VA_LIST Marker;
-
- VA_START (Marker, Format);
- DebugVPrint (DEBUG_ERROR, Format, Marker);
- VA_END (Marker);
-}
-
-
-
-/**
- Debug print interface for UHCI
-
- @param Level Level to control debug print
- @param Format String to use for the print, followed by print arguments
-
- @return None
-
-**/
-VOID
-UhciDebugPrint (
- IN UINTN Level,
- IN CHAR8 *Format,
- ...
- )
-{
- VA_LIST Marker;
-
- VA_START (Marker, Format);
-
- if (Level & mUhciDebugMask) {
- if (mUhciDebugMask & USB_DEBUG_FORCE_OUTPUT) {
- DebugVPrint (DEBUG_ERROR, Format, Marker);
- } else {
- DebugVPrint (DEBUG_INFO, Format, Marker);
- }
- }
-
- VA_END (Marker);
-}
-
/**
Dump the content of QH structure
@@ -122,16 +39,12 @@ UhciDumpQh ( IN UHCI_QH_SW *QhSw
)
{
- UINTN Level;
-
- Level = UHCI_DEBUG_QH;
-
- UhciDebugPrint (Level, "&QhSw @ 0x%x\n", QhSw);
- UhciDebugPrint (Level, "QhSw.NextQh - 0x%x\n", QhSw->NextQh);
- UhciDebugPrint (Level, "QhSw.TDs - 0x%x\n", QhSw->TDs);
- UhciDebugPrint (Level, "QhSw.QhHw:\n");
- UhciDebugPrint (Level, " Horizon Link - %x\n", QhSw->QhHw.HorizonLink);
- UhciDebugPrint (Level, " Vertical Link - %x\n\n", QhSw->QhHw.VerticalLink);
+ DEBUG ((EFI_D_INFO, "&QhSw @ 0x%x\n", QhSw));
+ DEBUG ((EFI_D_INFO, "QhSw.NextQh - 0x%x\n", QhSw->NextQh));
+ DEBUG ((EFI_D_INFO, "QhSw.TDs - 0x%x\n", QhSw->TDs));
+ DEBUG ((EFI_D_INFO, "QhSw.QhHw:\n"));
+ DEBUG ((EFI_D_INFO, " Horizon Link - %x\n", QhSw->QhHw.HorizonLink));
+ DEBUG ((EFI_D_INFO, " Vertical Link - %x\n\n", QhSw->QhHw.VerticalLink));
}
@@ -150,34 +63,31 @@ UhciDumpTds ( )
{
UHCI_TD_SW *CurTdSw;
- UINTN Level;
- Level = UHCI_DEBUG_TD;
CurTdSw = TdSw;
while (CurTdSw != NULL) {
- UhciDebugPrint (Level, "TdSw @ 0x%x\n", CurTdSw);
- UhciDebugPrint (Level, "TdSw.NextTd - 0x%x\n", CurTdSw->NextTd);
- UhciDebugPrint (Level, "TdSw.DataLen - %d\n", CurTdSw->DataLen);
- UhciDebugPrint (Level, "TdSw.Data - 0x%x\n", CurTdSw->Data);
- UhciDebugPrint (Level, "TdHw:\n");
- UhciDebugPrint (Level, " NextLink - 0x%x\n", CurTdSw->TdHw.NextLink);
- UhciDebugPrint (Level, " ActualLen - %d\n", CurTdSw->TdHw.ActualLen);
- UhciDebugPrint (Level, " Status - 0x%x\n", CurTdSw->TdHw.Status);
- UhciDebugPrint (Level, " IOC - %d\n", CurTdSw->TdHw.IntOnCpl);
- UhciDebugPrint (Level, " IsIsoCh - %d\n", CurTdSw->TdHw.IsIsoch);
- UhciDebugPrint (Level, " LowSpeed - %d\n", CurTdSw->TdHw.LowSpeed);
- UhciDebugPrint (Level, " ErrorCount - %d\n", CurTdSw->TdHw.ErrorCount);
- UhciDebugPrint (Level, " ShortPacket - %d\n", CurTdSw->TdHw.ShortPacket);
- UhciDebugPrint (Level, " PidCode - 0x%x\n", CurTdSw->TdHw.PidCode);
- UhciDebugPrint (Level, " DevAddr - %d\n", CurTdSw->TdHw.DeviceAddr);
- UhciDebugPrint (Level, " EndPoint - %d\n", CurTdSw->TdHw.EndPoint);
- UhciDebugPrint (Level, " DataToggle - %d\n", CurTdSw->TdHw.DataToggle);
- UhciDebugPrint (Level, " MaxPacketLen - %d\n", CurTdSw->TdHw.MaxPacketLen);
- UhciDebugPrint (Level, " DataBuffer - 0x%x\n\n",CurTdSw->TdHw.DataBuffer);
+ DEBUG ((EFI_D_INFO, "TdSw @ 0x%x\n", CurTdSw));
+ DEBUG ((EFI_D_INFO, "TdSw.NextTd - 0x%x\n", CurTdSw->NextTd));
+ DEBUG ((EFI_D_INFO, "TdSw.DataLen - %d\n", CurTdSw->DataLen));
+ DEBUG ((EFI_D_INFO, "TdSw.Data - 0x%x\n", CurTdSw->Data));
+ DEBUG ((EFI_D_INFO, "TdHw:\n"));
+ DEBUG ((EFI_D_INFO, " NextLink - 0x%x\n", CurTdSw->TdHw.NextLink));
+ DEBUG ((EFI_D_INFO, " ActualLen - %d\n", CurTdSw->TdHw.ActualLen));
+ DEBUG ((EFI_D_INFO, " Status - 0x%x\n", CurTdSw->TdHw.Status));
+ DEBUG ((EFI_D_INFO, " IOC - %d\n", CurTdSw->TdHw.IntOnCpl));
+ DEBUG ((EFI_D_INFO, " IsIsoCh - %d\n", CurTdSw->TdHw.IsIsoch));
+ DEBUG ((EFI_D_INFO, " LowSpeed - %d\n", CurTdSw->TdHw.LowSpeed));
+ DEBUG ((EFI_D_INFO, " ErrorCount - %d\n", CurTdSw->TdHw.ErrorCount));
+ DEBUG ((EFI_D_INFO, " ShortPacket - %d\n", CurTdSw->TdHw.ShortPacket));
+ DEBUG ((EFI_D_INFO, " PidCode - 0x%x\n", CurTdSw->TdHw.PidCode));
+ DEBUG ((EFI_D_INFO, " DevAddr - %d\n", CurTdSw->TdHw.DeviceAddr));
+ DEBUG ((EFI_D_INFO, " EndPoint - %d\n", CurTdSw->TdHw.EndPoint));
+ DEBUG ((EFI_D_INFO, " DataToggle - %d\n", CurTdSw->TdHw.DataToggle));
+ DEBUG ((EFI_D_INFO, " MaxPacketLen - %d\n", CurTdSw->TdHw.MaxPacketLen));
+ DEBUG ((EFI_D_INFO, " DataBuffer - 0x%x\n\n",CurTdSw->TdHw.DataBuffer));
CurTdSw = CurTdSw->NextTd;
}
}
-#endif
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UhciDebug.h b/MdeModulePkg/Bus/Pci/UhciDxe/UhciDebug.h index d71791a..5628e39 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/UhciDebug.h +++ b/MdeModulePkg/Bus/Pci/UhciDxe/UhciDebug.h @@ -25,69 +25,6 @@ Revision History #ifndef _EFI_UHCI_DEBUG_H_
#define _EFI_UHCI_DEBUG_H_
-//
-// DEBUG support
-//
-#define USB_DEBUG_FORCE_OUTPUT (UINTN) (1 << 0)
-#define UHCI_DEBUG_QH (UINTN) (1 << 2)
-#define UHCI_DEBUG_TD (UINTN) (1 << 3)
-
-VOID
-UhciDebugPrint (
- IN UINTN Level,
- IN CHAR8 *Format,
- ...
- )
-/*++
-
-Routine Description:
-
- Debug print interface for UHCI
-
-Arguments:
-
- Level - Level to control debug print
- Format - String to use for the print, followed by print arguments
-
-Returns:
-
- None
-
---*/
-;
-
-
-/**
- Debug print interface for UHCI
-
- @param Format String to use for the print, followed by print arguments
-
- @return None
-
-**/
-VOID
-UhciDebug (
- IN CHAR8 *Format,
- ...
- )
-;
-
-
-/**
- Debug error print interface for UHCI
-
- @param Format String to use for the print, followed by print arguments
-
- @return None
-
-**/
-VOID
-UhciError (
- IN CHAR8 *Format,
- ...
- )
-;
-
/**
Dump the content of QH structure
@@ -118,17 +55,4 @@ UhciDumpTds ( )
;
-
-#ifdef EFI_DEBUG
- #define UHCI_DEBUG(arg) UhciDebug arg
- #define UHCI_ERROR(arg) UhciError arg
- #define UHCI_DUMP_TDS(arg) UhciDumpTds arg
- #define UHCI_DUMP_QH(arg) UhciDumpQh arg
-#else
- #define UHCI_DEBUG(arg)
- #define UHCI_ERROR(arg)
- #define UHCI_DUMP_TDS(arg)
- #define UHCI_DUMP_QH(arg)
-#endif
-
#endif
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c b/MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c index 9c632a6..0742f20 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c +++ b/MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c @@ -53,7 +53,7 @@ UhciReadReg ( );
if (EFI_ERROR (Status)) {
- UHCI_ERROR (("UhciReadReg: PciIo Io.Read error: %r at offset %d\n", Status, Offset));
+ DEBUG ((EFI_D_ERROR, "UhciReadReg: PciIo Io.Read error: %r at offset %d\n", Status, Offset));
Data = 0xFFFF;
}
@@ -91,7 +91,7 @@ UhciWriteReg ( );
if (EFI_ERROR (Status)) {
- UHCI_ERROR (("UhciWriteReg: PciIo Io.Write error: %r at offset %d\n", Status, Offset));
+ DEBUG ((EFI_D_ERROR, "UhciWriteReg: PciIo Io.Write error: %r at offset %d\n", Status, Offset));
}
}
@@ -167,7 +167,7 @@ UhciAckAllInterrupt ( // is a temporary error status.
//
if (!UhciIsHcWorking (Uhc->PciIo)) {
- UHCI_ERROR (("UhciAckAllInterrupt: re-enable the UHCI from system error\n"));
+ DEBUG ((EFI_D_ERROR, "UhciAckAllInterrupt: re-enable the UHCI from system error\n"));
Uhc->Usb2Hc.SetState (&Uhc->Usb2Hc, EfiUsbHcStateOperational);
}
}
@@ -232,7 +232,7 @@ UhciIsHcWorking ( UsbSts = UhciReadReg (PciIo, USBSTS_OFFSET);
if (UsbSts & (USBSTS_HCPE | USBSTS_HSE | USBSTS_HCH)) {
- UHCI_ERROR (("UhciIsHcWorking: current USB state is %x\n", UsbSts));
+ DEBUG ((EFI_D_ERROR, "UhciIsHcWorking: current USB state is %x\n", UsbSts));
return FALSE;
}
@@ -271,7 +271,7 @@ UhciSetFrameListBaseAddr ( );
if (EFI_ERROR (Status)) {
- UHCI_ERROR (("UhciSetFrameListBaseAddr: PciIo Io.Write error: %r\n", Status));
+ DEBUG ((EFI_D_ERROR, "UhciSetFrameListBaseAddr: PciIo Io.Write error: %r\n", Status));
}
}
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.c b/MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.c index 401d32e..3c2b7d4 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.c +++ b/MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.c @@ -121,11 +121,7 @@ UhciInitFrameList ( // in supporting the full speed bandwidth reclamation in the previous
// mentioned form. Most new platforms don't suffer it.
//
-#ifdef UHCI_NO_BW_RECLAMATION
- Uhc->BulkQh->QhHw.HorizonLink = QH_HLINK (NULL, TRUE);
-#else
Uhc->BulkQh->QhHw.HorizonLink = QH_HLINK (Uhc->BulkQh, FALSE);
-#endif
Uhc->BulkQh->NextQh = NULL;
@@ -515,7 +511,7 @@ UhciCheckTdStatus ( // terminate the transfer
//
if (!IsLow && (TdHw->ShortPacket == 1) && (Len < Td->DataLen)) {
- UHCI_DEBUG (("UhciCheckTdStatus: short packet read occured\n"));
+ DEBUG ((EFI_D_INFO, "UhciCheckTdStatus: short packet read occured\n"));
Finished = TRUE;
goto ON_EXIT;
@@ -576,7 +572,7 @@ UhciExecuteTransfer ( Finished = FALSE;
Status = EFI_SUCCESS;
Delay = (TimeOut * UHC_1_MILLISECOND / UHC_SYNC_POLL_INTERVAL) + 1;
-
+
for (Index = 0; Index < Delay; Index++) {
Finished = UhciCheckTdStatus (Uhc, Td, IsLow, QhResult);
@@ -591,16 +587,16 @@ UhciExecuteTransfer ( }
if (!Finished) {
- UHCI_ERROR (("UhciExecuteTransfer: execution not finished for %dms\n", TimeOut));
- UHCI_DUMP_QH ((Qh));
- UHCI_DUMP_TDS ((Td));
+ DEBUG ((EFI_D_ERROR, "UhciExecuteTransfer: execution not finished for %dms\n", TimeOut));
+ UhciDumpQh (Qh);
+ UhciDumpTds (Td);
Status = EFI_TIMEOUT;
} else if (QhResult->Result != EFI_USB_NOERROR) {
- UHCI_ERROR (("UhciExecuteTransfer: execution failed with result %x\n", QhResult->Result));
- UHCI_DUMP_QH ((Qh));
- UHCI_DUMP_TDS ((Td));
+ DEBUG ((EFI_D_ERROR, "UhciExecuteTransfer: execution failed with result %x\n", QhResult->Result));
+ UhciDumpQh (Qh);
+ UhciDumpTds (Td);
Status = EFI_DEVICE_ERROR;
}
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c b/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c index 5e02a0d..c7881ec 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c +++ b/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c @@ -23,9 +23,6 @@ Revision History #include "Uhci.h"
-UINTN mUsbHcDebugLevel = DEBUG_INFO;
-
-
/**
Allocate a block of memory to be used by the buffer pool
@@ -116,9 +113,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:
@@ -454,7 +448,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;
}
@@ -538,8 +532,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);
}
diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMass.h b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMass.h index 3e7c700..fe3f8b9 100644 --- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMass.h +++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMass.h @@ -62,7 +62,7 @@ enum { USB_MASS_STORE_RBC = 0x01, // Reduced Block Commands
USB_MASS_STORE_8020I = 0x02, // SFF-8020i, typically a CD/DVD device
USB_MASS_STORE_QIC = 0x03, // Typically a tape device
- USB_MASS_STORE_UFI = 0x04, // Typically a floopy disk driver device
+ USB_MASS_STORE_UFI = 0x04, // Typically a floppy disk driver device
USB_MASS_STORE_8070I = 0x05, // SFF-8070i, typically a floppy disk driver device.
USB_MASS_STORE_SCSI = 0x06, // SCSI transparent command set
@@ -138,6 +138,4 @@ UsbClearEndpointStall ( IN UINT8 EndpointAddress
);
-extern UINTN mUsbMscInfo;
-extern UINTN mUsbMscError;
#endif
diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c index 1299059..8dd7ada 100644 --- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c +++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c @@ -167,7 +167,7 @@ UsbBootRequestSense ( &CmdResult
);
if (EFI_ERROR (Status) || CmdResult != USB_MASS_CMD_SUCCESS) {
- DEBUG ((mUsbMscError, "UsbBootRequestSense: (%r) CmdResult=0x%x\n", Status, CmdResult));
+ DEBUG ((EFI_D_ERROR, "UsbBootRequestSense: (%r) CmdResult=0x%x\n", Status, CmdResult));
return Status;
}
@@ -225,7 +225,7 @@ UsbBootRequestSense ( break;
}
- DEBUG ((mUsbMscInfo, "UsbBootRequestSense: (%r) with sense key %x/%x/%x\n",
+ DEBUG ((EFI_D_INFO, "UsbBootRequestSense: (%r) with sense key %x/%x/%x\n",
Status,
USB_BOOT_SENSE_KEY (SenseData.SenseKey),
SenseData.ASC,
@@ -291,7 +291,7 @@ UsbBootExecCmd ( return EFI_SUCCESS;
}
- DEBUG ((mUsbMscInfo, "UsbBootExecCmd: Fail to Exec 0x%x Cmd /w %r\n",
+ DEBUG ((EFI_D_INFO, "UsbBootExecCmd: Fail to Exec 0x%x Cmd /w %r\n",
*(UINT8 *)Cmd ,Status));
return UsbBootRequestSense (UsbMass);
@@ -349,7 +349,7 @@ UsbBootExecCmdWithRetry ( DataDir,
Data,
DataLen,
- Timeout * (Index + 1)
+ Timeout
);
if (Status == EFI_SUCCESS ||
Status == EFI_MEDIA_CHANGED) {
@@ -513,7 +513,7 @@ UsbBootReadCapacity ( return EFI_NOT_READY;
}
- DEBUG ((mUsbMscInfo, "UsbBootReadCapacity Success LBA=%ld BlockSize=%d\n",
+ DEBUG ((EFI_D_INFO, "UsbBootReadCapacity Success LBA=%ld BlockSize=%d\n",
Media->LastBlock, Media->BlockSize));
return EFI_SUCCESS;
@@ -603,7 +603,7 @@ UsbBootGetParams ( Status = UsbBootInquiry (UsbMass);
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbMscError, "UsbBootGetParams: UsbBootInquiry (%r)\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbBootGetParams: UsbBootInquiry (%r)\n", Status));
return Status;
}
@@ -670,7 +670,7 @@ UsbBootDetectMedia ( Status = UsbBootIsUnitReady (UsbMass);
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbMscError, "UsbBootDetectMedia: UsbBootIsUnitReady (%r)\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbBootDetectMedia: UsbBootIsUnitReady (%r)\n", Status));
goto ON_ERROR;
}
@@ -687,7 +687,7 @@ UsbBootDetectMedia ( Status = UsbBootReadCapacity (UsbMass);
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbMscError, "UsbBootDetectMedia: UsbBootReadCapacity (%r)\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbBootDetectMedia: UsbBootReadCapacity (%r)\n", Status));
goto ON_ERROR;
}
@@ -709,7 +709,7 @@ ON_ERROR: (Media->LastBlock != OldMedia.LastBlock)) {
OldTpl = UsbGetCurrentTpl ();
- DEBUG ((mUsbMscError, "UsbBootDetectMedia: TPL before reinstall BlockIoProtocol is %d\n", OldTpl));
+ DEBUG ((EFI_D_ERROR, "UsbBootDetectMedia: TPL before reinstall BlockIoProtocol is %d\n", OldTpl));
gBS->RestoreTPL (TPL_CALLBACK);
@@ -720,7 +720,7 @@ ON_ERROR: &UsbMass->BlockIo
);
- DEBUG ((mUsbMscError, "UsbBootDetectMedia: TPL after reinstall is %d\n", UsbGetCurrentTpl()));
+ DEBUG ((EFI_D_ERROR, "UsbBootDetectMedia: TPL after reinstall is %d\n", UsbGetCurrentTpl()));
ASSERT (UsbGetCurrentTpl () == TPL_CALLBACK);
gBS->RaiseTPL (OldTpl);
diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c index 3f4d0fc..3277fa9 100644 --- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c +++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c @@ -25,9 +25,6 @@ Revision History #include "UsbMass.h"
#include "UsbMassBot.h"
-UINTN mUsbBotInfo = DEBUG_INFO;
-UINTN mUsbBotError = DEBUG_ERROR;
-
STATIC
EFI_STATUS
UsbBotResetDevice (
@@ -83,7 +80,7 @@ UsbBotInit ( Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &UsbBot->Interface);
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbBotError, "UsbBotInit: Get invalid BOT interface (%r)\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbBotInit: Get invalid BOT interface (%r)\n", Status));
goto ON_ERROR;
}
@@ -120,7 +117,7 @@ UsbBotInit ( }
if ((UsbBot->BulkInEndpoint == NULL) || (UsbBot->BulkOutEndpoint == NULL)) {
- DEBUG ((mUsbBotError, "UsbBotInit: In/Out Endpoint invalid\n"));
+ DEBUG ((EFI_D_ERROR, "UsbBotInit: In/Out Endpoint invalid\n"));
Status = EFI_UNSUPPORTED;
goto ON_ERROR;
}
@@ -277,9 +274,9 @@ UsbBotDataTransfer ( &Result
);
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbBotError, "UsbBotDataTransfer: (%r)\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbBotDataTransfer: (%r)\n", Status));
if (USB_IS_ERROR (Result, EFI_USB_ERR_STALL)) {
- DEBUG ((mUsbBotError, "UsbBotDataTransfer: DataIn Stall\n"));
+ DEBUG ((EFI_D_ERROR, "UsbBotDataTransfer: DataIn Stall\n"));
UsbClearEndpointStall (UsbBot->UsbIo, Endpoint->EndpointAddress);
} else if (USB_IS_ERROR (Result, EFI_USB_ERR_NAK)) {
Status = EFI_NOT_READY;
@@ -323,7 +320,7 @@ UsbBotGetStatus ( EFI_USB_IO_PROTOCOL *UsbIo;
UINT32 Index;
UINTN Timeout;
-
+
*CmdStatus = USB_BOT_COMMAND_ERROR;
Status = EFI_DEVICE_ERROR;
Endpoint = UsbBot->BulkInEndpoint->EndpointAddress;
@@ -346,9 +343,9 @@ UsbBotGetStatus ( &Result
);
if (EFI_ERROR(Status)) {
- DEBUG ((mUsbBotError, "UsbBotGetStatus (%r)\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbBotGetStatus (%r)\n", Status));
if (USB_IS_ERROR (Result, EFI_USB_ERR_STALL)) {
- DEBUG ((mUsbBotError, "UsbBotGetStatus: DataIn Stall\n"));
+ DEBUG ((EFI_D_ERROR, "UsbBotGetStatus: DataIn Stall\n"));
UsbClearEndpointStall (UsbIo, Endpoint);
}
continue;
@@ -358,13 +355,13 @@ UsbBotGetStatus ( //
// Invalid Csw need perform reset recovery
//
- DEBUG ((mUsbBotError, "UsbBotGetStatus: Device return a invalid signature\n"));
+ DEBUG ((EFI_D_ERROR, "UsbBotGetStatus: Device return a invalid signature\n"));
Status = UsbBotResetDevice (UsbBot, FALSE);
} else if (Csw.CmdStatus == USB_BOT_COMMAND_ERROR) {
//
// Respond phase error need perform reset recovery
//
- DEBUG ((mUsbBotError, "UsbBotGetStatus: Device return a phase error\n"));
+ DEBUG ((EFI_D_ERROR, "UsbBotGetStatus: Device return a phase error\n"));
Status = UsbBotResetDevice (UsbBot, FALSE);
} else {
@@ -426,7 +423,7 @@ UsbBotExecCommand ( //
Status = UsbBotSendCommand (UsbBot, Cmd, CmdLen, DataDir, DataLen);
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbBotError, "UsbBotExecCommand: UsbBotSendCommand (%r)\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbBotExecCommand: UsbBotSendCommand (%r)\n", Status));
return Status;
}
@@ -443,7 +440,7 @@ UsbBotExecCommand ( //
Status = UsbBotGetStatus (UsbBot, DataLen, &Result);
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbBotError, "UsbBotExecCommand: UsbBotGetStatus (%r)\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbBotExecCommand: UsbBotGetStatus (%r)\n", Status));
return Status;
}
@@ -512,7 +509,7 @@ UsbBotResetDevice ( );
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbBotError, "UsbBotResetDevice: (%r)\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbBotResetDevice: (%r)\n", Status));
return Status;
}
diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassCbi.c b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassCbi.c index 0162350..a46a9a3 100644 --- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassCbi.c +++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassCbi.c @@ -27,9 +27,6 @@ Revision History #include "UsbMass.h"
#include "UsbMassCbi.h"
-UINTN mUsbCbiInfo = DEBUG_INFO;
-UINTN mUsbCbiError = DEBUG_ERROR;
-
STATIC
EFI_STATUS
UsbCbiResetDevice (
@@ -450,7 +447,7 @@ UsbCbiExecCommand ( //
Status = UsbCbiSendCommand (UsbCbi, Cmd, CmdLen, Timeout);
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbCbiError, "UsbCbiExecCommand: UsbCbiSendCommand (%r)\n",Status));
+ DEBUG ((EFI_D_ERROR, "UsbCbiExecCommand: UsbCbiSendCommand (%r)\n",Status));
return Status;
}
@@ -462,7 +459,7 @@ UsbCbiExecCommand ( Status = UsbCbiDataTransfer (UsbCbi, DataDir, Data, &TransLen, Timeout);
if (UsbCbi->InterruptEndpoint == NULL) {
- DEBUG ((mUsbCbiError, "UsbCbiExecCommand: UsbCbiDataTransfer (%r)\n",Status));
+ DEBUG ((EFI_D_ERROR, "UsbCbiExecCommand: UsbCbiDataTransfer (%r)\n",Status));
return Status;
}
@@ -471,7 +468,7 @@ UsbCbiExecCommand ( //
Status = UsbCbiGetStatus (UsbCbi, Timeout, &Result);
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbCbiError, "UsbCbiExecCommand: UsbCbiGetStatus (%r)\n",Status));
+ DEBUG ((EFI_D_ERROR, "UsbCbiExecCommand: UsbCbiGetStatus (%r)\n",Status));
return EFI_DEVICE_ERROR;
}
diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c index f077e2a..71ccfa9 100644 --- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c +++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassImpl.c @@ -40,10 +40,6 @@ USB_MASS_TRANSPORT *mUsbMassTransport[] = { NULL
};
-UINTN mUsbMscInfo = DEBUG_INFO;
-UINTN mUsbMscError = DEBUG_ERROR;
-
-
/**
Retrieve the media parameters such as disk gemotric for the
device's BLOCK IO protocol.
@@ -84,6 +80,7 @@ UsbMassInitMedia ( Media->ReadOnly = FALSE;
Media->WriteCaching = FALSE;
Media->IoAlign = 0;
+ Media->MediaId = 1;
//
// Some device may spend several seconds before it is ready.
@@ -102,7 +99,7 @@ UsbMassInitMedia ( Status = UsbBootIsUnitReady (UsbMass);
if (EFI_ERROR (Status)) {
- gBS->Stall (USB_BOOT_RETRY_UNIT_READY_STALL * (Index + 1));
+ gBS->Stall (USB_BOOT_RETRY_UNIT_READY_STALL * (Index + 1));
}
}
@@ -122,6 +119,7 @@ UsbMassInitMedia ( **/
EFI_STATUS
+EFIAPI
UsbMassReset (
IN EFI_BLOCK_IO_PROTOCOL *This,
IN BOOLEAN ExtendedVerification
@@ -162,6 +160,7 @@ UsbMassReset ( **/
EFI_STATUS
+EFIAPI
UsbMassReadBlocks (
IN EFI_BLOCK_IO_PROTOCOL *This,
IN UINT32 MediaId,
@@ -175,7 +174,7 @@ UsbMassReadBlocks ( EFI_STATUS Status;
EFI_TPL OldTpl;
UINTN TotalBlock;
-
+
OldTpl = gBS->RaiseTPL (USB_MASS_TPL);
UsbMass = USB_MASS_DEVICE_FROM_BLOCKIO (This);
Media = &UsbMass->BlockIoMedia;
@@ -187,21 +186,21 @@ UsbMassReadBlocks ( Status = EFI_INVALID_PARAMETER;
goto ON_EXIT;
}
-
+
//
// If it is a removable media, such as CD-Rom or Usb-Floppy,
- // need to detect the media before each rw. While some of
+ // need to detect the media before each rw. While some of
// Usb-Flash is marked as removable media.
- //
- //
+ //
+ //
if (Media->RemovableMedia == TRUE) {
Status = UsbBootDetectMedia (UsbMass);
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbMscError, "UsbMassReadBlocks: UsbBootDetectMedia (%r)\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbMassReadBlocks: UsbBootDetectMedia (%r)\n", Status));
goto ON_EXIT;
- }
+ }
}
-
+
//
// Make sure BlockSize and LBA is consistent with BufferSize
//
@@ -213,13 +212,23 @@ UsbMassReadBlocks ( TotalBlock = BufferSize / Media->BlockSize;
if (Lba + TotalBlock - 1 > Media->LastBlock) {
- Status = EFI_BAD_BUFFER_SIZE;
+ Status = EFI_INVALID_PARAMETER;
+ goto ON_EXIT;
+ }
+
+ if (!(Media->MediaPresent)) {
+ Status = EFI_NO_MEDIA;
+ goto ON_EXIT;
+ }
+
+ if (MediaId != Media->MediaId) {
+ Status = EFI_MEDIA_CHANGED;
goto ON_EXIT;
}
-
+
Status = UsbBootReadBlocks (UsbMass, (UINT32) Lba, TotalBlock, Buffer);
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbMscError, "UsbMassReadBlocks: UsbBootReadBlocks (%r) -> Reset\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbMassReadBlocks: UsbBootReadBlocks (%r) -> Reset\n", Status));
UsbMassReset (This, TRUE);
}
@@ -249,6 +258,7 @@ ON_EXIT: **/
EFI_STATUS
+EFIAPI
UsbMassWriteBlocks (
IN EFI_BLOCK_IO_PROTOCOL *This,
IN UINT32 MediaId,
@@ -274,21 +284,21 @@ UsbMassWriteBlocks ( Status = EFI_INVALID_PARAMETER;
goto ON_EXIT;
}
-
+
//
// If it is a removable media, such as CD-Rom or Usb-Floppy,
- // need to detect the media before each rw. While some of
+ // need to detect the media before each rw. While some of
// Usb-Flash is marked as removable media.
- //
- //
+ //
+ //
if (Media->RemovableMedia == TRUE) {
Status = UsbBootDetectMedia (UsbMass);
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbMscError, "UsbMassWriteBlocks: UsbBootDetectMedia (%r)\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbMassWriteBlocks: UsbBootDetectMedia (%r)\n", Status));
goto ON_EXIT;
- }
+ }
}
-
+
//
// Make sure BlockSize and LBA is consistent with BufferSize
//
@@ -300,20 +310,30 @@ UsbMassWriteBlocks ( TotalBlock = BufferSize / Media->BlockSize;
if (Lba + TotalBlock - 1 > Media->LastBlock) {
- Status = EFI_BAD_BUFFER_SIZE;
+ Status = EFI_INVALID_PARAMETER;
goto ON_EXIT;
}
-
+
+ if (!(Media->MediaPresent)) {
+ Status = EFI_NO_MEDIA;
+ goto ON_EXIT;
+ }
+
+ if (MediaId != Media->MediaId) {
+ Status = EFI_MEDIA_CHANGED;
+ goto ON_EXIT;
+ }
+
//
// Try to write the data even the device is marked as ReadOnly,
// and clear the status should the write succeed.
//
Status = UsbBootWriteBlocks (UsbMass, (UINT32) Lba, TotalBlock, Buffer);
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbMscError, "UsbMassWriteBlocks: UsbBootWriteBlocks (%r) -> Reset\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbMassWriteBlocks: UsbBootWriteBlocks (%r) -> Reset\n", Status));
UsbMassReset (This, TRUE);
}
-
+
ON_EXIT:
gBS->RestoreTPL (OldTpl);
return Status;
@@ -330,6 +350,7 @@ ON_EXIT: **/
EFI_STATUS
+EFIAPI
UsbMassFlushBlocks (
IN EFI_BLOCK_IO_PROTOCOL *This
)
@@ -402,7 +423,7 @@ USBMassDriverBindingSupported ( }
}
- DEBUG ((mUsbMscInfo, "Found a USB mass store device %r\n", Status));
+ DEBUG ((EFI_D_INFO, "Found a USB mass store device %r\n", Status));
ON_EXIT:
gBS->CloseProtocol (
@@ -467,7 +488,7 @@ USBMassDriverBindingStart ( //
Status = UsbIo->UsbGetInterfaceDescriptor (UsbIo, &Interface);
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbMscError, "USBMassDriverBindingStart: UsbIo->UsbGetInterfaceDescriptor (%r)\n", Status));
+ DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: UsbIo->UsbGetInterfaceDescriptor (%r)\n", Status));
goto ON_ERROR;
}
@@ -484,7 +505,7 @@ USBMassDriverBindingStart ( }
if (EFI_ERROR (Status)) {
- DEBUG ((mUsbMscError, "USBMassDriverBindingStart: Transport->Init (%r)\n", Status));
+ DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: Transport->Init (%r)\n", Status));
goto ON_ERROR;
}
@@ -508,11 +529,11 @@ USBMassDriverBindingStart ( (UsbMass->Pdt != USB_PDT_CDROM) &&
(UsbMass->Pdt != USB_PDT_OPTICAL) &&
(UsbMass->Pdt != USB_PDT_SIMPLE_DIRECT)) {
- DEBUG ((mUsbMscError, "USBMassDriverBindingStart: Found an unsupported peripheral type[%d]\n", UsbMass->Pdt));
+ DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: Found an unsupported peripheral type[%d]\n", UsbMass->Pdt));
goto ON_ERROR;
}
} else if (Status != EFI_NO_MEDIA){
- DEBUG ((mUsbMscError, "USBMassDriverBindingStart: UsbMassInitMedia (%r)\n", Status));
+ DEBUG ((EFI_D_ERROR, "USBMassDriverBindingStart: UsbMassInitMedia (%r)\n", Status));
goto ON_ERROR;
}
|