From owner-svn-src-head@freebsd.org Wed Apr 4 13:01:16 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 EF9A5F8CC68; Wed, 4 Apr 2018 13:01:15 +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 A164B7966E; Wed, 4 Apr 2018 13:01:15 +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 9C456140DD; Wed, 4 Apr 2018 13:01:15 +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 w34D1FjI045495; Wed, 4 Apr 2018 13:01:15 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w34D1FGh045490; Wed, 4 Apr 2018 13:01:15 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201804041301.w34D1FGh045490@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 13:01:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332019 - in head/sys: arm/mv dts/arm X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: in head/sys: arm/mv dts/arm X-SVN-Commit-Revision: 332019 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 13:01:16 -0000 Author: mw Date: Wed Apr 4 13:01:14 2018 New Revision: 332019 URL: https://svnweb.freebsd.org/changeset/base/332019 Log: Match Marvell Armada38X PCIE ranges in dts with Linux If driver cannot determine ranges based on fdt, it will calculate them based on number and type of current port. Submitted by: Rafal Kozik Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D14752 Modified: head/sys/arm/mv/mv_pci.c head/sys/dts/arm/armada-380.dtsi head/sys/dts/arm/armada-385.dtsi Modified: head/sys/arm/mv/mv_pci.c ============================================================================== --- head/sys/arm/mv/mv_pci.c Wed Apr 4 12:55:31 2018 (r332018) +++ head/sys/arm/mv/mv_pci.c Wed Apr 4 13:01:14 2018 (r332019) @@ -100,6 +100,7 @@ struct mv_pci_range { }; #define FDT_RANGES_CELLS ((3 + 3 + 2) * 2) +#define PCI_SPACE_LEN 0x00100000 static void mv_pci_range_dump(struct mv_pci_range *range) @@ -122,6 +123,7 @@ mv_pci_ranges_decode(phandle_t node, struct mv_pci_ran pcell_t *rangesptr; pcell_t cell0, cell1, cell2; int tuple_size, tuples, i, rv, offset_cells, len; + int portid, is_io_space; /* * Retrieve 'ranges' property. @@ -163,11 +165,14 @@ mv_pci_ranges_decode(phandle_t node, struct mv_pci_ran rangesptr++; cell2 = fdt_data_get((void *)rangesptr, 1); rangesptr++; + portid = fdt_data_get((void *)(rangesptr+1), 1); if (cell0 & 0x02000000) { pci_space = mem_space; + is_io_space = 0; } else if (cell0 & 0x01000000) { pci_space = io_space; + is_io_space = 1; } else { rv = ERANGE; goto out; @@ -198,6 +203,12 @@ mv_pci_ranges_decode(phandle_t node, struct mv_pci_ran rangesptr += size_cells; pci_space->base_pci = cell2; + + if (pci_space->len == 0) { + pci_space->len = PCI_SPACE_LEN; + pci_space->base_parent = fdt_immr_va + + PCI_SPACE_LEN * ( 2 * portid + is_io_space); + } } rv = 0; out: Modified: head/sys/dts/arm/armada-380.dtsi ============================================================================== --- head/sys/dts/arm/armada-380.dtsi Wed Apr 4 12:55:31 2018 (r332018) +++ head/sys/dts/arm/armada-380.dtsi Wed Apr 4 13:01:14 2018 (r332019) @@ -103,8 +103,8 @@ #address-cells = <3>; #size-cells = <2>; #interrupt-cells = <1>; - ranges = <0x82000000 0x0 0x0 0x82000000 0x0 0xf1200000 0x0 0x00100000 - 0x81000000 0x0 0x0 0x81000000 0x0 0xf1300000 0x0 0x00100000>; + ranges = <0x82000000 0 0 0x82000000 0x1 0 1 0 + 0x81000000 0 0 0x81000000 0x1 0 1 0>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &gic GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&gic>; @@ -122,8 +122,8 @@ #address-cells = <3>; #size-cells = <2>; #interrupt-cells = <1>; - ranges = <0x82000000 0x0 0x0 0x82000000 0x0 0xf1400000 0x0 0x00100000 - 0x81000000 0x0 0x0 0x81000000 0x0 0xf1500000 0x0 0x00100000>; + ranges = <0x82000000 0 0 0x82000000 0x2 0 1 0 + 0x81000000 0 0 0x81000000 0x2 0 1 0>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &gic GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&gic>; @@ -141,8 +141,8 @@ #address-cells = <3>; #size-cells = <2>; #interrupt-cells = <1>; - ranges = <0x82000000 0x0 0x0 0x82000000 0x0 0xf1600000 0x0 0x00100000 - 0x81000000 0x0 0x0 0x81000000 0x0 0xf1700000 0x0 0x00100000>; + ranges = <0x82000000 0 0 0x82000000 0x3 0 1 0 + 0x81000000 0 0 0x81000000 0x3 0 1 0>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &gic GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>; interrupt-parent = <&gic>; Modified: head/sys/dts/arm/armada-385.dtsi ============================================================================== --- head/sys/dts/arm/armada-385.dtsi Wed Apr 4 12:55:31 2018 (r332018) +++ head/sys/dts/arm/armada-385.dtsi Wed Apr 4 13:01:14 2018 (r332019) @@ -115,8 +115,8 @@ #address-cells = <3>; #size-cells = <2>; #interrupt-cells = <1>; - ranges = <0x82000000 0x0 0x0 0x82000000 0x0 0xf1200000 0x0 0x00100000 - 0x81000000 0x0 0x0 0x81000000 0x0 0xf1300000 0x0 0x00100000>; + ranges = <0x82000000 0 0 0x82000000 0x1 0 1 0 + 0x81000000 0 0 0x81000000 0x1 0 1 0>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &gic GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>; marvell,pcie-port = <0>; @@ -133,8 +133,8 @@ #address-cells = <3>; #size-cells = <2>; #interrupt-cells = <1>; - ranges = <0x82000000 0x0 0x0 0x82000000 0x0 0xf1400000 0x0 0x00100000 - 0x81000000 0x0 0x0 0x81000000 0x0 0xf1500000 0x0 0x00100000>; + ranges = <0x82000000 0 0 0x82000000 0x2 0 1 0 + 0x81000000 0 0 0x81000000 0x2 0 1 0>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &gic GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>; marvell,pcie-port = <1>; @@ -151,8 +151,8 @@ #address-cells = <3>; #size-cells = <2>; #interrupt-cells = <1>; - ranges = <0x82000000 0x0 0x0 0x82000000 0x0 0xf1600000 0x0 0x00100000 - 0x81000000 0x0 0x0 0x81000000 0x0 0xf1700000 0x0 0x00100000>; + ranges = <0x82000000 0 0 0x82000000 0x3 0 1 0 + 0x81000000 0 0 0x81000000 0x3 0 1 0>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &gic GIC_SPI 70 IRQ_TYPE_LEVEL_HIGH>; marvell,pcie-port = <2>; @@ -172,8 +172,8 @@ #address-cells = <3>; #size-cells = <2>; #interrupt-cells = <1>; - ranges = <0x82000000 0x0 0x0 0x82000000 0x0 0xf1800000 0x0 0x00100000 - 0x81000000 0x0 0x0 0x81000000 0x0 0xf1900000 0x0 0x00100000>; + ranges = <0x82000000 0 0 0x82000000 0x4 0 1 0 + 0x81000000 0 0 0x81000000 0x4 0 1 0>; interrupt-map-mask = <0 0 0 0>; interrupt-map = <0 0 0 0 &gic GIC_SPI 71 IRQ_TYPE_LEVEL_HIGH>; marvell,pcie-port = <3>;