MdeModulePkg EhciDxe: Extract new EhciInsertAsyncIntTransfer function

V3:
Match function parameter name and description between
EhciSched.c and EhciSched.h.

V2:
Add the missing "gBS->FreePool (Data);".

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1274

Extract new EhciInsertAsyncIntTransfer function from
EhcAsyncInterruptTransfer.

It is code preparation for following patch,
no essential functional change.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
Star Zeng
2018-10-24 19:27:22 +08:00
parent 6681582dcc
commit 4f792685e4
3 changed files with 111 additions and 25 deletions

View File

@@ -997,7 +997,6 @@ EhcAsyncInterruptTransfer (
URB *Urb;
EFI_TPL OldTpl;
EFI_STATUS Status;
UINT8 *Data;
//
// Validate parameters
@@ -1046,16 +1045,7 @@ EhcAsyncInterruptTransfer (
EhcAckAllInterrupt (Ehc);
Data = AllocatePool (DataLength);
if (Data == NULL) {
DEBUG ((EFI_D_ERROR, "EhcAsyncInterruptTransfer: failed to allocate buffer\n"));
Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
}
Urb = EhcCreateUrb (
Urb = EhciInsertAsyncIntTransfer (
Ehc,
DeviceAddress,
EndPointAddress,
@@ -1063,9 +1053,6 @@ EhcAsyncInterruptTransfer (
*DataToggle,
MaximumPacketLength,
Translator,
EHC_INT_TRANSFER_ASYNC,
NULL,
Data,
DataLength,
CallBackFunction,
Context,
@@ -1073,20 +1060,10 @@ EhcAsyncInterruptTransfer (
);
if (Urb == NULL) {
DEBUG ((EFI_D_ERROR, "EhcAsyncInterruptTransfer: failed to create URB\n"));
gBS->FreePool (Data);
Status = EFI_OUT_OF_RESOURCES;
goto ON_EXIT;
}
//
// New asynchronous transfer must inserted to the head.
// Check the comments in EhcMoniteAsyncRequests
//
EhcLinkQhToPeriod (Ehc, Urb->Qh);
InsertHeadList (&Ehc->AsyncIntTransfers, &Urb->UrbList);
ON_EXIT:
Ehc->PciIo->Flush (Ehc->PciIo);
gBS->RestoreTPL (OldTpl);