Reviewed-by: Star Zeng <[email protected]> -----Original Message----- From: Tian, Feng Sent: Friday, April 8, 2016 1:48 PM To: [email protected] Cc: Zeng, Star <[email protected]> Subject: [patch] MdeModulePkg/Usb: Fix wrong condition judgment to support usb3.1 dev
The bcdUSB value of usb3.1 is 0x0310, we update the condition judgment to get correct max packet size for usb3.1 dev. Cc: Star Zeng <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <[email protected]> --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 4 ++-- MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c | 4 ++-- MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c | 4 ++-- MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index 39c28ab..4798bea 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -1,7 +1,7 @@ /** @file The XHCI controller driver. -Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2011 - 2016, 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 @@ -955,7 +955,7 @@ XhcControlTransfer ( // Store a copy of device scriptor as hub device need this info to configure endpoint. // CopyMem (&Xhc->UsbDevContext[SlotId].DevDesc, Data, *DataLength); - if (Xhc->UsbDevContext[SlotId].DevDesc.BcdUSB == 0x0300) { + if (Xhc->UsbDevContext[SlotId].DevDesc.BcdUSB >= 0x0300) { // // If it's a usb3.0 device, then its max packet size is a 2^n. // diff --git a/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c b/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c index eaea38d..a58739f 100644 --- a/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c +++ b/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.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 - 2015, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions @@ -687,7 +687,7 @@ XhcPeiControlTransfer ( // Store a copy of device scriptor as hub device need this info to configure endpoint. // CopyMem (&Xhc->UsbDevContext[SlotId].DevDesc, Data, *DataLength); - if (Xhc->UsbDevContext[SlotId].DevDesc.BcdUSB == 0x0300) { + if (Xhc->UsbDevContext[SlotId].DevDesc.BcdUSB >= 0x0300) { // // If it's a usb3.0 device, then its max packet size is a 2^n. // diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c index 9687eb0..5b8b1aa 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c @@ -2,7 +2,7 @@ Manage Usb Descriptor List -Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2007 - 2016, 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 @@ -539,7 +539,7 @@ UsbGetMaxPacketSize0 ( Status = UsbCtrlGetDesc (UsbDev, USB_DESC_TYPE_DEVICE, 0, 0, &DevDesc, 8); if (!EFI_ERROR (Status)) { - if ((DevDesc.BcdUSB == 0x0300) && (DevDesc.MaxPacketSize0 == 9)) { + if ((DevDesc.BcdUSB >= 0x0300) && (DevDesc.MaxPacketSize0 == 9)) + { UsbDev->MaxPacket0 = 1 << 9; return EFI_SUCCESS; } diff --git a/MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.c b/MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.c index f350021..a4bb4d7 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.c +++ b/MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.c @@ -1,7 +1,7 @@ /** @file The module to produce Usb Bus PPI. -Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> +Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions @@ -702,7 +702,7 @@ PeiConfigureUsbDevice ( return Status; } - if ((DeviceDescriptor.BcdUSB == 0x0300) && (DeviceDescriptor.MaxPacketSize0 == 9)) { + if ((DeviceDescriptor.BcdUSB >= 0x0300) && + (DeviceDescriptor.MaxPacketSize0 == 9)) { PeiUsbDevice->MaxPacketSize0 = 1 << 9; } else { PeiUsbDevice->MaxPacketSize0 = DeviceDescriptor.MaxPacketSize0; -- 2.7.1.windows.2 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

