summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-08-22 17:09:09 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-08-22 17:09:09 +0000
commit18b5442f524b67a486479dd751e16d3a7d6ea1e0 (patch)
tree13c807e92bbb740e82a5dae4ddc7c7f7694fe3fa /sys/arch
parente90f146adaf0edcb160a8d7c1849d4ae2242d553 (diff)
Instead of spewing error messages about link status, support link status
like all drivers should ok miod
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/vax/if/if_ze.c4
-rw-r--r--sys/arch/vax/if/sgec.c38
-rw-r--r--sys/arch/vax/if/sgecvar.h4
-rw-r--r--sys/arch/vax/vsa/if_ze_vsbus.c3
-rw-r--r--sys/arch/vax/vxt/if_ze_vxtbus.c4
5 files changed, 46 insertions, 7 deletions
diff --git a/sys/arch/vax/if/if_ze.c b/sys/arch/vax/if/if_ze.c
index bc5f9c91a31..51f8dd5db85 100644
--- a/sys/arch/vax/if/if_ze.c
+++ b/sys/arch/vax/if/if_ze.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ze.c,v 1.7 2006/08/30 19:28:11 miod Exp $ */
+/* $OpenBSD: if_ze.c,v 1.8 2008/08/22 17:09:06 deraadt Exp $ */
/* $NetBSD: if_ze.c,v 1.3 2000/01/24 02:54:03 matt Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -38,6 +38,8 @@
#include <net/if.h>
#include <net/if_dl.h>
+#include <net/if_media.h>
+
#include <netinet/in.h>
#include <netinet/if_ether.h>
diff --git a/sys/arch/vax/if/sgec.c b/sys/arch/vax/if/sgec.c
index ba11abc9ec9..e7dce2eddcc 100644
--- a/sys/arch/vax/if/sgec.c
+++ b/sys/arch/vax/if/sgec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sgec.c,v 1.15 2006/08/31 22:10:57 miod Exp $ */
+/* $OpenBSD: sgec.c,v 1.16 2008/08/22 17:09:06 deraadt Exp $ */
/* $NetBSD: sgec.c,v 1.5 2000/06/04 02:14:14 matt Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -56,6 +56,7 @@
#include <net/if.h>
#include <net/if_dl.h>
+#include <net/if_media.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
@@ -74,6 +75,8 @@ void sgec_rxintr(struct ze_softc *);
void sgec_txintr(struct ze_softc *);
void zeinit(struct ze_softc *);
int zeioctl(struct ifnet *, u_long, caddr_t);
+int ze_ifmedia_change(struct ifnet *const);
+void ze_ifmedia_status(struct ifnet *const, struct ifmediareq *);
void zekick(struct ze_softc *);
int zereset(struct ze_softc *);
void zestart(struct ifnet *);
@@ -215,6 +218,12 @@ sgec_attach(sc)
ether_ifattach(ifp);
printf(": address %s\n", ether_sprintf(sc->sc_ac.ac_enaddr));
+
+ ifmedia_init(&sc->sc_ifmedia, 0, ze_ifmedia_change,
+ ze_ifmedia_status);
+ ifmedia_add(&sc->sc_ifmedia, IFM_ETHER | IFM_10_5, 0, 0);
+ ifmedia_set(&sc->sc_ifmedia, IFM_ETHER | IFM_10_5);
+ sc->sc_flags |= SGECF_LINKUP;
return;
/*
@@ -250,6 +259,23 @@ sgec_attach(sc)
return;
}
+int
+ze_ifmedia_change(struct ifnet *const ifp)
+{
+ return (0);
+}
+
+void
+ze_ifmedia_status(struct ifnet *const ifp, struct ifmediareq *req)
+{
+ struct ze_softc *sc = ifp->if_softc;
+
+ req->ifm_status = IFM_AVALID;
+ if (sc->sc_flags & SGECF_LINKUP)
+ req->ifm_status |= IFM_ACTIVE;
+ req->ifm_active = IFM_10_5 | IFM_ETHER;
+}
+
/*
* Initialization of interface.
*/
@@ -503,6 +529,7 @@ sgec_txintr(struct ze_softc *sc)
struct ifnet *ifp = &sc->sc_if;
u_short tdes0;
+ sc->sc_flags |= SGECF_LINKUP;
while ((zc->zc_xmit[sc->sc_lastack].ze_tdr & ZE_TDR_OW) == 0) {
int idx = sc->sc_lastack;
@@ -523,8 +550,7 @@ sgec_txintr(struct ze_softc *sc)
printf("%s: transmit watchdog timeout\n",
sc->sc_dev.dv_xname);
if (tdes0 & (ZE_TDES0_LO | ZE_TDES0_NC))
- printf("%s: no carrier\n",
- sc->sc_dev.dv_xname);
+ sc->sc_flags &= ~SGECF_LINKUP;
if (tdes0 & ZE_TDES0_EC) {
printf("%s: excessive collisions, tdr %d\n",
sc->sc_dev.dv_xname,
@@ -617,6 +643,12 @@ zeioctl(ifp, cmd, data)
}
break;
+ case SIOCSIFMEDIA:
+ case SIOCGIFMEDIA:
+ error = ifmedia_ioctl(ifp, (struct ifreq *)data,
+ &sc->sc_ifmedia, cmd);
+ break;
+
case SIOCSIFFLAGS:
if ((ifp->if_flags & IFF_UP) == 0 &&
(ifp->if_flags & IFF_RUNNING) != 0) {
diff --git a/sys/arch/vax/if/sgecvar.h b/sys/arch/vax/if/sgecvar.h
index 6e1417527d6..9418bcff3d1 100644
--- a/sys/arch/vax/if/sgecvar.h
+++ b/sys/arch/vax/if/sgecvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sgecvar.h,v 1.5 2006/08/30 19:28:11 miod Exp $ */
+/* $OpenBSD: sgecvar.h,v 1.6 2008/08/22 17:09:06 deraadt Exp $ */
/* $NetBSD: sgecvar.h,v 1.2 2000/06/04 02:14:14 matt Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -47,6 +47,7 @@ struct ze_softc {
struct evcount sc_intrcnt; /* Interrupt counters */
struct arpcom sc_ac; /* Ethernet common part */
#define sc_if sc_ac.ac_if /* network-visible interface */
+ struct ifmedia sc_ifmedia;
bus_space_tag_t sc_iot;
bus_addr_t sc_ioh;
bus_dma_tag_t sc_dmat;
@@ -65,6 +66,7 @@ struct ze_softc {
int sc_flags;
#define SGECF_SETUP 0x00000001 /* need to send setup packet */
#define SGECF_VXTQUIRKS 0x00000002 /* need VXT2000 care */
+#define SGECF_LINKUP 0x00000004 /* got link */
};
void sgec_attach(struct ze_softc *);
diff --git a/sys/arch/vax/vsa/if_ze_vsbus.c b/sys/arch/vax/vsa/if_ze_vsbus.c
index 24035da888e..e2bb48319c3 100644
--- a/sys/arch/vax/vsa/if_ze_vsbus.c
+++ b/sys/arch/vax/vsa/if_ze_vsbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ze_vsbus.c,v 1.4 2006/08/30 19:28:13 miod Exp $ */
+/* $OpenBSD: if_ze_vsbus.c,v 1.5 2008/08/22 17:09:08 deraadt Exp $ */
/* $NetBSD: if_ze_vsbus.c,v 1.5 2000/07/26 21:50:49 matt Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -38,6 +38,7 @@
#include <net/if.h>
#include <net/if_dl.h>
+#include <net/if_media.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
diff --git a/sys/arch/vax/vxt/if_ze_vxtbus.c b/sys/arch/vax/vxt/if_ze_vxtbus.c
index 727cded771f..383e462bbf3 100644
--- a/sys/arch/vax/vxt/if_ze_vxtbus.c
+++ b/sys/arch/vax/vxt/if_ze_vxtbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ze_vxtbus.c,v 1.2 2006/08/30 19:28:13 miod Exp $ */
+/* $OpenBSD: if_ze_vxtbus.c,v 1.3 2008/08/22 17:09:08 deraadt Exp $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved.
*
@@ -36,6 +36,8 @@
#include <net/if.h>
#include <net/if_dl.h>
+#include <net/if_media.h>
+
#include <netinet/in.h>
#include <netinet/if_ether.h>