From patchwork Fri Jun 30 10:05:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffy Chen X-Patchwork-Id: 9819041 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 680E560224 for ; Fri, 30 Jun 2017 10:06:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59F9E26D05 for ; Fri, 30 Jun 2017 10:06:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E2F827F81; Fri, 30 Jun 2017 10:06:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF60626224 for ; Fri, 30 Jun 2017 10:06:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751950AbdF3KG0 (ORCPT ); Fri, 30 Jun 2017 06:06:26 -0400 Received: from regular1.263xmail.com ([211.150.99.134]:56318 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751751AbdF3KFu (ORCPT ); Fri, 30 Jun 2017 06:05:50 -0400 Received: from jeffy.chen?rock-chips.com (unknown [192.168.167.163]) by regular1.263xmail.com (Postfix) with ESMTP id 54489917E; Fri, 30 Jun 2017 18:05:42 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id DB42F381; Fri, 30 Jun 2017 18:05:39 +0800 (CST) X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: linux-pci@vger.kernel.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: cjf@rock-chips.com X-DNS-TYPE: 0 Received: from localhost (unknown [103.29.142.67]) by smtp.263.net (Postfix) whith ESMTP id 29977GZLN6F; Fri, 30 Jun 2017 18:05:43 +0800 (CST) From: Jeffy Chen To: linux-pci@vger.kernel.org, mj@ucw.cz Cc: rajatja@google.com, briannorris@chromium.org, Jeffy Chen Subject: [PCIUTILS PATCH] lspci: Fix wrong read size for RootSta/DevCtl2/LnkCtl2 Date: Fri, 30 Jun 2017 18:05:40 +0800 Message-Id: <1498817140-24614-1-git-send-email-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.1.4 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We are reading wrong size(word) for these caps, since: RootSta has: PCI_EXP_RTSTA_PME_STATUS 0x00010000 /* PME Status */ PCI_EXP_RTSTA_PME_PENDING 0x00020000 /* PME is Pending */ DevCtl2 has: PCI_EXP_DEV2_OBFF(x) (((x) >> 13) & 3) /* OBFF enabled */ LnkCtl2 has: PCI_EXP_LNKCTL2_MARGIN(x) (((x) >> 7) & 7) /* Transmit Margin */ PCI_EXP_LNKCTL2_COM_DEEMPHASIS(x) (((x) >> 12) & 0xf) /* Compliance De-emphasis */ Signed-off-by: Jeffy Chen --- ls-caps.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ls-caps.c b/ls-caps.c index 0ca46fb..e0493c7 100644 --- a/ls-caps.c +++ b/ls-caps.c @@ -879,7 +879,7 @@ static void cap_express_root(struct device *d, int where) printf("\t\tRootCap: CRSVisible%c\n", FLAG(w, PCI_EXP_RTCAP_CRSVIS)); - w = get_conf_word(d, where + PCI_EXP_RTSTA); + w = get_conf_long(d, where + PCI_EXP_RTSTA); printf("\t\tRootSta: PME ReqID %04x, PMEStatus%c PMEPending%c\n", w & PCI_EXP_RTSTA_PME_REQID, FLAG(w, PCI_EXP_RTSTA_PME_STATUS), @@ -1021,7 +1021,7 @@ static void cap_express_dev2(struct device *d, int where, int type) printf("\n"); } - w = get_conf_word(d, where + PCI_EXP_DEVCTL2); + w = get_conf_long(d, where + PCI_EXP_DEVCTL2); printf("\t\tDevCtl2: Completion Timeout: %s, TimeoutDis%c, LTR%c, OBFF %s", cap_express_dev2_timeout_value(PCI_EXP_DEV2_TIMEOUT_VALUE(w)), FLAG(w, PCI_EXP_DEV2_TIMEOUT_DIS), @@ -1101,7 +1101,7 @@ static void cap_express_link2(struct device *d, int where, int type) if (!((type == PCI_EXP_TYPE_ENDPOINT || type == PCI_EXP_TYPE_LEG_END) && (d->dev->dev != 0 || d->dev->func != 0))) { - w = get_conf_word(d, where + PCI_EXP_LNKCTL2); + w = get_conf_long(d, where + PCI_EXP_LNKCTL2); printf("\t\tLnkCtl2: Target Link Speed: %s, EnterCompliance%c SpeedDis%c", cap_express_link2_speed(PCI_EXP_LNKCTL2_SPEED(w)), FLAG(w, PCI_EXP_LNKCTL2_CMPLNC),