]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbBusDxe/UsbUtility.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / UsbUtility.c
index e67a88541be0325011fc93f0889ab14c96a8b79a..8559992d27430335f6c23551be3457254d65a0aa 100644 (file)
@@ -2,14 +2,8 @@
 \r
     Wrapper function for usb host controller interface.\r
 \r
-Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
-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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -90,90 +84,12 @@ UsbHcGetCapability (
 }\r
 \r
 \r
-/**\r
-  Reset the host controller.\r
-\r
-  @param  UsbBus                The usb bus driver.\r
-  @param  Attributes            The reset type, only global reset is used by this driver.\r
-\r
-  @retval EFI_SUCCESS           The reset operation succeeded.\r
-  @retval EFI_INVALID_PARAMETER Attributes is not valid.\r
-  @retval EFI_UNSUPPOURTED      The type of reset specified by Attributes is\r
-                                not currently supported by the host controller.\r
-  @retval EFI_DEVICE_ERROR      Host controller isn't halted to reset.\r
-**/\r
-EFI_STATUS\r
-UsbHcReset (\r
-  IN USB_BUS              *UsbBus,\r
-  IN UINT16               Attributes\r
-  )\r
-{\r
-  EFI_STATUS              Status;\r
-\r
-  if (UsbBus->Usb2Hc != NULL) {\r
-    Status = UsbBus->Usb2Hc->Reset (UsbBus->Usb2Hc, Attributes);\r
-  } else {\r
-    Status = UsbBus->UsbHc->Reset (UsbBus->UsbHc, Attributes);\r
-  }\r
-\r
-  return Status;\r
-}\r
-\r
-\r
-/**\r
-  Get the current operation state of the host controller.\r
-\r
-  @param  UsbBus           The USB bus driver.\r
-  @param  State            The host controller operation state.\r
-\r
-  @retval EFI_SUCCESS      The operation state is returned in State.\r
-  @retval Others           Failed to get the host controller state.\r
-\r
-**/\r
-EFI_STATUS\r
-UsbHcGetState (\r
-  IN  USB_BUS             *UsbBus,\r
-  OUT EFI_USB_HC_STATE    *State\r
-  )\r
-{\r
-  EFI_STATUS              Status;\r
-\r
-  if (UsbBus->Usb2Hc != NULL) {\r
-    Status = UsbBus->Usb2Hc->GetState (UsbBus->Usb2Hc, State);\r
-  } else {\r
-    Status = UsbBus->UsbHc->GetState (UsbBus->UsbHc, State);\r
-  }\r
-\r
-  return Status;\r
-}\r
 \r
 \r
-/**\r
-  Set the host controller operation state.\r
 \r
-  @param  UsbBus           The USB bus driver.\r
-  @param  State            The state to set.\r
 \r
-  @retval EFI_SUCCESS      The host controller is now working at State.\r
-  @retval Others           Failed to set operation state.\r
 \r
-**/\r
-EFI_STATUS\r
-UsbHcSetState (\r
-  IN USB_BUS              *UsbBus,\r
-  IN EFI_USB_HC_STATE     State\r
-  )\r
-{\r
-  EFI_STATUS              Status;\r
 \r
-  if (UsbBus->Usb2Hc != NULL) {\r
-    Status = UsbBus->Usb2Hc->SetState (UsbBus->Usb2Hc, State);\r
-  } else {\r
-    Status = UsbBus->UsbHc->SetState (UsbBus->UsbHc, State);\r
-  }\r
-\r
-  return Status;\r
-}\r
 \r
 \r
 /**\r
@@ -563,78 +479,10 @@ UsbHcSyncInterruptTransfer (
 }\r
 \r
 \r
-/**\r
-  Execute a synchronous Isochronous USB transfer.\r
-\r
-  @param  UsbBus           The USB bus driver.\r
-  @param  DevAddr          The target device address.\r
-  @param  EpAddr           The target endpoint address, with direction encoded in\r
-                           bit 7.\r
-  @param  DevSpeed         The device's speed.\r
-  @param  MaxPacket        The endpoint's max packet size.\r
-  @param  BufferNum        The number of data buffer.\r
-  @param  Data             Array of pointers to data buffer.\r
-  @param  DataLength       The length of data buffer.\r
-  @param  Translator       The transaction translator for low/full speed device.\r
-  @param  UsbResult        The result of USB execution.\r
-\r
-  @retval EFI_UNSUPPORTED  The isochronous transfer isn't supported now.\r
-\r
-**/\r
-EFI_STATUS\r
-UsbHcIsochronousTransfer (\r
-  IN  USB_BUS                             *UsbBus,\r
-  IN  UINT8                               DevAddr,\r
-  IN  UINT8                               EpAddr,\r
-  IN  UINT8                               DevSpeed,\r
-  IN  UINTN                               MaxPacket,\r
-  IN  UINT8                               BufferNum,\r
-  IN  OUT VOID                            *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
-  IN  UINTN                               DataLength,\r
-  IN  EFI_USB2_HC_TRANSACTION_TRANSLATOR  *Translator,\r
-  OUT UINT32                              *UsbResult\r
-  )\r
-{\r
-  return EFI_UNSUPPORTED;\r
-}\r
-\r
 \r
