Module Name:    src
Committed By:   cegger
Date:           Tue May  5 09:51:24 UTC 2009

Modified Files:
        src/sys/arch/i386/isa: ahc_isa.c
        src/sys/dev/cardbus: ahc_cardbus.c
        src/sys/dev/eisa: ahc_eisa.c
        src/sys/dev/ic: aic7xxx_osm.c aic7xxx_osm.h aic7xxxvar.h
        src/sys/dev/pci: ahc_pci.c

Log Message:
device_t/softc split


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/i386/isa/ahc_isa.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/cardbus/ahc_cardbus.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/eisa/ahc_eisa.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/ic/aic7xxx_osm.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ic/aic7xxx_osm.h
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/ic/aic7xxxvar.h
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/pci/ahc_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/isa/ahc_isa.c
diff -u src/sys/arch/i386/isa/ahc_isa.c:1.36 src/sys/arch/i386/isa/ahc_isa.c:1.37
--- src/sys/arch/i386/isa/ahc_isa.c:1.36	Mon May  4 12:14:31 2009
+++ src/sys/arch/i386/isa/ahc_isa.c	Tue May  5 09:51:23 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahc_isa.c,v 1.36 2009/05/04 12:14:31 cegger Exp $	*/
+/*	$NetBSD: ahc_isa.c,v 1.37 2009/05/05 09:51:23 cegger Exp $	*/
 
 /*
  * Product specific probe and attach routines for:
@@ -110,7 +110,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahc_isa.c,v 1.36 2009/05/04 12:14:31 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahc_isa.c,v 1.37 2009/05/05 09:51:23 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -167,7 +167,7 @@
 void	aha2840_load_seeprom(struct ahc_softc *ahc);
 static int verify_seeprom_cksum(struct seeprom_config *sc);
 
-CFATTACH_DECL(ahc_isa, sizeof(struct ahc_softc),
+CFATTACH_DECL_NEW(ahc_isa, sizeof(struct ahc_softc),
     ahc_isa_probe, ahc_isa_attach, NULL, NULL);
 
 /*
@@ -371,6 +371,7 @@
 	char idstring[EISA_IDSTRINGLEN];
 	u_char intdef;
 
+	ahc->sc_dev = self;
 	aprint_naive(": SCSI controller\n");
 
 	if (bus_space_map(iot, ia->ia_io[0].ir_addr, ia->ia_io[0].ir_size,
@@ -402,7 +403,7 @@
 	 */
 	ahc->sc_dmaflags = ISABUS_DMA_32BIT;
 
-	ahc_set_name(ahc, device_xname(&ahc->sc_dev));
+	ahc_set_name(ahc, device_xname(ahc->sc_dev));
 	ahc->parent_dmat = ia->ia_dmat;
 	ahc->channel = 'A';
 	ahc->chip =  AHC_AIC7770|AHC_VL;
