 if (!mmio_resource_enabled(pdev, 0)) return; 
static void __devinit quirk_usb_disable_ehci(struct pci_dev *pdev){	int wait_time, delta;	void __iomem *base, *op_reg_base;	u32 hcc_params, val, temp;	u8 cap_length;	base = ioremap_nocache(pci_resource_start(pdev, 0),				pci_resource_len(pdev, 0));	if (base == NULL) return;	cap_length = readb(base);	op_reg_base = base + cap_length;	hcc_params = readl(base + EHCI_HCC_PARAMS);	hcc_params = (hcc_params >> 8) & 0xff;	if (hcc_params) {		pci_read_config_dword(pdev,					hcc_params + EHCI_USBLEGSUP,					&val);		if (((val & 0xff) == 1) && (val & EHCI_USBLEGSUP_BIOS)) {			/*			 * Ok, BIOS is in smm mode, try to hand off...			 */			pci_read_config_dword(pdev,						hcc_params + EHCI_USBLEGCTLSTS,						&temp);			pci_write_config_dword(pdev,						hcc_params + EHCI_USBLEGCTLSTS,						temp | EHCI_USBLEGCTLSTS_SOOE);			val |= EHCI_USBLEGSUP_OS;			pci_write_config_dword(pdev,						hcc_params + EHCI_USBLEGSUP,						val);			wait_time = 500;			do {				msleep(10);				wait_time -= 10;				pci_read_config_dword(pdev,						hcc_params + EHCI_USBLEGSUP,						&val);			} while (wait_time && (val & EHCI_USBLEGSUP_BIOS));			if (!wait_time) {				/*				 * well, possibly buggy BIOS...				 */				printk(KERN_WARNING "%s %s: early BIOS handoff "						"failed (BIOS bug ?)\n",					pdev->dev.bus_id, "EHCI");				pci_write_config_dword(pdev,						hcc_params + EHCI_USBLEGSUP,						EHCI_USBLEGSUP_OS);				pci_write_config_dword(pdev,						hcc_params + EHCI_USBLEGCTLSTS,						0);			}		}	}	/*	 * halt EHCI & disable its interrupts in any case	 */	val = readl(op_reg_base + EHCI_USBSTS);	if ((val & EHCI_USBSTS_HALTED) == 0) {		val = readl(op_reg_base + EHCI_USBCMD);		val &= ~EHCI_USBCMD_RUN;		writel(val, op_reg_base + EHCI_USBCMD);		wait_time = 2000;		delta = 100;		do {			writel(0x3f, op_reg_base + EHCI_USBSTS);			udelay(delta);			wait_time -= delta;			val = readl(op_reg_base + EHCI_USBSTS);			if ((val == ~(u32)0) || (val & EHCI_USBSTS_HALTED)) {				break;			}		} while (wait_time > 0);	}	writel(0, op_reg_base + EHCI_USBINTR);	writel(0x3f, op_reg_base + EHCI_USBSTS);	iounmap(base);	return;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/541ab4af11d5b41b95cd633e9b1d96cea9947ac2/pci-quirks.c/buggy/drivers/usb/host/pci-quirks.c