public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the port if status change returns an error
@ 2022-12-21  8:15 Sean Rhodes
  2022-12-23  8:56 ` [edk2-devel] " Wu, Hao A
  0 siblings, 1 reply; 5+ messages in thread
From: Sean Rhodes @ 2022-12-21  8:15 UTC (permalink / raw)
  To: devel; +Cc: Sean Rhodes

Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in PortChangeStatus
when XhcPollPortStatusChange fails

Signed-off-by: Sean Rhodes <sean@starlabs.systems>
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
index 461b2cd9b5..d8fa41f68f 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
@@ -471,7 +471,16 @@ XhcGetRootHubPortStatus (
   // For those devices behind hub, we get its attach/detach event by hooking Get_Port_Status request at control transfer for those hub.
   //
   ParentRouteChart.Dword = 0;
-  XhcPollPortStatusChange (Xhc, ParentRouteChart, PortNumber, PortStatus);
+  Status                 = XhcPollPortStatusChange (Xhc, ParentRouteChart, PortNumber, PortStatus);
+
+  //
+  // Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in PortChangeStatus
+  // when XhcPollPortStatusChange fails
+  //
+  if (EFI_ERROR (Status)) {
+    PortStatus->PortChangeStatus &= ~(USB_PORT_STAT_C_RESET);
+    Status                        = EFI_SUCCESS;
+  }
 
 ON_EXIT:
   gBS->RestoreTPL (OldTpl);
-- 
2.37.2


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

* Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the port if status change returns an error
  2022-12-21  8:15 [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the port if status change returns an error Sean Rhodes
@ 2022-12-23  8:56 ` Wu, Hao A
  2022-12-23 10:22   ` Sean Rhodes
  0 siblings, 1 reply; 5+ messages in thread
From: Wu, Hao A @ 2022-12-23  8:56 UTC (permalink / raw)
  To: devel@edk2.groups.io, Rhodes, Sean

Sorry,

The CI tests failed for the proposed patch:
https://github.com/tianocore/edk2/pull/3824

Could you help to check and resolve? Thanks.

Best Regards,
Hao Wu

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sean
> Rhodes
> Sent: Wednesday, December 21, 2022 4:15 PM
> To: devel@edk2.groups.io
> Cc: Rhodes, Sean <sean@starlabs.systems>
> Subject: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the
> port if status change returns an error
> 
> Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in
> PortChangeStatus
> when XhcPollPortStatusChange fails
> 
> Signed-off-by: Sean Rhodes <sean@starlabs.systems>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> index 461b2cd9b5..d8fa41f68f 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> @@ -471,7 +471,16 @@ XhcGetRootHubPortStatus (
>    // For those devices behind hub, we get its attach/detach event by hooking
> Get_Port_Status request at control transfer for those hub.
> 
>    //
> 
>    ParentRouteChart.Dword = 0;
> 
> -  XhcPollPortStatusChange (Xhc, ParentRouteChart, PortNumber, PortStatus);
> 
> +  Status                 = XhcPollPortStatusChange (Xhc, ParentRouteChart,
> PortNumber, PortStatus);
> 
> +
> 
> +  //
> 
> +  // Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in
> PortChangeStatus
> 
> +  // when XhcPollPortStatusChange fails
> 
> +  //
> 
> +  if (EFI_ERROR (Status)) {
> 
> +    PortStatus->PortChangeStatus &= ~(USB_PORT_STAT_C_RESET);
> 
> +    Status                        = EFI_SUCCESS;
> 
> +  }
> 
> 
> 
>  ON_EXIT:
> 
>    gBS->RestoreTPL (OldTpl);
> 
> --
> 2.37.2
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#97683): https://edk2.groups.io/g/devel/message/97683
> Mute This Topic: https://groups.io/mt/95802798/1768737
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu@intel.com]
> -=-=-=-=-=-=
> 


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

* Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the port if status change returns an error
  2022-12-23  8:56 ` [edk2-devel] " Wu, Hao A
@ 2022-12-23 10:22   ` Sean Rhodes
  2023-01-03  1:24     ` Wu, Hao A
  0 siblings, 1 reply; 5+ messages in thread
From: Sean Rhodes @ 2022-12-23 10:22 UTC (permalink / raw)
  To: devel, hao.a.wu

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

Hi Hao

This PR has passed CI - https://github.com/tianocore/edk2/pull/3353

Thanks

Sean

On Fri, 23 Dec 2022 at 08:56, Wu, Hao A <hao.a.wu@intel.com> wrote:

