[edk2] [PATCH] MdeModulePkg/Xhci: Fill the 'interval' field for ISO endpoint context

Hao Wu posted 1 patch 7 years, 7 months ago
Failed in applying to current master (apply log)
MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 30 +++++++++++++++++++++++++++++-
MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 30 +++++++++++++++++++++++++++++-
2 files changed, 58 insertions(+), 2 deletions(-)
[edk2] [PATCH] MdeModulePkg/Xhci: Fill the 'interval' field for ISO endpoint context
Posted by Hao Wu 7 years, 7 months ago
The commit fills the 'Interval' field of the Endpoint Context data for
isochronous endpoints. It will resolve the error when a Configure
Endpoint Command is sent to an isochronous endpoint.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Baranee <anbazhagan@hp.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 30 +++++++++++++++++++++++++++++-
 MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 30 +++++++++++++++++++++++++++++-
 2 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
index 4bec76a85f..58a2f984a9 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
@@ -2,7 +2,7 @@
 
   XHCI transfer scheduling routines.
 
-Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -2661,6 +2661,20 @@ XhcInitializeEndpointContext (
           InputContext->EP[Dci-1].EPType = ED_ISOCH_OUT;
         }
         //
+        // Get the bInterval from descriptor and init the the interval field of endpoint context.
+        // Refer to XHCI 1.1 spec section 6.2.3.6.
+        //
+        if (DeviceSpeed == EFI_USB_SPEED_FULL) {
+          Interval = EpDesc->Interval;
+          ASSERT (Interval >= 1 && Interval <= 16);
+          InputContext->EP[Dci-1].Interval = Interval + 2;
+        } else if ((DeviceSpeed == EFI_USB_SPEED_HIGH) || (DeviceSpeed == EFI_USB_SPEED_SUPER)) {
+          Interval = EpDesc->Interval;
+          ASSERT (Interval >= 1 && Interval <= 16);
+          InputContext->EP[Dci-1].Interval = Interval - 1;
+        }
+
+        //
         // Do not support isochronous transfer now.
         //
         DEBUG ((EFI_D_INFO, "XhcInitializeEndpointContext: Unsupport ISO EP found, Transfer ring is not allocated.\n"));
@@ -2829,6 +2843,20 @@ XhcInitializeEndpointContext64 (
           InputContext->EP[Dci-1].EPType = ED_ISOCH_OUT;
         }
         //
+        // Get the bInterval from descriptor and init the the interval field of endpoint context.
+        // Refer to XHCI 1.1 spec section 6.2.3.6.
+        //
+        if (DeviceSpeed == EFI_USB_SPEED_FULL) {
+          Interval = EpDesc->Interval;
+          ASSERT (Interval >= 1 && Interval <= 16);
+          InputContext->EP[Dci-1].Interval = Interval + 2;
+        } else if ((DeviceSpeed == EFI_USB_SPEED_HIGH) || (DeviceSpeed == EFI_USB_SPEED_SUPER)) {
+          Interval = EpDesc->Interval;
+          ASSERT (Interval >= 1 && Interval <= 16);
+          InputContext->EP[Dci-1].Interval = Interval - 1;
+        }
+
+        //
         // Do not support isochronous transfer now.
         //
         DEBUG ((EFI_D_INFO, "XhcInitializeEndpointContext64: Unsupport ISO EP found, Transfer ring is not allocated.\n"));
diff --git a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
index 7a63dabd8c..3dd2b89097 100644
--- a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
@@ -2,7 +2,7 @@
 PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid
 which is used to enable recovery function from USB Drivers.
 
-Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
 
 This program and the accompanying materials
 are licensed and made available under the terms and conditions
@@ -1750,6 +1750,20 @@ XhcPeiSetConfigCmd (
             InputContext->EP[Dci-1].EPType = ED_ISOCH_OUT;
           }
           //
