diff options
Diffstat (limited to 'sys/dev/mii')
-rw-r--r-- | sys/dev/mii/mii.c | 24 | ||||
-rw-r--r-- | sys/dev/mii/mii.h | 6 | ||||
-rw-r--r-- | sys/dev/mii/miivar.h | 7 |
3 files changed, 7 insertions, 30 deletions
diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c index 911db2409fa..66448a2296f 100644 --- a/sys/dev/mii/mii.c +++ b/sys/dev/mii/mii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mii.c,v 1.17 2005/07/22 11:50:53 brad Exp $ */ +/* $OpenBSD: mii.c,v 1.18 2005/07/23 01:42:16 brad Exp $ */ /* $NetBSD: mii.c,v 1.19 2000/02/02 17:09:44 thorpej Exp $ */ /*- @@ -304,25 +304,3 @@ mii_down(struct mii_data *mii) child = LIST_NEXT(child, mii_list)) (void) PHY_SERVICE(child, mii, MII_DOWN); } - -static unsigned char -bitreverse(unsigned char x) -{ - static unsigned char nibbletab[16] = { - 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15 - }; - - return ((nibbletab[x & 15] << 4) | nibbletab[x >> 4]); -} - -int -mii_oui(int id1, int id2) -{ - int h; - - h = (id1 << 6) | (id2 >> 10); - - return ((bitreverse(h >> 16) << 16) | - (bitreverse((h >> 8) & 255) << 8) | - bitreverse(h & 255)); -} diff --git a/sys/dev/mii/mii.h b/sys/dev/mii/mii.h index a68f8447cba..b41a5f98e88 100644 --- a/sys/dev/mii/mii.h +++ b/sys/dev/mii/mii.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mii.h,v 1.8 2005/07/22 11:50:53 brad Exp $ */ +/* $OpenBSD: mii.h,v 1.9 2005/07/23 01:42:16 brad Exp $ */ /* $NetBSD: mii.h,v 1.8 2001/05/31 03:06:46 thorpej Exp $ */ /* @@ -108,6 +108,10 @@ #define IDR2_MODEL 0x03f0 /* vendor model */ #define IDR2_REV 0x000f /* vendor revision */ +#define MII_OUI(id1, id2) (((id1) << 6) | ((id2) >> 10)) +#define MII_MODEL(id2) (((id2) & IDR2_MODEL) >> 4) +#define MII_REV(id2) ((id2) & IDR2_REV) + #define MII_ANAR 0x04 /* Autonegotiation advertisement (rw) */ /* section 28.2.4.1 and 37.2.6.1 */ #define ANAR_NP 0x8000 /* Next page (ro) */ diff --git a/sys/dev/mii/miivar.h b/sys/dev/mii/miivar.h index 2f24cbcad9f..990a6380906 100644 --- a/sys/dev/mii/miivar.h +++ b/sys/dev/mii/miivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: miivar.h,v 1.24 2005/07/22 11:50:53 brad Exp $ */ +/* $OpenBSD: miivar.h,v 1.25 2005/07/23 01:42:16 brad Exp $ */ /* $NetBSD: miivar.h,v 1.17 2000/03/06 20:56:57 thorpej Exp $ */ /*- @@ -267,11 +267,6 @@ int mii_phy_statusmsg(struct mii_softc *); void ukphy_status(struct mii_softc *); -int mii_oui(int, int); -#define MII_OUI(id1, id2) mii_oui(id1, id2) -#define MII_MODEL(id2) (((id2) & IDR2_MODEL) >> 4) -#define MII_REV(id2) ((id2) & IDR2_REV) - #endif /* _KERNEL */ #endif /* _DEV_MII_MIIVAR_H_ */ |