/** @file\r
Common Libarary for PEI USB.\r
\r
-Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\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
IN UINT8 EndpointAddress\r
)\r
{\r
- EFI_STATUS Status;\r
- PEI_USB_DEVICE *PeiUsbDev;\r
- EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor;\r
- UINT8 EndpointIndex;\r
+ EFI_STATUS Status;\r
+ EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDesc;\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
+ //\r
+ // Check its interface\r
+ //\r
+ Status = UsbIoPpi->UsbGetInterfaceDescriptor (\r
+ PeiServices,\r
+ UsbIoPpi,\r
+ &InterfaceDesc\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ for (EndpointIndex = 0; EndpointIndex < InterfaceDesc->NumEndpoints; EndpointIndex++) {\r
Status = UsbIoPpi->UsbGetEndpointDescriptor (PeiServices, UsbIoPpi, EndpointIndex, &EndpointDescriptor);\r
if (EFI_ERROR (Status)) {\r
return EFI_INVALID_PARAMETER;\r
if (EndpointDescriptor->EndpointAddress == EndpointAddress) {\r
break;\r
}\r
-\r
- EndpointIndex++;\r
}\r
\r
- if (EndpointIndex == MAX_ENDPOINT) {\r
+ if (EndpointIndex == InterfaceDesc->NumEndpoints) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\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