> Sorry,
>
> The CI tests failed for the proposed patch:
> https://github.com/tianocore/edk2/pull/3824
>
> Could you help to check and resolve? Thanks.
>
> Best Regards,
> Hao Wu
>
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sean
> > Rhodes
> > Sent: Wednesday, December 21, 2022 4:15 PM
> > To: devel@edk2.groups.io
> > Cc: Rhodes, Sean <sean@starlabs.systems>
> > Subject: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the
> > port if status change returns an error
> >
> > Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in
> > PortChangeStatus
> > when XhcPollPortStatusChange fails
> >
> > Signed-off-by: Sean Rhodes <sean@starlabs.systems>
> > ---
> >  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> > b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> > index 461b2cd9b5..d8fa41f68f 100644
> > --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> > @@ -471,7 +471,16 @@ XhcGetRootHubPortStatus (
> >    // For those devices behind hub, we get its attach/detach event by
> hooking
> > Get_Port_Status request at control transfer for those hub.
> >
> >    //
> >
> >    ParentRouteChart.Dword = 0;
> >
> > -  XhcPollPortStatusChange (Xhc, ParentRouteChart, PortNumber,
> PortStatus);
> >
> > +  Status                 = XhcPollPortStatusChange (Xhc,
> ParentRouteChart,
> > PortNumber, PortStatus);
> >
> > +
> >
> > +  //
> >
> > +  // Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit
> in
> > PortChangeStatus
> >
> > +  // when XhcPollPortStatusChange fails
> >
> > +  //
> >
> > +  if (EFI_ERROR (Status)) {
> >
> > +    PortStatus->PortChangeStatus &= ~(USB_PORT_STAT_C_RESET);
> >
> > +    Status                        = EFI_SUCCESS;
> >
> > +  }
> >
> >
> >
> >  ON_EXIT:
> >
> >    gBS->RestoreTPL (OldTpl);
> >
> > --
> > 2.37.2
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#97683): https://edk2.groups.io/g/devel/message/97683
> > Mute This Topic: https://groups.io/mt/95802798/1768737
> > Group Owner: devel+owner@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu@intel.com]
> > -=-=-=-=-=-=
> >
>
>
>
> 
>
>
>

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

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

* Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the port if status change returns an error
  2022-12-23 10:22   ` Sean Rhodes
@ 2023-01-03  1:24     ` Wu, Hao A
  2023-01-04  4:01       ` Wu, Hao A
  0 siblings, 1 reply; 5+ messages in thread
From: Wu, Hao A @ 2023-01-03  1:24 UTC (permalink / raw)
  To: Rhodes, Sean, devel@edk2.groups.io

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

Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Best Regards,
Hao Wu

From: Sean Rhodes <sean@starlabs.systems>
Sent: Friday, December 23, 2022 6:22 PM
To: devel@edk2.groups.io; Wu, Hao A <hao.a.wu@intel.com>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the port if status change returns an error

Hi Hao

This PR has passed CI - https://github.com/tianocore/edk2/pull/3353

Thanks

Sean

On Fri, 23 Dec 2022 at 08:56, Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>> wrote:
Sorry,

The CI tests failed for the proposed patch:
https://github.com/tianocore/edk2/pull/3824

Could you help to check and resolve? Thanks.

Best Regards,
Hao Wu

> -----Original Message-----
> From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Sean
> Rhodes
> Sent: Wednesday, December 21, 2022 4:15 PM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
> Cc: Rhodes, Sean <sean@starlabs.systems<mailto:sean@starlabs.systems>>
> Subject: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the
> port if status change returns an error
>
> Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in
> PortChangeStatus
> when XhcPollPortStatusChange fails
>
> Signed-off-by: Sean Rhodes <sean@starlabs.systems<mailto:sean@starlabs.systems>>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> index 461b2cd9b5..d8fa41f68f 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> @@ -471,7 +471,16 @@ XhcGetRootHubPortStatus (
>    // For those devices behind hub, we get its attach/detach event by hooking
> Get_Port_Status request at control transfer for those hub.
>
>    //
>
>    ParentRouteChart.Dword = 0;
>
> -  XhcPollPortStatusChange (Xhc, ParentRouteChart, PortNumber, PortStatus);
>
> +  Status                 = XhcPollPortStatusChange (Xhc, ParentRouteChart,
> PortNumber, PortStatus);
>
> +
>
> +  //
>
> +  // Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in
> PortChangeStatus
>
> +  // when XhcPollPortStatusChange fails
>
> +  //
>
> +  if (EFI_ERROR (Status)) {
>
> +    PortStatus->PortChangeStatus &= ~(USB_PORT_STAT_C_RESET);
>
> +    Status                        = EFI_SUCCESS;
>
> +  }
>
>
>
>  ON_EXIT:
>
>    gBS->RestoreTPL (OldTpl);
>
> --
> 2.37.2
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#97683): https://edk2.groups.io/g/devel/message/97683
> Mute This Topic: https://groups.io/mt/95802798/1768737
> Group Owner: devel+owner@edk2.groups.io<mailto:devel%2Bowner@edk2.groups.io>
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>]
> -=-=-=-=-=-=
>






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

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

* Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the port if status change returns an error
  2023-01-03  1:24     ` Wu, Hao A
