Module Name: src Committed By: dyoung Date: Thu Jul 16 18:10:01 UTC 2009
Modified Files: src/sys/dev/ic: mfi.c mfivar.h src/sys/dev/pci: mfi_pci.c Log Message: device_t/softc split. Tested and shown to work on a Dell PowerEdge 1950. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/dev/ic/mfi.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/mfivar.h cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/mfi_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/dev/ic/mfi.c diff -u src/sys/dev/ic/mfi.c:1.25 src/sys/dev/ic/mfi.c:1.26 --- src/sys/dev/ic/mfi.c:1.25 Thu Jul 16 01:30:10 2009 +++ src/sys/dev/ic/mfi.c Thu Jul 16 18:10:00 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: mfi.c,v 1.25 2009/07/16 01:30:10 dyoung Exp $ */ +/* $NetBSD: mfi.c,v 1.26 2009/07/16 18:10:00 dyoung Exp $ */ /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <ma...@peereboom.us> @@ -17,7 +17,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.25 2009/07/16 01:30:10 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.26 2009/07/16 18:10:00 dyoung Exp $"); #include "bio.h" @@ -635,12 +635,12 @@ DNPRINTF(MFI_D_MISC, "%s: mfi_detach\n", DEVNAME(sc)); - if ((error = config_detach_children(&sc->sc_dev, flags)) != 0) + if ((error = config_detach_children(sc->sc_dev, flags)) != 0) return error; #if NBIO > 0 mfi_destroy_sensors(sc); - bio_unregister(&sc->sc_dev); + bio_unregister(sc->sc_dev); #endif /* NBIO > 0 */ mfi_intr_disable(sc); @@ -760,7 +760,7 @@ sc->sc_ld[i].ld_present = 1; memset(adapt, 0, sizeof(*adapt)); - adapt->adapt_dev = &sc->sc_dev; + adapt->adapt_dev = sc->sc_dev; adapt->adapt_nchannels = 1; if (sc->sc_ld_cnt) adapt->adapt_openings = sc->sc_max_cmds / sc->sc_ld_cnt; @@ -779,13 +779,13 @@ chan->chan_ntargets = MFI_MAX_LD; chan->chan_id = MFI_MAX_LD; - (void)config_found(&sc->sc_dev, &sc->sc_chan, scsiprint); + (void)config_found(sc->sc_dev, &sc->sc_chan, scsiprint); /* enable interrupts */ mfi_intr_enable(sc); #if NBIO > 0 - if (bio_register(&sc->sc_dev, mfi_ioctl) != 0) + if (bio_register(sc->sc_dev, mfi_ioctl) != 0) panic("%s: controller registration failed", DEVNAME(sc)); if (mfi_create_sensors(sc) != 0) aprint_error("%s: unable to create sensors\n", DEVNAME(sc)); @@ -1062,7 +1062,7 @@ struct scsipi_periph *periph; struct scsipi_xfer *xs; struct scsipi_adapter *adapt = chan->chan_adapter; - struct mfi_softc *sc = (void *) adapt->adapt_dev; + struct mfi_softc *sc = device_private(adapt->adapt_dev); struct mfi_ccb *ccb; struct scsi_rw_6 *rw; struct scsipi_rw_10 *rwb; @@ -1146,7 +1146,7 @@ case SCSI_TEST_UNIT_READY: /* save off sd? after autoconf */ if (!cold) /* XXX bogus */ - strlcpy(sc->sc_ld[target].ld_dev, device_xname(&sc->sc_dev), + strlcpy(sc->sc_ld[target].ld_dev, device_xname(sc->sc_dev), sizeof(sc->sc_ld[target].ld_dev)); /* FALLTHROUGH */ @@ -1377,7 +1377,7 @@ int mfi_ioctl(device_t dev, u_long cmd, void *addr) { - struct mfi_softc *sc = (struct mfi_softc *)dev; + struct mfi_softc *sc = device_private(dev); int error = 0; int s = splbio(); Index: src/sys/dev/ic/mfivar.h diff -u src/sys/dev/ic/mfivar.h:1.11 src/sys/dev/ic/mfivar.h:1.12 --- src/sys/dev/ic/mfivar.h:1.11 Thu Jul 16 01:01:47 2009 +++ src/sys/dev/ic/mfivar.h Thu Jul 16 18:10:00 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: mfivar.h,v 1.11 2009/07/16 01:01:47 dyoung Exp $ */ +/* $NetBSD: mfivar.h,v 1.12 2009/07/16 18:10:00 dyoung Exp $ */ /* $OpenBSD: mfivar.h,v 1.28 2006/08/31 18:18:46 marco Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <ma...@peereboom.us> @@ -19,7 +19,7 @@ #include <dev/sysmon/sysmonvar.h> #include <sys/envsys.h> -#define DEVNAME(_s) (device_xname(&(_s)->sc_dev)) +#define DEVNAME(_s) (device_xname((_s)->sc_dev)) /* #define MFI_DEBUG */ #ifdef MFI_DEBUG @@ -110,7 +110,7 @@ }; struct mfi_softc { - struct device sc_dev; + device_t sc_dev; struct scsipi_channel sc_chan; struct scsipi_adapter sc_adapt; Index: src/sys/dev/pci/mfi_pci.c diff -u src/sys/dev/pci/mfi_pci.c:1.9 src/sys/dev/pci/mfi_pci.c:1.10 --- src/sys/dev/pci/mfi_pci.c:1.9 Thu Jul 16 01:01:46 2009 +++ src/sys/dev/pci/mfi_pci.c Thu Jul 16 18:10:00 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: mfi_pci.c,v 1.9 2009/07/16 01:01:46 dyoung Exp $ */ +/* $NetBSD: mfi_pci.c,v 1.10 2009/07/16 18:10:00 dyoung Exp $ */ /* $OpenBSD: mfi_pci.c,v 1.11 2006/08/06 04:40:08 brad Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <ma...@peereboom.us> @@ -17,7 +17,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mfi_pci.c,v 1.9 2009/07/16 01:01:46 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mfi_pci.c,v 1.10 2009/07/16 18:10:00 dyoung Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -50,7 +50,7 @@ void mfi_pci_attach(device_t, device_t, void *); int mfi_pci_detach(device_t, int); -CFATTACH_DECL(mfi_pci, sizeof(struct mfi_pci_softc), +CFATTACH_DECL_NEW(mfi_pci, sizeof(struct mfi_pci_softc), mfi_pci_match, mfi_pci_attach, mfi_pci_detach, NULL); struct mfi_pci_subtype { @@ -153,6 +153,7 @@ const char *subtype = NULL; uint32_t subsysid; + sc->sc_dev = self; psc->psc_pc = pa->pa_pc; csr = pci_mapreg_type(pa->pa_pc, pa->pa_tag, MFI_BAR);