UsbIf->Signature = USB_INTERFACE_SIGNATURE;\r
UsbIf->Device = Device;\r
UsbIf->IfDesc = IfDesc;\r
+ ASSERT (IfDesc->ActiveIndex < USB_MAX_INTERFACE_SETTING);\r
UsbIf->IfSetting = IfDesc->Settings[IfDesc->ActiveIndex];\r
\r
CopyMem (\r
//\r
if (UsbBusIsWantedUsbIO (UsbIf->Device->Bus, UsbIf)) {\r
OldTpl = UsbGetCurrentTpl ();\r
- DEBUG ((EFI_D_INFO, "UsbConnectDriver: TPL before connect is %d\n", (UINT32)OldTpl));\r
+ DEBUG ((EFI_D_INFO, "UsbConnectDriver: TPL before connect is %d, %p\n", (UINT32)OldTpl, UsbIf->Handle));\r
\r
gBS->RestoreTPL (TPL_CALLBACK);\r
\r
Setting = NULL;\r
\r
for (Index = 0; Index < IfDesc->NumOfSetting; Index++) {\r
+ ASSERT (Index < USB_MAX_INTERFACE_SETTING);\r
Setting = IfDesc->Settings[Index];\r
\r
if (Setting->Desc.AlternateSetting == Alternate) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
+ ASSERT (Index < USB_MAX_INTERFACE);\r
Device->Interfaces[Index] = UsbIf;\r
\r
//\r
)\r
{\r
EFI_TPL OldTpl;\r
+ EFI_STATUS Status;\r
\r
//\r
// Release the hub if it's a hub controller, otherwise\r
// or disconnect at CALLBACK.\r
//\r
OldTpl = UsbGetCurrentTpl ();\r
- DEBUG ((EFI_D_INFO, "UsbDisconnectDriver: old TPL is %d\n", (UINT32)OldTpl));\r
+ DEBUG ((EFI_D_INFO, "UsbDisconnectDriver: old TPL is %d, %p\n", (UINT32)OldTpl, UsbIf->Handle));\r
\r
gBS->RestoreTPL (TPL_CALLBACK);\r
\r
- gBS->DisconnectController (UsbIf->Handle, NULL, NULL);\r
+ Status = gBS->DisconnectController (UsbIf->Handle, NULL, NULL);\r
UsbIf->IsManaged = FALSE;\r
\r
- DEBUG (( EFI_D_INFO, "UsbDisconnectDriver: TPL after disconnect is %d\n", (UINT32)UsbGetCurrentTpl()));\r
+ DEBUG (( EFI_D_INFO, "UsbDisconnectDriver: TPL after disconnect is %d, %d\n", (UINT32)UsbGetCurrentTpl(), Status));\r
ASSERT (UsbGetCurrentTpl () == TPL_CALLBACK);\r
\r
gBS->RaiseTPL (OldTpl);\r
//\r
// Remove each interface of the device\r
//\r
- for (Index = 0; Index < Device->NumOfInterface; Index++) {\r
+ for (Index = 0; Index < Device->NumOfInterface; Index++) { \r
+ ASSERT (Index < USB_MAX_INTERFACE);\r
UsbIf = Device->Interfaces[Index];\r
\r
if (UsbIf == NULL) {\r
\r
DEBUG (( EFI_D_INFO, "UsbRemoveDevice: device %d removed\n", Device->Address));\r
\r
+ ASSERT (Device->Address < USB_MAX_DEVICES);\r
Bus->Devices[Device->Address] = NULL;\r
UsbFreeDevice (Device);\r
\r
Child = UsbFindChild (HubIf, Port);\r
\r
if (Child != NULL) {\r
- DEBUG (( EFI_D_INFO, "UsbEnumeratePort: device at port %d removed from system\n", Port));\r
+ DEBUG (( EFI_D_INFO, "UsbEnumeratePort: device at port %d removed from root hub %p\n", Port, HubIf));\r
UsbRemoveDevice (Child);\r
}\r
\r