From owner-svn-src-head@freebsd.org Wed Dec 2 14:22:59 2015 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 95A7DA3F634; Wed, 2 Dec 2015 14:22:59 +0000 (UTC) (envelope-from mmel@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 634F0145A; Wed, 2 Dec 2015 14:22:59 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tB2EMwGw002463; Wed, 2 Dec 2015 14:22:58 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tB2EMwkB002462; Wed, 2 Dec 2015 14:22:58 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201512021422.tB2EMwkB002462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 2 Dec 2015 14:22:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r291649 - head/sys/arm/arm 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.20 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, 02 Dec 2015 14:22:59 -0000 Author: mmel Date: Wed Dec 2 14:22:58 2015 New Revision: 291649 URL: https://svnweb.freebsd.org/changeset/base/291649 Log: ARM: Fix of detection of root interrupt controller. This fixes detection of root interrupt controller for cases, when interrupt parent is not defined at all or it's not defined directly in controller node. Approved by: kib (mentor) Modified: head/sys/arm/arm/gic.c Modified: head/sys/arm/arm/gic.c ============================================================================== --- head/sys/arm/arm/gic.c Wed Dec 2 14:21:16 2015 (r291648) +++ head/sys/arm/arm/gic.c Wed Dec 2 14:22:58 2015 (r291649) @@ -461,9 +461,13 @@ arm_gic_attach(device_t dev) goto cleanup; } - i = OF_getencprop(ofw_bus_get_node(dev), "interrupt-parent", - &pxref, sizeof(pxref)); - if (i > 0 && xref == pxref) { + /* + * Controller is root if: + * - doesn't have interrupt parent + * - his interrupt parent is this controller + */ + pxref = ofw_bus_find_iparent(ofw_bus_get_node(dev)); + if (pxref == 0 || xref == pxref) { if (arm_pic_claim_root(dev, xref, arm_gic_intr, sc, GIC_LAST_SGI - GIC_FIRST_SGI + 1) != 0) { device_printf(dev, "could not set PIC as a root\n"); @@ -471,6 +475,12 @@ arm_gic_attach(device_t dev) goto cleanup; } } else { + if (sc->gic_res[2] == NULL) { + device_printf(dev, + "not root PIC must have defined interrupt\n"); + arm_pic_unregister(dev, xref); + goto cleanup; + } if (bus_setup_intr(dev, sc->gic_res[2], INTR_TYPE_CLK, arm_gic_intr, NULL, sc, &sc->gic_intrhand)) { device_printf(dev, "could not setup irq handler\n");