summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/Pci/UhciDxe
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2008-02-13 09:08:24 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2008-02-13 09:08:24 +0000
commit1c61953576f35507eb24032fe2804eaf9a0e976c (patch)
tree360cede2dc10e488a9efd48a7f125a596db41f69 /MdeModulePkg/Bus/Pci/UhciDxe
parentd1f076304d3be2f1423ba8d62062253cb0d59354 (diff)
downloadedk2-platforms-1c61953576f35507eb24032fe2804eaf9a0e976c.tar.xz
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
Diffstat (limited to 'MdeModulePkg/Bus/Pci/UhciDxe')
-rw-r--r--MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c4
-rw-r--r--MdeModulePkg/Bus/Pci/UhciDxe/UhciDebug.c140
-rw-r--r--MdeModulePkg/Bus/Pci/UhciDxe/UhciDebug.h76
-rw-r--r--MdeModulePkg/Bus/Pci/UhciDxe/UhciReg.c10
-rw-r--r--MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.c20
-rw-r--r--MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c10
6 files changed, 41 insertions, 219 deletions
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c
index 7f4351796b..d129af8715 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 d47314ffbf..117bef2b96 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 d71791a414..5628e393f2 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 9c632a60fc..0742f209d8 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 401d32eb34..3c2b7d4cbb 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 5e02a0d3b8..c7881ecf35 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);
}