public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Wu, Hao A" <hao.a.wu@intel.com>,
	Jiading Zhang <jdzhang@kunluntech.com.cn>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Fix the Bug of clean InputContext in XhcEvaluateContext64();
Date: Tue, 20 Sep 2022 03:16:44 +0000	[thread overview]
Message-ID: <DM6PR11MB4025EB642FA8936DA98374F7CA4C9@DM6PR11MB4025.namprd11.prod.outlook.com> (raw)
In-Reply-To: <DM6PR11MB4025F74D6DA67C9A0D6737B1CA4C9@DM6PR11MB4025.namprd11.prod.outlook.com>

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

Sorry, missed one change, “EPState” field should be cleared to 0 for input context:

  INPUT_CONTEXT_64            *InputContext;
  DEVICE_CONTEXT_64           *OutputContext;
  EFI_PHYSICAL_ADDRESS        PhyAddr;

  ASSERT (Xhc->UsbDevContext[SlotId].SlotId != 0);

  //
  // 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;


From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, Hao A
Sent: Tuesday, September 20, 2022 11:04 AM
To: Jiading Zhang <jdzhang@kunluntech.com.cn>; devel@edk2.groups.io
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Fix the Bug of clean InputContext in XhcEvaluateContext64();

Thanks for the information.

Yes, I think the “EPType” field should be initialized properly for the Evaluate Context command to work.
The spec mentions in 6.2.3 Endpoint Context that:
* Note: Unless otherwise stated: As Input, all fields of the Endpoint Context shall be initialized to the appropriate value by software before issuing a command.
* Endpoint Type (EP Type). This field identifies whether an Endpoint Context is Valid

Could you help to update XhcEvaluateContext64 to (please help to update XhcEvaluateContext accordingly as well) and check below changes work on your environment?
  INPUT_CONTEXT_64            *InputContext;
  DEVICE_CONTEXT_64           *OutputContext;
  EFI_PHYSICAL_ADDRESS        PhyAddr;

  ASSERT (Xhc->UsbDevContext[SlotId].SlotId != 0);

  //
  // 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));

My take is that doing so will initialize the input context of EP0 for the Evaluate Context command with previous output context of the Address Device command.

Best Regards,
Hao Wu

From: Jiading Zhang <jdzhang@kunluntech.com.cn<mailto:jdzhang@kunluntech.com.cn>>
Sent: Tuesday, September 20, 2022 8:46 AM
To: Wu; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Fix the Bug of clean InputContext in XhcEvaluateContext64();

Hello,
   I test for several times and find that if add the following line, the KB and MassStorage will work,
       InputContext->EP[0].EPType = ED_CONTROL_BIDIR;

   I don't know if the issue is brought in by the different of xHCI controllers or else.


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

  reply	other threads:[~2022-09-20  3:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14  7:14 [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Fix the Bug of clean InputContext in XhcEvaluateContext64(); Jiading Zhang
2022-09-14  8:31 ` [edk2-devel] " Wu, Hao A
2022-09-14  9:23   ` Jiading Zhang
2022-09-15  3:26     ` Wu, Hao A
2022-09-20  0:46       ` Jiading Zhang
2022-09-20  3:03         ` Wu, Hao A
2022-09-20  3:16           ` Wu, Hao A [this message]
2022-09-20  5:59             ` Jiading Zhang
2022-09-20  6:27               ` Wu, Hao A
2022-09-20 10:00                 ` Jiading Zhang
2022-09-21  1:34                   ` Wu, Hao A

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM6PR11MB4025EB642FA8936DA98374F7CA4C9@DM6PR11MB4025.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox