Revert "EhciDxe: Use common buffer for AsyncInterruptTransfer"

There is concern at the thread
https://lists.01.org/pipermail/edk2-devel/2018-November/031951.html.
And the time point is a little sensitive as it is near edk2-stable201811.

This reverts commit 0cd6452503.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
Star Zeng
2018-11-06 21:45:25 +08:00
parent 1ed6498c4a
commit f87db25620
4 changed files with 95 additions and 57 deletions

View File

@@ -339,14 +339,6 @@ EhcFreeUrb (
PciIo->Unmap (PciIo, Urb->DataMap);
}
if (Urb->AllocateCommonBuffer) {
PciIo->FreeBuffer (
PciIo,
EFI_SIZE_TO_PAGES (Urb->DataLen),
Urb->Data
);
}
if (Urb->Qh != NULL) {
//
// Ensure that this queue head has been unlinked from the
@@ -537,8 +529,7 @@ ON_ERROR:
@param Hub The transaction translator to use.
@param Type The transaction type.
@param Request The standard USB request for control transfer.
@param AllocateCommonBuffer Indicate whether need to allocate common buffer for data transfer.
@param Data The user data to transfer, NULL if AllocateCommonBuffer is TRUE.
@param Data The user data to transfer.
@param DataLen The length of data buffer.
@param Callback The function to call when data is transferred.
@param Context The context to the callback.
@@ -558,7 +549,6 @@ EhcCreateUrb (
IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Hub,
IN UINTN Type,
IN EFI_USB_DEVICE_REQUEST *Request,
IN BOOLEAN AllocateCommonBuffer,
IN VOID *Data,
IN UINTN DataLen,
IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback,
@@ -606,24 +596,8 @@ EhcCreateUrb (
Ep->PollRate = EhcConvertPollRate (Interval);
Urb->Request = Request;
if (AllocateCommonBuffer) {
ASSERT (Data == NULL);
Status = Ehc->PciIo->AllocateBuffer (
Ehc->PciIo,
AllocateAnyPages,
EfiBootServicesData,
EFI_SIZE_TO_PAGES (DataLen),
&Data,
0
);
if (EFI_ERROR (Status) || (Data == NULL)) {
FreePool (Urb);
return NULL;
}
}
Urb->Data = Data;
Urb->DataLen = DataLen;
Urb->AllocateCommonBuffer = AllocateCommonBuffer;
Urb->Callback = Callback;
Urb->Context = Context;
@@ -653,14 +627,10 @@ EhcCreateUrb (
if (Data != NULL) {
Len = DataLen;
if (Urb->AllocateCommonBuffer) {
MapOp = EfiPciIoOperationBusMasterCommonBuffer;
if (Ep->Direction == EfiUsbDataIn) {
MapOp = EfiPciIoOperationBusMasterWrite;
} else {
if (Ep->Direction == EfiUsbDataIn) {
MapOp = EfiPciIoOperationBusMasterWrite;
} else {
MapOp = EfiPciIoOperationBusMasterRead;
}
MapOp = EfiPciIoOperationBusMasterRead;
}
Status = PciIo->Map (PciIo, MapOp, Data, &Len, &PhyAddr, &Map);