From owner-svn-src-head@freebsd.org Wed May 30 02:47:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E4CBEF61C8; Wed, 30 May 2018 02:47:24 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D3A976AB62; Wed, 30 May 2018 02:47:23 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B237024B5A; Wed, 30 May 2018 02:47:23 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4U2lNaK034965; Wed, 30 May 2018 02:47:23 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4U2lNTc034964; Wed, 30 May 2018 02:47:23 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201805300247.w4U2lNTc034964@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 30 May 2018 02:47:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334366 - head/sys/powerpc/powernv X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powernv X-SVN-Commit-Revision: 334366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2018 02:47:24 -0000 Author: jhibbits Date: Wed May 30 02:47:23 2018 New Revision: 334366 URL: https://svnweb.freebsd.org/changeset/base/334366 Log: Cache the phandle of the PCI node in opal_pci_attach Simple cleanup, no functional change. This is related to the fixups needed for POWER9 support. Modified: head/sys/powerpc/powernv/opal_pci.c Modified: head/sys/powerpc/powernv/opal_pci.c ============================================================================== --- head/sys/powerpc/powernv/opal_pci.c Wed May 30 02:41:47 2018 (r334365) +++ head/sys/powerpc/powernv/opal_pci.c Wed May 30 02:47:23 2018 (r334366) @@ -200,25 +200,27 @@ opalpci_attach(device_t dev) { struct opalpci_softc *sc; cell_t id[2], m64window[6], npe; + phandle_t node; int i, err; uint64_t maxmem; uint64_t entries; int rid; sc = device_get_softc(dev); + node = ofw_bus_get_node(dev); - switch (OF_getproplen(ofw_bus_get_node(dev), "ibm,opal-phbid")) { + switch (OF_getproplen(node, "ibm,opal-phbid")) { case 8: - OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-phbid", id, 8); + OF_getencprop(node, "ibm,opal-phbid", id, 8); sc->phb_id = ((uint64_t)id[0] << 32) | id[1]; break; case 4: - OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-phbid", id, 4); + OF_getencprop(node, "ibm,opal-phbid", id, 4); sc->phb_id = id[0]; break; default: device_printf(dev, "PHB ID property had wrong length (%zd)\n", - OF_getproplen(ofw_bus_get_node(dev), "ibm,opal-phbid")); + OF_getproplen(node, "ibm,opal-phbid")); return (ENXIO); } @@ -264,8 +266,7 @@ opalpci_attach(device_t dev) /* * Turn on MMIO, mapped to PE 1 */ - if (OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-num-pes", &npe, 4) - != 4) + if (OF_getencprop(node, "ibm,opal-num-pes", &npe, 4) != 4) npe = 1; for (i = 0; i < npe; i++) { err = opal_call(OPAL_PCI_MAP_PE_MMIO_WINDOW, sc->phb_id, @@ -275,7 +276,7 @@ opalpci_attach(device_t dev) } /* XXX: multiple M64 windows? */ - if (OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-m64-window", + if (OF_getencprop(node, "ibm,opal-m64-window", m64window, sizeof(m64window)) == sizeof(m64window)) { opal_call(OPAL_PCI_PHB_MMIO_ENABLE, sc->phb_id, OPAL_M64_WINDOW_TYPE, 0, 0); @@ -342,9 +343,9 @@ opalpci_attach(device_t dev) * Get MSI properties */ sc->msi_vmem = NULL; - if (OF_getproplen(ofw_bus_get_node(dev), "ibm,opal-msi-ranges") > 0) { + if (OF_getproplen(node, "ibm,opal-msi-ranges") > 0) { cell_t msi_ranges[2]; - OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-msi-ranges", + OF_getencprop(node, "ibm,opal-msi-ranges", msi_ranges, sizeof(msi_ranges)); sc->msi_base = msi_ranges[0]; @@ -352,7 +353,7 @@ opalpci_attach(device_t dev) msi_ranges[1], 1, 16, M_BESTFIT | M_WAITOK); sc->base_msi_irq = powerpc_register_pic(dev, - OF_xref_from_node(ofw_bus_get_node(dev)), + OF_xref_from_node(node), msi_ranges[0] + msi_ranges[1], 0, FALSE); if (bootverbose) @@ -377,7 +378,7 @@ opalpci_attach(device_t dev) /* * OPAL stores 64-bit BARs in a special property rather than "ranges" */ - if (OF_getencprop(ofw_bus_get_node(dev), "ibm,opal-m64-window", + if (OF_getencprop(node, "ibm,opal-m64-window", m64window, sizeof(m64window)) == sizeof(m64window)) { struct ofw_pci_range *rp;