// Remove all the devices on its downstream ports. Search from devices[1].\r
// Devices[0] is the root hub.\r
//\r
- for (Index = 1; Index < mMaxUsbDeviceNum; Index++) {\r
+ for (Index = 1; Index < Bus->MaxDevices; Index++) {\r
Child = Bus->Devices[Index];\r
\r
if ((Child == NULL) || (Child->ParentAddr != Device->Address)) {\r
\r
DEBUG (( EFI_D_INFO, "UsbRemoveDevice: device %d removed\n", Device->Address));\r
\r
- ASSERT (Device->Address < mMaxUsbDeviceNum);\r
+ ASSERT (Device->Address < Bus->MaxDevices);\r
Bus->Devices[Device->Address] = NULL;\r
UsbFreeDevice (Device);\r
\r
//\r
// Start checking from device 1, device 0 is the root hub\r
//\r
- for (Index = 1; Index < mMaxUsbDeviceNum; Index++) {\r
+ for (Index = 1; Index < Bus->MaxDevices; Index++) {\r
Device = Bus->Devices[Index];\r
\r
if ((Device != NULL) && (Device->ParentAddr == HubIf->Device->Address) &&\r
UINT8 Config;\r
EFI_STATUS Status;\r
\r
- Address = mMaxUsbDeviceNum;\r
Parent = HubIf->Device;\r
Bus = Parent->Bus;\r
- HubApi = HubIf->HubApi;\r
- \r
+ HubApi = HubIf->HubApi; \r
+ Address = Bus->MaxDevices;\r
+\r
gBS->Stall (USB_WAIT_PORT_STABLE_STALL);\r
\r
//\r
// status stage with default address, then switches to new address.\r
// ADDRESS state. Address zero is reserved for root hub.\r
//\r
- for (Address = 1; Address < mMaxUsbDeviceNum; Address++) {\r
+ ASSERT (Bus->MaxDevices <= 256);\r
+ for (Address = 1; Address < Bus->MaxDevices; Address++) {\r
if (Bus->Devices[Address] == NULL) {\r
break;\r
}\r
}\r
\r
- if (Address == mMaxUsbDeviceNum) {\r
+ if (Address >= Bus->MaxDevices) {\r
DEBUG ((EFI_D_ERROR, "UsbEnumerateNewDev: address pool is full for port %d\n", Port));\r
\r
Status = EFI_ACCESS_DENIED;\r
return EFI_SUCCESS;\r
\r
ON_ERROR:\r
- if (Address != mMaxUsbDeviceNum) {\r
+ if (Address != Bus->MaxDevices) {\r
Bus->Devices[Address] = NULL;\r
}\r
\r