+          // Get the bInterval from descriptor and init the the interval field of endpoint context.
+          // Refer to XHCI 1.1 spec section 6.2.3.6.
+          //
+          if (DeviceSpeed == EFI_USB_SPEED_FULL) {
+            Interval = EpDesc->Interval;
+            ASSERT (Interval >= 1 && Interval <= 16);
+            InputContext->EP[Dci-1].Interval = Interval + 2;
+          } else if ((DeviceSpeed == EFI_USB_SPEED_HIGH) || (DeviceSpeed == EFI_USB_SPEED_SUPER)) {
+            Interval = EpDesc->Interval;
+            ASSERT (Interval >= 1 && Interval <= 16);
+            InputContext->EP[Dci-1].Interval = Interval - 1;
+          }
+
+          //
           // Do not support isochronous transfer now.
           //
           DEBUG ((EFI_D_INFO, "XhcPeiSetConfigCmd: Unsupport ISO EP found, Transfer ring is not allocated.\n"));
@@ -1953,6 +1967,20 @@ XhcPeiSetConfigCmd64 (
             InputContext->EP[Dci-1].EPType = ED_ISOCH_OUT;
           }
           //
+          // Get the bInterval from descriptor and init the the interval field of endpoint context.
+          // Refer to XHCI 1.1 spec section 6.2.3.6.
+          //
+          if (DeviceSpeed == EFI_USB_SPEED_FULL) {
+            Interval = EpDesc->Interval;
+            ASSERT (Interval >= 1 && Interval <= 16);
+            InputContext->EP[Dci-1].Interval = Interval + 2;
+          } else if ((DeviceSpeed == EFI_USB_SPEED_HIGH) || (DeviceSpeed == EFI_USB_SPEED_SUPER)) {
+            Interval = EpDesc->Interval;
+            ASSERT (Interval >= 1 && Interval <= 16);
+            InputContext->EP[Dci-1].Interval = Interval - 1;
+          }
+
+          //
           // Do not support isochronous transfer now.
           //
           DEBUG ((EFI_D_INFO, "XhcPeiSetConfigCmd64: Unsupport ISO EP found, Transfer ring is not allocated.\n"));
-- 
2.12.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] MdeModulePkg/Xhci: Fill the 'interval' field for ISO endpoint context
Posted by Zeng, Star 7 years, 7 months ago
Reviewed-by: Star Zeng <star.zeng@intel.com>

BTW: Could you add the reference to the bugzilla link in the commit log?


Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Hao Wu
Sent: Wednesday, May 31, 2017 9:48 AM
To: edk2-devel@lists.01.org
Cc: Wu, Hao A <hao.a.wu@intel.com>; Baranee <anbazhagan@hp.com>; Zeng, Star <star.zeng@intel.com>
Subject: [edk2] [PATCH] MdeModulePkg/Xhci: Fill the 'interval' field for ISO endpoint context

The commit fills the 'Interval' field of the Endpoint Context data for isochronous endpoints. It will resolve the error when a Configure Endpoint Command is sent to an isochronous endpoint.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Baranee <anbazhagan@hp.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 30 +++++++++++++++++++++++++++++-  MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 30 +++++++++++++++++++++++++++++-
 2 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
index 4bec76a85f..58a2f984a9 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
@@ -2,7 +2,7 @@
 
   XHCI transfer scheduling routines.
 
-Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials  are licensed and made available under the terms and conditions of the BSD License  which accompanies this distribution.  The full text of the license may be found at @@ -2661,6 +2661,20 @@ XhcInitializeEndpointContext (
           InputContext->EP[Dci-1].EPType = ED_ISOCH_OUT;
         }
         //
