diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-08-20 03:13:24 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-08-20 03:13:24 +0000 |
commit | d2577026d3b27dd834356fcc658515b1a6f9e2a8 (patch) | |
tree | 06c918cf8ceae8127e0151e533ef8676b26e2608 | |
parent | 6f5554bd58d3279422ed75f570f584d02ce14282 (diff) | |
download | edk2-d2577026d3b27dd834356fcc658515b1a6f9e2a8.tar.gz edk2-d2577026d3b27dd834356fcc658515b1a6f9e2a8.tar.bz2 edk2-d2577026d3b27dd834356fcc658515b1a6f9e2a8.zip |
Merge in some fix from R8 on USB Bus driver:
1) Signal event immediately after HUB UsbRootHubEnumeration event is installed
2) Move UsbHcReset and UsbHcSetState before mUsbRootHubApi.Init
3) Change USB_DEBUG and USB_ERROR to R9 DEBUG macro.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@3680 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c | 30 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c | 70 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c | 38 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c | 56 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.h | 10 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBusDxe/usbbus.c | 29 |
6 files changed, 87 insertions, 146 deletions
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c index ffed1493c6..6d68d818d2 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c @@ -208,7 +208,7 @@ UsbCreateDesc ( if ((Len <= Offset) || (Len < Offset + DescLen) ||
(Head->Type != Type) || (Head->Len != DescLen)) {
- USB_ERROR (("UsbCreateDesc: met mal-format descriptor\n"));
+ DEBUG (( EFI_D_ERROR, "UsbCreateDesc: met mal-format descriptor\n"));
return NULL;
}
@@ -254,7 +254,7 @@ UsbParseInterfaceDesc ( Setting = UsbCreateDesc (DescBuf, Len, USB_DESC_TYPE_INTERFACE, &Used);
if (Setting == NULL) {
- USB_ERROR (("UsbParseInterfaceDesc: failed to create interface descriptor\n"));
+ DEBUG (( EFI_D_ERROR, "UsbParseInterfaceDesc: failed to create interface descriptor\n"));
return NULL;
}
@@ -265,7 +265,7 @@ UsbParseInterfaceDesc ( //
NumEp = Setting->Desc.NumEndpoints;
- USB_DEBUG (("UsbParseInterfaceDesc: interface %d(setting %d) has %d endpoints\n",
+ DEBUG (( EFI_D_INFO, "UsbParseInterfaceDesc: interface %d(setting %d) has %d endpoints\n",
Setting->Desc.InterfaceNumber, Setting->Desc.AlternateSetting, NumEp));
if (NumEp == 0) {
@@ -285,7 +285,7 @@ UsbParseInterfaceDesc ( Ep = UsbCreateDesc (DescBuf + Offset, Len - Offset, USB_DESC_TYPE_ENDPOINT, &Used);
if (Ep == NULL) {
- USB_ERROR (("UsbParseInterfaceDesc: failed to create endpoint(index %d)\n", Index));
+ DEBUG (( EFI_D_ERROR, "UsbParseInterfaceDesc: failed to create endpoint(index %d)\n", Index));
goto ON_ERROR;
}
@@ -345,7 +345,7 @@ UsbParseConfigDesc ( goto ON_ERROR;
}
- USB_DEBUG (("UsbParseConfigDesc: config %d has %d interfaces\n",
+ DEBUG (( EFI_D_INFO, "UsbParseConfigDesc: config %d has %d interfaces\n",
Config->Desc.ConfigurationValue, NumIf));
for (Index = 0; Index < NumIf; Index++) {
@@ -373,11 +373,11 @@ UsbParseConfigDesc ( Setting = UsbParseInterfaceDesc (DescBuf, Len, &Consumed);
if ((Setting == NULL)) {
- USB_ERROR (("UsbParseConfigDesc: failed to parse interface setting\n"));
+ DEBUG (( EFI_D_ERROR, "UsbParseConfigDesc: failed to parse interface setting\n"));
goto ON_ERROR;
} else if (Setting->Desc.InterfaceNumber >= NumIf) {
- USB_ERROR (("UsbParseConfigDesc: mal-formated interface descriptor\n"));
+ DEBUG (( EFI_D_ERROR, "UsbParseConfigDesc: mal-formated interface descriptor\n"));
UsbFreeInterfaceDesc (Setting);
goto ON_ERROR;
@@ -747,13 +747,13 @@ UsbGetOneConfig ( Status = UsbCtrlGetDesc (UsbDev, USB_DESC_TYPE_CONFIG, Index, 0, &Desc, 8);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbGetOneConfig: failed to get descript length(%d) %r\n",
+ DEBUG (( EFI_D_ERROR, "UsbGetOneConfig: failed to get descript length(%d) %r\n",
Status, Desc.TotalLength));
return NULL;
}
- USB_DEBUG (("UsbGetOneConfig: total length is %d\n", Desc.TotalLength));
+ DEBUG (( EFI_D_INFO, "UsbGetOneConfig: total length is %d\n", Desc.TotalLength));
Buf = AllocateZeroPool (Desc.TotalLength);
@@ -764,7 +764,7 @@ UsbGetOneConfig ( Status = UsbCtrlGetDesc (UsbDev, USB_DESC_TYPE_CONFIG, Index, 0, Buf, Desc.TotalLength);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbGetOneConfig: failed to get full descript %r\n", Status));
+ DEBUG (( EFI_D_ERROR, "UsbGetOneConfig: failed to get full descript %r\n", Status));
gBS->FreePool (Buf);
return NULL;
@@ -805,7 +805,7 @@ UsbBuildDescTable ( Status = UsbGetDevDesc (UsbDev);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbBuildDescTable: failed to get device descriptor - %r\n", Status));
+ DEBUG (( EFI_D_ERROR, "UsbBuildDescTable: failed to get device descriptor - %r\n", Status));
return Status;
}
@@ -817,7 +817,7 @@ UsbBuildDescTable ( return EFI_OUT_OF_RESOURCES;
}
- USB_DEBUG (("UsbBuildDescTable: device has %d configures\n", NumConfig));
+ DEBUG (( EFI_D_INFO, "UsbBuildDescTable: device has %d configures\n", NumConfig));
//
// Read each configurations, then parse them
@@ -826,7 +826,7 @@ UsbBuildDescTable ( Config = UsbGetOneConfig (UsbDev, Index);
if (Config == NULL) {
- USB_ERROR (("UsbBuildDescTable: failed to get configure (index %d)\n", Index));
+ DEBUG (( EFI_D_ERROR, "UsbBuildDescTable: failed to get configure (index %d)\n", Index));
//
// If we can get the default descriptor, it is likely that the
@@ -844,7 +844,7 @@ UsbBuildDescTable ( gBS->FreePool (Config);
if (ConfigDesc == NULL) {
- USB_ERROR (("UsbBuildDescTable: failed to parse configure (index %d)\n", Index));
+ DEBUG (( EFI_D_ERROR, "UsbBuildDescTable: failed to parse configure (index %d)\n", Index));
//
// If we can get the default descriptor, it is likely that the
@@ -867,7 +867,7 @@ UsbBuildDescTable ( Status = UsbBuildLangTable (UsbDev);
if (EFI_ERROR (Status)) {
- USB_DEBUG (("UsbBuildDescTable: get language ID table %r\n", Status));
+ DEBUG (( EFI_D_ERROR, "UsbBuildDescTable: get language ID table %r\n", Status));
}
return EFI_SUCCESS;
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c index 0b5532ec56..28052de91f 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c @@ -143,7 +143,7 @@ UsbCreateInterface ( UsbIf->DevicePath = AppendDevicePathNode (HubIf->DevicePath, &UsbNode.Header);
if (UsbIf->DevicePath == NULL) {
- USB_ERROR (("UsbCreateInterface: failed to create device path\n"));
+ DEBUG ((EFI_D_ERROR, "UsbCreateInterface: failed to create device path\n"));
Status = EFI_OUT_OF_RESOURCES;
goto ON_ERROR;
@@ -159,7 +159,7 @@ UsbCreateInterface ( );
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbCreateInterface: failed to install UsbIo - %r\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbCreateInterface: failed to install UsbIo - %r\n", Status));
goto ON_ERROR;
}
@@ -178,7 +178,7 @@ UsbCreateInterface ( NULL
);
- USB_ERROR (("UsbCreateInterface: failed to open host for child - %r\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbCreateInterface: failed to open host for child - %r\n", Status));
goto ON_ERROR;
}
@@ -277,7 +277,7 @@ UsbConnectDriver ( // connect drivers with this interface
//
if (UsbIsHubInterface (UsbIf)) {
- USB_DEBUG (("UsbConnectDriver: found a hub device\n"));
+ DEBUG ((EFI_D_INFO, "UsbConnectDriver: found a hub device\n"));
Status = mUsbHubApi.Init (UsbIf);
} else {
@@ -289,14 +289,14 @@ UsbConnectDriver ( // or disconnect at CALLBACK.
//
OldTpl = UsbGetCurrentTpl ();
- USB_DEBUG (("UsbConnectDriver: TPL before connect is %d\n", OldTpl));
+ DEBUG ((EFI_D_INFO, "UsbConnectDriver: TPL before connect is %d\n", OldTpl));
gBS->RestoreTPL (TPL_CALLBACK);
Status = gBS->ConnectController (UsbIf->Handle, NULL, NULL, TRUE);
UsbIf->IsManaged = (BOOLEAN)!EFI_ERROR (Status);
- USB_DEBUG (("UsbConnectDriver: TPL after connect is %d\n", UsbGetCurrentTpl()));
+ DEBUG ((EFI_D_INFO, "UsbConnectDriver: TPL after connect is %d\n", UsbGetCurrentTpl()));
ASSERT (UsbGetCurrentTpl () == TPL_CALLBACK);
gBS->RaiseTPL (OldTpl);
@@ -347,7 +347,7 @@ UsbSelectSetting ( IfDesc->ActiveIndex = Index;
- USB_DEBUG (("UsbSelectSetting: setting %d selected for interface %d\n",
+ DEBUG ((EFI_D_INFO, "UsbSelectSetting: setting %d selected for interface %d\n",
Alternate, Setting->Desc.InterfaceNumber));
//
@@ -406,7 +406,7 @@ UsbSelectConfig ( Device->ActiveConfig = ConfigDesc;
- USB_DEBUG (("UsbSelectConfig: config %d selected for device %d\n",
+ DEBUG ((EFI_D_INFO, "UsbSelectConfig: config %d selected for device %d\n",
ConfigValue, Device->Address));
//
@@ -439,7 +439,7 @@ UsbSelectConfig ( Status = UsbConnectDriver (UsbIf);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbSelectConfig: failed to connect driver %r, ignored\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbSelectConfig: failed to connect driver %r, ignored\n", Status));
}
}
@@ -482,14 +482,14 @@ UsbDisconnectDriver ( // or disconnect at CALLBACK.
//
OldTpl = UsbGetCurrentTpl ();
- USB_DEBUG (("UsbDisconnectDriver: old TPL is %d\n", OldTpl));
+ DEBUG ((EFI_D_INFO, "UsbDisconnectDriver: old TPL is %d\n", OldTpl));
gBS->RestoreTPL (TPL_CALLBACK);
gBS->DisconnectController (UsbIf->Handle, NULL, NULL);
UsbIf->IsManaged = FALSE;
- USB_DEBUG (("UsbDisconnectDriver: TPL after disconnect is %d\n", UsbGetCurrentTpl()));
+ DEBUG (( EFI_D_INFO, "UsbDisconnectDriver: TPL after disconnect is %d\n", UsbGetCurrentTpl()));
ASSERT (UsbGetCurrentTpl () == TPL_CALLBACK);
gBS->RaiseTPL (OldTpl);
@@ -569,14 +569,14 @@ UsbRemoveDevice ( Status = UsbRemoveDevice (Child);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbRemoveDevice: failed to remove child, ignore error\n"));
+ DEBUG ((EFI_D_ERROR, "UsbRemoveDevice: failed to remove child, ignore error\n"));
Bus->Devices[Index] = NULL;
}
}
UsbRemoveConfig (Device);
- USB_DEBUG (("UsbRemoveDevice: device %d removed\n", Device->Address));
+ DEBUG (( EFI_D_INFO, "UsbRemoveDevice: device %d removed\n", Device->Address));
Bus->Devices[Device->Address] = NULL;
UsbFreeDevice (Device);
@@ -672,12 +672,12 @@ UsbEnumerateNewDev ( Status = HubApi->ResetPort (HubIf, Port);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbEnumerateNewDev: failed to reset port %d - %r\n", Port, Status));
+ DEBUG ((EFI_D_ERROR, "UsbEnumerateNewDev: failed to reset port %d - %r\n", Port, Status));
return Status;
}
- USB_DEBUG (("UsbEnumerateNewDev: hub port %d is reset\n", Port));
+ DEBUG (( EFI_D_INFO, "UsbEnumerateNewDev: hub port %d is reset\n", Port));
Child = UsbCreateDevice (HubIf, Port);
@@ -692,7 +692,7 @@ UsbEnumerateNewDev ( Status = HubApi->GetPortStatus (HubIf, Port, &PortState);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbEnumerateNewDev: failed to get speed of port %d\n", Port));
+ DEBUG ((EFI_D_ERROR, "UsbEnumerateNewDev: failed to get speed of port %d\n", Port));
goto ON_ERROR;
}
@@ -706,7 +706,7 @@ UsbEnumerateNewDev ( Child->Speed = EFI_USB_SPEED_FULL;
}
- USB_DEBUG (("UsbEnumerateNewDev: device is of %d speed\n", Child->Speed));
+ DEBUG (( EFI_D_INFO, "UsbEnumerateNewDev: device is of %d speed\n", Child->Speed));
if (Child->Speed != EFI_USB_SPEED_HIGH) {
//
@@ -723,7 +723,7 @@ UsbEnumerateNewDev ( Child->Translator = Parent->Translator;
}
- USB_DEBUG (("UsbEnumerateNewDev: device uses translator (%d, %d)\n",
+ DEBUG (( EFI_D_INFO, "UsbEnumerateNewDev: device uses translator (%d, %d)\n",
Child->Translator.TranslatorHubAddress,
Child->Translator.TranslatorPortNumber));
}
@@ -742,11 +742,11 @@ UsbEnumerateNewDev ( Status = UsbGetMaxPacketSize0 (Child);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbEnumerateNewDev: failed to get max packet for EP 0 - %r\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbEnumerateNewDev: failed to get max packet for EP 0 - %r\n", Status));
goto ON_ERROR;
}
- USB_DEBUG (("UsbEnumerateNewDev: max packet size for EP 0 is %d\n", Child->MaxPacket0));
+ DEBUG (( EFI_D_INFO, "UsbEnumerateNewDev: max packet size for EP 0 is %d\n", Child->MaxPacket0));
//
// Host assigns an address to the device. Device completes the
@@ -760,7 +760,7 @@ UsbEnumerateNewDev ( }
if (Address == USB_MAX_DEVICES) {
- USB_ERROR (("UsbEnumerateNewDev: address pool is full for port %d\n", Port));
+ DEBUG ((EFI_D_ERROR, "UsbEnumerateNewDev: address pool is full for port %d\n", Port));
Status = EFI_ACCESS_DENIED;
goto ON_ERROR;
@@ -771,7 +771,7 @@ UsbEnumerateNewDev ( Child->Address = Address;
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbEnumerateNewDev: failed to set device address - %r\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbEnumerateNewDev: failed to set device address - %r\n", Status));
goto ON_ERROR;
}
@@ -780,7 +780,7 @@ UsbEnumerateNewDev ( //
gBS->Stall (20 * USB_STALL_1_MS);
- USB_DEBUG (("UsbEnumerateNewDev: device is now ADDRESSED at %d\n", Address));
+ DEBUG ((EFI_D_INFO, "UsbEnumerateNewDev: device is now ADDRESSED at %d\n", Address));
//
// Host learns about the device¡¯s abilities by requesting device's
@@ -789,7 +789,7 @@ UsbEnumerateNewDev ( Status = UsbBuildDescTable (Child);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbEnumerateNewDev: failed to build descriptor table - %r\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbEnumerateNewDev: failed to build descriptor table - %r\n", Status));
goto ON_ERROR;
}
@@ -801,11 +801,11 @@ UsbEnumerateNewDev ( Status = UsbSetConfig (Child, Config);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbEnumerateNewDev: failed to set configure %d - %r\n", Config, Status));
+ DEBUG ((EFI_D_ERROR, "UsbEnumerateNewDev: failed to set configure %d - %r\n", Config, Status));
goto ON_ERROR;
}
- USB_DEBUG (("UsbEnumerateNewDev: device %d is now in CONFIGED state\n", Address));
+ DEBUG (( EFI_D_INFO, "UsbEnumerateNewDev: device %d is now in CONFIGED state\n", Address));
//
// Host assigns and loads a device driver.
@@ -813,7 +813,7 @@ UsbEnumerateNewDev ( Status = UsbSelectConfig (Child, Config);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbEnumerateNewDev: failed to create interfaces - %r\n", Status));
+ DEBUG ((EFI_D_ERROR, "UsbEnumerateNewDev: failed to create interfaces - %r\n", Status));
goto ON_ERROR;
}
@@ -865,7 +865,7 @@ UsbEnumeratePort ( Status = HubApi->GetPortStatus (HubIf, Port, &PortState);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbEnumeratePort: failed to get state of port %d\n", Port));
+ DEBUG ((EFI_D_ERROR, "UsbEnumeratePort: failed to get state of port %d\n", Port));
return Status;
}
@@ -873,7 +873,7 @@ UsbEnumeratePort ( return EFI_SUCCESS;
}
- USB_DEBUG (("UsbEnumeratePort: port %d state - %x, change - %x\n",
+ DEBUG (( EFI_D_INFO, "UsbEnumeratePort: port %d state - %x, change - %x\n",
Port, PortState.PortStatus, PortState.PortChangeStatus));
//
@@ -890,7 +890,7 @@ UsbEnumeratePort ( // which probably is caused by short circuit. It has to wait system hardware
// to perform recovery.
//
- USB_DEBUG (("UsbEnumeratePort: Critical Over Current\n", Port));
+ DEBUG (( EFI_D_ERROR, "UsbEnumeratePort: Critical Over Current\n", Port));
return EFI_DEVICE_ERROR;
} else {
@@ -899,7 +899,7 @@ UsbEnumeratePort ( // over current. As a result, all ports are nearly power-off, so
// it's necessary to detach and enumerate all ports again.
//
- USB_DEBUG (("UsbEnumeratePort: 2.0 device Recovery Over Current\n", Port));
+ DEBUG (( EFI_D_ERROR, "UsbEnumeratePort: 2.0 device Recovery Over Current\n", Port));
goto ON_ENUMERATE;
}
@@ -911,7 +911,7 @@ UsbEnumeratePort ( // on 2.0 roothub does. When over-current has influence on 1.1 device, the port
// would be disabled, so it's also necessary to detach and enumerate again.
//
- USB_DEBUG (("UsbEnumeratePort: 1.1 device Recovery Over Current\n", Port));
+ DEBUG (( EFI_D_ERROR, "UsbEnumeratePort: 1.1 device Recovery Over Current\n", Port));
goto ON_ENUMERATE;
}
@@ -931,7 +931,7 @@ ON_ENUMERATE: Child = UsbFindChild (HubIf, Port);
if (Child != NULL) {
- USB_DEBUG (("UsbEnumeratePort: device at port %d removed from system\n", Port));
+ DEBUG (( EFI_D_INFO, "UsbEnumeratePort: device at port %d removed from system\n", Port));
UsbRemoveDevice (Child);
}
@@ -939,11 +939,11 @@ ON_ENUMERATE: //
// Now, new device connected, enumerate and configure the device
//
- USB_DEBUG (("UsbEnumeratePort: new device connected at port %d\n", Port));
+ DEBUG (( EFI_D_INFO, "UsbEnumeratePort: new device connected at port %d\n", Port));
Status = UsbEnumerateNewDev (HubIf, Port);
} else {
- USB_DEBUG (("UsbEnumeratePort: device disconnected event on port %d\n", Port));
+ DEBUG (( EFI_D_INFO, "UsbEnumeratePort: device disconnected event on port %d\n", Port));
}
HubApi->ClearPortChange (HubIf, Port);
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c index cb54f03747..8d747d0648 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c @@ -553,7 +553,7 @@ UsbOnHubInterrupt ( );
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbOnHubInterrupt: failed to remove async transfer - %r\n", Status));
+ DEBUG (( EFI_D_ERROR, "UsbOnHubInterrupt: failed to remove async transfer - %r\n", Status));
return Status;
}
@@ -568,7 +568,7 @@ UsbOnHubInterrupt ( );
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbOnHubInterrupt: failed to submit new async transfer - %r\n", Status));
+ DEBUG (( EFI_D_ERROR, "UsbOnHubInterrupt: failed to submit new async transfer - %r\n", Status));
}
return Status;
@@ -668,20 +668,20 @@ UsbHubInit ( }
if (Index == Setting->Desc.NumEndpoints) {
- USB_ERROR (("UsbHubInit: no interrupt endpoint found for hub %d\n", HubDev->Address));
+ DEBUG (( EFI_D_ERROR, "UsbHubInit: no interrupt endpoint found for hub %d\n", HubDev->Address));
return EFI_DEVICE_ERROR;
}
Status = UsbHubReadDesc (HubDev, &HubDesc);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbHubInit: failed to read HUB descriptor %r\n", Status));
+ DEBUG (( EFI_D_ERROR, "UsbHubInit: failed to read HUB descriptor %r\n", Status));
return Status;
}
HubIf->NumOfPort = HubDesc.NumPorts;
- USB_DEBUG (("UsbHubInit: hub %d has %d ports\n", HubDev->Address,HubIf->NumOfPort));
+ DEBUG (( EFI_D_INFO, "UsbHubInit: hub %d has %d ports\n", HubDev->Address,HubIf->NumOfPort));
//
// Create an event to enumerate the hub's port. On
@@ -695,7 +695,7 @@ UsbHubInit ( );
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbHubInit: failed to create signal for hub %d - %r\n",
+ DEBUG (( EFI_D_ERROR, "UsbHubInit: failed to create signal for hub %d - %r\n",
HubDev->Address, Status));
return Status;
@@ -720,7 +720,7 @@ UsbHubInit ( );
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbHubInit: failed to queue interrupt transfer for hub %d - %r\n",
+ DEBUG (( EFI_D_ERROR, "UsbHubInit: failed to queue interrupt transfer for hub %d - %r\n",
HubDev->Address, Status));
gBS->CloseEvent (HubIf->HubNotify);
@@ -750,7 +750,7 @@ UsbHubInit ( gBS->Stall (HubDesc.PwrOn2PwrGood * 2 * USB_STALL_1_MS);
UsbHubAckHubStatus (HubIf->Device);
- USB_DEBUG (("UsbHubInit: hub %d initialized\n", HubDev->Address));
+ DEBUG (( EFI_D_INFO, "UsbHubInit: hub %d initialized\n", HubDev->Address));
return Status;
}
@@ -979,7 +979,7 @@ UsbHubRelease ( HubIf->HubEp = NULL;
HubIf->HubNotify = NULL;
- USB_DEBUG (("UsbHubRelease: hub device %d released\n", HubIf->Device->Address));
+ DEBUG (( EFI_D_INFO, "UsbHubRelease: hub device %d released\n", HubIf->Device->Address));
return EFI_SUCCESS;
}
@@ -1011,7 +1011,7 @@ UsbRootHubInit ( return Status;
}
- USB_DEBUG (("UsbRootHubInit: root hub %x - max speed %d, %d ports\n",
+ DEBUG (( EFI_D_INFO, "UsbRootHubInit: root hub %x - max speed %d, %d ports\n",
HubIf, MaxSpeed, NumOfPort));
HubIf->IsHub = TRUE;
@@ -1036,6 +1036,12 @@ UsbRootHubInit ( return Status;
}
+ //
+ // It should signal the event immediately here, or device detection
+ // by bus enumeration might be delayed by the timer interval.
+ //
+ gBS->SignalEvent (HubIf->HubNotify);
+
Status = gBS->SetTimer (
HubIf->HubNotify,
TimerPeriodic,
@@ -1216,7 +1222,7 @@ UsbRootHubResetPort ( Status = UsbHcSetRootHubPortFeature (Bus, Port, EfiUsbPortReset);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbRootHubResetPort: failed to start reset on port %d\n", Port));
+ DEBUG (( EFI_D_ERROR, "UsbRootHubResetPort: failed to start reset on port %d\n", Port));
return Status;
}
@@ -1229,7 +1235,7 @@ UsbRootHubResetPort ( Status = UsbHcClearRootHubPortFeature (Bus, Port, EfiUsbPortReset);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbRootHubResetPort: failed to clear reset on port %d\n", Port));
+ DEBUG (( EFI_D_ERROR, "UsbRootHubResetPort: failed to clear reset on port %d\n", Port));
return Status;
}
@@ -1256,7 +1262,7 @@ UsbRootHubResetPort ( }
if (Index == USB_HUB_LOOP) {
- USB_ERROR (("UsbRootHubResetPort: reset not finished in time on port %d\n", Port));
+ DEBUG (( EFI_D_ERROR, "UsbRootHubResetPort: reset not finished in time on port %d\n", Port));
return EFI_TIMEOUT;
}
@@ -1268,7 +1274,7 @@ UsbRootHubResetPort ( // automatically enable the port, we need to enable it manually.
//
if (RootIf->MaxSpeed == EFI_USB_SPEED_HIGH) {
- USB_ERROR (("UsbRootHubResetPort: release low/full speed device (%d) to UHCI\n", Port));
+ DEBUG (( EFI_D_ERROR, "UsbRootHubResetPort: release low/full speed device (%d) to UHCI\n", Port));
UsbRootHubSetPortFeature (RootIf, Port, EfiUsbPortOwner);
return EFI_NOT_FOUND;
@@ -1278,7 +1284,7 @@ UsbRootHubResetPort ( Status = UsbRootHubSetPortFeature (RootIf, Port, EfiUsbPortEnable);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbRootHubResetPort: failed to enable port %d for UHCI\n", Port));
+ DEBUG (( EFI_D_ERROR, "UsbRootHubResetPort: failed to enable port %d for UHCI\n", Port));
return Status;
}
@@ -1305,7 +1311,7 @@ UsbRootHubRelease ( IN USB_INTERFACE *HubIf
)
{
- USB_DEBUG (("UsbRootHubRelease: root hub released for hub %x\n", HubIf));
+ DEBUG (( EFI_D_INFO, "UsbRootHubRelease: root hub released for hub %x\n", HubIf));
gBS->SetTimer (HubIf->HubNotify, TimerCancel, USB_ROOTHUB_POLL_INTERVAL);
gBS->CloseEvent (HubIf->HubNotify);
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c index 28d73daffe..d4184fe1a2 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c @@ -711,59 +711,3 @@ UsbGetCurrentTpl ( return Tpl;
}
-
-#ifdef EFI_DEBUG
-VOID
-UsbDebug (
- IN CHAR8 *Format,
- ...
- )
-/*++
-
-Routine Description:
-
- USB's debug output function.
-
-Arguments:
-
- Format - The format parameters to the print
- ... - The variable length parameters after format
-
-Returns:
-
- None
-
---*/
-{
- VA_LIST Marker;
-
- VA_START (Marker, Format);
- DebugVPrint (DEBUG_INFO, Format, Marker);
- VA_END (Marker);
-}
-
-
-
-/**
- USB's error output function.
-
- @param Format The format parameters to the print
- @param ... The variable length parameters after format
-
- @return None
-
-**/
-VOID
-UsbError (
- IN CHAR8 *Format,
- ...
- )
-{
- VA_LIST Marker;
-
- VA_START (Marker, Format);
- DebugVPrint (DEBUG_ERROR, Format, Marker);
- VA_END (Marker);
-}
-
-#endif
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.h b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.h index 2dafd1c0c1..ee44c6acd0 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.h +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.h @@ -194,16 +194,6 @@ UsbGetCurrentTpl ( VOID
);
-//
-// USB debug support routines
-//
-#ifdef EFI_DEBUG
- #define USB_DEBUG(arg) UsbDebug arg
- #define USB_ERROR(arg) UsbError arg
-#else
- #define USB_DEBUG(arg)
- #define USB_ERROR(arg)
-#endif
VOID
UsbDebug (
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/usbbus.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/usbbus.c index 096b10a831..608ea9f8b6 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/usbbus.c +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/usbbus.c @@ -150,8 +150,7 @@ UsbIoControlTransfer ( goto ON_EXIT;
}
-
- USB_DEBUG (("UsbIoControlTransfer: configure changed!!! Do NOT use old UsbIo!!!\n"));
+ DEBUG ((EFI_D_INFO, "UsbIoControlTransfer: configure changed!!! Do NOT use old UsbIo!!!\n"));
if (Dev->ActiveConfig != NULL) {
UsbRemoveConfig (Dev);
@@ -827,7 +826,7 @@ UsbIoPortReset ( Status = HubIf->HubApi->ResetPort (HubIf, Dev->ParentPort);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbIoPortReset: failed to reset hub port %d@hub %d, %r \n",
+ DEBUG (( EFI_D_ERROR, "UsbIoPortReset: failed to reset hub port %d@hub %d, %r \n",
Dev->ParentPort, Dev->ParentAddr, Status));
goto ON_EXIT;
@@ -843,7 +842,7 @@ UsbIoPortReset ( Status = UsbSetAddress (Dev, Address);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbIoPortReset: failed to set address for device %d - %r\n",
+ DEBUG (( EFI_D_ERROR, "UsbIoPortReset: failed to set address for device %d - %r\n",
Address, Status));
goto ON_EXIT;
@@ -859,7 +858,7 @@ UsbIoPortReset ( Status = UsbSetConfig (Dev, Dev->ActiveConfig->Desc.ConfigurationValue);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbIoPortReset: failed to set configure for device %d - %r\n",
+ DEBUG (( EFI_D_ERROR, "UsbIoPortReset: failed to set configure for device %d - %r\n",
Address, Status));
}
}
@@ -1105,7 +1104,7 @@ UsbBusControllerDriverStart ( );
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbBusStart: Failed to open device path %r\n", Status));
+ DEBUG (( EFI_D_ERROR, "UsbBusStart: Failed to open device path %r\n", Status));
gBS->FreePool (UsbBus);
return Status;
@@ -1138,7 +1137,7 @@ UsbBusControllerDriverStart ( );
if (EFI_ERROR (Status) && EFI_ERROR (Status2)) {
- USB_ERROR (("UsbBusStart: Failed to open USB_HC/USB2_HC %r\n", Status));
+ DEBUG (( EFI_D_ERROR, "UsbBusStart: Failed to open USB_HC/USB2_HC %r\n", Status));
Status = EFI_DEVICE_ERROR;
goto CLOSE_HC;
@@ -1169,10 +1168,14 @@ UsbBusControllerDriverStart ( RootIf->Device = RootHub;
RootIf->DevicePath = UsbBus->DevicePath;
+
+ UsbHcReset (UsbBus, EFI_USB_HC_RESET_GLOBAL);
+ UsbHcSetState (UsbBus, EfiUsbHcStateOperational);
+
Status = mUsbRootHubApi.Init (RootIf);
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbBusStart: Failed to init root hub %r\n", Status));
+ DEBUG (( EFI_D_ERROR, "UsbBusStart: Failed to init root hub %r\n", Status));
goto FREE_ROOTHUB;
}
@@ -1189,16 +1192,14 @@ UsbBusControllerDriverStart ( );
if (EFI_ERROR (Status)) {
- USB_ERROR (("UsbBusStart: Failed to install bus protocol %r\n", Status));
+ DEBUG (( EFI_D_ERROR, "UsbBusStart: Failed to install bus protocol %r\n", Status));
mUsbRootHubApi.Release (RootIf);
goto FREE_ROOTHUB;
}
- UsbHcReset (UsbBus, EFI_USB_HC_RESET_GLOBAL);
- UsbHcSetState (UsbBus, EfiUsbHcStateOperational);
- USB_DEBUG (("UsbBusStart: usb bus started on %x, root hub %x\n", Controller, RootIf));
+ DEBUG (( EFI_D_INFO, "UsbBusStart: usb bus started on %x, root hub %x\n", Controller, RootIf));
return EFI_SUCCESS;
FREE_ROOTHUB:
@@ -1233,7 +1234,7 @@ CLOSE_HC: gBS->FreePool (UsbBus);
- USB_ERROR (("UsbBusStart: Failed to start bus driver %r\n", Status));
+ DEBUG (( EFI_D_ERROR, "UsbBusStart: Failed to start bus driver %r\n", Status));
return Status;
}
@@ -1306,7 +1307,7 @@ UsbBusControllerDriverStop ( return EFI_SUCCESS;
}
- USB_DEBUG (("UsbBusStop: usb bus stopped on %x\n", Controller));
+ DEBUG (( EFI_D_INFO, "UsbBusStop: usb bus stopped on %x\n", Controller));
//
// Locate USB_BUS for the current host controller
|