From owner-svn-src-head@freebsd.org Wed Apr 4 12:36:56 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 8956DF8AF61; Wed, 4 Apr 2018 12:36:56 +0000 (UTC) (envelope-from mw@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 3DBE277C0C; Wed, 4 Apr 2018 12:36:56 +0000 (UTC) (envelope-from mw@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 3895C13C49; Wed, 4 Apr 2018 12:36:56 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w34Cau4b018042; Wed, 4 Apr 2018 12:36:56 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34CatEl018041; Wed, 4 Apr 2018 12:36:55 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201804041236.w34CatEl018041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Wed, 4 Apr 2018 12:36:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332014 - head/sys/arm/mv X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/arm/mv X-SVN-Commit-Revision: 332014 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.25 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, 04 Apr 2018 12:36:56 -0000 Author: mw Date: Wed Apr 4 12:36:55 2018 New Revision: 332014 URL: https://svnweb.freebsd.org/changeset/base/332014 Log: Add support of PCI_RES_BUS to Marvell PCI driver GENERIC ARM config use NEW_PCIB driver (https://wiki.freebsd.org/NEW_PCIB). To satisfy it, allocation and deallocation of PCI_RES_BUS is necessary. Conditional compilation is added for backward compatibility with ARMv5 configs. Submitted by: Rafal Kozik Reviewed by: jhb Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D14748 Modified: head/sys/arm/mv/mv_pci.c Modified: head/sys/arm/mv/mv_pci.c ============================================================================== --- head/sys/arm/mv/mv_pci.c Wed Apr 4 12:35:28 2018 (r332013) +++ head/sys/arm/mv/mv_pci.c Wed Apr 4 12:36:55 2018 (r332014) @@ -312,6 +312,8 @@ struct mv_pcib_softc { int sc_skip_enable_procedure; int sc_enable_find_root_slot; struct ofw_bus_iinfo sc_pci_iinfo; + + int ap_segment; /* PCI domain */ }; /* Local forward prototypes */ @@ -441,6 +443,8 @@ mv_pcib_attach(device_t self) return(ENXIO); } + sc->ap_segment = port_id; + if (ofw_bus_node_is_compatible(node, "mrvl,pcie")) { sc->sc_type = MV_TYPE_PCIE; if (ofw_bus_node_is_compatible(parnode, "marvell,armada-370-pcie")) { @@ -879,6 +883,11 @@ mv_pcib_alloc_resource(device_t dev, device_t child, i case SYS_RES_MEMORY: rm = &sc->sc_mem_rman; break; +#ifdef PCI_RES_BUS + case PCI_RES_BUS: + return (pci_domain_alloc_bus(sc->ap_segment, child, rid, start, + end, count, flags)); +#endif default: return (BUS_ALLOC_RESOURCE(device_get_parent(dev), dev, type, rid, start, end, count, flags)); @@ -915,7 +924,12 @@ static int mv_pcib_release_resource(device_t dev, device_t child, int type, int rid, struct resource *res) { +#ifdef PCI_RES_BUS + struct mv_pcib_softc *sc = device_get_softc(dev); + if (type == PCI_RES_BUS) + return (pci_domain_release_bus(sc->ap_segment, child, rid, res)); +#endif if (type != SYS_RES_IOPORT && type != SYS_RES_MEMORY) return (BUS_RELEASE_RESOURCE(device_get_parent(dev), child, type, rid, res));