Re: [edk2-devel] [PATCH] MdeModulePkg: Fix port multiplier port in AhciPei PEIM

2023-05-31 Thread He, Jiangang via groups.io
[AMD Official Use Only - General]

We did crisis recovery and Opal HD password unlock from S3 resume from SATA HD 
test on two different version of AHCI host controllers.

Thanks,
Jiangang
-Original Message-
From: Wu, Hao A 
Sent: Tuesday, May 30, 2023 10:30 PM
To: devel@edk2.groups.io; Hsueh, Hong-Chih (Neo) 
Cc: He, Jiangang ; Chang, Abner 
Subject: RE: [edk2-devel] [PATCH] MdeModulePkg: Fix port multiplier port in 
AhciPei PEIM

Caution: This message originated from an External Source. Use proper caution 
when opening attachments, clicking links, or responding.


Thanks, the code changes look good to me.
May I know what tests have been performed for the patch?

Best Regards,
Hao Wu

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Neo
> Hsueh via groups.io
> Sent: Wednesday, May 24, 2023 1:07 AM
> To: devel@edk2.groups.io
> Cc: jiangang...@amd.com; abner.ch...@amd.com; Neo Hsueh  chih.hs...@amd.com>
> Subject: [edk2-devel] [PATCH] MdeModulePkg: Fix port multiplier port
> in AhciPei PEIM
>
> If there is no port multiplier, PortMultiplierPort should be converted
> to 0 to follow AHCI spec.
> The same logic already applied in AtaAtapiPassThruDxe driver.
>
> Signed-off-by: Neo Hsueh 
> ---
>  MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c | 10 ++
>  1 file changed, 10 insertions(+)
>
> diff --git a/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> b/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> index cd55272c96..7bd04661d0 100644
> --- a/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> +++ b/MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.c
> @@ -3,6 +3,7 @@
>mode at PEI phase.
>
>Copyright (c) 2019, Intel Corporation. All rights reserved.
> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> + reserved.
>
>SPDX-License-Identifier: BSD-2-Clause-Patent
>
> @@ -92,6 +93,15 @@ AhciPassThruExecute (  {
>EFI_STATUS  Status;
>
> +  if (PortMultiplierPort == 0x) {
> +//
> +// If there is no port multiplier, PortMultiplierPort will be 0x
> +// according to UEFI spec. Here, we convert its value to 0 to follow
> +// AHCI spec.
> +//
> +PortMultiplierPort = 0;
> +  }
> +
>switch (Packet->Protocol) {
>  case EFI_ATA_PASS_THRU_PROTOCOL_ATA_NON_DATA:
>Status = AhciNonDataTransfer (
> --
> 2.40.0.windows.1
>
>
>
> 
>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#105502): https://edk2.groups.io/g/devel/message/105502
Mute This Topic: https://groups.io/mt/99093106/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH V2] MdeModulePkg/Decompress: Add missing source file to Brotli library

2023-01-12 Thread He, Jiangang via groups.io
[AMD Official Use Only - General]

Timothy will answer the question.

From: Chang, Abner 
Sent: Thursday, January 12, 2023 10:05 AM
To: Kinney, Michael D ; devel@edk2.groups.io
Cc: Bi, Dandan ; Gao, Liming ; 
Kirkendall, Garrett ; Kinney, Michael D 
; He, Jiangang 
Subject: Re: [edk2-devel] [PATCH V2] MdeModulePkg/Decompress: Add missing 
source file to Brotli library


[AMD Official Use Only - General]

Hi Mike,
CC Jiangang, he can give the clear answer.

Thanks
Abner


Get Outlook for Android

From: Kinney, Michael D 
mailto:michael.d.kin...@intel.com>>
Sent: Thursday, January 12, 2023 11:23:48 PM
To: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>>; Chang, Abner 
mailto:abner.ch...@amd.com>>
Cc: Bi, Dandan mailto:dandan...@intel.com>>; Gao, Liming 
mailto:gaolim...@byosoft.com.cn>>; Kirkendall, 
Garrett mailto:garrett.kirkend...@amd.com>>; 
Kinney, Michael D 
mailto:michael.d.kin...@intel.com>>
Subject: RE: [edk2-devel] [PATCH V2] MdeModulePkg/Decompress: Add missing 
source file to Brotli library

Caution: This message originated from an External Source. Use proper caution 
when opening attachments, clicking links, or responding.


Hi Abner,

What was the failure before this change?

This looks like something that would always break the build of source files 
were missing.

Mike

> -Original Message-
> From: devel@edk2.groups.io 
> mailto:devel@edk2.groups.io>> On Behalf Of Chang, Abner 
> via groups.io
> Sent: Wednesday, January 11, 2023 9:08 PM
> To: devel@edk2.groups.io
> Cc: Bi, Dandan mailto:dandan...@intel.com>>; Gao, Liming 
> mailto:gaolim...@byosoft.com.cn>>; Garrett 
> Kirkendall mailto:garrett.kirkend...@amd.com>>;
> Abner Chang mailto:abner.ch...@amd.com>>
> Subject: [edk2-devel] [PATCH V2] MdeModulePkg/Decompress: Add missing source 
> file to Brotli library
>
> From: Abner Chang mailto:abner.ch...@amd.com>>
>
> Add missing source files to Brotli library INF.
>
> Signed-off-by: Jiangang He mailto:jiangang...@amd.com>>
> Cc: Dandan Bi mailto:dandan...@intel.com>>
> Cc: Liming Gao mailto:gaolim...@byosoft.com.cn>>
> Cc: Garrett Kirkendall 
> mailto:garrett.kirkend...@amd.com>>
> Cc: Abner Chang mailto:abner.ch...@amd.com>>
> ---
>  .../BrotliCustomDecompressLib/BrotliCustomDecompressLib.inf  | 5 +
>  1 file changed, 5 insertions(+)
>
> diff --git 
> a/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliCustomDecompressLib.inf
> b/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliCustomDecompressLib.inf
> index 525e92408d6..244c2e35023 100644
> --- 
> a/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliCustomDecompressLib.inf
> +++ 
> b/MdeModulePkg/Library/BrotliCustomDecompressLib/BrotliCustomDecompressLib.inf
> @@ -5,6 +5,7 @@
>  #  Brotli was released on the website https://github.com/google/brotli.
>  #
>  #  Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
> +#  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
>  #
>  #  SPDX-License-Identifier: BSD-2-Clause-Patent
>  #
> @@ -41,6 +42,10 @@
># Wrapper header files end #
>brotli/c/common/dictionary.c
>brotli/c/common/transform.c
> +  brotli/c/common/context.c
> +  brotli/c/common/platform.c
> +  brotli/c/common/constants.c
> +  brotli/c/common/shared_dictionary.c
>brotli/c/dec/bit_reader.c
>brotli/c/dec/decode.c
>brotli/c/dec/huffman.c
> --
> 2.37.1.windows.1
>
>
>
> 
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#98378): https://edk2.groups.io/g/devel/message/98378
Mute This Topic: https://groups.io/mt/96217309/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH 3/3] MdeModulePkg/XhciPei: Unlinked XhciPei memory block

2023-01-09 Thread He, Jiangang via groups.io
[AMD Official Use Only - General]

Hi Hao,

Yes UsbHcUnlinkMemBlock() call should be uncommented.

--
  for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
 UsbHcUnlinkMemBlock (Pool->Head, Block);
 UsbHcFreeMemBlock (Pool, Block);
  }
--
Thanks,
Jiangang

-Original Message-
From: Chang, Abner 
Sent: Monday, December 26, 2022 9:33 AM
To: Wu, Hao A ; devel@edk2.groups.io
Cc: Ni, Ray ; Kirkendall, Garrett 
; Lin, Kuei-Hung (Timothy) ; 
He, Jiangang 
Subject: RE: [edk2-devel] [PATCH 3/3] MdeModulePkg/XhciPei: Unlinked XhciPei 
memory block

[AMD Official Use Only - General]

Hi Hao,
Yes, I think we also have to uncomment it and change the order as well. 
However, I would like to have Jiangang's confirmation. Lets wait until they 
come back from holidays.

Thanks
Abner


> -Original Message-
> From: Wu, Hao A 
> Sent: Friday, December 23, 2022 9:00 AM
> To: devel@edk2.groups.io; Chang, Abner 
> Cc: Ni, Ray ; Kirkendall, Garrett
> ; Lin, Kuei-Hung (Timothy)  hung@amd.com>
> Subject: RE: [edk2-devel] [PATCH 3/3] MdeModulePkg/XhciPei: Unlinked
> XhciPei memory block
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> Sorry,
>
> I found that I missed pointing out in the previous discussion that
> within function UsbHcFreeMem(), below snippet of code should be updated as 
> well:
>
>   //
>   // Release the current memory block if it is empty and not the head
>   //
>   if ((Block != Head) && UsbHcIsMemBlockEmpty (Block)) {
> // UsbHcUnlinkMemBlock (Head, Block);
> UsbHcFreeMemBlock (Pool, Block);
>   }
>
> Could you help to double check if the above UsbHcUnlinkMemBlock() call
> should be uncommented?
> Thanks in advance.
>
> Best Regards,
> Hao Wu
>
> > -Original Message-
> > From: devel@edk2.groups.io  On Behalf Of
> > Chang, Abner via groups.io
> > Sent: Wednesday, December 21, 2022 11:42 PM
> > To: devel@edk2.groups.io
> > Cc: Wu, Hao A ; Ni, Ray ;
> > Garrett Kirkendall ; Abner Chang
> > ; Kuei-Hung Lin 
> > Subject: [edk2-devel] [PATCH 3/3] MdeModulePkg/XhciPei: Unlinked
> > XhciPei memory block
> >
> > From: Abner Chang 
> >
> > Unlink the XhciPei memory block when it has been freed.
> >
> > Signed-off-by: Jiangang He 
> > Cc: Hao A Wu 
> > Cc: Ray Ni 
> > Cc: Garrett Kirkendall 
> > Cc: Abner Chang 
> > Cc: Kuei-Hung Lin 
> > ---
> >  MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c | 29
> > -
> >  1 file changed, 28 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
> > b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
> > index c64b38fcfc8..7dc014e465d 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.
> > +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights
> > +reserved.
> >
> >  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);
> >}
> >
> > --
> > 2.37.1.windows.1
> >
> >
> >
> > 
> >


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#98194): https://edk2.groups.io/g/devel/message/98194
Mute This Topic: https://groups.io/mt/95808360/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-




Re: [edk2-devel] [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory block

2022-12-19 Thread He, Jiangang via groups.io
[AMD Official Use Only - General]

UsbHcFreeMemBlock()->IoMmuFreeBuffer()->mIoMmu->FreeBuffer(), which may end up 
calling PeiFreePages() depending on gEdkiiIoMmuPpiGuid implementation. Surely 
both will work since UsbHcFreeMemPool() can't be interrupted by any service 
call to use the memory just freed. Just for good coding practice reason, I pick 
the one aligning with XhciDxe.

Thanks,
Jiangang
-Original Message-
From: Wu, Hao A 
Sent: Monday, December 19, 2022 12:40 AM
To: He, Jiangang ; Chang, Abner ; 
devel@edk2.groups.io
Cc: Lin, Kuei-Hung (Timothy) ; Ni, Ray 
; Zeng, Star ; Sun, Zhikai 
; Kirkendall, Garrett 
Subject: RE: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory block

[AMD Official Use Only - General]

Caution: This message originated from an External Source. Use proper caution 
when opening attachments, clicking links, or responding.


Hello,

My take is that unlike in DXE, the UsbHcFreeMemBlock() implementation in PEI 
phase does not perform freeing the memory.

So I think both the solution:
* Provided at 
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Ftopic%2F92833071%2392165&data=05%7C01%7CJiangang.He%40amd.com%7C528424aa303f4a2c9b1808dae18be036%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638070288126779782%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=uJMNyYXMU22UZNjrKtDetyD2BqrvkualuorPZHAV3wg%3D&reserved=0,
 which aligns with EhciPei
* Mentioned at the end of your previous reply, which aligns with XhciDxe should 
work fine.

I will leave it to you for the final decision.

Best Regards,
Hao Wu

> -Original Message-
> From: He, Jiangang 
> Sent: Friday, December 16, 2022 12:48 AM
> To: Chang, Abner ; Wu, Hao A
> ; devel@edk2.groups.io
> Cc: Lin, Kuei-Hung (Timothy) ; Ni, Ray
> ; Zeng, Star ; Sun, Zhikai
> ; Kirkendall, Garrett
> 
> Subject: RE: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory
> block
>
> [AMD Official Use Only - General]
>
> Yes, it is the same issue discussed in
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2
> .groups.io%2Fg%2Fdevel%2Ftopic%2F92833071%2392165&data=05%7C01%7CJiang
> ang.He%40amd.com%7C528424aa303f4a2c9b1808dae18be036%7C3dd8961fe4884e60
> 8e11a82d994e183d%7C0%7C0%7C638070288126936018%7CUnknown%7CTWFpbGZsb3d8
> eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3
> 000%7C%7C%7C&sdata=58j41QJxKbrQenhyZKYO4dxYj3Sat2kJejQGioZhtu4%3D&rese
> rved=0
>
> MdeModulePkg\Bus\Pci\XhciPei\UsbHcMem.c
>
>   for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
> // UsbHcUnlinkMemBlock (Pool->Head, Block);
> UsbHcFreeMemBlock (Pool, Block);
>   }
> Block = Pool->Head->Next never change without calling
> UsbHcUnlinkMemBlock (Pool->Head, Block), therefore dead loop.
>
> Our proposed fix came from dxe version of the equivalent file
> MdeModulePkg\Bus\Pci\XhciDxe\UsbHcMem.c but swapped two routine call
> order (Now I think it is incorrect as clarified below).
>   for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
> UsbHcFreeMemBlock (Pool, Block);
> UsbHcUnlinkMemBlock (Pool->Head, Block);
>   }
>
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2.groups.io%2Fg%2Fdevel%2Ftopic%2F92833071%2392165&data=05%7C01%7CJiangang.He%40amd.com%7C528424aa303f4a2c9b1808dae18be036%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638070288126936018%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=58j41QJxKbrQenhyZKYO4dxYj3Sat2kJejQGioZhtu4%3D&reserved=0
>  proposed fix:
>
>   for (Block = Pool->Head->Next; Block != NULL; Block = Block ->Next) {
> // UsbHcUnlinkMemBlock (Pool->Head, Block);
> UsbHcFreeMemBlock (Pool, Block);
>   }
>
> I think it again, both proposals have problem of reading memory
> content in the buffer that has just been freed.
>
>   for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
>  UsbHcUnlinkMemBlock (Pool->Head, Block);
> UsbHcFreeMemBlock (Pool, Block);
>   }
> is right solution and matches dxe version of UsbHcMem.c.
>
> Thanks,
> Jiangang
>
> -Original Message-
> From: Chang, Abner 
> Sent: Wednesday, December 14, 2022 8:12 PM
> To: Wu, Hao A ; devel@edk2.groups.io
> Cc: Lin, Kuei-Hung (Timothy) ; Ni, Ray
> ; Zeng, Star ; Sun, Zhikai
> ; Kirkendall, Garrett
> ; He, Jiangang 
> Subject: RE: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory
> block
>
> [AMD Official Use Only - General]
>
> Hi Jiangang,
> Could you please provide the context of this patch?
>
> Thanks
> Abner
>
> > -Original Message-
> > From: Wu, Hao A 
> > Sent: Monday, December 12, 2022 11:27 AM
> > To: Chang, Abner ; devel@edk2.groups.io
> > Cc: Lin, Kuei-Hung (Timothy) ; Ni, Ray
> > ; Zeng, Star ; Sun, Zhikai
> > ; Kirkendall, Garrett
> > 
> > Subject: RE: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei
>