+        // Get the bInterval from descriptor and init the the interval field of endpoint context.
+        // Refer to XHCI 1.1 spec section 6.2.3.6.
+        //
+        if (DeviceSpeed == EFI_USB_SPEED_FULL) {
+          Interval = EpDesc->Interval;
+          ASSERT (Interval >= 1 && Interval <= 16);
+          InputContext->EP[Dci-1].Interval = Interval + 2;
+        } else if ((DeviceSpeed == EFI_USB_SPEED_HIGH) || (DeviceSpeed == EFI_USB_SPEED_SUPER)) {
+          Interval = EpDesc->Interval;
+          ASSERT (Interval >= 1 && Interval <= 16);
+          InputContext->EP[Dci-1].Interval = Interval - 1;
+        }
+
+        //
         // Do not support isochronous transfer now.
         //
         DEBUG ((EFI_D_INFO, "XhcInitializeEndpointContext: Unsupport ISO EP found, Transfer ring is not allocated.\n")); @@ -2829,6 +2843,20 @@ XhcInitializeEndpointContext64 (
           InputContext->EP[Dci-1].EPType = ED_ISOCH_OUT;
         }
         //
+        // Get the bInterval from descriptor and init the the interval field of endpoint context.
+        // Refer to XHCI 1.1 spec section 6.2.3.6.
+        //
+        if (DeviceSpeed == EFI_USB_SPEED_FULL) {
+          Interval = EpDesc->Interval;
+          ASSERT (Interval >= 1 && Interval <= 16);
+          InputContext->EP[Dci-1].Interval = Interval + 2;
+        } else if ((DeviceSpeed == EFI_USB_SPEED_HIGH) || (DeviceSpeed == EFI_USB_SPEED_SUPER)) {
+          Interval = EpDesc->Interval;
+          ASSERT (Interval >= 1 && Interval <= 16);
+          InputContext->EP[Dci-1].Interval = Interval - 1;
+        }
+
+        //
         // Do not support isochronous transfer now.
         //
         DEBUG ((EFI_D_INFO, "XhcInitializeEndpointContext64: Unsupport ISO EP found, Transfer ring is not allocated.\n")); diff --git a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
index 7a63dabd8c..3dd2b89097 100644
--- a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
@@ -2,7 +2,7 @@
 PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid  which is used to enable recovery function from USB Drivers.
 
-Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
 
 This program and the accompanying materials  are licensed and made available under the terms and conditions @@ -1750,6 +1750,20 @@ XhcPeiSetConfigCmd (
             InputContext->EP[Dci-1].EPType = ED_ISOCH_OUT;
           }
           //
+          // Get the bInterval from descriptor and init the the interval field of endpoint context.
+          // Refer to XHCI 1.1 spec section 6.2.3.6.
+          //
+          if (DeviceSpeed == EFI_USB_SPEED_FULL) {
+            Interval = EpDesc->Interval;
+            ASSERT (Interval >= 1 && Interval <= 16);
+            InputContext->EP[Dci-1].Interval = Interval + 2;
+          } else if ((DeviceSpeed == EFI_USB_SPEED_HIGH) || (DeviceSpeed == EFI_USB_SPEED_SUPER)) {
+            Interval = EpDesc->Interval;
+            ASSERT (Interval >= 1 && Interval <= 16);
+            InputContext->EP[Dci-1].Interval = Interval - 1;
+          }
+
+          //
           // Do not support isochronous transfer now.
           //
           DEBUG ((EFI_D_INFO, "XhcPeiSetConfigCmd: Unsupport ISO EP found, Transfer ring is not allocated.\n")); @@ -1953,6 +1967,20 @@ XhcPeiSetConfigCmd64 (
             InputContext->EP[Dci-1].EPType = ED_ISOCH_OUT;
           }
           //
