public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"abner.chang@amd.com" <abner.chang@amd.com>
Cc: "Ni, Ray" <ray.ni@intel.com>,
	Garrett Kirkendall <garrett.kirkendall@amd.com>,
	Kuei-Hung Lin <Kuei-Hung.Lin@amd.com>
Subject: Re: [edk2-devel] [PATCH V2 3/3] MdeModulePkg/XhciPei: Unlinked XhciPei memory block
Date: Fri, 13 Jan 2023 08:26:29 +0000	[thread overview]
Message-ID: <DM6PR11MB4025FF7C4093BA1028531D56CAC29@DM6PR11MB4025.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20230111031008.1476-3-abner.chang@amd.com>

Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chang,
> Abner via groups.io
> Sent: Wednesday, January 11, 2023 11:10 AM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Garrett
> Kirkendall <garrett.kirkendall@amd.com>; Abner Chang
> <abner.chang@amd.com>; Kuei-Hung Lin <Kuei-Hung.Lin@amd.com>
> Subject: [edk2-devel] [PATCH V2 3/3] MdeModulePkg/XhciPei: Unlinked XhciPei
> memory block
> 
> From: Abner Chang <abner.chang@amd.com>
> 
> Unlink the XhciPei memory block when it has been freed.
> 
> Signed-off-by: Jiangang He <jiangang.he@amd.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Kuei-Hung Lin <Kuei-Hung.Lin@amd.com>
> ---
>  MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c | 31
> +++++++++++++++++++++++--
>  1 file changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
> b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
> index c64b38fcfc8..e779a311388 100644
> --- a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
> +++ b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
> @@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid based on
> gPeiUsbControllerPpiGuid
>  which is used to enable recovery function from USB Drivers.
> 
>  Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
> +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights reserved.<BR>
> 
>  SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> @@ -365,6 +366,32 @@ UsbHcInitMemPool (
>    return Pool;
>  }
> 
> +/**
> +  Unlink the memory block from the pool's list.
> +
> +  @param  Head           The block list head of the memory's pool.
> +  @param  BlockToUnlink  The memory block to unlink.
> +
> +**/
> +VOID
> +UsbHcUnlinkMemBlock (
> +  IN USBHC_MEM_BLOCK  *Head,
> +  IN USBHC_MEM_BLOCK  *BlockToUnlink
> +  )
> +{
> +  USBHC_MEM_BLOCK  *Block;
> +
> +  ASSERT ((Head != NULL) && (BlockToUnlink != NULL));
> +
> +  for (Block = Head; Block != NULL; Block = Block->Next) {
> +    if (Block->Next == BlockToUnlink) {
> +      Block->Next         = BlockToUnlink->Next;
> +      BlockToUnlink->Next = NULL;
> +      break;
> +    }
> +  }
> +}
> +
>  /**
>    Release the memory management pool.
> 
> @@ -386,7 +413,7 @@ UsbHcFreeMemPool (
>    // first block.
>    //
>    for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
> -    // UsbHcUnlinkMemBlock (Pool->Head, Block);
> +    UsbHcUnlinkMemBlock (Pool->Head, Block);
>      UsbHcFreeMemBlock (Pool, Block);
>    }
> 
> @@ -532,7 +559,7 @@ UsbHcFreeMem (
>    // Release the current memory block if it is empty and not the head
>    //
>    if ((Block != Head) && UsbHcIsMemBlockEmpty (Block)) {
> -    // UsbHcUnlinkMemBlock (Head, Block);
> +    UsbHcUnlinkMemBlock (Head, Block);
>      UsbHcFreeMemBlock (Pool, Block);
>    }
>  }
> --
> 2.37.1.windows.1
> 
> 
> 
> 
> 


  reply	other threads:[~2023-01-13  8:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11  3:10 [PATCH V2 1/3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value Chang, Abner
2023-01-11  3:10 ` [PATCH V2 2/3] MdeModulePkg/Usb: Read a large number of blocks Chang, Abner
2023-01-11  3:10 ` [PATCH V2 3/3] MdeModulePkg/XhciPei: Unlinked XhciPei memory block Chang, Abner
2023-01-13  8:26   ` Wu, Hao A [this message]
2023-01-16  2:40 ` [edk2-devel] [PATCH V2 1/3] MdeModulePkg/Xhci: Initial XHCI DCI slot's Context value Wu, Hao A
2023-01-16  2:41   ` Chang, Abner

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=DM6PR11MB4025FF7C4093BA1028531D56CAC29@DM6PR11MB4025.namprd11.prod.outlook.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