-/**\r
-  Queue an asynchronous isochronous transfer.\r
 \r
-  @param  UsbBus           The USB bus driver.\r
-  @param  DevAddr          The target device address.\r
-  @param  EpAddr           The target endpoint address, with direction encoded in\r
-                           bit 7.\r
-  @param  DevSpeed         The device's speed.\r
-  @param  MaxPacket        The endpoint's max packet size.\r
-  @param  BufferNum        The number of data buffer.\r
-  @param  Data             Array of pointers to data buffer.\r
-  @param  DataLength       The length of data buffer.\r
-  @param  Translator       The transaction translator for low/full speed device.\r
-  @param  Callback         The function to call when data is transferred.\r
-  @param  Context          The context to the callback function.\r
 \r
-  @retval EFI_UNSUPPORTED  The asynchronous isochronous transfer isn't supported.\r
 \r
-**/\r
-EFI_STATUS\r
-UsbHcAsyncIsochronousTransfer (\r
-  IN  USB_BUS                             *UsbBus,\r
-  IN  UINT8                               DevAddr,\r
-  IN  UINT8                               EpAddr,\r
-  IN  UINT8                               DevSpeed,\r
-  IN  UINTN                               MaxPacket,\r
-  IN  UINT8                               BufferNum,\r
-  IN OUT VOID                             *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
-  IN  UINTN                               DataLength,\r
-  IN  EFI_USB2_HC_TRANSACTION_TRANSLATOR  *Translator,\r
-  IN  EFI_ASYNC_USB_TRANSFER_CALLBACK     Callback,\r
-  IN  VOID                                *Context\r
-  )\r
-{\r
-  return EFI_UNSUPPORTED;\r
-}\r
 \r
 \r
 /**\r
@@ -1163,7 +1011,7 @@ UsbBusAddWantedUsbIoDP (
     DevicePathPtr = DuplicateDevicePath ((EFI_DEVICE_PATH_PROTOCOL *) &mAllUsbClassDevicePath);\r
   } else if (!IsDevicePathEnd (RemainingDevicePath)) {\r
     //\r
-    // If RemainingDevicePath isn't the End of Device Path Node, \r
+    // If RemainingDevicePath isn't the End of Device Path Node,\r
     // Create new Usb device path according to the usb part in remaining device path\r
     //\r
     DevicePathPtr = GetUsbDPFromFullDP (RemainingDevicePath);\r
@@ -1171,7 +1019,7 @@ UsbBusAddWantedUsbIoDP (
     //\r
     // If RemainingDevicePath is the End of Device Path Node,\r
     // skip enumerate any device and return EFI_SUCESSS\r
-    // \r
+    //\r
     return EFI_SUCCESS;\r
   }\r
 \r
@@ -1364,14 +1212,16 @@ UsbBusRecursivelyConnectWantedUsbIo (
         //\r
         // Recursively connect the wanted Usb Io handle\r
         //\r
-        DEBUG ((EFI_D_INFO, "UsbConnectDriver: TPL before connect is %d\n", (UINT32)UsbGetCurrentTpl ()));\r
+        DEBUG ((EFI_D_INFO, "UsbBusRecursivelyConnectWantedUsbIo: TPL before connect is %d\n", (UINT32)UsbGetCurrentTpl ()));\r
         Status            = gBS->ConnectController (UsbIf->Handle, NULL, NULL, TRUE);\r
         UsbIf->IsManaged  = (BOOLEAN)!EFI_ERROR (Status);\r
-        DEBUG ((EFI_D_INFO, "UsbConnectDriver: TPL after connect is %d\n", (UINT32)UsbGetCurrentTpl()));\r
+        DEBUG ((EFI_D_INFO, "UsbBusRecursivelyConnectWantedUsbIo: TPL after connect is %d\n", (UINT32)UsbGetCurrentTpl()));\r
       }\r
     }\r
   }\r
 \r
+  FreePool (UsbIoBuffer);\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r