+          // Get the bInterval from descriptor and init the the interval field of endpoint context.
+          // Refer to XHCI 1.1 spec section 6.2.3.6.
+          //
+          if (DeviceSpeed == EFI_USB_SPEED_FULL) {
+            Interval = EpDesc->Interval;
+            ASSERT (Interval >= 1 && Interval <= 16);
+            InputContext->EP[Dci-1].Interval = Interval + 2;
+          } else if ((DeviceSpeed == EFI_USB_SPEED_HIGH) || (DeviceSpeed == EFI_USB_SPEED_SUPER)) {
+            Interval = EpDesc->Interval;
+            ASSERT (Interval >= 1 && Interval <= 16);
+            InputContext->EP[Dci-1].Interval = Interval - 1;
+          }
+
+          //
           // Do not support isochronous transfer now.
           //
           DEBUG ((EFI_D_INFO, "XhcPeiSetConfigCmd64: Unsupport ISO EP found, Transfer ring is not allocated.\n"));
--
2.12.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] MdeModulePkg/Xhci: Fill the 'interval' field for ISO endpoint context
Posted by Wu, Hao A 7 years, 7 months ago
> -----Original Message-----
> From: Zeng, Star
> Sent: Wednesday, May 31, 2017 11:27 AM
> To: Wu, Hao A; edk2-devel@lists.01.org
> Cc: Wu, Hao A; Baranee; Zeng, Star
> Subject: RE: [edk2] [PATCH] MdeModulePkg/Xhci: Fill the 'interval' field for ISO
> endpoint context
> 
> Reviewed-by: Star Zeng <star.zeng@intel.com>
> 
> BTW: Could you add the reference to the bugzilla link in the commit log?

Yes, I will modify the commit message to include the info.

Best Regards,
Hao Wu

