/** @file\r
The module is used to implement Usb Io PPI interfaces.\r
\r
-Copyright (c) 2006 - 2013, 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
EFI_STATUS Status;\r
PEI_USB_DEVICE *PeiUsbDev;\r
UINT32 TransferResult;\r
+ EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor;\r
+ UINT8 EndpointIndex;\r
\r
PeiUsbDev = PEI_USB_DEVICE_FROM_THIS (This);\r
\r
+ EndpointDescriptor = NULL;\r
+ EndpointIndex = 0;\r
+\r
+ if ((Request->Request == USB_REQ_CLEAR_FEATURE) &&\r
+ (Request->RequestType == USB_DEV_CLEAR_FEATURE_REQ_TYPE_E) &&\r
+ (Request->Value == USB_FEATURE_ENDPOINT_HALT)) {\r
+ //\r
+ // Request->Index is the Endpoint Address, use it to get the Endpoint Index.\r
+ //\r
+ while (EndpointIndex < MAX_ENDPOINT) {\r
+ Status = PeiUsbGetEndpointDescriptor (PeiServices, This, EndpointIndex, &EndpointDescriptor);\r
+ if (EFI_ERROR (Status)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (EndpointDescriptor->EndpointAddress == Request->Index) {\r
+ break;\r
+ }\r
+\r
+ EndpointIndex++;\r
+ }\r
+\r
+ if (EndpointIndex == MAX_ENDPOINT) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ }\r
+\r
if (PeiUsbDev->Usb2HcPpi != NULL) {\r
Status = PeiUsbDev->Usb2HcPpi->ControlTransfer (\r
PeiServices,\r
&TransferResult\r
);\r
}\r
+\r
+ //\r
+ // Reset the endpoint toggle when endpoint stall is cleared\r
+ //\r
+ if ((Request->Request == USB_REQ_CLEAR_FEATURE) &&\r
+ (Request->RequestType == USB_DEV_CLEAR_FEATURE_REQ_TYPE_E) &&\r
+ (Request->Value == USB_FEATURE_ENDPOINT_HALT)) {\r
+ if ((PeiUsbDev->DataToggle & (1 << EndpointIndex)) != 0) {\r
+ PeiUsbDev->DataToggle = (UINT16) (PeiUsbDev->DataToggle ^ (1 << EndpointIndex));\r
+ }\r
+ }\r
+\r
return Status;\r
}\r
\r
}\r
\r
if (OldToggle != DataToggle) {\r
- PeiUsbDev->DataToggle = (UINT8) (PeiUsbDev->DataToggle ^ (1 << EndpointIndex));\r
+ PeiUsbDev->DataToggle = (UINT16) (PeiUsbDev->DataToggle ^ (1 << EndpointIndex));\r
}\r
\r
return Status;\r