mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 16:14:04 +02:00
MdeModulePkg/XhciPei: Unlinked XhciPei memory block
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> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
This commit is contained in:
parent
be8d6ef385
commit
47ab397011
@ -3,6 +3,7 @@ PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid
|
|||||||
which is used to enable recovery function from USB Drivers.
|
which is used to enable recovery function from USB Drivers.
|
||||||
|
|
||||||
Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
|
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
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
@ -365,6 +366,32 @@ UsbHcInitMemPool (
|
|||||||
return Pool;
|
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.
|
Release the memory management pool.
|
||||||
|
|
||||||
@ -386,7 +413,7 @@ UsbHcFreeMemPool (
|
|||||||
// first block.
|
// first block.
|
||||||
//
|
//
|
||||||
for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
|
for (Block = Pool->Head->Next; Block != NULL; Block = Pool->Head->Next) {
|
||||||
// UsbHcUnlinkMemBlock (Pool->Head, Block);
|
UsbHcUnlinkMemBlock (Pool->Head, Block);
|
||||||
UsbHcFreeMemBlock (Pool, Block);
|
UsbHcFreeMemBlock (Pool, Block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -532,7 +559,7 @@ UsbHcFreeMem (
|
|||||||
// Release the current memory block if it is empty and not the head
|
// Release the current memory block if it is empty and not the head
|
||||||
//
|
//
|
||||||
if ((Block != Head) && UsbHcIsMemBlockEmpty (Block)) {
|
if ((Block != Head) && UsbHcIsMemBlockEmpty (Block)) {
|
||||||
// UsbHcUnlinkMemBlock (Head, Block);
|
UsbHcUnlinkMemBlock (Head, Block);
|
||||||
UsbHcFreeMemBlock (Pool, Block);
|
UsbHcFreeMemBlock (Pool, Block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user