> 
> 
> Thanks,
> Star
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Hao
> Wu
> Sent: Wednesday, May 31, 2017 9:48 AM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Baranee <anbazhagan@hp.com>; Zeng,
> Star <star.zeng@intel.com>
> Subject: [edk2] [PATCH] MdeModulePkg/Xhci: Fill the 'interval' field for ISO
> endpoint context
> 
> The commit fills the 'Interval' field of the Endpoint Context data for isochronous
> endpoints. It will resolve the error when a Configure Endpoint Command is sent
> to an isochronous endpoint.
> 
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Baranee <anbazhagan@hp.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 30
> +++++++++++++++++++++++++++++-
> MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 30
> +++++++++++++++++++++++++++++-
>  2 files changed, 58 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> index 4bec76a85f..58a2f984a9 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
> @@ -2,7 +2,7 @@
> 
>    XHCI transfer scheduling routines.
> 
> -Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>
>  This program and the accompanying materials  are licensed and made
> available under the terms and conditions of the BSD License  which
> accompanies this distribution.  The full text of the license may be found at @@
> -2661,6 +2661,20 @@ XhcInitializeEndpointContext (
>            InputContext->EP[Dci-1].EPType = ED_ISOCH_OUT;
>          }
>          //
> +        // Get the bInterval from descriptor and init the the interval field of
> endpoint context.
> +        // Refer to XHCI 1.1 spec section 6.2.3.6.
> +        //
> +        if (DeviceSpeed == EFI_USB_SPEED_FULL) {
> +          Interval = EpDesc->Interval;
> +          ASSERT (Interval >= 1 && Interval <= 16);
> +          InputContext->EP[Dci-1].Interval = Interval + 2;
> +        } else if ((DeviceSpeed == EFI_USB_SPEED_HIGH) || (DeviceSpeed ==
> EFI_USB_SPEED_SUPER)) {
> +          Interval = EpDesc->Interval;
> +          ASSERT (Interval >= 1 && Interval <= 16);
> +          InputContext->EP[Dci-1].Interval = Interval - 1;
> +        }
> +
> +        //
>          // Do not support isochronous transfer now.
>          //
>          DEBUG ((EFI_D_INFO, "XhcInitializeEndpointContext: Unsupport ISO EP
> found, Transfer ring is not allocated.\n")); @@ -2829,6 +2843,20 @@
> XhcInitializeEndpointContext64 (
>            InputContext->EP[Dci-1].EPType = ED_ISOCH_OUT;
>          }
>          //
> +        // Get the bInterval from descriptor and init the the interval field of
> endpoint context.
> +        // Refer to XHCI 1.1 spec section 6.2.3.6.
> +        //
> +        if (DeviceSpeed == EFI_USB_SPEED_FULL) {
> +          Interval = EpDesc->Interval;
> +          ASSERT (Interval >= 1 && Interval <= 16);
> +          InputContext->EP[Dci-1].Interval = Interval + 2;
> +        } else if ((DeviceSpeed == EFI_USB_SPEED_HIGH) || (DeviceSpeed ==
> EFI_USB_SPEED_SUPER)) {
> +          Interval = EpDesc->Interval;
> +          ASSERT (Interval >= 1 && Interval <= 16);
> +          InputContext->EP[Dci-1].Interval = Interval - 1;
> +        }
> +
> +        //
>          // Do not support isochronous transfer now.
>          //
>          DEBUG ((EFI_D_INFO, "XhcInitializeEndpointContext64: Unsupport ISO EP
> found, Transfer ring is not allocated.\n")); diff --git
> a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> index 7a63dabd8c..3dd2b89097 100644
> --- a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> +++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c
> @@ -2,7 +2,7 @@
>  PEIM to produce gPeiUsb2HostControllerPpiGuid based on
> gPeiUsbControllerPpiGuid  which is used to enable recovery function from USB
> Drivers.
> 
> -Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
> 
>  This program and the accompanying materials  are licensed and made
> available under the terms and conditions @@ -1750,6 +1750,20 @@
> XhcPeiSetConfigCmd (
>              InputContext->EP[Dci-1].EPType = ED_ISOCH_OUT;
>            }
>            //
> +          // Get the bInterval from descriptor and init the the interval field of
> endpoint context.
> +          // Refer to XHCI 1.1 spec section 6.2.3.6.
> +          //
> +          if (DeviceSpeed == EFI_USB_SPEED_FULL) {
> +            Interval = EpDesc->Interval;
> +            ASSERT (Interval >= 1 && Interval <= 16);
> +            InputContext->EP[Dci-1].Interval = Interval + 2;
> +          } else if ((DeviceSpeed == EFI_USB_SPEED_HIGH) || (DeviceSpeed ==
> EFI_USB_SPEED_SUPER)) {
> +            Interval = EpDesc->Interval;
> +            ASSERT (Interval >= 1 && Interval <= 16);
> +            InputContext->EP[Dci-1].Interval = Interval - 1;
> +          }
> +
> +          //
>            // Do not support isochronous transfer now.
>            //
>            DEBUG ((EFI_D_INFO, "XhcPeiSetConfigCmd: Unsupport ISO EP found,
> Transfer ring is not allocated.\n")); @@ -1953,6 +1967,20 @@
> XhcPeiSetConfigCmd64 (
>              InputContext->EP[Dci-1].EPType = ED_ISOCH_OUT;
>            }
>            //
> +          // Get the bInterval from descriptor and init the the interval field of
> endpoint context.
> +          // Refer to XHCI 1.1 spec section 6.2.3.6.
> +          //
> +          if (DeviceSpeed == EFI_USB_SPEED_FULL) {
> +            Interval = EpDesc->Interval;
> +            ASSERT (Interval >= 1 && Interval <= 16);
> +            InputContext->EP[Dci-1].Interval = Interval + 2;
> +          } else if ((DeviceSpeed == EFI_USB_SPEED_HIGH) || (DeviceSpeed ==
> EFI_USB_SPEED_SUPER)) {
> +            Interval = EpDesc->Interval;
> +            ASSERT (Interval >= 1 && Interval <= 16);
> +            InputContext->EP[Dci-1].Interval = Interval - 1;
> +          }
> +
> +          //
>            // Do not support isochronous transfer now.
>            //
>            DEBUG ((EFI_D_INFO, "XhcPeiSetConfigCmd64: Unsupport ISO EP found,
> Transfer ring is not allocated.\n"));
> --
> 2.12.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel