From owner-svn-src-head@freebsd.org Tue May 10 15:46:01 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04262B35506; Tue, 10 May 2016 15:46:01 +0000 (UTC) (envelope-from andrew@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 mx1.freebsd.org (Postfix) with ESMTPS id B9CD91160; Tue, 10 May 2016 15:46:00 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4AFjxId073632; Tue, 10 May 2016 15:45:59 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4AFjxqE073630; Tue, 10 May 2016 15:45:59 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201605101545.u4AFjxqE073630@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Tue, 10 May 2016 15:45:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299370 - head/sys/arm64/cavium X-SVN-Group: head 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.22 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: Tue, 10 May 2016 15:46:01 -0000 Author: andrew Date: Tue May 10 15:45:59 2016 New Revision: 299370 URL: https://svnweb.freebsd.org/changeset/base/299370 Log: Push the logic to talk with the MSI/MSI-X interrupt controller to the FDT attachment. This is where it will live when we import intrng as it will need to look at either the msi-parent or msi-map FDT properties. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/cavium/thunder_pcie_pem.c head/sys/arm64/cavium/thunder_pcie_pem_fdt.c Modified: head/sys/arm64/cavium/thunder_pcie_pem.c ============================================================================== --- head/sys/arm64/cavium/thunder_pcie_pem.c Tue May 10 15:04:24 2016 (r299369) +++ head/sys/arm64/cavium/thunder_pcie_pem.c Tue May 10 15:45:59 2016 (r299370) @@ -128,9 +128,9 @@ static struct resource * thunder_pem_all int *, rman_res_t, rman_res_t, rman_res_t, u_int); static int thunder_pem_alloc_msi(device_t, device_t, int, int, int *); static int thunder_pem_release_msi(device_t, device_t, int, int *); -static int thunder_pem_map_msi(device_t, device_t, int, uint64_t *, uint32_t *); static int thunder_pem_alloc_msix(device_t, device_t, int *); static int thunder_pem_release_msix(device_t, device_t, int); +static int thunder_pem_map_msi(device_t, device_t, int, uint64_t *, uint32_t *); static int thunder_pem_attach(device_t); static int thunder_pem_deactivate_resource(device_t, device_t, int, int, struct resource *); @@ -177,11 +177,11 @@ static device_method_t thunder_pem_metho DEVMETHOD(pcib_maxslots, thunder_pem_maxslots), DEVMETHOD(pcib_read_config, thunder_pem_read_config), DEVMETHOD(pcib_write_config, thunder_pem_write_config), - DEVMETHOD(pcib_map_msi, thunder_pem_map_msi), DEVMETHOD(pcib_alloc_msix, thunder_pem_alloc_msix), DEVMETHOD(pcib_release_msix, thunder_pem_release_msix), DEVMETHOD(pcib_alloc_msi, thunder_pem_alloc_msi), DEVMETHOD(pcib_release_msi, thunder_pem_release_msi), + DEVMETHOD(pcib_map_msi, thunder_pem_map_msi), DEVMETHOD_END }; @@ -327,37 +327,48 @@ static int thunder_pem_alloc_msi(device_t pci, device_t child, int count, int maxcount, int *irqs) { + device_t bus; - return (arm_alloc_msi(pci, child, count, maxcount, irqs)); + bus = device_get_parent(pci); + return (PCIB_ALLOC_MSI(device_get_parent(bus), child, count, maxcount, + irqs)); } static int thunder_pem_release_msi(device_t pci, device_t child, int count, int *irqs) { + device_t bus; - return (arm_release_msi(pci, child, count, irqs)); + bus = device_get_parent(pci); + return (PCIB_RELEASE_MSI(device_get_parent(bus), child, count, irqs)); } static int -thunder_pem_map_msi(device_t pci, device_t child, int irq, uint64_t *addr, - uint32_t *data) +thunder_pem_alloc_msix(device_t pci, device_t child, int *irq) { + device_t bus; - return (arm_map_msi(pci, child, irq, addr, data)); + bus = device_get_parent(pci); + return (PCIB_ALLOC_MSIX(device_get_parent(bus), child, irq)); } static int -thunder_pem_alloc_msix(device_t pci, device_t child, int *irq) +thunder_pem_release_msix(device_t pci, device_t child, int irq) { + device_t bus; - return (arm_alloc_msix(pci, child, irq)); + bus = device_get_parent(pci); + return (PCIB_RELEASE_MSIX(device_get_parent(bus), child, irq)); } static int -thunder_pem_release_msix(device_t pci, device_t child, int irq) +thunder_pem_map_msi(device_t pci, device_t child, int irq, uint64_t *addr, + uint32_t *data) { + device_t bus; - return (arm_release_msix(pci, child, irq)); + bus = device_get_parent(pci); + return (PCIB_MAP_MSI(device_get_parent(bus), child, irq, addr, data)); } static int Modified: head/sys/arm64/cavium/thunder_pcie_pem_fdt.c ============================================================================== --- head/sys/arm64/cavium/thunder_pcie_pem_fdt.c Tue May 10 15:04:24 2016 (r299369) +++ head/sys/arm64/cavium/thunder_pcie_pem_fdt.c Tue May 10 15:45:59 2016 (r299370) @@ -51,15 +51,32 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include "thunder_pcie_common.h" #include "thunder_pcie_pem.h" +#include "pcib_if.h" + static int thunder_pem_fdt_probe(device_t); +static int thunder_pem_fdt_alloc_msix(device_t, device_t, int *); +static int thunder_pem_fdt_release_msix(device_t, device_t, int); +static int thunder_pem_fdt_alloc_msi(device_t, device_t, int, int, int *); +static int thunder_pem_fdt_release_msi(device_t, device_t, int, int *); +static int thunder_pem_fdt_map_msi(device_t, device_t, int, uint64_t *, + uint32_t *); static device_method_t thunder_pem_fdt_methods[] = { /* Device interface */ DEVMETHOD(device_probe, thunder_pem_fdt_probe), + /* pcib interface */ + DEVMETHOD(pcib_alloc_msix, thunder_pem_fdt_alloc_msix), + DEVMETHOD(pcib_release_msix, thunder_pem_fdt_release_msix), + DEVMETHOD(pcib_alloc_msi, thunder_pem_fdt_alloc_msi), + DEVMETHOD(pcib_release_msi, thunder_pem_fdt_release_msi), + DEVMETHOD(pcib_map_msi, thunder_pem_fdt_map_msi), + /* End */ DEVMETHOD_END }; @@ -88,3 +105,40 @@ thunder_pem_fdt_probe(device_t dev) return (ENXIO); } + +static int +thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int maxcount, + int *irqs) +{ + + return (arm_alloc_msi(pci, child, count, maxcount, irqs)); +} + +static int +thunder_pem_fdt_release_msi(device_t pci, device_t child, int count, int *irqs) +{ + + return (arm_release_msi(pci, child, count, irqs)); +} + +static int +thunder_pem_fdt_alloc_msix(device_t pci, device_t child, int *irq) +{ + + return (arm_alloc_msix(pci, child, irq)); +} + +static int +thunder_pem_fdt_release_msix(device_t pci, device_t child, int irq) +{ + + return (arm_release_msix(pci, child, irq)); +} + +static int +thunder_pem_fdt_map_msi(device_t pci, device_t child, int irq, uint64_t *addr, + uint32_t *data) +{ + + return (arm_map_msi(pci, child, irq, addr, data)); +}