Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 May 2004 14:07:46 -0700 (PDT)
From:      Scott Long <scottl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 53687 for review
Message-ID:  <200405282107.i4SL7kuW065314@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405282107.i4SL7kuW065314>