MdeModulePkg UsbBotPei: The UsbBotPei module contains the private structure definition used by the UsbBusPei module.
If the structure layout in UsbBusPei is changed, then the UsbBotPei will not work. 1. As the maximum number of endpoints is 16, use UINT16 type rather than UINT8 for DataToggle. 2. DataToggle needs to be reset to 0 when endpoint stall is cleared, do it in PeiUsbControlTransfer(). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15185 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Common Libarary for PEI USB.
|
||||
|
||||
Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions
|
||||
@@ -215,15 +215,24 @@ PeiUsbClearEndpointHalt (
|
||||
IN UINT8 EndpointAddress
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
PEI_USB_DEVICE *PeiUsbDev;
|
||||
EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor;
|
||||
UINT8 EndpointIndex;
|
||||
EFI_STATUS Status;
|
||||
EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDesc;
|
||||
EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor;
|
||||
UINT8 EndpointIndex;
|
||||
|
||||
EndpointIndex = 0;
|
||||
PeiUsbDev = PEI_USB_DEVICE_FROM_THIS (UsbIoPpi);
|
||||
|
||||
while (EndpointIndex < MAX_ENDPOINT) {
|
||||
//
|
||||
// Check its interface
|
||||
//
|
||||
Status = UsbIoPpi->UsbGetInterfaceDescriptor (
|
||||
PeiServices,
|
||||
UsbIoPpi,
|
||||
&InterfaceDesc
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
for (EndpointIndex = 0; EndpointIndex < InterfaceDesc->NumEndpoints; EndpointIndex++) {
|
||||
Status = UsbIoPpi->UsbGetEndpointDescriptor (PeiServices, UsbIoPpi, EndpointIndex, &EndpointDescriptor);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -232,11 +241,9 @@ PeiUsbClearEndpointHalt (
|
||||
if (EndpointDescriptor->EndpointAddress == EndpointAddress) {
|
||||
break;
|
||||
}
|
||||
|
||||
EndpointIndex++;
|
||||
}
|
||||
|
||||
if (EndpointIndex == MAX_ENDPOINT) {
|
||||
if (EndpointIndex == InterfaceDesc->NumEndpoints) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@@ -248,13 +255,6 @@ PeiUsbClearEndpointHalt (
|
||||
EndpointAddress
|
||||
);
|
||||
|
||||
//
|
||||
// set data toggle to zero.
|
||||
//
|
||||
if ((PeiUsbDev->DataToggle & (1 << EndpointIndex)) != 0) {
|
||||
PeiUsbDev->DataToggle = (UINT8) (PeiUsbDev->DataToggle ^ (1 << EndpointIndex));
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user