From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: [PATCH] REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4074 To: devel@edk2.groups.io From: "Jiading Zhang" X-Originating-Location: Tokyo, JP (192.109.233.224) X-Originating-Platform: Windows Chrome 105 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Tue, 20 Sep 2022 20:15:40 -0700 Message-ID: Content-Type: multipart/alternative; boundary="DEHup7GUCOkVJOYO6cgM" --DEHup7GUCOkVJOYO6cgM Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Update XhcEvaluateContext/XhcEvaluateContext64 to properly initialize the i= nput context for Evaluate Context command. Signed-off-by: jdzhang --- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pc= i/XhciDxe/XhciSched.c index c2906e06fd..4f2e9c3f6b 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -3957,6 +3957,7 @@ XhcEvaluateContext ( CMD_TRB_EVALUATE_CONTEXT=C2=A0 =C2=A0 CmdTrbEvalu; EVT_TRB_COMMAND_COMPLETION=C2=A0 *EvtTrb; INPUT_CONTEXT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*InputC= ontext; +=C2=A0 DEVICE_CONTEXT=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *Out= putContext; EFI_PHYSICAL_ADDRESS=C2=A0 =C2=A0 =C2=A0 =C2=A0 PhyAddr; ASSERT (Xhc->UsbDevContext[SlotId].SlotId !=3D 0); @@ -3965,10 +3966,14 @@ XhcEvaluateContext ( // 4.6.7 Evaluate Context // InputContext =3D Xhc->UsbDevContext[SlotId].InputContext; +=C2=A0 OutputContext =3D Xhc->UsbDevContext[SlotId].OutputContext; ZeroMem (InputContext, sizeof (INPUT_CONTEXT)); +=C2=A0 CopyMem (&InputContext->EP[0], &OutputContext->EP[0], sizeof (ENDPO= INT_CONTEXT)); + InputContext->InputControlContext.Dword2 |=3D BIT1; InputContext->EP[0].MaxPacketSize=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D MaxP= acketSize; +=C2=A0 InputContext->EP[0].EPState=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0=3D 0; ZeroMem (&CmdTrbEvalu, sizeof (CmdTrbEvalu)); PhyAddr=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D UsbHcGetPciAddr= ForHostAddr (Xhc->MemPool, InputContext, sizeof (INPUT_CONTEXT)); @@ -4013,6 +4018,7 @@ XhcEvaluateContext64 ( CMD_TRB_EVALUATE_CONTEXT=C2=A0 =C2=A0 CmdTrbEvalu; EVT_TRB_COMMAND_COMPLETION=C2=A0 *EvtTrb; INPUT_CONTEXT_64=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *InputContext; +=C2=A0 DEVICE_CONTEXT_64=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*OutputCo= ntext; EFI_PHYSICAL_ADDRESS=C2=A0 =C2=A0 =C2=A0 =C2=A0 PhyAddr; ASSERT (Xhc->UsbDevContext[SlotId].SlotId !=3D 0); @@ -4021,10 +4027,14 @@ XhcEvaluateContext64 ( // 4.6.7 Evaluate Context // InputContext =3D Xhc->UsbDevContext[SlotId].InputContext; +=C2=A0 OutputContext =3D Xhc->UsbDevContext[SlotId].OutputContext; ZeroMem (InputContext, sizeof (INPUT_CONTEXT_64)); +=C2=A0 CopyMem (&InputContext->EP[0], &OutputContext->EP[0], sizeof (ENDPO= INT_CONTEXT_64)); + InputContext->InputControlContext.Dword2 |=3D BIT1; InputContext->EP[0].MaxPacketSize=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D MaxP= acketSize; +=C2=A0 InputContext->EP[0].EPState=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0=3D 0; ZeroMem (&CmdTrbEvalu, sizeof (CmdTrbEvalu)); PhyAddr=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D UsbHcGetPciAddr= ForHostAddr (Xhc->MemPool, InputContext, sizeof (INPUT_CONTEXT_64)); -- 2.20.1.windows.1 --DEHup7GUCOkVJOYO6cgM Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Update XhcEvaluateContext/XhcEvaluateContext64 to properly initialize = the input context for Evaluate Context command.
 
Signed-off-by: jdzhang <jdzhang@kunluntech.com.cn>
---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
 
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/B= us/Pci/XhciDxe/XhciSched.c
index c2906e06fd..4f2e9c3f6b 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
@@ -3957,6 +3957,7 @@ XhcEvaluateContext (
   CMD_TRB_EVALUATE_CONTEXT    CmdTrbEvalu;
   EVT_TRB_COMMAND_COMPLETION  *EvtTrb;
   INPUT_CONTEXT            &n= bsp;  *InputContext;
+  DEVICE_CONTEXT             = *OutputContext;
   EFI_PHYSICAL_ADDRESS        PhyAddr;<= /div>
 
   ASSERT (Xhc->UsbDevContext[SlotId].SlotId !=3D 0);
@@ -3965,10 +3966,14 @@ XhcEvaluateContext (
   // 4.6.7 Evaluate Context
   //
   InputContext =3D Xhc->UsbDevContext[SlotId].InputConte= xt;
+  OutputContext =3D Xhc->UsbDevContext[SlotId].OutputContext;=
   ZeroMem (InputContext, sizeof (INPUT_CONTEXT));
 
+  CopyMem (&InputContext->EP[0], &OutputContext->E= P[0], sizeof (ENDPOINT_CONTEXT));
+  
   InputContext->InputControlContext.Dword2 |=3D BIT1;
   InputContext->EP[0].MaxPacketSize      =    =3D MaxPacketSize;
+  InputContext->EP[0].EPState        &nbs= p;      =3D 0;
 
   ZeroMem (&CmdTrbEvalu, sizeof (CmdTrbEvalu));
   PhyAddr              = =3D UsbHcGetPciAddrForHostAddr (Xhc->MemPool, InputContext, sizeof (INPU= T_CONTEXT));
@@ -4013,6 +4018,7 @@ XhcEvaluateContext64 (
   CMD_TRB_EVALUATE_CONTEXT    CmdTrbEvalu;
   EVT_TRB_COMMAND_COMPLETION  *EvtTrb;
   INPUT_CONTEXT_64           = *InputContext;
+  DEVICE_CONTEXT_64           *Out= putContext;
   EFI_PHYSICAL_ADDRESS        PhyAddr;<= /div>
 
   ASSERT (Xhc->UsbDevContext[SlotId].SlotId !=3D 0);
@@ -4021,10 +4027,14 @@ XhcEvaluateContext64 (
   // 4.6.7 Evaluate Context
   //
   InputContext =3D Xhc->UsbDevContext[SlotId].InputConte= xt;
+  OutputContext =3D Xhc->UsbDevContext[SlotId].OutputContext;=
   ZeroMem (InputContext, sizeof (INPUT_CONTEXT_64));
 
+  CopyMem (&InputContext->EP[0], &OutputContext->E= P[0], sizeof (ENDPOINT_CONTEXT_64));
+
   InputContext->InputControlContext.Dword2 |=3D BIT1;
   InputContext->EP[0].MaxPacketSize      =    =3D MaxPacketSize;
+  InputContext->EP[0].EPState        &nbs= p;      =3D 0;
 
   ZeroMem (&CmdTrbEvalu, sizeof (CmdTrbEvalu));
   PhyAddr              = =3D UsbHcGetPciAddrForHostAddr (Xhc->MemPool, InputContext, sizeof (INPU= T_CONTEXT_64));
-- 
2.20.1.windows.1
 
--DEHup7GUCOkVJOYO6cgM--