summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorjdzhang <jdzhang@zd-tech.com.cn>2021-11-25 15:44:48 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-09 02:36:30 +0000
commitd25b803e514a11a25de91d4174b289d2ae783338 (patch)
tree493b7ed8255215ffa9bf048e2c42dc87e2010c58 /MdeModulePkg
parent7b2831000894f3091cac633e61d9bcf3661cc44b (diff)
downloadedk2-d25b803e514a11a25de91d4174b289d2ae783338.tar.gz
edk2-d25b803e514a11a25de91d4174b289d2ae783338.tar.bz2
edk2-d25b803e514a11a25de91d4174b289d2ae783338.zip
MdeModulePkg/Bus/Pci/UhciDxe: Fix the UsbHc memory allocate and free issue
When use the UsbHcAllocMemFromBlock() and UsbHcFreeMem() to allocate memory and free memory for the UHC, it should use the corresponding host address but not the pci bus address. Signed-off-by: jdzhang <jdzhang@zd-tech.com.cn> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c b/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c
index d6b9615e49..c3d46f60be 100644
--- a/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c
+++ b/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c
@@ -207,7 +207,7 @@ UsbHcAllocMemFromBlock (
NEXT_BIT (Byte, Bit);
}
- return Block->Buf + (StartByte * 8 + StartBit) * USBHC_MEM_UNIT;
+ return Block->BufHost + (StartByte * 8 + StartBit) * USBHC_MEM_UNIT;
}
/**
@@ -508,12 +508,12 @@ UsbHcFreeMem (
// scan the memory block list for the memory block that
// completely contains the memory to free.
//
- if ((Block->Buf <= ToFree) && ((ToFree + AllocSize) <= (Block->Buf + Block->BufLen))) {
+ if ((Block->BufHost <= ToFree) && ((ToFree + AllocSize) <= (Block->BufHost + Block->BufLen))) {
//
// compute the start byte and bit in the bit array
//
- Byte = ((ToFree - Block->Buf) / USBHC_MEM_UNIT) / 8;
- Bit = ((ToFree - Block->Buf) / USBHC_MEM_UNIT) % 8;
+ Byte = ((ToFree - Block->BufHost) / USBHC_MEM_UNIT) / 8;
+ Bit = ((ToFree - Block->BufHost) / USBHC_MEM_UNIT) % 8;
//
// reset associated bits in bit array