@ 2023-01-04  4:01       ` Wu, Hao A
  0 siblings, 0 replies; 5+ messages in thread
From: Wu, Hao A @ 2023-01-04  4:01 UTC (permalink / raw)
  To: devel@edk2.groups.io, Wu, Hao A, Rhodes, Sean

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

Pushed via:
PR - https://github.com/tianocore/edk2/pull/3848
Commit  - https://github.com/tianocore/edk2/commit/992d5451d19b93635d52db293bab680e32142776

Best Regards,
Hao Wu

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, Hao A
Sent: Tuesday, January 3, 2023 9:25 AM
To: Rhodes, Sean <sean@starlabs.systems>; devel@edk2.groups.io
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the port if status change returns an error

Reviewed-by: Hao A Wu <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>

Best Regards,
Hao Wu

From: Sean Rhodes <sean@starlabs.systems<mailto:sean@starlabs.systems>>
Sent: Friday, December 23, 2022 6:22 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the port if status change returns an error

Hi Hao

This PR has passed CI - https://github.com/tianocore/edk2/pull/3353

Thanks

Sean

On Fri, 23 Dec 2022 at 08:56, Wu, Hao A <hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>> wrote:
Sorry,

The CI tests failed for the proposed patch:
https://github.com/tianocore/edk2/pull/3824

Could you help to check and resolve? Thanks.

Best Regards,
Hao Wu

> -----Original Message-----
> From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Sean
> Rhodes
> Sent: Wednesday, December 21, 2022 4:15 PM
> To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
> Cc: Rhodes, Sean <sean@starlabs.systems<mailto:sean@starlabs.systems>>
> Subject: [edk2-devel] [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the
> port if status change returns an error
>
> Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in
> PortChangeStatus
> when XhcPollPortStatusChange fails
>
> Signed-off-by: Sean Rhodes <sean@starlabs.systems<mailto:sean@starlabs.systems>>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> index 461b2cd9b5..d8fa41f68f 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> @@ -471,7 +471,16 @@ XhcGetRootHubPortStatus (
>    // For those devices behind hub, we get its attach/detach event by hooking
> Get_Port_Status request at control transfer for those hub.
>
>    //
>
>    ParentRouteChart.Dword = 0;
>
> -  XhcPollPortStatusChange (Xhc, ParentRouteChart, PortNumber, PortStatus);
>
> +  Status                 = XhcPollPortStatusChange (Xhc, ParentRouteChart,
> PortNumber, PortStatus);
>
> +
>
> +  //
>
> +  // Force resetting the port by clearing the USB_PORT_STAT_C_RESET bit in
> PortChangeStatus
>
> +  // when XhcPollPortStatusChange fails
>
> +  //
>
> +  if (EFI_ERROR (Status)) {
>
> +    PortStatus->PortChangeStatus &= ~(USB_PORT_STAT_C_RESET);
>
> +    Status                        = EFI_SUCCESS;
>
> +  }
>
>
>
>  ON_EXIT:
>
>    gBS->RestoreTPL (OldTpl);
>
> --
> 2.37.2
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#97683): https://edk2.groups.io/g/devel/message/97683
> Mute This Topic: https://groups.io/mt/95802798/1768737
> Group Owner: devel+owner@edk2.groups.io<mailto:devel%2Bowner@edk2.groups.io>
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu@intel.com<mailto:hao.a.wu@intel.com>]
> -=-=-=-=-=-=
>






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

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

end of thread, other threads:[~2023-01-04  4:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-21  8:15 [PATCH] MdeModulePkg/Bus/Pci/XhciDxe: Reset the port if status change returns an error Sean Rhodes
2022-12-23  8:56 ` [edk2-devel] " Wu, Hao A
2022-12-23 10:22   ` Sean Rhodes
2023-01-03  1:24     ` Wu, Hao A
2023-01-04  4:01       ` 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