Re: [edk2-devel] [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory block

2022-12-19 Thread He, Jiangang via groups.io
[AMD Official Use Only - General]

Yes, it is the same issue discussed in 
https://edk2.groups.io/g/devel/topic/92833071#92165

MdeModulePkg\Bus\Pci\XhciPei\UsbHcMem.c

  for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
// UsbHcUnlinkMemBlock (Pool->Head, Block);
UsbHcFreeMemBlock (Pool, Block);
  }
Block = Pool->Head->Next never change without calling UsbHcUnlinkMemBlock 
(Pool->Head, Block), therefore dead loop.

Our proposed fix came from dxe version of the equivalent file 
MdeModulePkg\Bus\Pci\XhciDxe\UsbHcMem.c but swapped two routine call order (Now 
I think it is incorrect as clarified below).
  for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
UsbHcFreeMemBlock (Pool, Block);
UsbHcUnlinkMemBlock (Pool->Head, Block);
  }

https://edk2.groups.io/g/devel/topic/92833071#92165 proposed fix:

  for (Block = Pool->Head->Next; Block != NULL; Block = Block ->Next) {
// UsbHcUnlinkMemBlock (Pool->Head, Block);
UsbHcFreeMemBlock (Pool, Block);
  }

I think it again, both proposals have problem of reading memory content in the 
buffer that has just been freed.

  for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
 UsbHcUnlinkMemBlock (Pool->Head, Block);
