diff options
author | 2011-04-04 03:49:32 +0000 | |
---|---|---|
committer | 2011-04-04 03:49:32 +0000 | |
commit | f8db8016e5f731ba9b76fddb1c159df50bdb5435 (patch) | |
tree | 084937871d5ea3bebaea3b9553adedf842e0668f | |
parent | pirofti made me look at wd(4) code, which made me sad. (diff) | |
download | wireguard-openbsd-f8db8016e5f731ba9b76fddb1c159df50bdb5435.tar.xz wireguard-openbsd-f8db8016e5f731ba9b76fddb1c159df50bdb5435.zip |
The backplane version of the 82575EB has no link state -- it's always
up. From FreeBSD.
ok jsg claudio
-rw-r--r-- | sys/dev/pci/if_em_hw.c | 30 | ||||
-rw-r--r-- | sys/dev/pci/if_em_hw.h | 6 |
2 files changed, 29 insertions, 7 deletions
diff --git a/sys/dev/pci/if_em_hw.c b/sys/dev/pci/if_em_hw.c index e58fff322fa..c4d3f34f418 100644 --- a/sys/dev/pci/if_em_hw.c +++ b/sys/dev/pci/if_em_hw.c @@ -31,7 +31,7 @@ *******************************************************************************/ -/* $OpenBSD: if_em_hw.c,v 1.60 2011/02/15 19:15:25 miod Exp $ */ +/* $OpenBSD: if_em_hw.c,v 1.61 2011/04/04 03:49:32 william Exp $ */ /* * if_em_hw.c Shared functions for accessing and configuring the MAC */ @@ -1570,7 +1570,7 @@ em_power_up_serdes_link_82575(struct em_hw *hw) static int32_t em_setup_fiber_serdes_link(struct em_hw *hw) { - uint32_t ctrl, reg; + uint32_t ctrl, ctrl_ext, reg; uint32_t status; uint32_t txcw = 0; uint32_t i; @@ -1613,10 +1613,28 @@ em_setup_fiber_serdes_link(struct em_hw *hw) /* set both sw defined pins on 82575/82576*/ ctrl |= E1000_CTRL_SWDPIN0 | E1000_CTRL_SWDPIN1; - /* Set switch control to serdes energy detect */ - reg = E1000_READ_REG(hw, CONNSW); - reg |= E1000_CONNSW_ENRGSRC; - E1000_WRITE_REG(hw, CONNSW, reg); + ctrl_ext = E1000_READ_REG(hw, CTRL_EXT); + switch (ctrl_ext & E1000_CTRL_EXT_LINK_MODE_MASK) { + case E1000_CTRL_EXT_LINK_MODE_1000BASE_KX: + case E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES: + /* the backplane is always connected */ + reg = E1000_READ_REG(hw, PCS_LCTL); + reg |= E1000_PCS_LCTL_FORCE_FCTRL; + reg |= E1000_PCS_LCTL_FSV_1000 | E1000_PCS_LCTL_FDV_FULL; + reg |= E1000_PCS_LCTL_FSD; /* Force Speed */ + DEBUGOUT("Configuring Forced Link\n"); + E1000_WRITE_REG(hw, PCS_LCTL, reg); + em_force_mac_fc(hw); + hw->autoneg_failed = 0; + return E1000_SUCCESS; + break; + default: + /* Set switch control to serdes energy detect */ + reg = E1000_READ_REG(hw, CONNSW); + reg |= E1000_CONNSW_ENRGSRC; + E1000_WRITE_REG(hw, CONNSW, reg); + break; + } } /* Adjust VCO speed to improve BER performance */ diff --git a/sys/dev/pci/if_em_hw.h b/sys/dev/pci/if_em_hw.h index e2770c0c3fa..345735366de 100644 --- a/sys/dev/pci/if_em_hw.h +++ b/sys/dev/pci/if_em_hw.h @@ -31,7 +31,7 @@ *******************************************************************************/ -/* $OpenBSD: if_em_hw.h,v 1.47 2011/02/06 23:47:14 dlg Exp $ */ +/* $OpenBSD: if_em_hw.h,v 1.48 2011/04/04 03:49:32 william Exp $ */ /* $FreeBSD: if_em_hw.h,v 1.15 2005/05/26 23:32:02 tackerman Exp $ */ /* if_em_hw.h @@ -1579,6 +1579,10 @@ struct em_hw { #define E1000_CONNSW_ENRGSRC 0x4 #define E1000_PCS_CFG_PCS_EN 8 +#define E1000_PCS_LCTL_FSV_1000 4 +#define E1000_PCS_LCTL_FDV_FULL 8 +#define E1000_PCS_LCTL_FSD 0x10 +#define E1000_PCS_LCTL_FORCE_FCTRL 0x80 #define E1000_PCS_LSTS_LINK_OK 0x01 #define E1000_PCS_LSTS_SPEED_100 0x02 |