<div>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.</div>
<div> </div>
<div>Signed-off-by: jdzhang <jdzhang@zd-tech.com.cn></div>
<div>---</div>
<div> MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c | 8 ++++----</div>
<div> 1 file changed, 4 insertions(+), 4 deletions(-)</div>
<div> </div>
<div>diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c b/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c</div>
<div>index 9aade19f8e..041638a2de 100644</div>
<div>--- a/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c</div>
<div>+++ b/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c</div>
<div>@@ -211,7 +211,7 @@ UsbHcAllocMemFromBlock (</div>
<div>     NEXT_BIT (Byte, Bit);</div>
<div>   }</div>
<div> </div>
<div>-  return Block->Buf + (StartByte * 8 + StartBit) * USBHC_MEM_UNIT;</div>
<div>+  return Block->BufHost + (StartByte * 8 + StartBit) * USBHC_MEM_UNIT;</div>
<div> }</div>
<div> </div>
<div> /**</div>
<div>@@ -518,12 +518,12 @@ UsbHcFreeMem (</div>
<div>     // scan the memory block list for the memory block that</div>
<div>     // completely contains the memory to free.</div>
<div>     //</div>
<div>-    if ((Block->Buf <= ToFree) && ((ToFree + AllocSize) <= (Block->Buf + Block->BufLen))) {</div>
<div>+    if ((Block->BufHost <= ToFree) && ((ToFree + AllocSize) <= (Block->BufHost + Block->BufLen))) {</div>
<div>       //</div>
<div>       // compute the start byte and bit in the bit array</div>
<div>       //</div>
<div>-      Byte  = ((ToFree - Block->Buf) / USBHC_MEM_UNIT) / 8;</div>
<div>-      Bit   = ((ToFree - Block->Buf) / USBHC_MEM_UNIT) % 8;</div>
<div>+      Byte  = ((ToFree - Block->BufHost) / USBHC_MEM_UNIT) / 8;</div>
<div>+      Bit   = ((ToFree - Block->BufHost) / USBHC_MEM_UNIT) % 8;</div>
<div> </div>
<div>       //</div>
<div>       // reset associated bits in bit array</div>
<div>-- </div>
<div>2.30.0.windows.1</div>
<div> </div>


 <div width="1" style="color:white;clear:both">_._,_._,_</div> <hr>   Groups.io Links:<p>   You receive all messages sent to this group.    <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/84077">View/Reply Online (#84077)</a> |    |  <a target="_blank" href="https://groups.io/mt/87296862/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>    <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |  <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>  [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>