Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Add activate routine and check device active flag al...
details: https://anonhg.NetBSD.org/src/rev/462435dcc5b9
branches: trunk
changeset: 482018:462435dcc5b9
user: enami <enami%NetBSD.org@localhost>
date: Sat Feb 12 04:05:49 2000 +0000
description:
Add activate routine and check device active flag also in one second
tick handler.
diffstat:
sys/dev/cardbus/if_fxp_cardbus.c | 4 +-
sys/dev/ic/i82557.c | 45 +++++++++++++++++++++++++++++++++++++--
sys/dev/ic/i82557var.h | 4 +-
3 files changed, 46 insertions(+), 7 deletions(-)
diffs (118 lines):
diff -r f45b85507e50 -r 462435dcc5b9 sys/dev/cardbus/if_fxp_cardbus.c
--- a/sys/dev/cardbus/if_fxp_cardbus.c Sat Feb 12 04:02:33 2000 +0000
+++ b/sys/dev/cardbus/if_fxp_cardbus.c Sat Feb 12 04:05:49 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_fxp_cardbus.c,v 1.6 2000/02/09 22:15:59 joda Exp $ */
+/* $NetBSD: if_fxp_cardbus.c,v 1.7 2000/02/12 04:05:50 enami Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -108,7 +108,7 @@
struct cfattach fxp_cardbus_ca = {
sizeof(struct fxp_cardbus_softc), fxp_cardbus_match, fxp_cardbus_attach,
- fxp_cardbus_detach
+ fxp_cardbus_detach, fxp_activate
};
#ifdef CBB_DEBUG
diff -r f45b85507e50 -r 462435dcc5b9 sys/dev/ic/i82557.c
--- a/sys/dev/ic/i82557.c Sat Feb 12 04:02:33 2000 +0000
+++ b/sys/dev/ic/i82557.c Sat Feb 12 04:05:49 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i82557.c,v 1.19 2000/02/12 03:55:49 enami Exp $ */
+/* $NetBSD: i82557.c,v 1.20 2000/02/12 04:05:49 enami Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -871,7 +871,7 @@
u_int8_t statack;
if ((sc->sc_dev.dv_flags & DVF_ACTIVE) == 0)
- return 0;
+ return (0);
/*
* If the interface isn't running, don't try to
* service the interrupt.. just ack it and bail.
@@ -882,7 +882,7 @@
claimed = 1;
CSR_WRITE_1(sc, FXP_CSR_SCB_STATACK, statack);
}
- return claimed;
+ return (claimed);
}
while ((statack = CSR_READ_1(sc, FXP_CSR_SCB_STATACK)) != 0) {
@@ -1076,6 +1076,9 @@
struct fxp_stats *sp = &sc->sc_control_data->fcd_stats;
int s;
+ if ((sc->sc_dev.dv_flags & DVF_ACTIVE) == 0)
+ return;
+
s = splnet();
ifp->if_opackets += le32toh(sp->tx_good);
@@ -1868,6 +1871,42 @@
}
}
+/*
+ * fxp_activate:
+ *
+ * Handle device activation/deactivation requests.
+ */
+int
+fxp_activate(self, act)
+ struct device *self;
+ enum devact act;
+{
+ struct fxp_softc *sc = (void *) self;
+ int s, error = 0;
+
+ s = splnet();
+ switch (act) {
+ case DVACT_ACTIVATE:
+ error = EOPNOTSUPP;
+ break;
+
+ case DVACT_DEACTIVATE:
+ if (sc->sc_flags & FXPF_MII)
+ mii_activate(&sc->sc_mii, act, MII_PHY_ANY,
+ MII_OFFSET_ANY);
+ if_deactivate(&sc->sc_ethercom.ec_if);
+ break;
+ }
+ splx(s);
+
+ return (error);
+}
+
+/*
+ * fxp_detach:
+ *
+ * Detach an i82557 interface.
+ */
int
fxp_detach(sc)
struct fxp_softc *sc;
diff -r f45b85507e50 -r 462435dcc5b9 sys/dev/ic/i82557var.h
--- a/sys/dev/ic/i82557var.h Sat Feb 12 04:02:33 2000 +0000
+++ b/sys/dev/ic/i82557var.h Sat Feb 12 04:05:49 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i82557var.h,v 1.10 2000/02/09 22:15:58 joda Exp $ */
+/* $NetBSD: i82557var.h,v 1.11 2000/02/12 04:05:49 enami Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -320,9 +320,9 @@
bus_space_write_4((sc)->sc_st, (sc)->sc_sh, (reg), (val))
void fxp_attach __P((struct fxp_softc *));
+int fxp_activate __P((struct device *, enum devact));
int fxp_detach __P((struct fxp_softc *));
int fxp_intr __P((void *));
int fxp_enable __P((struct fxp_softc*));
void fxp_disable __P((struct fxp_softc*));
-
Home |
Main Index |
Thread Index |
Old Index