From patchwork Mon Jun 19 06:46:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 777595 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 3wrhPZ2NZVz9s71 for ; Mon, 19 Jun 2017 16:48:02 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3wrhPZ1S15zDqhW for ; Mon, 19 Jun 2017 16:48:02 +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 3wrhPS4GJ6zDqgp for ; Mon, 19 Jun 2017 16:47:56 +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 v5J6iB6T114320 for ; Mon, 19 Jun 2017 02:47:54 -0400 Received: from e23smtp03.au.ibm.com (e23smtp03.au.ibm.com [202.81.31.145]) by mx0a-001b2d01.pphosted.com with ESMTP id 2b68h5tme3-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 19 Jun 2017 02:47:54 -0400 Received: from localhost by e23smtp03.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Jun 2017 16:47:51 +1000 Received: from d23relay10.au.ibm.com (202.81.31.229) by e23smtp03.au.ibm.com (202.81.31.209) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 19 Jun 2017 16:47:48 +1000 Received: from d23av05.au.ibm.com (d23av05.au.ibm.com [9.190.234.119]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v5J6lew37799214 for ; Mon, 19 Jun 2017 16:47:48 +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 v5J6lFxi009048 for ; Mon, 19 Jun 2017 16:47:15 +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 v5J6lFMI008371; Mon, 19 Jun 2017 16:47:15 +1000 Received: from bran.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) by ozlabs.au.ibm.com (Postfix) with ESMTP id EB6E4A0275; Mon, 19 Jun 2017 16:46:50 +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 DDF0BE3C84; Mon, 19 Jun 2017 16:46:50 +1000 (AEST) Received: by gwshan.ozlabs.ibm.com (Postfix, from userid 1000) id D4992AC0DF8; Mon, 19 Jun 2017 16:46:50 +1000 (AEST) From: Gavin Shan To: skiboot@lists.ozlabs.org Date: Mon, 19 Jun 2017 16:46:46 +1000 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497854809-26032-1-git-send-email-gwshan@linux.vnet.ibm.com> References: <1497854809-26032-1-git-send-email-gwshan@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17061906-0008-0000-0000-000001431C06 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17061906-0009-0000-0000-00000972825A Message-Id: <1497854809-26032-2-git-send-email-gwshan@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-19_05:, , 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-1703280000 definitions=main-1706190114 Subject: [Skiboot] [PATCH v2 1/4] core/pci: Use cached VDID when populating device node 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" No need to read the VDID from HW when populating the PCI device node, as it has been cached in pd->vdid. Signed-off-by: Gavin Shan --- core/pci.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/core/pci.c b/core/pci.c index 63d9d24..7cd29fd 100644 --- a/core/pci.c +++ b/core/pci.c @@ -1435,12 +1435,9 @@ static void pci_print_summary_line(struct phb *phb, struct pci_device *pd, const char *cname) { const char *label, *dtype, *s; - u32 vdid; #define MAX_SLOTSTR 32 char slotstr[MAX_SLOTSTR + 1] = { 0, }; - pci_cfg_read32(phb, pd->bdfn, 0, &vdid); - /* If it's a slot, it has a slot-label */ label = dt_prop_get_def(np, "ibm,slot-label", NULL); if (label) { @@ -1479,13 +1476,15 @@ static void pci_print_summary_line(struct phb *phb, struct pci_device *pd, if (pd->is_bridge) PCINOTICE(phb, pd->bdfn, "[%s] %04x %04x R:%02x C:%06x B:%02x..%02x %s\n", - dtype, vdid & 0xffff, vdid >> 16, + dtype, PCI_VENDOR_ID(pd->vdid), + PCI_DEVICE_ID(pd->vdid), rev_class & 0xff, rev_class >> 8, pd->secondary_bus, pd->subordinate_bus, slotstr); else PCINOTICE(phb, pd->bdfn, "[%s] %04x %04x R:%02x C:%06x (%14s) %s\n", - dtype, vdid & 0xffff, vdid >> 16, + dtype, PCI_VENDOR_ID(pd->vdid), + PCI_DEVICE_ID(pd->vdid), rev_class & 0xff, rev_class >> 8, cname, slotstr); } @@ -1500,7 +1499,7 @@ static void pci_add_one_device_node(struct phb *phb, #define MAX_NAME 256 char name[MAX_NAME]; char compat[MAX_NAME]; - uint32_t rev_class, vdid; + uint32_t rev_class; uint32_t reg[5]; uint8_t intpin; const uint32_t ranges_direct[] = { @@ -1511,7 +1510,6 @@ static void pci_add_one_device_node(struct phb *phb, 0x02000000, 0x0, 0x0, 0xf0000000, 0x0}; - pci_cfg_read32(phb, pd->bdfn, 0, &vdid); pci_cfg_read32(phb, pd->bdfn, PCI_CFG_REV_ID, &rev_class); pci_cfg_read8(phb, pd->bdfn, PCI_CFG_INT_PIN, &intpin); @@ -1536,17 +1534,17 @@ static void pci_add_one_device_node(struct phb *phb, /* XXX FIXME: make proper "compatible" properties */ if (pci_has_cap(pd, PCI_CFG_CAP_ID_EXP, false)) { snprintf(compat, MAX_NAME, "pciex%x,%x", - vdid & 0xffff, vdid >> 16); + PCI_VENDOR_ID(pd->vdid), PCI_DEVICE_ID(pd->vdid)); dt_add_property_cells(np, "ibm,pci-config-space-type", 1); } else { snprintf(compat, MAX_NAME, "pci%x,%x", - vdid & 0xffff, vdid >> 16); + PCI_VENDOR_ID(pd->vdid), PCI_DEVICE_ID(pd->vdid)); dt_add_property_cells(np, "ibm,pci-config-space-type", 0); } dt_add_property_cells(np, "class-code", rev_class >> 8); dt_add_property_cells(np, "revision-id", rev_class & 0xff); - dt_add_property_cells(np, "vendor-id", vdid & 0xffff); - dt_add_property_cells(np, "device-id", vdid >> 16); + dt_add_property_cells(np, "vendor-id", PCI_VENDOR_ID(pd->vdid)); + dt_add_property_cells(np, "device-id", PCI_DEVICE_ID(pd->vdid)); if (intpin) dt_add_property_cells(np, "interrupts", intpin);