* [PATCH v2 1/7] MdePkg/BaseLib: Add linked list iteration macros
[not found] <20200410200218.24992-1-michael.kubacki@outlook.com>
@ 2020-04-10 20:02 ` Michael Kubacki
2020-04-10 23:43 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-04-17 1:44 ` Zhiguang Liu
2020-04-10 20:02 ` [PATCH v2 2/7] MdeModulePkg/EhciDxe: Use BaseLib " Michael Kubacki
` (5 subsequent siblings)
6 siblings, 2 replies; 15+ messages in thread
From: Michael Kubacki @ 2020-04-10 20:02 UTC (permalink / raw)
To: devel
Cc: Dandan Bi, Hao A Wu, Jian J Wang, Liming Gao, Michael D Kinney,
Sean Brogan
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1959
The macros EFI_LIST_FOR_EACH and EFI_LIST_FOR_EACH_SAFE have been
duplicated across several drivers. These macros have proven useful and
established a commonly used pattern for linked list iteration.
This change defines the macros in BaseLib.h alongside other generic linked
list macros and functions.
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: Michael D Kinney <michael.d.kinney@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>
---
MdePkg/Include/Library/BaseLib.h | 27 ++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index ecadff8b235e..d066f1be2495 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -4,6 +4,7 @@
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -2972,6 +2973,32 @@ PathCleanUpDirectories(
**/
#define INITIALIZE_LIST_HEAD_VARIABLE(ListHead) {&(ListHead), &(ListHead)}
+/**
+ Iterates over each node in a doubly linked list using each node's forward link.
+
+ @param Entry A pointer to a list node used as a loop cursor during iteration
+ @param ListHead The head node of the doubly linked list
+
+**/
+#define BASE_LIST_FOR_EACH(Entry, ListHead) \
+ for(Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry = Entry->ForwardLink)
+
+/**
+ Iterates over each node in a doubly linked list using each node's forward link
+ with safety against node removal.
+
+ This macro uses NextEntry to temporarily store the next list node so the node
+ pointed to by Entry may be deleted in the current loop iteration step and
+ iteration can continue from the node pointed to by NextEntry.
+
+ @param Entry A pointer to a list node used as a loop cursor during iteration
+ @param NextEntry A pointer to a list node used to temporarily store the next node
+ @param ListHead The head node of the doubly linked list
+
+**/
+#define BASE_LIST_FOR_EACH_SAFE(Entry, NextEntry, ListHead) \
+ for(Entry = (ListHead)->ForwardLink, NextEntry = Entry->ForwardLink;\
+ Entry != (ListHead); Entry = NextEntry, NextEntry = Entry->ForwardLink)
/**
Checks whether FirstEntry and SecondEntry are part of the same doubly-linked
--
2.16.3.windows.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [EXTERNAL] [edk2-devel] [PATCH v2 1/7] MdePkg/BaseLib: Add linked list iteration macros
2020-04-10 20:02 ` [PATCH v2 1/7] MdePkg/BaseLib: Add linked list iteration macros Michael Kubacki
@ 2020-04-10 23:43 ` Bret Barkelew
2020-04-17 1:44 ` Zhiguang Liu
1 sibling, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2020-04-10 23:43 UTC (permalink / raw)
To: devel@edk2.groups.io, michael.kubacki@outlook.com
Cc: Dandan Bi, Hao A Wu, Jian J Wang, Liming Gao, Kinney, Michael D,
Sean Brogan
[-- Attachment #1: Type: text/plain, Size: 3784 bytes --]
Reviewed-by: Bret Barkelew <bret.barkelew@micrsoft.com>
- Bret
________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Michael Kubacki via groups.io <michael.kubacki=outlook.com@groups.io>
Sent: Friday, April 10, 2020 1:02:12 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Dandan Bi <dandan.bi@intel.com>; Hao A Wu <hao.a.wu@intel.com>; Jian J Wang <jian.j.wang@intel.com>; Liming Gao <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan <sean.brogan@microsoft.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH v2 1/7] MdePkg/BaseLib: Add linked list iteration macros
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D1959&data=02%7C01%7CBret.Barkelew%40microsoft.com%7C94961c566a924c5b25ec08d7dd8a20bc%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637221457630835410&sdata=HmJaCO%2BcGBU51%2BU1e1D7I3WN0x4PRq9LhH9d9hOBo4s%3D&reserved=0
The macros EFI_LIST_FOR_EACH and EFI_LIST_FOR_EACH_SAFE have been
duplicated across several drivers. These macros have proven useful and
established a commonly used pattern for linked list iteration.
This change defines the macros in BaseLib.h alongside other generic linked
list macros and functions.
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: Michael D Kinney <michael.d.kinney@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>
---
MdePkg/Include/Library/BaseLib.h | 27 ++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index ecadff8b235e..d066f1be2495 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -4,6 +4,7 @@
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -2972,6 +2973,32 @@ PathCleanUpDirectories(
**/
#define INITIALIZE_LIST_HEAD_VARIABLE(ListHead) {&(ListHead), &(ListHead)}
+/**
+ Iterates over each node in a doubly linked list using each node's forward link.
+
+ @param Entry A pointer to a list node used as a loop cursor during iteration
+ @param ListHead The head node of the doubly linked list
+
+**/
+#define BASE_LIST_FOR_EACH(Entry, ListHead) \
+ for(Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry = Entry->ForwardLink)
+
+/**
+ Iterates over each node in a doubly linked list using each node's forward link
+ with safety against node removal.
+
+ This macro uses NextEntry to temporarily store the next list node so the node
+ pointed to by Entry may be deleted in the current loop iteration step and
+ iteration can continue from the node pointed to by NextEntry.
+
+ @param Entry A pointer to a list node used as a loop cursor during iteration
+ @param NextEntry A pointer to a list node used to temporarily store the next node
+ @param ListHead The head node of the doubly linked list
+
+**/
+#define BASE_LIST_FOR_EACH_SAFE(Entry, NextEntry, ListHead) \
+ for(Entry = (ListHead)->ForwardLink, NextEntry = Entry->ForwardLink;\
+ Entry != (ListHead); Entry = NextEntry, NextEntry = Entry->ForwardLink)
/**
Checks whether FirstEntry and SecondEntry are part of the same doubly-linked
--
2.16.3.windows.1
[-- Attachment #2: Type: text/html, Size: 6391 bytes --]
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [edk2-devel] [PATCH v2 1/7] MdePkg/BaseLib: Add linked list iteration macros
2020-04-10 20:02 ` [PATCH v2 1/7] MdePkg/BaseLib: Add linked list iteration macros Michael Kubacki
2020-04-10 23:43 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
@ 2020-04-17 1:44 ` Zhiguang Liu
1 sibling, 0 replies; 15+ messages in thread
From: Zhiguang Liu @ 2020-04-17 1:44 UTC (permalink / raw)
To: devel@edk2.groups.io, michael.kubacki@outlook.com
Cc: Bi, Dandan, Wu, Hao A, Wang, Jian J, Gao, Liming,
Kinney, Michael D, Sean Brogan
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael Kubacki
Sent: Saturday, April 11, 2020 4:02 AM
To: devel@edk2.groups.io
Cc: Bi, Dandan <dandan.bi@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan <sean.brogan@microsoft.com>
Subject: [edk2-devel] [PATCH v2 1/7] MdePkg/BaseLib: Add linked list iteration macros
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1959
The macros EFI_LIST_FOR_EACH and EFI_LIST_FOR_EACH_SAFE have been duplicated across several drivers. These macros have proven useful and established a commonly used pattern for linked list iteration.
This change defines the macros in BaseLib.h alongside other generic linked list macros and functions.
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: Michael D Kinney <michael.d.kinney@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>
---
MdePkg/Include/Library/BaseLib.h | 27 ++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/MdePkg/Include/Library/BaseLib.h b/MdePkg/Include/Library/BaseLib.h
index ecadff8b235e..d066f1be2495 100644
--- a/MdePkg/Include/Library/BaseLib.h
+++ b/MdePkg/Include/Library/BaseLib.h
@@ -4,6 +4,7 @@
Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR> Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -2972,6 +2973,32 @@ PathCleanUpDirectories( **/ #define INITIALIZE_LIST_HEAD_VARIABLE(ListHead) {&(ListHead), &(ListHead)}
+/**
+ Iterates over each node in a doubly linked list using each node's forward link.
+
+ @param Entry A pointer to a list node used as a loop cursor during iteration
+ @param ListHead The head node of the doubly linked list
+
+**/
+#define BASE_LIST_FOR_EACH(Entry, ListHead) \
+ for(Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry =
+Entry->ForwardLink)
+
+/**
+ Iterates over each node in a doubly linked list using each node's
+forward link
+ with safety against node removal.
+
+ This macro uses NextEntry to temporarily store the next list node so
+ the node pointed to by Entry may be deleted in the current loop
+ iteration step and iteration can continue from the node pointed to by NextEntry.
+
+ @param Entry A pointer to a list node used as a loop cursor during iteration
+ @param NextEntry A pointer to a list node used to temporarily store
+ the next node @param ListHead The head node of the doubly linked
+ list
+
+**/
+#define BASE_LIST_FOR_EACH_SAFE(Entry, NextEntry, ListHead) \
+ for(Entry = (ListHead)->ForwardLink, NextEntry = Entry->ForwardLink;\
+ Entry != (ListHead); Entry = NextEntry, NextEntry =
+Entry->ForwardLink)
/**
Checks whether FirstEntry and SecondEntry are part of the same doubly-linked
--
2.16.3.windows.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 2/7] MdeModulePkg/EhciDxe: Use BaseLib linked list iteration macros
[not found] <20200410200218.24992-1-michael.kubacki@outlook.com>
2020-04-10 20:02 ` [PATCH v2 1/7] MdePkg/BaseLib: Add linked list iteration macros Michael Kubacki
@ 2020-04-10 20:02 ` Michael Kubacki
2020-04-10 23:42 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-04-10 20:02 ` [PATCH v2 3/7] MdeModulePkg/EhciPei: " Michael Kubacki
` (4 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Michael Kubacki @ 2020-04-10 20:02 UTC (permalink / raw)
To: devel; +Cc: Dandan Bi, Hao A Wu, Jian J Wang, Liming Gao, Ray Ni, Sean Brogan
From: Michael Kubacki <michael.kubacki@microsoft.com>
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>
---
MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c | 3 ++-
MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c | 11 ++++++-----
MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c | 5 +++--
MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h | 15 +--------------
4 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c
index e10f6bb357ab..db0e2c6d39c6 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c
@@ -3,6 +3,7 @@
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) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -185,7 +186,7 @@ EhcDumpQh (
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);
EhcDumpQtd (Qtd, NULL);
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c
index 7db637aa2cb9..5fe7cf466939 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c
@@ -3,6 +3,7 @@
EHCI transfer scheduling routines.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -577,7 +578,7 @@ EhcCheckUrbResult (
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);
QtdHw = &Qtd->QtdHw;
State = (UINT8) QtdHw->Status;
@@ -757,7 +758,7 @@ EhciDelAsyncIntTransfer (
Direction = (((EpNum & 0x80) != 0) ? EfiUsbDataIn : EfiUsbDataOut);
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);
if ((Urb->Ep.DevAddr == DevAddr) && (Urb->Ep.EpAddr == EpNum) &&
@@ -797,7 +798,7 @@ EhciDelAllAsyncIntTransfers (
LIST_ENTRY *Next;
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);
EhcUnlinkQhFromPeriod (Ehc, Urb->Qh);
@@ -965,7 +966,7 @@ EhcUpdateAsyncRequest (
if (Urb->Result == EFI_USB_NOERROR) {
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);
if (FirstQtd == NULL) {
@@ -1049,7 +1050,7 @@ EhcMonitorAsyncRequests (
OldTpl = gBS->RaiseTPL (EHC_TPL);
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);
//
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c
index ac5ddd259a83..37cef6d130f7 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c
@@ -4,6 +4,7 @@
URB (Usb Request Block).
Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -299,7 +300,7 @@ EhcFreeQtds (
LIST_ENTRY *Next;
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);
RemoveEntryList (&Qtd->QtdList);
@@ -482,7 +483,7 @@ EhcCreateQtds (
//
// 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);
//
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h
index 31fb171497a8..65933d94396e 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h
@@ -3,6 +3,7 @@
Provides some data struct used by EHCI controller driver.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -80,20 +81,6 @@ typedef struct _USB2_HC_DEV USB2_HC_DEV;
//
#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)
--
2.16.3.windows.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [EXTERNAL] [edk2-devel] [PATCH v2 2/7] MdeModulePkg/EhciDxe: Use BaseLib linked list iteration macros
2020-04-10 20:02 ` [PATCH v2 2/7] MdeModulePkg/EhciDxe: Use BaseLib " Michael Kubacki
@ 2020-04-10 23:42 ` Bret Barkelew
0 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2020-04-10 23:42 UTC (permalink / raw)
To: devel@edk2.groups.io, michael.kubacki@outlook.com
Cc: Dandan Bi, Hao A Wu, Jian J Wang, Liming Gao, Ray Ni, Sean Brogan
[-- Attachment #1: Type: text/plain, Size: 6982 bytes --]
Reviewed-by: Bret Barkelew <bret.barkelew@micrsoft.com>
- Bret
From: Michael Kubacki via groups.io<mailto:michael.kubacki=outlook.com@groups.io>
Sent: Friday, April 10, 2020 1:02 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Dandan Bi<mailto:dandan.bi@intel.com>; Hao A Wu<mailto:hao.a.wu@intel.com>; Jian J Wang<mailto:jian.j.wang@intel.com>; Liming Gao<mailto:liming.gao@intel.com>; Ray Ni<mailto:ray.ni@intel.com>; Sean Brogan<mailto:sean.brogan@microsoft.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH v2 2/7] MdeModulePkg/EhciDxe: Use BaseLib linked list iteration macros
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D1959&data=02%7C01%7Cbret.barkelew%40microsoft.com%7Ce3d00585bdea48b8a1c308d7dd8a2296%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637221457660162476&sdata=%2BbDiOEckmCFTUHLWOAa1pohNf65HMeHx5YiJQ7C5hHc%3D&reserved=0
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>
---
MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c | 3 ++-
MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c | 11 ++++++-----
MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c | 5 +++--
MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h | 15 +--------------
4 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c
index e10f6bb357ab..db0e2c6d39c6 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciDebug.c
@@ -3,6 +3,7 @@
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) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -185,7 +186,7 @@ EhcDumpQh (
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);
EhcDumpQtd (Qtd, NULL);
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c
index 7db637aa2cb9..5fe7cf466939 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c
@@ -3,6 +3,7 @@
EHCI transfer scheduling routines.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -577,7 +578,7 @@ EhcCheckUrbResult (
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);
QtdHw = &Qtd->QtdHw;
State = (UINT8) QtdHw->Status;
@@ -757,7 +758,7 @@ EhciDelAsyncIntTransfer (
Direction = (((EpNum & 0x80) != 0) ? EfiUsbDataIn : EfiUsbDataOut);
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);
if ((Urb->Ep.DevAddr == DevAddr) && (Urb->Ep.EpAddr == EpNum) &&
@@ -797,7 +798,7 @@ EhciDelAllAsyncIntTransfers (
LIST_ENTRY *Next;
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);
EhcUnlinkQhFromPeriod (Ehc, Urb->Qh);
@@ -965,7 +966,7 @@ EhcUpdateAsyncRequest (
if (Urb->Result == EFI_USB_NOERROR) {
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);
if (FirstQtd == NULL) {
@@ -1049,7 +1050,7 @@ EhcMonitorAsyncRequests (
OldTpl = gBS->RaiseTPL (EHC_TPL);
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);
//
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c
index ac5ddd259a83..37cef6d130f7 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c
@@ -4,6 +4,7 @@
URB (Usb Request Block).
Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -299,7 +300,7 @@ EhcFreeQtds (
LIST_ENTRY *Next;
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);
RemoveEntryList (&Qtd->QtdList);
@@ -482,7 +483,7 @@ EhcCreateQtds (
//
// 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);
//
diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h
index 31fb171497a8..65933d94396e 100644
--- a/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h
+++ b/MdeModulePkg/Bus/Pci/EhciDxe/Ehci.h
@@ -3,6 +3,7 @@
Provides some data struct used by EHCI controller driver.
Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -80,20 +81,6 @@ typedef struct _USB2_HC_DEV USB2_HC_DEV;
//
#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)
--
2.16.3.windows.1
[-- Attachment #2: Type: text/html, Size: 11594 bytes --]
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 3/7] MdeModulePkg/EhciPei: Use BaseLib linked list iteration macros
[not found] <20200410200218.24992-1-michael.kubacki@outlook.com>
2020-04-10 20:02 ` [PATCH v2 1/7] MdePkg/BaseLib: Add linked list iteration macros Michael Kubacki
2020-04-10 20:02 ` [PATCH v2 2/7] MdeModulePkg/EhciDxe: Use BaseLib " Michael Kubacki
@ 2020-04-10 20:02 ` Michael Kubacki
2020-04-10 23:38 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-04-10 20:02 ` [PATCH v2 4/7] MdeModulePkg/XhciDxe: " Michael Kubacki
` (3 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Michael Kubacki @ 2020-04-10 20:02 UTC (permalink / raw)
To: devel; +Cc: Dandan Bi, Hao A Wu, Jian J Wang, Liming Gao, Ray Ni, Sean Brogan
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1959
Replaces usage of the linked list iteration macros defined in EhcPeim.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>
---
MdeModulePkg/Bus/Pci/EhciPei/EhciSched.c | 3 ++-
MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c | 5 +++--
MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.h | 16 ++--------------
MdeModulePkg/Bus/Pci/EhciPei/EhciPei.inf | 2 ++
4 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhciSched.c b/MdeModulePkg/Bus/Pci/EhciPei/EhciSched.c
index 8eb432dfc31d..311f50198062 100644
--- a/MdeModulePkg/Bus/Pci/EhciPei/EhciSched.c
+++ b/MdeModulePkg/Bus/Pci/EhciPei/EhciSched.c
@@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid
which is used to enable recovery function from USB Drivers.
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -323,7 +324,7 @@ EhcCheckUrbResult (
goto ON_EXIT;
}
- EFI_LIST_FOR_EACH (Entry, &Urb->Qh->Qtds) {
+ BASE_LIST_FOR_EACH (Entry, &Urb->Qh->Qtds) {
Qtd = EFI_LIST_CONTAINER (Entry, PEI_EHC_QTD, QtdList);
QtdHw = &Qtd->QtdHw;
State = (UINT8) QtdHw->Status;
diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c b/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
index 995ccd2463d2..df512ed6fa59 100644
--- a/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
+++ b/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
@@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid
which is used to enable recovery function from USB Drivers.
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -290,7 +291,7 @@ EhcFreeQtds (
EFI_LIST_ENTRY *Next;
PEI_EHC_QTD *Qtd;
- EFI_LIST_FOR_EACH_SAFE (Entry, Next, Qtds) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, Next, Qtds) {
Qtd = EFI_LIST_CONTAINER (Entry, PEI_EHC_QTD, QtdList);
RemoveEntryList (&Qtd->QtdList);
@@ -461,7 +462,7 @@ EhcCreateQtds (
//
// 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, PEI_EHC_QTD, QtdList);
//
diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.h b/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.h
index 6b69f7a656ce..8e5b6418e6ee 100644
--- a/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.h
+++ b/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.h
@@ -2,6 +2,7 @@
Private Header file for Usb Host Controller PEIM
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -17,6 +18,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Ppi/IoMmu.h>
#include <Ppi/EndOfPeiPhase.h>
+#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/PeimEntryPoint.h>
#include <Library/PeiServicesLib.h>
@@ -60,20 +62,6 @@ typedef struct _PEI_USB2_HC_DEV PEI_USB2_HC_DEV;
//
#define EHC_SYNC_POLL_INTERVAL (6 * EHC_1_MILLISECOND)
-//
-//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)
diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhciPei.inf b/MdeModulePkg/Bus/Pci/EhciPei/EhciPei.inf
index 0fc09ffca434..01ebb371a72e 100644
--- a/MdeModulePkg/Bus/Pci/EhciPei/EhciPei.inf
+++ b/MdeModulePkg/Bus/Pci/EhciPei/EhciPei.inf
@@ -5,6 +5,7 @@
# which is used to enable recovery function from USB Drivers.
#
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) Microsoft Corporation.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -47,6 +48,7 @@
[LibraryClasses]
IoLib
TimerLib
+ BaseLib
BaseMemoryLib
PeimEntryPoint
PeiServicesLib
--
2.16.3.windows.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [EXTERNAL] [edk2-devel] [PATCH v2 3/7] MdeModulePkg/EhciPei: Use BaseLib linked list iteration macros
2020-04-10 20:02 ` [PATCH v2 3/7] MdeModulePkg/EhciPei: " Michael Kubacki
@ 2020-04-10 23:38 ` Bret Barkelew
0 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2020-04-10 23:38 UTC (permalink / raw)
To: devel@edk2.groups.io, michael.kubacki@outlook.com
Cc: Dandan Bi, Hao A Wu, Jian J Wang, Liming Gao, Ray Ni, Sean Brogan
[-- Attachment #1: Type: text/plain, Size: 5986 bytes --]
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
- Bret
________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Michael Kubacki via groups.io <michael.kubacki=outlook.com@groups.io>
Sent: Friday, April 10, 2020 1:02:14 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Dandan Bi <dandan.bi@intel.com>; Hao A Wu <hao.a.wu@intel.com>; Jian J Wang <jian.j.wang@intel.com>; Liming Gao <liming.gao@intel.com>; Ray Ni <ray.ni@intel.com>; Sean Brogan <sean.brogan@microsoft.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH v2 3/7] MdeModulePkg/EhciPei: Use BaseLib linked list iteration macros
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D1959&data=02%7C01%7CBret.Barkelew%40microsoft.com%7C2dea7084273f465de25608d7dd8a25f0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637221457723162038&sdata=DgZueRYdKEycj4iAeW4tVpSH5ptQcz3NSuCv35XUGDM%3D&reserved=0
Replaces usage of the linked list iteration macros defined in EhcPeim.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>
---
MdeModulePkg/Bus/Pci/EhciPei/EhciSched.c | 3 ++-
MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c | 5 +++--
MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.h | 16 ++--------------
MdeModulePkg/Bus/Pci/EhciPei/EhciPei.inf | 2 ++
4 files changed, 9 insertions(+), 17 deletions(-)
diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhciSched.c b/MdeModulePkg/Bus/Pci/EhciPei/EhciSched.c
index 8eb432dfc31d..311f50198062 100644
--- a/MdeModulePkg/Bus/Pci/EhciPei/EhciSched.c
+++ b/MdeModulePkg/Bus/Pci/EhciPei/EhciSched.c
@@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid
which is used to enable recovery function from USB Drivers.
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -323,7 +324,7 @@ EhcCheckUrbResult (
goto ON_EXIT;
}
- EFI_LIST_FOR_EACH (Entry, &Urb->Qh->Qtds) {
+ BASE_LIST_FOR_EACH (Entry, &Urb->Qh->Qtds) {
Qtd = EFI_LIST_CONTAINER (Entry, PEI_EHC_QTD, QtdList);
QtdHw = &Qtd->QtdHw;
State = (UINT8) QtdHw->Status;
diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c b/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
index 995ccd2463d2..df512ed6fa59 100644
--- a/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
+++ b/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
@@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid
which is used to enable recovery function from USB Drivers.
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -290,7 +291,7 @@ EhcFreeQtds (
EFI_LIST_ENTRY *Next;
PEI_EHC_QTD *Qtd;
- EFI_LIST_FOR_EACH_SAFE (Entry, Next, Qtds) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, Next, Qtds) {
Qtd = EFI_LIST_CONTAINER (Entry, PEI_EHC_QTD, QtdList);
RemoveEntryList (&Qtd->QtdList);
@@ -461,7 +462,7 @@ EhcCreateQtds (
//
// 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, PEI_EHC_QTD, QtdList);
//
diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.h b/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.h
index 6b69f7a656ce..8e5b6418e6ee 100644
--- a/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.h
+++ b/MdeModulePkg/Bus/Pci/EhciPei/EhcPeim.h
@@ -2,6 +2,7 @@
Private Header file for Usb Host Controller PEIM
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -17,6 +18,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Ppi/IoMmu.h>
#include <Ppi/EndOfPeiPhase.h>
+#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/PeimEntryPoint.h>
#include <Library/PeiServicesLib.h>
@@ -60,20 +62,6 @@ typedef struct _PEI_USB2_HC_DEV PEI_USB2_HC_DEV;
//
#define EHC_SYNC_POLL_INTERVAL (6 * EHC_1_MILLISECOND)
-//
-//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)
diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhciPei.inf b/MdeModulePkg/Bus/Pci/EhciPei/EhciPei.inf
index 0fc09ffca434..01ebb371a72e 100644
--- a/MdeModulePkg/Bus/Pci/EhciPei/EhciPei.inf
+++ b/MdeModulePkg/Bus/Pci/EhciPei/EhciPei.inf
@@ -5,6 +5,7 @@
# which is used to enable recovery function from USB Drivers.
#
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) Microsoft Corporation.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -47,6 +48,7 @@
[LibraryClasses]
IoLib
TimerLib
+ BaseLib
BaseMemoryLib
PeimEntryPoint
PeiServicesLib
--
2.16.3.windows.1
[-- Attachment #2: Type: text/html, Size: 9446 bytes --]
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 4/7] MdeModulePkg/XhciDxe: Use BaseLib linked list iteration macros
[not found] <20200410200218.24992-1-michael.kubacki@outlook.com>
` (2 preceding siblings ...)
2020-04-10 20:02 ` [PATCH v2 3/7] MdeModulePkg/EhciPei: " Michael Kubacki
@ 2020-04-10 20:02 ` Michael Kubacki
2020-04-10 23:37 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-04-10 20:02 ` [PATCH v2 5/7] MdeModulePkg/UfsPassThruDxe: " Michael Kubacki
` (2 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Michael Kubacki @ 2020-04-10 20:02 UTC (permalink / raw)
To: devel; +Cc: Dandan Bi, Hao A Wu, Jian J Wang, Liming Gao, Ray Ni, Sean Brogan
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1959
Replaces usage of the linked list iteration macros defined in Xhci.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>
---
MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 9 +++++----
MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h | 9 +--------
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
index c0c374fc4758..ab8957c546ee 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
@@ -3,6 +3,7 @@
XHCI transfer scheduling routines.
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -1051,7 +1052,7 @@ IsAsyncIntTrb (
LIST_ENTRY *Next;
URB *CheckedUrb;
- EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
CheckedUrb = EFI_LIST_CONTAINER (Entry, URB, UrbList);
if (IsTransferRingTrb (Xhc, Trb, CheckedUrb)) {
*Urb = CheckedUrb;
@@ -1346,7 +1347,7 @@ XhciDelAsyncIntTransfer (
Urb = NULL;
- EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList);
if ((Urb->Ep.BusAddr == BusAddr) &&
(Urb->Ep.EpAddr == EpNum) &&
@@ -1386,7 +1387,7 @@ XhciDelAllAsyncIntTransfers (
URB *Urb;
EFI_STATUS Status;
- EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList);
//
@@ -1578,7 +1579,7 @@ XhcMonitorAsyncRequests (
Xhc = (USB_XHCI_INSTANCE*) Context;
- EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList);
//
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
index 72b4e084f14d..3285eb8798c0 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
@@ -3,6 +3,7 @@
Provides some data structure definitions used by the XHCI host controller driver.
Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -82,14 +83,6 @@ typedef struct _USB_DEV_CONTEXT USB_DEV_CONTEXT;
#define INT_INTER 3
#define INT_INTER_ASYNC 4
-//
-// 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 XHC_LOW_32BIT(Addr64) ((UINT32)(((UINTN)(Addr64)) & 0xFFFFFFFF))
--
2.16.3.windows.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [EXTERNAL] [edk2-devel] [PATCH v2 4/7] MdeModulePkg/XhciDxe: Use BaseLib linked list iteration macros
2020-04-10 20:02 ` [PATCH v2 4/7] MdeModulePkg/XhciDxe: " Michael Kubacki
@ 2020-04-10 23:37 ` Bret Barkelew
0 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2020-04-10 23:37 UTC (permalink / raw)
To: devel@edk2.groups.io, michael.kubacki@outlook.com
Cc: Dandan Bi, Hao A Wu, Jian J Wang, Liming Gao, Ray Ni, Sean Brogan
[-- Attachment #1: Type: text/plain, Size: 4719 bytes --]
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
- Bret
________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Michael Kubacki via groups.io <michael.kubacki=outlook.com@groups.io>
Sent: Friday, April 10, 2020 1:02:15 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Dandan Bi <dandan.bi@intel.com>; Hao A Wu <hao.a.wu@intel.com>; Jian J Wang <jian.j.wang@intel.com>; Liming Gao <liming.gao@intel.com>; Ray Ni <ray.ni@intel.com>; Sean Brogan <sean.brogan@microsoft.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH v2 4/7] MdeModulePkg/XhciDxe: Use BaseLib linked list iteration macros
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D1959&data=02%7C01%7CBret.Barkelew%40microsoft.com%7C213b2a4ed0f945b3198d08d7dd8a26c6%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637221457736485446&sdata=7GPq6ea%2Bhkt7a1swJftfbaO4M1yeCG4PN2pjx10vZHs%3D&reserved=0
Replaces usage of the linked list iteration macros defined in Xhci.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>
---
MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 9 +++++----
MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h | 9 +--------
2 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
index c0c374fc4758..ab8957c546ee 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
@@ -3,6 +3,7 @@
XHCI transfer scheduling routines.
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -1051,7 +1052,7 @@ IsAsyncIntTrb (
LIST_ENTRY *Next;
URB *CheckedUrb;
- EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
CheckedUrb = EFI_LIST_CONTAINER (Entry, URB, UrbList);
if (IsTransferRingTrb (Xhc, Trb, CheckedUrb)) {
*Urb = CheckedUrb;
@@ -1346,7 +1347,7 @@ XhciDelAsyncIntTransfer (
Urb = NULL;
- EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList);
if ((Urb->Ep.BusAddr == BusAddr) &&
(Urb->Ep.EpAddr == EpNum) &&
@@ -1386,7 +1387,7 @@ XhciDelAllAsyncIntTransfers (
URB *Urb;
EFI_STATUS Status;
- EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList);
//
@@ -1578,7 +1579,7 @@ XhcMonitorAsyncRequests (
Xhc = (USB_XHCI_INSTANCE*) Context;
- EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, Next, &Xhc->AsyncIntTransfers) {
Urb = EFI_LIST_CONTAINER (Entry, URB, UrbList);
//
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
index 72b4e084f14d..3285eb8798c0 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
@@ -3,6 +3,7 @@
Provides some data structure definitions used by the XHCI host controller driver.
Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -82,14 +83,6 @@ typedef struct _USB_DEV_CONTEXT USB_DEV_CONTEXT;
#define INT_INTER 3
#define INT_INTER_ASYNC 4
-//
-// 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 XHC_LOW_32BIT(Addr64) ((UINT32)(((UINTN)(Addr64)) & 0xFFFFFFFF))
--
2.16.3.windows.1
[-- Attachment #2: Type: text/html, Size: 8220 bytes --]
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 5/7] MdeModulePkg/UfsPassThruDxe: Use BaseLib linked list iteration macros
[not found] <20200410200218.24992-1-michael.kubacki@outlook.com>
` (3 preceding siblings ...)
2020-04-10 20:02 ` [PATCH v2 4/7] MdeModulePkg/XhciDxe: " Michael Kubacki
@ 2020-04-10 20:02 ` Michael Kubacki
2020-04-10 23:37 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-04-10 20:02 ` [PATCH v2 6/7] MdeModulePkg/RamDiskDxe: " Michael Kubacki
2020-04-10 20:02 ` [PATCH v2 7/7] SecurityPkg/HddPassword: " Michael Kubacki
6 siblings, 1 reply; 15+ messages in thread
From: Michael Kubacki @ 2020-04-10 20:02 UTC (permalink / raw)
To: devel; +Cc: Dandan Bi, Hao A Wu, Jian J Wang, Liming Gao, Ray Ni, Sean Brogan
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1959
Replaces usage of the linked list iteration macros defined in UfsPassThru.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: Hao A Wu <hao.a.wu@intel.com>
---
MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 3 ++-
MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 3 ++-
MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h | 9 +--------
3 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
index 26c5a8b85554..9768c2e6fb22 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
@@ -1,6 +1,7 @@
/** @file
Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -1083,7 +1084,7 @@ UfsPassThruDriverBindingStop (
// Cleanup the resources of I/O requests in the async I/O queue
//
if (!IsListEmpty(&Private->Queue)) {
- EFI_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->Queue) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->Queue) {
TransReq = UFS_PASS_THRU_TRANS_REQ_FROM_THIS (Entry);
//
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
index 93ac958f658f..0b1030ab4788 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -3,6 +3,7 @@
for upper layer application to execute UFS-supported SCSI cmds.
Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -2285,7 +2286,7 @@ ProcessAsyncTaskList (
// Check the entries in the async I/O queue are done or not.
//
if (!IsListEmpty(&Private->Queue)) {
- EFI_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->Queue) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->Queue) {
TransReq = UFS_PASS_THRU_TRANS_REQ_FROM_THIS (Entry);
Packet = TransReq->Packet;
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
index cbc0c2126eee..ef33250c89d7 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
@@ -1,6 +1,7 @@
/** @file
Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -46,14 +47,6 @@ typedef struct {
UINT16 Rsvd:4;
} UFS_EXPOSED_LUNS;
-//
-// Iterate through the double linked list. This is delete-safe.
-// Do not 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)
-
typedef struct _UFS_PASS_THRU_PRIVATE_DATA {
UINT32 Signature;
EFI_HANDLE Handle;
--
2.16.3.windows.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [EXTERNAL] [edk2-devel] [PATCH v2 5/7] MdeModulePkg/UfsPassThruDxe: Use BaseLib linked list iteration macros
2020-04-10 20:02 ` [PATCH v2 5/7] MdeModulePkg/UfsPassThruDxe: " Michael Kubacki
@ 2020-04-10 23:37 ` Bret Barkelew
0 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2020-04-10 23:37 UTC (permalink / raw)
To: devel@edk2.groups.io, michael.kubacki@outlook.com
Cc: Dandan Bi, Hao A Wu, Jian J Wang, Liming Gao, Ray Ni, Sean Brogan
[-- Attachment #1: Type: text/plain, Size: 4648 bytes --]
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
- Bret
________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Michael Kubacki via groups.io <michael.kubacki=outlook.com@groups.io>
Sent: Friday, April 10, 2020 1:02:16 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Dandan Bi <dandan.bi@intel.com>; Hao A Wu <hao.a.wu@intel.com>; Jian J Wang <jian.j.wang@intel.com>; Liming Gao <liming.gao@intel.com>; Ray Ni <ray.ni@intel.com>; Sean Brogan <sean.brogan@microsoft.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH v2 5/7] MdeModulePkg/UfsPassThruDxe: Use BaseLib linked list iteration macros
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D1959&data=02%7C01%7CBret.Barkelew%40microsoft.com%7C42a2015727944a46024e08d7dd8a28da%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637221457764169536&sdata=iHZJWqVVjPHbOjQQu8if%2Br5NzA9Uexxeo%2BgHV619t3Y%3D&reserved=0
Replaces usage of the linked list iteration macros defined in UfsPassThru.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: Hao A Wu <hao.a.wu@intel.com>
---
MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 3 ++-
MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 3 ++-
MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h | 9 +--------
3 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
index 26c5a8b85554..9768c2e6fb22 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
@@ -1,6 +1,7 @@
/** @file
Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -1083,7 +1084,7 @@ UfsPassThruDriverBindingStop (
// Cleanup the resources of I/O requests in the async I/O queue
//
if (!IsListEmpty(&Private->Queue)) {
- EFI_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->Queue) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->Queue) {
TransReq = UFS_PASS_THRU_TRANS_REQ_FROM_THIS (Entry);
//
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
index 93ac958f658f..0b1030ab4788 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -3,6 +3,7 @@
for upper layer application to execute UFS-supported SCSI cmds.
Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -2285,7 +2286,7 @@ ProcessAsyncTaskList (
// Check the entries in the async I/O queue are done or not.
//
if (!IsListEmpty(&Private->Queue)) {
- EFI_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->Queue) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &Private->Queue) {
TransReq = UFS_PASS_THRU_TRANS_REQ_FROM_THIS (Entry);
Packet = TransReq->Packet;
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
index cbc0c2126eee..ef33250c89d7 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
@@ -1,6 +1,7 @@
/** @file
Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -46,14 +47,6 @@ typedef struct {
UINT16 Rsvd:4;
} UFS_EXPOSED_LUNS;
-//
-// Iterate through the double linked list. This is delete-safe.
-// Do not 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)
-
typedef struct _UFS_PASS_THRU_PRIVATE_DATA {
UINT32 Signature;
EFI_HANDLE Handle;
--
2.16.3.windows.1
[-- Attachment #2: Type: text/html, Size: 7849 bytes --]
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 6/7] MdeModulePkg/RamDiskDxe: Use BaseLib linked list iteration macros
[not found] <20200410200218.24992-1-michael.kubacki@outlook.com>
` (4 preceding siblings ...)
2020-04-10 20:02 ` [PATCH v2 5/7] MdeModulePkg/UfsPassThruDxe: " Michael Kubacki
@ 2020-04-10 20:02 ` Michael Kubacki
2020-04-10 23:37 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
2020-04-10 20:02 ` [PATCH v2 7/7] SecurityPkg/HddPassword: " Michael Kubacki
6 siblings, 1 reply; 15+ messages in thread
From: Michael Kubacki @ 2020-04-10 20:02 UTC (permalink / raw)
To: devel; +Cc: Dandan Bi, Hao A Wu, Jian J Wang, Liming Gao, Ray Ni, Sean Brogan
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1959
Replaces usage of the linked list iteration macros defined in RamDiskImpl.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: Hao A Wu <hao.a.wu@intel.com>
---
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c | 3 ++-
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c | 9 +++++----
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c | 5 +++--
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h | 15 +--------------
4 files changed, 11 insertions(+), 21 deletions(-)
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c
index a80ef271df9c..fcbf4f117dc6 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c
@@ -2,6 +2,7 @@
The driver entry point for RamDiskDxe driver.
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -92,7 +93,7 @@ RamDiskAcpiCheck (
return;
}
- EFI_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
RamDiskPublishNfit (PrivateData);
}
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
index 96ea74a9a536..e35b8fa2296c 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
@@ -3,6 +3,7 @@
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2016-2018 Hewlett Packard Enterprise Development LP<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -165,7 +166,7 @@ UnregisterAllRamDisks (
RAM_DISK_PRIVATE_DATA *PrivateData;
if (!IsListEmpty(&RegisteredRamDisks)) {
- EFI_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
gBS->UninstallMultipleProtocolInterfaces (
@@ -507,7 +508,7 @@ UpdateMainForm (
EndLabel->Number = MAIN_LABEL_LIST_END;
Index = 0;
- EFI_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
PrivateData->CheckBoxId = (EFI_QUESTION_ID)
(MAIN_CHECKBOX_QUESTION_ID_START + Index);
@@ -689,7 +690,7 @@ RamDiskCallback (
//
// Remove the selected RAM disks
//
- EFI_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
if (PrivateData->CheckBoxChecked) {
RamDiskUnregister (
@@ -742,7 +743,7 @@ RamDiskCallback (
//
if ((QuestionId >= MAIN_CHECKBOX_QUESTION_ID_START) &&
(QuestionId < CREATE_RAW_RAM_DISK_FORM_ID)) {
- EFI_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
if (PrivateData->CheckBoxId == QuestionId) {
PrivateData->CheckBoxChecked = (BOOLEAN) (Value->u8 != 0);
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c
index 36d635e4bc31..4333e000539b 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c
@@ -3,6 +3,7 @@
Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -662,7 +663,7 @@ RamDiskRegister (
if (!IsListEmpty(&RegisteredRamDisks)) {
DevicePathSize = GetDevicePathSize (PrivateData->DevicePath);
- EFI_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
RegisteredPrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
if (DevicePathSize == GetDevicePathSize (RegisteredPrivateData->DevicePath)) {
//
@@ -797,7 +798,7 @@ RamDiskUnregister (
EndingAddr = ReadUnaligned64 ((UINT64 *) &(RamDiskDevNode->EndingAddr[0]));
if (!IsListEmpty(&RegisteredRamDisks)) {
- EFI_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
//
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h
index 25fec15c1882..ed80b47ccc33 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h
@@ -2,6 +2,7 @@
The header file of RamDiskDxe driver.
Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -47,20 +48,6 @@
//
#define RAM_DISK_DEFAULT_BLOCK_SIZE 512
-//
-// 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.
-// Do not 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)
-
//
// RamDiskDxe driver maintains a list of registered RAM disks.
//
--
2.16.3.windows.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [EXTERNAL] [edk2-devel] [PATCH v2 6/7] MdeModulePkg/RamDiskDxe: Use BaseLib linked list iteration macros
2020-04-10 20:02 ` [PATCH v2 6/7] MdeModulePkg/RamDiskDxe: " Michael Kubacki
@ 2020-04-10 23:37 ` Bret Barkelew
0 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2020-04-10 23:37 UTC (permalink / raw)
To: devel@edk2.groups.io, michael.kubacki@outlook.com
Cc: Dandan Bi, Hao A Wu, Jian J Wang, Liming Gao, Ray Ni, Sean Brogan
[-- Attachment #1: Type: text/plain, Size: 7523 bytes --]
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
- Bret
________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Michael Kubacki via groups.io <michael.kubacki=outlook.com@groups.io>
Sent: Friday, April 10, 2020 1:02:17 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Dandan Bi <dandan.bi@intel.com>; Hao A Wu <hao.a.wu@intel.com>; Jian J Wang <jian.j.wang@intel.com>; Liming Gao <liming.gao@intel.com>; Ray Ni <ray.ni@intel.com>; Sean Brogan <sean.brogan@microsoft.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH v2 6/7] MdeModulePkg/RamDiskDxe: Use BaseLib linked list iteration macros
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D1959&data=02%7C01%7Cbret.barkelew%40microsoft.com%7C12b6ab8be60a43c8326808d7dd8a2a52%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637221457789115342&sdata=SoQ2JMwtD84nofSN%2B0Ge71u1hTL%2BFds8FcmWYcPd39o%3D&reserved=0
Replaces usage of the linked list iteration macros defined in RamDiskImpl.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: Hao A Wu <hao.a.wu@intel.com>
---
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c | 3 ++-
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c | 9 +++++----
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c | 5 +++--
MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h | 15 +--------------
4 files changed, 11 insertions(+), 21 deletions(-)
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c
index a80ef271df9c..fcbf4f117dc6 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskDriver.c
@@ -2,6 +2,7 @@
The driver entry point for RamDiskDxe driver.
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -92,7 +93,7 @@ RamDiskAcpiCheck (
return;
}
- EFI_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
RamDiskPublishNfit (PrivateData);
}
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
index 96ea74a9a536..e35b8fa2296c 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
@@ -3,6 +3,7 @@
Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2016-2018 Hewlett Packard Enterprise Development LP<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -165,7 +166,7 @@ UnregisterAllRamDisks (
RAM_DISK_PRIVATE_DATA *PrivateData;
if (!IsListEmpty(&RegisteredRamDisks)) {
- EFI_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
gBS->UninstallMultipleProtocolInterfaces (
@@ -507,7 +508,7 @@ UpdateMainForm (
EndLabel->Number = MAIN_LABEL_LIST_END;
Index = 0;
- EFI_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
PrivateData->CheckBoxId = (EFI_QUESTION_ID)
(MAIN_CHECKBOX_QUESTION_ID_START + Index);
@@ -689,7 +690,7 @@ RamDiskCallback (
//
// Remove the selected RAM disks
//
- EFI_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
if (PrivateData->CheckBoxChecked) {
RamDiskUnregister (
@@ -742,7 +743,7 @@ RamDiskCallback (
//
if ((QuestionId >= MAIN_CHECKBOX_QUESTION_ID_START) &&
(QuestionId < CREATE_RAW_RAM_DISK_FORM_ID)) {
- EFI_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
if (PrivateData->CheckBoxId == QuestionId) {
PrivateData->CheckBoxChecked = (BOOLEAN) (Value->u8 != 0);
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c
index 36d635e4bc31..4333e000539b 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskProtocol.c
@@ -3,6 +3,7 @@
Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -662,7 +663,7 @@ RamDiskRegister (
if (!IsListEmpty(&RegisteredRamDisks)) {
DevicePathSize = GetDevicePathSize (PrivateData->DevicePath);
- EFI_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
RegisteredPrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
if (DevicePathSize == GetDevicePathSize (RegisteredPrivateData->DevicePath)) {
//
@@ -797,7 +798,7 @@ RamDiskUnregister (
EndingAddr = ReadUnaligned64 ((UINT64 *) &(RamDiskDevNode->EndingAddr[0]));
if (!IsListEmpty(&RegisteredRamDisks)) {
- EFI_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
+ BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
//
diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h
index 25fec15c1882..ed80b47ccc33 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.h
@@ -2,6 +2,7 @@
The header file of RamDiskDxe driver.
Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -47,20 +48,6 @@
//
#define RAM_DISK_DEFAULT_BLOCK_SIZE 512
-//
-// 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.
-// Do not 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)
-
//
// RamDiskDxe driver maintains a list of registered RAM disks.
//
--
2.16.3.windows.1
[-- Attachment #2: Type: text/html, Size: 12296 bytes --]
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 7/7] SecurityPkg/HddPassword: Use BaseLib linked list iteration macros
[not found] <20200410200218.24992-1-michael.kubacki@outlook.com>
` (5 preceding siblings ...)
2020-04-10 20:02 ` [PATCH v2 6/7] MdeModulePkg/RamDiskDxe: " Michael Kubacki
@ 2020-04-10 20:02 ` Michael Kubacki
2020-04-10 23:36 ` [EXTERNAL] [edk2-devel] " Bret Barkelew
6 siblings, 1 reply; 15+ messages in thread
From: Michael Kubacki @ 2020-04-10 20:02 UTC (permalink / raw)
To: devel; +Cc: Chao Zhang, Hao A Wu, Jian J Wang, Jiewen Yao, Sean Brogan
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1959
Replaces usage of the linked list iteration macros defined in
HddPasswordDxe.h with the common definition in BaseLib.h.
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
---
SecurityPkg/HddPassword/HddPasswordDxe.c | 13 +++++++------
SecurityPkg/HddPassword/HddPasswordDxe.h | 7 +------
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/SecurityPkg/HddPassword/HddPasswordDxe.c b/SecurityPkg/HddPassword/HddPasswordDxe.c
index a25b3471d073..32b55a6a8b72 100644
--- a/SecurityPkg/HddPassword/HddPasswordDxe.c
+++ b/SecurityPkg/HddPassword/HddPasswordDxe.c
@@ -2,6 +2,7 @@
HDD password driver which is used to support HDD security feature.
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -115,7 +116,7 @@ BuildHddPasswordDeviceInfo (
// Build HDD password device info and save them to LockBox.
//
DevInfoLength = 0;
- EFI_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
+ BASE_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
ConfigFormEntry = BASE_CR (Entry, HDD_PASSWORD_CONFIG_FORM_ENTRY, Link);
//
@@ -164,7 +165,7 @@ BuildHddPasswordDeviceInfo (
ASSERT (DevInfo != NULL);
TempDevInfo = DevInfo;
- EFI_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
+ BASE_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
ConfigFormEntry = BASE_CR (Entry, HDD_PASSWORD_CONFIG_FORM_ENTRY, Link);
if ((!PasswordIsFullZero (ConfigFormEntry->Password)) ||
@@ -472,7 +473,7 @@ HddPasswordEndOfDxeEventNotify (
//
// Zero passsword and freeze lock device.
//
- EFI_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
+ BASE_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
ConfigFormEntry = BASE_CR (Entry, HDD_PASSWORD_CONFIG_FORM_ENTRY, Link);
ZeroMem (ConfigFormEntry->Password, HDD_PASSWORD_MAX_LENGTH);
@@ -2026,7 +2027,7 @@ HddPasswordGetConfigFormEntryByIndex (
CurrentIndex = 0;
ConfigFormEntry = NULL;
- EFI_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
+ BASE_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
if (CurrentIndex == Index) {
ConfigFormEntry = BASE_CR (Entry, HDD_PASSWORD_CONFIG_FORM_ENTRY, Link);
break;
@@ -2408,7 +2409,7 @@ HddPasswordConfigUpdateForm (
ConfigFormEntry = NULL;
EntryExisted = FALSE;
- EFI_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
+ BASE_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
ConfigFormEntry = BASE_CR (Entry, HDD_PASSWORD_CONFIG_FORM_ENTRY, Link);
if ((ConfigFormEntry->Bus == Bus) &&
@@ -2503,7 +2504,7 @@ HddPasswordConfigUpdateForm (
EndLabel->Number = HDD_DEVICE_LABEL_END;
mNumberOfHddDevices = 0;
- EFI_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
+ BASE_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
ConfigFormEntry = BASE_CR (Entry, HDD_PASSWORD_CONFIG_FORM_ENTRY, Link);
HiiCreateGotoOpCode (
diff --git a/SecurityPkg/HddPassword/HddPasswordDxe.h b/SecurityPkg/HddPassword/HddPasswordDxe.h
index 87db587eb6f0..a6c87169dc59 100644
--- a/SecurityPkg/HddPassword/HddPasswordDxe.h
+++ b/SecurityPkg/HddPassword/HddPasswordDxe.h
@@ -1,6 +1,7 @@
/** @file
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -87,12 +88,6 @@ typedef struct _HDD_PASSWORD_DXE_PRIVATE_DATA {
#define HDD_PASSWORD_DXE_PRIVATE_FROM_THIS(a) CR (a, HDD_PASSWORD_DXE_PRIVATE_DATA, ConfigAccess, HDD_PASSWORD_DXE_PRIVATE_SIGNATURE)
-//
-//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)
-
#define PASSWORD_SALT_SIZE 32
#define HDD_PASSWORD_REQUEST_VARIABLE_NAME L"HddPasswordRequest"
--
2.16.3.windows.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [EXTERNAL] [edk2-devel] [PATCH v2 7/7] SecurityPkg/HddPassword: Use BaseLib linked list iteration macros
2020-04-10 20:02 ` [PATCH v2 7/7] SecurityPkg/HddPassword: " Michael Kubacki
@ 2020-04-10 23:36 ` Bret Barkelew
0 siblings, 0 replies; 15+ messages in thread
From: Bret Barkelew @ 2020-04-10 23:36 UTC (permalink / raw)
To: devel@edk2.groups.io, michael.kubacki@outlook.com
Cc: Chao Zhang, Hao A Wu, Jian J Wang, Jiewen Yao, Sean Brogan
[-- Attachment #1: Type: text/plain, Size: 5371 bytes --]
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
- Bret
________________________________
From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Michael Kubacki via groups.io <michael.kubacki=outlook.com@groups.io>
Sent: Friday, April 10, 2020 1:02:18 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Chao Zhang <chao.b.zhang@intel.com>; Hao A Wu <hao.a.wu@intel.com>; Jian J Wang <jian.j.wang@intel.com>; Jiewen Yao <jiewen.yao@intel.com>; Sean Brogan <sean.brogan@microsoft.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH v2 7/7] SecurityPkg/HddPassword: Use BaseLib linked list iteration macros
From: Michael Kubacki <michael.kubacki@microsoft.com>
REF:https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D1959&data=02%7C01%7CBret.Barkelew%40microsoft.com%7C0cb7a3e5e3ef4f9c776808d7dd8a2c7e%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637221457829007406&sdata=TzvNo4r7FXEx%2BLEifMTR8HHL%2BGGpl8WkOiABJS1IqF8%3D&reserved=0
Replaces usage of the linked list iteration macros defined in
HddPasswordDxe.h with the common definition in BaseLib.h.
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
---
SecurityPkg/HddPassword/HddPasswordDxe.c | 13 +++++++------
SecurityPkg/HddPassword/HddPasswordDxe.h | 7 +------
2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/SecurityPkg/HddPassword/HddPasswordDxe.c b/SecurityPkg/HddPassword/HddPasswordDxe.c
index a25b3471d073..32b55a6a8b72 100644
--- a/SecurityPkg/HddPassword/HddPasswordDxe.c
+++ b/SecurityPkg/HddPassword/HddPasswordDxe.c
@@ -2,6 +2,7 @@
HDD password driver which is used to support HDD security feature.
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -115,7 +116,7 @@ BuildHddPasswordDeviceInfo (
// Build HDD password device info and save them to LockBox.
//
DevInfoLength = 0;
- EFI_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
+ BASE_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
ConfigFormEntry = BASE_CR (Entry, HDD_PASSWORD_CONFIG_FORM_ENTRY, Link);
//
@@ -164,7 +165,7 @@ BuildHddPasswordDeviceInfo (
ASSERT (DevInfo != NULL);
TempDevInfo = DevInfo;
- EFI_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
+ BASE_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
ConfigFormEntry = BASE_CR (Entry, HDD_PASSWORD_CONFIG_FORM_ENTRY, Link);
if ((!PasswordIsFullZero (ConfigFormEntry->Password)) ||
@@ -472,7 +473,7 @@ HddPasswordEndOfDxeEventNotify (
//
// Zero passsword and freeze lock device.
//
- EFI_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
+ BASE_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
ConfigFormEntry = BASE_CR (Entry, HDD_PASSWORD_CONFIG_FORM_ENTRY, Link);
ZeroMem (ConfigFormEntry->Password, HDD_PASSWORD_MAX_LENGTH);
@@ -2026,7 +2027,7 @@ HddPasswordGetConfigFormEntryByIndex (
CurrentIndex = 0;
ConfigFormEntry = NULL;
- EFI_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
+ BASE_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
if (CurrentIndex == Index) {
ConfigFormEntry = BASE_CR (Entry, HDD_PASSWORD_CONFIG_FORM_ENTRY, Link);
break;
@@ -2408,7 +2409,7 @@ HddPasswordConfigUpdateForm (
ConfigFormEntry = NULL;
EntryExisted = FALSE;
- EFI_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
+ BASE_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
ConfigFormEntry = BASE_CR (Entry, HDD_PASSWORD_CONFIG_FORM_ENTRY, Link);
if ((ConfigFormEntry->Bus == Bus) &&
@@ -2503,7 +2504,7 @@ HddPasswordConfigUpdateForm (
EndLabel->Number = HDD_DEVICE_LABEL_END;
mNumberOfHddDevices = 0;
- EFI_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
+ BASE_LIST_FOR_EACH (Entry, &mHddPasswordConfigFormList) {
ConfigFormEntry = BASE_CR (Entry, HDD_PASSWORD_CONFIG_FORM_ENTRY, Link);
HiiCreateGotoOpCode (
diff --git a/SecurityPkg/HddPassword/HddPasswordDxe.h b/SecurityPkg/HddPassword/HddPasswordDxe.h
index 87db587eb6f0..a6c87169dc59 100644
--- a/SecurityPkg/HddPassword/HddPasswordDxe.h
+++ b/SecurityPkg/HddPassword/HddPasswordDxe.h
@@ -1,6 +1,7 @@
/** @file
Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) Microsoft Corporation.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -87,12 +88,6 @@ typedef struct _HDD_PASSWORD_DXE_PRIVATE_DATA {
#define HDD_PASSWORD_DXE_PRIVATE_FROM_THIS(a) CR (a, HDD_PASSWORD_DXE_PRIVATE_DATA, ConfigAccess, HDD_PASSWORD_DXE_PRIVATE_SIGNATURE)
-//
-//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)
-
#define PASSWORD_SALT_SIZE 32
#define HDD_PASSWORD_REQUEST_VARIABLE_NAME L"HddPasswordRequest"
--
2.16.3.windows.1
[-- Attachment #2: Type: text/html, Size: 8721 bytes --]
^ permalink raw reply related [flat|nested] 15+ messages in thread