From patchwork Fri May 25 19:11:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Sierra X-Patchwork-Id: 161401 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 35DDBB6EE7 for ; Sat, 26 May 2012 05:17:45 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758198Ab2EYTRn (ORCPT ); Fri, 25 May 2012 15:17:43 -0400 Received: from xes-mad.com ([216.165.139.218]:32478 "EHLO xes-mad.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758153Ab2EYTRn (ORCPT ); Fri, 25 May 2012 15:17:43 -0400 X-Greylist: delayed 360 seconds by postgrey-1.27 at vger.kernel.org; Fri, 25 May 2012 15:17:43 EDT Received: from zimbra.xes-mad.com (cal [10.52.0.127]) by xes-mad.com (8.13.8/8.13.8) with ESMTP id q4PJBdqn023532; Fri, 25 May 2012 14:11:39 -0500 Date: Fri, 25 May 2012 14:11:39 -0500 (CDT) From: Aaron Sierra To: Martin Mares Cc: linux-pci@vger.kernel.org Subject: [PATCH] lspci: zero address in IO isn't always unassigned Message-ID: In-Reply-To: MIME-Version: 1.0 X-Originating-IP: [10.52.0.65] X-Mailer: Zimbra 7.1.3_GA_3346 (ZimbraWebClient - GC17 (Linux)/7.1.3_GA_3346) X-Virus-Scanned: clamav-milter 0.96 at mail X-Virus-Status: Clean X-Spam-Status: No, score=-5.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.xes-mad.com Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Zero is a valid address in I/O space, so display it and it's associated size when IO is enabled in the PCI command register. From arch/powerpc/kernel/pci-common.c: /* Here, we are a bit different than memory as typically IO space * starting at low addresses -is- valid. What we do instead [is] that * we consider as unassigned anything that doesn't have IO enabled * in the PCI command register, and that's it. */ Signed-off-by: Aaron Sierra --- lib/sysfs.c | 2 +- lspci.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sysfs.c b/lib/sysfs.c index 1ec4afb..2197fab 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -125,7 +125,7 @@ sysfs_get_resources(struct pci_dev *d) break; if (sscanf(buf, "%llx %llx %llx", &start, &end, &flags) != 3) a->error("Syntax error in %s", namebuf); - if (start) + if (end > start) size = end - start + 1; else size = 0; diff --git a/lspci.c b/lspci.c index 681ef6a..a67a516 100644 --- a/lspci.c +++ b/lspci.c @@ -372,7 +372,7 @@ show_bases(struct device *d, int cnt) { pciaddr_t a = pos & PCI_BASE_ADDRESS_IO_MASK; printf("I/O ports at "); - if (a) + if (a || (cmd & PCI_COMMAND_IO)) printf(PCIADDR_PORT_FMT, a); else if (flg & PCI_BASE_ADDRESS_IO_MASK) printf("");