From patchwork Thu Nov 13 01:26:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 410178 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 97BCA1400A0 for ; Thu, 13 Nov 2014 12:31:16 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 223EC4B6CB; Thu, 13 Nov 2014 02:31:14 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NzxsUhga8zSp; Thu, 13 Nov 2014 02:31:13 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 36F674B6BC; Thu, 13 Nov 2014 02:31:08 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3B70B4B6CD for ; Thu, 13 Nov 2014 02:31:00 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4wk9diaHLmv2 for ; Thu, 13 Nov 2014 02:31:00 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-oi0-f74.google.com (mail-oi0-f74.google.com [209.85.218.74]) by theia.denx.de (Postfix) with ESMTPS id 3CCF34B6CB for ; Thu, 13 Nov 2014 02:30:54 +0100 (CET) Received: by mail-oi0-f74.google.com with SMTP id u20so1888875oif.5 for ; Wed, 12 Nov 2014 17:30:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=E0NNIbYAM9Q51lI3a3t3dIH395k3Oaefa0Fcq1WPdwg=; b=WrYdxujHT9qDWDRJeBguVMZUDpwLrg4IvoQo/DB2IHIEf5p7lrmU0g2VOLASCtlWN4 +/7Dorbz+o5fjMrf37908AETPUSq2/uMaaRDQg2NQIvthRzs5yTCE8znvSWEqOtNAM41 mAgSA74xe4fePkJaVK4ZBPHCIqhMVNllJtQnf+zgIApM9pqeG9sNXb25w7eERaVZGrFM GPN5Lj8y7ycrzyC+LYoT80RK1jA2DE5TTdU7QwwoJ4cdWns/ysVKtr00IohA6tZLj5kA 4iuKD7XEjhLDyvNaI9Eoq6MaTspKPi4549SP8fO9rj3/3KG+c3h1228tzKSt6uPOYidO FNtA== X-Gm-Message-State: ALoCoQm0RcMIETAWtbTPzuF430KswpNKkDfb6VaWxl5oFmuqoBGAD9CQ5a+JYrRoueaxiAp6PDq8 X-Received: by 10.182.104.69 with SMTP id gc5mr41935129obb.18.1415842253030; Wed, 12 Nov 2014 17:30:53 -0800 (PST) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id e24si1006845yhe.3.2014.11.12.17.30.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Nov 2014 17:30:53 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id KsgQjBMB.1; Wed, 12 Nov 2014 17:30:52 -0800 Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 03EB0220E32; Wed, 12 Nov 2014 18:30:51 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Wed, 12 Nov 2014 18:26:49 -0700 Message-Id: <1415842036-28471-4-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.1.0.rc2.206.gedb03e5 In-Reply-To: <1415842036-28471-1-git-send-email-sjg@chromium.org> References: <1415842036-28471-1-git-send-email-sjg@chromium.org> Cc: Thierry Reding Subject: [U-Boot] [PATCH v3 03/30] pci: Honour pci_skip_dev() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Thierry Reding When enumerating devices, honour the pci_skip_dev() function. This can be used by PCI controller drivers to restrict which devices will be probed. This is required by the NVIDIA Tegra PCIe controller driver, which will fail with a data abort exception if an access is attempted to a device number larger than 0 outside of bus 0. pci_skip_dev() is therefore implemented to prevent any such accesses. Signed-off-by: Thierry Reding Signed-off-by: Simon Glass --- Changes in v3: None common/cmd_pci.c | 3 +++ drivers/pci/pci.c | 3 +++ include/pci.h | 1 + 3 files changed, 7 insertions(+) diff --git a/common/cmd_pci.c b/common/cmd_pci.c index 5a6048c..e3a77e3 100644 --- a/common/cmd_pci.c +++ b/common/cmd_pci.c @@ -71,6 +71,9 @@ void pciinfo(int BusNum, int ShortPCIListing) dev = PCI_BDF(BusNum, Device, Function); + if (pci_skip_dev(hose, dev)) + continue; + pci_read_config_word(dev, PCI_VENDOR_ID, &VendorID); if ((VendorID == 0xFFFF) || (VendorID == 0x0000)) continue; diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 60c333e..0d321a6 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -195,6 +195,9 @@ pci_dev_t pci_find_devices(struct pci_device_id *ids, int index) bdf < PCI_BDF(bus + 1, 0, 0); #endif bdf += PCI_BDF(0, 0, 1)) { + if (pci_skip_dev(hose, bdf)) + continue; + if (!PCI_FUNC(bdf)) { pci_read_config_byte(bdf, PCI_HEADER_TYPE, diff --git a/include/pci.h b/include/pci.h index 2ff7365..d211351 100644 --- a/include/pci.h +++ b/include/pci.h @@ -623,6 +623,7 @@ extern void pci_register_hose(struct pci_controller* hose); extern struct pci_controller* pci_bus_to_hose(int bus); extern struct pci_controller *find_hose_by_cfg_addr(void *cfg_addr); +extern int pci_skip_dev(struct pci_controller *hose, pci_dev_t dev); extern int pci_hose_scan(struct pci_controller *hose); extern int pci_hose_scan_bus(struct pci_controller *hose, int bus);