From owner-p4-projects@FreeBSD.ORG Sat Jul 7 12:04:19 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5DC4616A477; Sat, 7 Jul 2007 12:04:19 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2F6E816A400 for ; Sat, 7 Jul 2007 12:04:19 +0000 (UTC) (envelope-from loafier@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 1E9B313C484 for ; Sat, 7 Jul 2007 12:04:19 +0000 (UTC) (envelope-from loafier@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l67C4Jsk092235 for ; Sat, 7 Jul 2007 12:04:19 GMT (envelope-from loafier@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l67C4IVO092232 for perforce@freebsd.org; Sat, 7 Jul 2007 12:04:18 GMT (envelope-from loafier@FreeBSD.org) Date: Sat, 7 Jul 2007 12:04:18 GMT Message-Id: <200707071204.l67C4IVO092232@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to loafier@FreeBSD.org using -f From: Christopher Davis To: Perforce Change Reviews Cc: Subject: PERFORCE change 123054 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Jul 2007 12:04:19 -0000 http://perforce.freebsd.org/chv.cgi?CH=123054 Change 123054 by loafier@chrisdsoc on 2007/07/07 12:04:09 Missed one Affected files ... .. //depot/projects/soc2007/loafier_busalloc/arm/at91/at91_mci.c#2 edit Differences ... ==== //depot/projects/soc2007/loafier_busalloc/arm/at91/at91_mci.c#2 (text+ko) ==== @@ -63,14 +63,25 @@ #define BBSZ 512 +enum { + RES_IRQ, + RES_MEM, + RES_SZ +}; + +static struct resource_spec mci_res_spec[] = { + {SYS_RES_IRQ, 0, RF_ACTIVE | RF_SHARABLE}, + {SYS_RES_MEMORY, 0, RF_ACTIVE}, + {-1, 0, 0} +}; + struct at91_mci_softc { void *intrhand; /* Interrupt handle */ device_t dev; int flags; #define CMD_STARTED 1 #define STOP_STARTED 2 - struct resource *irq_res; /* IRQ resource */ - struct resource *mem_res; /* Memory resource */ + struct resource *res[RES_SZ]; /* IRQ and Memory resources */ struct mtx sc_mtx; bus_dma_tag_t dmatag; bus_dmamap_t map; @@ -86,13 +97,13 @@ static inline uint32_t RD4(struct at91_mci_softc *sc, bus_size_t off) { - return bus_read_4(sc->mem_res, off); + return bus_read_4(sc->res[RES_MEM], off); } static inline void WR4(struct at91_mci_softc *sc, bus_size_t off, uint32_t val) { - bus_write_4(sc->mem_res, off, val); + bus_write_4(sc->res[RES_MEM], off, val); } /* bus entry points */ @@ -191,7 +202,7 @@ /* * Activate the interrupt */ - err = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + err = bus_setup_intr(dev, sc->res[RES_IRQ], INTR_TYPE_MISC | INTR_MPSAFE, NULL, at91_mci_intr, sc, &sc->intrhand); if (err) { AT91_MCI_LOCK_DESTROY(sc); @@ -222,23 +233,14 @@ at91_mci_activate(device_t dev) { struct at91_mci_softc *sc; - int rid; sc = device_get_softc(dev); - rid = 0; - sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE); - if (sc->mem_res == NULL) - goto errout; - rid = 0; - sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_ACTIVE); - if (sc->irq_res == NULL) - goto errout; + if (bus_alloc_resources(dev, mci_res_spec, sc->res)) { + at91_mci_deactivate(dev); + return (ENOMEM); + } + return (0); -errout: - at91_mci_deactivate(dev); - return (ENOMEM); } static void @@ -248,18 +250,10 @@ sc = device_get_softc(dev); if (sc->intrhand) - bus_teardown_intr(dev, sc->irq_res, sc->intrhand); + bus_teardown_intr(dev, sc->res[RES_IRQ], sc->intrhand); sc->intrhand = 0; bus_generic_detach(sc->dev); - if (sc->mem_res) - bus_release_resource(dev, SYS_RES_IOPORT, - rman_get_rid(sc->mem_res), sc->mem_res); - sc->mem_res = 0; - if (sc->irq_res) - bus_release_resource(dev, SYS_RES_IRQ, - rman_get_rid(sc->irq_res), sc->irq_res); - sc->irq_res = 0; - return; + bus_release_resources(dev, mci_res_spec, sc->res); } static void