From patchwork Mon Jan 10 08:44:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 467991 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0A8l3to000817 for ; Mon, 10 Jan 2011 08:47:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752846Ab1AJIqX (ORCPT ); Mon, 10 Jan 2011 03:46:23 -0500 Received: from rcsinet10.oracle.com ([148.87.113.121]:22134 "EHLO rcsinet10.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752836Ab1AJIqV (ORCPT ); Mon, 10 Jan 2011 03:46:21 -0500 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p0A8k0pQ025613 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 10 Jan 2011 08:46:04 GMT Received: from acsmt355.oracle.com (acsmt355.oracle.com [141.146.40.155]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id p0A8jx7k014767; Mon, 10 Jan 2011 08:46:00 GMT Received: from abhmt010.oracle.com by acsmt354.oracle.com with ESMTP id 944113461294649048; Mon, 10 Jan 2011 00:44:08 -0800 Received: from linux-siqj.site (/75.62.232.119) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 10 Jan 2011 00:44:07 -0800 Message-ID: <4D2AC6D5.5040307@kernel.org> Date: Mon, 10 Jan 2011 00:44:05 -0800 From: Yinghai Lu User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11 MIME-Version: 1.0 To: Jesse Barnes , Greg KH , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Benjamin Herrenschmidt CC: "linux-pci@vger.kernel.org" , linux-usb@vger.kernel.org, "linux-kernel@vger.kernel.org" Subject: [PATCH 2/4] x86: early_quirk check all dev/func in domain 0 References: <4D2A1382.7010407@kernel.org> <4D2AC584.6010004@kernel.org> In-Reply-To: <4D2AC584.6010004@kernel.org> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 10 Jan 2011 08:47:04 +0000 (UTC) Index: linux-2.6/arch/x86/kernel/early-quirks.c =================================================================== --- linux-2.6.orig/arch/x86/kernel/early-quirks.c +++ linux-2.6/arch/x86/kernel/early-quirks.c @@ -243,7 +243,7 @@ static int __init check_dev_quirk(int nu class = read_pci_config_16(num, slot, func, PCI_CLASS_DEVICE); if (class == 0xffff) - return -1; /* no class, treat as single function */ + return 0; /* no class, func gap */ vendor = read_pci_config_16(num, slot, func, PCI_VENDOR_ID); @@ -263,27 +263,30 @@ static int __init check_dev_quirk(int nu } } - type = read_pci_config_byte(num, slot, func, - PCI_HEADER_TYPE); - if (!(type & 0x80)) - return -1; + if (func == 0) { + type = read_pci_config_byte(num, slot, func, + PCI_HEADER_TYPE); + if (!(type & 0x80)) + return -1; + } return 0; } void __init early_quirks(void) { - int slot, func; + int num, slot, func; if (!early_pci_allowed()) return; /* Poor man's PCI discovery */ - /* Only scan the root bus */ - for (slot = 0; slot < 32; slot++) - for (func = 0; func < 8; func++) { - /* Only probe function 0 on single fn devices */ - if (check_dev_quirk(0, slot, func)) - break; - } + /* Only can scan first domain */ + for (num = 0; num < 256; num++) + for (slot = 0; slot < 32; slot++) + for (func = 0; func < 8; func++) { + /* Only probe func 0 on single fn devices */ + if (check_dev_quirk(num, slot, func)) + break; + } }