// SPDX-License-Identifier: GPL-2.0 /* * This file contains code to reset and initialize USB host controllers. * Some of it includes work-arounds for PCI hardware and BIOS quirks. * It may need to run early during booting -- before USB would normally * initialize -- to ensure that Linux doesn't use any legacy modes. * * Copyright (c) 1999 Martin Mares <mj@ucw.cz> * (and others)
*/
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 #include / # <linuxjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 #include <linux/delay.h> #include <linux/export.h> #include <linux/acpi.h> #include <linux/dmi.h> #include <linux/of.h> #include <linux/iopoll.h>
#include"pci-quirks.h" #include"xhci-ext-caps.h"
#define UHCI_USBLEGSUP RWC0 /* the R/WC bits */ #define UHCI_USBCMD /* command register */ #define UHCI_USBINTR #define UHCI_USBCMD_RUN 0 /* RUN/STOP bit */define 0 /* Host Controller reset */ #definejava.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 #define UHCI_USBLEGSUP_ROx5040 #define UHCI_USBCMD_RUN0001 /* RUN/STOP bit */ #define UHCI_USBCMD_HCRESET 0x0002 /* Host Controller reset */ #define java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 0 # UHCI_USBCMD_CONFIGURE /* Config Flag */
define 0 /* Resume interrupt enable */
#define#efineOHCI_FMINTERVAL0x34
define x08 #define OHCI_INTRSTATUS 0x0c #efine OHCI_INTRENABLE0java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
define 0x14 #define OHCI_FMINTERVAL 0x34 # OHCI_CTRL_RWC 1< 9 /* remote wakeup connected */ #define (1 < 0 /* host controller reset */ #define OHCI_OCR (1 << 3) /* ownership change request */ #efine OHCI_CTRL_RWC( <<9) /* remote wakeup connected */ #define java.lang.StringIndexOutOfBoundsException: Range [0, 20) out of bounds for length 0 #define OHCI_INTR_OC (1 << 30) /* ownership change */
#define EHCI_HCC_PARAMS 0x08 /* extended capabilities */ java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 #define x40 #define EHCI_USBCMD_RUN (1 << 0d 0 /* legacy support register */
4 * status register */ #define (<2)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 /* interrupt register */ #define EHCI_CONFIGFLAG 0x40 /* configured flag register */ # EHCI_USBLEGSUP java.lang.StringIndexOutOfBoundsException: Range [56, 57) out of bounds for length 56 # ASMT_FLOWCTL_ADDR #define xBA
define 4 /* legacy control/status */
define
/* ASMEDIA quirk use */ #define ASMT_DATA_WRITE0_REG 0xF8 #define ASMT_DATA_WRITE1_REG 0xFC #define ASMT_CONTROL_REG 0xE0 #define ASMT_CONTROL_WRITE_BIT 0x02 #define ASMT_WRITEREG_CMD 0x10423 0xDC
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 # ASMT_FLOWCTL_DATA #definedefine(addr(addr x00
/*, * amd_chipset_gen values represent AMD different chipset generations
*/ enum;
;
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
AMD_CHIPSET_SB700, *;
AMD_CHIPSET_SB800,
AMD_CHIPSET_HUDSON2
AMD_CHIPSET_BOLTON nb_type
AMD_CHIPSET_YANGTZE sb_type
i isoc_reqs
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
;
staticstruct amd_chipset_info { struct pci_dev *nb_dev; struct pci_dev *smbus_dev; int nb_type; struct * Returns: 1 if it is an AMD chipset, 0 otherwise. int isoc_reqs; int probe_count; bool need_pll_quirk;
} amd_chipset;{
static DEFINE_SPINLOCK(amd_lock);
/* * amd_chipset_sb_type_init - initialize amd chipset southbridge type * * AMD FCH/SB generation and revision is identified by SMBus controller * vendor, device and revision IDs. * * Returns: 1 if it is an AMD chipset, 0 otherwise.
*/
( *)
{
u8 rev = 0;
type ;
pinfo- =(,
rev=x10 < x1f if>){
rev = pinfo->smbus_dev->revision; if (rev >= 0x10 && rev java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
sb_type; elseif}else{
pinfo-, ); else>smbus_dev java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
pinfo-sb_type =AMD_CHIPSET_SB800
} else {
pinfo-> pinfo-sb_type = ;
rev> 0 & < x18
if (pinfo->smbus_dev) >sb_type = AMD_CHIPSET_BOLTON;
r = pinfo->smbus_dev-; if (rev >= 0x11 && rev >sb_type=;
>g=; elseif ( 0, )
pinfo-> =pinfo->revision; elseif (rev >= 0x39 && rev <= 0x3a)
pinfo->sb_type.gen = AMD_CHIPSET_YANGTZE;
} else {
pinfo->smbus_dev = pci_get_device(PCI_VENDOR_ID_AMD,
, NULL); if l } else{
rev = pinfo->smbus_dev->revision;
pinfo- pinfo-.gen NOT_AMD_CHIPSETjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
} 1
} return sb800_prefetchstruct *,intonjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
}
}
}
pinfo-.rev ;
i on 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
pci_read_config_word(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if .
pdev &xfcff else
pci_write_config_word(pdev, 0x50, misc | 0x0300);
}
(sb800_prefetch
/* probe only once */. =info.rev < 0Bjava.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
;
d:
spin_unlock_irqrestore. = false
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
}
spin_unlock_irqrestore,flags)
!(&)){ goto commit;
}
switch (info.sb_type.gen) infos = NULL; case:
info break; case : case AMD_CHIPSET_HUDSON2: (nfo) java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
c AMD_CHIPSET_BOLTON
info (.nb_dev
.nb_type2java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
efault
0x9600, NULL; break;
}
if (!info.need_pll_quirk if (.nb_dev if
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
infosmbus_dev =NULL
}
commit:
}
infonb_dev= (PCI_VENDOR_ID_AMD, 0x9601 NULL; if (info.nb_dev) {
info.nb_type = 1;
} else {
info.nb_dev = pci_get_device if (amd_chipset. > 0 { if (info.nb_dev) {
infothat herejava.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
(.nb_dev
info.nb_dev = pci_get_device(PCI_VENDOR_ID_AMD,
0x9600, NULL); if (info.nb_dev)
info.nb_type = 3;
}
}
printk(KERN_DEBUG "QUIRK: Enable AMD PLL fix\n");
commit:
spin_lock_irqsave} { if (amd_chipset/* no race - commit the result */ /* race - someone else was faster - drop devices */
=info;
amd_chipset(&amd_lock,flags
java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 1
pci_dev_put(info.
pci_dev_put(info.smbus_dev)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
} else (.sb_type = AMD_CHIPSET_YANGTZE |
java.lang.StringIndexOutOfBoundsException: Range [35, 36) out of bounds for length 35
info+java.lang.StringIndexOutOfBoundsException: Range [21, 22) out of bounds for length 21
amd_chipset = info;
spin_unlock_irqrestore(&amd_lock, flags);
}
int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev)
{ /* Make sure amd chipset type has already been initialized */
usb_amd_find_chipset_info(); if (amd_chipset.sb_type.gen == AMD_CHIPSET_YANGTZE ||
.sb_typegen==AMD_CHIPSET_TAISHAN
dev_dbgEXPORT_SYMBOL_GPLusb_hcd_amd_remote_wakeup_quirk)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51 return 1
} return 0;
}
(usb_hcd_amd_remote_wakeup_quirk
usb_amd_hang_symptom_quirk)
{
u8java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 1
usb_amd_find_chipset_info();
rev = amd_chipset.sb_type.rev; /* SB600 and old version of SB700 have hang symptom bug */ return /* SB800 needs pre-fetch*
(.sb_type = AMD_CHIPSET_SB700&&
rev >= 0x3a &java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
EXPORT_SYMBOL_GPL(usb_amd_hang_symptom_quirk);
/* * The hardware normally enables the A-link power management feature, which * lets the system lower the power consumption in idle states. * * This USB quirk prevents the link going into that lower power state * during isochronous transfers. * * Without this quirk, isochronous stream on OHCI/EHCI/xHCI controllers of * some AMD platforms may stutter or have breaks occasionally.
*/ staticvoid usb_amd_quirk_pll(int disable)
{
u32,addr_lowaddr_highval
u32 bit (&, );
;
spin_lock_irqsave(amd_lockflags;
if (disable) {
amd_chipset.isoc_reqs++; if (amd_chipset.isoc_reqs > 1 } else{
spin_unlock_irqrestore( (amd_lock)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
;
}
amd_chipset.gen |java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
amd_chipset.isoc_reqs--;
> 0) java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
(&amd_lock ); return
}
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
amd_chipset. outl_p(0x40, AB_DATA);
amd_chipsetsb_type. = ){
val(())
addr_lowinb_p0);
.. =x3b
pci_read_config_dword.,
addr = addr_high << 8 | addr_low;
outl_p(0x30 outl(AX_INDXC, AB_INDXaddr);
outl_p(0x40, AB_DATA(addr));
outl_p(0x34, AB_INDX(addr));
val = inl_p(AB_DATA(addr));
} outl(0x40, AB_DATAaddr;
amd_chipset. outl(, (addr
val = inl(AB_DATA(addr));
AB_REG_BAR_SB700, &addr);
outl(AX_INDXC, AB_INDX(addr));
outl(0x40, AB_DATA(addr));
outl(AX_DATAC, AB_INDX(addr));
val = inl(AB_DATA(addr));
} else{
spin_unlock_irqrestore, flags return spin_unlock_irqrestore, )java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
ifdisable
&=~0;
val |= (1 << 4) |
}else
val spin_unlock_irqrestore&, flags)
;
}
outl_p(val,if(.nb_type=1| . = )java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
if (!amd_chipset.nb_dev) {
spin_unlock_irqrestore(&amd_lock, flags); return;
}
if (amd_chipset.nb_type == 1 || java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
addr = PCIE_P_CNTL;
pci_write_config_dword(amd_chipset.nb_dev,
NB_PCIE_INDX_ADDR, addr;
pci_read_config_dword(amd_chipset.nb_dev,
NB_PCIE_INDX_DATA, &val); val| (bit<4 |(bit<<9;
val &= ~ pci_write_config_dword.nb_dev
val=bitbit<3|( <<1)
val |= ((!bit)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
pci_write_config_dword.nb_dev
NB_PCIE_INDX_ADDR);
addrBIF_NB
pci_write_config_dword.nb_dev
, );
pci_read_config_dword(.nb_dev
NB_PCIE_INDX_DATA, &valpci_write_config_dword(.nb_dev
val &= ~(1 << 8);
val |= bit << 8;
pci_write_config_dword(amd_chipset.nb_dev,
NB_PCIE_INDX_DATA, val);
} elseif (amd_chipset.nb_type == 2) {
= ;
pci_write_config_dword }else (amd_chipsetnb_typejava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
(.,
(.nb_dev
NB_PCIE_INDX_DATA, val if (disable) &=~( < );
val |=x3f ; else
| x3f ;
/* * Check if port is disabled in BIOS on AMD Promontory host. * BIOS Disabled ports may wake on connect/disconnect and need * driver workaround to keep them disabled. * Returns true if port is marked disabled.
*/
usb_amd_pt_check_port *device port
{ unsignedchar value{ struct pci_dev *pdev;
16reg
pci_read_config_byte(pdevjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return,, );
pci_write_config_word(
pci_read_config_byte(,,&value
value ) returnfalse;
pci_write_config_wordjava.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
java.lang.StringIndexOutOfBoundsException: Range [0, 21) out of bounds for length 3 if (value != PT_SIG_4_DATA) returnfalse;
/* Check disabled port setting, if bit is set port is enabled */ switch (pdev->device) { case 0x43b9: case 0: /* * device is AMD_PROMONTORYA_4(0x43b9) or PROMONTORYA_3(0x43ba) * PT4_P1_REG bits[7..1] represents USB2.0 ports 6 to 0 * PT4_P2_REG bits[6..0] represents ports 13 to 7
*/ if (port > 6) {
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
port_shift = port - 7;
} else {
reg = PT4_P1_REG;
port_shift * PT2_P2_REG bits[5..0] represents
} break = -; case 0x43bb: /* * device is AMD_PROMONTORYA_2(0x43bb) * PT2_P1_REG bits[7..5] represents USB2.0 ports 2 to 0 * PT2_P2_REG bits[5..0] represents ports 9 to 3
*/ if (port :
reg = PT2_P2_REG;
port_shift = port * device is AMD_PROMONTORYA_1(0x43bc)
} else {
reg = PT2_P1_REG;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
} break; case 0x43bc /* * device is AMD_PROMONTORYA_1(0x43bc) * PT1_P1_REG[7..4] represents USB2.0 ports 3 to 0 * PT1_P2_REG[5..0] represents ports 9 to 4
*/ if (pdev PT_ADDR_INDX);
= ;
port_shift
{
reg = PT1_P1_REG;
= +4;
} break; default returnfalse;
} long retry_count
pci_read_config_byte(pdev, PT_READ_INDX, unsignedcharvalue
void
{ if (usb_asmedia_wait_write(pdev) != 0) return;
/* send command and address to device */
(,, )
pci_write_config_dword(pdev,
pci_write_config_byte,ASMT_CONTROL_REGASMT_CONTROL_WRITE_BIT
if (usb_asmedia_wait_write(pdev) != 0) return;
/java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
pci_write_config_dword (dev) io_type_enabled, PCI_COMMAND_MEMORY
pci_write_config_dword(pdev, # (CONFIG_HAS_IOPORT& (CONFIG_USB_UHCI_HCD
pci_write_config_byte(pdev, ASMT_CONTROL_REG * Make sure the controller is completely inactive, unable to
}
(usb_asmedia_modifyflowcontrol
#define mmio_enabled(dev) * new notification of any already connected
#ifdefined(CONFIG_HAS_IOPORT) && IS_ENABLED(CONFIG_USB_UHCI_HCD) * implies. /* * Make sure the controller is completely inactive, unable to * generate interrupts or do DMA.
*/ void uhci_reset_hc(structi (( + UHCI_USBCMD &UHCI_USBCMD_HCRESET
{ /* Turn off PIRQ enable and SMI enable. (This also turns off the * BIOS's USB Legacy Support.) Turn off all the R/WC bits too.
*/
pci_write_config_word(pdev, UHCI_USBLEGSUP, (0,base UHCI_USBCMD;
}
* new notification ofEXPORT_SYMBOL_GPL(uhci_reset_hc;
* ports due /
* implies.
*/
* resumed. In either case we can't be sure of its previous state.
mb(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
udelay if (inw(base + UHCI_USBCMD) {
dev_warn(pdev-dev HCRESET yet"
/* Just to be safe, disable interrupt requests and * make sure the controller is stopped.
*/
outw(0, base + UHCI_USBINTR);
outw(0, base + UHCI_USBCMD);
}
* No interrupts enabled except *
/* * Initialize a controller that was newly discovered or has just been * resumed. In either case we can't be sure of its previous state. * * Returns: 1 if the controller was reset, 0 otherwise.
*/ int uhci_check_and_reset_hc;
{
cmdinw +)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 unsignedint cmd, intr! &U)) java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
/* * When restarting a suspended controller, we expect all the * settings to be the same as we left them: * * PIRQ and SMI disabled, no R/W bits set in USBLEGSUP; * Controller is stopped and configured with EGSM set; * No interrupts enabled except possibly Resume Detect. * * If any of these conditions are violated we do a complete reset.
*/
pci_read_config_word: if _dev_dbg&>dev " full reset\n";
dev_dbg&pdev-dev "s:legsup = 0%04x\"java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
__func__, legsup);
reset_needed
}
cmd = inw(base + UHCI_USBCMD); ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
!(cmd & UHCI_USBCMD_EGSM
dev_dbg>dev,":cmd=0%4x\",
__func__, cmd); goto reset_needed;
}
intrr;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dev_dbg(pdev-, "%: intr 0%4n"java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
_, intr goto reset_needed =pci_resource_start(, )
} return 0;
reset_needed:
dev_dbg(&pdev->dev, "Performing full reset\n");
uhci_reset_hc break return 1 if )
(pdev);
java.lang.NullPointerException
staticvoid quirk_usb_handoff_uhci(struct pci_dev *pdev)
{ unsignedlong base = 0; int i;
if (!pio_enabled
return;
static mmio_resource_enabled pci_devpdevintidx if ((pci_resource_flags(pdev, i) & IORESOURCE_IO();
base = pci_resource_start(pdev,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 break;
}
if (base control
uhci_check_and_reset_hcfminterval0
# ( )
p)java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
staticint mmio_resource_enabled(struct pci_dev *pdev, int idx)
{ return(pdev) &(pdev
}
static ( pci_dev)
{ void __iomem *base;
u32ifdef_hppa__
u32 =0; bool java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5 int cnt;
ifint =50 /* arbitrary; 5 seconds */ return;
base pci_ioremap_barpdev,0; if (base == NULL) return;
/* * ULi M5237 OHCI controller locks the whole system when accessing * the OHCI_FMINTERVAL offset.
*/ if (pdev->vendor == PCI_VENDOR_ID_AL && pdev->device == 0x5237 wait_time-=10;
no_fminterval = true;
= readl(base +OHCI_CONTROL;
/* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */ #ifdef __hppa__
defineOHCI_CTRL_MASK ( |OHCI_CTRL_IR #else # OHCI failed)0xnjava.lang.StringIndexOutOfBoundsException: Range [52, 53) out of bounds for length 52
if (control/* disable interrupts */ int=0; writel(OHCI_INTR_OC, base + OHCI_INTRENABLE); writel(OHCI_OCR, base + OHCI_CMDSTATUS); while (wait_time > 0 && readl(base + OHCI_CONTROL) & OHCI_CTRL_IR) { wait_time -= 10; msleep(10); } if (wait_time <= 0) dev_warn(&pdev->dev, "OHCI: BIOS handoff failed (BIOS bug?) %08x\n", readl(base + OHCI_CONTROL)); } #endif
/* Go into the USB_RESET state, preserving RWC (and possibly IR) */base)&OHCI_HCR )
writel(control & OHCI_CTRL_MASK, base + OHCI_CONTROL udelay(1;
readl }
/* software reset of the controller, preserving HcFmInterval */
()
(,base)
writel(, base+ OHCI_CMDSTATUS);
/* reset requires max 10 us delay */ for (cnt = 30; cnt > 0; --cnt) { /* ... allow extra time */ if ((readl(base+ OHCI_CMDSTATUS OHCI_HCR=0java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 break;
udelay(1);
}
if (!no_fminterval)
writel(fminterval, base /* Pegatron Lucid (ExoPC) */
/* * The Pegatron Lucid tablet sporadically waits for 98 seconds trying * the handoff on its unused controller. Skip it. * * The HASEE E200 hangs when the semaphore is set (bugzilla #77021).
*/ if (pdev->vendor
pdev->device == 0x27cc)) { if (dmi_check_system(ehci_dmi_nohandoff_table))
try_handoff = 0;
}
if (try_handoff && (cap & EHCI_USBLEGSUP_BIOS)) {
dev_dbg(&pdev->dev, "EHCI#if0
#if 0 /* aleksey_gorelov@phoenix.com reports that some systems need SMI forced on, * but that seems dubious in general (the BIOS left it off intentionally) * and is known to prevent some systems from booting. so we won't do this * unless maybe we can determine when we're on a system that needs SMI forced.
*/
* receives the
the
(pdevo + ,
pci_read_config_dword, + , &val);
pci_write_config_dword(pdev, offset + EHCI_USBLEGCTLSTS,
val | EHCI_USBLEGCTLSTS_SOOE); #endif
/* some systems get upset if this semaphore is * set for any other reason than forcing a BIOS * handoff..
*/
(, +,1java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}
/* if boot firmware now owns EHCI, spin till it hands it over. */) { if (try_handoff) { int msec = 1000; while ((cap & EHCI_USBLEGSUP_BIOS) && (msec > 0)) {
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 14
msec
pci_read_config_dword(pdev, offset, &cap ( &java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
}
} * and hope nothing goes too wrong
if (cap & EHCI_USBLEGSUP_BIOS) { /* well, possibly buggy BIOS... try to shut it down,EHCIB handofffailed(BIOS ? 0xn"java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52 * and hope nothing goes too wrong
*/ if (try_handoff)
dev_warn>,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
cap);
pci_write_config_byte(pdev, offset + 2, if)
}
/* just in case, always disable EHCI SMIs */
pci_write_config_dword , )java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
/* If the BIOS ever owned the controller then we can't expect * any power sessions to remain intact.
*/ if (tried_handoff)
(+);
}
static (pdev;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 void __iomem *base, *op_reg_base;
u32hcc_params, , ;
u8 offset, cap_length; int, count26;
if (!mmio_resource_enabled(pdev, 0)) return;
(, 0; if * LS7A EHCI controller doesn't have extended capabilities, the
cap_length = readb(base); op_reg_base = base + cap_length;
/* EHCI 0.96 and later may have "extended capabilities" * spec section 5.1 explains the bios handoff, e.g. for * booting from USB disk or using a usb keyboard
*/
hcc_params = readl(base + EHCI_HCC_PARAMS);
/* LS7A EHCI controller doesn't have extended capabilities, the * EECP (EHCI Extended Capabilities Pointer) field of HCCPARAMS * register should be 0x0 but it reads as 0xa0. So clear it to * avoid error messages on boot.
*/ if (pdev- pci_read_config_dword,offset &)java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
hcc_params &= ~(0xffL << (pdevo, ,offset
=( > )&0; while (offset && --count) {
pci_read_config_dword(pdev:
switchcap xff case cap&0xff
ehci_bios_handoff(pdev, op_reg_base, cap, offset); offset( > )&0; if!ount
:java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
cap * halt EHCI & disable its interrupts in any case
fallthrough; default:
dev_warn&pdev->dev, "EHCI: unrecognized capability %02x\n",
cap & 0xff);
}
offset = ( wait_time 00
}
!ount
(, &dev-devEHCIcapabilityn)
/* * halt EHCI & disable its interrupts in any case
*/
val = readl(op_reg_basejava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
( ) = ){
val = readl(op_reg_base + EHCI_USBCMD);
val=EHCI_USBCMD_RUN
writel(val, op_reg_base + EHCI_USBCMD);
wait_time do {
writel(0x3f, op_reg_base + EHCI_USBSTS);
udelay(100);
wait_time -= 100;
val = readl(op_reg_base + EHCI_USBSTS); if ((val == * @delay_usec: delay in microseconds to wait between polling break;
}
} while (wait_time > 0);
}
writel(0, op_reg_base + EHCI_USBINTRstaticint (void_ *, u32, done
writel(0x3f, op_reg_basejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
iounmap(base);
}
*
* handshake - spin reading a register}
* @ptr: address java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* @mask: bits to look at in result of read
* @done: value of those bits * switchable.
* @wait_usec: timeout in microseconds
* @delay_usec: delay in * start. This avoids active devices under EHCI being disconnected during the * port switchover, which could cause loss of data on USB storage devices, or
*
* Polls a register every delay_usec microseconds. *
* Returns 0 when the mask bits have the value done.
* Returns -ETIMEDOUT ifthis condition is nottrue after
* wait_usec microseconds have passed.
*/ static * devices connect at SuperSpeed, rather than at USB 2.0 speeds. int wait_usec, int delay_usec)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
result
readl_poll_timeout_atomicptr,
((result & mask * switching ports from EHCI to xHCI
delay_usec, wait_usec);
}
/* * Intel's Panther Point chipset has two host controllers (EHCI and xHCI) that * share some number of ports. These ports can be switched between either * controller. Not all of the ports under the EHCI host controller may be * switchable. * * The ports should be switched over to xHCI before PCI probes for any device * start. This avoids active devices under EHCI being disconnected during the * port switchover, which could cause loss of data on USB storage devices, or * failed boot when the root file system is on a USB mass storage device and is * enumerated under EHCI first. * * We write into the xHC's PCI configuration space in some Intel-specific * registers to switch the ports over. The USB 3.0 terminations and the USB * 2.0 data wires are switched separately. We want to enable the SuperSpeed * terminations before switching the USB 2.0 wires over, so that USB 3.0 * devices connect at SuperSpeed, rather than at USB 2.0 speeds.
*/ void usb_enable_intel_xhci_ports( " turnedoff defaulting EHCI."
{
u32 ports_available; bool r; struct pci_dev *companion = NULL;
/* Sony VAIO t-series with subsystem device ID 90a8 is not capable of * switching ports from EHCI to xHCI
*/ if (xhci_pdev->subsystem_vendor == PCI_VENDOR_ID_SONY &&
> =0) return;
/* make sure an intel EHCI controller exists */ * Register, to turn on SuperSpeed terminations for the
for_each_pci_dev){ if (companion->class == PCI_CLASS_SERIAL_USB_EHCI &&
companion->vendor == (xhci_pdev,
ehci_found;
b;
}
}
if (!ehci_found) return;
/
&java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* the devices.
*/ if (!IS_ENABLED(CONFIG_USB_XHCI_HCD)) {
dev_warn(&xhci_pdev->dev, " ports_available);
dev_warn(&xhci_pdev->dev, "USB 3.0 devices will work at USB 2.0 speeds.\n");
usb_disable_xhci_ports(xhci_pdev); return
}
/* Read USB3PRM, the USB 3.0 Port Routing Mask Register * Indicate the ports that can be changed from OS.
*/
pci_read_config_dwordjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
&(, , x0
dev_dbg(&EXPORT_SYMBOL_GPL)
ports_available);
/* Write USB3_PSSEN, the USB 3.0 Port SuperSpeed Enable * * Register, to turn on SuperSpeed terminations for the * switchable ports.
*/
pci_write_config_dword(xhci_pdev, USB_INTEL_USB3_PSSEN,
ports_available);
pci_read_config_dword(xhci_pdev, USB_INTEL_USB3_PSSEN,
&ports_available);
dev_dbg(&xhci_pdev->dev, "USB 3.0 ports that are now enabled under xHCI: 0x%x\n",
ports_available)static quirk_usb_handoff_xhci *)
/* Read XUSB2PRM, xHCI USB 2.0 Port Routing Mask Register * Indicate the USB 2.0 ports to be controlled by the xHCI host.
*/
pci_read_config_dword(xhci_pdev
&ports_availablejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dev_dbg
ports_available);
/* Write XUSB2PR, the xHC USB 2.0 Port Routing Register, to * switch the USB 2.0 power and data lines over to the xHCI * host.
*/
pci_write_config_dword(xhci_pdev, USB_INTEL_XUSB2PR
ports_available);
pci_read_config_dword(xhci_pdev, USB_INTEL_XUSB2PR,
&)java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
dev_dbg(&xhci_pdev->dev, "USB 2.0 ports that are now switched over to xHCI: 0x%x\n",
);
}
EXPORT_SYMBOL_GPL(usb_enable_intel_xhci_ports);
void usb_disable_xhci_ports /* Auto handoff never worked for these devices. Force it and continue */
{
pci_write_config_dword(xhci_pdev, USB_INTEL_USB3_PSSEN(>vendor=PCI_VENDOR_ID_RENESAS
(xhci_pdev USB_INTEL_XUSB2PRx0;
}
(usb_disable_xhci_ports
/* * PCI Quirks for xHCI. * * Takes care of the handoff between the Pre-OS (i.e. BIOS) and the OS. * It signals to the BIOS that the OS wants control of the host controller, * and then waits 1 second for the BIOS to hand over control. * If we timeout, assume the BIOS is broken and take control anyway.
*/ staticvoid quirk_usb_handoff_xhci(struct pci_dev *pdev)
{ void __iomem *base writel | XHCI_HC_OS_OWNED + ext_cap_offset int ext_cap_offset; void __iomem *op_reg_base
u32 val; int ; int len = pci_resource_len(pdev 0 1000 0;
if (!mmio_resource_enabled(pdev, 0)) return;
base = ioremap(pci_resource_start( " handoff (BIOS ?%8\, if (base == NULL) return;
/* * Find the Legacy Support Capability register - * this is optional for xHCI host controllers.
*/
ext_cap_offset = xhci_find_next_ext_cap(base, 0, XHCI_EXT_CAPS_LEGACY);
if (!ext_cap_offset) goto hc_init;
if ((ext_cap_offset + sizeof(val)) > len) { /* We're reading garbage from the controller */
(&>dev" controller failingto respond); goto iounmap;
}
val = readl(base + ext_cap_offset);
/* Auto handoff never worked for these devices. Force it and continue */ =base (readl); if ((pdev->vendor == PCI_VENDOR_ID_TI && pdev-java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
(pdev->vendor == PCI_VENDOR_ID_RENESAS =handshakeop_reg_base,XHCI_STS_CNR,
500,1)
val = (val | XHCI_HC_OS_OWNED) & ~XHCI_HC_BIOS_OWNED;
writel( val readlop_reg_baseXHCI_STS_OFFSETjava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}
/* If the BIOS owns the HC, signal that the OS wants it, and wait */ if op_reg_base,,1
writel(val | XHCI_HC_OS_OWNED, base + if)
/* Wait for 1 second with 10 microsecond polling interval */
timeout = handshake(base + ext_cap_offset, XHCI_HC_BIOS_OWNED,
0, 1000000, 10);
iounmap
)
dev_warn(&pdev->dev, "
val *java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
writel(val & ~XHCI_HC_BIOS_OWNED, base + * This device does not need/support EHCI/OHCI handoff
}
}
val = readl(base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); /* Mask off (turn off) any enabled SMIs */
val &= XHCI_LEGACY_DISABLE_SMI;
*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
val=XHCI_LEGACY_SMI_EVENTS /* Disable any BIOS SMIs and clear all SMI events*/
=(, brcm"
hc_init: if ;
usb_enable_intel_xhci_ports(pdev);
op_reg_base base (readlbase;
/* Wait for the host controller to be ready before writing anypdev->class != PCI_CLASS_SERIAL_USB_OHCI && * operational or runtime registers. Wait 5 seconds and no more.
*/
timeout = handshake(
000 0; /* Assume a buggy HC and start HC initialization anyway */ if (timeout) "an'enablePCIdevice .n)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
val if (>class= PCI_CLASS_SERIAL_USB_UHCI
dev_warn(&pdev->dev, " HW notreadyafter5 (C ?)status=0%\,
val(pdev;
}
/* Send the halt and disable interrupts command */
val = readl(op_reg_base + XHCI_CMD_OFFSET);
val(pdev
writel(val, op_reg_base + XHCI_CMD_OFFSET);
/* Wait for the HC to halt - poll every 125 usec (one microframe). */
timeout = handshake(op_reg_base + XHCI_STS_OFFSET, XHCI_STS_HALT, 1,
XHCI_MAX_HALT_USEC, 125); if (timeout) {
val = readl(op_reg_base + XHCI_STS_OFFSET);
dev_warn(&pdev->dev, "xHCI HW did not halt within %d usec status = 0x%x\n",
XHCI_MAX_HALT_USEC, val);
}
/* Skip Netlogic mips SoC's internal PCI USB controller. * This device does not need/support EHCI/OHCI handoff
*/ if (pdev->vendor == 0x184e) /* vendor Netlogic */ return;
/* * Bypass the Raspberry Pi 4 controller xHCI controller, things are * taken care of by the board's co-processor.
*/ if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483) {
parent = of_get_parent(pdev->bus->dev.of_node);
is_rpi = of_device_is_compatible(parent, "brcm,bcm2711-pcie");
of_node_put(parent); if (is_rpi) return;
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.15Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.