\r
Unified interface for RootHub and Hub.\r
\r
-Copyright (c) 2007, Intel Corporation\r
+Copyright (c) 2007, 2009, Intel Corporation\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
\r
#include "UsbBus.h"\r
\r
+//\r
+// Array that maps the change bit to feature value which is\r
+// used to clear these change bit. USB HUB API will clear\r
+// these change bit automatically. For non-root hub, these\r
+// bits determine whether hub will report the port in changed\r
+// bit maps.\r
+//\r
+#define USB_HUB_MAP_SIZE 5\r
+\r
+USB_CHANGE_FEATURE_MAP mHubFeatureMap[USB_HUB_MAP_SIZE] = {\r
+ {USB_PORT_STAT_C_CONNECTION, EfiUsbPortConnectChange},\r
+ {USB_PORT_STAT_C_ENABLE, EfiUsbPortEnableChange},\r
+ {USB_PORT_STAT_C_SUSPEND, EfiUsbPortSuspendChange},\r
+ {USB_PORT_STAT_C_OVERCURRENT, EfiUsbPortOverCurrentChange},\r
+ {USB_PORT_STAT_C_RESET, EfiUsbPortResetChange},\r
+};\r
+\r
+#define USB_ROOT_HUB_MAP_SIZE 5\r
+\r
+USB_CHANGE_FEATURE_MAP mRootHubFeatureMap[USB_ROOT_HUB_MAP_SIZE] = {\r
+ {USB_PORT_STAT_C_CONNECTION, EfiUsbPortConnectChange},\r
+ {USB_PORT_STAT_C_ENABLE, EfiUsbPortEnableChange},\r
+ {USB_PORT_STAT_C_SUSPEND, EfiUsbPortSuspendChange},\r
+ {USB_PORT_STAT_C_OVERCURRENT, EfiUsbPortOverCurrentChange},\r
+ {USB_PORT_STAT_C_RESET, EfiUsbPortResetChange},\r
+};\r
+\r
//\r
// USB hub class specific requests. Although USB hub\r
// is related to an interface, these requests are sent\r
@param State Variable to return the hub port state.\r
\r
@retval EFI_SUCCESS The port state is returned in State.\r
- @retval Others Failed to retrive the port state.\r
+ @retval Others Failed to retrieve the port state.\r
\r
**/\r
EFI_STATUS\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
UsbOnHubInterrupt (\r
IN VOID *Data,\r
IN UINTN DataLength,\r
return EFI_SUCCESS;\r
}\r
\r
-//\r
-// Array that maps the change bit to feature value which is\r
-// used to clear these change bit. USB HUB API will clear\r
-// these change bit automatically. For non-root hub, these\r
-// bits determine whether hub will report the port in changed\r
-// bit maps.\r
-//\r
-#define USB_HUB_MAP_SIZE 5\r
-\r
-USB_CHANGE_FEATURE_MAP mHubFeatureMap[USB_HUB_MAP_SIZE] = {\r
- {USB_PORT_STAT_C_CONNECTION, EfiUsbPortConnectChange},\r
- {USB_PORT_STAT_C_ENABLE, EfiUsbPortEnableChange},\r
- {USB_PORT_STAT_C_SUSPEND, EfiUsbPortSuspendChange},\r
- {USB_PORT_STAT_C_OVERCURRENT, EfiUsbPortOverCurrentChange},\r
- {USB_PORT_STAT_C_RESET, EfiUsbPortResetChange},\r
-};\r
-\r
-#define USB_ROOT_HUB_MAP_SIZE 5\r
-\r
-USB_CHANGE_FEATURE_MAP mRootHubFeatureMap[USB_ROOT_HUB_MAP_SIZE] = {\r
- {USB_PORT_STAT_C_CONNECTION, EfiUsbPortConnectChange},\r
- {USB_PORT_STAT_C_ENABLE, EfiUsbPortEnableChange},\r
- {USB_PORT_STAT_C_SUSPEND, EfiUsbPortSuspendChange},\r
- {USB_PORT_STAT_C_OVERCURRENT, EfiUsbPortOverCurrentChange},\r
- {USB_PORT_STAT_C_RESET, EfiUsbPortResetChange},\r
-};\r
\r
\r
\r
USB_DEVICE *HubDev;\r
EFI_STATUS Status;\r
UINT8 Index;\r
+ UINT8 NumEndpoints;\r
\r
//\r
// Locate the interrupt endpoint for port change map\r
Setting = HubIf->IfSetting;\r
HubDev = HubIf->Device;\r
EpDesc = NULL;\r
+ NumEndpoints = Setting->Desc.NumEndpoints;\r
\r
- for (Index = 0; Index < Setting->Desc.NumEndpoints; Index++) {\r
+ for (Index = 0; Index < NumEndpoints; Index++) {\r
ASSERT ((Setting->Endpoints != NULL) && (Setting->Endpoints[Index] != NULL));\r
\r
EpDesc = Setting->Endpoints[Index];\r
}\r
}\r
\r
- if (Index == Setting->Desc.NumEndpoints) {\r
+ if (Index == NumEndpoints) {\r
DEBUG (( EFI_D_ERROR, "UsbHubInit: no interrupt endpoint found for hub %d\n", HubDev->Address));\r
return EFI_DEVICE_ERROR;\r
}\r
@param HubIf The hub interface.\r
@param Port The hub port.\r
\r
- @return None.\r
-\r
**/\r
VOID\r
UsbHubClearPortChange (\r
\r
\r
/**\r
- Interface funtion to reset the port.\r
+ Interface function to reset the port.\r
\r
@param HubIf The hub interface.\r
@param Port The port to reset.\r
\r
@param HubIf The root hub interface.\r
\r
- @retval EFI_SUCCESS The interface is initialied for root hub.\r
+ @retval EFI_SUCCESS The interface is initialized for root hub.\r
@retval Others Failed to initialize the hub.\r
\r
**/\r
@param HubIf The root hub interface.\r
@param Port The root hub port.\r
\r
- @return None.\r
-\r
**/\r
VOID\r
UsbRootHubClearPortChange (\r
\r
\r
/**\r
- Interface funtion to reset the root hub port.\r
+ Interface function to reset the root hub port.\r
\r
@param RootIf The root hub interface.\r
@param Port The port to reset.\r