* [edk2-devel] [PATCH V2 1/1] MdeModulePkg/XhciDxe: Abort the Address Device cmd when time out
[not found] <cover.1695268645.git.xianglei.cai@intel.com>
@ 2023-09-21 3:57 ` Xianglei Cai
2023-09-21 6:16 ` Wu, Hao A
0 siblings, 1 reply; 3+ messages in thread
From: Xianglei Cai @ 2023-09-21 3:57 UTC (permalink / raw)
To: devel
Cc: Xianglei Cai, Hao A Wu, Ray Ni, Jian J Wang, Liming Gao,
More Shih, Jenny Huang
https://bugzilla.tianocore.org/show_bug.cgi?id=4552
Following XHCI spec 4.6.1.2, software may abort the
execution of Address Device Command when command failed
due to timeout.
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: More Shih <more.shih@intel.com>
Cc: Jenny Huang <jenny.huang@intel.com>
Signed-off-by: Xianglei Cai <xianglei.cai@intel.com>
---
MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 36 ++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
index 53421e64a850..f6efcf80f376 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
@@ -2121,6 +2121,26 @@ RingIntTransferDoorBell (
return EFI_SUCCESS;
}
+/**
+ Set Command abort
+
+ @param Xhc The XHCI Instance.
+ @param SlotId The slot id to be disabled.
+
+**/
+VOID
+XhcCmdRingCmdAbort (
+ IN USB_XHCI_INSTANCE *Xhc,
+ IN UINT8 SlotId
+ )
+{
+ //
+ // Set XHC_CRCR_CA bit in XHC_CRCR_OFFSET to abort command.
+ //
+ DEBUG ((DEBUG_INFO, "Command Ring Control set Command Abort, SlotId: %d\n", SlotId));
+ XhcSetOpRegBit (Xhc, XHC_CRCR_OFFSET, XHC_CRCR_CA);
+}
+
/**
Assign and initialize the device slot for a new device.
@@ -2331,6 +2351,14 @@ XhcInitializeDeviceSlot (
Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
} else {
DEBUG ((DEBUG_ERROR, " Slot %d address not assigned successfully. Status = %r\n", SlotId, Status));
+ //
+ // Software may abort the execution of Address Device Command when command failed
+ // due to timeout by following XHCI spec. 4.6.1.2.
+ //
+ if (Status == EFI_TIMEOUT) {
+ XhcCmdRingCmdAbort (Xhc, SlotId);
+ }
+
XhcDisableSlotCmd (Xhc, SlotId);
}
@@ -2547,6 +2575,14 @@ XhcInitializeDeviceSlot64 (
Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
} else {
DEBUG ((DEBUG_ERROR, " Slot %d address not assigned successfully. Status = %r\n", SlotId, Status));
+ //
+ // Software may abort the execution of Address Device Command when command failed
+ // due to timeout by following XHCI spec. 4.6.1.2.
+ //
+ if (Status == EFI_TIMEOUT) {
+ XhcCmdRingCmdAbort (Xhc, SlotId);
+ }
+
XhcDisableSlotCmd64 (Xhc, SlotId);
}
--
2.42.0.windows.2
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108933): https://edk2.groups.io/g/devel/message/108933
Mute This Topic: https://groups.io/mt/101493909/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [PATCH V2 1/1] MdeModulePkg/XhciDxe: Abort the Address Device cmd when time out
2023-09-21 3:57 ` [edk2-devel] [PATCH V2 1/1] MdeModulePkg/XhciDxe: Abort the Address Device cmd when time out Xianglei Cai
@ 2023-09-21 6:16 ` Wu, Hao A
2023-09-25 4:09 ` Wu, Hao A
0 siblings, 1 reply; 3+ messages in thread
From: Wu, Hao A @ 2023-09-21 6:16 UTC (permalink / raw)
To: Cai, Xianglei, devel@edk2.groups.io
Cc: Ni, Ray, Wang, Jian J, Gao, Liming, Shih, More, Huang, Jenny
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
> -----Original Message-----
> From: Cai, Xianglei <xianglei.cai@intel.com>
> Sent: Thursday, September 21, 2023 11:58 AM
> To: devel@edk2.groups.io
> Cc: Cai, Xianglei <xianglei.cai@intel.com>; Wu, Hao A <hao.a.wu@intel.com>;
> Ni, Ray <ray.ni@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Gao,
> Liming <gaoliming@byosoft.com.cn>; Shih, More <more.shih@intel.com>;
> Huang, Jenny <jenny.huang@intel.com>
> Subject: [PATCH V2 1/1] MdeModulePkg/XhciDxe: Abort the Address Device
> cmd when time out
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=4552
>
> Following XHCI spec 4.6.1.2, software may abort the
> execution of Address Device Command when command failed
> due to timeout.
>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: More Shih <more.shih@intel.com>
> Cc: Jenny Huang <jenny.huang@intel.com>
> Signed-off-by: Xianglei Cai <xianglei.cai@intel.com>
> ---
> MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 36
> ++++++++++++++++++++++++
> 1 file changed, 36 insertions(+)
>
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> index 53421e64a850..f6efcf80f376 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> @@ -2121,6 +2121,26 @@ RingIntTransferDoorBell (
> return EFI_SUCCESS;
> }
>
> +/**
> + Set Command abort
> +
> + @param Xhc The XHCI Instance.
> + @param SlotId The slot id to be disabled.
> +
> +**/
> +VOID
> +XhcCmdRingCmdAbort (
> + IN USB_XHCI_INSTANCE *Xhc,
> + IN UINT8 SlotId
> + )
> +{
> + //
> + // Set XHC_CRCR_CA bit in XHC_CRCR_OFFSET to abort command.
> + //
> + DEBUG ((DEBUG_INFO, "Command Ring Control set Command Abort,
> SlotId: %d\n", SlotId));
> + XhcSetOpRegBit (Xhc, XHC_CRCR_OFFSET, XHC_CRCR_CA);
> +}
> +
> /**
> Assign and initialize the device slot for a new device.
>
> @@ -2331,6 +2351,14 @@ XhcInitializeDeviceSlot (
> Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
> } else {
> DEBUG ((DEBUG_ERROR, " Slot %d address not assigned successfully.
> Status = %r\n", SlotId, Status));
> + //
> + // Software may abort the execution of Address Device Command when
> command failed
> + // due to timeout by following XHCI spec. 4.6.1.2.
> + //
> + if (Status == EFI_TIMEOUT) {
> + XhcCmdRingCmdAbort (Xhc, SlotId);
> + }
> +
> XhcDisableSlotCmd (Xhc, SlotId);
> }
>
> @@ -2547,6 +2575,14 @@ XhcInitializeDeviceSlot64 (
> Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
> } else {
> DEBUG ((DEBUG_ERROR, " Slot %d address not assigned successfully.
> Status = %r\n", SlotId, Status));
> + //
> + // Software may abort the execution of Address Device Command when
> command failed
> + // due to timeout by following XHCI spec. 4.6.1.2.
> + //
> + if (Status == EFI_TIMEOUT) {
> + XhcCmdRingCmdAbort (Xhc, SlotId);
> + }
> +
> XhcDisableSlotCmd64 (Xhc, SlotId);
> }
>
> --
> 2.42.0.windows.2
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108935): https://edk2.groups.io/g/devel/message/108935
Mute This Topic: https://groups.io/mt/101493909/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [PATCH V2 1/1] MdeModulePkg/XhciDxe: Abort the Address Device cmd when time out
2023-09-21 6:16 ` Wu, Hao A
@ 2023-09-25 4:09 ` Wu, Hao A
0 siblings, 0 replies; 3+ messages in thread
From: Wu, Hao A @ 2023-09-25 4:09 UTC (permalink / raw)
To: devel@edk2.groups.io, Wu, Hao A, Cai, Xianglei
Cc: Ni, Ray, Wang, Jian J, Gao, Liming, Shih, More, Huang, Jenny
Pushed via:
PR - https://github.com/tianocore/edk2/pull/4863
Commit - https://github.com/tianocore/edk2/commit/d11f0ea045f598e08b414eeba4f8a74ac1b4ca0b
Best Regards,
Hao Wu
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, Hao
> A
> Sent: Thursday, September 21, 2023 2:17 PM
> To: Cai, Xianglei <xianglei.cai@intel.com>; devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Gao,
> Liming <gaoliming@byosoft.com.cn>; Shih, More <more.shih@intel.com>;
> Huang, Jenny <jenny.huang@intel.com>
> Subject: Re: [edk2-devel] [PATCH V2 1/1] MdeModulePkg/XhciDxe: Abort the
> Address Device cmd when time out
>
> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
>
> Best Regards,
> Hao Wu
>
> > -----Original Message-----
> > From: Cai, Xianglei <xianglei.cai@intel.com>
> > Sent: Thursday, September 21, 2023 11:58 AM
> > To: devel@edk2.groups.io
> > Cc: Cai, Xianglei <xianglei.cai@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>;
> > Ni, Ray <ray.ni@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Gao,
> > Liming <gaoliming@byosoft.com.cn>; Shih, More <more.shih@intel.com>;
> > Huang, Jenny <jenny.huang@intel.com>
> > Subject: [PATCH V2 1/1] MdeModulePkg/XhciDxe: Abort the Address Device
> > cmd when time out
> >
> > https://bugzilla.tianocore.org/show_bug.cgi?id=4552
> >
> > Following XHCI spec 4.6.1.2, software may abort the
> > execution of Address Device Command when command failed
> > due to timeout.
> >
> > Cc: Hao A Wu <hao.a.wu@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Jian J Wang <jian.j.wang@intel.com>
> > Cc: Liming Gao <gaoliming@byosoft.com.cn>
> > Cc: More Shih <more.shih@intel.com>
> > Cc: Jenny Huang <jenny.huang@intel.com>
> > Signed-off-by: Xianglei Cai <xianglei.cai@intel.com>
> > ---
> > MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 36
> > ++++++++++++++++++++++++
> > 1 file changed, 36 insertions(+)
> >
> > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > index 53421e64a850..f6efcf80f376 100644
> > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> > @@ -2121,6 +2121,26 @@ RingIntTransferDoorBell (
> > return EFI_SUCCESS;
> > }
> >
> > +/**
> > + Set Command abort
> > +
> > + @param Xhc The XHCI Instance.
> > + @param SlotId The slot id to be disabled.
> > +
> > +**/
> > +VOID
> > +XhcCmdRingCmdAbort (
> > + IN USB_XHCI_INSTANCE *Xhc,
> > + IN UINT8 SlotId
> > + )
> > +{
> > + //
> > + // Set XHC_CRCR_CA bit in XHC_CRCR_OFFSET to abort command.
> > + //
> > + DEBUG ((DEBUG_INFO, "Command Ring Control set Command Abort,
> > SlotId: %d\n", SlotId));
> > + XhcSetOpRegBit (Xhc, XHC_CRCR_OFFSET, XHC_CRCR_CA);
> > +}
> > +
> > /**
> > Assign and initialize the device slot for a new device.
> >
> > @@ -2331,6 +2351,14 @@ XhcInitializeDeviceSlot (
> > Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
> > } else {
> > DEBUG ((DEBUG_ERROR, " Slot %d address not assigned successfully.
> > Status = %r\n", SlotId, Status));
> > + //
> > + // Software may abort the execution of Address Device Command when
> > command failed
> > + // due to timeout by following XHCI spec. 4.6.1.2.
> > + //
> > + if (Status == EFI_TIMEOUT) {
> > + XhcCmdRingCmdAbort (Xhc, SlotId);
> > + }
> > +
> > XhcDisableSlotCmd (Xhc, SlotId);
> > }
> >
> > @@ -2547,6 +2575,14 @@ XhcInitializeDeviceSlot64 (
> > Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
> > } else {
> > DEBUG ((DEBUG_ERROR, " Slot %d address not assigned successfully.
> > Status = %r\n", SlotId, Status));
> > + //
> > + // Software may abort the execution of Address Device Command when
> > command failed
> > + // due to timeout by following XHCI spec. 4.6.1.2.
> > + //
> > + if (Status == EFI_TIMEOUT) {
> > + XhcCmdRingCmdAbort (Xhc, SlotId);
> > + }
> > +
> > XhcDisableSlotCmd64 (Xhc, SlotId);
> > }
> >
> > --
> > 2.42.0.windows.2
>
>
>
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#109035): https://edk2.groups.io/g/devel/message/109035
Mute This Topic: https://groups.io/mt/101493909/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-25 4:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1695268645.git.xianglei.cai@intel.com>
2023-09-21 3:57 ` [edk2-devel] [PATCH V2 1/1] MdeModulePkg/XhciDxe: Abort the Address Device cmd when time out Xianglei Cai
2023-09-21 6:16 ` Wu, Hao A
2023-09-25 4:09 ` 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