From owner-p4-projects@FreeBSD.ORG Sat Jun 3 19:22:51 2006 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 3127016A59A; Sat, 3 Jun 2006 19:22:51 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 33A8A16A58D for ; Sat, 3 Jun 2006 19:22:47 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id D815C43D48 for ; Sat, 3 Jun 2006 19:22:46 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k53JLAYa078239 for ; Sat, 3 Jun 2006 19:21:10 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k53JLAIk078236 for perforce@freebsd.org; Sat, 3 Jun 2006 19:21:10 GMT (envelope-from imp@freebsd.org) Date: Sat, 3 Jun 2006 19:21:10 GMT Message-Id: <200606031921.k53JLAIk078236@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 98415 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, 03 Jun 2006 19:22:58 -0000 http://perforce.freebsd.org/chv.cgi?CH=98415 Change 98415 by imp@imp_lighthouse on 2006/06/03 19:20:23 Establish pci interrupts. Affected files ... .. //depot/projects/arm/src/sys/dev/sdhc/sdhc.c#4 edit .. //depot/projects/arm/src/sys/dev/sdhc/sdhc_pci.c#8 edit .. //depot/projects/arm/src/sys/dev/sdhc/sdhcvar.h#4 edit Differences ... ==== //depot/projects/arm/src/sys/dev/sdhc/sdhc.c#4 (text+ko) ==== @@ -131,6 +131,10 @@ device_delete_child(dev, devlist[tmp]); free(devlist, M_TEMP); + if (sc->intrhand) + bus_teardown_intr(dev, sc->irq_res, sc->intrhand); + if (sc->irq_res) + bus_free_resource(dev, SYS_RES_IRQ, sc->irq_res); return (0); } ==== //depot/projects/arm/src/sys/dev/sdhc/sdhc_pci.c#8 (text+ko) ==== @@ -49,6 +49,8 @@ #include #include +static void sdhc_pci_intr(void *arg); + static int sdhc_pci_probe(device_t dev) { @@ -66,10 +68,19 @@ device_t child; struct sdhc_ivars *ivars; struct resource *res; - int i; + int i, rid, err; if (pci_get_progif(dev) == SDHC_PCI_INTERFACE_DMA) sc->flags |= SDHC_FLAG_HASDMA; + /* Map and establish the interrupt. */ + rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + if (sc->irq_res == NULL) { + device_printf(dev, "Unable to map IRQ...\n"); + goto errout; + } + for (i = SDHC_RID_MIN; i <= SDHC_RID_MAX; i += sizeof(uint32_t)) { res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &i, RF_ACTIVE); if (res == NULL) @@ -88,7 +99,24 @@ device_set_ivars(child, ivars); } - return (sdhc_attach(dev)); + err = sdhc_attach(dev); + if (err) + goto errout; + + if (bus_setup_intr(dev, sc->irq_res, INTR_TYPE_AV | INTR_MPSAFE, + sdhc_pci_intr, sc, &sc->intrhand)) { + device_printf(dev, "couldn't establish interrupt"); + goto errout; + } + return (0); +errout:; + sdhc_detach(dev); + return (ENXIO); +} + +static void +sdhc_pci_intr(void *arg) +{ } static device_method_t sdhc_pci_methods[] = { ==== //depot/projects/arm/src/sys/dev/sdhc/sdhcvar.h#4 (text+ko) ==== @@ -35,6 +35,8 @@ #define SDHC_FLAG_HASDMA 1 int nres; struct resource *res[SDHC_MAX_RES]; + struct resource *irq_res; + void *intrhand; }; struct sdhc_ivars