From patchwork Fri Oct 29 22:59:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Tyser X-Patchwork-Id: 71969 Return-Path: X-Original-To: wd@gemini.denx.de Delivered-To: wd@gemini.denx.de Received: from diddl.denx.de (diddl.denx.de [10.0.0.6]) by gemini.denx.de (Postfix) with ESMTP id 7DC76152451 for ; Sat, 30 Oct 2010 01:04:02 +0200 (CEST) Received: from diddl.denx.de (localhost.localdomain [127.0.0.1]) by diddl.denx.de (Postfix) with ESMTP id 6622030DC752 for ; Sat, 30 Oct 2010 01:04:02 +0200 (CEST) Received: from pop.mnet-online.de by diddl.denx.de with POP3 (fetchmail-6.3.17) for (single-drop); Sat, 30 Oct 2010 01:04:02 +0200 (CEST) Received: from murder ([192.168.6.180]) by backend2 (Cyrus v2.2.12) with LMTPA; Sat, 30 Oct 2010 01:01:02 +0200 X-Sieve: CMU Sieve 2.2 Received: from mail.m-online.net (localhost [127.0.0.1]) by frontend3.mail.m-online.net (Cyrus v2.2.12) with LMTPA; Sat, 30 Oct 2010 01:01:02 +0200 Received: from scanner-4.m-online.net (scanner-4.mail.m-online.net [192.168.1.18]) by mail.m-online.net (Postfix) with ESMTP id 46F0A1C00100; Sat, 30 Oct 2010 01:01:02 +0200 (CEST) Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by mxin-3.m-online.net (Postfix) with ESMTP id 04A5846C0DA; Sat, 30 Oct 2010 01:00:59 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B7DE3282A3; Sat, 30 Oct 2010 01:00:22 +0200 (CEST) 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 xZN9MM0f58Gg; Sat, 30 Oct 2010 01:00:22 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 31E39282A5; Sat, 30 Oct 2010 00:59:55 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8467828277 for ; Sat, 30 Oct 2010 00:59:48 +0200 (CEST) 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 FLpe-wWos2xb for ; Sat, 30 Oct 2010 00:59:48 +0200 (CEST) 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 xes-mad.com (xes-mad.com [216.165.139.218]) by theia.denx.de (Postfix) with ESMTPS id 9401B2826E for ; Sat, 30 Oct 2010 00:59:46 +0200 (CEST) Received: from localhost.localdomain (petert.xes-mad.com [10.52.0.62]) by xes-mad.com (8.13.8/8.13.8) with ESMTP id o9TMxVgW026848; Fri, 29 Oct 2010 17:59:44 -0500 From: Peter Tyser To: u-boot@lists.denx.de Date: Fri, 29 Oct 2010 17:59:29 -0500 Message-Id: <1288393169-9814-6-git-send-email-ptyser@xes-inc.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1288393169-9814-1-git-send-email-ptyser@xes-inc.com> References: <1288393169-9814-1-git-send-email-ptyser@xes-inc.com> X-Virus-Status: Clean Cc: Peter Tyser Subject: [U-Boot] [PATCH/RFC 6/6] pci: Use intelligent indentation for CONFIG_PCI_SCAN_SHOW X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 X-Virus-Scanned: by amavisd-new at m-online.net When CONFIG_PCI_SCAN_SHOW is defined U-Boot prints out PCI devices as they are found during bootup, eg: PCIE1: connected as Root Complex 01:00.0 - 10b5:8518 - Bridge device 02:01.0 - 10b5:8518 - Bridge device 03:00.0 - 10b5:8112 - Bridge device 04:01.0 - 8086:1010 - Network controller 04:01.1 - 8086:1010 - Network controller 02:02.0 - 10b5:8518 - Bridge device 02:03.0 - 10b5:8518 - Bridge device 06:00.0 - 10b5:8518 - Bridge device 07:00.0 - 10b5:8518 - Bridge device 08:00.0 - 1957:0040 - Processor 07:01.0 - 10b5:8518 - Bridge device 09:00.0 - 10b5:8112 - Bridge device 07:02.0 - 10b5:8518 - Bridge device PCIE1: Bus 00 - 0b PCIE2: connected as Root Complex 0d:00.0 - 1957:0040 - Processor PCIE2: Bus 0c - 0d This information is useful, but its difficult to determine the PCI bus topology. To things clearer, we can use indention to make it more obvious how the PCI bus is organized. For the example above, the updated output with this change is: PCIE1: connected as Root Complex 01:00.0 - 10b5:8518 - Bridge device 02:01.0 - 10b5:8518 - Bridge device 03:00.0 - 10b5:8112 - Bridge device 04:01.0 - 8086:1010 - Network controller 04:01.1 - 8086:1010 - Network controller 02:02.0 - 10b5:8518 - Bridge device 02:03.0 - 10b5:8518 - Bridge device 06:00.0 - 10b5:8518 - Bridge device 07:00.0 - 10b5:8518 - Bridge device 08:00.0 - 1957:0040 - Processor 07:01.0 - 10b5:8518 - Bridge device 09:00.0 - 10b5:8112 - Bridge device 07:02.0 - 10b5:8518 - Bridge device PCIE1: Bus 00 - 0b PCIE2: connected as Root Complex 0d:00.0 - 1957:0040 - Processor PCIE2: Bus 0c - 0d In the examples above, an MPC8640 is connected to a PEX8518 PCIe switch (01:00 and 02:0x), which is connected to another PEX8518 PCIe switch (06:00 and 07:0x), which then connects to a MPC8572 processor (08:00). Also, the MPC8640's PEX8518 PCIe switch is connected to a PCI ethernet card (04:01) via a PEX8112 PCIe-to-PCI bridge (03:00). Signed-off-by: Peter Tyser --- drivers/pci/pci.c | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 78f7339..702ac67 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -616,6 +616,9 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus) unsigned char header_type; struct pci_config_table *cfg; pci_dev_t dev; +#ifdef CONFIG_PCI_SCAN_SHOW + static int indent = 0; +#endif sub_bus = bus; @@ -646,9 +649,14 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus) pci_hose_read_config_word(hose, dev, PCI_CLASS_DEVICE, &class); #ifdef CONFIG_PCI_SCAN_SHOW + indent++; + + /* Print leading space, including bus indentation */ + printf("%*c", indent + 1, ' '); + if (pci_print_dev(hose, dev)) { - printf(" %02x:%02x.%x - %04x:%04x - %s\n", - PCI_BUS(dev), PCI_DEV(dev), PCI_FUNC(dev), + printf("%02x:%02x.%-*x - %04x:%04x - %s\n", + PCI_BUS(dev), PCI_DEV(dev), 6 - indent, PCI_FUNC(dev), vendor, device, pci_class_str(class >> 8)); } #endif @@ -666,6 +674,10 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus) #endif } +#ifdef CONFIG_PCI_SCAN_SHOW + indent--; +#endif + if (hose->fixup_irq) hose->fixup_irq(hose, dev); }