Add a flag to mii_flags which will cause autonegotiation to use tsleep()

instead of callout.  This way adapters which need a process context for
PHY register access (e.g. USB adapters) have a chance.
This commit is contained in:
augustss 2001-04-13 11:12:36 +00:00
parent 7d01561a4c
commit 205b10ed17
2 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mii_physubr.c,v 1.18 2000/07/04 03:28:59 thorpej Exp $ */
/* $NetBSD: mii_physubr.c,v 1.19 2001/04/13 11:12:36 augustss Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -47,6 +47,7 @@
#include <sys/kernel.h>
#include <sys/socket.h>
#include <sys/errno.h>
#include <sys/proc.h>
#include <net/if.h>
#include <net/if_media.h>
@ -136,7 +137,11 @@ mii_phy_auto(sc, waitfor)
* the tick handler driving autonegotiation. Don't want 500ms
* delays all the time while the system is running!
*/
if ((sc->mii_flags & MIIF_DOINGAUTO) == 0) {
if (sc->mii_flags & MIIF_AUTOTSLEEP) {
sc->mii_flags |= MIIF_DOINGAUTO;
tsleep(&sc->mii_flags, PZERO, "miiaut", hz >> 1);
mii_phy_auto_timeout(sc);
} else if ((sc->mii_flags & MIIF_DOINGAUTO) == 0) {
sc->mii_flags |= MIIF_DOINGAUTO;
callout_reset(&sc->mii_nway_ch, hz >> 1,
mii_phy_auto_timeout, sc);

View File

@ -1,4 +1,4 @@
/* $NetBSD: miivar.h,v 1.20 2001/03/28 14:13:07 drochner Exp $ */
/* $NetBSD: miivar.h,v 1.21 2001/04/13 11:12:37 augustss Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -142,8 +142,9 @@ typedef struct mii_softc mii_softc_t;
#define MIIF_NOISOLATE 0x0002 /* do not isolate the PHY */
#define MIIF_NOLOOP 0x0004 /* no loopback capability */
#define MIIF_DOINGAUTO 0x0008 /* doing autonegotiation (mii_softc) */
#define MIIF_AUTOTSLEEP 0x0010 /* use tsleep(), not callout() */
#define MIIF_INHERIT_MASK (MIIF_NOISOLATE|MIIF_NOLOOP)
#define MIIF_INHERIT_MASK (MIIF_NOISOLATE|MIIF_NOLOOP|MIIF_AUTOTSLEEP)
/*
* Special `locators' passed to mii_attach(). If one of these is not