Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
msk(4) device_t/softc split
Please apply and test this patch for the msk(4) device_t/softc split.
Dave
--
David Young OJC Technologies
dyoung%ojctech.com@localhost Urbana, IL * (217) 278-3933
Index: sys/dev/pci/if_msk.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_msk.c,v
retrieving revision 1.27
diff -p -u -u -p -r1.27 if_msk.c
--- sys/dev/pci/if_msk.c 12 May 2009 08:23:00 -0000 1.27
+++ sys/dev/pci/if_msk.c 26 Jun 2009 16:07:08 -0000
@@ -100,11 +100,11 @@ __KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1
#include <dev/pci/if_mskvar.h>
int mskc_probe(device_t, cfdata_t, void *);
-void mskc_attach(device_t, device_t self, void *aux);
+void mskc_attach(device_t, device_t, void *);
static bool mskc_suspend(device_t PMF_FN_PROTO);
static bool mskc_resume(device_t PMF_FN_PROTO);
int msk_probe(device_t, cfdata_t, void *);
-void msk_attach(device_t, device_t self, void *aux);
+void msk_attach(device_t, device_t, void *);
int mskcprint(void *, const char *);
int msk_intr(void *);
void msk_intr_yukon(struct sk_if_softc *);
@@ -244,7 +244,7 @@ msk_miibus_readreg(device_t dev, int phy
}
if (i == SK_TIMEOUT) {
- aprint_error_dev(&sc_if->sk_dev, "phy failed to come ready\n");
+ aprint_error_dev(sc_if->sk_dev, "phy failed to come ready\n");
return (0);
}
@@ -279,7 +279,7 @@ msk_miibus_writereg(device_t dev, int ph
}
if (i == SK_TIMEOUT)
- aprint_error_dev(&sc_if->sk_dev, "phy write timed out\n");
+ aprint_error_dev(sc_if->sk_dev, "phy write timed out\n");
}
void
@@ -321,7 +321,7 @@ msk_miibus_statchg(device_t dev)
SK_YU_WRITE_2(sc_if, YUKON_GPCR, gpcr);
DPRINTFN(9, ("msk_miibus_statchg: gpcr=%x\n",
- SK_YU_READ_2(((struct sk_if_softc *)dev), YUKON_GPCR)));
+ SK_YU_READ_2(sc_if, YUKON_GPCR)));
}
#define HASH_BITS 6
@@ -429,7 +429,7 @@ msk_init_rx_ring(struct sk_if_softc *sc_
for (i = 0; i < MSK_RX_RING_CNT; i++) {
if (msk_newbuf(sc_if, i, NULL,
sc_if->sk_cdata.sk_rx_jumbo_map) == ENOBUFS) {
- aprint_error_dev(&sc_if->sk_dev, "failed alloc of %dth
mbuf\n", i);
+ aprint_error_dev(sc_if->sk_dev, "failed alloc of %dth
mbuf\n", i);
return (ENOBUFS);
}
}
@@ -749,7 +749,7 @@ msk_update_int_mod(struct sk_softc *sc)
default:
imtimer_ticks = SK_IMTIMER_TICKS_YUKON;
}
- aprint_verbose_dev(&sc->sk_dev, "interrupt moderation is %d us\n",
+ aprint_verbose_dev(sc->sk_dev, "interrupt moderation is %d us\n",
sc->sk_int_mod);
sk_win_write_4(sc, SK_IMTIMERINIT, SK_IM_USECS(sc->sk_int_mod));
sk_win_write_4(sc, SK_IMMR, SK_ISR_TX1_S_EOF|SK_ISR_TX2_S_EOF|
@@ -987,6 +987,7 @@ msk_attach(device_t parent, device_t sel
int i, rseg;
u_int32_t chunk, val;
+ sc_if->sk_dev = self;
sc_if->sk_port = sa->skc_port;
sc_if->sk_softc = sc;
sc->sk_if[sa->skc_port] = sc_if;
@@ -1081,7 +1082,7 @@ msk_attach(device_t parent, device_t sel
ifp->if_baudrate = 1000000000;
IFQ_SET_MAXLEN(&ifp->if_snd, MSK_TX_RING_CNT - 1);
IFQ_SET_READY(&ifp->if_snd);
- strlcpy(ifp->if_xname, device_xname(&sc_if->sk_dev), IFNAMSIZ);
+ strlcpy(ifp->if_xname, device_xname(sc_if->sk_dev), IFNAMSIZ);
/*
* Do miibus setup.
@@ -1101,7 +1102,7 @@ msk_attach(device_t parent, device_t sel
mii_attach(self, &sc_if->sk_mii, 0xffffffff, MII_PHY_ANY,
MII_OFFSET_ANY, MIIF_DOPAUSE|MIIF_FORCEANEG);
if (LIST_FIRST(&sc_if->sk_mii.mii_phys) == NULL) {
- aprint_error_dev(&sc_if->sk_dev, "no PHY found!\n");
+ aprint_error_dev(sc_if->sk_dev, "no PHY found!\n");
ifmedia_add(&sc_if->sk_mii.mii_media, IFM_ETHER|IFM_MANUAL,
0, NULL);
ifmedia_set(&sc_if->sk_mii.mii_media, IFM_ETHER|IFM_MANUAL);
@@ -1124,7 +1125,7 @@ msk_attach(device_t parent, device_t sel
pmf_class_network_register(self, ifp);
#if NRND > 0
- rnd_attach_source(&sc->rnd_source, device_xname(&sc->sk_dev),
+ rnd_attach_source(&sc->rnd_source, device_xname(sc->sk_dev),
RND_TYPE_NET, 0);
#endif
@@ -1177,6 +1178,8 @@ mskc_attach(device_t parent, device_t se
bus_dma_segment_t seg;
int rseg;
+ sc->sk_dev = self;
+
DPRINTFN(2, ("begin mskc_attach\n"));
/*
@@ -1195,7 +1198,7 @@ mskc_attach(device_t parent, device_t se
irq = pci_conf_read(pc, pa->pa_tag, SK_PCI_INTLINE);
/* Reset the power state. */
- aprint_normal_dev(&sc->sk_dev, "chip is in D%d power
mode "
+ aprint_normal_dev(sc->sk_dev, "chip is in D%d power
mode "
"-- setting to D0\n",
command & SK_PSTATE_MASK);
command &= 0xFFFFFFFC;
@@ -1409,13 +1412,13 @@ mskc_attach(device_t parent, device_t se
skca.skc_port = SK_PORT_A;
skca.skc_type = sc->sk_type;
skca.skc_rev = sc->sk_rev;
- (void)config_found(&sc->sk_dev, &skca, mskcprint);
+ (void)config_found(sc->sk_dev, &skca, mskcprint);
if (sc->sk_macs > 1) {
skca.skc_port = SK_PORT_B;
skca.skc_type = sc->sk_type;
skca.skc_rev = sc->sk_rev;
- (void)config_found(&sc->sk_dev, &skca, mskcprint);
+ (void)config_found(sc->sk_dev, &skca, mskcprint);
}
/* Turn on the 'driver is loaded' LED. */
@@ -1427,11 +1430,11 @@ mskc_attach(device_t parent, device_t se
sc->sk_int_mod_pending = 0;
if ((rc = sysctl_createv(&sc->sk_clog, 0, NULL, &node,
- 0, CTLTYPE_NODE, device_xname(&sc->sk_dev),
+ 0, CTLTYPE_NODE, device_xname(sc->sk_dev),
SYSCTL_DESCR("mskc per-controller controls"),
NULL, 0, NULL, 0, CTL_HW, msk_root_num, CTL_CREATE,
CTL_EOL)) != 0) {
- aprint_normal_dev(&sc->sk_dev, "couldn't create sysctl node\n");
+ aprint_normal_dev(sc->sk_dev, "couldn't create sysctl node\n");
goto fail_6;
}
@@ -1445,7 +1448,7 @@ mskc_attach(device_t parent, device_t se
msk_sysctl_handler, 0, sc,
0, CTL_HW, msk_root_num, sk_nodenum, CTL_CREATE,
CTL_EOL)) != 0) {
- aprint_normal_dev(&sc->sk_dev, "couldn't create int_mod sysctl
node\n");
+ aprint_normal_dev(sc->sk_dev, "couldn't create int_mod sysctl
node\n");
goto fail_6;
}
@@ -1638,7 +1641,7 @@ msk_watchdog(struct ifnet *ifp)
if (sc_if->sk_cdata.sk_tx_cons != idx) {
msk_txeof(sc_if, idx);
if (sc_if->sk_cdata.sk_tx_cnt != 0) {
- aprint_error_dev(&sc_if->sk_dev, "watchdog timeout\n");
+ aprint_error_dev(sc_if->sk_dev, "watchdog timeout\n");
ifp->if_oerrors++;
@@ -2156,7 +2159,7 @@ msk_init(struct ifnet *ifp)
/* Init descriptors */
if (msk_init_rx_ring(sc_if) == ENOBUFS) {
- aprint_error_dev(&sc_if->sk_dev, "initialization failed: no "
+ aprint_error_dev(sc_if->sk_dev, "initialization failed: no "
"memory for rx buffers\n");
msk_stop(ifp,0);
splx(s);
@@ -2164,7 +2167,7 @@ msk_init(struct ifnet *ifp)
}
if (msk_init_tx_ring(sc_if) == ENOBUFS) {
- aprint_error_dev(&sc_if->sk_dev, "initialization failed: no "
+ aprint_error_dev(sc_if->sk_dev, "initialization failed: no "
"memory for tx buffers\n");
msk_stop(ifp,0);
splx(s);
@@ -2190,7 +2193,7 @@ msk_init(struct ifnet *ifp)
if (imr != SK_IM_USECS(sc->sk_int_mod)) {
sk_win_write_4(sc, SK_IMTIMERINIT,
SK_IM_USECS(sc->sk_int_mod));
- aprint_verbose_dev(&sc->sk_dev, "interrupt moderation is %d
us\n",
+ aprint_verbose_dev(sc->sk_dev, "interrupt moderation is %d
us\n",
sc->sk_int_mod);
}
@@ -2310,10 +2313,10 @@ msk_stop(struct ifnet *ifp, int disable)
#endif
}
-CFATTACH_DECL(mskc, sizeof(struct sk_softc), mskc_probe, mskc_attach,
+CFATTACH_DECL_NEW(mskc, sizeof(struct sk_softc), mskc_probe, mskc_attach,
NULL, NULL);
-CFATTACH_DECL(msk, sizeof(struct sk_if_softc), msk_probe, msk_attach,
+CFATTACH_DECL_NEW(msk, sizeof(struct sk_if_softc), msk_probe, msk_attach,
NULL, NULL);
#ifdef MSK_DEBUG
Index: sys/dev/pci/if_mskvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_mskvar.h,v
retrieving revision 1.7
diff -p -u -u -p -r1.7 if_mskvar.h
--- sys/dev/pci/if_mskvar.h 20 Jun 2008 16:45:13 -0000 1.7
+++ sys/dev/pci/if_mskvar.h 26 Jun 2009 16:07:08 -0000
@@ -188,7 +188,7 @@ struct sk_if_softc;
/* Softc for the Yukon-II controller. */
struct sk_softc {
- struct device sk_dev; /* generic device */
+ device_t sk_dev; /* generic device */
bus_space_handle_t sk_bhandle; /* bus space handle */
bus_space_tag_t sk_btag; /* bus space tag */
void *sk_intrhand; /* irq handler handle */
@@ -216,7 +216,7 @@ struct sk_softc {
/* Softc for each logical interface */
struct sk_if_softc {
- struct device sk_dev; /* generic device */
+ device_t sk_dev; /* generic device */
struct ethercom sk_ethercom; /* interface info */
struct mii_data sk_mii;
u_int8_t sk_enaddr[ETHER_ADDR_LEN]; /* station addr */
Home |
Main Index |
Thread Index |
Old Index