MdeModulePkg/EhciDxe: Use BaseLib linked list iteration macros

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

Replaces usage of the linked list iteration macros defined in Ehci.h
with the common definition in BaseLib.h.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Guomin Jiang <guomin.jiang@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
This commit is contained in:
Michael Kubacki 2020-04-11 04:02:13 +08:00 committed by mergify[bot]
parent 3b5a58c5f0
commit e33d3e7f56
4 changed files with 12 additions and 22 deletions

View File

@ -3,6 +3,7 @@
Provides some data struct used by EHCI controller driver. Provides some data struct used by EHCI controller driver.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR> Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -80,20 +81,6 @@ typedef struct _USB2_HC_DEV USB2_HC_DEV;
// //
#define EHC_TPL TPL_NOTIFY #define EHC_TPL TPL_NOTIFY
//
//Iterate through the double linked list. NOT delete safe
//
#define EFI_LIST_FOR_EACH(Entry, ListHead) \
for(Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry = Entry->ForwardLink)
//
//Iterate through the double linked list. This is delete-safe.
//Don't touch NextEntry
//
#define EFI_LIST_FOR_EACH_SAFE(Entry, NextEntry, ListHead) \
for(Entry = (ListHead)->ForwardLink, NextEntry = Entry->ForwardLink;\
Entry != (ListHead); Entry = NextEntry, NextEntry = Entry->ForwardLink)
#define EFI_LIST_CONTAINER(Entry, Type, Field) BASE_CR(Entry, Type, Field) #define EFI_LIST_CONTAINER(Entry, Type, Field) BASE_CR(Entry, Type, Field)

View File

@ -3,6 +3,7 @@
This file provides the information dump support for EHCI when in debug mode. This file provides the information dump support for EHCI when in debug mode.
Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR> Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -185,7 +186,7 @@ EhcDumpQh (
DEBUG ((EFI_D_VERBOSE, "\n")); DEBUG ((EFI_D_VERBOSE, "\n"));
EFI_LIST_FOR_EACH (Entry, &Qh->Qtds) { BASE_LIST_FOR_EACH (Entry, &Qh->Qtds) {
Qtd = EFI_LIST_CONTAINER (Entry, EHC_QTD, QtdList); Qtd = EFI_LIST_CONTAINER (Entry, EHC_QTD, QtdList);
EhcDumpQtd (Qtd, NULL); EhcDumpQtd (Qtd, NULL);

View File

@ -3,6 +3,7 @@
EHCI transfer scheduling routines. EHCI transfer scheduling routines.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR> Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -577,7 +578,7 @@ EhcCheckUrbResult (
goto ON_EXIT; goto ON_EXIT;
} }
EFI_LIST_FOR_EACH (Entry, &Urb->Qh->Qtds) { BASE_LIST_FOR_EACH (Entry, &Urb->Qh->Qtds) {
Qtd = EFI_LIST_CONTAINER (Entry, EHC_QTD, QtdList); Qtd = EFI_LIST_CONTAINER (Entry, EHC_QTD, QtdList);
QtdHw = &Qtd->QtdHw; QtdHw = &Qtd->QtdHw;
State = (UINT8) QtdHw->Status; State = (UINT8) QtdHw->Status;
@ -757,7 +758,7 @@ EhciDelAsyncIntTransfer (
Direction = (((EpNum & 0x80) != 0) ? EfiUsbDataIn : EfiUsbDataOut); Direction = (((EpNum & 0x80) != 0) ? EfiUsbDataIn : EfiUsbDataOut);
EpNum &= 0x0F; EpNum &= 0x0F;
EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Ehc->AsyncIntTransfers) { BASE_LIST_FOR_EACH_SAFE (Entry, Next, &Ehc->AsyncIntTransfers) {
Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList); Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList);
if ((Urb->Ep.DevAddr == DevAddr) && (Urb->Ep.EpAddr == EpNum) && if ((Urb->Ep.DevAddr == DevAddr) && (Urb->Ep.EpAddr == EpNum) &&
@ -797,7 +798,7 @@ EhciDelAllAsyncIntTransfers (
LIST_ENTRY *Next; LIST_ENTRY *Next;
URB *Urb; URB *Urb;
EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Ehc->AsyncIntTransfers) { BASE_LIST_FOR_EACH_SAFE (Entry, Next, &Ehc->AsyncIntTransfers) {
Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList); Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList);
EhcUnlinkQhFromPeriod (Ehc, Urb->Qh); EhcUnlinkQhFromPeriod (Ehc, Urb->Qh);
@ -965,7 +966,7 @@ EhcUpdateAsyncRequest (
if (Urb->Result == EFI_USB_NOERROR) { if (Urb->Result == EFI_USB_NOERROR) {
FirstQtd = NULL; FirstQtd = NULL;
EFI_LIST_FOR_EACH (Entry, &Urb->Qh->Qtds) { BASE_LIST_FOR_EACH (Entry, &Urb->Qh->Qtds) {
Qtd = EFI_LIST_CONTAINER (Entry, EHC_QTD, QtdList); Qtd = EFI_LIST_CONTAINER (Entry, EHC_QTD, QtdList);
if (FirstQtd == NULL) { if (FirstQtd == NULL) {
@ -1049,7 +1050,7 @@ EhcMonitorAsyncRequests (
OldTpl = gBS->RaiseTPL (EHC_TPL); OldTpl = gBS->RaiseTPL (EHC_TPL);
Ehc = (USB2_HC_DEV *) Context; Ehc = (USB2_HC_DEV *) Context;
EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Ehc->AsyncIntTransfers) { BASE_LIST_FOR_EACH_SAFE (Entry, Next, &Ehc->AsyncIntTransfers) {
Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList); Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList);
// //

View File

@ -4,6 +4,7 @@
URB (Usb Request Block). URB (Usb Request Block).
Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR> Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent SPDX-License-Identifier: BSD-2-Clause-Patent
**/ **/
@ -299,7 +300,7 @@ EhcFreeQtds (
LIST_ENTRY *Next; LIST_ENTRY *Next;
EHC_QTD *Qtd; EHC_QTD *Qtd;
EFI_LIST_FOR_EACH_SAFE (Entry, Next, Qtds) { BASE_LIST_FOR_EACH_SAFE (Entry, Next, Qtds) {
Qtd = EFI_LIST_CONTAINER (Entry, EHC_QTD, QtdList); Qtd = EFI_LIST_CONTAINER (Entry, EHC_QTD, QtdList);
RemoveEntryList (&Qtd->QtdList); RemoveEntryList (&Qtd->QtdList);
@ -482,7 +483,7 @@ EhcCreateQtds (
// //
// OK, all the QTDs needed are created. Now, fix the NextQtd point // OK, all the QTDs needed are created. Now, fix the NextQtd point
// //
EFI_LIST_FOR_EACH (Entry, &Qh->Qtds) { BASE_LIST_FOR_EACH (Entry, &Qh->Qtds) {
Qtd = EFI_LIST_CONTAINER (Entry, EHC_QTD, QtdList); Qtd = EFI_LIST_CONTAINER (Entry, EHC_QTD, QtdList);
// //