From: "Ni, Ruiyu" <ruiyu.ni@Intel.com>
To: Star Zeng <star.zeng@intel.com>, edk2-devel@lists.01.org
Cc: Hao Wu <hao.a.wu@intel.com>, Jian J Wang <jian.j.wang@intel.com>,
Jiewen Yao <jiewen.yao@intel.com>
Subject: Re: [PATCH 2/4] MdeModulePkg EhciDxe: Extract new EhciInsertAsyncIntTransfer function
Date: Fri, 26 Oct 2018 12:59:07 +0800 [thread overview]
Message-ID: <2ad85f7d-8ea7-2607-7eed-3d352d39370f@Intel.com> (raw)
In-Reply-To: <1540465113-103964-3-git-send-email-star.zeng@intel.com>
On 10/25/2018 6:58 PM, Star Zeng wrote:
> 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>
> ---
> MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c | 25 +----------
> MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c | 76 ++++++++++++++++++++++++++++++++
> MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.h | 36 ++++++++++++++-
> 3 files changed, 112 insertions(+), 25 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
> index 50b5598df4fb..5569f4f9618b 100644
> --- a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
> +++ b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.c
> @@ -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);
> diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c
> index 168280be81d7..d38340e49c8d 100644
> --- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c
> +++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c
> @@ -814,6 +814,82 @@ EhciDelAllAsyncIntTransfers (
> }
> }
>
> +/**
> + Insert a single asynchronous interrupt transfer for
> + the device and endpoint.
> +
> + @param Ehc The EHCI device.
> + @param DevAddr The device address.
> + @param EpAddr Endpoint addrress & its direction.
> + @param DevSpeed The device speed.
> + @param Toggle Initial data toggle to use.
> + @param MaxPacket The max packet length of the endpoint.
> + @param Hub The transaction translator to use.
> + @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.
> + @param Interval The interval for interrupt transfer.
> +
> + @return Created URB or NULL.
> +
> +**/
> +URB *
> +EhciInsertAsyncIntTransfer (
> + IN USB2_HC_DEV *Ehc,
> + IN UINT8 DevAddr,
> + IN UINT8 EpAddr,
> + IN UINT8 DevSpeed,
> + IN UINT8 Toggle,
> + IN UINTN MaxPacket,
> + IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Hub,
> + IN UINTN DataLen,
> + IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback,
> + IN VOID *Context,
> + IN UINTN Interval
> + )
> +{
> + VOID *Data;
> + URB *Urb;
> +
> + Data = AllocatePool (DataLen);
> +
> + if (Data == NULL) {
> + DEBUG ((DEBUG_ERROR, "%a: failed to allocate buffer\n", __FUNCTION__));
> + return NULL;
> + }
> +
> + Urb = EhcCreateUrb (
> + Ehc,
> + DevAddr,
> + EpAddr,
> + DevSpeed,
> + Toggle,
> + MaxPacket,
> + Hub,
> + EHC_INT_TRANSFER_ASYNC,
> + NULL,
> + Data,
> + DataLen,
> + Callback,
> + Context,
> + Interval
> + );
> +
> + if (Urb == NULL) {
> + DEBUG ((DEBUG_ERROR, "%a: failed to create URB\n", __FUNCTION__));
FreePool (Data)?
> + return NULL;
> + }
> +
> + //
> + // New asynchronous transfer must inserted to the head.
> + // Check the comments in EhcMoniteAsyncRequests
> + //
> + EhcLinkQhToPeriod (Ehc, Urb->Qh);
> + InsertHeadList (&Ehc->AsyncIntTransfers, &Urb->UrbList);
> +
> + return Urb;
> +}
>
> /**
> Flush data from PCI controller specific address to mapped system
> diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.h b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.h
> index c03bd619d7e8..b852e6327f37 100644
> --- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.h
> +++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.h
> @@ -2,7 +2,7 @@
>
> This file contains the definination for host controller schedule routines.
>
> -Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials
> are licensed and made available under the terms and conditions of the BSD License
> which accompanies this distribution. The full text of the license may be found at
> @@ -162,6 +162,40 @@ EhciDelAllAsyncIntTransfers (
> IN USB2_HC_DEV *Ehc
> );
>
> +/**
> + Insert a single asynchronous interrupt transfer for
> + the device and endpoint.
> +
> + @param Ehc The EHCI device.
> + @param DevAddr The device address.
> + @param EpAddr Endpoint addrress & its direction.
> + @param DevSpeed The device speed.
> + @param Toggle Initial data toggle to use.
> + @param MaxPacket The max packet length of the endpoint.
> + @param Hub The transaction translator to use.
> + @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.
> + @param Interval The interval for interrupt transfer.
> +
> + @return Created URB or NULL.
> +
> +**/
> +URB *
> +EhciInsertAsyncIntTransfer (
> + IN USB2_HC_DEV *Ehc,
> + IN UINT8 BusAddr,
> + IN UINT8 EpAddr,
> + IN UINT8 DevSpeed,
> + IN UINT8 Toggle,
> + IN UINTN MaxPacket,
> + IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Hub,
> + IN UINTN DataLen,
> + IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback,
> + IN VOID *Context,
> + IN UINTN Interval
> + );
>
> /**
> Interrupt transfer periodic check handler.
>
--
Thanks,
Ray
next prev parent reply other threads:[~2018-10-26 4:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-25 10:58 [PATCH 0/4] Remove unnecessary Map/Unmap in XhciDxe/EhciDxe for AsyncInterruptTransfer Star Zeng
2018-10-25 10:58 ` [PATCH 1/4] MdeModulePkg XhciDxe: Extract new XhciInsertAsyncIntTransfer function Star Zeng
2018-10-26 4:57 ` Ni, Ruiyu
2018-10-26 5:01 ` Zeng, Star
2018-10-26 5:05 ` Zeng, Star
2018-10-25 10:58 ` [PATCH 2/4] MdeModulePkg EhciDxe: Extract new EhciInsertAsyncIntTransfer function Star Zeng
2018-10-26 4:59 ` Ni, Ruiyu [this message]
2018-10-25 10:58 ` [PATCH 3/4] MdeModulePkg XhciDxe: Use common buffer for AsyncInterruptTransfer Star Zeng
2018-10-26 5:36 ` Ni, Ruiyu
2018-10-25 10:58 ` [PATCH 4/4] MdeModulePkg EhciDxe: " Star Zeng
2018-10-26 5:36 ` Ni, Ruiyu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2ad85f7d-8ea7-2607-7eed-3d352d39370f@Intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox