Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Apr 2004 22:17:23 -0800 (PST)
From:      Scott Long <scottl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 50169 for review
Message-ID:  <200404020617.i326HNfC083224@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=50169

Change 50169 by scottl@scottl-esp-sparc64 on 2004/04/01 22:16:27

	Start out with some mechanical changes.  Remove __P, reference
	headers in the right spot, remove the need for the dma engine to
	have it's own attachment, block out some code that likely need to
	go away.

Affected files ...

.. //depot/projects/scottl-esp/src/sys/dev/esp/esp_sbus.c#2 edit
.. //depot/projects/scottl-esp/src/sys/dev/esp/lsi64854.c#2 edit
.. //depot/projects/scottl-esp/src/sys/dev/esp/lsi64854var.h#2 edit
.. //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9xvar.h#2 edit

Differences ...

==== //depot/projects/scottl-esp/src/sys/dev/esp/esp_sbus.c#2 (text+ko) ====

@@ -46,28 +46,28 @@
 #include <sys/buf.h>
 #include <sys/malloc.h>
 
-#include <dev/scsipi/scsi_all.h>
-#include <dev/scsipi/scsipi_all.h>
-#include <dev/scsipi/scsiconf.h>
-#include <dev/scsipi/scsi_message.h>
+#include <cam/cam.h>
+#include <cam/cam_ccb.h>
+#include <cam/scsi/scsi_all.h>
 
 #include <machine/bus.h>
-#include <machine/intr.h>
-#include <machine/autoconf.h>
+#include <machine/resource.h>
 
-#include <dev/ic/lsi64854reg.h>
-#include <dev/ic/lsi64854var.h>
+#include <dev/esp/lsi64854reg.h>
+#include <dev/esp/lsi64854var.h>
 
-#include <dev/ic/ncr53c9xreg.h>
-#include <dev/ic/ncr53c9xvar.h>
+#include <dev/esp/ncr53c9xreg.h>
+#include <dev/esp/ncr53c9xvar.h>
 
-#include <dev/sbus/sbusvar.h>
+#include <sparc64/sbus/sbusvar.h>
 
 /* #define ESP_SBUS_DEBUG */
 
 struct esp_softc {
 	struct ncr53c9x_softc sc_ncr53c9x;	/* glue to MI code */
+#if 0
 	struct sbusdev	sc_sd;			/* sbus device */
+#endif
 
 	bus_space_tag_t	sc_bustag;
 	bus_dma_tag_t	sc_dmatag;
@@ -78,9 +78,9 @@
 	int	sc_pri;				/* SBUS priority */
 };
 
-void	espattach_sbus	__P((struct device *, struct device *, void *));
-void	espattach_dma	__P((struct device *, struct device *, void *));
-int	espmatch_sbus	__P((struct device *, struct cfdata *, void *));
+void	espattach_sbus(struct device *, struct device *, void *);
+void	espattach_dma(struct device *, struct device *, void *);
+int	espmatch_sbus(struct device *, struct cfdata *, void *);
 
 
 CFATTACH_DECL(esp_sbus, sizeof(struct esp_softc),
@@ -92,18 +92,18 @@
 /*
  * Functions and the switch for the MI code.
  */
-static u_char	esp_read_reg __P((struct ncr53c9x_softc *, int));
-static void	esp_write_reg __P((struct ncr53c9x_softc *, int, u_char));
-static u_char	esp_rdreg1 __P((struct ncr53c9x_softc *, int));
-static void	esp_wrreg1 __P((struct ncr53c9x_softc *, int, u_char));
-static int	esp_dma_isintr __P((struct ncr53c9x_softc *));
-static void	esp_dma_reset __P((struct ncr53c9x_softc *));
-static int	esp_dma_intr __P((struct ncr53c9x_softc *));
-static int	esp_dma_setup __P((struct ncr53c9x_softc *, caddr_t *,
-				    size_t *, int, size_t *));
-static void	esp_dma_go __P((struct ncr53c9x_softc *));
-static void	esp_dma_stop __P((struct ncr53c9x_softc *));
-static int	esp_dma_isactive __P((struct ncr53c9x_softc *));
+static u_char	esp_read_reg(struct ncr53c9x_softc *, int);
+static void	esp_write_reg(struct ncr53c9x_softc *, int, u_char);
+static u_char	esp_rdreg1(struct ncr53c9x_softc *, int);
+static void	esp_wrreg1(struct ncr53c9x_softc *, int, u_char);
+static int	esp_dma_isintr(struct ncr53c9x_softc *);
+static void	esp_dma_reset(struct ncr53c9x_softc *);
+static int	esp_dma_intr(struct ncr53c9x_softc *);
+static int	esp_dma_setup(struct ncr53c9x_softc *, caddr_t *, size_t *,
+			      int, size_t *);
+static void	esp_dma_go(struct ncr53c9x_softc *);
+static void	esp_dma_stop(struct ncr53c9x_softc *);
+static int	esp_dma_isactive(struct ncr53c9x_softc *);
 
 static struct ncr53c9x_glue esp_sbus_glue = {
 	esp_read_reg,
@@ -131,7 +131,7 @@
 	NULL,			/* gl_clear_latched_intr */
 };
 
-static void	espattach __P((struct esp_softc *, struct ncr53c9x_glue *));
+static void	espattach(struct esp_softc *, struct ncr53c9x_glue *);
 
 int
 espmatch_sbus(parent, cf, aux)
@@ -278,9 +278,11 @@
 
 		esc->sc_pri = sa->sa_pri;
 
+#if 0
 		/* add me to the sbus structures */
 		esc->sc_sd.sd_reset = (void *) ncr53c9x_reset;
 		sbus_establish(&esc->sc_sd, &sc->sc_dev);
+#endif
 
 		espattach(esc, &esp_sbus_glue);
 
@@ -344,9 +346,11 @@
 
 	esc->sc_pri = sa->sa_pri;
 
+#if 0
 	/* add me to the sbus structures */
 	esc->sc_sd.sd_reset = (void *) ncr53c9x_reset;
 	sbus_establish(&esc->sc_sd, &sc->sc_dev);
+#endif
 
 	if (strcmp("ptscII", sa->sa_name) == 0) {
 		espattach(esc, &esp_sbus_glue1);
@@ -405,9 +409,11 @@
 
 	esc->sc_pri = sa->sa_pri;
 
+#if 0
 	/* Assume SBus is grandparent */
 	esc->sc_sd.sd_reset = (void *) ncr53c9x_reset;
 	sbus_establish(&esc->sc_sd, parent);
+#endif
 
 	espattach(esc, &esp_sbus_glue);
 }
@@ -721,7 +727,7 @@
 #include <machine/db_machdep.h>
 #include <ddb/db_output.h>
 
-void db_esp __P((db_expr_t, int, db_expr_t, char*));
+void db_esp(db_expr_t, int, db_expr_t, char*);
 
 void
 db_esp(addr, have_addr, count, modif)

==== //depot/projects/scottl-esp/src/sys/dev/esp/lsi64854.c#2 (text+ko) ====

@@ -62,11 +62,11 @@
 #include <dev/ic/ncr53c9xreg.h>
 #include <dev/ic/ncr53c9xvar.h>
 
-void	lsi64854_reset	__P((struct lsi64854_softc *));
-int	lsi64854_setup	__P((struct lsi64854_softc *, caddr_t *, size_t *,
-			     int, size_t *));
-int	lsi64854_setup_pp __P((struct lsi64854_softc *, caddr_t *, size_t *,
-			     int, size_t *));
+void	lsi64854_reset(struct lsi64854_softc *);
+int	lsi64854_setup(struct lsi64854_softc *, caddr_t *, size_t *,
+			     int, size_t *);
+int	lsi64854_setup_pp(struct lsi64854_softc *, caddr_t *, size_t *,
+			     int, size_t *);
 
 #ifdef DEBUG
 #define LDB_SCSI	1
@@ -97,6 +97,8 @@
 {
 	u_int32_t csr;
 
+	sc->dv_name = device_get_nameunit(sc->sc_client);
+
 	/* Indirect functions */
 	switch (sc->sc_channel) {
 	case L64854_CHANNEL_SCSI:
@@ -110,14 +112,14 @@
 		sc->setup = lsi64854_setup_pp;
 		break;
 	default:
-		printf("%s: unknown channel\n", sc->sc_dev.dv_xname);
+		printf("%s: unknown channel\n", sc->dv_name);
 	}
 	sc->reset = lsi64854_reset;
 
 	/* Allocate a dmamap */
 	if (bus_dmamap_create(sc->sc_dmatag, MAX_DMA_SZ, 1, MAX_DMA_SZ,
 			      0, BUS_DMA_WAITOK, &sc->sc_dmamap) != 0) {
-		printf("%s: DMA map create failed\n", sc->sc_dev.dv_xname);
+		printf("%s: DMA map create failed\n", sc->dv_name);
 		return;
 	}
 
@@ -336,8 +338,7 @@
 				*sc->sc_dmaaddr, sc->sc_dmasize,
 				NULL /* kernel address */,   
 		                BUS_DMA_NOWAIT | BUS_DMA_STREAMING))
