From owner-svn-src-all@FreeBSD.ORG Sun Dec 21 16:35:43 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6CB2025F; Sun, 21 Dec 2014 16:35:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 590C2305F; Sun, 21 Dec 2014 16:35:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBLGZhf4019647; Sun, 21 Dec 2014 16:35:43 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBLGZhYb019646; Sun, 21 Dec 2014 16:35:43 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201412211635.sBLGZhYb019646@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 21 Dec 2014 16:35:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r276017 - head/sys/arm/broadcom/bcm2835 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.18-1 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, 21 Dec 2014 16:35:43 -0000 Author: andrew Date: Sun Dec 21 16:35:42 2014 New Revision: 276017 URL: https://svnweb.freebsd.org/changeset/base/276017 Log: Reduce the diff between head and arm_intrng with the bcm2835 interrupt controller. Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_intr.c Sun Dec 21 16:32:57 2014 (r276016) +++ head/sys/arm/broadcom/bcm2835/bcm2835_intr.c Sun Dec 21 16:35:42 2014 (r276017) @@ -83,10 +83,10 @@ struct bcm_intc_softc { static struct bcm_intc_softc *bcm_intc_sc = NULL; -#define intc_read_4(reg) \ - bus_space_read_4(bcm_intc_sc->intc_bst, bcm_intc_sc->intc_bsh, reg) -#define intc_write_4(reg, val) \ - bus_space_write_4(bcm_intc_sc->intc_bst, bcm_intc_sc->intc_bsh, reg, val) +#define intc_read_4(_sc, reg) \ + bus_space_read_4((_sc)->intc_bst, (_sc)->intc_bsh, (reg)) +#define intc_write_4(_sc, reg, val) \ + bus_space_write_4((_sc)->intc_bst, (_sc)->intc_bsh, (reg), (val)) static int bcm_intc_probe(device_t dev) @@ -145,6 +145,7 @@ DRIVER_MODULE(intc, simplebus, bcm_intc_ int arm_get_next_irq(int last_irq) { + struct bcm_intc_softc *sc = bcm_intc_sc; uint32_t pending; int32_t irq = last_irq + 1; @@ -154,7 +155,7 @@ arm_get_next_irq(int last_irq) /* TODO: should we mask last_irq? */ if (irq < BANK1_START) { - pending = intc_read_4(INTC_PENDING_BASIC); + pending = intc_read_4(sc, INTC_PENDING_BASIC); if ((pending & 0xFF) == 0) { irq = BANK1_START; /* skip to next bank */ } else do { @@ -164,7 +165,7 @@ arm_get_next_irq(int last_irq) } while (irq < BANK1_START); } if (irq < BANK2_START) { - pending = intc_read_4(INTC_PENDING_BANK1); + pending = intc_read_4(sc, INTC_PENDING_BANK1); if (pending == 0) { irq = BANK2_START; /* skip to next bank */ } else do { @@ -174,7 +175,7 @@ arm_get_next_irq(int last_irq) } while (irq < BANK2_START); } if (irq < BANK3_START) { - pending = intc_read_4(INTC_PENDING_BANK2); + pending = intc_read_4(sc, INTC_PENDING_BANK2); if (pending != 0) do { if (pending & (1 << IRQ_BANK2(irq))) return irq; @@ -187,14 +188,15 @@ arm_get_next_irq(int last_irq) void arm_mask_irq(uintptr_t nb) { + struct bcm_intc_softc *sc = bcm_intc_sc; dprintf("%s: %d\n", __func__, nb); if (IS_IRQ_BASIC(nb)) - intc_write_4(INTC_DISABLE_BASIC, (1 << nb)); + intc_write_4(sc, INTC_DISABLE_BASIC, (1 << nb)); else if (IS_IRQ_BANK1(nb)) - intc_write_4(INTC_DISABLE_BANK1, (1 << IRQ_BANK1(nb))); + intc_write_4(sc, INTC_DISABLE_BANK1, (1 << IRQ_BANK1(nb))); else if (IS_IRQ_BANK2(nb)) - intc_write_4(INTC_DISABLE_BANK2, (1 << IRQ_BANK2(nb))); + intc_write_4(sc, INTC_DISABLE_BANK2, (1 << IRQ_BANK2(nb))); else printf("arm_mask_irq: Invalid IRQ number: %d\n", nb); } @@ -202,14 +204,15 @@ arm_mask_irq(uintptr_t nb) void arm_unmask_irq(uintptr_t nb) { + struct bcm_intc_softc *sc = bcm_intc_sc; dprintf("%s: %d\n", __func__, nb); if (IS_IRQ_BASIC(nb)) - intc_write_4(INTC_ENABLE_BASIC, (1 << nb)); + intc_write_4(sc, INTC_ENABLE_BASIC, (1 << nb)); else if (IS_IRQ_BANK1(nb)) - intc_write_4(INTC_ENABLE_BANK1, (1 << IRQ_BANK1(nb))); + intc_write_4(sc, INTC_ENABLE_BANK1, (1 << IRQ_BANK1(nb))); else if (IS_IRQ_BANK2(nb)) - intc_write_4(INTC_ENABLE_BANK2, (1 << IRQ_BANK2(nb))); + intc_write_4(sc, INTC_ENABLE_BANK2, (1 << IRQ_BANK2(nb))); else printf("arm_mask_irq: Invalid IRQ number: %d\n", nb); }