]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbBotPei/PeiUsbLib.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBotPei / PeiUsbLib.c
index 46c1a0644458e3a989899757410acb1fa5e33888..fe9e6203010ed16ec6e71ab54bc8ab5382619660 100644 (file)
 /** @file\r
 Common Libarary  for PEI USB.\r
 \r
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
-  \r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions\r
-of the BSD License which accompanies this distribution.  The\r
-full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\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
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #include "UsbPeim.h"\r
 #include "PeiUsbLib.h"\r
 \r
-/**\r
-  Get a given usb descriptor.\r
-\r
-  @param  PeiServices        General-purpose services that are available to every PEIM.\r
-  @param  UsbIoPpi           Indicates the PEI_USB_IO_PPI instance.\r
-  @param  Value              Request Value.\r
-  @param  Index              Request Index.\r
-  @param  DescriptorLength   Request descriptor Length.\r
-  @param  Descriptor         Request descriptor.\r
-\r
-\r
-  @retval EFI_SUCCESS        Usb descriptor is obtained successfully.\r
-  @retval EFI_DEVICE_ERROR   Cannot get the usb descriptor due to a hardware error.\r
-  @retval Others             Other failure occurs.\r
-\r
-**/\r
-EFI_STATUS\r
-PeiUsbGetDescriptor (\r
-  IN  EFI_PEI_SERVICES         **PeiServices,\r
-  IN  PEI_USB_IO_PPI           *UsbIoPpi,\r
-  IN  UINT16                   Value,\r
-  IN  UINT16                   Index,\r
-  IN  UINT16                   DescriptorLength,\r
-  OUT VOID                     *Descriptor\r
-  )\r
-{\r
-  EFI_USB_DEVICE_REQUEST  DevReq;\r
-\r
-  ASSERT (UsbIoPpi != NULL);\r
-\r
-  DevReq.RequestType  = USB_DEV_GET_DESCRIPTOR_REQ_TYPE;\r
-  DevReq.Request      = USB_DEV_GET_DESCRIPTOR;\r
-  DevReq.Value        = Value;\r
-  DevReq.Index        = Index;\r
-  DevReq.Length       = DescriptorLength;\r
-\r
-  return UsbIoPpi->UsbControlTransfer (\r
-                     PeiServices,\r
-                     UsbIoPpi,\r
-                     &DevReq,\r
-                     EfiUsbDataIn,\r
-                     PcdGet32 (PcdUsbTransferTimeoutValue),\r
-                     Descriptor,\r
-                     DescriptorLength\r
-                     );\r
-}\r
-\r
-/**\r
-  Set a usb device with a specified address.\r
-\r
-  @param  PeiServices        General-purpose services that are available to every PEIM.\r
-  @param  UsbIoPpi           Indicates the PEI_USB_IO_PPI instance.\r
-  @param  AddressValue       The address to assign.\r
-\r
-  @retval EFI_SUCCESS        Usb device address is set successfully.\r
-  @retval EFI_DEVICE_ERROR   Cannot set the usb address due to a hardware error.\r
-  @retval Others             Other failure occurs.\r
-\r
-**/\r
-EFI_STATUS\r
-PeiUsbSetDeviceAddress (\r
-  IN EFI_PEI_SERVICES         **PeiServices,\r
-  IN PEI_USB_IO_PPI           *UsbIoPpi,\r
-  IN UINT16                   AddressValue\r
-  )\r
-{\r
-  EFI_USB_DEVICE_REQUEST  DevReq;\r
-\r
-  ASSERT (UsbIoPpi != NULL);\r
-\r
-  DevReq.RequestType  = USB_DEV_SET_ADDRESS_REQ_TYPE;\r
-  DevReq.Request      = USB_DEV_SET_ADDRESS;\r
-  DevReq.Value        = AddressValue;\r
-  DevReq.Index        = 0;\r
-  DevReq.Length       = 0;\r
-\r
-  return UsbIoPpi->UsbControlTransfer (\r
-                     PeiServices,\r
-                     UsbIoPpi,\r
-                     &DevReq,\r
-                     EfiUsbNoData,\r
-                     PcdGet32 (PcdUsbTransferTimeoutValue),\r
-                     NULL,\r
-                     0\r
-                     );\r
-}\r
 \r
 /**\r
   Clear a given usb feature.\r
@@ -161,40 +68,6 @@ PeiUsbClearDeviceFeature (
                      );\r
 }\r
 \r
-/**\r
-  Configure a usb device to Configuration 1.\r
-\r
-  @param  PeiServices        General-purpose services that are available to every PEIM.\r
-  @param  UsbIoPpi           Indicates the PEI_USB_IO_PPI instance.\r
-\r
-  @retval EFI_SUCCESS       Usb device is set to use Configuration 1 successfully.\r
-  @retval EFI_DEVICE_ERROR  Cannot set the usb device due to a hardware error.\r
-  @retval Others            Other failure occurs.\r
-\r
-**/\r
-EFI_STATUS\r
-PeiUsbSetConfiguration (\r
-  IN EFI_PEI_SERVICES         **PeiServices,\r
-  IN PEI_USB_IO_PPI           *UsbIoPpi\r
-  )\r
-{\r
-  EFI_USB_DEVICE_REQUEST  DevReq;\r
-  ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));\r
-\r
-  DevReq.RequestType  = USB_DEV_SET_CONFIGURATION_REQ_TYPE;\r
-  DevReq.Request      = USB_DEV_SET_CONFIGURATION;\r
-  DevReq.Value        = 1;\r
-\r
-  return UsbIoPpi->UsbControlTransfer (\r
-                     PeiServices,\r
-                     UsbIoPpi,\r
-                     &DevReq,\r
-                     EfiUsbNoData,\r
-                     PcdGet32 (PcdUsbTransferTimeoutValue),\r
-                     NULL,\r
-                     0\r
-                     );\r
-}\r
 \r
 /**\r
   Clear Endpoint Halt.\r
@@ -258,74 +131,4 @@ PeiUsbClearEndpointHalt (
   return Status;\r
 }\r
 \r
-/**\r
-  Judge if the port is connected with a usb device or not.\r
-\r
-  @param  PortStatus  The usb port status gotten.\r
 \r
-  @retval TRUE        A usb device is connected with the port.\r
-  @retval FALSE       No usb device is connected with the port.\r
-\r
-**/\r
-BOOLEAN\r
-IsPortConnect (\r
-  IN UINT16  PortStatus\r
-  )\r
-{\r
-  //\r
-  // return the bit 0 value of PortStatus\r
-  //\r
-  if ((PortStatus & USB_PORT_STAT_CONNECTION) != 0) {\r
-    return TRUE;\r
-  } else {\r
-    return FALSE;\r
-  }\r
-}\r
-\r
-/**\r
-  Judge if the port is connected with a low-speed usb device or not.\r
-\r
-  @param  PortStatus  The usb port status gotten.\r
-\r
-  @retval TRUE        A low-speed usb device is connected with the port.\r
-  @retval FALSE       No low-speed usb device is connected with the port.\r
-\r
-**/\r
-BOOLEAN\r
-IsPortLowSpeedDeviceAttached (\r
-  IN UINT16  PortStatus\r
-  )\r
-{\r
-  //\r
-  // return the bit 9 value of PortStatus\r
-  //\r
-  if ((PortStatus & USB_PORT_STAT_LOW_SPEED) != 0) {\r
-    return TRUE;\r
-  } else {\r
-    return FALSE;\r
-  }\r
-}\r
-\r
-/**\r
-  Judge if the port is in "connection change" status or not.\r
-\r
-  @param  PortChangeStatus  The usb port change status gotten.\r
-\r
-  @retval TRUE              The port is in "connection change" status.\r
-  @retval FALSE             The port is NOT in "connection change" status.\r
-\r
-**/\r
-BOOLEAN\r
-IsPortConnectChange (\r
-  IN UINT16  PortChangeStatus\r
-  )\r
-{\r
-  //\r
-  // return the bit 0 value of PortChangeStatus\r
-  //\r
-  if ((PortChangeStatus & USB_PORT_STAT_C_CONNECTION) != 0) {\r
-    return TRUE;\r
-  } else {\r
-    return FALSE;\r
-  }\r
-}\r