From patchwork Fri Apr 7 00:16:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 747995 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vzgBw3VMVz9s8P for ; Fri, 7 Apr 2017 10:17:44 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vzgBw2YtWzDqJ0 for ; Fri, 7 Apr 2017 10:17:44 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3vzgBr0KDqzDqHl for ; Fri, 7 Apr 2017 10:17:39 +1000 (AEST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v370Df3V011592 for ; Thu, 6 Apr 2017 20:17:28 -0400 Received: from e23smtp03.au.ibm.com (e23smtp03.au.ibm.com [202.81.31.145]) by mx0a-001b2d01.pphosted.com with ESMTP id 29nwqdd6aw-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 06 Apr 2017 20:17:28 -0400 Received: from localhost by e23smtp03.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 7 Apr 2017 10:17:25 +1000 Received: from d23relay08.au.ibm.com (202.81.31.227) by e23smtp03.au.ibm.com (202.81.31.209) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 7 Apr 2017 10:17:24 +1000 Received: from d23av05.au.ibm.com (d23av05.au.ibm.com [9.190.234.119]) by d23relay08.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v370HG3453477532 for ; Fri, 7 Apr 2017 10:17:24 +1000 Received: from d23av05.au.ibm.com (localhost [127.0.0.1]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v370Gp1w030112 for ; Fri, 7 Apr 2017 10:16:51 +1000 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v370Gp8r029912; Fri, 7 Apr 2017 10:16:51 +1000 Received: from bran.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) by ozlabs.au.ibm.com (Postfix) with ESMTP id 4684CA0389; Fri, 7 Apr 2017 10:16:27 +1000 (AEST) Received: from gwshan.ozlabs.ibm.com (shangw.ozlabs.ibm.com [10.61.2.199]) by bran.ozlabs.ibm.com (Postfix) with ESMTP id 3ADF5E3AC4; Fri, 7 Apr 2017 10:16:27 +1000 (AEST) Received: by gwshan.ozlabs.ibm.com (Postfix, from userid 1000) id 318A1AC235E; Fri, 7 Apr 2017 10:16:27 +1000 (AEST) From: Gavin Shan To: skiboot@lists.ozlabs.org Date: Fri, 7 Apr 2017 10:16:20 +1000 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1491524180-12644-1-git-send-email-gwshan@linux.vnet.ibm.com> References: <1491524180-12644-1-git-send-email-gwshan@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17040700-0008-0000-0000-0000011DE081 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17040700-0009-0000-0000-0000094A2386 Message-Id: <1491524180-12644-5-git-send-email-gwshan@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-04-06_20:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1704070001 Subject: [Skiboot] [PATCH 4/4] core/pci: Use macro as vendor ID register offset X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" This uses macro as PCI config register (vendor ID) offset because it's more indicative. Signed-off-by: Gavin Shan Acked-by: Benjamin Herrenschmidt --- core/pci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/pci.c b/core/pci.c index 7742454..13768a0 100644 --- a/core/pci.c +++ b/core/pci.c @@ -219,7 +219,7 @@ static struct pci_device *pci_scan_one(struct phb *phb, struct pci_device *paren bool had_crs = false; for (retries = 0; retries < 40; retries++) { - rc = pci_cfg_read32(phb, bdfn, 0, &vdid); + rc = pci_cfg_read32(phb, bdfn, PCI_CFG_VENDOR_ID, &vdid); if (rc) return NULL; if (vdid == 0xffffffff || vdid == 0x00000000) @@ -240,7 +240,7 @@ static struct pci_device *pci_scan_one(struct phb *phb, struct pci_device *paren * capture it's own bus number, so any subsequent error * messages will be properly tagged */ - pci_cfg_write32(phb, bdfn, 0, vdid); + pci_cfg_write32(phb, bdfn, PCI_CFG_VENDOR_ID, vdid); pd = zalloc(sizeof(struct pci_device)); if (!pd) { @@ -1715,8 +1715,8 @@ static int __pci_restore_bridge_buses(struct phb *phb, uint32_t vdid; /* Make all devices below a bridge "re-capture" the bdfn */ - if (pci_cfg_read32(phb, pd->bdfn, 0, &vdid) == 0) - pci_cfg_write32(phb, pd->bdfn, 0, vdid); + if (pci_cfg_read32(phb, pd->bdfn, PCI_CFG_VENDOR_ID, &vdid) == 0) + pci_cfg_write32(phb, pd->bdfn, PCI_CFG_VENDOR_ID, vdid); return 0; }