diff options
author | Nathan Binkert <nate@cvs.openbsd.org> | 2001-10-05 18:33:34 +0000 |
---|---|---|
committer | Nathan Binkert <nate@cvs.openbsd.org> | 2001-10-05 18:33:34 +0000 |
commit | d46cd93397c7a3804f069df45a9ade9869335ff2 (patch) | |
tree | 16f765ed83e310065cd74df6abce32184f023ac4 | |
parent | 91c25e293ec1f36143217773da161d0a4157e526 (diff) |
Differentiate between 1000baseT and 1000baseX.
Add some support for gigabit control/status regs.
-rw-r--r-- | sys/dev/mii/mii.h | 36 | ||||
-rw-r--r-- | sys/dev/mii/mii_physubr.c | 10 | ||||
-rw-r--r-- | sys/dev/mii/miivar.h | 13 |
3 files changed, 40 insertions, 19 deletions
diff --git a/sys/dev/mii/mii.h b/sys/dev/mii/mii.h index f8abe567722..85c99dcca3d 100644 --- a/sys/dev/mii/mii.h +++ b/sys/dev/mii/mii.h @@ -1,5 +1,5 @@ -/* $OpenBSD: mii.h,v 1.3 2001/06/08 02:16:41 nate Exp $ */ -/* $NetBSD: mii.h,v 1.6 2001/04/30 19:49:08 thorpej Exp $ */ +/* $OpenBSD: mii.h,v 1.4 2001/10/05 18:33:33 nate Exp $ */ +/* $NetBSD: mii.h,v 1.8 2001/05/31 03:06:46 thorpej Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. All rights reserved. @@ -67,7 +67,7 @@ #define BMCR_S100 BMCR_SPEED0 /* 100 Mb/s */ #define BMCR_S1000 BMCR_SPEED1 /* 1000 Mb/s */ -#define BMCR_SPEED(x) ((x) & (BMCR_SPEED0|BMCR_SPEED1)) +#define BMCR_SPEED(x) ((x) & (BMCR_SPEED0|BMCR_SPEED1)) #define MII_BMSR 0x01 /* Basic mode status register (ro) */ #define BMSR_100T4 0x8000 /* 100 base T4 capable */ @@ -87,12 +87,12 @@ #define BMSR_JABBER 0x0002 /* Jabber detected */ #define BMSR_EXTCAP 0x0001 /* Extended capability */ - /* - * Note that the EXTSTAT bit indicates that there is extended status - * info available in register 15, but 802.3 section 22.2.4.3 also - * states that that all 1000 Mb/s capable PHYs will set this bit to 1. - */ - +/* + * Note that the EXTSTAT bit indicates that there is extended status + * info available in register 15, but 802.3 section 22.2.4.3 also + * states that that all 1000 Mb/s capable PHYs will set this bit to 1. + */ + #define BMSR_MEDIAMASK (BMSR_100T4|BMSR_100TXFDX|BMSR_100TXHDX| \ BMSR_10TFDX|BMSR_10THDX|BMSR_100T2FDX|BMSR_100T2HDX) @@ -153,9 +153,25 @@ #define MII_ANLPRNP 0x08 /* Autonegotiation link partner rx next page */ /* section 32.5.1 and 37.2.6.1 */ + /* This is also the 1000baseT control register */ #define MII_100T2CR 0x09 /* 100base-T2 control register */ - +#define GTCR_TEST_MASK 0xe000 /* see 802.3ab ss. 40.6.1.1.2 */ +#define GTCR_MAN_MS 0x1000 /* enable manual master/slave control */ +#define GTCR_ADV_MS 0x0800 /* 1 = adv. master, 0 = adv. slave */ +#define GTCR_PORT_TYPE 0x0400 /* 1 = DCE, 0 = DTE (NIC) */ +#define GTCR_ADV_1000TFDX 0x0200 /* adv. 1000baseT FDX */ +#define GTCR_ADV_1000THDX 0x0100 /* adv. 1000baseT HDX */ + + /* This is also the 1000baseT status register */ #define MII_100T2SR 0x0a /* 100base-T2 status register */ +#define GTSR_MAN_MS_FLT 0x8000 /* master/slave config fault */ +#define GTSR_MS_RES 0x4000 /* result: 1 = master, 0 = slave */ +#define GTSR_LRS 0x2000 /* local rx status, 1 = ok */ +#define GTSR_RRS 0x1000 /* remove rx status, 1 = ok */ +#define GTSR_LP_1000TFDX 0x0800 /* link partner 1000baseT FDX capable */ +#define GTSR_LP_1000THDX 0x0400 /* link partner 1000baseT HDX capable */ +#define GTSR_LP_ASM_DIR 0x0200 /* link partner asym. pause dir. capable */ +#define GTSR_IDLE_ERR 0x00ff /* IDLE error count */ #define MII_EXTSR 0x0f /* Extended status register */ #define EXTSR_1000XFDX 0x8000 /* 1000X full-duplex capable */ diff --git a/sys/dev/mii/mii_physubr.c b/sys/dev/mii/mii_physubr.c index 1d0481b321a..cca0dc38002 100644 --- a/sys/dev/mii/mii_physubr.c +++ b/sys/dev/mii/mii_physubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mii_physubr.c,v 1.10 2001/06/25 20:24:13 nate Exp $ */ +/* $OpenBSD: mii_physubr.c,v 1.11 2001/10/05 18:33:33 nate Exp $ */ /* $NetBSD: mii_physubr.c,v 1.20 2001/04/13 23:30:09 thorpej Exp $ */ /*- @@ -368,22 +368,22 @@ mii_phy_add_media(sc) if (sc->mii_extcapabilities & EXTSR_1000XHDX) { sc->mii_anegticks = 10; ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, 0, - sc->mii_inst), MII_MEDIA_1000); + sc->mii_inst), MII_MEDIA_1000_X); } if (sc->mii_extcapabilities & EXTSR_1000XFDX) { sc->mii_anegticks = 10; ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, - sc->mii_inst), MII_MEDIA_1000_FDX); + sc->mii_inst), MII_MEDIA_1000_X_FDX); } if (sc->mii_extcapabilities & EXTSR_1000THDX) { sc->mii_anegticks = 10; ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_TX, 0, - sc->mii_inst), MII_MEDIA_1000); + sc->mii_inst), MII_MEDIA_1000_T); } if (sc->mii_extcapabilities & EXTSR_1000TFDX) { sc->mii_anegticks = 10; ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_TX, IFM_FDX, - sc->mii_inst), MII_MEDIA_1000_FDX); + sc->mii_inst), MII_MEDIA_1000_T_FDX); } } diff --git a/sys/dev/mii/miivar.h b/sys/dev/mii/miivar.h index f9a911daa98..473b3ed9332 100644 --- a/sys/dev/mii/miivar.h +++ b/sys/dev/mii/miivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: miivar.h,v 1.12 2001/08/19 15:07:34 miod Exp $ */ +/* $OpenBSD: miivar.h,v 1.13 2001/10/05 18:33:33 nate Exp $ */ /* $NetBSD: miivar.h,v 1.17 2000/03/06 20:56:57 thorpej Exp $ */ /*- @@ -159,6 +159,8 @@ typedef struct mii_softc mii_softc_t; #define MIIF_NOLOOP 0x0004 /* no loopback capability */ #define MIIF_DOINGAUTO 0x0008 /* doing autonegotiation (mii_softc) */ #define MIIF_AUTOTSLEEP 0x0010 /* use tsleep(), not timeout() */ +#define MIIF_HAVEFIBER 0x0020 /* from parent: has fiber interface */ +#define MIIF_HAVE_GTCR 0x0040 /* has 100base-T2/1000base-T CR */ #define MIIF_INHERIT_MASK (MIIF_NOISOLATE|MIIF_NOLOOP|MIIF_AUTOTSLEEP) @@ -189,6 +191,7 @@ typedef struct mii_attach_args mii_attach_args_t; struct mii_media { int mm_bmcr; /* BMCR settings for this media */ int mm_anar; /* ANAR settings for this media */ + int mm_gtcr; /* 100base-T2 or 1000base-T CR */ }; #define MII_MEDIA_NONE 0 @@ -197,9 +200,11 @@ struct mii_media { #define MII_MEDIA_100_T4 3 #define MII_MEDIA_100_TX 4 #define MII_MEDIA_100_TX_FDX 5 -#define MII_MEDIA_1000 6 -#define MII_MEDIA_1000_FDX 7 -#define MII_NMEDIA 8 +#define MII_MEDIA_1000_X 6 +#define MII_MEDIA_1000_X_FDX 7 +#define MII_MEDIA_1000_T 8 +#define MII_MEDIA_1000_T_FDX 9 +#define MII_NMEDIA 10 #ifdef _KERNEL |