From: Edward Shao Date: Wed, 10 Feb 2010 19:37:30 +0000 (+0800) Subject: USB: xhci: Fix finding extended capabilities registers X-Git-Tag: v2.6.32.10~29 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=bbb4ae3e0220f07cc88eb7398d7742add03542f1;p=karo-tx-linux.git USB: xhci: Fix finding extended capabilities registers commit 05197921ff3dad52d99fd1647974c57d9c28d40e upstream. According "5.3.6 Capability Parameters (HCCPARAMS)" of xHCI rev0.96 spec, value of xECP register indicates a relative offset, in 32-bit words, from Base to the beginning of the first extended capability. The wrong calculation will cause BIOS handoff fail (not handoff from BIOS) in some platform with BIOS USB legacy sup support. Signed-off-by: Edward Shao Cc: Sarah Sharp Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/host/xhci-ext-caps.h b/drivers/usb/host/xhci-ext-caps.h index ecc131c3fe33..78c4edac1db1 100644 --- a/drivers/usb/host/xhci-ext-caps.h +++ b/drivers/usb/host/xhci-ext-caps.h @@ -101,12 +101,15 @@ static inline int xhci_find_next_cap_offset(void __iomem *base, int ext_offset) next = readl(base + ext_offset); - if (ext_offset == XHCI_HCC_PARAMS_OFFSET) + if (ext_offset == XHCI_HCC_PARAMS_OFFSET) { /* Find the first extended capability */ next = XHCI_HCC_EXT_CAPS(next); - else + ext_offset = 0; + } else { /* Find the next extended capability */ next = XHCI_EXT_CAPS_NEXT(next); + } + if (!next) return 0; /*