From patchwork Wed Jan 13 19:47:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sean O. Stalley" X-Patchwork-Id: 567126 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 5DA631402C4 for ; Thu, 14 Jan 2016 06:51:15 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756068AbcAMTvD (ORCPT ); Wed, 13 Jan 2016 14:51:03 -0500 Received: from mga14.intel.com ([192.55.52.115]:41449 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755898AbcAMTvC (ORCPT ); Wed, 13 Jan 2016 14:51:02 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 13 Jan 2016 11:51:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,290,1449561600"; d="scan'208";a="859904671" Received: from dev.jf.intel.com ([134.134.147.78]) by orsmga001.jf.intel.com with ESMTP; 13 Jan 2016 11:51:01 -0800 From: "Sean O. Stalley" To: linux-pci@vger.kernel.org, mj@ucw.cz Cc: sean.stalley@intel.com, bhelgaas@google.com, david.daney@cavium.com Subject: [PATCH 1/1] Support region sizes that are not power-of-2 in lspci Date: Wed, 13 Jan 2016 11:47:13 -0800 Message-Id: <1452714433-8144-1-git-send-email-sean.stalley@intel.com> X-Mailer: git-send-email 1.9.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Enhanced Allocation allows PCI devices to reserve regions with DWORD granularity. Make sure lspci doesn't tuncate least significant bits of the region size. ex: a 2000 byte region should display [size=2000] instead of [size=1K] Signed-off-by: Sean O. Stalley --- lspci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lspci.c b/lspci.c index fe7b7fe..d483f3a 100644 --- a/lspci.c +++ b/lspci.c @@ -336,7 +336,7 @@ show_size(pciaddr_t x) if (!x) return; for (i = 0; i < (sizeof(suffix) / sizeof(*suffix) - 1); i++) { - if (x < 1024) + if (x % 1024) break; x /= 1024; } @@ -366,7 +366,7 @@ show_bases(struct device *d, int cnt) putchar('\t'); if (pos && !flg) /* Reported by the OS, but not by the device */ { - printf("[virtual] "); + printf("[virtual] "); /* could also be enhanced */ flg = pos; virtual = 1; }