From owner-p4-projects@FreeBSD.ORG Fri May 28 14:08:03 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 400DC16A4D0; Fri, 28 May 2004 14:08:03 -0700 (PDT) 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 F0F9F16A4CE for ; Fri, 28 May 2004 14:08:02 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id B144243D2D for ; Fri, 28 May 2004 14:08:02 -0700 (PDT) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i4SL7lou065317 for ; Fri, 28 May 2004 14:07:47 -0700 (PDT) (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i4SL7kuW065314 for perforce@freebsd.org; Fri, 28 May 2004 14:07:46 -0700 (PDT) (envelope-from scottl@freebsd.org) Date: Fri, 28 May 2004 14:07:46 -0700 (PDT) Message-Id: <200405282107.i4SL7kuW065314@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to scottl@freebsd.org using -f From: Scott Long To: Perforce Change Reviews Subject: PERFORCE change 53687 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 May 2004 21:08:03 -0000 http://perforce.freebsd.org/chv.cgi?CH=53687 Change 53687 by scottl@scottl-esp-sparc64 on 2004/05/28 14:06:53 Use FreeBSD conventions for allocating an interrupt. Remove the code for negotiating the sbus burst size as that is already done but the sbus accessor. Remove other barriers to having this compile. Affected files ... .. //depot/projects/scottl-esp/src/sys/dev/esp/esp_sbus.c#7 edit .. //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#3 edit .. //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9xvar.h#4 edit Differences ... ==== //depot/projects/scottl-esp/src/sys/dev/esp/esp_sbus.c#7 (text+ko) ==== @@ -68,6 +68,7 @@ struct esp_softc { struct ncr53c9x_softc sc_ncr53c9x; /* glue to MI code */ + struct device *sc_dev; #if 0 struct sbusdev sc_sd; /* sbus device */ #endif @@ -77,6 +78,10 @@ bus_space_handle_t sc_regh; bus_space_tag_t sc_regt; + int sc_irqrid; + struct resource *sc_irqres; + void *sc_irq; + struct lsi64854_softc *sc_dma; /* pointer to my dma */ int sc_pri; /* SBUS priority */ @@ -152,8 +157,9 @@ struct ncr53c9x_softc *sc = &esc->sc_ncr53c9x; struct lsi64854_softc *lsc; phandle_t node; - int burst, sbusburst; + int burst; + esc->sc_dev = dev; node = sbus_get_node(dev); if (OF_getprop(node, "initiator-id", &sc->sc_id, sizeof(sc->sc_id)) == -1) @@ -192,31 +198,12 @@ lsc->sc_regt = rman_get_bustag(lsc->sc_res); lsc->sc_regh = rman_get_bushandle(lsc->sc_res); - /* - * XXX is this common(from bpp.c), the same in dma_sbus...etc. - * - * Get transfer burst size from PROM and plug it into the - * controller registers. This is needed on the Sun4m; do - * others need it too? - */ -#if 0 - sbusburst = ((struct sbus_softc *)parent)->sc_burst; -#endif - if (sbusburst == 0) - sbusburst = SBUS_BURST_32 - 1; /* 1->16 */ - burst = sbus_get_burstsz(dev); #if ESP_SBUS_DEBUG - printf("espattach_sbus: burst 0x%x, sbus 0x%x\n", burst, sbusburst); + printf("espattach_sbus: burst 0x%x\n", burst); #endif - if (burst == -1) - /* take SBus burst sizes */ - burst = sbusburst; - - /* Clamp at parent's burst sizes */ - burst &= sbusburst; lsc->sc_burst = (burst & SBUS_BURST_32) ? 32 : (burst & SBUS_BURST_16) ? 16 : 0; @@ -258,7 +245,6 @@ espattach(struct esp_softc *esc, struct ncr53c9x_glue *gluep) { struct ncr53c9x_softc *sc = &esc->sc_ncr53c9x; - void *icookie; unsigned int uid = 0; /* @@ -358,16 +344,23 @@ } /* Establish interrupt channel */ - icookie = bus_intr_establish(esc->sc_bustag, esc->sc_pri, IPL_BIO, - ncr53c9x_intr, sc); + esc->sc_irqrid = 0; + if ((esc->sc_irqres = bus_alloc_resource_any(esc->sc_dev, SYS_RES_IRQ, + &esc->sc_irqrid, RF_SHAREABLE|RF_ACTIVE)) == NULL) { + device_printf(esc->sc_dev, "Cannot allocate interrupt\n"); + return; + } + if (bus_setup_intr(esc->sc_dev, esc->sc_irqres, + INTR_TYPE_BIO|INTR_ENTROPY, ncr53c9x_intr, sc, &esc->sc_irq)) { + device_printf(esc->sc_dev, "Cannot set up interrupt\n"); + return; + } /* Turn on target selection using the `dma' method */ if (sc->sc_rev != NCR_VARIANT_FAS366) sc->sc_features |= NCR_F_DMASELECT; /* Do the common parts of attachment. */ - sc->sc_adapter.adapt_minphys = minphys; - sc->sc_adapter.adapt_request = ncr53c9x_scsipi_request; ncr53c9x_attach(sc); } ==== //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9x.c#3 (text+ko) ==== @@ -2059,7 +2059,7 @@ * * Most of this needs verifying. */ -int +void ncr53c9x_intr(arg) void *arg; { ==== //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9xvar.h#4 (text+ko) ==== @@ -448,7 +448,7 @@ int ncr53c9x_detach(struct ncr53c9x_softc *, int); void ncr53c9x_action(struct cam_sim *, union ccb *); void ncr53c9x_reset(struct ncr53c9x_softc *); -int ncr53c9x_intr(void *); +void ncr53c9x_intr(void *); void ncr53c9x_init(struct ncr53c9x_softc *, int); #endif /* _DEV_IC_NCR53C9XVAR_H_ */