]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusPei / PeiUsbLib.c
index 2ac8d7bae3713767236f9a3ea78b81d4fe97cffe..c5e599e2f77babb9fd8d94d84cc981ff761d4db3 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
 Common Libarary for PEI USB\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved. <BR>\r
-  \r
+Copyright (c) 2006 - 2018, 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
@@ -196,68 +196,6 @@ PeiUsbSetConfiguration (
                      );\r
 }\r
 \r
-/**\r
-  Clear Endpoint Halt.\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  EndpointAddress   The endpoint address.\r
-\r
-  @retval EFI_SUCCESS       Endpoint halt is cleared successfully.\r
-  @retval EFI_DEVICE_ERROR  Cannot clear the endpoint halt status due to a hardware error.\r
-  @retval Others            Other failure occurs.\r
-\r
-**/\r
-EFI_STATUS\r
-PeiUsbClearEndpointHalt (\r
-  IN EFI_PEI_SERVICES         **PeiServices,\r
-  IN PEI_USB_IO_PPI           *UsbIoPpi,\r
-  IN UINT8                    EndpointAddress\r
-  )\r
-{\r
-  EFI_STATUS                  Status;\r
-  PEI_USB_DEVICE              *PeiUsbDev;\r
-  EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor;\r
-  UINT8                       EndpointIndex;\r
-\r
-  EndpointIndex = 0;\r
-  PeiUsbDev     = PEI_USB_DEVICE_FROM_THIS (UsbIoPpi);\r
-\r
-  while (EndpointIndex < MAX_ENDPOINT) {\r
-    Status = UsbIoPpi->UsbGetEndpointDescriptor (PeiServices, UsbIoPpi, EndpointIndex, &EndpointDescriptor);\r
-    if (EFI_ERROR (Status)) {\r
-      return EFI_INVALID_PARAMETER;\r
-    }\r
-\r
-    if (EndpointDescriptor->EndpointAddress == EndpointAddress) {\r
-      break;\r
-    }\r
-\r
-    EndpointIndex++;\r
-  }\r
-\r
-  if (EndpointIndex == MAX_ENDPOINT) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  Status = PeiUsbClearDeviceFeature (\r
-            PeiServices,\r
-            UsbIoPpi,\r
-            EfiUsbEndpoint,\r
-            EfiUsbEndpointHalt,\r
-            EndpointAddress\r
-            );\r
-\r
-  //\r
-  // set data toggle to zero.\r
-  //\r
-  if ((PeiUsbDev->DataToggle & (1 << EndpointIndex)) != 0) {\r
-    PeiUsbDev->DataToggle = (UINT8) (PeiUsbDev->DataToggle ^ (1 << EndpointIndex));\r
-  }\r
-\r
-  return Status;\r
-}\r
-\r
 /**\r
   Judge if the port is connected with a usb device or not.\r
 \r
@@ -283,26 +221,24 @@ IsPortConnect (
 }\r
 \r
 /**\r
-  Judge if the port is connected with a low-speed usb device or not.\r
+  Get device speed according to port status.\r
 \r
-  @param  PortStatus  The usb port status gotten.\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
+  @return   Device speed value.\r
 \r
 **/\r
 UINTN\r
-IsPortLowSpeedDeviceAttached (\r
-  IN UINT16  PortStatus\r
+PeiUsbGetDeviceSpeed (\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 EFI_USB_SPEED_LOW;\r
   } else if ((PortStatus & USB_PORT_STAT_HIGH_SPEED) != 0){\r
     return EFI_USB_SPEED_HIGH;\r
+  } else if ((PortStatus & USB_PORT_STAT_SUPER_SPEED) != 0) {\r
+    return EFI_USB_SPEED_SUPER;\r
   } else {\r
     return EFI_USB_SPEED_FULL;\r
   }\r