public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4074
@ 2022-09-21  3:15 Jiading Zhang
  2022-09-21  6:12 ` [edk2-devel] " Wu, Hao A
  0 siblings, 1 reply; 4+ messages in thread
From: Jiading Zhang @ 2022-09-21  3:15 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 2543 bytes --]

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/Bus/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               *InputContext;
+  DEVICE_CONTEXT              *OutputContext;
EFI_PHYSICAL_ADDRESS        PhyAddr;

ASSERT (Xhc->UsbDevContext[SlotId].SlotId != 0);
@@ -3965,10 +3966,14 @@ XhcEvaluateContext (
// 4.6.7 Evaluate Context
//
InputContext = Xhc->UsbDevContext[SlotId].InputContext;
+  OutputContext = Xhc->UsbDevContext[SlotId].OutputContext;
ZeroMem (InputContext, sizeof (INPUT_CONTEXT));

+  CopyMem (&InputContext->EP[0], &OutputContext->EP[0], sizeof (ENDPOINT_CONTEXT));
+
InputContext->InputControlContext.Dword2 |= BIT1;
InputContext->EP[0].MaxPacketSize         = MaxPacketSize;
+  InputContext->EP[0].EPState               = 0;

ZeroMem (&CmdTrbEvalu, sizeof (CmdTrbEvalu));
PhyAddr              = UsbHcGetPciAddrForHostAddr (Xhc->MemPool, InputContext, sizeof (INPUT_CONTEXT));
@@ -4013,6 +4018,7 @@ XhcEvaluateContext64 (
CMD_TRB_EVALUATE_CONTEXT    CmdTrbEvalu;
EVT_TRB_COMMAND_COMPLETION  *EvtTrb;
INPUT_CONTEXT_64            *InputContext;
+  DEVICE_CONTEXT_64           *OutputContext;
EFI_PHYSICAL_ADDRESS        PhyAddr;

ASSERT (Xhc->UsbDevContext[SlotId].SlotId != 0);
@@ -4021,10 +4027,14 @@ XhcEvaluateContext64 (
// 4.6.7 Evaluate Context
//
InputContext = Xhc->UsbDevContext[SlotId].InputContext;
+  OutputContext = Xhc->UsbDevContext[SlotId].OutputContext;
ZeroMem (InputContext, sizeof (INPUT_CONTEXT_64));

+  CopyMem (&InputContext->EP[0], &OutputContext->EP[0], sizeof (ENDPOINT_CONTEXT_64));
+
InputContext->InputControlContext.Dword2 |= BIT1;
InputContext->EP[0].MaxPacketSize         = MaxPacketSize;
+  InputContext->EP[0].EPState               = 0;

ZeroMem (&CmdTrbEvalu, sizeof (CmdTrbEvalu));
PhyAddr              = UsbHcGetPciAddrForHostAddr (Xhc->MemPool, InputContext, sizeof (INPUT_CONTEXT_64));
--
2.20.1.windows.1

[-- Attachment #2: Type: text/html, Size: 4067 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-27  2:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-21  3:15 [PATCH] REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4074 Jiading Zhang
2022-09-21  6:12 ` [edk2-devel] " Wu, Hao A
2022-09-21  7:18   ` Jiading Zhang
2022-09-27  2:46   ` Wu, Hao A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox