From owner-svn-src-all@freebsd.org Sun Oct 18 20:37:11 2015 Return-Path: Delivered-To: svn-src-all@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 B9E61A18CD0; Sun, 18 Oct 2015 20:37:11 +0000 (UTC) (envelope-from ian@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 63848BB9; Sun, 18 Oct 2015 20:37:11 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9IKbAUA098805; Sun, 18 Oct 2015 20:37:10 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9IKbATM098803; Sun, 18 Oct 2015 20:37:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201510182037.t9IKbATM098803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 18 Oct 2015 20:37:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289548 - in head/sys/arm: arm include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Oct 2015 20:37:11 -0000 Author: ian Date: Sun Oct 18 20:37:10 2015 New Revision: 289548 URL: https://svnweb.freebsd.org/changeset/base/289548 Log: Only decode fdt data which belongs to the GIC controller. The interrupts-extended property is a list of controller-specific interrupt tuples for more than one controller. The decode routine of every PIC gets called in the pre-INTRNG code (nexus doesn't know which device instance belongs to which fdt node), so the GIC code has to check each FDT node it is asked to decode to ensure it is the owner. Because in the pre-INTRNG world there can only be one instance of a GIC, it's safe to cache the results of a positive lookup in a static variable to avoid the expensive lookups on subsequent calls. Submitted by: Svatopluk Kraus Differential Revision: https://reviews.freebsd.org/D2345 Modified: head/sys/arm/arm/gic.c head/sys/arm/include/intr.h Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Sun Oct 18 20:32:37 2015 (r289547) +++ head/sys/arm/arm/gic.c Sun Oct 18 20:37:10 2015 (r289548) @@ -36,6 +36,8 @@ __FBSDID("$FreeBSD$"); #include "opt_platform.h" +#include "opt_platform.h" + #include #include #include @@ -288,10 +290,23 @@ arm_gic_init_secondary(device_t dev) #ifndef ARM_INTRNG int -gic_decode_fdt(uint32_t iparent, uint32_t *intr, int *interrupt, +gic_decode_fdt(phandle_t iparent, pcell_t *intr, int *interrupt, int *trig, int *pol) { static u_int num_intr_cells; + static phandle_t self; + struct ofw_compat_data *ocd; + + if (self == 0) { + for (ocd = compat_data; ocd->ocd_str != NULL; ocd++) { + if (fdt_is_compatible(iparent, ocd->ocd_str)) { + self = iparent; + break; + } + } + } + if (self != iparent) + return (ENXIO); if (num_intr_cells == 0) { if (OF_searchencprop(OF_node_from_xref(iparent), Modified: head/sys/arm/include/intr.h ============================================================================== --- head/sys/arm/include/intr.h Sun Oct 18 20:32:37 2015 (r289547) +++ head/sys/arm/include/intr.h Sun Oct 18 20:37:10 2015 (r289548) @@ -179,10 +179,9 @@ extern int (*arm_config_irq)(int irq, en enum intr_polarity pol); void arm_pic_init_secondary(void); -int gic_decode_fdt(uint32_t iparentnode, uint32_t *intrcells, int *interrupt, - int *trig, int *pol); #ifdef FDT +int gic_decode_fdt(phandle_t, pcell_t *, int *, int *, int *); int arm_fdt_map_irq(phandle_t, pcell_t *, int); #endif