UsbHcFreeMemBlock (Pool, Block);
  }
is right solution and matches dxe version of UsbHcMem.c.

Thanks,
Jiangang

-Original Message-
From: Chang, Abner 
Sent: Wednesday, December 14, 2022 8:12 PM
To: Wu, Hao A ; devel@edk2.groups.io
Cc: Lin, Kuei-Hung (Timothy) ; Ni, Ray 
; Zeng, Star ; Sun, Zhikai 
; Kirkendall, Garrett ; He, 
Jiangang 
Subject: RE: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory block

[AMD Official Use Only - General]

Hi Jiangang,
Could you please provide the context of this patch?

Thanks
Abner

> -Original Message-
> From: Wu, Hao A 
> Sent: Monday, December 12, 2022 11:27 AM
> To: Chang, Abner ; devel@edk2.groups.io
> Cc: Lin, Kuei-Hung (Timothy) ; Ni, Ray
> ; Zeng, Star ; Sun, Zhikai
> ; Kirkendall, Garrett
> 
> Subject: RE: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory
> block
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> Sorry for a question, may I know what issue was met that leads to the
> proposed patch?
> Could you help to check if it is related with the topic discussed in
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fedk2
> .gr
> oups.io%2Fg%2Fdevel%2Ftopic%2F92833071%2392165&data=05%7C01%7
> Cabner.chang%40amd.com%7Ccac49c2820e741b8c48a08dadbf0cc24%7C3dd8
> 961fe4884e608e11a82d994e183d%7C0%7C0%7C638064124512265992%7CUnk
> nown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1h
> aWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=z1Q7NRxN4GMA%2
> FBxYd2D7Gnkc3aTD23mRnwNF3H5wE0k%3D&reserved=0? Thanks in advance.
>
> Best Regards,
> Hao Wu
>
> > -Original Message-
> > From: abner.ch...@amd.com 
> > Sent: Saturday, December 10, 2022 11:13 PM
> > To: devel@edk2.groups.io
> > Cc: kuei-hung@amd.com; Wu, Hao A ; Ni, Ray
> > ; Garrett Kirkendall ;
> > Abner Chang 
> > Subject: [PATCH V2] MdeModulePkg/XhciPei: Unlinked XhciPei memory
> > block
> >
> > From: Abner Chang 
> >
> > In V2: Add AMD copyright.
> >
> > Unlink the XhciPei memory block when it has been freed.
> >
> > Signed-off-by: Kuei-Hung Lin 
> > Cc: Hao A Wu 
> > Cc: Ray Ni 
> > Cc: Garrett Kirkendall 
> > Cc: Abner Chang 
> > ---
> >  MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c | 29
> > -
> >  1 file changed, 28 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
> > b/MdeModulePkg/Bus/Pci/XhciPei/UsbHcMem.c
> > index c64b38fcfc8..39ba31b0913 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.
> > +Copyright (C) 2022 Advanced Micro Devices, Inc. All rights
> > +reserved.
> >
> >  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;
> > +  bre