@@ -432,7 +433,7 @@
 	ahc->ih = isa_intr_establish(ia->ia_ic, irq,
 	    intrtype, IPL_BIO, ahc_intr, ahc);
 	if (ahc->ih == NULL) {
-		aprint_error_dev(&ahc->sc_dev, "couldn't establish %s interrupt\n",
+		aprint_error_dev(ahc->sc_dev, "couldn't establish %s interrupt\n",
 		       intrtypestr);
 		goto free_io;
 	}
@@ -442,7 +443,7 @@
 	 * usefull for debugging irq problems
 	 */
 	if (bootverbose) {
-		aprint_verbose_dev(&ahc->sc_dev, "Using %s interrupts\n",
+		aprint_verbose_dev(ahc->sc_dev, "Using %s interrupts\n",
 		       intrtypestr);
 	}
 

Index: src/sys/dev/cardbus/ahc_cardbus.c
diff -u src/sys/dev/cardbus/ahc_cardbus.c:1.26 src/sys/dev/cardbus/ahc_cardbus.c:1.27
--- src/sys/dev/cardbus/ahc_cardbus.c:1.26	Sat Mar 14 15:36:16 2009
+++ src/sys/dev/cardbus/ahc_cardbus.c	Tue May  5 09:51:23 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahc_cardbus.c,v 1.26 2009/03/14 15:36:16 dsl Exp $	*/
+/*	$NetBSD: ahc_cardbus.c,v 1.27 2009/05/05 09:51:23 cegger Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2005 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahc_cardbus.c,v 1.26 2009/03/14 15:36:16 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahc_cardbus.c,v 1.27 2009/05/05 09:51:23 cegger Exp $");
 
 #include "opt_ahc_cardbus.h"
 
@@ -85,17 +85,16 @@
 	bus_size_t sc_size;
 };
 
-int	ahc_cardbus_match(struct device *, struct cfdata *, void *);
-void	ahc_cardbus_attach(struct device *, struct device *, void *);
-int	ahc_cardbus_detach(struct device *, int);
-int	ahc_activate(struct device *self, enum devact act);
+int	ahc_cardbus_match(device_t, cfdata_t, void *);
+void	ahc_cardbus_attach(device_t, device_t, void *);
+int	ahc_cardbus_detach(device_t, int);
+int	ahc_activate(device_t self, enum devact act);
 
-CFATTACH_DECL(ahc_cardbus, sizeof(struct ahc_cardbus_softc),
+CFATTACH_DECL_NEW(ahc_cardbus, sizeof(struct ahc_cardbus_softc),
     ahc_cardbus_match, ahc_cardbus_attach, ahc_cardbus_detach, ahc_activate);
 
 int
-ahc_cardbus_match(struct device *parent, struct cfdata *match,
-    void *aux)
+ahc_cardbus_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct cardbus_attach_args *ca = aux;
 
@@ -107,8 +106,7 @@
 }
 
 void
-ahc_cardbus_attach(struct device *parent, struct device *self,
-    void *aux)
+ahc_cardbus_attach(device_t parent, device_t self, void *aux)
 {
 	struct cardbus_attach_args *ca = aux;
 	struct ahc_cardbus_softc *csc = device_private(self);
@@ -123,6 +121,7 @@
 	u_char sblkctl;
 
 
+	ahc->sc_dev = self;
 	csc->sc_ct = ct;
 	csc->sc_tag = ca->ca_tag;
 	csc->sc_intrline = ca->ca_intrline;
@@ -169,7 +168,7 @@
 		cardbus_conf_write(cc, cf, ca->ca_tag, PCI_BHLC_REG, reg);
 	}
 
-	ahc_set_name(ahc, device_xname(&ahc->sc_dev));
+	ahc_set_name(ahc, device_xname(ahc->sc_dev));
 
 	ahc->parent_dmat = ca->ca_dmat;
 	ahc->tag = bst;
@@ -257,7 +256,7 @@
 }
 
 int
-ahc_cardbus_detach(struct device *self, int flags)
+ahc_cardbus_detach(device_t self, int flags)
 {
 	struct ahc_cardbus_softc *csc = device_private(self);
 	struct ahc_softc *ahc = &csc->sc_ahc;
@@ -289,9 +288,9 @@
 
 
 int
-ahc_activate(struct device *self, enum devact act)
+ahc_activate(device_t self, enum devact act)
 {
-	struct ahc_cardbus_softc *csc = (void*)self;
+	struct ahc_cardbus_softc *csc = device_private(self);
 	struct ahc_softc *ahc = &csc->sc_ahc;
 	int s, rv = 0;
 

Index: src/sys/dev/eisa/ahc_eisa.c
diff -u src/sys/dev/eisa/ahc_eisa.c:1.36 src/sys/dev/eisa/ahc_eisa.c:1.37
--- src/sys/dev/eisa/ahc_eisa.c:1.36	Sun Apr  6 08:54:43 2008
+++ src/sys/dev/eisa/ahc_eisa.c	Tue May  5 09:51:23 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahc_eisa.c,v 1.36 2008/04/06 08:54:43 cegger Exp $	*/
+/*	$NetBSD: ahc_eisa.c,v 1.37 2009/05/05 09:51:23 cegger Exp $	*/
 
 /*
  * Product specific probe and attach routines for:
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahc_eisa.c,v 1.36 2008/04/06 08:54:43 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahc_eisa.c,v 1.37 2009/05/05 09:51:23 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -56,11 +56,11 @@
 #include <dev/ic/aic77xxreg.h>
 #include <dev/ic/aic77xxvar.h>
 
-static int	ahc_eisa_match(struct device *, struct cfdata *, void *);
-static void	ahc_eisa_attach(struct device *, struct device *, void *);
+static int	ahc_eisa_match(device_t, cfdata_t, void *);
+static void	ahc_eisa_attach(device_t, device_t, void *);
 
 
-CFATTACH_DECL(ahc_eisa, sizeof(struct ahc_softc),
+CFATTACH_DECL_NEW(ahc_eisa, sizeof(struct ahc_softc),
     ahc_eisa_match, ahc_eisa_attach, NULL, NULL);
 
 /*
@@ -69,8 +69,7 @@
  * the actual probe routine to check it out.
  */
 static int
-ahc_eisa_match(struct device *parent, struct cfdata *match,
-    void *aux)
+ahc_eisa_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct eisa_attach_args *ea = aux;
 	bus_space_tag_t iot = ea->ea_iot;
@@ -94,7 +93,7 @@
 }
 
 static void
-ahc_eisa_attach(struct device *parent, struct device *self, void *aux)
+ahc_eisa_attach(device_t parent, device_t self, void *aux)
 {
 	struct ahc_softc *ahc = device_private(self);
 	struct eisa_attach_args *ea = aux;
@@ -112,13 +111,15 @@
 	int i;
 #endif
 
+	ahc->sc_dev = self;
+
 	if (bus_space_map(iot, EISA_SLOT_ADDR(ea->ea_slot) +
 	    AHC_EISA_SLOT_OFFSET, AHC_EISA_IOSIZE, 0, &ioh)) {
-		aprint_error_dev(&ahc->sc_dev, "could not map I/O addresses");
+		aprint_error_dev(ahc->sc_dev, "could not map I/O addresses");
 		return;
 	}
 	if ((irq = ahc_aic77xx_irq(iot, ioh)) < 0) {
-		aprint_error_dev(&ahc->sc_dev, "ahc_aic77xx_irq failed!");
+		aprint_error_dev(ahc->sc_dev, "ahc_aic77xx_irq failed!");
 		goto free_io;
 	}
 
@@ -131,7 +132,7 @@
 		goto free_io;
 	}
 
-	ahc_set_name(ahc, device_xname(&ahc->sc_dev));
+	ahc_set_name(ahc, device_xname(ahc->sc_dev));
 	ahc->parent_dmat = ea->ea_dmat;
 	ahc->chip = AHC_AIC7770|AHC_EISA;
 	ahc->features = AHC_AIC7770_FE;
@@ -150,7 +151,7 @@
 		goto free_io;
 
 	if (eisa_intr_map(ec, irq, &ih)) {
-		aprint_error_dev(&ahc->sc_dev, "couldn't map interrupt (%d)\n",
+		aprint_error_dev(ahc->sc_dev, "couldn't map interrupt (%d)\n",
 		    irq);
 		goto free_io;
 	}
@@ -168,7 +169,7 @@
 	ahc->ih = eisa_intr_establish(ec, ih,
 	    intrtype, IPL_BIO, ahc_intr, ahc);
 	if (ahc->ih == NULL) {
-		aprint_error_dev(&ahc->sc_dev, "couldn't establish %s interrupt",
+		aprint_error_dev(ahc->sc_dev, "couldn't establish %s interrupt",
 		    intrtypestr);
 		if (intrstr != NULL)
 			printf(" at %s", intrstr);
@@ -176,7 +177,7 @@
 		goto free_io;
 	}
 	if (intrstr != NULL)
-		printf("%s: %s interrupting at %s\n", device_xname(&ahc->sc_dev),
+		printf("%s: %s interrupting at %s\n", device_xname(ahc->sc_dev),
 		       intrtypestr, intrstr);
 
 	/*

Index: src/sys/dev/ic/aic7xxx_osm.c
diff -u src/sys/dev/ic/aic7xxx_osm.c:1.27 src/sys/dev/ic/aic7xxx_osm.c:1.28
--- src/sys/dev/ic/aic7xxx_osm.c:1.27	Tue Apr  8 12:07:25 2008
+++ src/sys/dev/ic/aic7xxx_osm.c	Tue May  5 09:51:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: aic7xxx_osm.c,v 1.27 2008/04/08 12:07:25 cegger Exp $	*/
+/*	$NetBSD: aic7xxx_osm.c,v 1.28 2009/05/05 09:51:24 cegger Exp $	*/
 
 /*
  * Bus independent FreeBSD shim for the aic7xxx based adaptec SCSI controllers
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aic7xxx_osm.c,v 1.27 2008/04/08 12:07:25 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic7xxx_osm.c,v 1.28 2009/05/05 09:51:24 cegger Exp $");
 
 #include <dev/ic/aic7xxx_osm.h>
 #include <dev/ic/aic7xxx_inline.h>
@@ -76,7 +76,7 @@
 
 	ahc_lock(ahc, &s);
 
-	ahc->sc_adapter.adapt_dev = &ahc->sc_dev;
+	ahc->sc_adapter.adapt_dev = ahc->sc_dev;
 	ahc->sc_adapter.adapt_nchannels = (ahc->features & AHC_TWIN) ? 2 : 1;
 
 	ahc->sc_adapter.adapt_openings = ahc->scb_data->numscbs - 1;
@@ -101,19 +101,19 @@
 	}
 
 	ahc_controller_info(ahc, ahc_info, sizeof(ahc_info));
-	printf("%s: %s\n", device_xname(&ahc->sc_dev), ahc_info);
+	printf("%s: %s\n", device_xname(ahc->sc_dev), ahc_info);
 
 	if ((ahc->flags & AHC_PRIMARY_CHANNEL) == 0) {
-		ahc->sc_child = config_found((void *)&ahc->sc_dev,
+		ahc->sc_child = config_found(ahc->sc_dev,
 		    &ahc->sc_channel, scsiprint);
 		if (ahc->features & AHC_TWIN)
-			ahc->sc_child_b = config_found((void *)&ahc->sc_dev,
+			ahc->sc_child_b = config_found(ahc->sc_dev,
 			    &ahc->sc_channel_b, scsiprint);
 	} else {
 		if (ahc->features & AHC_TWIN)
-			ahc->sc_child = config_found((void *)&ahc->sc_dev,
+			ahc->sc_child = config_found(ahc->sc_dev,
 			    &ahc->sc_channel_b, scsiprint);
-		ahc->sc_child_b = config_found((void *)&ahc->sc_dev,
+		ahc->sc_child_b = config_found(ahc->sc_dev,
 		    &ahc->sc_channel, scsiprint);
 	}
 

Index: src/sys/dev/ic/aic7xxx_osm.h
diff -u src/sys/dev/ic/aic7xxx_osm.h:1.21 src/sys/dev/ic/aic7xxx_osm.h:1.22
--- src/sys/dev/ic/aic7xxx_osm.h:1.21	Sun Mar 15 15:52:12 2009
+++ src/sys/dev/ic/aic7xxx_osm.h	Tue May  5 09:51:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: aic7xxx_osm.h,v 1.21 2009/03/15 15:52:12 cegger Exp $	*/
+/*	$NetBSD: aic7xxx_osm.h,v 1.22 2009/05/05 09:51:24 cegger Exp $	*/
 
 /*
  * NetBSD platform specific driver option settings, data structures,
@@ -508,7 +508,7 @@
 static __inline void
 ahc_print_path(struct ahc_softc *ahc, struct scb *scb)
 {
-	printf("%s:", device_xname(&ahc->sc_dev));
+	printf("%s:", device_xname(ahc->sc_dev));
 }
 
 static __inline void

Index: src/sys/dev/ic/aic7xxxvar.h
diff -u src/sys/dev/ic/aic7xxxvar.h:1.55 src/sys/dev/ic/aic7xxxvar.h:1.56
--- src/sys/dev/ic/aic7xxxvar.h:1.55	Mon Feb 11 21:43:46 2008
+++ src/sys/dev/ic/aic7xxxvar.h	Tue May  5 09:51:24 2009
@@ -37,7 +37,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: aic7xxxvar.h,v 1.55 2008/02/11 21:43:46 dyoung Exp $
+ * $Id: aic7xxxvar.h,v 1.56 2009/05/05 09:51:24 cegger Exp $
  *
  * $FreeBSD: /repoman/r/ncvs/src/sys/dev/aic7xxx/aic7xxx.h,v 1.44 2003/01/20 20:44:55 gibbs Exp $
  */
@@ -1020,7 +1020,7 @@
 typedef void ahc_callback_t (void *);
 
 struct ahc_softc {
-	struct device 		  sc_dev;
+	device_t 		  sc_dev;
 
 	struct scsipi_channel	  sc_channel;
 	struct scsipi_channel 	  sc_channel_b;

Index: src/sys/dev/pci/ahc_pci.c
diff -u src/sys/dev/pci/ahc_pci.c:1.64 src/sys/dev/pci/ahc_pci.c:1.65
--- src/sys/dev/pci/ahc_pci.c:1.64	Sat Jan  3 03:43:22 2009
+++ src/sys/dev/pci/ahc_pci.c	Tue May  5 09:51:24 2009
@@ -39,7 +39,7 @@
  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGES.
  *
- * $Id: ahc_pci.c,v 1.64 2009/01/03 03:43:22 yamt Exp $
+ * $Id: ahc_pci.c,v 1.65 2009/05/05 09:51:24 cegger Exp $
  *
  * //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#57 $
  *
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahc_pci.c,v 1.64 2009/01/03 03:43:22 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahc_pci.c,v 1.65 2009/05/05 09:51:24 cegger Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -784,7 +784,8 @@
 	struct ahc_pci_busdata *bd;
 	bool               override_ultra;
 
-	ahc_set_name(ahc, device_xname(&ahc->sc_dev));
+	ahc->sc_dev = self;
+	ahc_set_name(ahc, device_xname(ahc->sc_dev));
 	ahc->parent_dmat = pa->pa_dmat;
 
 	command = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
@@ -956,7 +957,7 @@
 	intrstr = pci_intr_string(pa->pa_pc, ih);
 	ahc->ih = pci_intr_establish(pa->pa_pc, ih, IPL_BIO, ahc_intr, ahc);
 	if (ahc->ih == NULL) {
-		aprint_error_dev(&ahc->sc_dev,
+		aprint_error_dev(ahc->sc_dev,
 		    "couldn't establish interrupt\n");
 		if (intrstr != NULL)
 			printf(" at %s", intrstr);
@@ -1062,7 +1063,7 @@
 			 * property is set.
 			 */ 
 			usetd = prop_dictionary_get(
-					device_properties(&ahc->sc_dev),
+					device_properties(ahc->sc_dev),
 					"aic7xxx-use-target-defaults");
 			if (usetd != NULL) {
 				KASSERT(prop_object_type(usetd) ==
@@ -1140,7 +1141,7 @@
 #endif
 }
 
-CFATTACH_DECL(ahc_pci, sizeof(struct ahc_softc),
+CFATTACH_DECL_NEW(ahc_pci, sizeof(struct ahc_softc),
     ahc_pci_probe, ahc_pci_attach, NULL, NULL);
 
 static int
@@ -1748,7 +1749,7 @@
 static int
 ahc_raid_setup(struct ahc_softc *ahc)
 {
-	aprint_normal_dev(&ahc->sc_dev, "RAID functionality unsupported\n");
+	aprint_normal_dev(ahc->sc_dev, "RAID functionality unsupported\n");
 	return (ENXIO);
 }
 

Reply via email to