-			panic("%s: cannot allocate DVMA address",
-			      sc->sc_dev.dv_xname);
+			panic("%s: cannot allocate DVMA address", sc->dv_name);
 		bus_dmamap_sync(sc->sc_dmatag, sc->sc_dmamap, 0, sc->sc_dmasize,
 				datain
 					? BUS_DMASYNC_PREREAD
@@ -393,12 +394,12 @@
 
 	csr = L64854_GCSR(sc);
 
-	DPRINTF(LDB_SCSI, ("%s: dmaintr: addr 0x%x, csr %s\n", sc->sc_dev.dv_xname,
+	DPRINTF(LDB_SCSI, ("%s: dmaintr: addr 0x%x, csr %s\n", sc->dv_name,
 		 bus_space_read_4(sc->sc_bustag, sc->sc_regs, L64854_REG_ADDR),
 		 bitmask_snprintf(csr, DDMACSR_BITS, bits, sizeof(bits))));
 
 	if (csr & (D_ERR_PEND|D_SLAVE_ERR)) {
-		printf("%s: error: csr=%s\n", sc->sc_dev.dv_xname,
+		printf("%s: error: csr=%s\n", sc->dv_name,
 			bitmask_snprintf(csr, DDMACSR_BITS, bits,sizeof(bits)));
 		csr &= ~D_EN_DMA;	/* Stop DMA */
 		/* Invalidate the queue; SLAVE_ERR bit is write-to-clear */
@@ -468,8 +469,8 @@
 		 * if the ESP is reselected while using DMA to select
 		 * another target.  As such, don't print the warning.
 		 */
-		printf("%s: xfer (%d) > req (%d)\n",
-		    sc->sc_dev.dv_xname, trans, sc->sc_dmasize);
+		printf("%s: xfer (%d) > req (%d)\n", sc->dv_name, trans,
+		       sc->sc_dmasize);
 #endif
 		trans = sc->sc_dmasize;
 	}
@@ -523,7 +524,7 @@
 	rv = ((csr & E_INT_PEND) != 0) ? 1 : 0;
 
 	if (csr & (E_ERR_PEND|E_SLAVE_ERR)) {
-		printf("%s: error: csr=%s\n", sc->sc_dev.dv_xname,
+		printf("%s: error: csr=%s\n", sc->dv_name,
 			bitmask_snprintf(csr, EDMACSR_BITS, bits,sizeof(bits)));
 		csr &= ~L64854_EN_DMA;	/* Stop DMA */
 		/* Invalidate the queue; SLAVE_ERR bit is write-to-clear */
@@ -563,7 +564,7 @@
 	sc->sc_dmaaddr = addr;
 	sc->sc_dmalen = len;
 
-	DPRINTF(LDB_PP, ("%s: pp start %ld@%p,%d\n", sc->sc_dev.dv_xname,
+	DPRINTF(LDB_PP, ("%s: pp start %ld@%p,%d\n", sc->dv_name,
 		(long)*sc->sc_dmalen, *sc->sc_dmaaddr, datain ? 1 : 0));
 
 	/*
@@ -584,7 +585,7 @@
 				NULL /* kernel address */,   
 				    BUS_DMA_NOWAIT/*|BUS_DMA_COHERENT*/))
 			panic("%s: pp cannot allocate DVMA address",
-			      sc->sc_dev.dv_xname);
+			      sc->dv_name);
 		bus_dmamap_sync(sc->sc_dmatag, sc->sc_dmamap, 0, sc->sc_dmasize,
 				datain
 					? BUS_DMASYNC_PREREAD
@@ -632,15 +633,14 @@
 
 	csr = L64854_GCSR(sc);
 
-	DPRINTF(LDB_PP, ("%s: pp intr: addr 0x%x, csr %s\n", sc->sc_dev.dv_xname,
+	DPRINTF(LDB_PP, ("%s: pp intr: addr 0x%x, csr %s\n", sc->dv_name,
 		 bus_space_read_4(sc->sc_bustag, sc->sc_regs, L64854_REG_ADDR),
 		 bitmask_snprintf(csr, PDMACSR_BITS, bits, sizeof(bits))));
 
 	if (csr & (P_ERR_PEND|P_SLAVE_ERR)) {
 		resid = bus_space_read_4(sc->sc_bustag, sc->sc_regs,
 					 L64854_REG_CNT);
-		printf("%s: pp error: resid %d csr=%s\n", sc->sc_dev.dv_xname,
-		       resid,
+		printf("%s: pp error: resid %d csr=%s\n", sc->dv_name, resid,
 		       bitmask_snprintf(csr, PDMACSR_BITS, bits,sizeof(bits)));
 		csr &= ~P_EN_DMA;	/* Stop DMA */
 		/* Invalidate the queue; SLAVE_ERR bit is write-to-clear */

==== //depot/projects/scottl-esp/src/sys/dev/esp/lsi64854var.h#2 (text+ko) ====

@@ -37,7 +37,7 @@
  */
 
 struct lsi64854_softc {
-	struct device		sc_dev;		/* base device */
+	char			*dv_name;
 	bus_space_tag_t		sc_bustag;	/* bus tags */
 	bus_dma_tag_t		sc_dmatag;
 
@@ -53,17 +53,19 @@
 
 	int			sc_active;	/* DMA active ? */
 	bus_dmamap_t		sc_dmamap;	/* DMA map for bus_dma_* */
+#ifdef NOT_NEEDED
 	caddr_t			sc_dvmaaddr;	/* DVMA cookie */
+#endif
 	size_t			sc_dmasize;
 	caddr_t			*sc_dmaaddr;
 	size_t			*sc_dmalen;
 
-	void	(*reset) __P((struct lsi64854_softc *));/* reset routine */
-	int	(*setup) __P((struct lsi64854_softc *, caddr_t *, size_t *,
-			      int, size_t *));	/* DMA setup */
-	int	(*intr) __P((void *));		/* interrupt handler */
+	void	(*reset)(struct lsi64854_softc *);/* reset routine */
+	int	(*setup)(struct lsi64854_softc *, caddr_t *, size_t *,
+			 int, size_t *);	/* DMA setup */
+	int	(*intr)(void *);		/* interrupt handler */
 
-	int	(*sc_intrchain) __P((void *));	/* next handler in intr chain */
+	int	(*sc_intrchain)(void *);	/* next handler in intr chain */
 	void	*sc_intrchainarg;		/* arg for next intr handler */
 
 	u_int 			sc_dmactl;
@@ -101,7 +103,7 @@
 } while (0)
 
 
-void	lsi64854_attach	__P((struct lsi64854_softc *));
-int	lsi64854_scsi_intr	__P((void *));
-int	lsi64854_enet_intr	__P((void *));
-int	lsi64854_pp_intr	__P((void *));
+void	lsi64854_attach(struct lsi64854_softc *);
+int	lsi64854_scsi_intr(void *);
+int	lsi64854_enet_intr(void *);
+int	lsi64854_pp_intr(void *);

==== //depot/projects/scottl-esp/src/sys/dev/esp/ncr53c9xvar.h#2 (text+ko) ====

@@ -109,7 +109,7 @@
  */
 struct ncr53c9x_ecb {
 	TAILQ_ENTRY(ncr53c9x_ecb) chain;
-	struct scsipi_xfer *xs;	/* SCSI xfer ctrl block from above */
+	union ccb	*ccb;	/* SCSI xfer ctrl block from above */
 	int flags;
 #define	ECB_ALLOC		0x01
 #define	ECB_READY		0x02
@@ -272,8 +272,8 @@
 	struct device sc_dev;			/* us as a device */
 
 	struct evcnt sc_intrcnt;		/* intr count */
-	struct scsipi_adapter sc_adapter;	/* out scsipi adapter */
-	struct scsipi_channel sc_channel;	/* our scsipi channel */
+	struct cam_sim	*sim;			/* our scsi adapter */
+	struct cam_path	*path;			/* our scsi channel */
 	struct device *sc_child;		/* attached scsibus, if any */
 	struct callout sc_watchdog;		/* periodic timer */
 
@@ -443,12 +443,11 @@
 #define	ncr53c9x_cpb2stp(sc, cpb)	\
 	((250 * (cpb)) / (sc)->sc_freq)
 
-void	ncr53c9x_attach __P((struct ncr53c9x_softc *));
-int	ncr53c9x_detach __P((struct ncr53c9x_softc *, int));
-void	ncr53c9x_scsipi_request __P((struct scsipi_channel *chan,
-	    scsipi_adapter_req_t req, void *));
-void	ncr53c9x_reset __P((struct ncr53c9x_softc *));
-int	ncr53c9x_intr __P((void *));
-void	ncr53c9x_init __P((struct ncr53c9x_softc *, int));
+void	ncr53c9x_attach(struct ncr53c9x_softc *);
+int	ncr53c9x_detach(struct ncr53c9x_softc *, int);
+void	ncr53c9x_action(struct cam_sim *, union *);
+void	ncr53c9x_reset(struct ncr53c9x_softc *);
+int	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?200404020617.i326HNfC083224>