]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c
Fix various 'EFIAPI' inconsistencies found while building MdeModulePkg.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / UsbHub.c
index 4a2e382cd7a8b07f76c0ca5bc85443b72eba21ac..f20d933f0399f8662518a476c7321c62c7fea803 100644 (file)
@@ -2,7 +2,7 @@
 \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
@@ -15,6 +15,33 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \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
@@ -225,7 +252,7 @@ UsbHubCtrlGetHubStatus (
   @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
@@ -489,6 +516,7 @@ UsbIsHubInterface (
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 UsbOnHubInterrupt (\r
   IN  VOID                *Data,\r
   IN  UINTN               DataLength,\r
@@ -576,32 +604,6 @@ UsbOnHubInterrupt (
   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
@@ -626,6 +628,7 @@ UsbHubInit (
   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
@@ -634,8 +637,9 @@ UsbHubInit (
   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
@@ -646,7 +650,7 @@ UsbHubInit (
     }\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
@@ -771,8 +775,6 @@ UsbHubGetPortStatus (
   @param  HubIf                 The hub interface.\r
   @param  Port                  The hub port.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 UsbHubClearPortChange (\r
@@ -861,7 +863,7 @@ UsbHubClearPortFeature (
 \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
@@ -963,7 +965,7 @@ UsbHubRelease (
 \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
@@ -1065,8 +1067,6 @@ UsbRootHubGetPortStatus (
   @param  HubIf                 The root hub interface.\r
   @param  Port                  The root hub port.\r
 \r
-  @return None.\r
-\r
 **/\r
 VOID\r
 UsbRootHubClearPortChange (\r
@@ -1154,7 +1154,7 @@ UsbRootHubClearPortFeature (
 \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