[edk2-devel] [PATCH] REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4074

Jiading Zhang posted 1 patch 1 week ago
Failed in applying to current master (apply log)
MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 10 ++++++++++
1 file changed, 10 insertions(+)
[edk2-devel] [PATCH] REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4074
Posted by Jiading Zhang 1 week ago
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


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94030): https://edk2.groups.io/g/devel/message/94030
Mute This Topic: https://groups.io/mt/93819720/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4074
Posted by Wu, Hao A 6 days, 22 hours ago
Thanks for the patch, it looks good to me:
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Will wait a couple of days to see if comments from other reviewers.

Also, before merging, I will modify the subject of the commit to:
MdeModulePkg/XhciDxe: Input context update for Evaluate Context command
and move the BZ tracker information to the commit message.

Best Regards,
Hao Wu

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Jiading Zhang
Sent: Wednesday, September 21, 2022 11:16 AM
To: devel@edk2.groups.io
Subject: [edk2-devel] [PATCH] REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4074

Update XhcEvaluateContext/XhcEvaluateContext64 to properly initialize the input context for Evaluate Context command.

Signed-off-by: jdzhang <jdzhang@kunluntech.com.cn<mailto: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




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94046): https://edk2.groups.io/g/devel/message/94046
Mute This Topic: https://groups.io/mt/93819720/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4074
Posted by Wu, Hao A 1 day, 1 hour ago
Pushed via:
PR - https://github.com/tianocore/edk2/pull/3413
Commit - https://github.com/tianocore/edk2/commit/b3dd9cb836e2aed68198aa79a1ca6afdb25adf80

Best Regards,
Hao Wu

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, Hao A
Sent: Wednesday, September 21, 2022 2:12 PM
To: devel@edk2.groups.io; jdzhang@kunluntech.com.cn
Subject: Re: [edk2-devel] [PATCH] REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4074

Thanks for the patch, it looks good to me:
Reviewed-by: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>

Will wait a couple of days to see if comments from other reviewers.

Also, before merging, I will modify the subject of the commit to:
MdeModulePkg/XhciDxe: Input context update for Evaluate Context command
and move the BZ tracker information to the commit message.

Best Regards,
Hao Wu

From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Jiading Zhang
Sent: Wednesday, September 21, 2022 11:16 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: [edk2-devel] [PATCH] REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4074

Update XhcEvaluateContext/XhcEvaluateContext64 to properly initialize the input context for Evaluate Context command.

Signed-off-by: jdzhang <jdzhang@kunluntech.com.cn<mailto: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




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#94382): https://edk2.groups.io/g/devel/message/94382
Mute This Topic: https://groups.io/mt/93819720/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-