From: "Wu, Hao A" <hao.a.wu@intel.com>
To: Jiading Zhang <jdzhang@kunluntech.com.cn>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Fix the Bug of clean InputContext in XhcEvaluateContext64();
Date: Thu, 15 Sep 2022 03:26:33 +0000 [thread overview]
Message-ID: <DM6PR11MB40255319F5B84D4531DBC499CA499@DM6PR11MB4025.namprd11.prod.outlook.com> (raw)
In-Reply-To: <10580.1663147381171837795@groups.io>
[-- Attachment #1: Type: text/plain, Size: 2575 bytes --]
Hello,
My take to the purpose of calling XhcEvaluateContext/XhcEvaluateContext64 functions is to “inform the xHC of the change to the Default Control endpoint’s Max Packet Size parameter.”
That is why the function only set bit 1 (Add Context bit 1) to inform the xHC only Endpoint Context for EP0 should be evaluated by xHC:
InputContext->InputControlContext.Dword2 |= BIT1
I checked the xHCI spec, it does not prohibit only setting Add Context bit 1. According to section 4.6.7 Evaluate Context:
System software shall initialize Contexts of the
Input Context affected by the command. All Contexts not referenced by an Add Context flag in the Input
Context are ignored by the xHC.
If this is the case, the Slot Context should be ignored by the xHC, since Add Context bit 0 is cleared.
Then, according to section 6.2.3.3 Evaluate Context Command Usage:
A 'valid' Input Endpoint Context for an Evaluate Context Command requires that if the Add Context flag
(A1) for Default Control Endpoint is set to ‘1’, the Max Packet Size field shall be evaluated.
I do not think below code snippet violates with the above content in the spec:
ZeroMem (InputContext, sizeof (INPUT_CONTEXT_64));
InputContext->InputControlContext.Dword2 |= BIT1;
InputContext->EP[0].MaxPacketSize = MaxPacketSize;
Do you have a chance to test other USB devices on your environment? Is it possible that the issue is a device specific case?
Thanks in advance.
Best Regards,
Hao Wu
From: Jiading Zhang <jdzhang@kunluntech.com.cn>
Sent: Wednesday, September 14, 2022 5:23 PM
To: Wu; Wu, Hao A <hao.a.wu@intel.com>; devel@edk2.groups.io
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Fix the Bug of clean InputContext in XhcEvaluateContext64();
When I use the newest XhciDxe driver in Phytium Platform( ARM) , I found if clearing “Input Context” in XhcEvaluateContext64(), the usb KB doesn't work, and mark the code ZeroMem (InputContext, sizeof (INPUT_CONTEXT_64)); it works.
I viewed the code again, maybe change the ZeroMem (InputContext, sizeof (INPUT_CONTEXT_64)); to ZeroMem (InputContext, sizeof (INPUT_CONTRL_CONTEXT_64)); is more resonable. Because when clearing the INPUT_CONTEXT_64, the Slot context and the endpoint context are cleared too. But according the xHCI Spec section 6.2.2
Note:Unless otherwise stated: As Input, all fields of the Slot Context shall be initialized to the appropriate value by software before issuing a command.
And I test again, just clear INPUT_CONTRL_CONTEXT_64 is OK.
[-- Attachment #2: Type: text/html, Size: 6139 bytes --]
next prev parent reply other threads:[~2022-09-15 3:26 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 [this message]
2022-09-20 0:46 ` Jiading Zhang
2022-09-20 3:03 ` Wu, Hao A
2022-09-20 3:16 ` Wu, Hao A
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=DM6PR11MB40255319F5B84D4531DBC499CA499@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