Update FreeBSD network drivers with the 9.1 release
This commit is contained in:
committed by
Jerome Duval
parent
82ee340110
commit
648db7333e
@@ -56,7 +56,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/bmtphy.c,v 1.12.10.8.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* Driver for the Broadcom BCM5201/BCM5202 "Mini-Theta" PHYs. This also
|
||||
@@ -91,8 +91,7 @@ static device_method_t bmtphy_methods[] = {
|
||||
DEVMETHOD(device_attach, bmtphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t bmtphy_devclass;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
*
|
||||
* from NetBSD: bmtphyreg.h,v 1.1 2001/06/02 21:42:10 thorpej Exp
|
||||
*
|
||||
* $FreeBSD: src/sys/dev/mii/bmtphyreg.h,v 1.2.22.2.2.1 2010/12/21 17:09:25 kensmith Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _DEV_MII_BMTPHYREG_H_
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* driver for generic unknown PHYs
|
||||
@@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = {
|
||||
DEVMETHOD(device_attach, ukphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t ukphy_devclass;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* Subroutines shared by the ukphy driver and other PHY drivers.
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/xl/if_xl.c,v 1.8.2.7.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* 3Com 3c90x Etherlink XL PCI NIC driver
|
||||
@@ -310,17 +310,13 @@ static device_method_t xl_methods[] = {
|
||||
DEVMETHOD(device_suspend, xl_suspend),
|
||||
DEVMETHOD(device_resume, xl_resume),
|
||||
|
||||
/* bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
|
||||
|
||||
/* MII interface */
|
||||
DEVMETHOD(miibus_readreg, xl_miibus_readreg),
|
||||
DEVMETHOD(miibus_writereg, xl_miibus_writereg),
|
||||
DEVMETHOD(miibus_statchg, xl_miibus_statchg),
|
||||
DEVMETHOD(miibus_mediainit, xl_miibus_mediainit),
|
||||
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t xl_driver = {
|
||||
@@ -331,8 +327,9 @@ static driver_t xl_driver = {
|
||||
|
||||
static devclass_t xl_devclass;
|
||||
|
||||
DRIVER_MODULE(xl, pci, xl_driver, xl_devclass, 0, 0);
|
||||
DRIVER_MODULE(miibus, xl, miibus_driver, miibus_devclass, 0, 0);
|
||||
DRIVER_MODULE_ORDERED(xl, pci, xl_driver, xl_devclass, NULL, NULL,
|
||||
SI_ORDER_ANY);
|
||||
DRIVER_MODULE(miibus, xl, miibus_driver, miibus_devclass, NULL, NULL);
|
||||
|
||||
static void
|
||||
xl_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error)
|
||||
@@ -2185,12 +2182,9 @@ xl_intr(void *arg)
|
||||
#endif
|
||||
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
|
||||
break;
|
||||
if (status & XL_STAT_UP_COMPLETE) {
|
||||
int curpkts;
|
||||
|
||||
curpkts = ifp->if_ipackets;
|
||||
xl_rxeof(sc);
|
||||
if (curpkts == ifp->if_ipackets) {
|
||||
if (status & XL_STAT_UP_COMPLETE) {
|
||||
if (xl_rxeof(sc) == 0) {
|
||||
while (xl_rx_resync(sc))
|
||||
xl_rxeof(sc);
|
||||
}
|
||||
@@ -2226,7 +2220,7 @@ xl_intr(void *arg)
|
||||
}
|
||||
|
||||
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd) &&
|
||||
ifp->if_drv_flags & IFF_DRV_RUNNING) {
|
||||
ifp->if_drv_flags & IFF_DRV_RUNNING) {
|
||||
if (sc->xl_type == XL_TYPE_905B)
|
||||
xl_start_90xB_locked(ifp);
|
||||
else
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/dev/xl/if_xlreg.h,v 1.1.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define XL_EE_READ 0x0080 /* read, 5 bit address */
|
||||
|
||||
@@ -86,7 +86,7 @@ static device_method_t xlphy_methods[] = {
|
||||
DEVMETHOD(device_attach, xlphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t xlphy_devclass;
|
||||
|
||||
@@ -91,11 +91,11 @@ TUNABLE_INT("hw.ale.msix_disable", &msix_disable);
|
||||
/*
|
||||
* Devices supported by this driver.
|
||||
*/
|
||||
static struct ale_dev {
|
||||
static const struct ale_dev {
|
||||
uint16_t ale_vendorid;
|
||||
uint16_t ale_deviceid;
|
||||
const char *ale_name;
|
||||
} ale_devs[] = {
|
||||
} const ale_devs[] = {
|
||||
{ VENDORID_ATHEROS, DEVICEID_ATHEROS_AR81XX,
|
||||
"Atheros AR8121/AR8113/AR8114 PCIe Ethernet" },
|
||||
};
|
||||
@@ -115,7 +115,6 @@ static void ale_init_tx_ring(struct ale_softc *);
|
||||
static void ale_int_task(void *, int);
|
||||
static int ale_intr(void *);
|
||||
static int ale_ioctl(struct ifnet *, u_long, caddr_t);
|
||||
static void ale_link_task(void *, int);
|
||||
static void ale_mac_config(struct ale_softc *);
|
||||
static int ale_miibus_readreg(device_t, int, int);
|
||||
static void ale_miibus_statchg(device_t);
|
||||
@@ -164,7 +163,7 @@ static device_method_t ale_methods[] = {
|
||||
DEVMETHOD(miibus_writereg, ale_miibus_writereg),
|
||||
DEVMETHOD(miibus_statchg, ale_miibus_statchg),
|
||||
|
||||
{ NULL, NULL }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t ale_driver = {
|
||||
@@ -175,8 +174,8 @@ static driver_t ale_driver = {
|
||||
|
||||
static devclass_t ale_devclass;
|
||||
|
||||
DRIVER_MODULE(ale, pci, ale_driver, ale_devclass, 0, 0);
|
||||
DRIVER_MODULE(miibus, ale, miibus_driver, miibus_devclass, 0, 0);
|
||||
DRIVER_MODULE(ale, pci, ale_driver, ale_devclass, NULL, NULL);
|
||||
DRIVER_MODULE(miibus, ale, miibus_driver, miibus_devclass, NULL, NULL);
|
||||
|
||||
static struct resource_spec ale_res_spec_mem[] = {
|
||||
{ SYS_RES_MEMORY, PCIR_BAR(0), RF_ACTIVE },
|
||||
@@ -253,10 +252,45 @@ static void
|
||||
ale_miibus_statchg(device_t dev)
|
||||
{
|
||||
struct ale_softc *sc;
|
||||
struct mii_data *mii;
|
||||
struct ifnet *ifp;
|
||||
uint32_t reg;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
mii = device_get_softc(sc->ale_miibus);
|
||||
ifp = sc->ale_ifp;
|
||||
if (mii == NULL || ifp == NULL ||
|
||||
(ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
|
||||
return;
|
||||
|
||||
taskqueue_enqueue(taskqueue_swi, &sc->ale_link_task);
|
||||
sc->ale_flags &= ~ALE_FLAG_LINK;
|
||||
if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
|
||||
(IFM_ACTIVE | IFM_AVALID)) {
|
||||
switch (IFM_SUBTYPE(mii->mii_media_active)) {
|
||||
case IFM_10_T:
|
||||
case IFM_100_TX:
|
||||
sc->ale_flags |= ALE_FLAG_LINK;
|
||||
break;
|
||||
case IFM_1000_T:
|
||||
if ((sc->ale_flags & ALE_FLAG_FASTETHER) == 0)
|
||||
sc->ale_flags |= ALE_FLAG_LINK;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Stop Rx/Tx MACs. */
|
||||
ale_stop_mac(sc);
|
||||
|
||||
/* Program MACs with resolved speed/duplex/flow-control. */
|
||||
if ((sc->ale_flags & ALE_FLAG_LINK) != 0) {
|
||||
ale_mac_config(sc);
|
||||
/* Reenable Tx/Rx MACs. */
|
||||
reg = CSR_READ_4(sc, ALE_MAC_CFG);
|
||||
reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB;
|
||||
CSR_WRITE_4(sc, ALE_MAC_CFG, reg);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -267,12 +301,16 @@ ale_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
|
||||
sc = ifp->if_softc;
|
||||
ALE_LOCK(sc);
|
||||
if ((ifp->if_flags & IFF_UP) == 0) {
|
||||
ALE_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
mii = device_get_softc(sc->ale_miibus);
|
||||
|
||||
mii_pollstat(mii);
|
||||
ALE_UNLOCK(sc);
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
ALE_UNLOCK(sc);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -297,7 +335,7 @@ ale_mediachange(struct ifnet *ifp)
|
||||
static int
|
||||
ale_probe(device_t dev)
|
||||
{
|
||||
struct ale_dev *sp;
|
||||
const struct ale_dev *sp;
|
||||
int i;
|
||||
uint16_t vendor, devid;
|
||||
|
||||
@@ -414,7 +452,7 @@ ale_attach(device_t dev)
|
||||
struct ale_softc *sc;
|
||||
struct ifnet *ifp;
|
||||
uint16_t burst;
|
||||
int error, i, msic, msixc;
|
||||
int error, i, msic, msixc, pmc;
|
||||
uint32_t rxf_len, txf_len;
|
||||
|
||||
error = 0;
|
||||
@@ -425,7 +463,6 @@ ale_attach(device_t dev)
|
||||
MTX_DEF);
|
||||
callout_init_mtx(&sc->ale_tick_ch, &sc->ale_mtx, 0);
|
||||
TASK_INIT(&sc->ale_int_task, 0, ale_int_task, sc);
|
||||
TASK_INIT(&sc->ale_link_task, 0, ale_link_task, sc);
|
||||
|
||||
/* Map the device. */
|
||||
pci_enable_busmaster(dev);
|
||||
@@ -589,18 +626,16 @@ ale_attach(device_t dev)
|
||||
IFQ_SET_READY(&ifp->if_snd);
|
||||
ifp->if_capabilities = IFCAP_RXCSUM | IFCAP_TXCSUM | IFCAP_TSO4;
|
||||
ifp->if_hwassist = ALE_CSUM_FEATURES | CSUM_TSO;
|
||||
#ifdef ENABLE_WOL
|
||||
if (pci_find_cap(dev, PCIY_PMG, &pmc) == 0) {
|
||||
sc->ale_flags |= ALE_FLAG_PMCAP;
|
||||
ifp->if_capabilities |= IFCAP_WOL_MAGIC | IFCAP_WOL_MCAST;
|
||||
}
|
||||
#endif
|
||||
ifp->if_capenable = ifp->if_capabilities;
|
||||
|
||||
/* Set up MII bus. */
|
||||
error = mii_attach(dev, &sc->ale_miibus, ifp, ale_mediachange,
|
||||
ale_mediastatus, BMSR_DEFCAPMASK, sc->ale_phyaddr, MII_OFFSET_ANY,
|
||||
0);
|
||||
MIIF_DOPAUSE);
|
||||
if (error != 0) {
|
||||
device_printf(dev, "attaching PHYs failed\n");
|
||||
goto fail;
|
||||
@@ -681,7 +716,6 @@ ale_detach(device_t dev)
|
||||
ALE_UNLOCK(sc);
|
||||
callout_drain(&sc->ale_tick_ch);
|
||||
taskqueue_drain(sc->ale_tq, &sc->ale_int_task);
|
||||
taskqueue_drain(taskqueue_swi, &sc->ale_link_task);
|
||||
}
|
||||
|
||||
if (sc->ale_tq != NULL) {
|
||||
@@ -1399,7 +1433,6 @@ ale_shutdown(device_t dev)
|
||||
static void
|
||||
ale_setlinkspeed(struct ale_softc *sc)
|
||||
{
|
||||
#ifdef ENABLE_WOL
|
||||
struct mii_data *mii;
|
||||
int aneg, i;
|
||||
|
||||
@@ -1458,13 +1491,11 @@ ale_setlinkspeed(struct ale_softc *sc)
|
||||
mii->mii_media_status = IFM_AVALID | IFM_ACTIVE;
|
||||
mii->mii_media_active = IFM_ETHER | IFM_100_TX | IFM_FDX;
|
||||
ale_mac_config(sc);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
ale_setwol(struct ale_softc *sc)
|
||||
{
|
||||
#ifdef ENABLE_WOL
|
||||
struct ifnet *ifp;
|
||||
uint32_t reg, pmcs;
|
||||
uint16_t pmstat;
|
||||
@@ -1523,7 +1554,6 @@ ale_setwol(struct ale_softc *sc)
|
||||
if ((ifp->if_capenable & IFCAP_WOL) != 0)
|
||||
pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE;
|
||||
pci_write_config(sc->ale_dev, pmc + PCIR_POWER_STATUS, pmstat, 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -2017,14 +2047,12 @@ ale_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
|
||||
ifp->if_hwassist &= ~CSUM_TSO;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_WOL
|
||||
if ((mask & IFCAP_WOL_MCAST) != 0 &&
|
||||
(ifp->if_capabilities & IFCAP_WOL_MCAST) != 0)
|
||||
ifp->if_capenable ^= IFCAP_WOL_MCAST;
|
||||
if ((mask & IFCAP_WOL_MAGIC) != 0 &&
|
||||
(ifp->if_capabilities & IFCAP_WOL_MAGIC) != 0)
|
||||
ifp->if_capenable ^= IFCAP_WOL_MAGIC;
|
||||
#endif
|
||||
if ((mask & IFCAP_VLAN_HWCSUM) != 0 &&
|
||||
(ifp->if_capabilities & IFCAP_VLAN_HWCSUM) != 0)
|
||||
ifp->if_capenable ^= IFCAP_VLAN_HWCSUM;
|
||||
@@ -2073,67 +2101,14 @@ ale_mac_config(struct ale_softc *sc)
|
||||
}
|
||||
if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) {
|
||||
reg |= MAC_CFG_FULL_DUPLEX;
|
||||
#ifdef notyet
|
||||
if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0)
|
||||
reg |= MAC_CFG_TX_FC;
|
||||
if ((IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0)
|
||||
reg |= MAC_CFG_RX_FC;
|
||||
#endif
|
||||
}
|
||||
CSR_WRITE_4(sc, ALE_MAC_CFG, reg);
|
||||
}
|
||||
|
||||
static void
|
||||
ale_link_task(void *arg, int pending)
|
||||
{
|
||||
struct ale_softc *sc;
|
||||
struct mii_data *mii;
|
||||
struct ifnet *ifp;
|
||||
uint32_t reg;
|
||||
|
||||
sc = (struct ale_softc *)arg;
|
||||
|
||||
ALE_LOCK(sc);
|
||||
mii = device_get_softc(sc->ale_miibus);
|
||||
ifp = sc->ale_ifp;
|
||||
if (mii == NULL || ifp == NULL ||
|
||||
(ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
|
||||
ALE_UNLOCK(sc);
|
||||
return;
|
||||
}
|
||||
|
||||
sc->ale_flags &= ~ALE_FLAG_LINK;
|
||||
if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
|
||||
(IFM_ACTIVE | IFM_AVALID)) {
|
||||
switch (IFM_SUBTYPE(mii->mii_media_active)) {
|
||||
case IFM_10_T:
|
||||
case IFM_100_TX:
|
||||
sc->ale_flags |= ALE_FLAG_LINK;
|
||||
break;
|
||||
case IFM_1000_T:
|
||||
if ((sc->ale_flags & ALE_FLAG_FASTETHER) == 0)
|
||||
sc->ale_flags |= ALE_FLAG_LINK;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Stop Rx/Tx MACs. */
|
||||
ale_stop_mac(sc);
|
||||
|
||||
/* Program MACs with resolved speed/duplex/flow-control. */
|
||||
if ((sc->ale_flags & ALE_FLAG_LINK) != 0) {
|
||||
ale_mac_config(sc);
|
||||
/* Reenable Tx/Rx MACs. */
|
||||
reg = CSR_READ_4(sc, ALE_MAC_CFG);
|
||||
reg |= MAC_CFG_TX_ENB | MAC_CFG_RX_ENB;
|
||||
CSR_WRITE_4(sc, ALE_MAC_CFG, reg);
|
||||
}
|
||||
|
||||
ALE_UNLOCK(sc);
|
||||
}
|
||||
|
||||
static void
|
||||
ale_stats_clear(struct ale_softc *sc)
|
||||
{
|
||||
@@ -2821,7 +2796,7 @@ ale_init_locked(struct ale_softc *sc)
|
||||
((rxf_lo << RX_FIFO_PAUSE_THRESH_LO_SHIFT) &
|
||||
RX_FIFO_PAUSE_THRESH_LO_MASK) |
|
||||
((rxf_hi << RX_FIFO_PAUSE_THRESH_HI_SHIFT) &
|
||||
RX_FIFO_PAUSE_THRESH_HI_MASK));
|
||||
RX_FIFO_PAUSE_THRESH_HI_MASK));
|
||||
}
|
||||
|
||||
/* Disable RSS. */
|
||||
@@ -2884,14 +2859,14 @@ ale_init_locked(struct ale_softc *sc)
|
||||
CSR_WRITE_4(sc, ALE_INTR_STATUS, 0xFFFFFFFF);
|
||||
CSR_WRITE_4(sc, ALE_INTR_STATUS, 0);
|
||||
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
|
||||
sc->ale_flags &= ~ALE_FLAG_LINK;
|
||||
/* Switch to the current media. */
|
||||
mii_mediachg(mii);
|
||||
|
||||
callout_reset(&sc->ale_tick_ch, hz, ale_tick, sc);
|
||||
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -221,7 +221,6 @@ struct ale_softc {
|
||||
int ale_pagesize;
|
||||
|
||||
struct task ale_int_task;
|
||||
struct task ale_link_task;
|
||||
struct taskqueue *ale_tq;
|
||||
struct mtx ale_mtx;
|
||||
};
|
||||
|
||||
@@ -16,13 +16,6 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
@@ -48,11 +41,6 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Manuel Bouyer.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
@@ -67,7 +55,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20 2007/01/20 00:52:29 marius Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* driver for generic unknown PHYs
|
||||
@@ -98,7 +86,7 @@ static device_method_t ukphy_methods[] = {
|
||||
DEVMETHOD(device_attach, ukphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t ukphy_devclass;
|
||||
@@ -134,11 +122,9 @@ static int
|
||||
ukphy_attach(device_t dev)
|
||||
{
|
||||
struct mii_softc *sc;
|
||||
struct mii_attach_args *ma;
|
||||
struct mii_data *mii;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
|
||||
mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &ukphy_funcs, 1);
|
||||
mii_phy_setmedia(sc);
|
||||
|
||||
@@ -148,29 +134,12 @@ ukphy_attach(device_t dev)
|
||||
static int
|
||||
ukphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
||||
{
|
||||
struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
|
||||
int reg;
|
||||
|
||||
switch (cmd) {
|
||||
case MII_POLLSTAT:
|
||||
/*
|
||||
* If we're not polling our PHY instance, just return.
|
||||
*/
|
||||
if (IFM_INST(ife->ifm_media) != sc->mii_inst)
|
||||
return (0);
|
||||
break;
|
||||
|
||||
case MII_MEDIACHG:
|
||||
/*
|
||||
* If the media indicates a different PHY instance,
|
||||
* isolate ourselves.
|
||||
*/
|
||||
if (IFM_INST(ife->ifm_media) != sc->mii_inst) {
|
||||
reg = PHY_READ(sc, MII_BMCR);
|
||||
PHY_WRITE(sc, MII_BMCR, reg | BMCR_ISO);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the interface is not up, don't do anything.
|
||||
*/
|
||||
@@ -181,11 +150,6 @@ ukphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
|
||||
break;
|
||||
|
||||
case MII_TICK:
|
||||
/*
|
||||
* If we're not currently selected, just return.
|
||||
*/
|
||||
if (IFM_INST(ife->ifm_media) != sc->mii_inst)
|
||||
return (0);
|
||||
if (mii_phy_tick(sc) == EJUSTRETURN)
|
||||
return (0);
|
||||
break;
|
||||
|
||||
@@ -16,13 +16,6 @@
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
@@ -38,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.8.8.1 2006/07/19 04:40:26 yongari Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* Subroutines shared by the ukphy driver and other PHY drivers.
|
||||
@@ -111,19 +104,26 @@ ukphy_status(struct mii_softc *phy)
|
||||
mii->mii_media_active |= IFM_1000_T|IFM_FDX;
|
||||
else if ((gtcr & GTCR_ADV_1000THDX) &&
|
||||
(gtsr & GTSR_LP_1000THDX))
|
||||
mii->mii_media_active |= IFM_1000_T;
|
||||
else if (anlpar & ANLPAR_T4)
|
||||
mii->mii_media_active |= IFM_100_T4;
|
||||
mii->mii_media_active |= IFM_1000_T|IFM_HDX;
|
||||
else if (anlpar & ANLPAR_TX_FD)
|
||||
mii->mii_media_active |= IFM_100_TX|IFM_FDX;
|
||||
else if (anlpar & ANLPAR_T4)
|
||||
mii->mii_media_active |= IFM_100_T4|IFM_HDX;
|
||||
else if (anlpar & ANLPAR_TX)
|
||||
mii->mii_media_active |= IFM_100_TX;
|
||||
mii->mii_media_active |= IFM_100_TX|IFM_HDX;
|
||||
else if (anlpar & ANLPAR_10_FD)
|
||||
mii->mii_media_active |= IFM_10_T|IFM_FDX;
|
||||
else if (anlpar & ANLPAR_10)
|
||||
mii->mii_media_active |= IFM_10_T;
|
||||
mii->mii_media_active |= IFM_10_T|IFM_HDX;
|
||||
else
|
||||
mii->mii_media_active |= IFM_NONE;
|
||||
|
||||
if ((mii->mii_media_active & IFM_1000_T) != 0 &&
|
||||
(gtsr & GTSR_MS_RES) != 0)
|
||||
mii->mii_media_active |= IFM_ETH_MASTER;
|
||||
|
||||
if ((mii->mii_media_active & IFM_FDX) != 0)
|
||||
mii->mii_media_active |= mii_phy_flowstatus(phy);
|
||||
} else
|
||||
mii->mii_media_active = ife->ifm_media;
|
||||
}
|
||||
|
||||
@@ -349,9 +349,9 @@ alc_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
mii = device_get_softc(sc->alc_miibus);
|
||||
|
||||
mii_pollstat(mii);
|
||||
ALC_UNLOCK(sc);
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
ALC_UNLOCK(sc);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* driver for generic unknown PHYs
|
||||
@@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = {
|
||||
DEVMETHOD(device_attach, ukphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t ukphy_devclass;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* Subroutines shared by the ukphy driver and other PHY drivers.
|
||||
|
||||
@@ -282,9 +282,9 @@ age_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
mii = device_get_softc(sc->age_miibus);
|
||||
|
||||
mii_pollstat(mii);
|
||||
AGE_UNLOCK(sc);
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
AGE_UNLOCK(sc);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1405,7 +1405,7 @@ age_setwol(struct age_softc *sc)
|
||||
AGE_UNLOCK(sc);
|
||||
#ifdef __HAIKU__
|
||||
DELAY(1);
|
||||
#else
|
||||
#else
|
||||
pause("agelnk", hz);
|
||||
#endif
|
||||
AGE_LOCK(sc);
|
||||
|
||||
@@ -59,7 +59,7 @@ static device_method_t atphy_methods[] = {
|
||||
DEVMETHOD(device_attach, atphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ NULL, NULL }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t atphy_devclass;
|
||||
|
||||
@@ -1385,12 +1385,13 @@ ae_pm_init(ae_softc_t *sc)
|
||||
/*
|
||||
* Configure PME.
|
||||
*/
|
||||
pci_find_cap(sc->dev, PCIY_PMG, &pmc);
|
||||
pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2);
|
||||
pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE);
|
||||
if ((ifp->if_capenable & IFCAP_WOL) != 0)
|
||||
pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE;
|
||||
pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2);
|
||||
if (pci_find_cap(sc->dev, PCIY_PMG, &pmc) == 0) {
|
||||
pmstat = pci_read_config(sc->dev, pmc + PCIR_POWER_STATUS, 2);
|
||||
pmstat &= ~(PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE);
|
||||
if ((ifp->if_capenable & IFCAP_WOL) != 0)
|
||||
pmstat |= PCIM_PSTAT_PME | PCIM_PSTAT_PMEENABLE;
|
||||
pci_write_config(sc->dev, pmc + PCIR_POWER_STATUS, pmstat, 2);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -1435,7 +1436,7 @@ ae_tx_avail_size(ae_softc_t *sc)
|
||||
else
|
||||
avail = sc->txd_ack - sc->txd_cur;
|
||||
|
||||
return (avail - 4); /* 4-byte header. */
|
||||
return (avail);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -1452,7 +1453,7 @@ ae_encap(ae_softc_t *sc, struct mbuf **m_head)
|
||||
len = m0->m_pkthdr.len;
|
||||
|
||||
if ((sc->flags & AE_FLAG_TXAVAIL) == 0 ||
|
||||
ae_tx_avail_size(sc) < len) {
|
||||
len + sizeof(ae_txd_t) + 3 > ae_tx_avail_size(sc)) {
|
||||
#ifdef AE_DEBUG
|
||||
if_printf(sc->ifp, "No free Tx available.\n");
|
||||
#endif
|
||||
@@ -1461,11 +1462,10 @@ ae_encap(ae_softc_t *sc, struct mbuf **m_head)
|
||||
|
||||
hdr = (ae_txd_t *)(sc->txd_base + sc->txd_cur);
|
||||
bzero(hdr, sizeof(*hdr));
|
||||
sc->txd_cur = (sc->txd_cur + 4) % AE_TXD_BUFSIZE_DEFAULT; /* Header
|
||||
size. */
|
||||
to_end = AE_TXD_BUFSIZE_DEFAULT - sc->txd_cur; /* Space available to
|
||||
* the end of the ring
|
||||
*/
|
||||
/* Skip header size. */
|
||||
sc->txd_cur = (sc->txd_cur + sizeof(ae_txd_t)) % AE_TXD_BUFSIZE_DEFAULT;
|
||||
/* Space available to the end of the ring */
|
||||
to_end = AE_TXD_BUFSIZE_DEFAULT - sc->txd_cur;
|
||||
if (to_end >= len) {
|
||||
m_copydata(m0, 0, len, (caddr_t)(sc->txd_base + sc->txd_cur));
|
||||
} else {
|
||||
@@ -1844,8 +1844,8 @@ ae_tx_intr(ae_softc_t *sc)
|
||||
/*
|
||||
* Move txd ack and align on 4-byte boundary.
|
||||
*/
|
||||
sc->txd_ack = ((sc->txd_ack + le16toh(txd->len) + 4 + 3) & ~3) %
|
||||
AE_TXD_BUFSIZE_DEFAULT;
|
||||
sc->txd_ack = ((sc->txd_ack + le16toh(txd->len) +
|
||||
sizeof(ae_txs_t) + 3) & ~3) % AE_TXD_BUFSIZE_DEFAULT;
|
||||
|
||||
if ((flags & AE_TXS_SUCCESS) != 0)
|
||||
ifp->if_opackets++;
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* driver for generic unknown PHYs
|
||||
@@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = {
|
||||
DEVMETHOD(device_attach, ukphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t ukphy_devclass;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* Subroutines shared by the ukphy driver and other PHY drivers.
|
||||
|
||||
@@ -137,16 +137,12 @@ static device_method_t bfe_methods[] = {
|
||||
DEVMETHOD(device_suspend, bfe_suspend),
|
||||
DEVMETHOD(device_resume, bfe_resume),
|
||||
|
||||
/* bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
|
||||
|
||||
/* MII interface */
|
||||
DEVMETHOD(miibus_readreg, bfe_miibus_readreg),
|
||||
DEVMETHOD(miibus_writereg, bfe_miibus_writereg),
|
||||
DEVMETHOD(miibus_statchg, bfe_miibus_statchg),
|
||||
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t bfe_driver = {
|
||||
|
||||
@@ -91,8 +91,7 @@ static device_method_t bmtphy_methods[] = {
|
||||
DEVMETHOD(device_attach, bmtphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t bmtphy_devclass;
|
||||
|
||||
@@ -576,7 +576,6 @@ default: DBPRINT(sc, BCE_INSANE_PHY, \
|
||||
#define BCE_CHIP_NUM_5706 0x57060000
|
||||
#define BCE_CHIP_NUM_5708 0x57080000
|
||||
#define BCE_CHIP_NUM_5709 0x57090000
|
||||
#define BCE_CHIP_NUM_5716 0x57160000
|
||||
|
||||
#define BCE_CHIP_REV(sc) (((sc)->bce_chipid) & 0x0000f000)
|
||||
#define BCE_CHIP_REV_Ax 0x00000000
|
||||
@@ -601,7 +600,6 @@ default: DBPRINT(sc, BCE_INSANE_PHY, \
|
||||
#define BCE_CHIP_ID_5709_B1 0x57091010
|
||||
#define BCE_CHIP_ID_5709_B2 0x57091020
|
||||
#define BCE_CHIP_ID_5709_C0 0x57092000
|
||||
#define BCE_CHIP_ID_5716_C0 0x57162000
|
||||
|
||||
#define BCE_CHIP_BOND_ID(sc) (((sc)->bce_chipid) & 0xf)
|
||||
|
||||
@@ -816,6 +814,23 @@ struct flash_spec {
|
||||
#define BCE_DRV_PULSE_SEQ_MASK 0x00007fff
|
||||
|
||||
#define BCE_MB_ARGS_0 0x00000014
|
||||
#define BCE_NETLINK_SPEED_10HALF (1<<0)
|
||||
#define BCE_NETLINK_SPEED_10FULL (1<<1)
|
||||
#define BCE_NETLINK_SPEED_100HALF (1<<2)
|
||||
#define BCE_NETLINK_SPEED_100FULL (1<<3)
|
||||
#define BCE_NETLINK_SPEED_1000HALF (1<<4)
|
||||
#define BCE_NETLINK_SPEED_1000FULL (1<<5)
|
||||
#define BCE_NETLINK_SPEED_2500HALF (1<<6)
|
||||
#define BCE_NETLINK_SPEED_2500FULL (1<<7)
|
||||
#define BCE_NETLINK_SPEED_10GHALF (1<<8)
|
||||
#define BCE_NETLINK_SPEED_10GFULL (1<<9)
|
||||
#define BCE_NETLINK_ANEG_ENB (1<<10)
|
||||
#define BCE_NETLINK_PHY_APP_REMOTE (1<<11)
|
||||
#define BCE_NETLINK_FC_PAUSE_SYM (1<<12)
|
||||
#define BCE_NETLINK_FC_PAUSE_ASYM (1<<13)
|
||||
#define BCE_NETLINK_ETH_AT_WIRESPEED (1<<14)
|
||||
#define BCE_NETLINK_PHY_RESET (1<<15)
|
||||
|
||||
#define BCE_MB_ARGS_1 0x00000018
|
||||
|
||||
/* Indicate to the firmware not to go into the
|
||||
@@ -1081,6 +1096,26 @@ struct flash_spec {
|
||||
#define BCE_BC_STATE_BC_DBG_CMD_LOOP_CNT_MASK 0xffff
|
||||
#define BCE_BC_STATE_BC_DBG_CMD_LOOP_INFINITE 0xffff
|
||||
|
||||
#define BCE_FW_EVT_CODE_MB 0x00000354
|
||||
#define BCE_FW_EVT_CODE_SW_TIMER_EXPIRE_EVENT 0x00000000
|
||||
#define BCE_FW_EVT_CODE_LINK_EVENT 0x00000001
|
||||
|
||||
#define BCE_DRV_ACK_CAP_MB 0x00000364
|
||||
#define BCE_DRV_ACK_CAP_SIGNATURE_MAGIC 0x35450000
|
||||
|
||||
#define BCE_FW_CAP_MB 0x00000368
|
||||
#define BCE_FW_CAP_SIGNATURE_MAGIC 0xaa550000
|
||||
#define BCE_FW_ACK_SIGNATURE_MAGIC 0x52500000
|
||||
#define BCE_FW_CAP_SIGNATURE_MAGIC_MASK 0xffff0000
|
||||
#define BCE_FW_CAP_REMOTE_PHY_CAP 0x00000001
|
||||
#define BCE_FW_CAP_REMOTE_PHY_PRESENT 0x00000002
|
||||
#define BCE_FW_CAP_MFW_KEEP_VLAN 0x00000008
|
||||
#define BCE_FW_CAP_BC_KEEP_VLAN 0x00000010
|
||||
|
||||
#define BCE_RPHY_SERDES_LINK 0x00000374
|
||||
|
||||
#define BCE_RPHY_COPPER_LINK 0x00000378
|
||||
|
||||
#define HOST_VIEW_SHMEM_BASE 0x167c00
|
||||
|
||||
/*
|
||||
@@ -6456,6 +6491,8 @@ struct bce_softc
|
||||
#define BCE_PHY_INT_MODE_AUTO_POLLING_FLAG 0x00000100
|
||||
#define BCE_PHY_INT_MODE_LINK_READY_FLAG 0x00000200
|
||||
#define BCE_PHY_IEEE_CLAUSE_45_FLAG 0x00000400
|
||||
#define BCE_PHY_REMOTE_CAP_FLAG 0x00000800
|
||||
#define BCE_PHY_REMOTE_PORT_FIBER_FLAG 0x00001000
|
||||
|
||||
/* Values that need to be shared with the PHY driver. */
|
||||
u32 bce_shared_hw_cfg;
|
||||
|
||||
@@ -301,6 +301,7 @@ static const struct bge_revision {
|
||||
{ BGE_CHIPID_BCM5717_A0, "BCM5717 A0" },
|
||||
{ BGE_CHIPID_BCM5717_B0, "BCM5717 B0" },
|
||||
{ BGE_CHIPID_BCM5719_A0, "BCM5719 A0" },
|
||||
{ BGE_CHIPID_BCM5720_A0, "BCM5720 A0" },
|
||||
{ BGE_CHIPID_BCM5755_A0, "BCM5755 A0" },
|
||||
{ BGE_CHIPID_BCM5755_A1, "BCM5755 A1" },
|
||||
{ BGE_CHIPID_BCM5755_A2, "BCM5755 A2" },
|
||||
@@ -349,6 +350,7 @@ static const struct bge_revision const bge_majorrevs[] = {
|
||||
{ BGE_ASICREV_BCM57780, "unknown BCM57780" },
|
||||
{ BGE_ASICREV_BCM5717, "unknown BCM5717" },
|
||||
{ BGE_ASICREV_BCM5719, "unknown BCM5719" },
|
||||
{ BGE_ASICREV_BCM5720, "unknown BCM5720" },
|
||||
|
||||
{ 0, NULL }
|
||||
};
|
||||
@@ -378,6 +380,9 @@ static void bge_dma_free(struct bge_softc *);
|
||||
static int bge_dma_ring_alloc(struct bge_softc *, bus_size_t, bus_size_t,
|
||||
bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, const char *);
|
||||
|
||||
static void bge_devinfo(struct bge_softc *);
|
||||
static int bge_mbox_reorder(struct bge_softc *);
|
||||
|
||||
static int bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]);
|
||||
static int bge_get_eaddr_mem(struct bge_softc *, uint8_t[]);
|
||||
static int bge_get_eaddr_nvram(struct bge_softc *, uint8_t[]);
|
||||
@@ -437,6 +442,7 @@ static int bge_init_tx_ring(struct bge_softc *);
|
||||
|
||||
static int bge_chipinit(struct bge_softc *);
|
||||
static int bge_blockinit(struct bge_softc *);
|
||||
static uint32_t bge_dma_swap_options(struct bge_softc *);
|
||||
|
||||
static int bge_has_eaddr(struct bge_softc *);
|
||||
static uint32_t bge_readmem_ind(struct bge_softc *, int);
|
||||
@@ -492,16 +498,12 @@ static device_method_t bge_methods[] = {
|
||||
DEVMETHOD(device_suspend, bge_suspend),
|
||||
DEVMETHOD(device_resume, bge_resume),
|
||||
|
||||
/* bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
|
||||
|
||||
/* MII interface */
|
||||
DEVMETHOD(miibus_readreg, bge_miibus_readreg),
|
||||
DEVMETHOD(miibus_writereg, bge_miibus_writereg),
|
||||
DEVMETHOD(miibus_statchg, bge_miibus_statchg),
|
||||
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t bge_driver = {
|
||||
@@ -642,6 +644,8 @@ bge_writembx(struct bge_softc *sc, int off, int val)
|
||||
off += BGE_LPMBX_IRQ0_HI - BGE_MBX_IRQ0_HI;
|
||||
|
||||
CSR_WRITE_4(sc, off, val);
|
||||
if ((sc->bge_flags & BGE_FLAG_MBOX_REORDER) != 0)
|
||||
CSR_READ_4(sc, off);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1315,15 +1319,17 @@ bge_sig_pre_reset(struct bge_softc *sc, int type)
|
||||
* Some chips don't like this so only do this if ASF is enabled
|
||||
*/
|
||||
if (sc->bge_asf_mode)
|
||||
bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER);
|
||||
bge_writemem_ind(sc, BGE_SRAM_FW_MB, BGE_SRAM_FW_MB_MAGIC);
|
||||
|
||||
if (sc->bge_asf_mode & ASF_NEW_HANDSHAKE) {
|
||||
switch (type) {
|
||||
case BGE_RESET_START:
|
||||
bge_writemem_ind(sc, BGE_SDI_STATUS, 0x1); /* START */
|
||||
bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB,
|
||||
BGE_FW_DRV_STATE_START);
|
||||
break;
|
||||
case BGE_RESET_STOP:
|
||||
bge_writemem_ind(sc, BGE_SDI_STATUS, 0x2); /* UNLOAD */
|
||||
bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB,
|
||||
BGE_FW_DRV_STATE_UNLOAD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1336,11 +1342,13 @@ bge_sig_post_reset(struct bge_softc *sc, int type)
|
||||
if (sc->bge_asf_mode & ASF_NEW_HANDSHAKE) {
|
||||
switch (type) {
|
||||
case BGE_RESET_START:
|
||||
bge_writemem_ind(sc, BGE_SDI_STATUS, 0x80000001);
|
||||
bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB,
|
||||
BGE_FW_DRV_STATE_START_DONE);
|
||||
/* START DONE */
|
||||
break;
|
||||
case BGE_RESET_STOP:
|
||||
bge_writemem_ind(sc, BGE_SDI_STATUS, 0x80000002);
|
||||
bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB,
|
||||
BGE_FW_DRV_STATE_UNLOAD_DONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1353,10 +1361,12 @@ bge_sig_legacy(struct bge_softc *sc, int type)
|
||||
if (sc->bge_asf_mode) {
|
||||
switch (type) {
|
||||
case BGE_RESET_START:
|
||||
bge_writemem_ind(sc, BGE_SDI_STATUS, 0x1); /* START */
|
||||
bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB,
|
||||
BGE_FW_DRV_STATE_START);
|
||||
break;
|
||||
case BGE_RESET_STOP:
|
||||
bge_writemem_ind(sc, BGE_SDI_STATUS, 0x2); /* UNLOAD */
|
||||
bge_writemem_ind(sc, BGE_SRAM_FW_DRV_STATE_MB,
|
||||
BGE_FW_DRV_STATE_UNLOAD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1368,25 +1378,44 @@ bge_stop_fw(struct bge_softc *sc)
|
||||
int i;
|
||||
|
||||
if (sc->bge_asf_mode) {
|
||||
bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW, BGE_FW_PAUSE);
|
||||
CSR_WRITE_4(sc, BGE_CPU_EVENT,
|
||||
CSR_READ_4(sc, BGE_CPU_EVENT) | (1 << 14));
|
||||
bge_writemem_ind(sc, BGE_SRAM_FW_CMD_MB, BGE_FW_CMD_PAUSE);
|
||||
CSR_WRITE_4(sc, BGE_RX_CPU_EVENT,
|
||||
CSR_READ_4(sc, BGE_RX_CPU_EVENT) | BGE_RX_CPU_DRV_EVENT);
|
||||
|
||||
for (i = 0; i < 100; i++ ) {
|
||||
if (!(CSR_READ_4(sc, BGE_CPU_EVENT) & (1 << 14)))
|
||||
if (!(CSR_READ_4(sc, BGE_RX_CPU_EVENT) &
|
||||
BGE_RX_CPU_DRV_EVENT))
|
||||
break;
|
||||
DELAY(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
bge_dma_swap_options(struct bge_softc *sc)
|
||||
{
|
||||
uint32_t dma_options;
|
||||
|
||||
dma_options = BGE_MODECTL_WORDSWAP_NONFRAME |
|
||||
BGE_MODECTL_BYTESWAP_DATA | BGE_MODECTL_WORDSWAP_DATA;
|
||||
#if BYTE_ORDER == BIG_ENDIAN
|
||||
dma_options |= BGE_MODECTL_BYTESWAP_NONFRAME;
|
||||
#endif
|
||||
if ((sc)->bge_asicrev == BGE_ASICREV_BCM5720)
|
||||
dma_options |= BGE_MODECTL_BYTESWAP_B2HRX_DATA |
|
||||
BGE_MODECTL_WORDSWAP_B2HRX_DATA | BGE_MODECTL_B2HRX_ENABLE |
|
||||
BGE_MODECTL_HTX2B_ENABLE;
|
||||
|
||||
return (dma_options);
|
||||
}
|
||||
|
||||
/*
|
||||
* Do endian, PCI and DMA initialization.
|
||||
*/
|
||||
static int
|
||||
bge_chipinit(struct bge_softc *sc)
|
||||
{
|
||||
uint32_t dma_rw_ctl, misc_ctl;
|
||||
uint32_t dma_rw_ctl, misc_ctl, mode_ctl;
|
||||
uint16_t val;
|
||||
int i;
|
||||
|
||||
@@ -1504,9 +1533,8 @@ bge_chipinit(struct bge_softc *sc)
|
||||
/*
|
||||
* Set up general mode register.
|
||||
*/
|
||||
CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS |
|
||||
BGE_MODECTL_MAC_ATTN_INTR | BGE_MODECTL_HOST_SEND_BDS |
|
||||
BGE_MODECTL_TX_NO_PHDR_CSUM);
|
||||
mode_ctl = bge_dma_swap_options(sc) | BGE_MODECTL_MAC_ATTN_INTR |
|
||||
BGE_MODECTL_HOST_SEND_BDS | BGE_MODECTL_TX_NO_PHDR_CSUM;
|
||||
|
||||
/*
|
||||
* BCM5701 B5 have a bug causing data corruption when using
|
||||
@@ -1516,13 +1544,15 @@ bge_chipinit(struct bge_softc *sc)
|
||||
*/
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5701 &&
|
||||
sc->bge_chipid == BGE_CHIPID_BCM5701_B5)
|
||||
BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_FORCE_PCI32);
|
||||
mode_ctl |= BGE_MODECTL_FORCE_PCI32;
|
||||
|
||||
/*
|
||||
* Tell the firmware the driver is running
|
||||
*/
|
||||
if (sc->bge_asf_mode & ASF_STACKUP)
|
||||
BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_STACKUP);
|
||||
mode_ctl |= BGE_MODECTL_STACKUP;
|
||||
|
||||
CSR_WRITE_4(sc, BGE_MODE_CTL, mode_ctl);
|
||||
|
||||
/*
|
||||
* Disable memory write invalidate. Apparently it is not supported
|
||||
@@ -1582,8 +1612,7 @@ bge_blockinit(struct bge_softc *sc)
|
||||
}
|
||||
|
||||
/* Configure mbuf pool watermarks */
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5717 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM57765) {
|
||||
if (BGE_IS_5717_PLUS(sc)) {
|
||||
CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
|
||||
if (sc->bge_ifp->if_mtu > ETHERMTU) {
|
||||
CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x7e);
|
||||
@@ -1718,7 +1747,8 @@ bge_blockinit(struct bge_softc *sc)
|
||||
BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0);
|
||||
}
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5717 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5719)
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5719 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5720)
|
||||
rcb->bge_nicaddr = BGE_STD_RX_RINGS_5717;
|
||||
else
|
||||
rcb->bge_nicaddr = BGE_STD_RX_RINGS;
|
||||
@@ -1751,7 +1781,8 @@ bge_blockinit(struct bge_softc *sc)
|
||||
rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0,
|
||||
BGE_RCB_FLAG_USE_EXT_RX_BD | BGE_RCB_FLAG_RING_DISABLED);
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5717 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5719)
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5719 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5720)
|
||||
rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS_5717;
|
||||
else
|
||||
rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS;
|
||||
@@ -1840,7 +1871,8 @@ bge_blockinit(struct bge_softc *sc)
|
||||
RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi);
|
||||
RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_lo, taddr.bge_addr_lo);
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5717 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5719)
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5719 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5720)
|
||||
RCB_WRITE_4(sc, vrcb, bge_nicaddr, BGE_SEND_RING_5717);
|
||||
else
|
||||
RCB_WRITE_4(sc, vrcb, bge_nicaddr,
|
||||
@@ -1854,7 +1886,8 @@ bge_blockinit(struct bge_softc *sc)
|
||||
* return ring control blocks, located in NIC memory.
|
||||
*/
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5717 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5719) {
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5719 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5720) {
|
||||
/* Should be 17, use 16 until we get an SRAM map. */
|
||||
limit = 16;
|
||||
} else if (!BGE_IS_5705_PLUS(sc))
|
||||
@@ -1898,7 +1931,11 @@ bge_blockinit(struct bge_softc *sc)
|
||||
BGE_TX_BACKOFF_SEED_MASK);
|
||||
|
||||
/* Set inter-packet gap */
|
||||
CSR_WRITE_4(sc, BGE_TX_LENGTHS, 0x2620);
|
||||
val = 0x2620;
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5720)
|
||||
val |= CSR_READ_4(sc, BGE_TX_LENGTHS) &
|
||||
(BGE_TXLEN_JMB_FRM_LEN_MSK | BGE_TXLEN_CNT_DN_VAL_MSK);
|
||||
CSR_WRITE_4(sc, BGE_TX_LENGTHS, val);
|
||||
|
||||
/*
|
||||
* Specify which ring to use for packets that don't match
|
||||
@@ -2053,6 +2090,17 @@ bge_blockinit(struct bge_softc *sc)
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM57780)
|
||||
val |= BGE_RDMAMODE_TSO6_ENABLE;
|
||||
}
|
||||
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5720) {
|
||||
val |= CSR_READ_4(sc, BGE_RDMA_MODE) &
|
||||
BGE_RDMAMODE_H2BNC_VLAN_DET;
|
||||
/*
|
||||
* Allow multiple outstanding read requests from
|
||||
* non-LSO read DMA engine.
|
||||
*/
|
||||
val &= ~BGE_RDMAMODE_MULT_DMA_RD_DIS;
|
||||
}
|
||||
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5761 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5784 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5785 ||
|
||||
@@ -2063,7 +2111,8 @@ bge_blockinit(struct bge_softc *sc)
|
||||
* Adjust tx margin to prevent TX data corruption and
|
||||
* fix internal FIFO overflow.
|
||||
*/
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5719) {
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5719 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5720) {
|
||||
dmactl &= ~(BGE_RDMA_RSRVCTRL_FIFO_LWM_MASK |
|
||||
BGE_RDMA_RSRVCTRL_FIFO_HWM_MASK |
|
||||
BGE_RDMA_RSRVCTRL_TXMRGN_MASK);
|
||||
@@ -2085,6 +2134,15 @@ bge_blockinit(struct bge_softc *sc)
|
||||
CSR_READ_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL) |
|
||||
BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_4K |
|
||||
BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_LSO_4K);
|
||||
} else if (sc->bge_asicrev == BGE_ASICREV_BCM5720) {
|
||||
/*
|
||||
* Allow 4KB burst length reads for non-LSO frames.
|
||||
* Enable 512B burst length reads for buffer descriptors.
|
||||
*/
|
||||
CSR_WRITE_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL,
|
||||
CSR_READ_4(sc, BGE_RDMA_LSO_CRPTEN_CTRL) |
|
||||
BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_512 |
|
||||
BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_LSO_4K);
|
||||
}
|
||||
|
||||
CSR_WRITE_4(sc, BGE_RDMA_MODE, val);
|
||||
@@ -2239,6 +2297,7 @@ bge_probe(device_t dev)
|
||||
case BCOM_DEVICEID_BCM5717:
|
||||
case BCOM_DEVICEID_BCM5718:
|
||||
case BCOM_DEVICEID_BCM5719:
|
||||
case BCOM_DEVICEID_BCM5720:
|
||||
id = pci_read_config(dev,
|
||||
BGE_PCI_GEN2_PRODID_ASICREV, 4);
|
||||
break;
|
||||
@@ -2310,10 +2369,11 @@ bge_dma_free(struct bge_softc *sc)
|
||||
|
||||
if (sc->bge_cdata.bge_rx_mtag)
|
||||
bus_dma_tag_destroy(sc->bge_cdata.bge_rx_mtag);
|
||||
if (sc->bge_cdata.bge_mtag_jumbo)
|
||||
bus_dma_tag_destroy(sc->bge_cdata.bge_mtag_jumbo);
|
||||
if (sc->bge_cdata.bge_tx_mtag)
|
||||
bus_dma_tag_destroy(sc->bge_cdata.bge_tx_mtag);
|
||||
|
||||
|
||||
/* Destroy standard RX ring. */
|
||||
if (sc->bge_cdata.bge_rx_std_ring_map)
|
||||
bus_dmamap_unload(sc->bge_cdata.bge_rx_std_ring_tag,
|
||||
@@ -2559,10 +2619,10 @@ bge_dma_alloc(struct bge_softc *sc)
|
||||
* XXX
|
||||
* watchdog timeout issue was observed on BCM5704 which
|
||||
* lives behind PCI-X bridge(e.g AMD 8131 PCI-X bridge).
|
||||
* Limiting DMA address space to 32bits seems to address
|
||||
* it.
|
||||
* Both limiting DMA address space to 32bits and flushing
|
||||
* mailbox write seem to address the issue.
|
||||
*/
|
||||
if (sc->bge_flags & BGE_FLAG_PCIX)
|
||||
if (sc->bge_pcixcap != 0)
|
||||
lowaddr = BUS_SPACE_MAXADDR_32BIT;
|
||||
}
|
||||
error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev),
|
||||
@@ -2701,6 +2761,9 @@ bge_can_use_msi(struct bge_softc *sc)
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
if (sc->bge_msi == 0)
|
||||
return (0);
|
||||
|
||||
/* Disable MSI for polling(4). */
|
||||
#ifdef DEVICE_POLLING
|
||||
return (0);
|
||||
@@ -2727,6 +2790,102 @@ bge_can_use_msi(struct bge_softc *sc)
|
||||
return (can_use_msi);
|
||||
}
|
||||
|
||||
static int
|
||||
bge_mbox_reorder(struct bge_softc *sc)
|
||||
{
|
||||
#ifndef __HAIKU__
|
||||
/* Lists of PCI bridges that are known to reorder mailbox writes. */
|
||||
static const struct mbox_reorder {
|
||||
const uint16_t vendor;
|
||||
const uint16_t device;
|
||||
const char *desc;
|
||||
} const mbox_reorder_lists[] = {
|
||||
{ 0x1022, 0x7450, "AMD-8131 PCI-X Bridge" },
|
||||
};
|
||||
devclass_t pci, pcib;
|
||||
device_t bus, dev;
|
||||
int i;
|
||||
|
||||
pci = devclass_find("pci");
|
||||
pcib = devclass_find("pcib");
|
||||
dev = sc->bge_dev;
|
||||
bus = device_get_parent(dev);
|
||||
for (;;) {
|
||||
dev = device_get_parent(bus);
|
||||
bus = device_get_parent(dev);
|
||||
if (device_get_devclass(dev) != pcib)
|
||||
break;
|
||||
for (i = 0; i < nitems(mbox_reorder_lists); i++) {
|
||||
if (pci_get_vendor(dev) ==
|
||||
mbox_reorder_lists[i].vendor &&
|
||||
pci_get_device(dev) ==
|
||||
mbox_reorder_lists[i].device) {
|
||||
device_printf(sc->bge_dev,
|
||||
"enabling MBOX workaround for %s\n",
|
||||
mbox_reorder_lists[i].desc);
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
if (device_get_devclass(bus) != pci)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
bge_devinfo(struct bge_softc *sc)
|
||||
{
|
||||
uint32_t cfg, clk;
|
||||
|
||||
device_printf(sc->bge_dev,
|
||||
"CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; ",
|
||||
sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev);
|
||||
if (sc->bge_flags & BGE_FLAG_PCIE)
|
||||
printf("PCI-E\n");
|
||||
else if (sc->bge_flags & BGE_FLAG_PCIX) {
|
||||
printf("PCI-X ");
|
||||
cfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID_MASK;
|
||||
if (cfg == BGE_MISCCFG_BOARD_ID_5704CIOBE)
|
||||
clk = 133;
|
||||
else {
|
||||
clk = CSR_READ_4(sc, BGE_PCI_CLKCTL) & 0x1F;
|
||||
switch (clk) {
|
||||
case 0:
|
||||
clk = 33;
|
||||
break;
|
||||
case 2:
|
||||
clk = 50;
|
||||
break;
|
||||
case 4:
|
||||
clk = 66;
|
||||
break;
|
||||
case 6:
|
||||
clk = 100;
|
||||
break;
|
||||
case 7:
|
||||
clk = 133;
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf("%u MHz\n", clk);
|
||||
} else {
|
||||
if (sc->bge_pcixcap != 0)
|
||||
printf("PCI on PCI-X ");
|
||||
else
|
||||
printf("PCI ");
|
||||
cfg = pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE, 4);
|
||||
if (cfg & BGE_PCISTATE_PCI_BUSSPEED)
|
||||
clk = 66;
|
||||
else
|
||||
clk = 33;
|
||||
if (cfg & BGE_PCISTATE_32BIT_BUS)
|
||||
printf("%u MHz; 32bit\n", clk);
|
||||
else
|
||||
printf("%u MHz; 64bit\n", clk);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
bge_attach(device_t dev)
|
||||
{
|
||||
@@ -2769,6 +2928,7 @@ bge_attach(device_t dev)
|
||||
case BCOM_DEVICEID_BCM5717:
|
||||
case BCOM_DEVICEID_BCM5718:
|
||||
case BCOM_DEVICEID_BCM5719:
|
||||
case BCOM_DEVICEID_BCM5720:
|
||||
sc->bge_chipid = pci_read_config(dev,
|
||||
BGE_PCI_GEN2_PRODID_ASICREV, 4);
|
||||
break;
|
||||
@@ -2800,12 +2960,14 @@ bge_attach(device_t dev)
|
||||
* BCM5704 | 1 | X | 1 | X |
|
||||
* BCM5717 | 1 | 8 | 2 | 9 |
|
||||
* BCM5719 | 1 | 8 | 2 | 9 |
|
||||
* BCM5720 | 1 | 8 | 2 | 9 |
|
||||
*
|
||||
* Other addresses may respond but they are not
|
||||
* IEEE compliant PHYs and should be ignored.
|
||||
*/
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5717 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5719) {
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5719 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5720) {
|
||||
f = pci_get_function(dev);
|
||||
if (sc->bge_chipid == BGE_CHIPID_BCM5717_A0) {
|
||||
if (CSR_READ_4(sc, BGE_SGDIG_STS) &
|
||||
@@ -2840,7 +3002,7 @@ bge_attach(device_t dev)
|
||||
switch (sc->bge_asicrev) {
|
||||
case BGE_ASICREV_BCM5717:
|
||||
case BGE_ASICREV_BCM5719:
|
||||
sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG;
|
||||
case BGE_ASICREV_BCM5720:
|
||||
case BGE_ASICREV_BCM57765:
|
||||
sc->bge_flags |= BGE_FLAG_5717_PLUS | BGE_FLAG_5755_PLUS |
|
||||
BGE_FLAG_575X_PLUS | BGE_FLAG_5705_PLUS | BGE_FLAG_JUMBO |
|
||||
@@ -2875,14 +3037,15 @@ bge_attach(device_t dev)
|
||||
case BGE_ASICREV_BCM5752:
|
||||
case BGE_ASICREV_BCM5906:
|
||||
sc->bge_flags |= BGE_FLAG_575X_PLUS;
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5906)
|
||||
sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG;
|
||||
/* FALLTHROUGH */
|
||||
case BGE_ASICREV_BCM5705:
|
||||
sc->bge_flags |= BGE_FLAG_5705_PLUS;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Add SYSCTLs, requires the chipset family to be set. */
|
||||
bge_add_sysctls(sc);
|
||||
|
||||
/* Set various PHY bug flags. */
|
||||
if (sc->bge_chipid == BGE_CHIPID_BCM5701_A0 ||
|
||||
sc->bge_chipid == BGE_CHIPID_BCM5701_B0)
|
||||
@@ -2898,6 +3061,7 @@ bge_attach(device_t dev)
|
||||
sc->bge_asicrev != BGE_ASICREV_BCM5906 &&
|
||||
sc->bge_asicrev != BGE_ASICREV_BCM5717 &&
|
||||
sc->bge_asicrev != BGE_ASICREV_BCM5719 &&
|
||||
sc->bge_asicrev != BGE_ASICREV_BCM5720 &&
|
||||
sc->bge_asicrev != BGE_ASICREV_BCM5785 &&
|
||||
sc->bge_asicrev != BGE_ASICREV_BCM57765 &&
|
||||
sc->bge_asicrev != BGE_ASICREV_BCM57780) {
|
||||
@@ -2930,17 +3094,28 @@ bge_attach(device_t dev)
|
||||
sc->bge_mi_mode |= BGE_MIMODE_AUTOPOLL;
|
||||
|
||||
/*
|
||||
* All controllers that are not 5755 or higher have 4GB
|
||||
* boundary DMA bug.
|
||||
* All Broadcom controllers have 4GB boundary DMA bug.
|
||||
* Whenever an address crosses a multiple of the 4GB boundary
|
||||
* (including 4GB, 8Gb, 12Gb, etc.) and makes the transition
|
||||
* from 0xX_FFFF_FFFF to 0x(X+1)_0000_0000 an internal DMA
|
||||
* state machine will lockup and cause the device to hang.
|
||||
*/
|
||||
if (BGE_IS_5755_PLUS(sc) == 0)
|
||||
sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG;
|
||||
sc->bge_flags |= BGE_FLAG_4G_BNDRY_BUG;
|
||||
|
||||
misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID;
|
||||
/* BCM5755 or higher and BCM5906 have short DMA bug. */
|
||||
if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906)
|
||||
sc->bge_flags |= BGE_FLAG_SHORT_DMA_BUG;
|
||||
|
||||
/*
|
||||
* BCM5719 cannot handle DMA requests for DMA segments that
|
||||
* have larger than 4KB in size. However the maximum DMA
|
||||
* segment size created in DMA tag is 4KB for TSO, so we
|
||||
* wouldn't encounter the issue here.
|
||||
*/
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5719)
|
||||
sc->bge_flags |= BGE_FLAG_4K_RDMA_BUG;
|
||||
|
||||
misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID_MASK;
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5705) {
|
||||
if (misccfg == BGE_MISCCFG_BOARD_ID_5788 ||
|
||||
misccfg == BGE_MISCCFG_BOARD_ID_5788M)
|
||||
@@ -2997,9 +3172,9 @@ bge_attach(device_t dev)
|
||||
sc->bge_flags |= BGE_FLAG_TSO;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Check if this is a PCI-X or PCI Express device.
|
||||
*/
|
||||
*/
|
||||
if (pci_find_cap(dev, PCIY_EXPRESS, ®) == 0) {
|
||||
/*
|
||||
* Found a PCI Express capabilities register, this
|
||||
@@ -3007,7 +3182,8 @@ bge_attach(device_t dev)
|
||||
*/
|
||||
sc->bge_flags |= BGE_FLAG_PCIE;
|
||||
sc->bge_expcap = reg;
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5719)
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5719 ||
|
||||
sc->bge_asicrev == BGE_ASICREV_BCM5720)
|
||||
pci_set_max_read_req(dev, 2048);
|
||||
else if (pci_get_max_read_req(dev) != 4096)
|
||||
pci_set_max_read_req(dev, 4096);
|
||||
@@ -3030,6 +3206,16 @@ bge_attach(device_t dev)
|
||||
*/
|
||||
if (BGE_IS_5714_FAMILY(sc) && (sc->bge_flags & BGE_FLAG_PCIX))
|
||||
sc->bge_flags |= BGE_FLAG_40BIT_BUG;
|
||||
/*
|
||||
* Some PCI-X bridges are known to trigger write reordering to
|
||||
* the mailbox registers. Typical phenomena is watchdog timeouts
|
||||
* caused by out-of-order TX completions. Enable workaround for
|
||||
* PCI-X devices that live behind these bridges.
|
||||
* Note, PCI-X controllers can run in PCI mode so we can't use
|
||||
* BGE_FLAG_PCIX flag to detect PCI-X controllers.
|
||||
*/
|
||||
if (sc->bge_pcixcap != 0 && bge_mbox_reorder(sc) != 0)
|
||||
sc->bge_flags |= BGE_FLAG_MBOX_REORDER;
|
||||
/*
|
||||
* Allocate the interrupt, using MSI if possible. These devices
|
||||
* support 8 MSI messages, but only the first one is used in
|
||||
@@ -3069,11 +3255,7 @@ bge_attach(device_t dev)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
device_printf(dev,
|
||||
"CHIP ID 0x%08x; ASIC REV 0x%02x; CHIP REV 0x%02x; %s\n",
|
||||
sc->bge_chipid, sc->bge_asicrev, sc->bge_chiprev,
|
||||
(sc->bge_flags & BGE_FLAG_PCIX) ? "PCI-X" :
|
||||
((sc->bge_flags & BGE_FLAG_PCIE) ? "PCI-E" : "PCI"));
|
||||
bge_devinfo(sc);
|
||||
|
||||
BGE_LOCK_INIT(sc, device_get_nameunit(dev));
|
||||
|
||||
@@ -3085,9 +3267,9 @@ bge_attach(device_t dev)
|
||||
}
|
||||
|
||||
sc->bge_asf_mode = 0;
|
||||
if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG)
|
||||
== BGE_MAGIC_NUMBER)) {
|
||||
if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG)
|
||||
if (bge_allow_asf && (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) ==
|
||||
BGE_SRAM_DATA_SIG_MAGIC)) {
|
||||
if (bge_readmem_ind(sc, BGE_SRAM_DATA_CFG)
|
||||
& BGE_HWCFG_ASF) {
|
||||
sc->bge_asf_mode |= ASF_ENABLE;
|
||||
sc->bge_asf_mode |= ASF_STACKUP;
|
||||
@@ -3137,8 +3319,6 @@ bge_attach(device_t dev)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bge_add_sysctls(sc);
|
||||
|
||||
/* Set default tuneable values. */
|
||||
sc->bge_stat_ticks = BGE_TICKS_PER_SEC;
|
||||
sc->bge_rx_coal_ticks = 150;
|
||||
@@ -3201,8 +3381,8 @@ bge_attach(device_t dev)
|
||||
* by its PCI subsystem ID, as we do below for the SysKonnect
|
||||
* SK-9D41.
|
||||
*/
|
||||
if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) == BGE_MAGIC_NUMBER)
|
||||
hwcfg = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG);
|
||||
if (bge_readmem_ind(sc, BGE_SRAM_DATA_SIG) == BGE_SRAM_DATA_SIG_MAGIC)
|
||||
hwcfg = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG);
|
||||
else if ((sc->bge_flags & BGE_FLAG_EADDR) &&
|
||||
(sc->bge_asicrev != BGE_ASICREV_BCM5906)) {
|
||||
if (bge_read_eeprom(sc, (caddr_t)&hwcfg, BGE_EE_HWCFG_OFFSET,
|
||||
@@ -3437,9 +3617,9 @@ bge_reset(struct bge_softc *sc)
|
||||
/*
|
||||
* Write the magic number to SRAM at offset 0xB50.
|
||||
* When firmware finishes its initialization it will
|
||||
* write ~BGE_MAGIC_NUMBER to the same location.
|
||||
* write ~BGE_SRAM_FW_MB_MAGIC to the same location.
|
||||
*/
|
||||
bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER);
|
||||
bge_writemem_ind(sc, BGE_SRAM_FW_MB, BGE_SRAM_FW_MB_MAGIC);
|
||||
|
||||
reset = BGE_MISCCFG_RESET_CORE_CLOCKS | BGE_32BITTIME_66MHZ;
|
||||
|
||||
@@ -3458,7 +3638,8 @@ bge_reset(struct bge_softc *sc)
|
||||
* Set GPHY Power Down Override to leave GPHY
|
||||
* powered up in D0 uninitialized.
|
||||
*/
|
||||
if (BGE_IS_5705_PLUS(sc))
|
||||
if (BGE_IS_5705_PLUS(sc) &&
|
||||
(sc->bge_flags & BGE_FLAG_CPMU_PRESENT) == 0)
|
||||
reset |= BGE_MISCCFG_GPHY_PD_OVERRIDE;
|
||||
|
||||
/* Issue global reset */
|
||||
@@ -3487,8 +3668,6 @@ bge_reset(struct bge_softc *sc)
|
||||
/* Clear enable no snoop and disable relaxed ordering. */
|
||||
devctl &= ~(PCIM_EXP_CTL_RELAXED_ORD_ENABLE |
|
||||
PCIM_EXP_CTL_NOSNOOP_ENABLE);
|
||||
/* Set PCIE max payload size to 128. */
|
||||
devctl &= ~PCIM_EXP_CTL_MAX_PAYLOAD;
|
||||
pci_write_config(dev, sc->bge_expcap + PCIR_EXPRESS_DEVICE_CTL,
|
||||
devctl, 2);
|
||||
/* Clear error status. */
|
||||
@@ -3563,8 +3742,8 @@ bge_reset(struct bge_softc *sc)
|
||||
*/
|
||||
for (i = 0; i < BGE_TIMEOUT; i++) {
|
||||
DELAY(10);
|
||||
val = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM);
|
||||
if (val == ~BGE_MAGIC_NUMBER)
|
||||
val = bge_readmem_ind(sc, BGE_SRAM_FW_MB);
|
||||
if (val == ~BGE_SRAM_FW_MB_MAGIC)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3592,8 +3771,7 @@ bge_reset(struct bge_softc *sc)
|
||||
}
|
||||
|
||||
/* Fix up byte swapping. */
|
||||
CSR_WRITE_4(sc, BGE_MODE_CTL, BGE_DMA_SWAP_OPTIONS |
|
||||
BGE_MODECTL_BYTESWAP_DATA);
|
||||
CSR_WRITE_4(sc, BGE_MODE_CTL, bge_dma_swap_options(sc));
|
||||
|
||||
/* Tell the ASF firmware we are up */
|
||||
if (sc->bge_asf_mode & ASF_STACKUP)
|
||||
@@ -3624,6 +3802,10 @@ bge_reset(struct bge_softc *sc)
|
||||
}
|
||||
DELAY(10000);
|
||||
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5720)
|
||||
BGE_CLRBIT(sc, BGE_CPMU_CLCK_ORIDE,
|
||||
CPMU_CLCK_ORIDE_MAC_ORIDE_EN);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -4007,7 +4189,7 @@ bge_intr_task(void *arg, int pending)
|
||||
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
|
||||
/* Check TX ring producer/consumer. */
|
||||
bge_txeof(sc, tx_cons);
|
||||
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
|
||||
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
|
||||
bge_start_locked(ifp);
|
||||
}
|
||||
BGE_UNLOCK(sc);
|
||||
@@ -4103,12 +4285,14 @@ bge_asf_driver_up(struct bge_softc *sc)
|
||||
sc->bge_asf_count --;
|
||||
else {
|
||||
sc->bge_asf_count = 2;
|
||||
bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM_FW,
|
||||
BGE_FW_DRV_ALIVE);
|
||||
bge_writemem_ind(sc, BGE_SOFTWARE_GENNCOMM_FW_LEN, 4);
|
||||
bge_writemem_ind(sc, BGE_SOFTWARE_GENNCOMM_FW_DATA, 3);
|
||||
CSR_WRITE_4(sc, BGE_CPU_EVENT,
|
||||
CSR_READ_4(sc, BGE_CPU_EVENT) | (1 << 14));
|
||||
bge_writemem_ind(sc, BGE_SRAM_FW_CMD_MB,
|
||||
BGE_FW_CMD_DRV_ALIVE);
|
||||
bge_writemem_ind(sc, BGE_SRAM_FW_CMD_LEN_MB, 4);
|
||||
bge_writemem_ind(sc, BGE_SRAM_FW_CMD_DATA_MB,
|
||||
BGE_FW_HB_TIMEOUT_SEC);
|
||||
CSR_WRITE_4(sc, BGE_RX_CPU_EVENT,
|
||||
CSR_READ_4(sc, BGE_RX_CPU_EVENT) |
|
||||
BGE_RX_CPU_DRV_EVENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4124,7 +4308,7 @@ bge_tick(void *xsc)
|
||||
/* Synchronize with possible callout reset/stop. */
|
||||
if (callout_pending(&sc->bge_stat_ch) ||
|
||||
!callout_active(&sc->bge_stat_ch))
|
||||
return;
|
||||
return;
|
||||
|
||||
if (BGE_IS_5705_PLUS(sc))
|
||||
bge_stats_update_regs(sc);
|
||||
@@ -4239,8 +4423,30 @@ bge_stats_update_regs(struct bge_softc *sc)
|
||||
CSR_READ_4(sc, BGE_RXLP_LOCSTAT_DMA_HPWRQ_FULL);
|
||||
stats->NoMoreRxBDs +=
|
||||
CSR_READ_4(sc, BGE_RXLP_LOCSTAT_OUT_OF_BDS);
|
||||
stats->InputDiscards +=
|
||||
CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS);
|
||||
/*
|
||||
* XXX
|
||||
* Unlike other controllers, BGE_RXLP_LOCSTAT_IFIN_DROPS
|
||||
* counter of BCM5717, BCM5718, BCM5719 A0 and BCM5720 A0
|
||||
* includes number of unwanted multicast frames. This comes
|
||||
* from silicon bug and known workaround to get rough(not
|
||||
* exact) counter is to enable interrupt on MBUF low water
|
||||
* attention. This can be accomplished by setting
|
||||
* BGE_HCCMODE_ATTN bit of BGE_HCC_MODE,
|
||||
* BGE_BMANMODE_LOMBUF_ATTN bit of BGE_BMAN_MODE and
|
||||
* BGE_MODECTL_FLOWCTL_ATTN_INTR bit of BGE_MODE_CTL.
|
||||
* However that change would generate more interrupts and
|
||||
* there are still possibilities of losing multiple frames
|
||||
* during BGE_MODECTL_FLOWCTL_ATTN_INTR interrupt handling.
|
||||
* Given that the workaround still would not get correct
|
||||
* counter I don't think it's worth to implement it. So
|
||||
* ignore reading the counter on controllers that have the
|
||||
* silicon bug.
|
||||
*/
|
||||
if (sc->bge_asicrev != BGE_ASICREV_BCM5717 &&
|
||||
sc->bge_chipid != BGE_CHIPID_BCM5719_A0 &&
|
||||
sc->bge_chipid != BGE_CHIPID_BCM5720_A0)
|
||||
stats->InputDiscards +=
|
||||
CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_DROPS);
|
||||
stats->InputErrors +=
|
||||
CSR_READ_4(sc, BGE_RXLP_LOCSTAT_IFIN_ERRORS);
|
||||
stats->RecvThresholdHit +=
|
||||
@@ -4311,6 +4517,12 @@ bge_stats_update(struct bge_softc *sc)
|
||||
ifp->if_collisions += (uint32_t)(cnt - sc->bge_tx_collisions);
|
||||
sc->bge_tx_collisions = cnt;
|
||||
|
||||
cnt = READ_STAT(sc, stats, nicNoMoreRxBDs.bge_addr_lo);
|
||||
ifp->if_ierrors += (uint32_t)(cnt - sc->bge_rx_nobds);
|
||||
sc->bge_rx_nobds = cnt;
|
||||
cnt = READ_STAT(sc, stats, ifInErrors.bge_addr_lo);
|
||||
ifp->if_ierrors += (uint32_t)(cnt - sc->bge_rx_inerrs);
|
||||
sc->bge_rx_inerrs = cnt;
|
||||
cnt = READ_STAT(sc, stats, ifInDiscards.bge_addr_lo);
|
||||
ifp->if_ierrors += (uint32_t)(cnt - sc->bge_rx_discards);
|
||||
sc->bge_rx_discards = cnt;
|
||||
@@ -4836,6 +5048,11 @@ bge_init_locked(struct bge_softc *sc)
|
||||
mode = CSR_READ_4(sc, BGE_TX_MODE);
|
||||
if (BGE_IS_5755_PLUS(sc) || sc->bge_asicrev == BGE_ASICREV_BCM5906)
|
||||
mode |= BGE_TXMODE_MBUF_LOCKUP_FIX;
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5720) {
|
||||
mode &= ~(BGE_TXMODE_JMB_FRM_LEN | BGE_TXMODE_CNT_DN_MODE);
|
||||
mode |= CSR_READ_4(sc, BGE_TX_MODE) &
|
||||
(BGE_TXMODE_JMB_FRM_LEN | BGE_TXMODE_CNT_DN_MODE);
|
||||
}
|
||||
/* Turn on transmitter. */
|
||||
CSR_WRITE_4(sc, BGE_TX_MODE, mode | BGE_TXMODE_ENABLE);
|
||||
|
||||
@@ -5048,7 +5265,7 @@ bge_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
break;
|
||||
}
|
||||
} else if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU) {
|
||||
error = EINVAL;
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
BGE_LOCK(sc);
|
||||
@@ -5536,6 +5753,12 @@ bge_add_sysctls(struct bge_softc *sc)
|
||||
"Number of fragmented TX buffers of a frame allowed before "
|
||||
"forced collapsing");
|
||||
|
||||
sc->bge_msi = 1;
|
||||
snprintf(tn, sizeof(tn), "dev.bge.%d.msi", unit);
|
||||
TUNABLE_INT_FETCH(tn, &sc->bge_msi);
|
||||
SYSCTL_ADD_INT(ctx, children, OID_AUTO, "msi",
|
||||
CTLFLAG_RD, &sc->bge_msi, 0, "Enable MSI");
|
||||
|
||||
/*
|
||||
* It seems all Broadcom controllers have a bug that can generate UDP
|
||||
* datagrams with checksum value 0 when TX UDP checksum offloading is
|
||||
@@ -5809,8 +6032,7 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
struct bge_softc *sc;
|
||||
uint16_t *sbdata;
|
||||
int error;
|
||||
int result;
|
||||
int error, result, sbsz;
|
||||
int i, j;
|
||||
|
||||
result = -1;
|
||||
@@ -5821,14 +6043,21 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARGS)
|
||||
if (result == 1) {
|
||||
sc = (struct bge_softc *)arg1;
|
||||
|
||||
if (sc->bge_asicrev == BGE_ASICREV_BCM5700 &&
|
||||
sc->bge_chipid != BGE_CHIPID_BCM5700_C0)
|
||||
sbsz = BGE_STATUS_BLK_SZ;
|
||||
else
|
||||
sbsz = 32;
|
||||
sbdata = (uint16_t *)sc->bge_ldata.bge_status_block;
|
||||
printf("Status Block:\n");
|
||||
for (i = 0x0; i < (BGE_STATUS_BLK_SZ / 4); ) {
|
||||
BGE_LOCK(sc);
|
||||
bus_dmamap_sync(sc->bge_cdata.bge_status_tag,
|
||||
sc->bge_cdata.bge_status_map,
|
||||
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
|
||||
for (i = 0x0; i < sbsz / sizeof(uint16_t); ) {
|
||||
printf("%06x:", i);
|
||||
for (j = 0; j < 8; j++) {
|
||||
printf(" %04x", sbdata[i]);
|
||||
i += 4;
|
||||
}
|
||||
for (j = 0; j < 8; j++)
|
||||
printf(" %04x", sbdata[i++]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@@ -5841,8 +6070,11 @@ bge_sysctl_debug_info(SYSCTL_HANDLER_ARGS)
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
BGE_UNLOCK(sc);
|
||||
|
||||
printf("Hardware Flags:\n");
|
||||
if (BGE_IS_5717_PLUS(sc))
|
||||
printf(" - 5717 Plus\n");
|
||||
if (BGE_IS_5755_PLUS(sc))
|
||||
printf(" - 5755 Plus\n");
|
||||
if (BGE_IS_575X_PLUS(sc))
|
||||
@@ -5932,11 +6164,11 @@ bge_get_eaddr_mem(struct bge_softc *sc, uint8_t ether_addr[])
|
||||
{
|
||||
uint32_t mac_addr;
|
||||
|
||||
mac_addr = bge_readmem_ind(sc, 0x0c14);
|
||||
mac_addr = bge_readmem_ind(sc, BGE_SRAM_MAC_ADDR_HIGH_MB);
|
||||
if ((mac_addr >> 16) == 0x484b) {
|
||||
ether_addr[0] = (uint8_t)(mac_addr >> 8);
|
||||
ether_addr[1] = (uint8_t)mac_addr;
|
||||
mac_addr = bge_readmem_ind(sc, 0x0c18);
|
||||
mac_addr = bge_readmem_ind(sc, BGE_SRAM_MAC_ADDR_LOW_MB);
|
||||
ether_addr[2] = (uint8_t)(mac_addr >> 24);
|
||||
ether_addr[3] = (uint8_t)(mac_addr >> 16);
|
||||
ether_addr[4] = (uint8_t)(mac_addr >> 8);
|
||||
|
||||
@@ -71,12 +71,15 @@
|
||||
#define BGE_STATS_BLOCK_END 0x00000AFF
|
||||
#define BGE_STATUS_BLOCK 0x00000B00
|
||||
#define BGE_STATUS_BLOCK_END 0x00000B4F
|
||||
#define BGE_SOFTWARE_GENCOMM 0x00000B50
|
||||
#define BGE_SOFTWARE_GENCOMM_SIG 0x00000B54
|
||||
#define BGE_SOFTWARE_GENCOMM_NICCFG 0x00000B58
|
||||
#define BGE_SOFTWARE_GENCOMM_FW 0x00000B78
|
||||
#define BGE_SOFTWARE_GENNCOMM_FW_LEN 0x00000B7C
|
||||
#define BGE_SOFTWARE_GENNCOMM_FW_DATA 0x00000B80
|
||||
#define BGE_SRAM_FW_MB 0x00000B50
|
||||
#define BGE_SRAM_DATA_SIG 0x00000B54
|
||||
#define BGE_SRAM_DATA_CFG 0x00000B58
|
||||
#define BGE_SRAM_FW_CMD_MB 0x00000B78
|
||||
#define BGE_SRAM_FW_CMD_LEN_MB 0x00000B7C
|
||||
#define BGE_SRAM_FW_CMD_DATA_MB 0x00000B80
|
||||
#define BGE_SRAM_FW_DRV_STATE_MB 0x00000C04
|
||||
#define BGE_SRAM_MAC_ADDR_HIGH_MB 0x00000C14
|
||||
#define BGE_SRAM_MAC_ADDR_LOW_MB 0x00000C18
|
||||
#define BGE_SOFTWARE_GENCOMM_END 0x00000FFF
|
||||
#define BGE_UNMAPPED 0x00001000
|
||||
#define BGE_UNMAPPED_END 0x00001FFF
|
||||
@@ -87,8 +90,24 @@
|
||||
#define BGE_SEND_RING_1_TO_4_END 0x00005FFF
|
||||
|
||||
/* Firmware interface */
|
||||
#define BGE_FW_DRV_ALIVE 0x00000001
|
||||
#define BGE_FW_PAUSE 0x00000002
|
||||
#define BGE_SRAM_DATA_SIG_MAGIC 0x4B657654 /* 'KevT' */
|
||||
|
||||
#define BGE_FW_CMD_DRV_ALIVE 0x00000001
|
||||
#define BGE_FW_CMD_PAUSE 0x00000002
|
||||
#define BGE_FW_CMD_IPV4_ADDR_CHANGE 0x00000003
|
||||
#define BGE_FW_CMD_IPV6_ADDR_CHANGE 0x00000004
|
||||
#define BGE_FW_CMD_LINK_UPDATE 0x0000000C
|
||||
#define BGE_FW_CMD_DRV_ALIVE2 0x0000000D
|
||||
#define BGE_FW_CMD_DRV_ALIVE3 0x0000000E
|
||||
|
||||
#define BGE_FW_HB_TIMEOUT_SEC 3
|
||||
|
||||
#define BGE_FW_DRV_STATE_START 0x00000001
|
||||
#define BGE_FW_DRV_STATE_START_DONE 0x80000001
|
||||
#define BGE_FW_DRV_STATE_UNLOAD 0x00000002
|
||||
#define BGE_FW_DRV_STATE_UNLOAD_DONE 0x80000002
|
||||
#define BGE_FW_DRV_STATE_WOL 0x00000003
|
||||
#define BGE_FW_DRV_STATE_SUSPEND 0x00000004
|
||||
|
||||
/* Mappings for internal memory configuration */
|
||||
#define BGE_STD_RX_RINGS 0x00006000
|
||||
@@ -239,15 +258,6 @@
|
||||
#define BGE_PCIMISCCTL_ASICREV_SHIFT 16
|
||||
|
||||
#define BGE_HIF_SWAP_OPTIONS (BGE_PCIMISCCTL_ENDIAN_WORDSWAP)
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#define BGE_DMA_SWAP_OPTIONS \
|
||||
BGE_MODECTL_WORDSWAP_NONFRAME| \
|
||||
BGE_MODECTL_BYTESWAP_DATA|BGE_MODECTL_WORDSWAP_DATA
|
||||
#else
|
||||
#define BGE_DMA_SWAP_OPTIONS \
|
||||
BGE_MODECTL_WORDSWAP_NONFRAME|BGE_MODECTL_BYTESWAP_NONFRAME| \
|
||||
BGE_MODECTL_BYTESWAP_DATA|BGE_MODECTL_WORDSWAP_DATA
|
||||
#endif
|
||||
|
||||
#define BGE_INIT \
|
||||
(BGE_HIF_SWAP_OPTIONS|BGE_PCIMISCCTL_CLEAR_INTA| \
|
||||
@@ -320,6 +330,7 @@
|
||||
#define BGE_CHIPID_BCM5717_A0 0x05717000
|
||||
#define BGE_CHIPID_BCM5717_B0 0x05717100
|
||||
#define BGE_CHIPID_BCM5719_A0 0x05719000
|
||||
#define BGE_CHIPID_BCM5720_A0 0x05720000
|
||||
#define BGE_CHIPID_BCM57765_A0 0x57785000
|
||||
#define BGE_CHIPID_BCM57765_B0 0x57785100
|
||||
|
||||
@@ -344,6 +355,7 @@
|
||||
/* BGE_PCI_PRODID_ASICREV ASIC rev. identifiers. */
|
||||
#define BGE_ASICREV_BCM5717 0x5717
|
||||
#define BGE_ASICREV_BCM5719 0x5719
|
||||
#define BGE_ASICREV_BCM5720 0x5720
|
||||
#define BGE_ASICREV_BCM5761 0x5761
|
||||
#define BGE_ASICREV_BCM5784 0x5784
|
||||
#define BGE_ASICREV_BCM5785 0x5785
|
||||
@@ -788,6 +800,8 @@
|
||||
#define BGE_TXMODE_BIGBACKOFF_ENABLE 0x00000020
|
||||
#define BGE_TXMODE_LONGPAUSE_ENABLE 0x00000040
|
||||
#define BGE_TXMODE_MBUF_LOCKUP_FIX 0x00000100
|
||||
#define BGE_TXMODE_JMB_FRM_LEN 0x00400000
|
||||
#define BGE_TXMODE_CNT_DN_MODE 0x00800000
|
||||
|
||||
/* Transmit MAC status register */
|
||||
#define BGE_TXSTAT_RX_XOFFED 0x00000001
|
||||
@@ -801,6 +815,8 @@
|
||||
#define BGE_TXLEN_SLOTTIME 0x000000FF
|
||||
#define BGE_TXLEN_IPG 0x00000F00
|
||||
#define BGE_TXLEN_CRS 0x00003000
|
||||
#define BGE_TXLEN_JMB_FRM_LEN_MSK 0x00FF0000
|
||||
#define BGE_TXLEN_CNT_DN_VAL_MSK 0xFF000000
|
||||
|
||||
/* Receive MAC mode register */
|
||||
#define BGE_RXMODE_RESET 0x00000001
|
||||
@@ -1258,6 +1274,7 @@
|
||||
#define BGE_CPMU_LSPD_1000MB_CLK 0x360C
|
||||
#define BGE_CPMU_LNK_AWARE_PWRMD 0x3610
|
||||
#define BGE_CPMU_HST_ACC 0x361C
|
||||
#define BGE_CPMU_CLCK_ORIDE 0x3624
|
||||
#define BGE_CPMU_CLCK_STAT 0x3630
|
||||
#define BGE_CPMU_MUTEX_REQ 0x365C
|
||||
#define BGE_CPMU_MUTEX_GNT 0x3660
|
||||
@@ -1285,6 +1302,9 @@
|
||||
#define BGE_CPMU_HST_ACC_MACCLK_MASK 0x001F0000
|
||||
#define BGE_CPMU_HST_ACC_MACCLK_6_25 0x00130000
|
||||
|
||||
/* Clock Speed Override Policy register */
|
||||
#define CPMU_CLCK_ORIDE_MAC_ORIDE_EN 0x80000000
|
||||
|
||||
/* CPMU Clock Status register */
|
||||
#define BGE_CPMU_CLCK_STAT_MAC_CLCK_MASK 0x001F0000
|
||||
#define BGE_CPMU_CLCK_STAT_MAC_CLCK_62_5 0x00000000
|
||||
@@ -1532,6 +1552,7 @@
|
||||
#define BGE_RDMAMODE_MULT_DMA_RD_DIS 0x01000000
|
||||
#define BGE_RDMAMODE_TSO4_ENABLE 0x08000000
|
||||
#define BGE_RDMAMODE_TSO6_ENABLE 0x10000000
|
||||
#define BGE_RDMAMODE_H2BNC_VLAN_DET 0x20000000
|
||||
|
||||
/* Read DMA status register */
|
||||
#define BGE_RDMASTAT_PCI_TGT_ABRT_ATTN 0x00000004
|
||||
@@ -1552,6 +1573,7 @@
|
||||
#define BGE_RDMA_RSRVCTRL_FIFO_HWM_MASK 0x000FF000
|
||||
#define BGE_RDMA_RSRVCTRL_TXMRGN_MASK 0xFFE00000
|
||||
|
||||
#define BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_512 0x00020000
|
||||
#define BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_BD_4K 0x00030000
|
||||
#define BGE_RDMA_LSO_CRPTEN_CTRL_BLEN_LSO_4K 0x000C0000
|
||||
|
||||
@@ -1875,7 +1897,8 @@
|
||||
#define BGE_MODE_CTL 0x6800
|
||||
#define BGE_MISC_CFG 0x6804
|
||||
#define BGE_MISC_LOCAL_CTL 0x6808
|
||||
#define BGE_CPU_EVENT 0x6810
|
||||
#define BGE_RX_CPU_EVENT 0x6810
|
||||
#define BGE_TX_CPU_EVENT 0x6820
|
||||
#define BGE_EE_ADDR 0x6838
|
||||
#define BGE_EE_DATA 0x683C
|
||||
#define BGE_EE_CTL 0x6840
|
||||
@@ -1883,6 +1906,8 @@
|
||||
#define BGE_EE_DELAY 0x6848
|
||||
#define BGE_FASTBOOT_PC 0x6894
|
||||
|
||||
#define BGE_RX_CPU_DRV_EVENT 0x00004000
|
||||
|
||||
/*
|
||||
* NVRAM Control registers
|
||||
*/
|
||||
@@ -1939,14 +1964,18 @@
|
||||
#define BGE_MODECTL_WORDSWAP_NONFRAME 0x00000004
|
||||
#define BGE_MODECTL_BYTESWAP_DATA 0x00000010
|
||||
#define BGE_MODECTL_WORDSWAP_DATA 0x00000020
|
||||
#define BGE_MODECTL_BYTESWAP_B2HRX_DATA 0x00000040
|
||||
#define BGE_MODECTL_WORDSWAP_B2HRX_DATA 0x00000080
|
||||
#define BGE_MODECTL_NO_FRAME_CRACKING 0x00000200
|
||||
#define BGE_MODECTL_NO_RX_CRC 0x00000400
|
||||
#define BGE_MODECTL_RX_BADFRAMES 0x00000800
|
||||
#define BGE_MODECTL_NO_TX_INTR 0x00002000
|
||||
#define BGE_MODECTL_NO_RX_INTR 0x00004000
|
||||
#define BGE_MODECTL_FORCE_PCI32 0x00008000
|
||||
#define BGE_MODECTL_B2HRX_ENABLE 0x00008000
|
||||
#define BGE_MODECTL_STACKUP 0x00010000
|
||||
#define BGE_MODECTL_HOST_SEND_BDS 0x00020000
|
||||
#define BGE_MODECTL_HTX2B_ENABLE 0x00040000
|
||||
#define BGE_MODECTL_TX_NO_PHDR_CSUM 0x00100000
|
||||
#define BGE_MODECTL_RX_NO_PHDR_CSUM 0x00800000
|
||||
#define BGE_MODECTL_TX_ATTN_INTR 0x01000000
|
||||
@@ -1960,7 +1989,9 @@
|
||||
/* Misc. config register */
|
||||
#define BGE_MISCCFG_RESET_CORE_CLOCKS 0x00000001
|
||||
#define BGE_MISCCFG_TIMER_PRESCALER 0x000000FE
|
||||
#define BGE_MISCCFG_BOARD_ID 0x0001E000
|
||||
#define BGE_MISCCFG_BOARD_ID_MASK 0x0001E000
|
||||
#define BGE_MISCCFG_BOARD_ID_5704 0x00000000
|
||||
#define BGE_MISCCFG_BOARD_ID_5704CIOBE 0x00004000
|
||||
#define BGE_MISCCFG_BOARD_ID_5788 0x00010000
|
||||
#define BGE_MISCCFG_BOARD_ID_5788M 0x00018000
|
||||
#define BGE_MISCCFG_EPHY_IDDQ 0x00200000
|
||||
@@ -2052,10 +2083,10 @@
|
||||
* This magic number is written to the firmware mailbox at 0xb50
|
||||
* before a software reset is issued. After the internal firmware
|
||||
* has completed its initialization it will write the opposite of
|
||||
* this value, ~BGE_MAGIC_NUMBER, to the same location, allowing the
|
||||
* driver to synchronize with the firmware.
|
||||
* this value, ~BGE_SRAM_FW_MB_MAGIC, to the same location,
|
||||
* allowing the driver to synchronize with the firmware.
|
||||
*/
|
||||
#define BGE_MAGIC_NUMBER 0x4B657654
|
||||
#define BGE_SRAM_FW_MB_MAGIC 0x4B657654
|
||||
|
||||
typedef struct {
|
||||
uint32_t bge_addr_hi;
|
||||
@@ -2276,7 +2307,8 @@ struct bge_status_block {
|
||||
#define BCOM_DEVICEID_BCM5717 0x1655
|
||||
#define BCOM_DEVICEID_BCM5718 0x1656
|
||||
#define BCOM_DEVICEID_BCM5719 0x1657
|
||||
#define BCOM_DEVICEID_BCM5720 0x1658
|
||||
#define BCOM_DEVICEID_BCM5720_PP 0x1658 /* Not released to public. */
|
||||
#define BCOM_DEVICEID_BCM5720 0x165F
|
||||
#define BCOM_DEVICEID_BCM5721 0x1659
|
||||
#define BCOM_DEVICEID_BCM5722 0x165A
|
||||
#define BCOM_DEVICEID_BCM5723 0x165B
|
||||
@@ -2797,6 +2829,8 @@ struct bge_softc {
|
||||
#define BGE_FLAG_4G_BNDRY_BUG 0x02000000
|
||||
#define BGE_FLAG_RX_ALIGNBUG 0x04000000
|
||||
#define BGE_FLAG_SHORT_DMA_BUG 0x08000000
|
||||
#define BGE_FLAG_4K_RDMA_BUG 0x10000000
|
||||
#define BGE_FLAG_MBOX_REORDER 0x20000000
|
||||
uint32_t bge_phy_flags;
|
||||
#define BGE_PHY_NO_WIRESPEED 0x00000001
|
||||
#define BGE_PHY_ADC_BUG 0x00000002
|
||||
@@ -2833,9 +2867,12 @@ struct bge_softc {
|
||||
int bge_timer;
|
||||
int bge_forced_collapse;
|
||||
int bge_forced_udpcsum;
|
||||
int bge_msi;
|
||||
int bge_csum_features;
|
||||
struct callout bge_stat_ch;
|
||||
uint32_t bge_rx_discards;
|
||||
uint32_t bge_rx_inerrs;
|
||||
uint32_t bge_rx_nobds;
|
||||
uint32_t bge_tx_discards;
|
||||
uint32_t bge_tx_collisions;
|
||||
#ifdef DEVICE_POLLING
|
||||
|
||||
@@ -82,7 +82,7 @@ static device_method_t brgphy_methods[] = {
|
||||
DEVMETHOD(device_attach, brgphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t brgphy_devclass;
|
||||
@@ -139,9 +139,14 @@ static const struct mii_phydesc brgphys[] = {
|
||||
MII_PHY_DESC(BROADCOM2, BCM5754),
|
||||
MII_PHY_DESC(BROADCOM2, BCM5761),
|
||||
MII_PHY_DESC(BROADCOM2, BCM5784),
|
||||
#ifdef notyet /* better handled by ukphy(4) until WARs are implemented */
|
||||
MII_PHY_DESC(BROADCOM2, BCM5785),
|
||||
#endif
|
||||
MII_PHY_DESC(BROADCOM3, BCM5717C),
|
||||
MII_PHY_DESC(BROADCOM3, BCM5719C),
|
||||
MII_PHY_DESC(BROADCOM3, BCM5720C),
|
||||
MII_PHY_DESC(BROADCOM3, BCM57765),
|
||||
MII_PHY_DESC(BROADCOM3, BCM57780),
|
||||
MII_PHY_DESC(xxBROADCOM_ALT1, BCM5906),
|
||||
MII_PHY_END
|
||||
};
|
||||
@@ -221,7 +226,8 @@ brgphy_attach(device_t dev)
|
||||
sc->mii_flags |= MIIF_HAVEFIBER;
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
case MII_OUI_BROADCOM2:
|
||||
switch (sc->mii_mpd_model) {
|
||||
case MII_MODEL_BROADCOM2_BCM5708S:
|
||||
@@ -938,7 +944,8 @@ brgphy_reset(struct mii_softc *sc)
|
||||
if (bge_sc->bge_phy_flags & BGE_PHY_JITTER_BUG)
|
||||
brgphy_fixup_jitter_bug(sc);
|
||||
|
||||
brgphy_jumbo_settings(sc, ifp->if_mtu);
|
||||
if (bge_sc->bge_flags & BGE_FLAG_JUMBO)
|
||||
brgphy_jumbo_settings(sc, ifp->if_mtu);
|
||||
|
||||
if ((bge_sc->bge_phy_flags & BGE_PHY_NO_WIRESPEED) == 0)
|
||||
brgphy_ethernet_wirespeed(sc);
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* driver for generic unknown PHYs
|
||||
@@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = {
|
||||
DEVMETHOD(device_attach, ukphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t ukphy_devclass;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* Subroutines shared by the ukphy driver and other PHY drivers.
|
||||
|
||||
@@ -95,7 +95,7 @@ static device_method_t dcphy_methods[] = {
|
||||
DEVMETHOD(device_attach, dcphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t dcphy_devclass;
|
||||
@@ -294,7 +294,7 @@ static void
|
||||
dcphy_status(struct mii_softc *sc)
|
||||
{
|
||||
struct mii_data *mii = sc->mii_pdata;
|
||||
int reg, anlpar, tstat = 0;
|
||||
int anlpar, tstat;
|
||||
struct dc_softc *dc_sc;
|
||||
|
||||
dc_sc = mii->mii_ifp->if_softc;
|
||||
@@ -305,13 +305,12 @@ dcphy_status(struct mii_softc *sc)
|
||||
if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
|
||||
return;
|
||||
|
||||
reg = CSR_READ_4(dc_sc, DC_10BTSTAT);
|
||||
if (!(reg & DC_TSTAT_LS10) || !(reg & DC_TSTAT_LS100))
|
||||
tstat = CSR_READ_4(dc_sc, DC_10BTSTAT);
|
||||
if (!(tstat & DC_TSTAT_LS10) || !(tstat & DC_TSTAT_LS100))
|
||||
mii->mii_media_status |= IFM_ACTIVE;
|
||||
|
||||
if (CSR_READ_4(dc_sc, DC_10BTCTRL) & DC_TCTL_AUTONEGENBL) {
|
||||
/* Erg, still trying, I guess... */
|
||||
tstat = CSR_READ_4(dc_sc, DC_10BTSTAT);
|
||||
if ((tstat & DC_TSTAT_ANEGSTAT) != DC_ASTAT_AUTONEGCMP) {
|
||||
if ((DC_IS_MACRONIX(dc_sc) || DC_IS_PNICII(dc_sc)) &&
|
||||
(tstat & DC_TSTAT_ANEGSTAT) == DC_ASTAT_DISABLE)
|
||||
@@ -351,9 +350,9 @@ dcphy_status(struct mii_softc *sc)
|
||||
* and hope that the user is clever enough to manually
|
||||
* change the media settings if we're wrong.
|
||||
*/
|
||||
if (!(reg & DC_TSTAT_LS100))
|
||||
if (!(tstat & DC_TSTAT_LS100))
|
||||
mii->mii_media_active |= IFM_100_TX | IFM_HDX;
|
||||
else if (!(reg & DC_TSTAT_LS10))
|
||||
else if (!(tstat & DC_TSTAT_LS10))
|
||||
mii->mii_media_active |= IFM_10_T | IFM_HDX;
|
||||
else
|
||||
mii->mii_media_active |= IFM_NONE;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/dc/if_dc.c,v 1.201.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* DEC "tulip" clone ethernet driver. Supports the DEC/Intel 21143
|
||||
@@ -225,6 +225,10 @@ static const struct dc_type const dc_devs[] = {
|
||||
"Linksys PCMPC200 CardBus 10/100" },
|
||||
{ DC_DEVID(DC_VENDORID_LINKSYS, DC_DEVICEID_PCMPC200_AB09), 0,
|
||||
"Linksys PCMPC200 CardBus 10/100" },
|
||||
{ DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261), 0,
|
||||
"ULi M5261 FastEthernet" },
|
||||
{ DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5263), 0,
|
||||
"ULi M5263 FastEthernet" },
|
||||
{ 0, 0, NULL }
|
||||
};
|
||||
|
||||
@@ -253,6 +257,7 @@ static void dc_stop(struct dc_softc *);
|
||||
static void dc_watchdog(void *);
|
||||
static int dc_shutdown(device_t);
|
||||
static int dc_ifmedia_upd(struct ifnet *);
|
||||
static int dc_ifmedia_upd_locked(struct dc_softc *);
|
||||
static void dc_ifmedia_sts(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
static int dc_dma_alloc(struct dc_softc *);
|
||||
@@ -280,6 +285,7 @@ static uint32_t dc_mchash_be(const uint8_t *);
|
||||
static void dc_setfilt_21143(struct dc_softc *);
|
||||
static void dc_setfilt_asix(struct dc_softc *);
|
||||
static void dc_setfilt_admtek(struct dc_softc *);
|
||||
static void dc_setfilt_uli(struct dc_softc *);
|
||||
static void dc_setfilt_xircom(struct dc_softc *);
|
||||
|
||||
static void dc_setfilt(struct dc_softc *);
|
||||
@@ -331,17 +337,13 @@ static device_method_t dc_methods[] = {
|
||||
DEVMETHOD(device_resume, dc_resume),
|
||||
DEVMETHOD(device_shutdown, dc_shutdown),
|
||||
|
||||
/* bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
|
||||
|
||||
/* MII interface */
|
||||
DEVMETHOD(miibus_readreg, dc_miibus_readreg),
|
||||
DEVMETHOD(miibus_writereg, dc_miibus_writereg),
|
||||
DEVMETHOD(miibus_statchg, dc_miibus_statchg),
|
||||
DEVMETHOD(miibus_mediainit, dc_miibus_mediainit),
|
||||
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t dc_driver = {
|
||||
@@ -352,8 +354,9 @@ static driver_t dc_driver = {
|
||||
|
||||
static devclass_t dc_devclass;
|
||||
|
||||
DRIVER_MODULE(dc, pci, dc_driver, dc_devclass, 0, 0);
|
||||
DRIVER_MODULE(miibus, dc, miibus_driver, miibus_devclass, 0, 0);
|
||||
DRIVER_MODULE_ORDERED(dc, pci, dc_driver, dc_devclass, NULL, NULL,
|
||||
SI_ORDER_ANY);
|
||||
DRIVER_MODULE(miibus, dc, miibus_driver, miibus_devclass, NULL, NULL);
|
||||
|
||||
#define DC_SETBIT(sc, reg, x) \
|
||||
CSR_WRITE_4(sc, reg, CSR_READ_4(sc, reg) | (x))
|
||||
@@ -700,6 +703,23 @@ dc_miibus_readreg(device_t dev, int phy, int reg)
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (sc->dc_type == DC_TYPE_ULI_M5263) {
|
||||
CSR_WRITE_4(sc, DC_ROM,
|
||||
((phy << DC_ULI_PHY_ADDR_SHIFT) & DC_ULI_PHY_ADDR_MASK) |
|
||||
((reg << DC_ULI_PHY_REG_SHIFT) & DC_ULI_PHY_REG_MASK) |
|
||||
DC_ULI_PHY_OP_READ);
|
||||
for (i = 0; i < DC_TIMEOUT; i++) {
|
||||
DELAY(1);
|
||||
rval = CSR_READ_4(sc, DC_ROM);
|
||||
if ((rval & DC_ULI_PHY_OP_DONE) != 0) {
|
||||
return (rval & DC_ULI_PHY_DATA_MASK);
|
||||
}
|
||||
}
|
||||
if (i == DC_TIMEOUT)
|
||||
device_printf(dev, "phy read timed out\n");
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (DC_IS_COMET(sc)) {
|
||||
switch (reg) {
|
||||
case MII_BMCR:
|
||||
@@ -765,6 +785,16 @@ dc_miibus_writereg(device_t dev, int phy, int reg, int data)
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (sc->dc_type == DC_TYPE_ULI_M5263) {
|
||||
CSR_WRITE_4(sc, DC_ROM,
|
||||
((phy << DC_ULI_PHY_ADDR_SHIFT) & DC_ULI_PHY_ADDR_MASK) |
|
||||
((reg << DC_ULI_PHY_REG_SHIFT) & DC_ULI_PHY_REG_MASK) |
|
||||
((data << DC_ULI_PHY_DATA_SHIFT) & DC_ULI_PHY_DATA_MASK) |
|
||||
DC_ULI_PHY_OP_WRITE);
|
||||
DELAY(1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (DC_IS_COMET(sc)) {
|
||||
switch (reg) {
|
||||
case MII_BMCR:
|
||||
@@ -827,12 +857,11 @@ dc_miibus_statchg(device_t dev)
|
||||
return;
|
||||
|
||||
ifm = &mii->mii_media;
|
||||
if (DC_IS_DAVICOM(sc) &&
|
||||
IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) {
|
||||
if (DC_IS_DAVICOM(sc) && IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1) {
|
||||
dc_setcfg(sc, ifm->ifm_media);
|
||||
sc->dc_if_media = ifm->ifm_media;
|
||||
return;
|
||||
}
|
||||
} else if (!DC_IS_ADMTEK(sc))
|
||||
dc_setcfg(sc, mii->mii_media_active);
|
||||
|
||||
sc->dc_link = 0;
|
||||
if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
|
||||
@@ -842,17 +871,8 @@ dc_miibus_statchg(device_t dev)
|
||||
case IFM_100_TX:
|
||||
sc->dc_link = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sc->dc_link == 0)
|
||||
return;
|
||||
|
||||
sc->dc_if_media = mii->mii_media_active;
|
||||
if (DC_IS_ADMTEK(sc))
|
||||
return;
|
||||
dc_setcfg(sc, mii->mii_media_active);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1147,6 +1167,97 @@ dc_setfilt_asix(struct dc_softc *sc)
|
||||
CSR_WRITE_4(sc, DC_AX_FILTDATA, hashes[1]);
|
||||
}
|
||||
|
||||
static void
|
||||
dc_setfilt_uli(struct dc_softc *sc)
|
||||
{
|
||||
uint8_t eaddr[ETHER_ADDR_LEN];
|
||||
struct ifnet *ifp;
|
||||
struct ifmultiaddr *ifma;
|
||||
struct dc_desc *sframe;
|
||||
uint32_t filter, *sp;
|
||||
uint8_t *ma;
|
||||
int i, mcnt;
|
||||
|
||||
ifp = sc->dc_ifp;
|
||||
|
||||
i = sc->dc_cdata.dc_tx_prod;
|
||||
DC_INC(sc->dc_cdata.dc_tx_prod, DC_TX_LIST_CNT);
|
||||
sc->dc_cdata.dc_tx_cnt++;
|
||||
sframe = &sc->dc_ldata.dc_tx_list[i];
|
||||
sp = sc->dc_cdata.dc_sbuf;
|
||||
bzero(sp, DC_SFRAME_LEN);
|
||||
|
||||
sframe->dc_data = htole32(DC_ADDR_LO(sc->dc_saddr));
|
||||
sframe->dc_ctl = htole32(DC_SFRAME_LEN | DC_TXCTL_SETUP |
|
||||
DC_TXCTL_TLINK | DC_FILTER_PERFECT | DC_TXCTL_FINT);
|
||||
|
||||
sc->dc_cdata.dc_tx_chain[i] = (struct mbuf *)sc->dc_cdata.dc_sbuf;
|
||||
|
||||
/* Set station address. */
|
||||
bcopy(IF_LLADDR(sc->dc_ifp), eaddr, ETHER_ADDR_LEN);
|
||||
*sp++ = DC_SP_MAC(eaddr[1] << 8 | eaddr[0]);
|
||||
*sp++ = DC_SP_MAC(eaddr[3] << 8 | eaddr[2]);
|
||||
*sp++ = DC_SP_MAC(eaddr[5] << 8 | eaddr[4]);
|
||||
|
||||
/* Set broadcast address. */
|
||||
*sp++ = DC_SP_MAC(0xFFFF);
|
||||
*sp++ = DC_SP_MAC(0xFFFF);
|
||||
*sp++ = DC_SP_MAC(0xFFFF);
|
||||
|
||||
/* Extract current filter configuration. */
|
||||
filter = CSR_READ_4(sc, DC_NETCFG);
|
||||
filter &= ~(DC_NETCFG_RX_PROMISC | DC_NETCFG_RX_ALLMULTI);
|
||||
|
||||
/* Now build perfect filters. */
|
||||
mcnt = 0;
|
||||
if_maddr_rlock(ifp);
|
||||
TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
|
||||
if (ifma->ifma_addr->sa_family != AF_LINK)
|
||||
continue;
|
||||
if (mcnt >= DC_ULI_FILTER_NPERF) {
|
||||
filter |= DC_NETCFG_RX_ALLMULTI;
|
||||
break;
|
||||
}
|
||||
ma = LLADDR((struct sockaddr_dl *)ifma->ifma_addr);
|
||||
*sp++ = DC_SP_MAC(ma[1] << 8 | ma[0]);
|
||||
*sp++ = DC_SP_MAC(ma[3] << 8 | ma[2]);
|
||||
*sp++ = DC_SP_MAC(ma[5] << 8 | ma[4]);
|
||||
mcnt++;
|
||||
}
|
||||
if_maddr_runlock(ifp);
|
||||
|
||||
for (; mcnt < DC_ULI_FILTER_NPERF; mcnt++) {
|
||||
*sp++ = DC_SP_MAC(0xFFFF);
|
||||
*sp++ = DC_SP_MAC(0xFFFF);
|
||||
*sp++ = DC_SP_MAC(0xFFFF);
|
||||
}
|
||||
|
||||
if (filter & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON))
|
||||
CSR_WRITE_4(sc, DC_NETCFG,
|
||||
filter & ~(DC_NETCFG_TX_ON | DC_NETCFG_RX_ON));
|
||||
if (ifp->if_flags & IFF_PROMISC)
|
||||
filter |= DC_NETCFG_RX_PROMISC | DC_NETCFG_RX_ALLMULTI;
|
||||
if (ifp->if_flags & IFF_ALLMULTI)
|
||||
filter |= DC_NETCFG_RX_ALLMULTI;
|
||||
CSR_WRITE_4(sc, DC_NETCFG,
|
||||
filter & ~(DC_NETCFG_TX_ON | DC_NETCFG_RX_ON));
|
||||
if (filter & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON))
|
||||
CSR_WRITE_4(sc, DC_NETCFG, filter);
|
||||
|
||||
sframe->dc_status = htole32(DC_TXSTAT_OWN);
|
||||
bus_dmamap_sync(sc->dc_tx_ltag, sc->dc_tx_lmap, BUS_DMASYNC_PREREAD |
|
||||
BUS_DMASYNC_PREWRITE);
|
||||
bus_dmamap_sync(sc->dc_stag, sc->dc_smap, BUS_DMASYNC_PREWRITE);
|
||||
CSR_WRITE_4(sc, DC_TXSTART, 0xFFFFFFFF);
|
||||
|
||||
/*
|
||||
* Wait some time...
|
||||
*/
|
||||
DELAY(1000);
|
||||
|
||||
sc->dc_wdog_timer = 5;
|
||||
}
|
||||
|
||||
static void
|
||||
dc_setfilt_xircom(struct dc_softc *sc)
|
||||
{
|
||||
@@ -1235,6 +1346,9 @@ dc_setfilt(struct dc_softc *sc)
|
||||
if (DC_IS_ADMTEK(sc))
|
||||
dc_setfilt_admtek(sc);
|
||||
|
||||
if (DC_IS_ULI(sc))
|
||||
dc_setfilt_uli(sc);
|
||||
|
||||
if (DC_IS_XIRCOM(sc))
|
||||
dc_setfilt_xircom(sc);
|
||||
}
|
||||
@@ -1403,7 +1517,7 @@ dc_reset(struct dc_softc *sc)
|
||||
}
|
||||
|
||||
if (DC_IS_ASIX(sc) || DC_IS_ADMTEK(sc) || DC_IS_CONEXANT(sc) ||
|
||||
DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc)) {
|
||||
DC_IS_XIRCOM(sc) || DC_IS_INTEL(sc) || DC_IS_ULI(sc)) {
|
||||
DELAY(10000);
|
||||
DC_CLRBIT(sc, DC_BUSCTL, DC_BUSCTL_RESET);
|
||||
i = 0;
|
||||
@@ -1615,7 +1729,7 @@ dc_read_srom(struct dc_softc *sc, int bits)
|
||||
int size;
|
||||
|
||||
size = DC_ROM_SIZE(bits);
|
||||
sc->dc_srom = malloc(size, M_DEVBUF, M_NOWAIT);
|
||||
sc->dc_srom = malloc(size, M_DEVBUF, M_NOWAIT | M_ZERO);
|
||||
if (sc->dc_srom == NULL) {
|
||||
device_printf(sc->dc_dev, "Could not allocate SROM buffer\n");
|
||||
return (ENOMEM);
|
||||
@@ -1909,7 +2023,8 @@ dc_attach(device_t dev)
|
||||
struct ifnet *ifp;
|
||||
struct dc_mediainfo *m;
|
||||
uint32_t reg, revision;
|
||||
int error, mac_offset, phy, rid, tmp;
|
||||
uint16_t *srom;
|
||||
int error, mac_offset, n, phy, rid, tmp;
|
||||
uint8_t *mac;
|
||||
|
||||
sc = device_get_softc(dev);
|
||||
@@ -2089,6 +2204,21 @@ dc_attach(device_t dev)
|
||||
if (error != 0)
|
||||
goto fail;
|
||||
break;
|
||||
case DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261):
|
||||
case DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5263):
|
||||
if (sc->dc_info->dc_devid ==
|
||||
DC_DEVID(DC_VENDORID_ULI, DC_DEVICEID_M5261))
|
||||
sc->dc_type = DC_TYPE_ULI_M5261;
|
||||
else
|
||||
sc->dc_type = DC_TYPE_ULI_M5263;
|
||||
/* TX buffers should be aligned on 4 byte boundary. */
|
||||
sc->dc_flags |= DC_TX_INTR_ALWAYS | DC_TX_COALESCE |
|
||||
DC_TX_ALIGN;
|
||||
sc->dc_pmode = DC_PMODE_MII;
|
||||
error = dc_read_srom(sc, sc->dc_romwidth);
|
||||
if (error != 0)
|
||||
goto fail;
|
||||
break;
|
||||
default:
|
||||
device_printf(dev, "unknown device: %x\n",
|
||||
sc->dc_info->dc_devid);
|
||||
@@ -2186,6 +2316,33 @@ dc_attach(device_t dev)
|
||||
}
|
||||
bcopy(mac, eaddr, ETHER_ADDR_LEN);
|
||||
break;
|
||||
case DC_TYPE_ULI_M5261:
|
||||
case DC_TYPE_ULI_M5263:
|
||||
srom = (uint16_t *)sc->dc_srom;
|
||||
if (srom == NULL || *srom == 0xFFFF || *srom == 0) {
|
||||
/*
|
||||
* No valid SROM present, read station address
|
||||
* from ID Table.
|
||||
*/
|
||||
device_printf(dev,
|
||||
"Reading station address from ID Table.\n");
|
||||
CSR_WRITE_4(sc, DC_BUSCTL, 0x10000);
|
||||
CSR_WRITE_4(sc, DC_SIARESET, 0x01C0);
|
||||
CSR_WRITE_4(sc, DC_10BTCTRL, 0x0000);
|
||||
CSR_WRITE_4(sc, DC_10BTCTRL, 0x0010);
|
||||
CSR_WRITE_4(sc, DC_10BTCTRL, 0x0000);
|
||||
CSR_WRITE_4(sc, DC_SIARESET, 0x0000);
|
||||
CSR_WRITE_4(sc, DC_SIARESET, 0x01B0);
|
||||
mac = (uint8_t *)eaddr;
|
||||
for (n = 0; n < ETHER_ADDR_LEN; n++)
|
||||
mac[n] = (uint8_t)CSR_READ_4(sc, DC_10BTCTRL);
|
||||
CSR_WRITE_4(sc, DC_SIARESET, 0x0000);
|
||||
CSR_WRITE_4(sc, DC_BUSCTL, 0x0000);
|
||||
DELAY(10);
|
||||
} else
|
||||
dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3,
|
||||
0);
|
||||
break;
|
||||
default:
|
||||
dc_read_eeprom(sc, (caddr_t)&eaddr, DC_EE_NODEADDR, 3, 0);
|
||||
break;
|
||||
@@ -2296,9 +2453,6 @@ dc_attach(device_t dev)
|
||||
if (sc->dc_pmode != DC_PMODE_SIA)
|
||||
sc->dc_pmode = DC_PMODE_SYM;
|
||||
sc->dc_flags |= DC_21143_NWAY;
|
||||
mii_attach(dev, &sc->dc_miibus, ifp, dc_ifmedia_upd,
|
||||
dc_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
/*
|
||||
* For non-MII cards, we need to have the 21143
|
||||
* drive the LEDs. Except there are some systems
|
||||
@@ -2309,7 +2463,9 @@ dc_attach(device_t dev)
|
||||
if (!(pci_get_subvendor(dev) == 0x1033 &&
|
||||
pci_get_subdevice(dev) == 0x8028))
|
||||
sc->dc_flags |= DC_TULIP_LEDS;
|
||||
error = 0;
|
||||
error = mii_attach(dev, &sc->dc_miibus, ifp, dc_ifmedia_upd,
|
||||
dc_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
}
|
||||
|
||||
if (error) {
|
||||
@@ -2378,7 +2534,7 @@ dc_detach(device_t dev)
|
||||
ifp = sc->dc_ifp;
|
||||
|
||||
#ifdef DEVICE_POLLING
|
||||
if (ifp->if_capenable & IFCAP_POLLING)
|
||||
if (ifp != NULL && ifp->if_capenable & IFCAP_POLLING)
|
||||
ether_poll_deregister(ifp);
|
||||
#endif
|
||||
|
||||
@@ -2402,7 +2558,7 @@ dc_detach(device_t dev)
|
||||
if (sc->dc_res)
|
||||
bus_release_resource(dev, DC_RES, DC_RID, sc->dc_res);
|
||||
|
||||
if (ifp)
|
||||
if (ifp != NULL)
|
||||
if_free(ifp);
|
||||
|
||||
dc_dma_free(sc);
|
||||
@@ -2452,7 +2608,6 @@ dc_list_tx_init(struct dc_softc *sc)
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the RX descriptors and allocate mbufs for them. Note that
|
||||
* we arrange the descriptors in a closed ring, so that the last descriptor
|
||||
@@ -3462,7 +3617,7 @@ dc_init_locked(struct dc_softc *sc)
|
||||
/*
|
||||
* Set cache alignment and burst length.
|
||||
*/
|
||||
if (DC_IS_ASIX(sc) || DC_IS_DAVICOM(sc))
|
||||
if (DC_IS_ASIX(sc) || DC_IS_DAVICOM(sc) || DC_IS_ULI(sc))
|
||||
CSR_WRITE_4(sc, DC_BUSCTL, 0);
|
||||
else
|
||||
CSR_WRITE_4(sc, DC_BUSCTL, DC_BUSCTL_MRME | DC_BUSCTL_MRLE);
|
||||
@@ -3575,6 +3730,11 @@ dc_init_locked(struct dc_softc *sc)
|
||||
CSR_WRITE_4(sc, DC_IMR, DC_INTRS);
|
||||
CSR_WRITE_4(sc, DC_ISR, 0xFFFFFFFF);
|
||||
|
||||
/* Initialize TX jabber and RX watchdog timer. */
|
||||
if (DC_IS_ULI(sc))
|
||||
CSR_WRITE_4(sc, DC_WATCHDOG, DC_WDOG_JABBERCLK |
|
||||
DC_WDOG_HOSTUNJAB);
|
||||
|
||||
/* Enable transmitter. */
|
||||
DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON);
|
||||
|
||||
@@ -3604,8 +3764,7 @@ dc_init_locked(struct dc_softc *sc)
|
||||
ifp->if_drv_flags |= IFF_DRV_RUNNING;
|
||||
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
|
||||
|
||||
mii_mediachg(mii);
|
||||
dc_setcfg(sc, sc->dc_if_media);
|
||||
dc_ifmedia_upd_locked(sc);
|
||||
|
||||
/* Clear missed frames and overflow counter. */
|
||||
CSR_READ_4(sc, DC_FRAMESDISCARDED);
|
||||
@@ -3631,25 +3790,37 @@ static int
|
||||
dc_ifmedia_upd(struct ifnet *ifp)
|
||||
{
|
||||
struct dc_softc *sc;
|
||||
struct mii_data *mii;
|
||||
struct ifmedia *ifm;
|
||||
int error;
|
||||
|
||||
sc = ifp->if_softc;
|
||||
mii = device_get_softc(sc->dc_miibus);
|
||||
DC_LOCK(sc);
|
||||
mii_mediachg(mii);
|
||||
ifm = &mii->mii_media;
|
||||
|
||||
if (DC_IS_INTEL(sc))
|
||||
dc_setcfg(sc, ifm->ifm_media);
|
||||
else if (DC_IS_DAVICOM(sc) &&
|
||||
IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1)
|
||||
dc_setcfg(sc, ifm->ifm_media);
|
||||
else
|
||||
sc->dc_link = 0;
|
||||
error = dc_ifmedia_upd_locked(sc);
|
||||
DC_UNLOCK(sc);
|
||||
return (error);
|
||||
}
|
||||
|
||||
return (0);
|
||||
static int
|
||||
dc_ifmedia_upd_locked(struct dc_softc *sc)
|
||||
{
|
||||
struct mii_data *mii;
|
||||
struct ifmedia *ifm;
|
||||
int error;
|
||||
|
||||
DC_LOCK_ASSERT(sc);
|
||||
|
||||
sc->dc_link = 0;
|
||||
mii = device_get_softc(sc->dc_miibus);
|
||||
error = mii_mediachg(mii);
|
||||
if (error == 0) {
|
||||
ifm = &mii->mii_media;
|
||||
if (DC_IS_INTEL(sc))
|
||||
dc_setcfg(sc, ifm->ifm_media);
|
||||
else if (DC_IS_DAVICOM(sc) &&
|
||||
IFM_SUBTYPE(ifm->ifm_media) == IFM_HPNA_1)
|
||||
dc_setcfg(sc, ifm->ifm_media);
|
||||
}
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/dev/dc/if_dcreg.h,v 1.57.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -78,6 +78,8 @@
|
||||
#define DC_TYPE_PNIC 0xA /* 82c168/82c169 PNIC I */
|
||||
#define DC_TYPE_XIRCOM 0xB /* Xircom X3201 */
|
||||
#define DC_TYPE_CONEXANT 0xC /* Conexant LANfinity RS7112 */
|
||||
#define DC_TYPE_ULI_M5261 0xD /* ALi/ULi M5261 */
|
||||
#define DC_TYPE_ULI_M5263 0xE /* ALi/ULi M5263 */
|
||||
|
||||
#define DC_IS_MACRONIX(x) \
|
||||
(x->dc_type == DC_TYPE_98713 || \
|
||||
@@ -88,6 +90,10 @@
|
||||
(x->dc_type == DC_TYPE_AL981 || \
|
||||
x->dc_type == DC_TYPE_AN983)
|
||||
|
||||
#define DC_IS_ULI(x) \
|
||||
(x->dc_type == DC_TYPE_ULI_M5261 || \
|
||||
x->dc_type == DC_TYPE_ULI_M5263)
|
||||
|
||||
#define DC_IS_INTEL(x) (x->dc_type == DC_TYPE_21143)
|
||||
#define DC_IS_ASIX(x) (x->dc_type == DC_TYPE_ASIX)
|
||||
#define DC_IS_COMET(x) (x->dc_type == DC_TYPE_AL981)
|
||||
@@ -707,6 +713,23 @@ struct dc_type {
|
||||
|
||||
/* End of CONEXANT specific registers */
|
||||
|
||||
/*
|
||||
* ULi M5263 specific registers.
|
||||
*/
|
||||
#define DC_ULI_FILTER_NPERF 14
|
||||
|
||||
#define DC_ULI_PHY_DATA_MASK 0x0000FFFF
|
||||
#define DC_ULI_PHY_REG_MASK 0x001F0000
|
||||
#define DC_ULI_PHY_ADDR_MASK 0x03E00000
|
||||
#define DC_ULI_PHY_OP_WRITE 0x04000000
|
||||
#define DC_ULI_PHY_OP_READ 0x08000000
|
||||
#define DC_ULI_PHY_OP_DONE 0x10000000
|
||||
|
||||
#define DC_ULI_PHY_DATA_SHIFT 0
|
||||
#define DC_ULI_PHY_REG_SHIFT 16
|
||||
#define DC_ULI_PHY_ADDR_SHIFT 21
|
||||
|
||||
/* End of ULi M5263 specific registers */
|
||||
|
||||
struct dc_softc {
|
||||
struct ifnet *dc_ifp; /* interface info */
|
||||
@@ -737,7 +760,6 @@ struct dc_softc {
|
||||
int dc_pnic_rx_bug_save;
|
||||
unsigned char *dc_pnic_rx_buf;
|
||||
int dc_if_flags;
|
||||
int dc_if_media;
|
||||
uint32_t dc_flags;
|
||||
uint32_t dc_txthresh;
|
||||
uint32_t dc_eaddr[2];
|
||||
@@ -1014,6 +1036,17 @@ struct dc_softc {
|
||||
#define DC_DEVICEID_PCMPC200_AB08 0xab08
|
||||
#define DC_DEVICEID_PCMPC200_AB09 0xab09
|
||||
|
||||
/*
|
||||
* ULi vendor ID.
|
||||
*/
|
||||
#define DC_VENDORID_ULI 0x10b9
|
||||
|
||||
/*
|
||||
* ULi device IDs.
|
||||
*/
|
||||
#define DC_DEVICEID_M5261 0x5261
|
||||
#define DC_DEVICEID_M5263 0x5263
|
||||
|
||||
#define DC_DEVID(vendor, device) ((device) << 16 | (vendor))
|
||||
|
||||
/*
|
||||
|
||||
@@ -74,7 +74,7 @@ static device_method_t pnphy_methods[] = {
|
||||
DEVMETHOD(device_attach, pnphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t pnphy_devclass;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* $NetBSD: dc21040reg.h,v 1.15 1998/05/22 18:50:59 matt Exp $ */
|
||||
|
||||
/* $FreeBSD: src/sys/dev/de/dc21040reg.h,v 1.7.26.1.6.1 2010/12/21 17:09:25 kensmith Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994, 1995, 1996 Matt Thomas <matt@3am-software.com>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/de/if_de.c,v 1.186.2.3.4.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#define TULIP_HDR_DATA
|
||||
|
||||
@@ -4496,7 +4496,8 @@ tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count,
|
||||
/* First, setup a tag. */
|
||||
ri->ri_max = count;
|
||||
size = count * sizeof(tulip_desc_t);
|
||||
error = bus_dma_tag_create(NULL, 32, 0, BUS_SPACE_MAXADDR_32BIT,
|
||||
error = bus_dma_tag_create(bus_get_dma_tag(dev),
|
||||
32, 0, BUS_SPACE_MAXADDR_32BIT,
|
||||
BUS_SPACE_MAXADDR, NULL, NULL, size, 1, size, 0, NULL, NULL,
|
||||
&ri->ri_ring_tag);
|
||||
if (error) {
|
||||
@@ -4524,7 +4525,7 @@ tulip_busdma_allocring(device_t dev, tulip_softc_t * const sc, size_t count,
|
||||
}
|
||||
|
||||
/* Allocate a tag for the data buffers. */
|
||||
error = bus_dma_tag_create(NULL, align, 0,
|
||||
error = bus_dma_tag_create(bus_get_dma_tag(dev), align, 0,
|
||||
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
|
||||
MCLBYTES * nsegs, nsegs, MCLBYTES, 0, NULL, NULL, &ri->ri_data_tag);
|
||||
if (error) {
|
||||
@@ -4604,7 +4605,7 @@ tulip_busdma_init(device_t dev, tulip_softc_t * const sc)
|
||||
/*
|
||||
* Allocate a DMA tag, memory, and map for setup descriptor
|
||||
*/
|
||||
error = bus_dma_tag_create(NULL, 32, 0,
|
||||
error = bus_dma_tag_create(bus_get_dma_tag(dev), 32, 0,
|
||||
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
|
||||
sizeof(sc->tulip_setupdata), 1, sizeof(sc->tulip_setupdata), 0,
|
||||
NULL, NULL, &sc->tulip_setup_tag);
|
||||
@@ -4710,7 +4711,7 @@ tulip_pci_probe(device_t dev)
|
||||
else
|
||||
name = "Digital 21140 Fast Ethernet";
|
||||
break;
|
||||
#ifndef __HAIKU__
|
||||
#ifndef __HAIKU__
|
||||
/*
|
||||
* The card with the same id is supported by if_dc - screen it to
|
||||
* prevent duplicated dev entries.
|
||||
@@ -4721,7 +4722,7 @@ tulip_pci_probe(device_t dev)
|
||||
else
|
||||
name = "Digital 21142 Fast Ethernet";
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
if (name) {
|
||||
device_set_desc(dev, name);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* $NetBSD: if_devar.h,v 1.32 1999/04/01 14:55:25 tsubai Exp $ */
|
||||
|
||||
/* $FreeBSD: src/sys/dev/de/if_devar.h,v 1.45.10.2.6.1 2010/12/21 17:09:25 kensmith Exp $ */
|
||||
/* $FreeBSD$ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com)
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/acphy.c,v 1.21.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* Driver for Altima AC101 10/100 PHY
|
||||
@@ -87,7 +87,7 @@ static device_method_t acphy_methods[] = {
|
||||
DEVMETHOD(device_attach, acphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t acphy_devclass;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/dev/mii/acphyreg.h,v 1.2.10.1.6.1 2010/12/21 17:09:25 kensmith Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _DEV_MII_ACPHYREG_H_
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/amphy.c,v 1.24.2.5.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* driver for AMD AM79c873 PHYs
|
||||
@@ -66,7 +66,7 @@ static device_method_t amphy_methods[] = {
|
||||
DEVMETHOD(device_attach, amphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t amphy_devclass;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/dev/mii/amphyreg.h,v 1.2.22.1.6.1 2010/12/21 17:09:25 kensmith Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _DEV_MII_AMTPHYREG_H_
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* driver for generic unknown PHYs
|
||||
@@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = {
|
||||
DEVMETHOD(device_attach, ukphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t ukphy_devclass;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* Subroutines shared by the ukphy driver and other PHY drivers.
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/fxp/if_fxp.c,v 1.295.2.14.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* Intel EtherExpress Pro/100B PCI Fast Ethernet driver
|
||||
@@ -194,7 +194,7 @@ static const struct fxp_ident const fxp_ident_table[] = {
|
||||
{ 0x1229, 0x08, 0, "Intel 82559 Pro/100 Ethernet" },
|
||||
{ 0x1229, 0x09, 0, "Intel 82559ER Pro/100 Ethernet" },
|
||||
{ 0x1229, 0x0c, 0, "Intel 82550 Pro/100 Ethernet" },
|
||||
{ 0x1229, 0x0d, 0, "Intel 82550 Pro/100 Ethernet" },
|
||||
{ 0x1229, 0x0d, 0, "Intel 82550C Pro/100 Ethernet" },
|
||||
{ 0x1229, 0x0e, 0, "Intel 82550 Pro/100 Ethernet" },
|
||||
{ 0x1229, 0x0f, 0, "Intel 82551 Pro/100 Ethernet" },
|
||||
{ 0x1229, 0x10, 0, "Intel 82551 Pro/100 Ethernet" },
|
||||
@@ -236,11 +236,11 @@ static int fxp_ioctl(struct ifnet *ifp, u_long command,
|
||||
caddr_t data);
|
||||
static void fxp_watchdog(struct fxp_softc *sc);
|
||||
static void fxp_add_rfabuf(struct fxp_softc *sc,
|
||||
struct fxp_rx *rxp);
|
||||
struct fxp_rx *rxp);
|
||||
static void fxp_discard_rfabuf(struct fxp_softc *sc,
|
||||
struct fxp_rx *rxp);
|
||||
struct fxp_rx *rxp);
|
||||
static int fxp_new_rfabuf(struct fxp_softc *sc,
|
||||
struct fxp_rx *rxp);
|
||||
struct fxp_rx *rxp);
|
||||
static int fxp_mc_addrs(struct fxp_softc *sc);
|
||||
static void fxp_mc_setup(struct fxp_softc *sc);
|
||||
static uint16_t fxp_eeprom_getword(struct fxp_softc *sc, int offset,
|
||||
@@ -248,6 +248,7 @@ static uint16_t fxp_eeprom_getword(struct fxp_softc *sc, int offset,
|
||||
static void fxp_eeprom_putword(struct fxp_softc *sc, int offset,
|
||||
uint16_t data);
|
||||
static void fxp_autosize_eeprom(struct fxp_softc *sc);
|
||||
static void fxp_load_eeprom(struct fxp_softc *sc);
|
||||
static void fxp_read_eeprom(struct fxp_softc *sc, u_short *data,
|
||||
int offset, int words);
|
||||
static void fxp_write_eeprom(struct fxp_softc *sc, u_short *data,
|
||||
@@ -272,7 +273,7 @@ static int sysctl_hw_fxp_int_delay(SYSCTL_HANDLER_ARGS);
|
||||
static void fxp_scb_wait(struct fxp_softc *sc);
|
||||
static void fxp_scb_cmd(struct fxp_softc *sc, int cmd);
|
||||
static void fxp_dma_wait(struct fxp_softc *sc,
|
||||
volatile uint16_t *status, bus_dma_tag_t dmat,
|
||||
volatile uint16_t *status, bus_dma_tag_t dmat,
|
||||
bus_dmamap_t map);
|
||||
|
||||
static device_method_t fxp_methods[] = {
|
||||
@@ -289,7 +290,7 @@ static device_method_t fxp_methods[] = {
|
||||
DEVMETHOD(miibus_writereg, fxp_miibus_writereg),
|
||||
DEVMETHOD(miibus_statchg, fxp_miibus_statchg),
|
||||
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t fxp_driver = {
|
||||
@@ -300,8 +301,9 @@ static driver_t fxp_driver = {
|
||||
|
||||
static devclass_t fxp_devclass;
|
||||
|
||||
DRIVER_MODULE(fxp, pci, fxp_driver, fxp_devclass, 0, 0);
|
||||
DRIVER_MODULE(miibus, fxp, miibus_driver, miibus_devclass, 0, 0);
|
||||
DRIVER_MODULE_ORDERED(fxp, pci, fxp_driver, fxp_devclass, NULL, NULL,
|
||||
SI_ORDER_ANY);
|
||||
DRIVER_MODULE(miibus, fxp, miibus_driver, miibus_devclass, NULL, NULL);
|
||||
|
||||
static struct resource_spec fxp_res_spec_mem[] = {
|
||||
{ SYS_RES_MEMORY, FXP_PCI_MMBA, RF_ACTIVE },
|
||||
@@ -426,7 +428,7 @@ fxp_attach(device_t dev)
|
||||
struct fxp_rx *rxp;
|
||||
struct ifnet *ifp;
|
||||
uint32_t val;
|
||||
uint16_t data, myea[ETHER_ADDR_LEN / 2];
|
||||
uint16_t data;
|
||||
u_char eaddr[ETHER_ADDR_LEN];
|
||||
int error, flags, i, pmc, prefer_iomap;
|
||||
|
||||
@@ -498,6 +500,7 @@ fxp_attach(device_t dev)
|
||||
* Find out how large of an SEEPROM we have.
|
||||
*/
|
||||
fxp_autosize_eeprom(sc);
|
||||
fxp_load_eeprom(sc);
|
||||
|
||||
/*
|
||||
* Find out the chip revision; lump all 82557 revs together.
|
||||
@@ -507,7 +510,7 @@ fxp_attach(device_t dev)
|
||||
/* Assume ICH controllers are 82559. */
|
||||
sc->revision = FXP_REV_82559_A0;
|
||||
} else {
|
||||
fxp_read_eeprom(sc, &data, 5, 1);
|
||||
data = sc->eeprom[FXP_EEPROM_MAP_CNTR];
|
||||
if ((data >> 8) == 1)
|
||||
sc->revision = FXP_REV_82557;
|
||||
else
|
||||
@@ -519,15 +522,27 @@ fxp_attach(device_t dev)
|
||||
*/
|
||||
if (sc->revision >= FXP_REV_82558_A4 &&
|
||||
sc->revision != FXP_REV_82559S_A) {
|
||||
fxp_read_eeprom(sc, &data, 10, 1);
|
||||
data = sc->eeprom[FXP_EEPROM_MAP_ID];
|
||||
if ((data & 0x20) != 0 &&
|
||||
pci_find_cap(sc->dev, PCIY_PMG, &pmc) == 0)
|
||||
sc->flags |= FXP_FLAG_WOLCAP;
|
||||
}
|
||||
|
||||
if (sc->revision == FXP_REV_82550_C) {
|
||||
/*
|
||||
* 82550C with server extension requires microcode to
|
||||
* receive fragmented UDP datagrams. However if the
|
||||
* microcode is used for client-only featured 82550C
|
||||
* it locks up controller.
|
||||
*/
|
||||
data = sc->eeprom[FXP_EEPROM_MAP_COMPAT];
|
||||
if ((data & 0x0400) == 0)
|
||||
sc->flags |= FXP_FLAG_NO_UCODE;
|
||||
}
|
||||
|
||||
/* Receiver lock-up workaround detection. */
|
||||
if (sc->revision < FXP_REV_82558_A4) {
|
||||
fxp_read_eeprom(sc, &data, 3, 1);
|
||||
data = sc->eeprom[FXP_EEPROM_MAP_COMPAT];
|
||||
if ((data & 0x03) != 0x03) {
|
||||
sc->flags |= FXP_FLAG_RXBUG;
|
||||
device_printf(dev, "Enabling Rx lock-up workaround\n");
|
||||
@@ -537,7 +552,7 @@ fxp_attach(device_t dev)
|
||||
/*
|
||||
* Determine whether we must use the 503 serial interface.
|
||||
*/
|
||||
fxp_read_eeprom(sc, &data, 6, 1);
|
||||
data = sc->eeprom[FXP_EEPROM_MAP_PRI_PHY];
|
||||
if (sc->revision == FXP_REV_82557 && (data & FXP_PHY_DEVICE_MASK) != 0
|
||||
&& (data & FXP_PHY_SERIAL_ONLY))
|
||||
sc->flags |= FXP_FLAG_SERIAL_MEDIA;
|
||||
@@ -557,7 +572,7 @@ fxp_attach(device_t dev)
|
||||
*/
|
||||
if ((sc->ident->ich >= 2 && sc->ident->ich <= 3) ||
|
||||
(sc->ident->ich == 0 && sc->revision >= FXP_REV_82559_A0)) {
|
||||
fxp_read_eeprom(sc, &data, 10, 1);
|
||||
data = sc->eeprom[FXP_EEPROM_MAP_ID];
|
||||
if (data & 0x02) { /* STB enable */
|
||||
uint16_t cksum;
|
||||
int i;
|
||||
@@ -565,27 +580,24 @@ fxp_attach(device_t dev)
|
||||
device_printf(dev,
|
||||
"Disabling dynamic standby mode in EEPROM\n");
|
||||
data &= ~0x02;
|
||||
fxp_write_eeprom(sc, &data, 10, 1);
|
||||
sc->eeprom[FXP_EEPROM_MAP_ID] = data;
|
||||
fxp_write_eeprom(sc, &data, FXP_EEPROM_MAP_ID, 1);
|
||||
device_printf(dev, "New EEPROM ID: 0x%x\n", data);
|
||||
cksum = 0;
|
||||
for (i = 0; i < (1 << sc->eeprom_size) - 1; i++) {
|
||||
fxp_read_eeprom(sc, &data, i, 1);
|
||||
cksum += data;
|
||||
}
|
||||
for (i = 0; i < (1 << sc->eeprom_size) - 1; i++)
|
||||
cksum += sc->eeprom[i];
|
||||
i = (1 << sc->eeprom_size) - 1;
|
||||
cksum = 0xBABA - cksum;
|
||||
fxp_read_eeprom(sc, &data, i, 1);
|
||||
fxp_write_eeprom(sc, &cksum, i, 1);
|
||||
device_printf(dev,
|
||||
"EEPROM checksum @ 0x%x: 0x%x -> 0x%x\n",
|
||||
i, data, cksum);
|
||||
#if 1
|
||||
i, sc->eeprom[i], cksum);
|
||||
sc->eeprom[i] = cksum;
|
||||
/*
|
||||
* If the user elects to continue, try the software
|
||||
* workaround, as it is better than nothing.
|
||||
*/
|
||||
sc->flags |= FXP_FLAG_CU_RESUME_BUG;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,7 +693,8 @@ fxp_attach(device_t dev)
|
||||
goto fail;
|
||||
}
|
||||
error = bus_dmamap_load(sc->fxp_stag, sc->fxp_smap, sc->fxp_stats,
|
||||
sizeof(struct fxp_stats), fxp_dma_map_addr, &sc->stats_addr, 0);
|
||||
sizeof(struct fxp_stats), fxp_dma_map_addr, &sc->stats_addr,
|
||||
BUS_DMA_NOWAIT);
|
||||
if (error) {
|
||||
device_printf(dev, "could not load the stats DMA buffer\n");
|
||||
goto fail;
|
||||
@@ -705,7 +718,7 @@ fxp_attach(device_t dev)
|
||||
|
||||
error = bus_dmamap_load(sc->cbl_tag, sc->cbl_map,
|
||||
sc->fxp_desc.cbl_list, FXP_TXCB_SZ, fxp_dma_map_addr,
|
||||
&sc->fxp_desc.cbl_addr, 0);
|
||||
&sc->fxp_desc.cbl_addr, BUS_DMA_NOWAIT);
|
||||
if (error) {
|
||||
device_printf(dev, "could not load TxCB DMA buffer\n");
|
||||
goto fail;
|
||||
@@ -729,7 +742,8 @@ fxp_attach(device_t dev)
|
||||
goto fail;
|
||||
}
|
||||
error = bus_dmamap_load(sc->mcs_tag, sc->mcs_map, sc->mcsp,
|
||||
sizeof(struct fxp_cb_mcs), fxp_dma_map_addr, &sc->mcs_addr, 0);
|
||||
sizeof(struct fxp_cb_mcs), fxp_dma_map_addr, &sc->mcs_addr,
|
||||
BUS_DMA_NOWAIT);
|
||||
if (error) {
|
||||
device_printf(dev,
|
||||
"can't load the multicast setup DMA buffer\n");
|
||||
@@ -777,21 +791,20 @@ fxp_attach(device_t dev)
|
||||
/*
|
||||
* Read MAC address.
|
||||
*/
|
||||
fxp_read_eeprom(sc, myea, 0, 3);
|
||||
eaddr[0] = myea[0] & 0xff;
|
||||
eaddr[1] = myea[0] >> 8;
|
||||
eaddr[2] = myea[1] & 0xff;
|
||||
eaddr[3] = myea[1] >> 8;
|
||||
eaddr[4] = myea[2] & 0xff;
|
||||
eaddr[5] = myea[2] >> 8;
|
||||
eaddr[0] = sc->eeprom[FXP_EEPROM_MAP_IA0] & 0xff;
|
||||
eaddr[1] = sc->eeprom[FXP_EEPROM_MAP_IA0] >> 8;
|
||||
eaddr[2] = sc->eeprom[FXP_EEPROM_MAP_IA1] & 0xff;
|
||||
eaddr[3] = sc->eeprom[FXP_EEPROM_MAP_IA1] >> 8;
|
||||
eaddr[4] = sc->eeprom[FXP_EEPROM_MAP_IA2] & 0xff;
|
||||
eaddr[5] = sc->eeprom[FXP_EEPROM_MAP_IA2] >> 8;
|
||||
if (bootverbose) {
|
||||
device_printf(dev, "PCI IDs: %04x %04x %04x %04x %04x\n",
|
||||
pci_get_vendor(dev), pci_get_device(dev),
|
||||
pci_get_subvendor(dev), pci_get_subdevice(dev),
|
||||
pci_get_revid(dev));
|
||||
fxp_read_eeprom(sc, &data, 10, 1);
|
||||
device_printf(dev, "Dynamic Standby mode is %s\n",
|
||||
data & 0x02 ? "enabled" : "disabled");
|
||||
sc->eeprom[FXP_EEPROM_MAP_ID] & 0x02 ? "enabled" :
|
||||
"disabled");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -900,7 +913,7 @@ fxp_attach(device_t dev)
|
||||
FXP_LOCK(sc);
|
||||
/* Clear wakeup events. */
|
||||
CSR_WRITE_1(sc, FXP_CSR_PMDR, CSR_READ_1(sc, FXP_CSR_PMDR));
|
||||
fxp_init_body(sc, 1);
|
||||
fxp_init_body(sc, 0);
|
||||
fxp_stop(sc);
|
||||
FXP_UNLOCK(sc);
|
||||
}
|
||||
@@ -1287,6 +1300,23 @@ fxp_write_eeprom(struct fxp_softc *sc, u_short *data, int offset, int words)
|
||||
fxp_eeprom_putword(sc, offset + i, data[i]);
|
||||
}
|
||||
|
||||
static void
|
||||
fxp_load_eeprom(struct fxp_softc *sc)
|
||||
{
|
||||
int i;
|
||||
uint16_t cksum;
|
||||
|
||||
fxp_read_eeprom(sc, sc->eeprom, 0, 1 << sc->eeprom_size);
|
||||
cksum = 0;
|
||||
for (i = 0; i < (1 << sc->eeprom_size) - 1; i++)
|
||||
cksum += sc->eeprom[i];
|
||||
cksum = 0xBABA - cksum;
|
||||
if (cksum != sc->eeprom[(1 << sc->eeprom_size) - 1])
|
||||
device_printf(sc->dev,
|
||||
"EEPROM checksum mismatch! (0x%04x -> 0x%04x)\n",
|
||||
cksum, sc->eeprom[(1 << sc->eeprom_size) - 1]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Grab the softc lock and call the real fxp_start_body() routine
|
||||
*/
|
||||
@@ -1454,7 +1484,7 @@ fxp_encap(struct fxp_softc *sc, struct mbuf **m_head)
|
||||
return (ENOBUFS);
|
||||
}
|
||||
tcp = (struct tcphdr *)(mtod(m, char *) + poff);
|
||||
m = m_pullup(m, poff + sizeof(struct tcphdr) + tcp->th_off);
|
||||
m = m_pullup(m, poff + (tcp->th_off << 2));
|
||||
if (m == NULL) {
|
||||
*m_head = NULL;
|
||||
return (ENOBUFS);
|
||||
@@ -1541,7 +1571,7 @@ fxp_encap(struct fxp_softc *sc, struct mbuf **m_head)
|
||||
}
|
||||
*m_head = m;
|
||||
error = bus_dmamap_load_mbuf_sg(sc->fxp_txmtag, txp->tx_map,
|
||||
*m_head, segs, &nseg, 0);
|
||||
*m_head, segs, &nseg, 0);
|
||||
if (error != 0) {
|
||||
m_freem(*m_head);
|
||||
*m_head = NULL;
|
||||
@@ -2048,7 +2078,7 @@ fxp_update_stats(struct fxp_softc *sc)
|
||||
*/
|
||||
sc->rx_idle_secs++;
|
||||
}
|
||||
ifp->if_ierrors +=
|
||||
ifp->if_ierrors +=
|
||||
le32toh(sp->rx_crc_errors) +
|
||||
le32toh(sp->rx_alignment_errors) +
|
||||
le32toh(sp->rx_rnr_errors) +
|
||||
@@ -2175,7 +2205,7 @@ fxp_stop(struct fxp_softc *sc)
|
||||
txp = sc->fxp_desc.tx_list;
|
||||
if (txp != NULL) {
|
||||
for (i = 0; i < FXP_NTXCB; i++) {
|
||||
if (txp[i].tx_mbuf != NULL) {
|
||||
if (txp[i].tx_mbuf != NULL) {
|
||||
bus_dmamap_sync(sc->fxp_txmtag, txp[i].tx_map,
|
||||
BUS_DMASYNC_POSTWRITE);
|
||||
bus_dmamap_unload(sc->fxp_txmtag,
|
||||
@@ -2580,12 +2610,6 @@ fxp_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
mii_pollstat(mii);
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
|
||||
if (IFM_SUBTYPE(ifmr->ifm_active) == IFM_10_T &&
|
||||
sc->flags & FXP_FLAG_CU_RESUME_BUG)
|
||||
sc->cu_resume_bug = 1;
|
||||
else
|
||||
sc->cu_resume_bug = 0;
|
||||
FXP_UNLOCK(sc);
|
||||
}
|
||||
|
||||
@@ -2778,6 +2802,11 @@ fxp_miibus_statchg(device_t dev)
|
||||
(IFM_AVALID | IFM_ACTIVE))
|
||||
return;
|
||||
|
||||
if (IFM_SUBTYPE(mii->mii_media_active) == IFM_10_T &&
|
||||
sc->flags & FXP_FLAG_CU_RESUME_BUG)
|
||||
sc->cu_resume_bug = 1;
|
||||
else
|
||||
sc->cu_resume_bug = 0;
|
||||
/*
|
||||
* Call fxp_init_body in order to adjust the flow control settings.
|
||||
* Note that the 82557 doesn't support hardware flow control.
|
||||
@@ -2808,7 +2837,7 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
if (((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) &&
|
||||
((ifp->if_flags ^ sc->if_flags) &
|
||||
(IFF_PROMISC | IFF_ALLMULTI | IFF_LINK0)) != 0)
|
||||
fxp_init_body(sc, 1);
|
||||
fxp_init_body(sc, 0);
|
||||
else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
|
||||
fxp_init_body(sc, 1);
|
||||
} else {
|
||||
@@ -2914,7 +2943,7 @@ fxp_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
reinit++;
|
||||
}
|
||||
if (reinit > 0 && ifp->if_flags & IFF_UP)
|
||||
fxp_init_body(sc, 1);
|
||||
fxp_init_body(sc, 0);
|
||||
FXP_UNLOCK(sc);
|
||||
VLAN_CAPABILITIES(ifp);
|
||||
break;
|
||||
@@ -3012,10 +3041,8 @@ static uint32_t fxp_ucode_d101a[] = D101_A_RCVBUNDLE_UCODE;
|
||||
static uint32_t fxp_ucode_d101b0[] = D101_B0_RCVBUNDLE_UCODE;
|
||||
static uint32_t fxp_ucode_d101ma[] = D101M_B_RCVBUNDLE_UCODE;
|
||||
static uint32_t fxp_ucode_d101s[] = D101S_RCVBUNDLE_UCODE;
|
||||
#ifdef notyet
|
||||
static uint32_t fxp_ucode_d102[] = D102_B_RCVBUNDLE_UCODE;
|
||||
static uint32_t fxp_ucode_d102c[] = D102_C_RCVBUNDLE_UCODE;
|
||||
#endif
|
||||
static uint32_t fxp_ucode_d102e[] = D102_E_RCVBUNDLE_UCODE;
|
||||
|
||||
#define UCODE(x) x, sizeof(x)/sizeof(uint32_t)
|
||||
@@ -3033,12 +3060,10 @@ static const struct ucode {
|
||||
D101M_CPUSAVER_DWORD, D101M_CPUSAVER_BUNDLE_MAX_DWORD },
|
||||
{ FXP_REV_82559S_A, UCODE(fxp_ucode_d101s),
|
||||
D101S_CPUSAVER_DWORD, D101S_CPUSAVER_BUNDLE_MAX_DWORD },
|
||||
#ifdef notyet
|
||||
{ FXP_REV_82550, UCODE(fxp_ucode_d102),
|
||||
D102_B_CPUSAVER_DWORD, D102_B_CPUSAVER_BUNDLE_MAX_DWORD },
|
||||
{ FXP_REV_82550_C, UCODE(fxp_ucode_d102c),
|
||||
D102_C_CPUSAVER_DWORD, D102_C_CPUSAVER_BUNDLE_MAX_DWORD },
|
||||
#endif
|
||||
{ FXP_REV_82551_F, UCODE(fxp_ucode_d102e),
|
||||
D102_E_CPUSAVER_DWORD, D102_E_CPUSAVER_BUNDLE_MAX_DWORD },
|
||||
{ FXP_REV_82551_10, UCODE(fxp_ucode_d102e),
|
||||
@@ -3053,6 +3078,9 @@ fxp_load_ucode(struct fxp_softc *sc)
|
||||
struct fxp_cb_ucode *cbp;
|
||||
int i;
|
||||
|
||||
if (sc->flags & FXP_FLAG_NO_UCODE)
|
||||
return;
|
||||
|
||||
for (uc = ucode_table; uc->ucode != NULL; uc++)
|
||||
if (sc->revision == uc->revision)
|
||||
break;
|
||||
@@ -3085,6 +3113,7 @@ fxp_load_ucode(struct fxp_softc *sc)
|
||||
sc->tunable_int_delay,
|
||||
uc->bundle_max_offset == 0 ? 0 : sc->tunable_bundle_max);
|
||||
sc->flags |= FXP_FLAG_UCODE;
|
||||
bzero(cbp, FXP_TXCB_SZ);
|
||||
}
|
||||
|
||||
#define FXP_SYSCTL_STAT_ADD(c, h, n, p, d) \
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/dev/fxp/if_fxpreg.h,v 1.43.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define FXP_VENDORID_INTEL 0x8086
|
||||
@@ -447,6 +447,24 @@ struct fxp_stats {
|
||||
#define FXP_EEPROM_OPC_WRITE 0x5
|
||||
#define FXP_EEPROM_OPC_READ 0x6
|
||||
|
||||
/*
|
||||
* EEPROM map
|
||||
*/
|
||||
#define FXP_EEPROM_MAP_IA0 0x00 /* Station address */
|
||||
#define FXP_EEPROM_MAP_IA1 0x01
|
||||
#define FXP_EEPROM_MAP_IA2 0x02
|
||||
#define FXP_EEPROM_MAP_COMPAT 0x03 /* Compatibility */
|
||||
#define FXP_EEPROM_MAP_CNTR 0x05 /* Controller/connector type */
|
||||
#define FXP_EEPROM_MAP_PRI_PHY 0x06 /* Primary PHY record */
|
||||
#define FXP_EEPROM_MAP_SEC_PHY 0x07 /* Secondary PHY record */
|
||||
#define FXP_EEPROM_MAP_PWA0 0x08 /* Printed wire assembly num. */
|
||||
#define FXP_EEPROM_MAP_PWA1 0x09 /* Printed wire assembly num. */
|
||||
#define FXP_EEPROM_MAP_ID 0x0A /* EEPROM ID */
|
||||
#define FXP_EEPROM_MAP_SUBSYS 0x0B /* Subsystem ID */
|
||||
#define FXP_EEPROM_MAP_SUBVEN 0x0C /* Subsystem vendor ID */
|
||||
#define FXP_EEPROM_MAP_CKSUM64 0x3F /* 64-word EEPROM checksum */
|
||||
#define FXP_EEPROM_MAP_CKSUM256 0xFF /* 256-word EEPROM checksum */
|
||||
|
||||
/*
|
||||
* Management Data Interface opcodes
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/dev/fxp/if_fxpvar.h,v 1.49.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -219,6 +219,7 @@ struct fxp_softc {
|
||||
int if_flags;
|
||||
uint8_t rfa_size;
|
||||
uint32_t tx_cmd;
|
||||
uint16_t eeprom[256];
|
||||
};
|
||||
|
||||
#define FXP_FLAG_MWI_ENABLE 0x0001 /* MWI enable */
|
||||
@@ -236,6 +237,7 @@ struct fxp_softc {
|
||||
#define FXP_FLAG_WOLCAP 0x2000 /* WOL capability */
|
||||
#define FXP_FLAG_WOL 0x4000 /* WOL active */
|
||||
#define FXP_FLAG_RXBUG 0x8000 /* Rx lock-up bug */
|
||||
#define FXP_FLAG_NO_UCODE 0x10000 /* ucode is not applicable */
|
||||
|
||||
/* Macros to ease CSR access. */
|
||||
#define CSR_READ_1(sc, reg) bus_read_1(sc->fxp_res[0], reg)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/inphy.c,v 1.17.10.7.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* driver for Intel 82553 and 82555 PHYs
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/dev/mii/inphyreg.h,v 1.1.38.1.6.1 2010/12/21 17:09:25 kensmith Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _INPHYREG_H
|
||||
|
||||
@@ -29,7 +29,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/*
|
||||
* $FreeBSD: src/sys/dev/fxp/rcvbundl.h,v 1.3.22.1.6.1 2010/12/21 17:09:25 kensmith Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
/*
|
||||
rcvbundl.h
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$FreeBSD: src/sys/dev/e1000/LICENSE,v 1.1.4.2.4.1 2010/12/21 17:09:25 kensmith Exp $
|
||||
$FreeBSD$
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$FreeBSD: src/sys/dev/e1000/README,v 1.1.4.1.6.1 2010/12/21 17:09:25 kensmith Exp $
|
||||
$FreeBSD$
|
||||
FreeBSD* Driver for Intel Network Connection
|
||||
=============================================
|
||||
|
||||
@@ -354,6 +354,7 @@ Known Limitations
|
||||
include:
|
||||
Planex FXG-08TE
|
||||
I-O Data ETG-SH8
|
||||
Netgear GS105v3
|
||||
|
||||
The driver can be compiled with the following changes:
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2011, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_80003es2lan.c,v 1.3.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
/*
|
||||
* 80003ES2LAN Gigabit Ethernet Controller (Copper)
|
||||
@@ -47,18 +47,18 @@ static void e1000_release_phy_80003es2lan(struct e1000_hw *hw);
|
||||
static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw);
|
||||
static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw);
|
||||
static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
|
||||
u32 offset,
|
||||
u16 *data);
|
||||
u32 offset,
|
||||
u16 *data);
|
||||
static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
|
||||
u32 offset,
|
||||
u16 data);
|
||||
u32 offset,
|
||||
u16 data);
|
||||
static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset,
|
||||
u16 words, u16 *data);
|
||||
u16 words, u16 *data);
|
||||
static s32 e1000_get_cfg_done_80003es2lan(struct e1000_hw *hw);
|
||||
static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw);
|
||||
static s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw);
|
||||
static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed,
|
||||
u16 *duplex);
|
||||
u16 *duplex);
|
||||
static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw);
|
||||
static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw);
|
||||
static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw);
|
||||
@@ -68,9 +68,9 @@ static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex);
|
||||
static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw);
|
||||
static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw);
|
||||
static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
|
||||
u16 *data);
|
||||
u16 *data);
|
||||
static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
|
||||
u16 data);
|
||||
u16 data);
|
||||
static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw);
|
||||
static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw);
|
||||
static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask);
|
||||
@@ -85,8 +85,8 @@ static void e1000_power_down_phy_copper_80003es2lan(struct e1000_hw *hw);
|
||||
static const u16 e1000_gg82563_cable_length_table[] = {
|
||||
0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF };
|
||||
#define GG82563_CABLE_LENGTH_TABLE_SIZE \
|
||||
(sizeof(e1000_gg82563_cable_length_table) / \
|
||||
sizeof(e1000_gg82563_cable_length_table[0]))
|
||||
(sizeof(e1000_gg82563_cable_length_table) / \
|
||||
sizeof(e1000_gg82563_cable_length_table[0]))
|
||||
|
||||
/**
|
||||
* e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs.
|
||||
@@ -100,34 +100,34 @@ static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw)
|
||||
DEBUGFUNC("e1000_init_phy_params_80003es2lan");
|
||||
|
||||
if (hw->phy.media_type != e1000_media_type_copper) {
|
||||
phy->type = e1000_phy_none;
|
||||
phy->type = e1000_phy_none;
|
||||
goto out;
|
||||
} else {
|
||||
phy->ops.power_up = e1000_power_up_phy_copper;
|
||||
phy->ops.power_down = e1000_power_down_phy_copper_80003es2lan;
|
||||
}
|
||||
|
||||
phy->addr = 1;
|
||||
phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
|
||||
phy->reset_delay_us = 100;
|
||||
phy->type = e1000_phy_gg82563;
|
||||
phy->addr = 1;
|
||||
phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
|
||||
phy->reset_delay_us = 100;
|
||||
phy->type = e1000_phy_gg82563;
|
||||
|
||||
phy->ops.acquire = e1000_acquire_phy_80003es2lan;
|
||||
phy->ops.check_polarity = e1000_check_polarity_m88;
|
||||
phy->ops.check_reset_block = e1000_check_reset_block_generic;
|
||||
phy->ops.commit = e1000_phy_sw_reset_generic;
|
||||
phy->ops.get_cfg_done = e1000_get_cfg_done_80003es2lan;
|
||||
phy->ops.get_info = e1000_get_phy_info_m88;
|
||||
phy->ops.release = e1000_release_phy_80003es2lan;
|
||||
phy->ops.reset = e1000_phy_hw_reset_generic;
|
||||
phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic;
|
||||
phy->ops.acquire = e1000_acquire_phy_80003es2lan;
|
||||
phy->ops.check_polarity = e1000_check_polarity_m88;
|
||||
phy->ops.check_reset_block = e1000_check_reset_block_generic;
|
||||
phy->ops.commit = e1000_phy_sw_reset_generic;
|
||||
phy->ops.get_cfg_done = e1000_get_cfg_done_80003es2lan;
|
||||
phy->ops.get_info = e1000_get_phy_info_m88;
|
||||
phy->ops.release = e1000_release_phy_80003es2lan;
|
||||
phy->ops.reset = e1000_phy_hw_reset_generic;
|
||||
phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic;
|
||||
|
||||
phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_80003es2lan;
|
||||
phy->ops.get_cable_length = e1000_get_cable_length_80003es2lan;
|
||||
phy->ops.read_reg = e1000_read_phy_reg_gg82563_80003es2lan;
|
||||
phy->ops.write_reg = e1000_write_phy_reg_gg82563_80003es2lan;
|
||||
phy->ops.get_cable_length = e1000_get_cable_length_80003es2lan;
|
||||
phy->ops.read_reg = e1000_read_phy_reg_gg82563_80003es2lan;
|
||||
phy->ops.write_reg = e1000_write_phy_reg_gg82563_80003es2lan;
|
||||
|
||||
phy->ops.cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan;
|
||||
phy->ops.cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan;
|
||||
|
||||
/* This can only be done after all function pointers are setup. */
|
||||
ret_val = e1000_get_phy_id(hw);
|
||||
@@ -154,19 +154,19 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw)
|
||||
|
||||
DEBUGFUNC("e1000_init_nvm_params_80003es2lan");
|
||||
|
||||
nvm->opcode_bits = 8;
|
||||
nvm->delay_usec = 1;
|
||||
nvm->opcode_bits = 8;
|
||||
nvm->delay_usec = 1;
|
||||
switch (nvm->override) {
|
||||
case e1000_nvm_override_spi_large:
|
||||
nvm->page_size = 32;
|
||||
nvm->page_size = 32;
|
||||
nvm->address_bits = 16;
|
||||
break;
|
||||
case e1000_nvm_override_spi_small:
|
||||
nvm->page_size = 8;
|
||||
nvm->page_size = 8;
|
||||
nvm->address_bits = 8;
|
||||
break;
|
||||
default:
|
||||
nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8;
|
||||
nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8;
|
||||
nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8;
|
||||
break;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw)
|
||||
nvm->type = e1000_nvm_eeprom_spi;
|
||||
|
||||
size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >>
|
||||
E1000_EECD_SIZE_EX_SHIFT);
|
||||
E1000_EECD_SIZE_EX_SHIFT);
|
||||
|
||||
/*
|
||||
* Added to a constant, "size" becomes the left-shift value
|
||||
@@ -185,16 +185,16 @@ static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw)
|
||||
/* EEPROM access above 16k is unsupported */
|
||||
if (size > 14)
|
||||
size = 14;
|
||||
nvm->word_size = 1 << size;
|
||||
nvm->word_size = 1 << size;
|
||||
|
||||
/* Function Pointers */
|
||||
nvm->ops.acquire = e1000_acquire_nvm_80003es2lan;
|
||||
nvm->ops.read = e1000_read_nvm_eerd;
|
||||
nvm->ops.release = e1000_release_nvm_80003es2lan;
|
||||
nvm->ops.update = e1000_update_nvm_checksum_generic;
|
||||
nvm->ops.acquire = e1000_acquire_nvm_80003es2lan;
|
||||
nvm->ops.read = e1000_read_nvm_eerd;
|
||||
nvm->ops.release = e1000_release_nvm_80003es2lan;
|
||||
nvm->ops.update = e1000_update_nvm_checksum_generic;
|
||||
nvm->ops.valid_led_default = e1000_valid_led_default_generic;
|
||||
nvm->ops.validate = e1000_validate_nvm_checksum_generic;
|
||||
nvm->ops.write = e1000_write_nvm_80003es2lan;
|
||||
nvm->ops.validate = e1000_validate_nvm_checksum_generic;
|
||||
nvm->ops.write = e1000_write_nvm_80003es2lan;
|
||||
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
@@ -215,13 +215,13 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw)
|
||||
hw->phy.media_type = e1000_media_type_internal_serdes;
|
||||
mac->ops.check_for_link = e1000_check_for_serdes_link_generic;
|
||||
mac->ops.setup_physical_interface =
|
||||
e1000_setup_fiber_serdes_link_generic;
|
||||
e1000_setup_fiber_serdes_link_generic;
|
||||
break;
|
||||
default:
|
||||
hw->phy.media_type = e1000_media_type_copper;
|
||||
mac->ops.check_for_link = e1000_check_for_copper_link_generic;
|
||||
mac->ops.setup_physical_interface =
|
||||
e1000_setup_copper_link_80003es2lan;
|
||||
e1000_setup_copper_link_80003es2lan;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -234,9 +234,8 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw)
|
||||
/* FWSM register */
|
||||
mac->has_fwsm = TRUE;
|
||||
/* ARC supported; valid only if manageability features are enabled. */
|
||||
mac->arc_subsystem_valid =
|
||||
(E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK)
|
||||
? TRUE : FALSE;
|
||||
mac->arc_subsystem_valid = (E1000_READ_REG(hw, E1000_FWSM) &
|
||||
E1000_FWSM_MODE_MASK) ? TRUE : FALSE;
|
||||
/* Adaptive IFS not supported */
|
||||
mac->adaptive_ifs = FALSE;
|
||||
|
||||
@@ -330,7 +329,7 @@ static void e1000_release_phy_80003es2lan(struct e1000_hw *hw)
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_acquire_mac_csr_80003es2lan - Acquire rights to access Kumeran register
|
||||
* e1000_acquire_mac_csr_80003es2lan - Acquire right to access Kumeran register
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Acquire the semaphore to access the Kumeran interface.
|
||||
@@ -348,7 +347,7 @@ static s32 e1000_acquire_mac_csr_80003es2lan(struct e1000_hw *hw)
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_release_mac_csr_80003es2lan - Release rights to access Kumeran Register
|
||||
* e1000_release_mac_csr_80003es2lan - Release right to access Kumeran Register
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Release the semaphore used to access the Kumeran interface
|
||||
@@ -488,7 +487,7 @@ static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask)
|
||||
* Read the GG82563 PHY register.
|
||||
**/
|
||||
static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
|
||||
u32 offset, u16 *data)
|
||||
u32 offset, u16 *data)
|
||||
{
|
||||
s32 ret_val;
|
||||
u32 page_select;
|
||||
@@ -538,14 +537,14 @@ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
|
||||
usec_delay(200);
|
||||
|
||||
ret_val = e1000_read_phy_reg_mdic(hw,
|
||||
MAX_PHY_REG_ADDRESS & offset,
|
||||
data);
|
||||
MAX_PHY_REG_ADDRESS & offset,
|
||||
data);
|
||||
|
||||
usec_delay(200);
|
||||
} else {
|
||||
ret_val = e1000_read_phy_reg_mdic(hw,
|
||||
MAX_PHY_REG_ADDRESS & offset,
|
||||
data);
|
||||
MAX_PHY_REG_ADDRESS & offset,
|
||||
data);
|
||||
}
|
||||
|
||||
e1000_release_phy_80003es2lan(hw);
|
||||
@@ -563,7 +562,7 @@ out:
|
||||
* Write to the GG82563 PHY register.
|
||||
**/
|
||||
static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
|
||||
u32 offset, u16 data)
|
||||
u32 offset, u16 data)
|
||||
{
|
||||
s32 ret_val;
|
||||
u32 page_select;
|
||||
@@ -613,14 +612,14 @@ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw,
|
||||
usec_delay(200);
|
||||
|
||||
ret_val = e1000_write_phy_reg_mdic(hw,
|
||||
MAX_PHY_REG_ADDRESS & offset,
|
||||
data);
|
||||
MAX_PHY_REG_ADDRESS & offset,
|
||||
data);
|
||||
|
||||
usec_delay(200);
|
||||
} else {
|
||||
ret_val = e1000_write_phy_reg_mdic(hw,
|
||||
MAX_PHY_REG_ADDRESS & offset,
|
||||
data);
|
||||
MAX_PHY_REG_ADDRESS & offset,
|
||||
data);
|
||||
}
|
||||
|
||||
e1000_release_phy_80003es2lan(hw);
|
||||
@@ -639,7 +638,7 @@ out:
|
||||
* Write "words" of data to the ESB2 NVM.
|
||||
**/
|
||||
static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset,
|
||||
u16 words, u16 *data)
|
||||
u16 words, u16 *data)
|
||||
{
|
||||
DEBUGFUNC("e1000_write_nvm_80003es2lan");
|
||||
|
||||
@@ -729,11 +728,10 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
|
||||
usec_delay(1);
|
||||
|
||||
if (hw->phy.autoneg_wait_to_complete) {
|
||||
DEBUGOUT("Waiting for forced speed/duplex link "
|
||||
"on GG82563 phy.\n");
|
||||
DEBUGOUT("Waiting for forced speed/duplex link on GG82563 phy.\n");
|
||||
|
||||
ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
|
||||
100000, &link);
|
||||
100000, &link);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
@@ -749,12 +747,13 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
|
||||
|
||||
/* Try once more */
|
||||
ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT,
|
||||
100000, &link);
|
||||
100000, &link);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, &phy_data);
|
||||
ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL,
|
||||
&phy_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
@@ -773,7 +772,8 @@ static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw)
|
||||
* duplex.
|
||||
*/
|
||||
phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX;
|
||||
ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, phy_data);
|
||||
ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL,
|
||||
phy_data);
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
@@ -826,21 +826,20 @@ out:
|
||||
* Retrieve the current speed and duplex configuration.
|
||||
**/
|
||||
static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed,
|
||||
u16 *duplex)
|
||||
u16 *duplex)
|
||||
{
|
||||
s32 ret_val;
|
||||
|
||||
DEBUGFUNC("e1000_get_link_up_info_80003es2lan");
|
||||
|
||||
if (hw->phy.media_type == e1000_media_type_copper) {
|
||||
ret_val = e1000_get_speed_and_duplex_copper_generic(hw,
|
||||
speed,
|
||||
duplex);
|
||||
ret_val = e1000_get_speed_and_duplex_copper_generic(hw, speed,
|
||||
duplex);
|
||||
hw->phy.ops.cfg_on_link_up(hw);
|
||||
} else {
|
||||
ret_val = e1000_get_speed_and_duplex_fiber_serdes_generic(hw,
|
||||
speed,
|
||||
duplex);
|
||||
speed,
|
||||
duplex);
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
@@ -939,21 +938,21 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)
|
||||
|
||||
/* Disable IBIST slave mode (far-end loopback) */
|
||||
e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
|
||||
&kum_reg_data);
|
||||
&kum_reg_data);
|
||||
kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE;
|
||||
e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM,
|
||||
kum_reg_data);
|
||||
kum_reg_data);
|
||||
|
||||
/* Set the transmit descriptor write-back policy */
|
||||
reg_data = E1000_READ_REG(hw, E1000_TXDCTL(0));
|
||||
reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) |
|
||||
E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC;
|
||||
E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC;
|
||||
E1000_WRITE_REG(hw, E1000_TXDCTL(0), reg_data);
|
||||
|
||||
/* ...for both queues. */
|
||||
reg_data = E1000_READ_REG(hw, E1000_TXDCTL(1));
|
||||
reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) |
|
||||
E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC;
|
||||
E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC;
|
||||
E1000_WRITE_REG(hw, E1000_TXDCTL(1), reg_data);
|
||||
|
||||
/* Enable retransmit on late collisions */
|
||||
@@ -981,9 +980,9 @@ static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw)
|
||||
hw->dev_spec._80003es2lan.mdic_wa_enable = TRUE;
|
||||
|
||||
ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
|
||||
E1000_KMRNCTRLSTA_OFFSET >>
|
||||
E1000_KMRNCTRLSTA_OFFSET_SHIFT,
|
||||
&i);
|
||||
E1000_KMRNCTRLSTA_OFFSET >>
|
||||
E1000_KMRNCTRLSTA_OFFSET_SHIFT,
|
||||
&i);
|
||||
if (!ret_val) {
|
||||
if ((i & E1000_KMRNCTRLSTA_OPMODE_MASK) ==
|
||||
E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO)
|
||||
@@ -1056,11 +1055,7 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
|
||||
|
||||
DEBUGFUNC("e1000_copper_link_setup_gg82563_80003es2lan");
|
||||
|
||||
if (phy->reset_disable)
|
||||
goto skip_reset;
|
||||
|
||||
ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL,
|
||||
&data);
|
||||
ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, &data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
@@ -1068,8 +1063,7 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
|
||||
/* Use 25MHz for both link down and 1000Base-T for Tx clock. */
|
||||
data |= GG82563_MSCR_TX_CLK_1000MBPS_25;
|
||||
|
||||
ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL,
|
||||
data);
|
||||
ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
@@ -1122,7 +1116,6 @@ static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw)
|
||||
goto out;
|
||||
}
|
||||
|
||||
skip_reset:
|
||||
/* Bypass Rx and Tx FIFO's */
|
||||
ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
|
||||
E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL,
|
||||
@@ -1132,14 +1125,12 @@ skip_reset:
|
||||
goto out;
|
||||
|
||||
ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
|
||||
E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE,
|
||||
&data);
|
||||
E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, &data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
data |= E1000_KMRNCTRLSTA_OPMODE_E_IDLE;
|
||||
ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
|
||||
E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE,
|
||||
data);
|
||||
E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
@@ -1169,18 +1160,18 @@ skip_reset:
|
||||
/* Enable Electrical Idle on the PHY */
|
||||
data |= GG82563_PMCR_ENABLE_ELECTRICAL_IDLE;
|
||||
ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_PWR_MGMT_CTRL,
|
||||
data);
|
||||
data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
|
||||
&data);
|
||||
&data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
data &= ~GG82563_KMCR_PASS_FALSE_CARRIER;
|
||||
ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
|
||||
data);
|
||||
data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
}
|
||||
@@ -1228,27 +1219,25 @@ static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw)
|
||||
* polling the phy; this fixes erroneous timeouts at 10Mbps.
|
||||
*/
|
||||
ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 4),
|
||||
0xFFFF);
|
||||
0xFFFF);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
ret_val = e1000_read_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9),
|
||||
®_data);
|
||||
®_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
reg_data |= 0x3F;
|
||||
ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9),
|
||||
reg_data);
|
||||
reg_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
ret_val = e1000_read_kmrn_reg_80003es2lan(hw,
|
||||
E1000_KMRNCTRLSTA_OFFSET_INB_CTRL,
|
||||
®_data);
|
||||
E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, ®_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
reg_data |= E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING;
|
||||
ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
|
||||
E1000_KMRNCTRLSTA_OFFSET_INB_CTRL,
|
||||
reg_data);
|
||||
E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, reg_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
@@ -1279,9 +1268,8 @@ static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw)
|
||||
DEBUGFUNC("e1000_configure_on_link_up");
|
||||
|
||||
if (hw->phy.media_type == e1000_media_type_copper) {
|
||||
ret_val = e1000_get_speed_and_duplex_copper_generic(hw,
|
||||
&speed,
|
||||
&duplex);
|
||||
ret_val = e1000_get_speed_and_duplex_copper_generic(hw, &speed,
|
||||
&duplex);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
@@ -1314,8 +1302,8 @@ static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex)
|
||||
|
||||
reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT;
|
||||
ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
|
||||
E1000_KMRNCTRLSTA_OFFSET_HD_CTRL,
|
||||
reg_data);
|
||||
E1000_KMRNCTRLSTA_OFFSET_HD_CTRL,
|
||||
reg_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
@@ -1327,12 +1315,12 @@ static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex)
|
||||
|
||||
do {
|
||||
ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
|
||||
®_data);
|
||||
®_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
|
||||
®_data2);
|
||||
®_data2);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
i++;
|
||||
@@ -1343,7 +1331,8 @@ static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex)
|
||||
else
|
||||
reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER;
|
||||
|
||||
ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data);
|
||||
ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
|
||||
reg_data);
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
@@ -1367,8 +1356,7 @@ static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw)
|
||||
|
||||
reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT;
|
||||
ret_val = e1000_write_kmrn_reg_80003es2lan(hw,
|
||||
E1000_KMRNCTRLSTA_OFFSET_HD_CTRL,
|
||||
reg_data);
|
||||
E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, reg_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
@@ -1380,19 +1368,20 @@ static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw)
|
||||
|
||||
do {
|
||||
ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
|
||||
®_data);
|
||||
®_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
|
||||
®_data2);
|
||||
®_data2);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
i++;
|
||||
} while ((reg_data != reg_data2) && (i < GG82563_MAX_KMRN_RETRY));
|
||||
|
||||
reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER;
|
||||
ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data);
|
||||
ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL,
|
||||
reg_data);
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
@@ -1409,7 +1398,7 @@ out:
|
||||
* Release the semaphore before exiting.
|
||||
**/
|
||||
static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
|
||||
u16 *data)
|
||||
u16 *data)
|
||||
{
|
||||
u32 kmrnctrlsta;
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
@@ -1421,8 +1410,9 @@ static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
|
||||
goto out;
|
||||
|
||||
kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
|
||||
E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN;
|
||||
E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN;
|
||||
E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta);
|
||||
E1000_WRITE_FLUSH(hw);
|
||||
|
||||
usec_delay(2);
|
||||
|
||||
@@ -1446,7 +1436,7 @@ out:
|
||||
* before exiting.
|
||||
**/
|
||||
static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
|
||||
u16 data)
|
||||
u16 data)
|
||||
{
|
||||
u32 kmrnctrlsta;
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
@@ -1458,8 +1448,9 @@ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset,
|
||||
goto out;
|
||||
|
||||
kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) &
|
||||
E1000_KMRNCTRLSTA_OFFSET) | data;
|
||||
E1000_KMRNCTRLSTA_OFFSET) | data;
|
||||
E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta);
|
||||
E1000_WRITE_FLUSH(hw);
|
||||
|
||||
usec_delay(2);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2011, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,53 +30,52 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_80003es2lan.h,v 1.1.4.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_80003ES2LAN_H_
|
||||
#define _E1000_80003ES2LAN_H_
|
||||
|
||||
#define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00
|
||||
#define E1000_KMRNCTRLSTA_OFFSET_INB_CTRL 0x02
|
||||
#define E1000_KMRNCTRLSTA_OFFSET_HD_CTRL 0x10
|
||||
#define E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE 0x1F
|
||||
#define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00
|
||||
#define E1000_KMRNCTRLSTA_OFFSET_INB_CTRL 0x02
|
||||
#define E1000_KMRNCTRLSTA_OFFSET_HD_CTRL 0x10
|
||||
#define E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE 0x1F
|
||||
|
||||
#define E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS 0x0008
|
||||
#define E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS 0x0800
|
||||
#define E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING 0x0010
|
||||
#define E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS 0x0008
|
||||
#define E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS 0x0800
|
||||
#define E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING 0x0010
|
||||
|
||||
#define E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT 0x0004
|
||||
#define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000
|
||||
#define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000
|
||||
#define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000
|
||||
#define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000
|
||||
|
||||
#define E1000_KMRNCTRLSTA_OPMODE_MASK 0x000C
|
||||
#define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO 0x0004
|
||||
#define E1000_KMRNCTRLSTA_OPMODE_MASK 0x000C
|
||||
#define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO 0x0004
|
||||
|
||||
#define E1000_TCTL_EXT_GCEX_MASK 0x000FFC00 /* Gigabit Carry Extend Padding */
|
||||
#define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000
|
||||
#define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000
|
||||
|
||||
#define DEFAULT_TIPG_IPGT_1000_80003ES2LAN 0x8
|
||||
#define DEFAULT_TIPG_IPGT_10_100_80003ES2LAN 0x9
|
||||
#define DEFAULT_TIPG_IPGT_1000_80003ES2LAN 0x8
|
||||
#define DEFAULT_TIPG_IPGT_10_100_80003ES2LAN 0x9
|
||||
|
||||
/* GG82563 PHY Specific Status Register (Page 0, Register 16 */
|
||||
#define GG82563_PSCR_POLARITY_REVERSAL_DISABLE 0x0002 /* 1=Reversal Disabled */
|
||||
#define GG82563_PSCR_CROSSOVER_MODE_MASK 0x0060
|
||||
#define GG82563_PSCR_CROSSOVER_MODE_MDI 0x0000 /* 00=Manual MDI */
|
||||
#define GG82563_PSCR_CROSSOVER_MODE_MDIX 0x0020 /* 01=Manual MDIX */
|
||||
#define GG82563_PSCR_CROSSOVER_MODE_AUTO 0x0060 /* 11=Auto crossover */
|
||||
#define GG82563_PSCR_POLARITY_REVERSAL_DISABLE 0x0002 /* 1=Reversal Disabled */
|
||||
#define GG82563_PSCR_CROSSOVER_MODE_MASK 0x0060
|
||||
#define GG82563_PSCR_CROSSOVER_MODE_MDI 0x0000 /* 00=Manual MDI */
|
||||
#define GG82563_PSCR_CROSSOVER_MODE_MDIX 0x0020 /* 01=Manual MDIX */
|
||||
#define GG82563_PSCR_CROSSOVER_MODE_AUTO 0x0060 /* 11=Auto crossover */
|
||||
|
||||
/* PHY Specific Control Register 2 (Page 0, Register 26) */
|
||||
#define GG82563_PSCR2_REVERSE_AUTO_NEG 0x2000
|
||||
/* 1=Reverse Auto-Negotiation */
|
||||
#define GG82563_PSCR2_REVERSE_AUTO_NEG 0x2000 /* 1=Reverse Auto-Nego */
|
||||
|
||||
/* MAC Specific Control Register (Page 2, Register 21) */
|
||||
/* Tx clock speed for Link Down and 1000BASE-T for the following speeds */
|
||||
#define GG82563_MSCR_TX_CLK_MASK 0x0007
|
||||
#define GG82563_MSCR_TX_CLK_10MBPS_2_5 0x0004
|
||||
#define GG82563_MSCR_TX_CLK_100MBPS_25 0x0005
|
||||
#define GG82563_MSCR_TX_CLK_1000MBPS_2_5 0x0006
|
||||
#define GG82563_MSCR_TX_CLK_1000MBPS_25 0x0007
|
||||
#define GG82563_MSCR_TX_CLK_MASK 0x0007
|
||||
#define GG82563_MSCR_TX_CLK_10MBPS_2_5 0x0004
|
||||
#define GG82563_MSCR_TX_CLK_100MBPS_25 0x0005
|
||||
#define GG82563_MSCR_TX_CLK_1000MBPS_2_5 0x0006
|
||||
#define GG82563_MSCR_TX_CLK_1000MBPS_25 0x0007
|
||||
|
||||
#define GG82563_MSCR_ASSERT_CRS_ON_TX 0x0010 /* 1=Assert */
|
||||
#define GG82563_MSCR_ASSERT_CRS_ON_TX 0x0010 /* 1=Assert */
|
||||
|
||||
/* DSP Distance Register (Page 5, Register 26) */
|
||||
/*
|
||||
@@ -86,19 +85,19 @@
|
||||
* 3 = 110-140M
|
||||
* 4 = >140M
|
||||
*/
|
||||
#define GG82563_DSPD_CABLE_LENGTH 0x0007
|
||||
#define GG82563_DSPD_CABLE_LENGTH 0x0007
|
||||
|
||||
/* Kumeran Mode Control Register (Page 193, Register 16) */
|
||||
#define GG82563_KMCR_PASS_FALSE_CARRIER 0x0800
|
||||
#define GG82563_KMCR_PASS_FALSE_CARRIER 0x0800
|
||||
|
||||
/* Max number of times Kumeran read/write should be validated */
|
||||
#define GG82563_MAX_KMRN_RETRY 0x5
|
||||
#define GG82563_MAX_KMRN_RETRY 0x5
|
||||
|
||||
/* Power Management Control Register (Page 193, Register 20) */
|
||||
#define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE 0x0001
|
||||
/* 1=Enable SERDES Electrical Idle */
|
||||
/* 1=Enable SERDES Electrical Idle */
|
||||
#define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE 0x0001
|
||||
|
||||
/* In-Band Control Register (Page 194, Register 18) */
|
||||
#define GG82563_ICR_DIS_PADDING 0x0010 /* Disable Padding */
|
||||
#define GG82563_ICR_DIS_PADDING 0x0010 /* Disable Padding */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2011, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_82540.c,v 1.4.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
/*
|
||||
* 82540EM Gigabit Ethernet Controller
|
||||
@@ -68,23 +68,23 @@ static s32 e1000_init_phy_params_82540(struct e1000_hw *hw)
|
||||
struct e1000_phy_info *phy = &hw->phy;
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
|
||||
phy->addr = 1;
|
||||
phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
|
||||
phy->reset_delay_us = 10000;
|
||||
phy->type = e1000_phy_m88;
|
||||
phy->addr = 1;
|
||||
phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
|
||||
phy->reset_delay_us = 10000;
|
||||
phy->type = e1000_phy_m88;
|
||||
|
||||
/* Function Pointers */
|
||||
phy->ops.check_polarity = e1000_check_polarity_m88;
|
||||
phy->ops.commit = e1000_phy_sw_reset_generic;
|
||||
phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88;
|
||||
phy->ops.get_cable_length = e1000_get_cable_length_m88;
|
||||
phy->ops.get_cfg_done = e1000_get_cfg_done_generic;
|
||||
phy->ops.read_reg = e1000_read_phy_reg_m88;
|
||||
phy->ops.reset = e1000_phy_hw_reset_generic;
|
||||
phy->ops.write_reg = e1000_write_phy_reg_m88;
|
||||
phy->ops.get_info = e1000_get_phy_info_m88;
|
||||
phy->ops.power_up = e1000_power_up_phy_copper;
|
||||
phy->ops.power_down = e1000_power_down_phy_copper_82540;
|
||||
phy->ops.check_polarity = e1000_check_polarity_m88;
|
||||
phy->ops.commit = e1000_phy_sw_reset_generic;
|
||||
phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88;
|
||||
phy->ops.get_cable_length = e1000_get_cable_length_m88;
|
||||
phy->ops.get_cfg_done = e1000_get_cfg_done_generic;
|
||||
phy->ops.read_reg = e1000_read_phy_reg_m88;
|
||||
phy->ops.reset = e1000_phy_hw_reset_generic;
|
||||
phy->ops.write_reg = e1000_write_phy_reg_m88;
|
||||
phy->ops.get_info = e1000_get_phy_info_m88;
|
||||
phy->ops.power_up = e1000_power_up_phy_copper;
|
||||
phy->ops.power_down = e1000_power_down_phy_copper_82540;
|
||||
|
||||
ret_val = e1000_get_phy_id(hw);
|
||||
if (ret_val)
|
||||
@@ -121,32 +121,32 @@ static s32 e1000_init_nvm_params_82540(struct e1000_hw *hw)
|
||||
|
||||
DEBUGFUNC("e1000_init_nvm_params_82540");
|
||||
|
||||
nvm->type = e1000_nvm_eeprom_microwire;
|
||||
nvm->delay_usec = 50;
|
||||
nvm->opcode_bits = 3;
|
||||
nvm->type = e1000_nvm_eeprom_microwire;
|
||||
nvm->delay_usec = 50;
|
||||
nvm->opcode_bits = 3;
|
||||
switch (nvm->override) {
|
||||
case e1000_nvm_override_microwire_large:
|
||||
nvm->address_bits = 8;
|
||||
nvm->word_size = 256;
|
||||
nvm->address_bits = 8;
|
||||
nvm->word_size = 256;
|
||||
break;
|
||||
case e1000_nvm_override_microwire_small:
|
||||
nvm->address_bits = 6;
|
||||
nvm->word_size = 64;
|
||||
nvm->address_bits = 6;
|
||||
nvm->word_size = 64;
|
||||
break;
|
||||
default:
|
||||
nvm->address_bits = eecd & E1000_EECD_SIZE ? 8 : 6;
|
||||
nvm->word_size = eecd & E1000_EECD_SIZE ? 256 : 64;
|
||||
nvm->address_bits = eecd & E1000_EECD_SIZE ? 8 : 6;
|
||||
nvm->word_size = eecd & E1000_EECD_SIZE ? 256 : 64;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Function Pointers */
|
||||
nvm->ops.acquire = e1000_acquire_nvm_generic;
|
||||
nvm->ops.read = e1000_read_nvm_microwire;
|
||||
nvm->ops.release = e1000_release_nvm_generic;
|
||||
nvm->ops.update = e1000_update_nvm_checksum_generic;
|
||||
nvm->ops.valid_led_default = e1000_valid_led_default_generic;
|
||||
nvm->ops.validate = e1000_validate_nvm_checksum_generic;
|
||||
nvm->ops.write = e1000_write_nvm_microwire;
|
||||
nvm->ops.acquire = e1000_acquire_nvm_generic;
|
||||
nvm->ops.read = e1000_read_nvm_microwire;
|
||||
nvm->ops.release = e1000_release_nvm_generic;
|
||||
nvm->ops.update = e1000_update_nvm_checksum_generic;
|
||||
nvm->ops.valid_led_default = e1000_valid_led_default_generic;
|
||||
nvm->ops.validate = e1000_validate_nvm_checksum_generic;
|
||||
nvm->ops.write = e1000_write_nvm_microwire;
|
||||
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
@@ -198,9 +198,9 @@ static s32 e1000_init_mac_params_82540(struct e1000_hw *hw)
|
||||
mac->ops.setup_link = e1000_setup_link_generic;
|
||||
/* physical interface setup */
|
||||
mac->ops.setup_physical_interface =
|
||||
(hw->phy.media_type == e1000_media_type_copper)
|
||||
? e1000_setup_copper_link_82540
|
||||
: e1000_setup_fiber_serdes_link_82540;
|
||||
(hw->phy.media_type == e1000_media_type_copper)
|
||||
? e1000_setup_copper_link_82540
|
||||
: e1000_setup_fiber_serdes_link_82540;
|
||||
/* check for link */
|
||||
switch (hw->phy.media_type) {
|
||||
case e1000_media_type_copper:
|
||||
@@ -219,9 +219,9 @@ static s32 e1000_init_mac_params_82540(struct e1000_hw *hw)
|
||||
}
|
||||
/* link info */
|
||||
mac->ops.get_link_up_info =
|
||||
(hw->phy.media_type == e1000_media_type_copper)
|
||||
? e1000_get_speed_and_duplex_copper_generic
|
||||
: e1000_get_speed_and_duplex_fiber_serdes_generic;
|
||||
(hw->phy.media_type == e1000_media_type_copper)
|
||||
? e1000_get_speed_and_duplex_copper_generic
|
||||
: e1000_get_speed_and_duplex_fiber_serdes_generic;
|
||||
/* multicast address update */
|
||||
mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic;
|
||||
/* writing VFTA */
|
||||
@@ -374,7 +374,7 @@ static s32 e1000_init_hw_82540(struct e1000_hw *hw)
|
||||
|
||||
txdctl = E1000_READ_REG(hw, E1000_TXDCTL(0));
|
||||
txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) |
|
||||
E1000_TXDCTL_FULL_TX_DESC_WB;
|
||||
E1000_TXDCTL_FULL_TX_DESC_WB;
|
||||
E1000_WRITE_REG(hw, E1000_TXDCTL(0), txdctl);
|
||||
|
||||
/*
|
||||
@@ -427,11 +427,13 @@ static s32 e1000_setup_copper_link_82540(struct e1000_hw *hw)
|
||||
|
||||
if (hw->mac.type == e1000_82545_rev_3 ||
|
||||
hw->mac.type == e1000_82546_rev_3) {
|
||||
ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &data);
|
||||
ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL,
|
||||
&data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
data |= 0x00000008;
|
||||
ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, data);
|
||||
ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL,
|
||||
data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
}
|
||||
@@ -508,9 +510,8 @@ static s32 e1000_adjust_serdes_amplitude_82540(struct e1000_hw *hw)
|
||||
if (nvm_data != NVM_RESERVED_WORD) {
|
||||
/* Adjust serdes output amplitude only. */
|
||||
nvm_data &= NVM_SERDES_AMPLITUDE_MASK;
|
||||
ret_val = hw->phy.ops.write_reg(hw,
|
||||
M88E1000_PHY_EXT_CTRL,
|
||||
nvm_data);
|
||||
ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_EXT_CTRL,
|
||||
nvm_data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
}
|
||||
@@ -535,9 +536,8 @@ static s32 e1000_set_vco_speed_82540(struct e1000_hw *hw)
|
||||
|
||||
/* Set PHY register 30, page 5, bit 8 to 0 */
|
||||
|
||||
ret_val = hw->phy.ops.read_reg(hw,
|
||||
M88E1000_PHY_PAGE_SELECT,
|
||||
&default_page);
|
||||
ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_PAGE_SELECT,
|
||||
&default_page);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
@@ -570,7 +570,7 @@ static s32 e1000_set_vco_speed_82540(struct e1000_hw *hw)
|
||||
goto out;
|
||||
|
||||
ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT,
|
||||
default_page);
|
||||
default_page);
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
@@ -587,7 +587,6 @@ out:
|
||||
**/
|
||||
static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw)
|
||||
{
|
||||
struct e1000_phy_info *phy = &hw->phy;
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
u16 nvm_data;
|
||||
|
||||
@@ -604,20 +603,18 @@ static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw)
|
||||
|
||||
if ((nvm_data != NVM_RESERVED_WORD) && (nvm_data & NVM_PHY_CLASS_A)) {
|
||||
ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT,
|
||||
0x000B);
|
||||
0x000B);
|
||||
if (ret_val) {
|
||||
ret_val = -E1000_ERR_PHY;
|
||||
goto out;
|
||||
}
|
||||
ret_val = hw->phy.ops.write_reg(hw,
|
||||
M88E1000_PHY_GEN_CONTROL,
|
||||
0x8104);
|
||||
ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL,
|
||||
0x8104);
|
||||
if (ret_val) {
|
||||
ret_val = -E1000_ERR_PHY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
phy->reset_disable = FALSE;
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2011, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_82541.c,v 1.4.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
/*
|
||||
* 82541EI Gigabit Ethernet Controller
|
||||
@@ -300,7 +300,7 @@ void e1000_init_function_pointers_82541(struct e1000_hw *hw)
|
||||
**/
|
||||
static s32 e1000_reset_hw_82541(struct e1000_hw *hw)
|
||||
{
|
||||
u32 ledctl, ctrl, manc;
|
||||
u32 ledctl, ctrl, icr, manc;
|
||||
|
||||
DEBUGFUNC("e1000_reset_hw_82541");
|
||||
|
||||
@@ -364,7 +364,7 @@ static s32 e1000_reset_hw_82541(struct e1000_hw *hw)
|
||||
E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF);
|
||||
|
||||
/* Clear any pending interrupt events. */
|
||||
E1000_READ_REG(hw, E1000_ICR);
|
||||
icr = E1000_READ_REG(hw, E1000_ICR);
|
||||
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
@@ -390,7 +390,7 @@ static s32 e1000_init_hw_82541(struct e1000_hw *hw)
|
||||
DEBUGOUT("Error initializing identification LED\n");
|
||||
/* This is not fatal and we should not stop init due to this */
|
||||
}
|
||||
|
||||
|
||||
/* Storing the Speed Power Down value for later use */
|
||||
ret_val = hw->phy.ops.read_reg(hw,
|
||||
IGP01E1000_GMII_FIFO,
|
||||
@@ -549,8 +549,6 @@ static s32 e1000_setup_copper_link_82541(struct e1000_hw *hw)
|
||||
ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
|
||||
E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
|
||||
|
||||
hw->phy.reset_disable = FALSE;
|
||||
|
||||
/* Earlier revs of the IGP phy require us to force MDI. */
|
||||
if (hw->mac.type == e1000_82541 || hw->mac.type == e1000_82547) {
|
||||
dev_spec->dsp_config = e1000_dsp_config_disabled;
|
||||
@@ -644,7 +642,7 @@ static s32 e1000_check_for_link_82541(struct e1000_hw *hw)
|
||||
* of MAC speed/duplex configuration. So we only need to
|
||||
* configure Collision Distance in the MAC.
|
||||
*/
|
||||
e1000_config_collision_dist_generic(hw);
|
||||
mac->ops.config_collision_dist(hw);
|
||||
|
||||
/*
|
||||
* Configure Flow Control now that Auto-Neg has completed.
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_82541.h,v 1.1.4.1.6.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_82541_H_
|
||||
#define _E1000_82541_H_
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_82542.c,v 1.3.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
/*
|
||||
* 82542 Gigabit Ethernet Controller
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2011, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_82543.c,v 1.2.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
/*
|
||||
* 82543GC Gigabit Ethernet Controller (Fiber)
|
||||
@@ -901,7 +901,7 @@ static s32 e1000_phy_hw_reset_82543(struct e1000_hw *hw)
|
||||
**/
|
||||
static s32 e1000_reset_hw_82543(struct e1000_hw *hw)
|
||||
{
|
||||
u32 ctrl;
|
||||
u32 ctrl, icr;
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
|
||||
DEBUGFUNC("e1000_reset_hw_82543");
|
||||
@@ -943,7 +943,7 @@ static s32 e1000_reset_hw_82543(struct e1000_hw *hw)
|
||||
|
||||
/* Masking off and clearing any pending interrupts */
|
||||
E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff);
|
||||
E1000_READ_REG(hw, E1000_ICR);
|
||||
icr = E1000_READ_REG(hw, E1000_ICR);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
@@ -1079,7 +1079,6 @@ static s32 e1000_setup_copper_link_82543(struct e1000_hw *hw)
|
||||
ret_val = hw->phy.ops.reset(hw);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
hw->phy.reset_disable = FALSE;
|
||||
} else {
|
||||
ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX);
|
||||
E1000_WRITE_REG(hw, E1000_CTRL, ctrl);
|
||||
@@ -1127,7 +1126,7 @@ static s32 e1000_setup_copper_link_82543(struct e1000_hw *hw)
|
||||
DEBUGOUT("Valid link established!!!\n");
|
||||
/* Config the MAC and PHY after link is up */
|
||||
if (hw->mac.type == e1000_82544) {
|
||||
e1000_config_collision_dist_generic(hw);
|
||||
hw->mac.ops.config_collision_dist(hw);
|
||||
} else {
|
||||
ret_val = e1000_config_mac_to_phy_82543(hw);
|
||||
if (ret_val)
|
||||
@@ -1161,7 +1160,7 @@ static s32 e1000_setup_fiber_link_82543(struct e1000_hw *hw)
|
||||
/* Take the link out of reset */
|
||||
ctrl &= ~E1000_CTRL_LRST;
|
||||
|
||||
e1000_config_collision_dist_generic(hw);
|
||||
hw->mac.ops.config_collision_dist(hw);
|
||||
|
||||
ret_val = e1000_commit_fc_settings_generic(hw);
|
||||
if (ret_val)
|
||||
@@ -1260,7 +1259,7 @@ static s32 e1000_check_for_copper_link_82543(struct e1000_hw *hw)
|
||||
* settings.
|
||||
*/
|
||||
if (mac->type == e1000_82544)
|
||||
e1000_config_collision_dist_generic(hw);
|
||||
hw->mac.ops.config_collision_dist(hw);
|
||||
else {
|
||||
ret_val = e1000_config_mac_to_phy_82543(hw);
|
||||
if (ret_val) {
|
||||
@@ -1434,7 +1433,7 @@ static s32 e1000_config_mac_to_phy_82543(struct e1000_hw *hw)
|
||||
if (phy_data & M88E1000_PSSR_DPLX)
|
||||
ctrl |= E1000_CTRL_FD;
|
||||
|
||||
e1000_config_collision_dist_generic(hw);
|
||||
hw->mac.ops.config_collision_dist(hw);
|
||||
|
||||
/*
|
||||
* Set up speed in the Device Control register depending on
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_82543.h,v 1.1.4.1.6.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_82543_H_
|
||||
#define _E1000_82543_H_
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2011, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_82571.c,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
/*
|
||||
* 82571EB Gigabit Ethernet Controller
|
||||
@@ -57,12 +57,12 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw);
|
||||
static s32 e1000_acquire_nvm_82571(struct e1000_hw *hw);
|
||||
static void e1000_release_nvm_82571(struct e1000_hw *hw);
|
||||
static s32 e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset,
|
||||
u16 words, u16 *data);
|
||||
u16 words, u16 *data);
|
||||
static s32 e1000_update_nvm_checksum_82571(struct e1000_hw *hw);
|
||||
static s32 e1000_validate_nvm_checksum_82571(struct e1000_hw *hw);
|
||||
static s32 e1000_get_cfg_done_82571(struct e1000_hw *hw);
|
||||
static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw,
|
||||
bool active);
|
||||
bool active);
|
||||
static s32 e1000_reset_hw_82571(struct e1000_hw *hw);
|
||||
static s32 e1000_init_hw_82571(struct e1000_hw *hw);
|
||||
static void e1000_clear_vfta_82571(struct e1000_hw *hw);
|
||||
@@ -83,12 +83,12 @@ static void e1000_put_hw_semaphore_82573(struct e1000_hw *hw);
|
||||
static s32 e1000_get_hw_semaphore_82574(struct e1000_hw *hw);
|
||||
static void e1000_put_hw_semaphore_82574(struct e1000_hw *hw);
|
||||
static s32 e1000_set_d0_lplu_state_82574(struct e1000_hw *hw,
|
||||
bool active);
|
||||
bool active);
|
||||
static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw,
|
||||
bool active);
|
||||
bool active);
|
||||
static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw);
|
||||
static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
|
||||
u16 words, u16 *data);
|
||||
u16 words, u16 *data);
|
||||
static s32 e1000_read_mac_addr_82571(struct e1000_hw *hw);
|
||||
static void e1000_power_down_phy_copper_82571(struct e1000_hw *hw);
|
||||
|
||||
@@ -108,61 +108,61 @@ static s32 e1000_init_phy_params_82571(struct e1000_hw *hw)
|
||||
goto out;
|
||||
}
|
||||
|
||||
phy->addr = 1;
|
||||
phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
|
||||
phy->reset_delay_us = 100;
|
||||
phy->addr = 1;
|
||||
phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT;
|
||||
phy->reset_delay_us = 100;
|
||||
|
||||
phy->ops.check_reset_block = e1000_check_reset_block_generic;
|
||||
phy->ops.reset = e1000_phy_hw_reset_generic;
|
||||
phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82571;
|
||||
phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic;
|
||||
phy->ops.power_up = e1000_power_up_phy_copper;
|
||||
phy->ops.power_down = e1000_power_down_phy_copper_82571;
|
||||
phy->ops.check_reset_block = e1000_check_reset_block_generic;
|
||||
phy->ops.reset = e1000_phy_hw_reset_generic;
|
||||
phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82571;
|
||||
phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic;
|
||||
phy->ops.power_up = e1000_power_up_phy_copper;
|
||||
phy->ops.power_down = e1000_power_down_phy_copper_82571;
|
||||
|
||||
switch (hw->mac.type) {
|
||||
case e1000_82571:
|
||||
case e1000_82572:
|
||||
phy->type = e1000_phy_igp_2;
|
||||
phy->ops.get_cfg_done = e1000_get_cfg_done_82571;
|
||||
phy->ops.get_info = e1000_get_phy_info_igp;
|
||||
phy->ops.check_polarity = e1000_check_polarity_igp;
|
||||
phy->type = e1000_phy_igp_2;
|
||||
phy->ops.get_cfg_done = e1000_get_cfg_done_82571;
|
||||
phy->ops.get_info = e1000_get_phy_info_igp;
|
||||
phy->ops.check_polarity = e1000_check_polarity_igp;
|
||||
phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_igp;
|
||||
phy->ops.get_cable_length = e1000_get_cable_length_igp_2;
|
||||
phy->ops.read_reg = e1000_read_phy_reg_igp;
|
||||
phy->ops.write_reg = e1000_write_phy_reg_igp;
|
||||
phy->ops.acquire = e1000_get_hw_semaphore_82571;
|
||||
phy->ops.release = e1000_put_hw_semaphore_82571;
|
||||
phy->ops.get_cable_length = e1000_get_cable_length_igp_2;
|
||||
phy->ops.read_reg = e1000_read_phy_reg_igp;
|
||||
phy->ops.write_reg = e1000_write_phy_reg_igp;
|
||||
phy->ops.acquire = e1000_get_hw_semaphore_82571;
|
||||
phy->ops.release = e1000_put_hw_semaphore_82571;
|
||||
break;
|
||||
case e1000_82573:
|
||||
phy->type = e1000_phy_m88;
|
||||
phy->ops.get_cfg_done = e1000_get_cfg_done_generic;
|
||||
phy->ops.get_info = e1000_get_phy_info_m88;
|
||||
phy->ops.check_polarity = e1000_check_polarity_m88;
|
||||
phy->ops.commit = e1000_phy_sw_reset_generic;
|
||||
phy->type = e1000_phy_m88;
|
||||
phy->ops.get_cfg_done = e1000_get_cfg_done_generic;
|
||||
phy->ops.get_info = e1000_get_phy_info_m88;
|
||||
phy->ops.check_polarity = e1000_check_polarity_m88;
|
||||
phy->ops.commit = e1000_phy_sw_reset_generic;
|
||||
phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88;
|
||||
phy->ops.get_cable_length = e1000_get_cable_length_m88;
|
||||
phy->ops.read_reg = e1000_read_phy_reg_m88;
|
||||
phy->ops.write_reg = e1000_write_phy_reg_m88;
|
||||
phy->ops.acquire = e1000_get_hw_semaphore_82571;
|
||||
phy->ops.release = e1000_put_hw_semaphore_82571;
|
||||
phy->ops.get_cable_length = e1000_get_cable_length_m88;
|
||||
phy->ops.read_reg = e1000_read_phy_reg_m88;
|
||||
phy->ops.write_reg = e1000_write_phy_reg_m88;
|
||||
phy->ops.acquire = e1000_get_hw_semaphore_82571;
|
||||
phy->ops.release = e1000_put_hw_semaphore_82571;
|
||||
break;
|
||||
case e1000_82574:
|
||||
case e1000_82583:
|
||||
E1000_MUTEX_INIT(&hw->dev_spec._82571.swflag_mutex);
|
||||
|
||||
phy->type = e1000_phy_bm;
|
||||
phy->ops.get_cfg_done = e1000_get_cfg_done_generic;
|
||||
phy->ops.get_info = e1000_get_phy_info_m88;
|
||||
phy->ops.check_polarity = e1000_check_polarity_m88;
|
||||
phy->ops.commit = e1000_phy_sw_reset_generic;
|
||||
phy->type = e1000_phy_bm;
|
||||
phy->ops.get_cfg_done = e1000_get_cfg_done_generic;
|
||||
phy->ops.get_info = e1000_get_phy_info_m88;
|
||||
phy->ops.check_polarity = e1000_check_polarity_m88;
|
||||
phy->ops.commit = e1000_phy_sw_reset_generic;
|
||||
phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88;
|
||||
phy->ops.get_cable_length = e1000_get_cable_length_m88;
|
||||
phy->ops.read_reg = e1000_read_phy_reg_bm2;
|
||||
phy->ops.write_reg = e1000_write_phy_reg_bm2;
|
||||
phy->ops.acquire = e1000_get_hw_semaphore_82574;
|
||||
phy->ops.release = e1000_put_hw_semaphore_82574;
|
||||
phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82574;
|
||||
phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82574;
|
||||
phy->ops.get_cable_length = e1000_get_cable_length_m88;
|
||||
phy->ops.read_reg = e1000_read_phy_reg_bm2;
|
||||
phy->ops.write_reg = e1000_write_phy_reg_bm2;
|
||||
phy->ops.acquire = e1000_get_hw_semaphore_82574;
|
||||
phy->ops.release = e1000_put_hw_semaphore_82574;
|
||||
phy->ops.set_d0_lplu_state = e1000_set_d0_lplu_state_82574;
|
||||
phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_82574;
|
||||
break;
|
||||
default:
|
||||
ret_val = -E1000_ERR_PHY;
|
||||
@@ -253,7 +253,7 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)
|
||||
default:
|
||||
nvm->type = e1000_nvm_eeprom_spi;
|
||||
size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >>
|
||||
E1000_EECD_SIZE_EX_SHIFT);
|
||||
E1000_EECD_SIZE_EX_SHIFT);
|
||||
/*
|
||||
* Added to a constant, "size" becomes the left-shift value
|
||||
* for setting word_size.
|
||||
@@ -263,7 +263,7 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)
|
||||
/* EEPROM access above 16k is unsupported */
|
||||
if (size > 14)
|
||||
size = 14;
|
||||
nvm->word_size = 1 << size;
|
||||
nvm->word_size = 1 << size;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -279,11 +279,11 @@ static s32 e1000_init_nvm_params_82571(struct e1000_hw *hw)
|
||||
nvm->ops.release = e1000_release_nvm_82571;
|
||||
break;
|
||||
}
|
||||
nvm->ops.read = e1000_read_nvm_eerd;
|
||||
nvm->ops.update = e1000_update_nvm_checksum_82571;
|
||||
nvm->ops.validate = e1000_validate_nvm_checksum_82571;
|
||||
nvm->ops.read = e1000_read_nvm_eerd;
|
||||
nvm->ops.update = e1000_update_nvm_checksum_82571;
|
||||
nvm->ops.validate = e1000_validate_nvm_checksum_82571;
|
||||
nvm->ops.valid_led_default = e1000_valid_led_default_82571;
|
||||
nvm->ops.write = e1000_write_nvm_82571;
|
||||
nvm->ops.write = e1000_write_nvm_82571;
|
||||
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
@@ -363,8 +363,6 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw)
|
||||
mac->ops.read_mac_addr = e1000_read_mac_addr_82571;
|
||||
/* ID LED init */
|
||||
mac->ops.id_led_init = e1000_id_led_init_generic;
|
||||
/* blink LED */
|
||||
mac->ops.blink_led = e1000_blink_led_generic;
|
||||
/* setup LED */
|
||||
mac->ops.setup_led = e1000_setup_led_generic;
|
||||
/* cleanup LED */
|
||||
@@ -380,6 +378,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw)
|
||||
mac->ops.set_lan_id = e1000_set_lan_id_single_port;
|
||||
mac->ops.check_mng_mode = e1000_check_mng_mode_generic;
|
||||
mac->ops.led_on = e1000_led_on_generic;
|
||||
mac->ops.blink_led = e1000_blink_led_generic;
|
||||
|
||||
/* FWSM register */
|
||||
mac->has_fwsm = TRUE;
|
||||
@@ -387,9 +386,8 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw)
|
||||
* ARC supported; valid only if manageability features are
|
||||
* enabled.
|
||||
*/
|
||||
mac->arc_subsystem_valid =
|
||||
(E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK)
|
||||
? TRUE : FALSE;
|
||||
mac->arc_subsystem_valid = (E1000_READ_REG(hw, E1000_FWSM) &
|
||||
E1000_FWSM_MODE_MASK) ? TRUE : FALSE;
|
||||
break;
|
||||
case e1000_82574:
|
||||
case e1000_82583:
|
||||
@@ -400,6 +398,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw)
|
||||
default:
|
||||
mac->ops.check_mng_mode = e1000_check_mng_mode_generic;
|
||||
mac->ops.led_on = e1000_led_on_generic;
|
||||
mac->ops.blink_led = e1000_blink_led_generic;
|
||||
|
||||
/* FWSM register */
|
||||
mac->has_fwsm = TRUE;
|
||||
@@ -420,8 +419,8 @@ static s32 e1000_init_mac_params_82571(struct e1000_hw *hw)
|
||||
|
||||
if (!(swsm2 & E1000_SWSM2_LOCK)) {
|
||||
/* Only do this for the first interface on this card */
|
||||
E1000_WRITE_REG(hw, E1000_SWSM2,
|
||||
swsm2 | E1000_SWSM2_LOCK);
|
||||
E1000_WRITE_REG(hw, E1000_SWSM2, swsm2 |
|
||||
E1000_SWSM2_LOCK);
|
||||
force_clear_smbi = TRUE;
|
||||
} else
|
||||
force_clear_smbi = FALSE;
|
||||
@@ -746,8 +745,8 @@ static s32 e1000_set_d3_lplu_state_82574(struct e1000_hw *hw, bool active)
|
||||
if (!active) {
|
||||
data &= ~E1000_PHY_CTRL_NOND0A_LPLU;
|
||||
} else if ((hw->phy.autoneg_advertised == E1000_ALL_SPEED_DUPLEX) ||
|
||||
(hw->phy.autoneg_advertised == E1000_ALL_NOT_GIG) ||
|
||||
(hw->phy.autoneg_advertised == E1000_ALL_10_SPEED)) {
|
||||
(hw->phy.autoneg_advertised == E1000_ALL_NOT_GIG) ||
|
||||
(hw->phy.autoneg_advertised == E1000_ALL_10_SPEED)) {
|
||||
data |= E1000_PHY_CTRL_NOND0A_LPLU;
|
||||
}
|
||||
|
||||
@@ -816,7 +815,7 @@ static void e1000_release_nvm_82571(struct e1000_hw *hw)
|
||||
* EEPROM will most likely contain an invalid checksum.
|
||||
**/
|
||||
static s32 e1000_write_nvm_82571(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
u16 *data)
|
||||
u16 *data)
|
||||
{
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
|
||||
@@ -941,7 +940,7 @@ static s32 e1000_validate_nvm_checksum_82571(struct e1000_hw *hw)
|
||||
* EEPROM will most likely contain an invalid checksum.
|
||||
**/
|
||||
static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
|
||||
u16 words, u16 *data)
|
||||
u16 words, u16 *data)
|
||||
{
|
||||
struct e1000_nvm_info *nvm = &hw->nvm;
|
||||
u32 i, eewr = 0;
|
||||
@@ -1039,22 +1038,22 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active)
|
||||
if (active) {
|
||||
data |= IGP02E1000_PM_D0_LPLU;
|
||||
ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT,
|
||||
data);
|
||||
data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
/* When LPLU is enabled, we should disable SmartSpeed */
|
||||
ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
|
||||
&data);
|
||||
&data);
|
||||
data &= ~IGP01E1000_PSCFR_SMART_SPEED;
|
||||
ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
|
||||
data);
|
||||
data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
} else {
|
||||
data &= ~IGP02E1000_PM_D0_LPLU;
|
||||
ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT,
|
||||
data);
|
||||
data);
|
||||
/*
|
||||
* LPLU and SmartSpeed are mutually exclusive. LPLU is used
|
||||
* during Dx states where the power conservation is most
|
||||
@@ -1063,28 +1062,28 @@ static s32 e1000_set_d0_lplu_state_82571(struct e1000_hw *hw, bool active)
|
||||
*/
|
||||
if (phy->smart_speed == e1000_smart_speed_on) {
|
||||
ret_val = phy->ops.read_reg(hw,
|
||||
IGP01E1000_PHY_PORT_CONFIG,
|
||||
&data);
|
||||
IGP01E1000_PHY_PORT_CONFIG,
|
||||
&data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
data |= IGP01E1000_PSCFR_SMART_SPEED;
|
||||
ret_val = phy->ops.write_reg(hw,
|
||||
IGP01E1000_PHY_PORT_CONFIG,
|
||||
data);
|
||||
IGP01E1000_PHY_PORT_CONFIG,
|
||||
data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
} else if (phy->smart_speed == e1000_smart_speed_off) {
|
||||
ret_val = phy->ops.read_reg(hw,
|
||||
IGP01E1000_PHY_PORT_CONFIG,
|
||||
&data);
|
||||
IGP01E1000_PHY_PORT_CONFIG,
|
||||
&data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
data &= ~IGP01E1000_PSCFR_SMART_SPEED;
|
||||
ret_val = phy->ops.write_reg(hw,
|
||||
IGP01E1000_PHY_PORT_CONFIG,
|
||||
data);
|
||||
IGP01E1000_PHY_PORT_CONFIG,
|
||||
data);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
}
|
||||
@@ -1255,8 +1254,7 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
|
||||
/* Set the transmit descriptor write-back policy */
|
||||
reg_data = E1000_READ_REG(hw, E1000_TXDCTL(0));
|
||||
reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) |
|
||||
E1000_TXDCTL_FULL_TX_DESC_WB |
|
||||
E1000_TXDCTL_COUNT_DESC;
|
||||
E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC;
|
||||
E1000_WRITE_REG(hw, E1000_TXDCTL(0), reg_data);
|
||||
|
||||
/* ...for both queues. */
|
||||
@@ -1273,8 +1271,8 @@ static s32 e1000_init_hw_82571(struct e1000_hw *hw)
|
||||
default:
|
||||
reg_data = E1000_READ_REG(hw, E1000_TXDCTL(1));
|
||||
reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) |
|
||||
E1000_TXDCTL_FULL_TX_DESC_WB |
|
||||
E1000_TXDCTL_COUNT_DESC;
|
||||
E1000_TXDCTL_FULL_TX_DESC_WB |
|
||||
E1000_TXDCTL_COUNT_DESC;
|
||||
E1000_WRITE_REG(hw, E1000_TXDCTL(1), reg_data);
|
||||
break;
|
||||
}
|
||||
@@ -1320,6 +1318,10 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
|
||||
case e1000_82572:
|
||||
reg |= (1 << 23) | (1 << 24) | (1 << 25) | (1 << 26);
|
||||
break;
|
||||
case e1000_82574:
|
||||
case e1000_82583:
|
||||
reg |= (1 << 26);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1527,12 +1529,12 @@ bool e1000_check_phy_82574(struct e1000_hw *hw)
|
||||
* read the Base1000T status register If both are max then PHY is hung.
|
||||
*/
|
||||
ret_val = hw->phy.ops.read_reg(hw, E1000_RECEIVE_ERROR_COUNTER,
|
||||
&receive_errors);
|
||||
&receive_errors);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
if (receive_errors == E1000_RECEIVE_ERROR_MAX) {
|
||||
ret_val = hw->phy.ops.read_reg(hw, E1000_BASE1000T_STATUS,
|
||||
&status_1kbt);
|
||||
&status_1kbt);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
if ((status_1kbt & E1000_IDLE_ERROR_COUNT_MASK) ==
|
||||
@@ -1640,7 +1642,8 @@ static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw)
|
||||
* mode. This prevents drivers from twiddling their thumbs
|
||||
* if another tool failed to take it out of loopback mode.
|
||||
*/
|
||||
E1000_WRITE_REG(hw, E1000_SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK);
|
||||
E1000_WRITE_REG(hw, E1000_SCTL,
|
||||
E1000_SCTL_DISABLE_SERDES_LOOPBACK);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1664,7 +1667,7 @@ static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw)
|
||||
*
|
||||
* 1) down
|
||||
* 2) autoneg_progress
|
||||
* 3) autoneg_complete (the link sucessfully autonegotiated)
|
||||
* 3) autoneg_complete (the link successfully autonegotiated)
|
||||
* 4) forced_up (the link has been forced up, it did not autonegotiate)
|
||||
*
|
||||
**/
|
||||
@@ -1763,7 +1766,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
|
||||
break;
|
||||
}
|
||||
mac->serdes_link_state =
|
||||
e1000_serdes_link_forced_up;
|
||||
e1000_serdes_link_forced_up;
|
||||
mac->serdes_has_link = TRUE;
|
||||
DEBUGOUT("AN_PROG -> FORCED_UP\n");
|
||||
}
|
||||
@@ -1777,10 +1780,10 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
|
||||
* up.
|
||||
*/
|
||||
E1000_WRITE_REG(hw, E1000_TXCW, mac->txcw);
|
||||
E1000_WRITE_REG(hw, E1000_CTRL,
|
||||
(ctrl & ~E1000_CTRL_SLU));
|
||||
E1000_WRITE_REG(hw, E1000_CTRL, (ctrl &
|
||||
~E1000_CTRL_SLU));
|
||||
mac->serdes_link_state =
|
||||
e1000_serdes_link_autoneg_progress;
|
||||
e1000_serdes_link_autoneg_progress;
|
||||
mac->serdes_has_link = FALSE;
|
||||
DEBUGOUT("DOWN -> AN_PROG\n");
|
||||
break;
|
||||
@@ -1804,7 +1807,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
|
||||
(rxcw & E1000_RXCW_C))) {
|
||||
mac->serdes_has_link = FALSE;
|
||||
mac->serdes_link_state =
|
||||
e1000_serdes_link_down;
|
||||
e1000_serdes_link_down;
|
||||
DEBUGOUT("ANYSTATE -> DOWN\n");
|
||||
break;
|
||||
}
|
||||
@@ -1815,7 +1818,7 @@ static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
|
||||
txcw |= E1000_TXCW_ANE;
|
||||
E1000_WRITE_REG(hw, E1000_TXCW, txcw);
|
||||
mac->serdes_link_state =
|
||||
e1000_serdes_link_autoneg_progress;
|
||||
e1000_serdes_link_autoneg_progress;
|
||||
mac->serdes_has_link = FALSE;
|
||||
DEBUGOUT("ANYSTATE -> AN_PROG\n");
|
||||
}
|
||||
@@ -1904,8 +1907,8 @@ void e1000_set_laa_state_82571(struct e1000_hw *hw, bool state)
|
||||
* incoming packets directed to this port are dropped.
|
||||
* Eventually the LAA will be in RAR[0] and RAR[14].
|
||||
*/
|
||||
e1000_rar_set_generic(hw, hw->mac.addr,
|
||||
hw->mac.rar_entry_count - 1);
|
||||
hw->mac.ops.rar_set(hw, hw->mac.addr,
|
||||
hw->mac.rar_entry_count - 1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_82571.h,v 1.1.4.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_82571_H_
|
||||
#define _E1000_82571_H_
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2011, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,15 +30,15 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_82575.h,v 1.4.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_82575_H_
|
||||
#define _E1000_82575_H_
|
||||
|
||||
#define ID_LED_DEFAULT_82575_SERDES ((ID_LED_DEF1_DEF2 << 12) | \
|
||||
(ID_LED_DEF1_DEF2 << 8) | \
|
||||
(ID_LED_DEF1_DEF2 << 4) | \
|
||||
(ID_LED_OFF1_ON2))
|
||||
#define ID_LED_DEFAULT_82575_SERDES ((ID_LED_DEF1_DEF2 << 12) | \
|
||||
(ID_LED_DEF1_DEF2 << 8) | \
|
||||
(ID_LED_DEF1_DEF2 << 4) | \
|
||||
(ID_LED_OFF1_ON2))
|
||||
/*
|
||||
* Receive Address Register Count
|
||||
* Number of high/low register pairs in the RAR. The RAR (Receive Address
|
||||
@@ -49,13 +49,13 @@
|
||||
* For 82576, there are an additional set of RARs that begin at an offset
|
||||
* separate from the first set of RARs.
|
||||
*/
|
||||
#define E1000_RAR_ENTRIES_82575 16
|
||||
#define E1000_RAR_ENTRIES_82576 24
|
||||
#define E1000_RAR_ENTRIES_82580 24
|
||||
#define E1000_RAR_ENTRIES_I350 32
|
||||
#define E1000_SW_SYNCH_MB 0x00000100
|
||||
#define E1000_STAT_DEV_RST_SET 0x00100000
|
||||
#define E1000_CTRL_DEV_RST 0x20000000
|
||||
#define E1000_RAR_ENTRIES_82575 16
|
||||
#define E1000_RAR_ENTRIES_82576 24
|
||||
#define E1000_RAR_ENTRIES_82580 24
|
||||
#define E1000_RAR_ENTRIES_I350 32
|
||||
#define E1000_SW_SYNCH_MB 0x00000100
|
||||
#define E1000_STAT_DEV_RST_SET 0x00100000
|
||||
#define E1000_CTRL_DEV_RST 0x20000000
|
||||
|
||||
#ifdef E1000_BIT_FIELDS
|
||||
struct e1000_adv_data_desc {
|
||||
@@ -63,137 +63,138 @@ struct e1000_adv_data_desc {
|
||||
union {
|
||||
u32 data;
|
||||
struct {
|
||||
u32 datalen :16; /* Data buffer length */
|
||||
u32 rsvd :4;
|
||||
u32 dtyp :4; /* Descriptor type */
|
||||
u32 dcmd :8; /* Descriptor command */
|
||||
u32 datalen:16; /* Data buffer length */
|
||||
u32 rsvd:4;
|
||||
u32 dtyp:4; /* Descriptor type */
|
||||
u32 dcmd:8; /* Descriptor command */
|
||||
} config;
|
||||
} lower;
|
||||
union {
|
||||
u32 data;
|
||||
struct {
|
||||
u32 status :4; /* Descriptor status */
|
||||
u32 idx :4;
|
||||
u32 popts :6; /* Packet Options */
|
||||
u32 paylen :18; /* Payload length */
|
||||
u32 status:4; /* Descriptor status */
|
||||
u32 idx:4;
|
||||
u32 popts:6; /* Packet Options */
|
||||
u32 paylen:18; /* Payload length */
|
||||
} options;
|
||||
} upper;
|
||||
};
|
||||
|
||||
#define E1000_TXD_DTYP_ADV_C 0x2 /* Advanced Context Descriptor */
|
||||
#define E1000_TXD_DTYP_ADV_D 0x3 /* Advanced Data Descriptor */
|
||||
#define E1000_ADV_TXD_CMD_DEXT 0x20 /* Descriptor extension (0 = legacy) */
|
||||
#define E1000_ADV_TUCMD_IPV4 0x2 /* IP Packet Type: 1=IPv4 */
|
||||
#define E1000_ADV_TUCMD_IPV6 0x0 /* IP Packet Type: 0=IPv6 */
|
||||
#define E1000_ADV_TUCMD_L4T_UDP 0x0 /* L4 Packet TYPE of UDP */
|
||||
#define E1000_ADV_TUCMD_L4T_TCP 0x4 /* L4 Packet TYPE of TCP */
|
||||
#define E1000_ADV_TUCMD_MKRREQ 0x10 /* Indicates markers are required */
|
||||
#define E1000_ADV_DCMD_EOP 0x1 /* End of Packet */
|
||||
#define E1000_ADV_DCMD_IFCS 0x2 /* Insert FCS (Ethernet CRC) */
|
||||
#define E1000_ADV_DCMD_RS 0x8 /* Report Status */
|
||||
#define E1000_ADV_DCMD_VLE 0x40 /* Add VLAN tag */
|
||||
#define E1000_ADV_DCMD_TSE 0x80 /* TCP Seg enable */
|
||||
#define E1000_TXD_DTYP_ADV_C 0x2 /* Advanced Context Descriptor */
|
||||
#define E1000_TXD_DTYP_ADV_D 0x3 /* Advanced Data Descriptor */
|
||||
#define E1000_ADV_TXD_CMD_DEXT 0x20 /* Descriptor extension (0 = legacy) */
|
||||
#define E1000_ADV_TUCMD_IPV4 0x2 /* IP Packet Type: 1=IPv4 */
|
||||
#define E1000_ADV_TUCMD_IPV6 0x0 /* IP Packet Type: 0=IPv6 */
|
||||
#define E1000_ADV_TUCMD_L4T_UDP 0x0 /* L4 Packet TYPE of UDP */
|
||||
#define E1000_ADV_TUCMD_L4T_TCP 0x4 /* L4 Packet TYPE of TCP */
|
||||
#define E1000_ADV_TUCMD_MKRREQ 0x10 /* Indicates markers are required */
|
||||
#define E1000_ADV_DCMD_EOP 0x1 /* End of Packet */
|
||||
#define E1000_ADV_DCMD_IFCS 0x2 /* Insert FCS (Ethernet CRC) */
|
||||
#define E1000_ADV_DCMD_RS 0x8 /* Report Status */
|
||||
#define E1000_ADV_DCMD_VLE 0x40 /* Add VLAN tag */
|
||||
#define E1000_ADV_DCMD_TSE 0x80 /* TCP Seg enable */
|
||||
/* Extended Device Control */
|
||||
#define E1000_CTRL_EXT_NSICR 0x00000001 /* Disable Intr Clear all on read */
|
||||
#define E1000_CTRL_EXT_NSICR 0x00000001 /* Disable Intr Clear all on read */
|
||||
|
||||
struct e1000_adv_context_desc {
|
||||
union {
|
||||
u32 ip_config;
|
||||
struct {
|
||||
u32 iplen :9;
|
||||
u32 maclen :7;
|
||||
u32 vlan_tag :16;
|
||||
u32 iplen:9;
|
||||
u32 maclen:7;
|
||||
u32 vlan_tag:16;
|
||||
} fields;
|
||||
} ip_setup;
|
||||
u32 seq_num;
|
||||
union {
|
||||
u64 l4_config;
|
||||
struct {
|
||||
u32 mkrloc :9;
|
||||
u32 tucmd :11;
|
||||
u32 dtyp :4;
|
||||
u32 adv :8;
|
||||
u32 rsvd :4;
|
||||
u32 idx :4;
|
||||
u32 l4len :8;
|
||||
u32 mss :16;
|
||||
u32 mkrloc:9;
|
||||
u32 tucmd:11;
|
||||
u32 dtyp:4;
|
||||
u32 adv:8;
|
||||
u32 rsvd:4;
|
||||
u32 idx:4;
|
||||
u32 l4len:8;
|
||||
u32 mss:16;
|
||||
} fields;
|
||||
} l4_setup;
|
||||
};
|
||||
#endif
|
||||
|
||||
/* SRRCTL bit definitions */
|
||||
#define E1000_SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */
|
||||
#define E1000_SRRCTL_BSIZEHDRSIZE_MASK 0x00000F00
|
||||
#define E1000_SRRCTL_BSIZEHDRSIZE_SHIFT 2 /* Shift _left_ */
|
||||
#define E1000_SRRCTL_DESCTYPE_LEGACY 0x00000000
|
||||
#define E1000_SRRCTL_DESCTYPE_ADV_ONEBUF 0x02000000
|
||||
#define E1000_SRRCTL_DESCTYPE_HDR_SPLIT 0x04000000
|
||||
#define E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS 0x0A000000
|
||||
#define E1000_SRRCTL_DESCTYPE_HDR_REPLICATION 0x06000000
|
||||
#define E1000_SRRCTL_BSIZEPKT_SHIFT 10 /* Shift _right_ */
|
||||
#define E1000_SRRCTL_BSIZEHDRSIZE_MASK 0x00000F00
|
||||
#define E1000_SRRCTL_BSIZEHDRSIZE_SHIFT 2 /* Shift _left_ */
|
||||
#define E1000_SRRCTL_DESCTYPE_LEGACY 0x00000000
|
||||
#define E1000_SRRCTL_DESCTYPE_ADV_ONEBUF 0x02000000
|
||||
#define E1000_SRRCTL_DESCTYPE_HDR_SPLIT 0x04000000
|
||||
#define E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS 0x0A000000
|
||||
#define E1000_SRRCTL_DESCTYPE_HDR_REPLICATION 0x06000000
|
||||
#define E1000_SRRCTL_DESCTYPE_HDR_REPLICATION_LARGE_PKT 0x08000000
|
||||
#define E1000_SRRCTL_DESCTYPE_MASK 0x0E000000
|
||||
#define E1000_SRRCTL_TIMESTAMP 0x40000000
|
||||
#define E1000_SRRCTL_DROP_EN 0x80000000
|
||||
#define E1000_SRRCTL_DESCTYPE_MASK 0x0E000000
|
||||
#define E1000_SRRCTL_TIMESTAMP 0x40000000
|
||||
#define E1000_SRRCTL_DROP_EN 0x80000000
|
||||
|
||||
#define E1000_SRRCTL_BSIZEPKT_MASK 0x0000007F
|
||||
#define E1000_SRRCTL_BSIZEHDR_MASK 0x00003F00
|
||||
#define E1000_SRRCTL_BSIZEPKT_MASK 0x0000007F
|
||||
#define E1000_SRRCTL_BSIZEHDR_MASK 0x00003F00
|
||||
|
||||
#define E1000_TX_HEAD_WB_ENABLE 0x1
|
||||
#define E1000_TX_SEQNUM_WB_ENABLE 0x2
|
||||
#define E1000_TX_HEAD_WB_ENABLE 0x1
|
||||
#define E1000_TX_SEQNUM_WB_ENABLE 0x2
|
||||
|
||||
#define E1000_MRQC_ENABLE_RSS_4Q 0x00000002
|
||||
#define E1000_MRQC_ENABLE_VMDQ 0x00000003
|
||||
#define E1000_MRQC_ENABLE_VMDQ_RSS_2Q 0x00000005
|
||||
#define E1000_MRQC_RSS_FIELD_IPV4_UDP 0x00400000
|
||||
#define E1000_MRQC_RSS_FIELD_IPV6_UDP 0x00800000
|
||||
#define E1000_MRQC_RSS_FIELD_IPV6_UDP_EX 0x01000000
|
||||
#define E1000_MRQC_ENABLE_RSS_8Q 0x00000002
|
||||
#define E1000_MRQC_ENABLE_RSS_4Q 0x00000002
|
||||
#define E1000_MRQC_ENABLE_VMDQ 0x00000003
|
||||
#define E1000_MRQC_ENABLE_VMDQ_RSS_2Q 0x00000005
|
||||
#define E1000_MRQC_RSS_FIELD_IPV4_UDP 0x00400000
|
||||
#define E1000_MRQC_RSS_FIELD_IPV6_UDP 0x00800000
|
||||
#define E1000_MRQC_RSS_FIELD_IPV6_UDP_EX 0x01000000
|
||||
#define E1000_MRQC_ENABLE_RSS_8Q 0x00000002
|
||||
|
||||
#define E1000_VMRCTL_MIRROR_PORT_SHIFT 8
|
||||
#define E1000_VMRCTL_MIRROR_DSTPORT_MASK (7 << E1000_VMRCTL_MIRROR_PORT_SHIFT)
|
||||
#define E1000_VMRCTL_POOL_MIRROR_ENABLE (1 << 0)
|
||||
#define E1000_VMRCTL_UPLINK_MIRROR_ENABLE (1 << 1)
|
||||
#define E1000_VMRCTL_DOWNLINK_MIRROR_ENABLE (1 << 2)
|
||||
#define E1000_VMRCTL_MIRROR_PORT_SHIFT 8
|
||||
#define E1000_VMRCTL_MIRROR_DSTPORT_MASK (7 << \
|
||||
E1000_VMRCTL_MIRROR_PORT_SHIFT)
|
||||
#define E1000_VMRCTL_POOL_MIRROR_ENABLE (1 << 0)
|
||||
#define E1000_VMRCTL_UPLINK_MIRROR_ENABLE (1 << 1)
|
||||
#define E1000_VMRCTL_DOWNLINK_MIRROR_ENABLE (1 << 2)
|
||||
|
||||
#define E1000_EICR_TX_QUEUE ( \
|
||||
E1000_EICR_TX_QUEUE0 | \
|
||||
E1000_EICR_TX_QUEUE1 | \
|
||||
E1000_EICR_TX_QUEUE2 | \
|
||||
E1000_EICR_TX_QUEUE3)
|
||||
E1000_EICR_TX_QUEUE0 | \
|
||||
E1000_EICR_TX_QUEUE1 | \
|
||||
E1000_EICR_TX_QUEUE2 | \
|
||||
E1000_EICR_TX_QUEUE3)
|
||||
|
||||
#define E1000_EICR_RX_QUEUE ( \
|
||||
E1000_EICR_RX_QUEUE0 | \
|
||||
E1000_EICR_RX_QUEUE1 | \
|
||||
E1000_EICR_RX_QUEUE2 | \
|
||||
E1000_EICR_RX_QUEUE3)
|
||||
E1000_EICR_RX_QUEUE0 | \
|
||||
E1000_EICR_RX_QUEUE1 | \
|
||||
E1000_EICR_RX_QUEUE2 | \
|
||||
E1000_EICR_RX_QUEUE3)
|
||||
|
||||
#define E1000_EIMS_RX_QUEUE E1000_EICR_RX_QUEUE
|
||||
#define E1000_EIMS_TX_QUEUE E1000_EICR_TX_QUEUE
|
||||
#define E1000_EIMS_RX_QUEUE E1000_EICR_RX_QUEUE
|
||||
#define E1000_EIMS_TX_QUEUE E1000_EICR_TX_QUEUE
|
||||
|
||||
#define EIMS_ENABLE_MASK ( \
|
||||
E1000_EIMS_RX_QUEUE | \
|
||||
E1000_EIMS_TX_QUEUE | \
|
||||
E1000_EIMS_TCP_TIMER | \
|
||||
E1000_EIMS_OTHER)
|
||||
E1000_EIMS_RX_QUEUE | \
|
||||
E1000_EIMS_TX_QUEUE | \
|
||||
E1000_EIMS_TCP_TIMER | \
|
||||
E1000_EIMS_OTHER)
|
||||
|
||||
/* Immediate Interrupt Rx (A.K.A. Low Latency Interrupt) */
|
||||
#define E1000_IMIR_PORT_IM_EN 0x00010000 /* TCP port enable */
|
||||
#define E1000_IMIR_PORT_BP 0x00020000 /* TCP port check bypass */
|
||||
#define E1000_IMIREXT_SIZE_BP 0x00001000 /* Packet size bypass */
|
||||
#define E1000_IMIREXT_CTRL_URG 0x00002000 /* Check URG bit in header */
|
||||
#define E1000_IMIREXT_CTRL_ACK 0x00004000 /* Check ACK bit in header */
|
||||
#define E1000_IMIREXT_CTRL_PSH 0x00008000 /* Check PSH bit in header */
|
||||
#define E1000_IMIREXT_CTRL_RST 0x00010000 /* Check RST bit in header */
|
||||
#define E1000_IMIREXT_CTRL_SYN 0x00020000 /* Check SYN bit in header */
|
||||
#define E1000_IMIREXT_CTRL_FIN 0x00040000 /* Check FIN bit in header */
|
||||
#define E1000_IMIREXT_CTRL_BP 0x00080000 /* Bypass check of ctrl bits */
|
||||
#define E1000_IMIR_PORT_IM_EN 0x00010000 /* TCP port enable */
|
||||
#define E1000_IMIR_PORT_BP 0x00020000 /* TCP port check bypass */
|
||||
#define E1000_IMIREXT_SIZE_BP 0x00001000 /* Packet size bypass */
|
||||
#define E1000_IMIREXT_CTRL_URG 0x00002000 /* Check URG bit in header */
|
||||
#define E1000_IMIREXT_CTRL_ACK 0x00004000 /* Check ACK bit in header */
|
||||
#define E1000_IMIREXT_CTRL_PSH 0x00008000 /* Check PSH bit in header */
|
||||
#define E1000_IMIREXT_CTRL_RST 0x00010000 /* Check RST bit in header */
|
||||
#define E1000_IMIREXT_CTRL_SYN 0x00020000 /* Check SYN bit in header */
|
||||
#define E1000_IMIREXT_CTRL_FIN 0x00040000 /* Check FIN bit in header */
|
||||
#define E1000_IMIREXT_CTRL_BP 0x00080000 /* Bypass check of ctrl bits */
|
||||
|
||||
/* Receive Descriptor - Advanced */
|
||||
union e1000_adv_rx_desc {
|
||||
struct {
|
||||
__le64 pkt_addr; /* Packet buffer address */
|
||||
__le64 hdr_addr; /* Header buffer address */
|
||||
__le64 pkt_addr; /* Packet buffer address */
|
||||
__le64 hdr_addr; /* Header buffer address */
|
||||
} read;
|
||||
struct {
|
||||
struct {
|
||||
@@ -206,74 +207,74 @@ union e1000_adv_rx_desc {
|
||||
} hs_rss;
|
||||
} lo_dword;
|
||||
union {
|
||||
__le32 rss; /* RSS Hash */
|
||||
__le32 rss; /* RSS Hash */
|
||||
struct {
|
||||
__le16 ip_id; /* IP id */
|
||||
__le16 csum; /* Packet Checksum */
|
||||
__le16 ip_id; /* IP id */
|
||||
__le16 csum; /* Packet Checksum */
|
||||
} csum_ip;
|
||||
} hi_dword;
|
||||
} lower;
|
||||
struct {
|
||||
__le32 status_error; /* ext status/error */
|
||||
__le16 length; /* Packet length */
|
||||
__le16 vlan; /* VLAN tag */
|
||||
__le32 status_error; /* ext status/error */
|
||||
__le16 length; /* Packet length */
|
||||
__le16 vlan; /* VLAN tag */
|
||||
} upper;
|
||||
} wb; /* writeback */
|
||||
};
|
||||
|
||||
#define E1000_RXDADV_RSSTYPE_MASK 0x0000000F
|
||||
#define E1000_RXDADV_RSSTYPE_SHIFT 12
|
||||
#define E1000_RXDADV_HDRBUFLEN_MASK 0x7FE0
|
||||
#define E1000_RXDADV_HDRBUFLEN_SHIFT 5
|
||||
#define E1000_RXDADV_SPLITHEADER_EN 0x00001000
|
||||
#define E1000_RXDADV_SPH 0x8000
|
||||
#define E1000_RXDADV_STAT_TS 0x10000 /* Pkt was time stamped */
|
||||
#define E1000_RXDADV_STAT_TSIP 0x08000 /* timestamp in packet */
|
||||
#define E1000_RXDADV_ERR_HBO 0x00800000
|
||||
#define E1000_RXDADV_RSSTYPE_MASK 0x0000000F
|
||||
#define E1000_RXDADV_RSSTYPE_SHIFT 12
|
||||
#define E1000_RXDADV_HDRBUFLEN_MASK 0x7FE0
|
||||
#define E1000_RXDADV_HDRBUFLEN_SHIFT 5
|
||||
#define E1000_RXDADV_SPLITHEADER_EN 0x00001000
|
||||
#define E1000_RXDADV_SPH 0x8000
|
||||
#define E1000_RXDADV_STAT_TS 0x10000 /* Pkt was time stamped */
|
||||
#define E1000_RXDADV_STAT_TSIP 0x08000 /* timestamp in packet */
|
||||
#define E1000_RXDADV_ERR_HBO 0x00800000
|
||||
|
||||
/* RSS Hash results */
|
||||
#define E1000_RXDADV_RSSTYPE_NONE 0x00000000
|
||||
#define E1000_RXDADV_RSSTYPE_IPV4_TCP 0x00000001
|
||||
#define E1000_RXDADV_RSSTYPE_IPV4 0x00000002
|
||||
#define E1000_RXDADV_RSSTYPE_IPV6_TCP 0x00000003
|
||||
#define E1000_RXDADV_RSSTYPE_IPV6_EX 0x00000004
|
||||
#define E1000_RXDADV_RSSTYPE_IPV6 0x00000005
|
||||
#define E1000_RXDADV_RSSTYPE_NONE 0x00000000
|
||||
#define E1000_RXDADV_RSSTYPE_IPV4_TCP 0x00000001
|
||||
#define E1000_RXDADV_RSSTYPE_IPV4 0x00000002
|
||||
#define E1000_RXDADV_RSSTYPE_IPV6_TCP 0x00000003
|
||||
#define E1000_RXDADV_RSSTYPE_IPV6_EX 0x00000004
|
||||
#define E1000_RXDADV_RSSTYPE_IPV6 0x00000005
|
||||
#define E1000_RXDADV_RSSTYPE_IPV6_TCP_EX 0x00000006
|
||||
#define E1000_RXDADV_RSSTYPE_IPV4_UDP 0x00000007
|
||||
#define E1000_RXDADV_RSSTYPE_IPV6_UDP 0x00000008
|
||||
#define E1000_RXDADV_RSSTYPE_IPV4_UDP 0x00000007
|
||||
#define E1000_RXDADV_RSSTYPE_IPV6_UDP 0x00000008
|
||||
#define E1000_RXDADV_RSSTYPE_IPV6_UDP_EX 0x00000009
|
||||
|
||||
/* RSS Packet Types as indicated in the receive descriptor */
|
||||
#define E1000_RXDADV_PKTTYPE_NONE 0x00000000
|
||||
#define E1000_RXDADV_PKTTYPE_IPV4 0x00000010 /* IPV4 hdr present */
|
||||
#define E1000_RXDADV_PKTTYPE_IPV4_EX 0x00000020 /* IPV4 hdr + extensions */
|
||||
#define E1000_RXDADV_PKTTYPE_IPV6 0x00000040 /* IPV6 hdr present */
|
||||
#define E1000_RXDADV_PKTTYPE_IPV6_EX 0x00000080 /* IPV6 hdr + extensions */
|
||||
#define E1000_RXDADV_PKTTYPE_TCP 0x00000100 /* TCP hdr present */
|
||||
#define E1000_RXDADV_PKTTYPE_UDP 0x00000200 /* UDP hdr present */
|
||||
#define E1000_RXDADV_PKTTYPE_SCTP 0x00000400 /* SCTP hdr present */
|
||||
#define E1000_RXDADV_PKTTYPE_NFS 0x00000800 /* NFS hdr present */
|
||||
#define E1000_RXDADV_PKTTYPE_NONE 0x00000000
|
||||
#define E1000_RXDADV_PKTTYPE_IPV4 0x00000010 /* IPV4 hdr present */
|
||||
#define E1000_RXDADV_PKTTYPE_IPV4_EX 0x00000020 /* IPV4 hdr + extensions */
|
||||
#define E1000_RXDADV_PKTTYPE_IPV6 0x00000040 /* IPV6 hdr present */
|
||||
#define E1000_RXDADV_PKTTYPE_IPV6_EX 0x00000080 /* IPV6 hdr + extensions */
|
||||
#define E1000_RXDADV_PKTTYPE_TCP 0x00000100 /* TCP hdr present */
|
||||
#define E1000_RXDADV_PKTTYPE_UDP 0x00000200 /* UDP hdr present */
|
||||
#define E1000_RXDADV_PKTTYPE_SCTP 0x00000400 /* SCTP hdr present */
|
||||
#define E1000_RXDADV_PKTTYPE_NFS 0x00000800 /* NFS hdr present */
|
||||
|
||||
#define E1000_RXDADV_PKTTYPE_IPSEC_ESP 0x00001000 /* IPSec ESP */
|
||||
#define E1000_RXDADV_PKTTYPE_IPSEC_AH 0x00002000 /* IPSec AH */
|
||||
#define E1000_RXDADV_PKTTYPE_LINKSEC 0x00004000 /* LinkSec Encap */
|
||||
#define E1000_RXDADV_PKTTYPE_ETQF 0x00008000 /* PKTTYPE is ETQF index */
|
||||
#define E1000_RXDADV_PKTTYPE_ETQF_MASK 0x00000070 /* ETQF has 8 indices */
|
||||
#define E1000_RXDADV_PKTTYPE_ETQF_SHIFT 4 /* Right-shift 4 bits */
|
||||
#define E1000_RXDADV_PKTTYPE_IPSEC_ESP 0x00001000 /* IPSec ESP */
|
||||
#define E1000_RXDADV_PKTTYPE_IPSEC_AH 0x00002000 /* IPSec AH */
|
||||
#define E1000_RXDADV_PKTTYPE_LINKSEC 0x00004000 /* LinkSec Encap */
|
||||
#define E1000_RXDADV_PKTTYPE_ETQF 0x00008000 /* PKTTYPE is ETQF index */
|
||||
#define E1000_RXDADV_PKTTYPE_ETQF_MASK 0x00000070 /* ETQF has 8 indices */
|
||||
#define E1000_RXDADV_PKTTYPE_ETQF_SHIFT 4 /* Right-shift 4 bits */
|
||||
|
||||
/* LinkSec results */
|
||||
/* Security Processing bit Indication */
|
||||
#define E1000_RXDADV_LNKSEC_STATUS_SECP 0x00020000
|
||||
#define E1000_RXDADV_LNKSEC_ERROR_BIT_MASK 0x18000000
|
||||
#define E1000_RXDADV_LNKSEC_ERROR_NO_SA_MATCH 0x08000000
|
||||
#define E1000_RXDADV_LNKSEC_ERROR_REPLAY_ERROR 0x10000000
|
||||
#define E1000_RXDADV_LNKSEC_ERROR_BAD_SIG 0x18000000
|
||||
#define E1000_RXDADV_LNKSEC_STATUS_SECP 0x00020000
|
||||
#define E1000_RXDADV_LNKSEC_ERROR_BIT_MASK 0x18000000
|
||||
#define E1000_RXDADV_LNKSEC_ERROR_NO_SA_MATCH 0x08000000
|
||||
#define E1000_RXDADV_LNKSEC_ERROR_REPLAY_ERROR 0x10000000
|
||||
#define E1000_RXDADV_LNKSEC_ERROR_BAD_SIG 0x18000000
|
||||
|
||||
#define E1000_RXDADV_IPSEC_STATUS_SECP 0x00020000
|
||||
#define E1000_RXDADV_IPSEC_ERROR_BIT_MASK 0x18000000
|
||||
#define E1000_RXDADV_IPSEC_ERROR_INVALID_PROTOCOL 0x08000000
|
||||
#define E1000_RXDADV_IPSEC_ERROR_INVALID_LENGTH 0x10000000
|
||||
#define E1000_RXDADV_IPSEC_ERROR_AUTHENTICATION_FAILED 0x18000000
|
||||
#define E1000_RXDADV_IPSEC_STATUS_SECP 0x00020000
|
||||
#define E1000_RXDADV_IPSEC_ERROR_BIT_MASK 0x18000000
|
||||
#define E1000_RXDADV_IPSEC_ERROR_INVALID_PROTOCOL 0x08000000
|
||||
#define E1000_RXDADV_IPSEC_ERROR_INVALID_LENGTH 0x10000000
|
||||
#define E1000_RXDADV_IPSEC_ERROR_AUTHENTICATION_FAILED 0x18000000
|
||||
|
||||
/* Transmit Descriptor - Advanced */
|
||||
union e1000_adv_tx_desc {
|
||||
@@ -290,25 +291,26 @@ union e1000_adv_tx_desc {
|
||||
};
|
||||
|
||||
/* Adv Transmit Descriptor Config Masks */
|
||||
#define E1000_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Descriptor */
|
||||
#define E1000_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */
|
||||
#define E1000_ADVTXD_DCMD_EOP 0x01000000 /* End of Packet */
|
||||
#define E1000_ADVTXD_DCMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */
|
||||
#define E1000_ADVTXD_DCMD_RS 0x08000000 /* Report Status */
|
||||
#define E1000_ADVTXD_DCMD_DDTYP_ISCSI 0x10000000 /* DDP hdr type or iSCSI */
|
||||
#define E1000_ADVTXD_DCMD_DEXT 0x20000000 /* Descriptor extension (1=Adv) */
|
||||
#define E1000_ADVTXD_DCMD_VLE 0x40000000 /* VLAN pkt enable */
|
||||
#define E1000_ADVTXD_DCMD_TSE 0x80000000 /* TCP Seg enable */
|
||||
#define E1000_ADVTXD_MAC_LINKSEC 0x00040000 /* Apply LinkSec on packet */
|
||||
#define E1000_ADVTXD_MAC_TSTAMP 0x00080000 /* IEEE1588 Timestamp packet */
|
||||
#define E1000_ADVTXD_STAT_SN_CRC 0x00000002 /* NXTSEQ/SEED present in WB */
|
||||
#define E1000_ADVTXD_IDX_SHIFT 4 /* Adv desc Index shift */
|
||||
#define E1000_ADVTXD_POPTS_ISCO_1ST 0x00000000 /* 1st TSO of iSCSI PDU */
|
||||
#define E1000_ADVTXD_POPTS_ISCO_MDL 0x00000800 /* Middle TSO of iSCSI PDU */
|
||||
#define E1000_ADVTXD_POPTS_ISCO_LAST 0x00001000 /* Last TSO of iSCSI PDU */
|
||||
#define E1000_ADVTXD_POPTS_ISCO_FULL 0x00001800 /* 1st&Last TSO-full iSCSI PDU*/
|
||||
#define E1000_ADVTXD_POPTS_IPSEC 0x00000400 /* IPSec offload request */
|
||||
#define E1000_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */
|
||||
#define E1000_ADVTXD_DTYP_CTXT 0x00200000 /* Advanced Context Descriptor */
|
||||
#define E1000_ADVTXD_DTYP_DATA 0x00300000 /* Advanced Data Descriptor */
|
||||
#define E1000_ADVTXD_DCMD_EOP 0x01000000 /* End of Packet */
|
||||
#define E1000_ADVTXD_DCMD_IFCS 0x02000000 /* Insert FCS (Ethernet CRC) */
|
||||
#define E1000_ADVTXD_DCMD_RS 0x08000000 /* Report Status */
|
||||
#define E1000_ADVTXD_DCMD_DDTYP_ISCSI 0x10000000 /* DDP hdr type or iSCSI */
|
||||
#define E1000_ADVTXD_DCMD_DEXT 0x20000000 /* Descriptor extension (1=Adv) */
|
||||
#define E1000_ADVTXD_DCMD_VLE 0x40000000 /* VLAN pkt enable */
|
||||
#define E1000_ADVTXD_DCMD_TSE 0x80000000 /* TCP Seg enable */
|
||||
#define E1000_ADVTXD_MAC_LINKSEC 0x00040000 /* Apply LinkSec on pkt */
|
||||
#define E1000_ADVTXD_MAC_TSTAMP 0x00080000 /* IEEE1588 Timestamp pkt */
|
||||
#define E1000_ADVTXD_STAT_SN_CRC 0x00000002 /* NXTSEQ/SEED prsnt in WB */
|
||||
#define E1000_ADVTXD_IDX_SHIFT 4 /* Adv desc Index shift */
|
||||
#define E1000_ADVTXD_POPTS_ISCO_1ST 0x00000000 /* 1st TSO of iSCSI PDU */
|
||||
#define E1000_ADVTXD_POPTS_ISCO_MDL 0x00000800 /* Middle TSO of iSCSI PDU */
|
||||
#define E1000_ADVTXD_POPTS_ISCO_LAST 0x00001000 /* Last TSO of iSCSI PDU */
|
||||
/* 1st & Last TSO-full iSCSI PDU*/
|
||||
#define E1000_ADVTXD_POPTS_ISCO_FULL 0x00001800
|
||||
#define E1000_ADVTXD_POPTS_IPSEC 0x00000400 /* IPSec offload request */
|
||||
#define E1000_ADVTXD_PAYLEN_SHIFT 14 /* Adv desc PAYLEN shift */
|
||||
|
||||
/* Context descriptors */
|
||||
struct e1000_adv_tx_context_desc {
|
||||
@@ -318,65 +320,66 @@ struct e1000_adv_tx_context_desc {
|
||||
__le32 mss_l4len_idx;
|
||||
};
|
||||
|
||||
#define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */
|
||||
#define E1000_ADVTXD_VLAN_SHIFT 16 /* Adv ctxt vlan tag shift */
|
||||
#define E1000_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */
|
||||
#define E1000_ADVTXD_TUCMD_IPV6 0x00000000 /* IP Packet Type: 0=IPv6 */
|
||||
#define E1000_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */
|
||||
#define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */
|
||||
#define E1000_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 Packet TYPE of SCTP */
|
||||
#define E1000_ADVTXD_TUCMD_IPSEC_TYPE_ESP 0x00002000 /* IPSec Type ESP */
|
||||
#define E1000_ADVTXD_MACLEN_SHIFT 9 /* Adv ctxt desc mac len shift */
|
||||
#define E1000_ADVTXD_VLAN_SHIFT 16 /* Adv ctxt vlan tag shift */
|
||||
#define E1000_ADVTXD_TUCMD_IPV4 0x00000400 /* IP Packet Type: 1=IPv4 */
|
||||
#define E1000_ADVTXD_TUCMD_IPV6 0x00000000 /* IP Packet Type: 0=IPv6 */
|
||||
#define E1000_ADVTXD_TUCMD_L4T_UDP 0x00000000 /* L4 Packet TYPE of UDP */
|
||||
#define E1000_ADVTXD_TUCMD_L4T_TCP 0x00000800 /* L4 Packet TYPE of TCP */
|
||||
#define E1000_ADVTXD_TUCMD_L4T_SCTP 0x00001000 /* L4 Packet TYPE of SCTP */
|
||||
#define E1000_ADVTXD_TUCMD_IPSEC_TYPE_ESP 0x00002000 /* IPSec Type ESP */
|
||||
/* IPSec Encrypt Enable for ESP */
|
||||
#define E1000_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN 0x00004000
|
||||
#define E1000_ADVTXD_TUCMD_MKRREQ 0x00002000 /* Req requires Markers and CRC */
|
||||
#define E1000_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */
|
||||
#define E1000_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */
|
||||
#define E1000_ADVTXD_TUCMD_IPSEC_ENCRYPT_EN 0x00004000
|
||||
/* Req requires Markers and CRC */
|
||||
#define E1000_ADVTXD_TUCMD_MKRREQ 0x00002000
|
||||
#define E1000_ADVTXD_L4LEN_SHIFT 8 /* Adv ctxt L4LEN shift */
|
||||
#define E1000_ADVTXD_MSS_SHIFT 16 /* Adv ctxt MSS shift */
|
||||
/* Adv ctxt IPSec SA IDX mask */
|
||||
#define E1000_ADVTXD_IPSEC_SA_INDEX_MASK 0x000000FF
|
||||
#define E1000_ADVTXD_IPSEC_SA_INDEX_MASK 0x000000FF
|
||||
/* Adv ctxt IPSec ESP len mask */
|
||||
#define E1000_ADVTXD_IPSEC_ESP_LEN_MASK 0x000000FF
|
||||
#define E1000_ADVTXD_IPSEC_ESP_LEN_MASK 0x000000FF
|
||||
|
||||
/* Additional Transmit Descriptor Control definitions */
|
||||
#define E1000_TXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Tx Queue */
|
||||
#define E1000_TXDCTL_SWFLSH 0x04000000 /* Tx Desc. write-back flushing */
|
||||
#define E1000_TXDCTL_QUEUE_ENABLE 0x02000000 /* Ena specific Tx Queue */
|
||||
#define E1000_TXDCTL_SWFLSH 0x04000000 /* Tx Desc. wbk flushing */
|
||||
/* Tx Queue Arbitration Priority 0=low, 1=high */
|
||||
#define E1000_TXDCTL_PRIORITY 0x08000000
|
||||
#define E1000_TXDCTL_PRIORITY 0x08000000
|
||||
|
||||
/* Additional Receive Descriptor Control definitions */
|
||||
#define E1000_RXDCTL_QUEUE_ENABLE 0x02000000 /* Enable specific Rx Queue */
|
||||
#define E1000_RXDCTL_SWFLSH 0x04000000 /* Rx Desc. write-back flushing */
|
||||
#define E1000_RXDCTL_QUEUE_ENABLE 0x02000000 /* Ena specific Rx Queue */
|
||||
#define E1000_RXDCTL_SWFLSH 0x04000000 /* Rx Desc. wbk flushing */
|
||||
|
||||
/* Direct Cache Access (DCA) definitions */
|
||||
#define E1000_DCA_CTRL_DCA_ENABLE 0x00000000 /* DCA Enable */
|
||||
#define E1000_DCA_CTRL_DCA_DISABLE 0x00000001 /* DCA Disable */
|
||||
#define E1000_DCA_CTRL_DCA_ENABLE 0x00000000 /* DCA Enable */
|
||||
#define E1000_DCA_CTRL_DCA_DISABLE 0x00000001 /* DCA Disable */
|
||||
|
||||
#define E1000_DCA_CTRL_DCA_MODE_CB1 0x00 /* DCA Mode CB1 */
|
||||
#define E1000_DCA_CTRL_DCA_MODE_CB2 0x02 /* DCA Mode CB2 */
|
||||
#define E1000_DCA_CTRL_DCA_MODE_CB1 0x00 /* DCA Mode CB1 */
|
||||
#define E1000_DCA_CTRL_DCA_MODE_CB2 0x02 /* DCA Mode CB2 */
|
||||
|
||||
#define E1000_DCA_RXCTRL_CPUID_MASK 0x0000001F /* Rx CPUID Mask */
|
||||
#define E1000_DCA_RXCTRL_DESC_DCA_EN (1 << 5) /* DCA Rx Desc enable */
|
||||
#define E1000_DCA_RXCTRL_HEAD_DCA_EN (1 << 6) /* DCA Rx Desc header enable */
|
||||
#define E1000_DCA_RXCTRL_DATA_DCA_EN (1 << 7) /* DCA Rx Desc payload enable */
|
||||
#define E1000_DCA_RXCTRL_CPUID_MASK 0x0000001F /* Rx CPUID Mask */
|
||||
#define E1000_DCA_RXCTRL_DESC_DCA_EN (1 << 5) /* DCA Rx Desc enable */
|
||||
#define E1000_DCA_RXCTRL_HEAD_DCA_EN (1 << 6) /* DCA Rx Desc header ena */
|
||||
#define E1000_DCA_RXCTRL_DATA_DCA_EN (1 << 7) /* DCA Rx Desc payload ena */
|
||||
|
||||
#define E1000_DCA_TXCTRL_CPUID_MASK 0x0000001F /* Tx CPUID Mask */
|
||||
#define E1000_DCA_TXCTRL_DESC_DCA_EN (1 << 5) /* DCA Tx Desc enable */
|
||||
#define E1000_DCA_TXCTRL_TX_WB_RO_EN (1 << 11) /* Tx Desc writeback RO bit */
|
||||
#define E1000_DCA_TXCTRL_CPUID_MASK 0x0000001F /* Tx CPUID Mask */
|
||||
#define E1000_DCA_TXCTRL_DESC_DCA_EN (1 << 5) /* DCA Tx Desc enable */
|
||||
#define E1000_DCA_TXCTRL_TX_WB_RO_EN (1 << 11) /* Tx Desc writeback RO bit */
|
||||
|
||||
#define E1000_DCA_TXCTRL_CPUID_MASK_82576 0xFF000000 /* Tx CPUID Mask */
|
||||
#define E1000_DCA_RXCTRL_CPUID_MASK_82576 0xFF000000 /* Rx CPUID Mask */
|
||||
#define E1000_DCA_TXCTRL_CPUID_SHIFT_82576 24 /* Tx CPUID */
|
||||
#define E1000_DCA_RXCTRL_CPUID_SHIFT_82576 24 /* Rx CPUID */
|
||||
#define E1000_DCA_TXCTRL_CPUID_MASK_82576 0xFF000000 /* Tx CPUID Mask */
|
||||
#define E1000_DCA_RXCTRL_CPUID_MASK_82576 0xFF000000 /* Rx CPUID Mask */
|
||||
#define E1000_DCA_TXCTRL_CPUID_SHIFT_82576 24 /* Tx CPUID */
|
||||
#define E1000_DCA_RXCTRL_CPUID_SHIFT_82576 24 /* Rx CPUID */
|
||||
|
||||
/* Additional interrupt register bit definitions */
|
||||
#define E1000_ICR_LSECPNS 0x00000020 /* PN threshold - server */
|
||||
#define E1000_IMS_LSECPNS E1000_ICR_LSECPNS /* PN threshold - server */
|
||||
#define E1000_ICS_LSECPNS E1000_ICR_LSECPNS /* PN threshold - server */
|
||||
#define E1000_ICR_LSECPNS 0x00000020 /* PN threshold - server */
|
||||
#define E1000_IMS_LSECPNS E1000_ICR_LSECPNS /* PN threshold - server */
|
||||
#define E1000_ICS_LSECPNS E1000_ICR_LSECPNS /* PN threshold - server */
|
||||
|
||||
/* ETQF register bit definitions */
|
||||
#define E1000_ETQF_FILTER_ENABLE (1 << 26)
|
||||
#define E1000_ETQF_IMM_INT (1 << 29)
|
||||
#define E1000_ETQF_1588 (1 << 30)
|
||||
#define E1000_ETQF_QUEUE_ENABLE (1 << 31)
|
||||
#define E1000_ETQF_FILTER_ENABLE (1 << 26)
|
||||
#define E1000_ETQF_IMM_INT (1 << 29)
|
||||
#define E1000_ETQF_1588 (1 << 30)
|
||||
#define E1000_ETQF_QUEUE_ENABLE (1 << 31)
|
||||
/*
|
||||
* ETQF filter list: one static filter per filter consumer. This is
|
||||
* to avoid filter collisions later. Add new filters
|
||||
@@ -385,87 +388,89 @@ struct e1000_adv_tx_context_desc {
|
||||
* Current filters:
|
||||
* EAPOL 802.1x (0x888e): Filter 0
|
||||
*/
|
||||
#define E1000_ETQF_FILTER_EAPOL 0
|
||||
#define E1000_ETQF_FILTER_EAPOL 0
|
||||
|
||||
#define E1000_FTQF_VF_BP 0x00008000
|
||||
#define E1000_FTQF_1588_TIME_STAMP 0x08000000
|
||||
#define E1000_FTQF_MASK 0xF0000000
|
||||
#define E1000_FTQF_MASK_PROTO_BP 0x10000000
|
||||
#define E1000_FTQF_MASK_SOURCE_ADDR_BP 0x20000000
|
||||
#define E1000_FTQF_MASK_DEST_ADDR_BP 0x40000000
|
||||
#define E1000_FTQF_MASK_SOURCE_PORT_BP 0x80000000
|
||||
#define E1000_FTQF_VF_BP 0x00008000
|
||||
#define E1000_FTQF_1588_TIME_STAMP 0x08000000
|
||||
#define E1000_FTQF_MASK 0xF0000000
|
||||
#define E1000_FTQF_MASK_PROTO_BP 0x10000000
|
||||
#define E1000_FTQF_MASK_SOURCE_ADDR_BP 0x20000000
|
||||
#define E1000_FTQF_MASK_DEST_ADDR_BP 0x40000000
|
||||
#define E1000_FTQF_MASK_SOURCE_PORT_BP 0x80000000
|
||||
|
||||
#define E1000_NVM_APME_82575 0x0400
|
||||
#define MAX_NUM_VFS 8
|
||||
#define E1000_NVM_APME_82575 0x0400
|
||||
#define MAX_NUM_VFS 7
|
||||
|
||||
#define E1000_DTXSWC_MAC_SPOOF_MASK 0x000000FF /* Per VF MAC spoof control */
|
||||
#define E1000_DTXSWC_VLAN_SPOOF_MASK 0x0000FF00 /* Per VF VLAN spoof control */
|
||||
#define E1000_DTXSWC_LLE_MASK 0x00FF0000 /* Per VF Local LB enables */
|
||||
#define E1000_DTXSWC_VLAN_SPOOF_SHIFT 8
|
||||
#define E1000_DTXSWC_LLE_SHIFT 16
|
||||
#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1 << 31) /* global VF LB enable */
|
||||
#define E1000_DTXSWC_MAC_SPOOF_MASK 0x000000FF /* Per VF MAC spoof cntrl */
|
||||
#define E1000_DTXSWC_VLAN_SPOOF_MASK 0x0000FF00 /* Per VF VLAN spoof cntrl */
|
||||
#define E1000_DTXSWC_LLE_MASK 0x00FF0000 /* Per VF Local LB enables */
|
||||
#define E1000_DTXSWC_VLAN_SPOOF_SHIFT 8
|
||||
#define E1000_DTXSWC_LLE_SHIFT 16
|
||||
#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1 << 31) /* global VF LB enable */
|
||||
|
||||
/* Easy defines for setting default pool, would normally be left a zero */
|
||||
#define E1000_VT_CTL_DEFAULT_POOL_SHIFT 7
|
||||
#define E1000_VT_CTL_DEFAULT_POOL_MASK (0x7 << E1000_VT_CTL_DEFAULT_POOL_SHIFT)
|
||||
#define E1000_VT_CTL_DEFAULT_POOL_SHIFT 7
|
||||
#define E1000_VT_CTL_DEFAULT_POOL_MASK (0x7 << E1000_VT_CTL_DEFAULT_POOL_SHIFT)
|
||||
|
||||
/* Other useful VMD_CTL register defines */
|
||||
#define E1000_VT_CTL_IGNORE_MAC (1 << 28)
|
||||
#define E1000_VT_CTL_DISABLE_DEF_POOL (1 << 29)
|
||||
#define E1000_VT_CTL_VM_REPL_EN (1 << 30)
|
||||
#define E1000_VT_CTL_IGNORE_MAC (1 << 28)
|
||||
#define E1000_VT_CTL_DISABLE_DEF_POOL (1 << 29)
|
||||
#define E1000_VT_CTL_VM_REPL_EN (1 << 30)
|
||||
|
||||
/* Per VM Offload register setup */
|
||||
#define E1000_VMOLR_RLPML_MASK 0x00003FFF /* Long Packet Maximum Length mask */
|
||||
#define E1000_VMOLR_LPE 0x00010000 /* Accept Long packet */
|
||||
#define E1000_VMOLR_RSSE 0x00020000 /* Enable RSS */
|
||||
#define E1000_VMOLR_AUPE 0x01000000 /* Accept untagged packets */
|
||||
#define E1000_VMOLR_ROMPE 0x02000000 /* Accept overflow multicast */
|
||||
#define E1000_VMOLR_ROPE 0x04000000 /* Accept overflow unicast */
|
||||
#define E1000_VMOLR_BAM 0x08000000 /* Accept Broadcast packets */
|
||||
#define E1000_VMOLR_MPME 0x10000000 /* Multicast promiscuous mode */
|
||||
#define E1000_VMOLR_STRVLAN 0x40000000 /* Vlan stripping enable */
|
||||
#define E1000_VMOLR_STRCRC 0x80000000 /* CRC stripping enable */
|
||||
#define E1000_VMOLR_RLPML_MASK 0x00003FFF /* Long Packet Maximum Length mask */
|
||||
#define E1000_VMOLR_LPE 0x00010000 /* Accept Long packet */
|
||||
#define E1000_VMOLR_RSSE 0x00020000 /* Enable RSS */
|
||||
#define E1000_VMOLR_AUPE 0x01000000 /* Accept untagged packets */
|
||||
#define E1000_VMOLR_ROMPE 0x02000000 /* Accept overflow multicast */
|
||||
#define E1000_VMOLR_ROPE 0x04000000 /* Accept overflow unicast */
|
||||
#define E1000_VMOLR_BAM 0x08000000 /* Accept Broadcast packets */
|
||||
#define E1000_VMOLR_MPME 0x10000000 /* Multicast promiscuous mode */
|
||||
#define E1000_VMOLR_STRVLAN 0x40000000 /* Vlan stripping enable */
|
||||
#define E1000_VMOLR_STRCRC 0x80000000 /* CRC stripping enable */
|
||||
|
||||
#define E1000_VMOLR_VPE 0x00800000 /* VLAN promiscuous enable */
|
||||
#define E1000_VMOLR_UPE 0x20000000 /* Unicast promisuous enable */
|
||||
#define E1000_DVMOLR_HIDVLAN 0x20000000 /* Vlan hiding enable */
|
||||
#define E1000_DVMOLR_STRVLAN 0x40000000 /* Vlan stripping enable */
|
||||
#define E1000_DVMOLR_STRCRC 0x80000000 /* CRC stripping enable */
|
||||
#define E1000_VMOLR_VPE 0x00800000 /* VLAN promiscuous enable */
|
||||
#define E1000_VMOLR_UPE 0x20000000 /* Unicast promisuous enable */
|
||||
#define E1000_DVMOLR_HIDVLAN 0x20000000 /* Vlan hiding enable */
|
||||
#define E1000_DVMOLR_STRVLAN 0x40000000 /* Vlan stripping enable */
|
||||
#define E1000_DVMOLR_STRCRC 0x80000000 /* CRC stripping enable */
|
||||
|
||||
#define E1000_PBRWAC_WALPB 0x00000007 /* Wrap around event on LAN Rx PB */
|
||||
#define E1000_PBRWAC_PBE 0x00000008 /* Rx packet buffer empty */
|
||||
#define E1000_PBRWAC_WALPB 0x00000007 /* Wrap around event on LAN Rx PB */
|
||||
#define E1000_PBRWAC_PBE 0x00000008 /* Rx packet buffer empty */
|
||||
|
||||
#define E1000_VLVF_ARRAY_SIZE 32
|
||||
#define E1000_VLVF_VLANID_MASK 0x00000FFF
|
||||
#define E1000_VLVF_POOLSEL_SHIFT 12
|
||||
#define E1000_VLVF_POOLSEL_MASK (0xFF << E1000_VLVF_POOLSEL_SHIFT)
|
||||
#define E1000_VLVF_LVLAN 0x00100000
|
||||
#define E1000_VLVF_VLANID_ENABLE 0x80000000
|
||||
#define E1000_VLVF_ARRAY_SIZE 32
|
||||
#define E1000_VLVF_VLANID_MASK 0x00000FFF
|
||||
#define E1000_VLVF_POOLSEL_SHIFT 12
|
||||
#define E1000_VLVF_POOLSEL_MASK (0xFF << E1000_VLVF_POOLSEL_SHIFT)
|
||||
#define E1000_VLVF_LVLAN 0x00100000
|
||||
#define E1000_VLVF_VLANID_ENABLE 0x80000000
|
||||
|
||||
#define E1000_VMVIR_VLANA_DEFAULT 0x40000000 /* Always use default VLAN */
|
||||
#define E1000_VMVIR_VLANA_NEVER 0x80000000 /* Never insert VLAN tag */
|
||||
#define E1000_VMVIR_VLANA_DEFAULT 0x40000000 /* Always use default VLAN */
|
||||
#define E1000_VMVIR_VLANA_NEVER 0x80000000 /* Never insert VLAN tag */
|
||||
|
||||
#define E1000_VF_INIT_TIMEOUT 200 /* Number of retries to clear RSTI */
|
||||
#define E1000_VF_INIT_TIMEOUT 200 /* Number of retries to clear RSTI */
|
||||
|
||||
#define E1000_IOVCTL 0x05BBC
|
||||
#define E1000_IOVCTL_REUSE_VFQ 0x00000001
|
||||
#define E1000_IOVCTL 0x05BBC
|
||||
#define E1000_IOVCTL_REUSE_VFQ 0x00000001
|
||||
|
||||
#define E1000_RPLOLR_STRVLAN 0x40000000
|
||||
#define E1000_RPLOLR_STRCRC 0x80000000
|
||||
#define E1000_RPLOLR_STRVLAN 0x40000000
|
||||
#define E1000_RPLOLR_STRCRC 0x80000000
|
||||
|
||||
#define E1000_TCTL_EXT_COLD 0x000FFC00
|
||||
#define E1000_TCTL_EXT_COLD_SHIFT 10
|
||||
#define E1000_TCTL_EXT_COLD 0x000FFC00
|
||||
#define E1000_TCTL_EXT_COLD_SHIFT 10
|
||||
|
||||
#define E1000_DTXCTL_8023LL 0x0004
|
||||
#define E1000_DTXCTL_VLAN_ADDED 0x0008
|
||||
#define E1000_DTXCTL_OOS_ENABLE 0x0010
|
||||
#define E1000_DTXCTL_MDP_EN 0x0020
|
||||
#define E1000_DTXCTL_SPOOF_INT 0x0040
|
||||
#define E1000_DTXCTL_8023LL 0x0004
|
||||
#define E1000_DTXCTL_VLAN_ADDED 0x0008
|
||||
#define E1000_DTXCTL_OOS_ENABLE 0x0010
|
||||
#define E1000_DTXCTL_MDP_EN 0x0020
|
||||
#define E1000_DTXCTL_SPOOF_INT 0x0040
|
||||
|
||||
#define ALL_QUEUES 0xFFFF
|
||||
#define E1000_EEPROM_PCS_AUTONEG_DISABLE_BIT (1 << 14)
|
||||
|
||||
#define ALL_QUEUES 0xFFFF
|
||||
|
||||
/* Rx packet buffer size defines */
|
||||
#define E1000_RXPBS_SIZE_MASK_82576 0x0000007F
|
||||
#define E1000_RXPBS_SIZE_MASK_82576 0x0000007F
|
||||
void e1000_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable);
|
||||
void e1000_vmdq_set_anti_spoofing_pf(struct e1000_hw *hw, bool enable, int pf);
|
||||
void e1000_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable);
|
||||
@@ -484,4 +489,23 @@ void e1000_rlpml_set_vf(struct e1000_hw *, u16);
|
||||
s32 e1000_promisc_set_vf(struct e1000_hw *, enum e1000_promisc_type type);
|
||||
u16 e1000_rxpbs_adjust_82580(u32 data);
|
||||
s32 e1000_set_eee_i350(struct e1000_hw *);
|
||||
|
||||
/* I2C SDA and SCL timing parameters for standard mode */
|
||||
#define E1000_I2C_T_HD_STA 4
|
||||
#define E1000_I2C_T_LOW 5
|
||||
#define E1000_I2C_T_HIGH 4
|
||||
#define E1000_I2C_T_SU_STA 5
|
||||
#define E1000_I2C_T_HD_DATA 5
|
||||
#define E1000_I2C_T_SU_DATA 1
|
||||
#define E1000_I2C_T_RISE 1
|
||||
#define E1000_I2C_T_FALL 1
|
||||
#define E1000_I2C_T_SU_STO 4
|
||||
#define E1000_I2C_T_BUF 5
|
||||
|
||||
s32 e1000_set_i2c_bb(struct e1000_hw *hw);
|
||||
s32 e1000_read_i2c_byte_generic(struct e1000_hw *hw, u8 byte_offset,
|
||||
u8 dev_addr, u8 *data);
|
||||
s32 e1000_write_i2c_byte_generic(struct e1000_hw *hw, u8 byte_offset,
|
||||
u8 dev_addr, u8 data);
|
||||
void e1000_i2c_bus_clear(struct e1000_hw *hw);
|
||||
#endif /* _E1000_82575_H_ */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2012, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_api.c,v 1.4.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#include "e1000_api.h"
|
||||
|
||||
@@ -277,7 +277,6 @@ s32 e1000_set_mac_type(struct e1000_hw *hw)
|
||||
case E1000_DEV_ID_ICH10_D_BM_LM:
|
||||
case E1000_DEV_ID_ICH10_D_BM_LF:
|
||||
case E1000_DEV_ID_ICH10_D_BM_V:
|
||||
case E1000_DEV_ID_ICH10_HANKSVILLE:
|
||||
mac->type = e1000_ich10lan;
|
||||
break;
|
||||
case E1000_DEV_ID_PCH_D_HV_DM:
|
||||
@@ -293,7 +292,6 @@ s32 e1000_set_mac_type(struct e1000_hw *hw)
|
||||
case E1000_DEV_ID_82575EB_COPPER:
|
||||
case E1000_DEV_ID_82575EB_FIBER_SERDES:
|
||||
case E1000_DEV_ID_82575GB_QUAD_COPPER:
|
||||
case E1000_DEV_ID_82575GB_QUAD_COPPER_PM:
|
||||
mac->type = e1000_82575;
|
||||
break;
|
||||
case E1000_DEV_ID_82576:
|
||||
@@ -322,8 +320,20 @@ s32 e1000_set_mac_type(struct e1000_hw *hw)
|
||||
case E1000_DEV_ID_I350_FIBER:
|
||||
case E1000_DEV_ID_I350_SERDES:
|
||||
case E1000_DEV_ID_I350_SGMII:
|
||||
case E1000_DEV_ID_I350_DA4:
|
||||
mac->type = e1000_i350;
|
||||
break;
|
||||
case E1000_DEV_ID_I210_COPPER:
|
||||
case E1000_DEV_ID_I210_COPPER_OEM1:
|
||||
case E1000_DEV_ID_I210_COPPER_IT:
|
||||
case E1000_DEV_ID_I210_FIBER:
|
||||
case E1000_DEV_ID_I210_SERDES:
|
||||
case E1000_DEV_ID_I210_SGMII:
|
||||
mac->type = e1000_i210;
|
||||
break;
|
||||
case E1000_DEV_ID_I211_COPPER:
|
||||
mac->type = e1000_i211;
|
||||
break;
|
||||
case E1000_DEV_ID_82576_VF:
|
||||
mac->type = e1000_vfadapt;
|
||||
break;
|
||||
@@ -343,10 +353,10 @@ s32 e1000_set_mac_type(struct e1000_hw *hw)
|
||||
* e1000_setup_init_funcs - Initializes function pointers
|
||||
* @hw: pointer to the HW structure
|
||||
* @init_device: TRUE will initialize the rest of the function pointers
|
||||
* getting the device ready for use. FALSE will only set
|
||||
* MAC type and the function pointers for the other init
|
||||
* functions. Passing FALSE will not generate any hardware
|
||||
* reads or writes.
|
||||
* getting the device ready for use. FALSE will only set
|
||||
* MAC type and the function pointers for the other init
|
||||
* functions. Passing FALSE will not generate any hardware
|
||||
* reads or writes.
|
||||
*
|
||||
* This function must be called by a driver in order to use the rest
|
||||
* of the 'shared' code files. Called by drivers only.
|
||||
@@ -426,6 +436,10 @@ s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
|
||||
case e1000_i350:
|
||||
e1000_init_function_pointers_82575(hw);
|
||||
break;
|
||||
case e1000_i210:
|
||||
case e1000_i211:
|
||||
e1000_init_function_pointers_i210(hw);
|
||||
break;
|
||||
case e1000_vfadapt:
|
||||
e1000_init_function_pointers_vf(hw);
|
||||
break;
|
||||
@@ -518,11 +532,11 @@ void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
|
||||
* The caller must have a packed mc_addr_list of multicast addresses.
|
||||
**/
|
||||
void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
|
||||
u32 mc_addr_count)
|
||||
u32 mc_addr_count)
|
||||
{
|
||||
if (hw->mac.ops.update_mc_addr_list)
|
||||
hw->mac.ops.update_mc_addr_list(hw, mc_addr_list,
|
||||
mc_addr_count);
|
||||
mc_addr_count);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -856,12 +870,12 @@ bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
|
||||
* It also does alignment considerations to do the writes in most efficient
|
||||
* way. Also fills up the sum of the buffer in *buffer parameter.
|
||||
**/
|
||||
s32 e1000_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, u16 length,
|
||||
u16 offset, u8 *sum)
|
||||
s32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length,
|
||||
u16 offset, u8 *sum)
|
||||
{
|
||||
if (hw->mac.ops.mng_host_if_write)
|
||||
return hw->mac.ops.mng_host_if_write(hw, buffer, length,
|
||||
offset, sum);
|
||||
offset, sum);
|
||||
|
||||
return E1000_NOT_IMPLEMENTED;
|
||||
}
|
||||
@@ -874,7 +888,7 @@ s32 e1000_mng_host_if_write(struct e1000_hw * hw, u8 *buffer, u16 length,
|
||||
* Writes the command header after does the checksum calculation.
|
||||
**/
|
||||
s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
|
||||
struct e1000_host_mng_command_header *hdr)
|
||||
struct e1000_host_mng_command_header *hdr)
|
||||
{
|
||||
if (hw->mac.ops.mng_write_cmd_header)
|
||||
return hw->mac.ops.mng_write_cmd_header(hw, hdr);
|
||||
@@ -892,7 +906,7 @@ s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
|
||||
* and also checks whether the previous command is completed. It busy waits
|
||||
* in case of previous command is not completed.
|
||||
**/
|
||||
s32 e1000_mng_enable_host_if(struct e1000_hw * hw)
|
||||
s32 e1000_mng_enable_host_if(struct e1000_hw *hw)
|
||||
{
|
||||
if (hw->mac.ops.mng_enable_host_if)
|
||||
return hw->mac.ops.mng_enable_host_if(hw);
|
||||
@@ -1277,7 +1291,7 @@ s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
|
||||
* This is a function pointer entry point called by drivers.
|
||||
**/
|
||||
s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset,
|
||||
u8 data)
|
||||
u8 data)
|
||||
{
|
||||
return e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2012, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,97 +30,96 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_api.h,v 1.3.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_API_H_
|
||||
#define _E1000_API_H_
|
||||
|
||||
#include "e1000_hw.h"
|
||||
|
||||
extern void e1000_init_function_pointers_82542(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_82543(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_82540(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_82571(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_82541(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_82575(struct e1000_hw *hw);
|
||||
extern void e1000_rx_fifo_flush_82575(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_vf(struct e1000_hw *hw);
|
||||
extern void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw);
|
||||
extern void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_82542(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_82543(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_82540(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_82571(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_82541(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_ich8lan(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_82575(struct e1000_hw *hw);
|
||||
extern void e1000_rx_fifo_flush_82575(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_vf(struct e1000_hw *hw);
|
||||
extern void e1000_power_up_fiber_serdes_link(struct e1000_hw *hw);
|
||||
extern void e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw);
|
||||
extern void e1000_init_function_pointers_i210(struct e1000_hw *hw);
|
||||
|
||||
s32 e1000_set_mac_type(struct e1000_hw *hw);
|
||||
s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device);
|
||||
s32 e1000_init_mac_params(struct e1000_hw *hw);
|
||||
s32 e1000_init_nvm_params(struct e1000_hw *hw);
|
||||
s32 e1000_init_phy_params(struct e1000_hw *hw);
|
||||
s32 e1000_init_mbx_params(struct e1000_hw *hw);
|
||||
s32 e1000_get_bus_info(struct e1000_hw *hw);
|
||||
s32 e1000_set_mac_type(struct e1000_hw *hw);
|
||||
s32 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device);
|
||||
s32 e1000_init_mac_params(struct e1000_hw *hw);
|
||||
s32 e1000_init_nvm_params(struct e1000_hw *hw);
|
||||
s32 e1000_init_phy_params(struct e1000_hw *hw);
|
||||
s32 e1000_init_mbx_params(struct e1000_hw *hw);
|
||||
s32 e1000_get_bus_info(struct e1000_hw *hw);
|
||||
void e1000_clear_vfta(struct e1000_hw *hw);
|
||||
void e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value);
|
||||
s32 e1000_force_mac_fc(struct e1000_hw *hw);
|
||||
s32 e1000_check_for_link(struct e1000_hw *hw);
|
||||
s32 e1000_reset_hw(struct e1000_hw *hw);
|
||||
s32 e1000_init_hw(struct e1000_hw *hw);
|
||||
s32 e1000_setup_link(struct e1000_hw *hw);
|
||||
s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed,
|
||||
u16 *duplex);
|
||||
s32 e1000_disable_pcie_master(struct e1000_hw *hw);
|
||||
s32 e1000_force_mac_fc(struct e1000_hw *hw);
|
||||
s32 e1000_check_for_link(struct e1000_hw *hw);
|
||||
s32 e1000_reset_hw(struct e1000_hw *hw);
|
||||
s32 e1000_init_hw(struct e1000_hw *hw);
|
||||
s32 e1000_setup_link(struct e1000_hw *hw);
|
||||
s32 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex);
|
||||
s32 e1000_disable_pcie_master(struct e1000_hw *hw);
|
||||
void e1000_config_collision_dist(struct e1000_hw *hw);
|
||||
void e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);
|
||||
u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr);
|
||||
void e1000_update_mc_addr_list(struct e1000_hw *hw,
|
||||
u8 *mc_addr_list, u32 mc_addr_count);
|
||||
s32 e1000_setup_led(struct e1000_hw *hw);
|
||||
s32 e1000_cleanup_led(struct e1000_hw *hw);
|
||||
s32 e1000_check_reset_block(struct e1000_hw *hw);
|
||||
s32 e1000_blink_led(struct e1000_hw *hw);
|
||||
s32 e1000_led_on(struct e1000_hw *hw);
|
||||
s32 e1000_led_off(struct e1000_hw *hw);
|
||||
u32 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr);
|
||||
void e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
|
||||
u32 mc_addr_count);
|
||||
s32 e1000_setup_led(struct e1000_hw *hw);
|
||||
s32 e1000_cleanup_led(struct e1000_hw *hw);
|
||||
s32 e1000_check_reset_block(struct e1000_hw *hw);
|
||||
s32 e1000_blink_led(struct e1000_hw *hw);
|
||||
s32 e1000_led_on(struct e1000_hw *hw);
|
||||
s32 e1000_led_off(struct e1000_hw *hw);
|
||||
s32 e1000_id_led_init(struct e1000_hw *hw);
|
||||
void e1000_reset_adaptive(struct e1000_hw *hw);
|
||||
void e1000_update_adaptive(struct e1000_hw *hw);
|
||||
s32 e1000_get_cable_length(struct e1000_hw *hw);
|
||||
s32 e1000_validate_mdi_setting(struct e1000_hw *hw);
|
||||
s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg,
|
||||
u32 offset, u8 data);
|
||||
s32 e1000_get_phy_info(struct e1000_hw *hw);
|
||||
s32 e1000_get_cable_length(struct e1000_hw *hw);
|
||||
s32 e1000_validate_mdi_setting(struct e1000_hw *hw);
|
||||
s32 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset,
|
||||
u8 data);
|
||||
s32 e1000_get_phy_info(struct e1000_hw *hw);
|
||||
void e1000_release_phy(struct e1000_hw *hw);
|
||||
s32 e1000_acquire_phy(struct e1000_hw *hw);
|
||||
s32 e1000_cfg_on_link_up(struct e1000_hw *hw);
|
||||
s32 e1000_phy_hw_reset(struct e1000_hw *hw);
|
||||
s32 e1000_phy_commit(struct e1000_hw *hw);
|
||||
s32 e1000_acquire_phy(struct e1000_hw *hw);
|
||||
s32 e1000_cfg_on_link_up(struct e1000_hw *hw);
|
||||
s32 e1000_phy_hw_reset(struct e1000_hw *hw);
|
||||
s32 e1000_phy_commit(struct e1000_hw *hw);
|
||||
void e1000_power_up_phy(struct e1000_hw *hw);
|
||||
void e1000_power_down_phy(struct e1000_hw *hw);
|
||||
s32 e1000_read_mac_addr(struct e1000_hw *hw);
|
||||
s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num,
|
||||
u32 pba_num_size);
|
||||
s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size);
|
||||
s32 e1000_read_mac_addr(struct e1000_hw *hw);
|
||||
s32 e1000_read_pba_string(struct e1000_hw *hw, u8 *pba_num, u32 pba_num_size);
|
||||
s32 e1000_read_pba_length(struct e1000_hw *hw, u32 *pba_num_size);
|
||||
void e1000_reload_nvm(struct e1000_hw *hw);
|
||||
s32 e1000_update_nvm_checksum(struct e1000_hw *hw);
|
||||
s32 e1000_validate_nvm_checksum(struct e1000_hw *hw);
|
||||
s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
|
||||
s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
u16 *data);
|
||||
s32 e1000_wait_autoneg(struct e1000_hw *hw);
|
||||
s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active);
|
||||
s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active);
|
||||
s32 e1000_update_nvm_checksum(struct e1000_hw *hw);
|
||||
s32 e1000_validate_nvm_checksum(struct e1000_hw *hw);
|
||||
s32 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
|
||||
s32 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
|
||||
s32 e1000_wait_autoneg(struct e1000_hw *hw);
|
||||
s32 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active);
|
||||
s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active);
|
||||
bool e1000_check_mng_mode(struct e1000_hw *hw);
|
||||
bool e1000_enable_tx_pkt_filtering(struct e1000_hw *hw);
|
||||
s32 e1000_mng_enable_host_if(struct e1000_hw *hw);
|
||||
s32 e1000_mng_host_if_write(struct e1000_hw *hw,
|
||||
u8 *buffer, u16 length, u16 offset, u8 *sum);
|
||||
s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
|
||||
struct e1000_host_mng_command_header *hdr);
|
||||
s32 e1000_mng_write_dhcp_info(struct e1000_hw * hw,
|
||||
u8 *buffer, u16 length);
|
||||
s32 e1000_mng_enable_host_if(struct e1000_hw *hw);
|
||||
s32 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length,
|
||||
u16 offset, u8 *sum);
|
||||
s32 e1000_mng_write_cmd_header(struct e1000_hw *hw,
|
||||
struct e1000_host_mng_command_header *hdr);
|
||||
s32 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length);
|
||||
u32 e1000_translate_register_82542(u32 reg);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* TBI_ACCEPT macro definition:
|
||||
*
|
||||
@@ -152,14 +151,15 @@ u32 e1000_translate_register_82542(u32 reg);
|
||||
/* The carrier extension symbol, as received by the NIC. */
|
||||
#define CARRIER_EXTENSION 0x0F
|
||||
|
||||
#define TBI_ACCEPT(a, status, errors, length, last_byte, min_frame_size, max_frame_size) \
|
||||
(e1000_tbi_sbp_enabled_82543(a) && \
|
||||
(((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \
|
||||
((last_byte) == CARRIER_EXTENSION) && \
|
||||
(((status) & E1000_RXD_STAT_VP) ? \
|
||||
(((length) > (min_frame_size - VLAN_TAG_SIZE)) && \
|
||||
((length) <= (max_frame_size + 1))) : \
|
||||
(((length) > min_frame_size) && \
|
||||
((length) <= (max_frame_size + VLAN_TAG_SIZE + 1)))))
|
||||
#define TBI_ACCEPT(a, status, errors, length, last_byte, \
|
||||
min_frame_size, max_frame_size) \
|
||||
(e1000_tbi_sbp_enabled_82543(a) && \
|
||||
(((errors) & E1000_RXD_ERR_FRAME_ERR_MASK) == E1000_RXD_ERR_CE) && \
|
||||
((last_byte) == CARRIER_EXTENSION) && \
|
||||
(((status) & E1000_RXD_STAT_VP) ? \
|
||||
(((length) > (min_frame_size - VLAN_TAG_SIZE)) && \
|
||||
((length) <= (max_frame_size + 1))) : \
|
||||
(((length) > min_frame_size) && \
|
||||
((length) <= (max_frame_size + VLAN_TAG_SIZE + 1)))))
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2012, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_hw.h,v 1.4.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_HW_H_
|
||||
#define _E1000_HW_H_
|
||||
@@ -41,139 +41,145 @@
|
||||
|
||||
struct e1000_hw;
|
||||
|
||||
#define E1000_DEV_ID_82542 0x1000
|
||||
#define E1000_DEV_ID_82543GC_FIBER 0x1001
|
||||
#define E1000_DEV_ID_82543GC_COPPER 0x1004
|
||||
#define E1000_DEV_ID_82544EI_COPPER 0x1008
|
||||
#define E1000_DEV_ID_82544EI_FIBER 0x1009
|
||||
#define E1000_DEV_ID_82544GC_COPPER 0x100C
|
||||
#define E1000_DEV_ID_82544GC_LOM 0x100D
|
||||
#define E1000_DEV_ID_82540EM 0x100E
|
||||
#define E1000_DEV_ID_82540EM_LOM 0x1015
|
||||
#define E1000_DEV_ID_82540EP_LOM 0x1016
|
||||
#define E1000_DEV_ID_82540EP 0x1017
|
||||
#define E1000_DEV_ID_82540EP_LP 0x101E
|
||||
#define E1000_DEV_ID_82545EM_COPPER 0x100F
|
||||
#define E1000_DEV_ID_82545EM_FIBER 0x1011
|
||||
#define E1000_DEV_ID_82545GM_COPPER 0x1026
|
||||
#define E1000_DEV_ID_82545GM_FIBER 0x1027
|
||||
#define E1000_DEV_ID_82545GM_SERDES 0x1028
|
||||
#define E1000_DEV_ID_82546EB_COPPER 0x1010
|
||||
#define E1000_DEV_ID_82546EB_FIBER 0x1012
|
||||
#define E1000_DEV_ID_82546EB_QUAD_COPPER 0x101D
|
||||
#define E1000_DEV_ID_82546GB_COPPER 0x1079
|
||||
#define E1000_DEV_ID_82546GB_FIBER 0x107A
|
||||
#define E1000_DEV_ID_82546GB_SERDES 0x107B
|
||||
#define E1000_DEV_ID_82546GB_PCIE 0x108A
|
||||
#define E1000_DEV_ID_82546GB_QUAD_COPPER 0x1099
|
||||
#define E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 0x10B5
|
||||
#define E1000_DEV_ID_82541EI 0x1013
|
||||
#define E1000_DEV_ID_82541EI_MOBILE 0x1018
|
||||
#define E1000_DEV_ID_82541ER_LOM 0x1014
|
||||
#define E1000_DEV_ID_82541ER 0x1078
|
||||
#define E1000_DEV_ID_82541GI 0x1076
|
||||
#define E1000_DEV_ID_82541GI_LF 0x107C
|
||||
#define E1000_DEV_ID_82541GI_MOBILE 0x1077
|
||||
#define E1000_DEV_ID_82547EI 0x1019
|
||||
#define E1000_DEV_ID_82547EI_MOBILE 0x101A
|
||||
#define E1000_DEV_ID_82547GI 0x1075
|
||||
#define E1000_DEV_ID_82571EB_COPPER 0x105E
|
||||
#define E1000_DEV_ID_82571EB_FIBER 0x105F
|
||||
#define E1000_DEV_ID_82571EB_SERDES 0x1060
|
||||
#define E1000_DEV_ID_82571EB_SERDES_DUAL 0x10D9
|
||||
#define E1000_DEV_ID_82571EB_SERDES_QUAD 0x10DA
|
||||
#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4
|
||||
#define E1000_DEV_ID_82571PT_QUAD_COPPER 0x10D5
|
||||
#define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5
|
||||
#define E1000_DEV_ID_82571EB_QUAD_COPPER_LP 0x10BC
|
||||
#define E1000_DEV_ID_82572EI_COPPER 0x107D
|
||||
#define E1000_DEV_ID_82572EI_FIBER 0x107E
|
||||
#define E1000_DEV_ID_82572EI_SERDES 0x107F
|
||||
#define E1000_DEV_ID_82572EI 0x10B9
|
||||
#define E1000_DEV_ID_82573E 0x108B
|
||||
#define E1000_DEV_ID_82573E_IAMT 0x108C
|
||||
#define E1000_DEV_ID_82573L 0x109A
|
||||
#define E1000_DEV_ID_82574L 0x10D3
|
||||
#define E1000_DEV_ID_82574LA 0x10F6
|
||||
#define E1000_DEV_ID_82583V 0x150C
|
||||
#define E1000_DEV_ID_80003ES2LAN_COPPER_DPT 0x1096
|
||||
#define E1000_DEV_ID_80003ES2LAN_SERDES_DPT 0x1098
|
||||
#define E1000_DEV_ID_80003ES2LAN_COPPER_SPT 0x10BA
|
||||
#define E1000_DEV_ID_80003ES2LAN_SERDES_SPT 0x10BB
|
||||
#define E1000_DEV_ID_ICH8_82567V_3 0x1501
|
||||
#define E1000_DEV_ID_ICH8_IGP_M_AMT 0x1049
|
||||
#define E1000_DEV_ID_ICH8_IGP_AMT 0x104A
|
||||
#define E1000_DEV_ID_ICH8_IGP_C 0x104B
|
||||
#define E1000_DEV_ID_ICH8_IFE 0x104C
|
||||
#define E1000_DEV_ID_ICH8_IFE_GT 0x10C4
|
||||
#define E1000_DEV_ID_ICH8_IFE_G 0x10C5
|
||||
#define E1000_DEV_ID_ICH8_IGP_M 0x104D
|
||||
#define E1000_DEV_ID_ICH9_IGP_M 0x10BF
|
||||
#define E1000_DEV_ID_ICH9_IGP_M_AMT 0x10F5
|
||||
#define E1000_DEV_ID_ICH9_IGP_M_V 0x10CB
|
||||
#define E1000_DEV_ID_ICH9_IGP_AMT 0x10BD
|
||||
#define E1000_DEV_ID_ICH9_BM 0x10E5
|
||||
#define E1000_DEV_ID_ICH9_IGP_C 0x294C
|
||||
#define E1000_DEV_ID_ICH9_IFE 0x10C0
|
||||
#define E1000_DEV_ID_ICH9_IFE_GT 0x10C3
|
||||
#define E1000_DEV_ID_ICH9_IFE_G 0x10C2
|
||||
#define E1000_DEV_ID_ICH10_R_BM_LM 0x10CC
|
||||
#define E1000_DEV_ID_ICH10_R_BM_LF 0x10CD
|
||||
#define E1000_DEV_ID_ICH10_R_BM_V 0x10CE
|
||||
#define E1000_DEV_ID_ICH10_HANKSVILLE 0xF0FE
|
||||
#define E1000_DEV_ID_ICH10_D_BM_LM 0x10DE
|
||||
#define E1000_DEV_ID_ICH10_D_BM_LF 0x10DF
|
||||
#define E1000_DEV_ID_ICH10_D_BM_V 0x1525
|
||||
#define E1000_DEV_ID_82542 0x1000
|
||||
#define E1000_DEV_ID_82543GC_FIBER 0x1001
|
||||
#define E1000_DEV_ID_82543GC_COPPER 0x1004
|
||||
#define E1000_DEV_ID_82544EI_COPPER 0x1008
|
||||
#define E1000_DEV_ID_82544EI_FIBER 0x1009
|
||||
#define E1000_DEV_ID_82544GC_COPPER 0x100C
|
||||
#define E1000_DEV_ID_82544GC_LOM 0x100D
|
||||
#define E1000_DEV_ID_82540EM 0x100E
|
||||
#define E1000_DEV_ID_82540EM_LOM 0x1015
|
||||
#define E1000_DEV_ID_82540EP_LOM 0x1016
|
||||
#define E1000_DEV_ID_82540EP 0x1017
|
||||
#define E1000_DEV_ID_82540EP_LP 0x101E
|
||||
#define E1000_DEV_ID_82545EM_COPPER 0x100F
|
||||
#define E1000_DEV_ID_82545EM_FIBER 0x1011
|
||||
#define E1000_DEV_ID_82545GM_COPPER 0x1026
|
||||
#define E1000_DEV_ID_82545GM_FIBER 0x1027
|
||||
#define E1000_DEV_ID_82545GM_SERDES 0x1028
|
||||
#define E1000_DEV_ID_82546EB_COPPER 0x1010
|
||||
#define E1000_DEV_ID_82546EB_FIBER 0x1012
|
||||
#define E1000_DEV_ID_82546EB_QUAD_COPPER 0x101D
|
||||
#define E1000_DEV_ID_82546GB_COPPER 0x1079
|
||||
#define E1000_DEV_ID_82546GB_FIBER 0x107A
|
||||
#define E1000_DEV_ID_82546GB_SERDES 0x107B
|
||||
#define E1000_DEV_ID_82546GB_PCIE 0x108A
|
||||
#define E1000_DEV_ID_82546GB_QUAD_COPPER 0x1099
|
||||
#define E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 0x10B5
|
||||
#define E1000_DEV_ID_82541EI 0x1013
|
||||
#define E1000_DEV_ID_82541EI_MOBILE 0x1018
|
||||
#define E1000_DEV_ID_82541ER_LOM 0x1014
|
||||
#define E1000_DEV_ID_82541ER 0x1078
|
||||
#define E1000_DEV_ID_82541GI 0x1076
|
||||
#define E1000_DEV_ID_82541GI_LF 0x107C
|
||||
#define E1000_DEV_ID_82541GI_MOBILE 0x1077
|
||||
#define E1000_DEV_ID_82547EI 0x1019
|
||||
#define E1000_DEV_ID_82547EI_MOBILE 0x101A
|
||||
#define E1000_DEV_ID_82547GI 0x1075
|
||||
#define E1000_DEV_ID_82571EB_COPPER 0x105E
|
||||
#define E1000_DEV_ID_82571EB_FIBER 0x105F
|
||||
#define E1000_DEV_ID_82571EB_SERDES 0x1060
|
||||
#define E1000_DEV_ID_82571EB_SERDES_DUAL 0x10D9
|
||||
#define E1000_DEV_ID_82571EB_SERDES_QUAD 0x10DA
|
||||
#define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4
|
||||
#define E1000_DEV_ID_82571PT_QUAD_COPPER 0x10D5
|
||||
#define E1000_DEV_ID_82571EB_QUAD_FIBER 0x10A5
|
||||
#define E1000_DEV_ID_82571EB_QUAD_COPPER_LP 0x10BC
|
||||
#define E1000_DEV_ID_82572EI_COPPER 0x107D
|
||||
#define E1000_DEV_ID_82572EI_FIBER 0x107E
|
||||
#define E1000_DEV_ID_82572EI_SERDES 0x107F
|
||||
#define E1000_DEV_ID_82572EI 0x10B9
|
||||
#define E1000_DEV_ID_82573E 0x108B
|
||||
#define E1000_DEV_ID_82573E_IAMT 0x108C
|
||||
#define E1000_DEV_ID_82573L 0x109A
|
||||
#define E1000_DEV_ID_82574L 0x10D3
|
||||
#define E1000_DEV_ID_82574LA 0x10F6
|
||||
#define E1000_DEV_ID_82583V 0x150C
|
||||
#define E1000_DEV_ID_80003ES2LAN_COPPER_DPT 0x1096
|
||||
#define E1000_DEV_ID_80003ES2LAN_SERDES_DPT 0x1098
|
||||
#define E1000_DEV_ID_80003ES2LAN_COPPER_SPT 0x10BA
|
||||
#define E1000_DEV_ID_80003ES2LAN_SERDES_SPT 0x10BB
|
||||
#define E1000_DEV_ID_ICH8_82567V_3 0x1501
|
||||
#define E1000_DEV_ID_ICH8_IGP_M_AMT 0x1049
|
||||
#define E1000_DEV_ID_ICH8_IGP_AMT 0x104A
|
||||
#define E1000_DEV_ID_ICH8_IGP_C 0x104B
|
||||
#define E1000_DEV_ID_ICH8_IFE 0x104C
|
||||
#define E1000_DEV_ID_ICH8_IFE_GT 0x10C4
|
||||
#define E1000_DEV_ID_ICH8_IFE_G 0x10C5
|
||||
#define E1000_DEV_ID_ICH8_IGP_M 0x104D
|
||||
#define E1000_DEV_ID_ICH9_IGP_M 0x10BF
|
||||
#define E1000_DEV_ID_ICH9_IGP_M_AMT 0x10F5
|
||||
#define E1000_DEV_ID_ICH9_IGP_M_V 0x10CB
|
||||
#define E1000_DEV_ID_ICH9_IGP_AMT 0x10BD
|
||||
#define E1000_DEV_ID_ICH9_BM 0x10E5
|
||||
#define E1000_DEV_ID_ICH9_IGP_C 0x294C
|
||||
#define E1000_DEV_ID_ICH9_IFE 0x10C0
|
||||
#define E1000_DEV_ID_ICH9_IFE_GT 0x10C3
|
||||
#define E1000_DEV_ID_ICH9_IFE_G 0x10C2
|
||||
#define E1000_DEV_ID_ICH10_R_BM_LM 0x10CC
|
||||
#define E1000_DEV_ID_ICH10_R_BM_LF 0x10CD
|
||||
#define E1000_DEV_ID_ICH10_R_BM_V 0x10CE
|
||||
#define E1000_DEV_ID_ICH10_D_BM_LM 0x10DE
|
||||
#define E1000_DEV_ID_ICH10_D_BM_LF 0x10DF
|
||||
#define E1000_DEV_ID_ICH10_D_BM_V 0x1525
|
||||
|
||||
#define E1000_DEV_ID_PCH_M_HV_LM 0x10EA
|
||||
#define E1000_DEV_ID_PCH_M_HV_LC 0x10EB
|
||||
#define E1000_DEV_ID_PCH_D_HV_DM 0x10EF
|
||||
#define E1000_DEV_ID_PCH_D_HV_DC 0x10F0
|
||||
#define E1000_DEV_ID_PCH2_LV_LM 0x1502
|
||||
#define E1000_DEV_ID_PCH2_LV_V 0x1503
|
||||
#define E1000_DEV_ID_82576 0x10C9
|
||||
#define E1000_DEV_ID_82576_FIBER 0x10E6
|
||||
#define E1000_DEV_ID_82576_SERDES 0x10E7
|
||||
#define E1000_DEV_ID_82576_QUAD_COPPER 0x10E8
|
||||
#define E1000_DEV_ID_82576_QUAD_COPPER_ET2 0x1526
|
||||
#define E1000_DEV_ID_82576_NS 0x150A
|
||||
#define E1000_DEV_ID_82576_NS_SERDES 0x1518
|
||||
#define E1000_DEV_ID_82576_SERDES_QUAD 0x150D
|
||||
#define E1000_DEV_ID_82576_VF 0x10CA
|
||||
#define E1000_DEV_ID_I350_VF 0x1520
|
||||
#define E1000_DEV_ID_82575EB_COPPER 0x10A7
|
||||
#define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9
|
||||
#define E1000_DEV_ID_82575GB_QUAD_COPPER 0x10D6
|
||||
#define E1000_DEV_ID_82575GB_QUAD_COPPER_PM 0x10E2
|
||||
#define E1000_DEV_ID_82580_COPPER 0x150E
|
||||
#define E1000_DEV_ID_82580_FIBER 0x150F
|
||||
#define E1000_DEV_ID_82580_SERDES 0x1510
|
||||
#define E1000_DEV_ID_82580_SGMII 0x1511
|
||||
#define E1000_DEV_ID_82580_COPPER_DUAL 0x1516
|
||||
#define E1000_DEV_ID_82580_QUAD_FIBER 0x1527
|
||||
#define E1000_DEV_ID_I350_COPPER 0x1521
|
||||
#define E1000_DEV_ID_I350_FIBER 0x1522
|
||||
#define E1000_DEV_ID_I350_SERDES 0x1523
|
||||
#define E1000_DEV_ID_I350_SGMII 0x1524
|
||||
#define E1000_DEV_ID_DH89XXCC_SGMII 0x0438
|
||||
#define E1000_DEV_ID_DH89XXCC_SERDES 0x043A
|
||||
#define E1000_DEV_ID_DH89XXCC_BACKPLANE 0x043C
|
||||
#define E1000_DEV_ID_DH89XXCC_SFP 0x0440
|
||||
#define E1000_REVISION_0 0
|
||||
#define E1000_REVISION_1 1
|
||||
#define E1000_REVISION_2 2
|
||||
#define E1000_REVISION_3 3
|
||||
#define E1000_REVISION_4 4
|
||||
#define E1000_DEV_ID_PCH_M_HV_LM 0x10EA
|
||||
#define E1000_DEV_ID_PCH_M_HV_LC 0x10EB
|
||||
#define E1000_DEV_ID_PCH_D_HV_DM 0x10EF
|
||||
#define E1000_DEV_ID_PCH_D_HV_DC 0x10F0
|
||||
#define E1000_DEV_ID_PCH2_LV_LM 0x1502
|
||||
#define E1000_DEV_ID_PCH2_LV_V 0x1503
|
||||
#define E1000_DEV_ID_82576 0x10C9
|
||||
#define E1000_DEV_ID_82576_FIBER 0x10E6
|
||||
#define E1000_DEV_ID_82576_SERDES 0x10E7
|
||||
#define E1000_DEV_ID_82576_QUAD_COPPER 0x10E8
|
||||
#define E1000_DEV_ID_82576_QUAD_COPPER_ET2 0x1526
|
||||
#define E1000_DEV_ID_82576_NS 0x150A
|
||||
#define E1000_DEV_ID_82576_NS_SERDES 0x1518
|
||||
#define E1000_DEV_ID_82576_SERDES_QUAD 0x150D
|
||||
#define E1000_DEV_ID_82576_VF 0x10CA
|
||||
#define E1000_DEV_ID_I350_VF 0x1520
|
||||
#define E1000_DEV_ID_82575EB_COPPER 0x10A7
|
||||
#define E1000_DEV_ID_82575EB_FIBER_SERDES 0x10A9
|
||||
#define E1000_DEV_ID_82575GB_QUAD_COPPER 0x10D6
|
||||
#define E1000_DEV_ID_82580_COPPER 0x150E
|
||||
#define E1000_DEV_ID_82580_FIBER 0x150F
|
||||
#define E1000_DEV_ID_82580_SERDES 0x1510
|
||||
#define E1000_DEV_ID_82580_SGMII 0x1511
|
||||
#define E1000_DEV_ID_82580_COPPER_DUAL 0x1516
|
||||
#define E1000_DEV_ID_82580_QUAD_FIBER 0x1527
|
||||
#define E1000_DEV_ID_I350_COPPER 0x1521
|
||||
#define E1000_DEV_ID_I350_FIBER 0x1522
|
||||
#define E1000_DEV_ID_I350_SERDES 0x1523
|
||||
#define E1000_DEV_ID_I350_SGMII 0x1524
|
||||
#define E1000_DEV_ID_I350_DA4 0x1546
|
||||
#define E1000_DEV_ID_I210_COPPER 0x1533
|
||||
#define E1000_DEV_ID_I210_COPPER_OEM1 0x1534
|
||||
#define E1000_DEV_ID_I210_COPPER_IT 0x1535
|
||||
#define E1000_DEV_ID_I210_FIBER 0x1536
|
||||
#define E1000_DEV_ID_I210_SERDES 0x1537
|
||||
#define E1000_DEV_ID_I210_SGMII 0x1538
|
||||
#define E1000_DEV_ID_I211_COPPER 0x1539
|
||||
#define E1000_DEV_ID_DH89XXCC_SGMII 0x0438
|
||||
#define E1000_DEV_ID_DH89XXCC_SERDES 0x043A
|
||||
#define E1000_DEV_ID_DH89XXCC_BACKPLANE 0x043C
|
||||
#define E1000_DEV_ID_DH89XXCC_SFP 0x0440
|
||||
#define E1000_REVISION_0 0
|
||||
#define E1000_REVISION_1 1
|
||||
#define E1000_REVISION_2 2
|
||||
#define E1000_REVISION_3 3
|
||||
#define E1000_REVISION_4 4
|
||||
|
||||
#define E1000_FUNC_0 0
|
||||
#define E1000_FUNC_1 1
|
||||
#define E1000_FUNC_2 2
|
||||
#define E1000_FUNC_3 3
|
||||
#define E1000_FUNC_0 0
|
||||
#define E1000_FUNC_1 1
|
||||
#define E1000_FUNC_2 2
|
||||
#define E1000_FUNC_3 3
|
||||
|
||||
#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN0 0
|
||||
#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 3
|
||||
#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN2 6
|
||||
#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN3 9
|
||||
#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN0 0
|
||||
#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN1 3
|
||||
#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN2 6
|
||||
#define E1000_ALT_MAC_ADDRESS_OFFSET_LAN3 9
|
||||
|
||||
enum e1000_mac_type {
|
||||
e1000_undefined = 0,
|
||||
@@ -204,6 +210,8 @@ enum e1000_mac_type {
|
||||
e1000_82576,
|
||||
e1000_82580,
|
||||
e1000_i350,
|
||||
e1000_i210,
|
||||
e1000_i211,
|
||||
e1000_vfadapt,
|
||||
e1000_vfadapt_i350,
|
||||
e1000_num_macs /* List is 1-based, so subtract 1 for TRUE count. */
|
||||
@@ -249,6 +257,7 @@ enum e1000_phy_type {
|
||||
e1000_phy_82579,
|
||||
e1000_phy_82580,
|
||||
e1000_phy_vf,
|
||||
e1000_phy_i210,
|
||||
};
|
||||
|
||||
enum e1000_bus_type {
|
||||
@@ -342,9 +351,9 @@ enum e1000_serdes_link_state {
|
||||
struct e1000_rx_desc {
|
||||
__le64 buffer_addr; /* Address of the descriptor's data buffer */
|
||||
__le16 length; /* Length of data DMAed into data buffer */
|
||||
__le16 csum; /* Packet checksum */
|
||||
u8 status; /* Descriptor status */
|
||||
u8 errors; /* Descriptor Errors */
|
||||
__le16 csum; /* Packet checksum */
|
||||
u8 status; /* Descriptor status */
|
||||
u8 errors; /* Descriptor Errors */
|
||||
__le16 special;
|
||||
};
|
||||
|
||||
@@ -356,9 +365,9 @@ union e1000_rx_desc_extended {
|
||||
} read;
|
||||
struct {
|
||||
struct {
|
||||
__le32 mrq; /* Multiple Rx Queues */
|
||||
__le32 mrq; /* Multiple Rx Queues */
|
||||
union {
|
||||
__le32 rss; /* RSS Hash */
|
||||
__le32 rss; /* RSS Hash */
|
||||
struct {
|
||||
__le16 ip_id; /* IP id */
|
||||
__le16 csum; /* Packet Checksum */
|
||||
@@ -368,7 +377,7 @@ union e1000_rx_desc_extended {
|
||||
struct {
|
||||
__le32 status_error; /* ext status/error */
|
||||
__le16 length;
|
||||
__le16 vlan; /* VLAN tag */
|
||||
__le16 vlan; /* VLAN tag */
|
||||
} upper;
|
||||
} wb; /* writeback */
|
||||
};
|
||||
@@ -382,9 +391,9 @@ union e1000_rx_desc_packet_split {
|
||||
} read;
|
||||
struct {
|
||||
struct {
|
||||
__le32 mrq; /* Multiple Rx Queues */
|
||||
__le32 mrq; /* Multiple Rx Queues */
|
||||
union {
|
||||
__le32 rss; /* RSS Hash */
|
||||
__le32 rss; /* RSS Hash */
|
||||
struct {
|
||||
__le16 ip_id; /* IP id */
|
||||
__le16 csum; /* Packet Checksum */
|
||||
@@ -393,8 +402,8 @@ union e1000_rx_desc_packet_split {
|
||||
} lower;
|
||||
struct {
|
||||
__le32 status_error; /* ext status/error */
|
||||
__le16 length0; /* length of buffer 0 */
|
||||
__le16 vlan; /* VLAN tag */
|
||||
__le16 length0; /* length of buffer 0 */
|
||||
__le16 vlan; /* VLAN tag */
|
||||
} middle;
|
||||
struct {
|
||||
__le16 header_status;
|
||||
@@ -410,16 +419,16 @@ struct e1000_tx_desc {
|
||||
union {
|
||||
__le32 data;
|
||||
struct {
|
||||
__le16 length; /* Data buffer length */
|
||||
u8 cso; /* Checksum offset */
|
||||
u8 cmd; /* Descriptor control */
|
||||
__le16 length; /* Data buffer length */
|
||||
u8 cso; /* Checksum offset */
|
||||
u8 cmd; /* Descriptor control */
|
||||
} flags;
|
||||
} lower;
|
||||
union {
|
||||
__le32 data;
|
||||
struct {
|
||||
u8 status; /* Descriptor status */
|
||||
u8 css; /* Checksum start */
|
||||
u8 status; /* Descriptor status */
|
||||
u8 css; /* Checksum start */
|
||||
__le16 special;
|
||||
} fields;
|
||||
} upper;
|
||||
@@ -430,37 +439,37 @@ struct e1000_context_desc {
|
||||
union {
|
||||
__le32 ip_config;
|
||||
struct {
|
||||
u8 ipcss; /* IP checksum start */
|
||||
u8 ipcso; /* IP checksum offset */
|
||||
__le16 ipcse; /* IP checksum end */
|
||||
u8 ipcss; /* IP checksum start */
|
||||
u8 ipcso; /* IP checksum offset */
|
||||
__le16 ipcse; /* IP checksum end */
|
||||
} ip_fields;
|
||||
} lower_setup;
|
||||
union {
|
||||
__le32 tcp_config;
|
||||
struct {
|
||||
u8 tucss; /* TCP checksum start */
|
||||
u8 tucso; /* TCP checksum offset */
|
||||
__le16 tucse; /* TCP checksum end */
|
||||
u8 tucss; /* TCP checksum start */
|
||||
u8 tucso; /* TCP checksum offset */
|
||||
__le16 tucse; /* TCP checksum end */
|
||||
} tcp_fields;
|
||||
} upper_setup;
|
||||
__le32 cmd_and_length;
|
||||
union {
|
||||
__le32 data;
|
||||
struct {
|
||||
u8 status; /* Descriptor status */
|
||||
u8 hdr_len; /* Header length */
|
||||
__le16 mss; /* Maximum segment size */
|
||||
u8 status; /* Descriptor status */
|
||||
u8 hdr_len; /* Header length */
|
||||
__le16 mss; /* Maximum segment size */
|
||||
} fields;
|
||||
} tcp_seg_setup;
|
||||
};
|
||||
|
||||
/* Offload data descriptor */
|
||||
struct e1000_data_desc {
|
||||
__le64 buffer_addr; /* Address of the descriptor's buffer address */
|
||||
__le64 buffer_addr; /* Address of the descriptor's buffer address */
|
||||
union {
|
||||
__le32 data;
|
||||
struct {
|
||||
__le16 length; /* Data buffer length */
|
||||
__le16 length; /* Data buffer length */
|
||||
u8 typ_len_ext;
|
||||
u8 cmd;
|
||||
} flags;
|
||||
@@ -468,8 +477,8 @@ struct e1000_data_desc {
|
||||
union {
|
||||
__le32 data;
|
||||
struct {
|
||||
u8 status; /* Descriptor status */
|
||||
u8 popts; /* Packet Options */
|
||||
u8 status; /* Descriptor status */
|
||||
u8 popts; /* Packet Options */
|
||||
__le16 special;
|
||||
} fields;
|
||||
} upper;
|
||||
@@ -553,6 +562,10 @@ struct e1000_hw_stats {
|
||||
u64 scvpc;
|
||||
u64 hrmpc;
|
||||
u64 doosync;
|
||||
u64 o2bgptc;
|
||||
u64 o2bspc;
|
||||
u64 b2ospc;
|
||||
u64 b2ogprc;
|
||||
};
|
||||
|
||||
struct e1000_vf_stats {
|
||||
@@ -611,7 +624,7 @@ struct e1000_host_command_header {
|
||||
u8 checksum;
|
||||
};
|
||||
|
||||
#define E1000_HI_MAX_DATA_LENGTH 252
|
||||
#define E1000_HI_MAX_DATA_LENGTH 252
|
||||
struct e1000_host_command_info {
|
||||
struct e1000_host_command_header command_header;
|
||||
u8 command_data[E1000_HI_MAX_DATA_LENGTH];
|
||||
@@ -626,7 +639,7 @@ struct e1000_host_mng_command_header {
|
||||
u16 command_length;
|
||||
};
|
||||
|
||||
#define E1000_HI_MAX_MNG_DATA_LENGTH 0x6F8
|
||||
#define E1000_HI_MAX_MNG_DATA_LENGTH 0x6F8
|
||||
struct e1000_host_mng_command_info {
|
||||
struct e1000_host_mng_command_header command_header;
|
||||
u8 command_data[E1000_HI_MAX_MNG_DATA_LENGTH];
|
||||
@@ -668,11 +681,28 @@ struct e1000_mac_operations {
|
||||
s32 (*validate_mdi_setting)(struct e1000_hw *);
|
||||
s32 (*mng_host_if_write)(struct e1000_hw *, u8*, u16, u16, u8*);
|
||||
s32 (*mng_write_cmd_header)(struct e1000_hw *hw,
|
||||
struct e1000_host_mng_command_header*);
|
||||
struct e1000_host_mng_command_header*);
|
||||
s32 (*mng_enable_host_if)(struct e1000_hw *);
|
||||
s32 (*wait_autoneg)(struct e1000_hw *);
|
||||
s32 (*acquire_swfw_sync)(struct e1000_hw *, u16);
|
||||
void (*release_swfw_sync)(struct e1000_hw *, u16);
|
||||
};
|
||||
|
||||
/*
|
||||
* When to use various PHY register access functions:
|
||||
*
|
||||
* Func Caller
|
||||
* Function Does Does When to use
|
||||
* ~~~~~~~~~~~~ ~~~~~ ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* X_reg L,P,A n/a for simple PHY reg accesses
|
||||
* X_reg_locked P,A L for multiple accesses of different regs
|
||||
* on different pages
|
||||
* X_reg_page A L,P for multiple accesses of different regs
|
||||
* on the same page
|
||||
*
|
||||
* Where X=[read|write], L=locking, P=sets page, A=register access
|
||||
*
|
||||
*/
|
||||
struct e1000_phy_operations {
|
||||
s32 (*init_params)(struct e1000_hw *);
|
||||
s32 (*acquire)(struct e1000_hw *);
|
||||
@@ -684,16 +714,21 @@ struct e1000_phy_operations {
|
||||
s32 (*get_cfg_done)(struct e1000_hw *hw);
|
||||
s32 (*get_cable_length)(struct e1000_hw *);
|
||||
s32 (*get_info)(struct e1000_hw *);
|
||||
s32 (*set_page)(struct e1000_hw *, u16);
|
||||
s32 (*read_reg)(struct e1000_hw *, u32, u16 *);
|
||||
s32 (*read_reg_locked)(struct e1000_hw *, u32, u16 *);
|
||||
s32 (*read_reg_page)(struct e1000_hw *, u32, u16 *);
|
||||
void (*release)(struct e1000_hw *);
|
||||
s32 (*reset)(struct e1000_hw *);
|
||||
s32 (*set_d0_lplu_state)(struct e1000_hw *, bool);
|
||||
s32 (*set_d3_lplu_state)(struct e1000_hw *, bool);
|
||||
s32 (*write_reg)(struct e1000_hw *, u32, u16);
|
||||
s32 (*write_reg_locked)(struct e1000_hw *, u32, u16);
|
||||
s32 (*write_reg_page)(struct e1000_hw *, u32, u16);
|
||||
void (*power_up)(struct e1000_hw *);
|
||||
void (*power_down)(struct e1000_hw *);
|
||||
s32 (*read_i2c_byte)(struct e1000_hw *, u8, u8, u8 *);
|
||||
s32 (*write_i2c_byte)(struct e1000_hw *, u8, u8, u8);
|
||||
};
|
||||
|
||||
struct e1000_nvm_operations {
|
||||
@@ -781,7 +816,6 @@ struct e1000_phy_info {
|
||||
bool disable_polarity_correction;
|
||||
bool is_mdix;
|
||||
bool polarity_correction;
|
||||
bool reset_disable;
|
||||
bool speed_downgraded;
|
||||
bool autoneg_wait_to_complete;
|
||||
};
|
||||
@@ -811,14 +845,14 @@ struct e1000_bus_info {
|
||||
};
|
||||
|
||||
struct e1000_fc_info {
|
||||
u32 high_water; /* Flow control high-water mark */
|
||||
u32 low_water; /* Flow control low-water mark */
|
||||
u16 pause_time; /* Flow control pause timer */
|
||||
u16 refresh_time; /* Flow control refresh timer */
|
||||
bool send_xon; /* Flow control send XON */
|
||||
bool strict_ieee; /* Strict IEEE mode */
|
||||
enum e1000_fc_mode current_mode; /* FC mode in effect */
|
||||
enum e1000_fc_mode requested_mode; /* FC mode requested by caller */
|
||||
u32 high_water; /* Flow control high-water mark */
|
||||
u32 low_water; /* Flow control low-water mark */
|
||||
u16 pause_time; /* Flow control pause timer */
|
||||
u16 refresh_time; /* Flow control refresh timer */
|
||||
bool send_xon; /* Flow control send XON */
|
||||
bool strict_ieee; /* Strict IEEE mode */
|
||||
enum e1000_fc_mode current_mode; /* FC mode in effect */
|
||||
enum e1000_fc_mode requested_mode; /* FC mode requested by caller */
|
||||
};
|
||||
|
||||
struct e1000_mbx_operations {
|
||||
@@ -896,6 +930,8 @@ struct e1000_dev_spec_82575 {
|
||||
bool sgmii_active;
|
||||
bool global_device_reset;
|
||||
bool eee_disable;
|
||||
bool module_plugged;
|
||||
u32 mtu;
|
||||
};
|
||||
|
||||
struct e1000_dev_spec_vf {
|
||||
@@ -943,6 +979,7 @@ struct e1000_hw {
|
||||
#include "e1000_80003es2lan.h"
|
||||
#include "e1000_ich8lan.h"
|
||||
#include "e1000_82575.h"
|
||||
#include "e1000_i210.h"
|
||||
|
||||
/* These functions must be implemented by drivers */
|
||||
void e1000_pci_clear_mwi(struct e1000_hw *hw);
|
||||
|
||||
@@ -0,0 +1,740 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2012, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#include "e1000_api.h"
|
||||
|
||||
|
||||
static s32 e1000_acquire_nvm_i210(struct e1000_hw *hw);
|
||||
static void e1000_release_nvm_i210(struct e1000_hw *hw);
|
||||
static s32 e1000_get_hw_semaphore_i210(struct e1000_hw *hw);
|
||||
static void e1000_put_hw_semaphore_i210(struct e1000_hw *hw);
|
||||
static s32 e1000_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
u16 *data);
|
||||
static s32 e1000_pool_flash_update_done_i210(struct e1000_hw *hw);
|
||||
static s32 e1000_valid_led_default_i210(struct e1000_hw *hw, u16 *data);
|
||||
static s32 e1000_read_nvm_i211(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
u16 *data);
|
||||
|
||||
/**
|
||||
* e1000_acquire_nvm_i210 - Request for access to EEPROM
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Acquire the necessary semaphores for exclusive access to the EEPROM.
|
||||
* Set the EEPROM access request bit and wait for EEPROM access grant bit.
|
||||
* Return successful if access grant bit set, else clear the request for
|
||||
* EEPROM access and return -E1000_ERR_NVM (-1).
|
||||
**/
|
||||
static s32 e1000_acquire_nvm_i210(struct e1000_hw *hw)
|
||||
{
|
||||
s32 ret_val;
|
||||
|
||||
DEBUGFUNC("e1000_acquire_nvm_i210");
|
||||
|
||||
ret_val = e1000_acquire_swfw_sync_i210(hw, E1000_SWFW_EEP_SM);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_release_nvm_i210 - Release exclusive access to EEPROM
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Stop any current commands to the EEPROM and clear the EEPROM request bit,
|
||||
* then release the semaphores acquired.
|
||||
**/
|
||||
static void e1000_release_nvm_i210(struct e1000_hw *hw)
|
||||
{
|
||||
DEBUGFUNC("e1000_release_nvm_i210");
|
||||
|
||||
e1000_release_swfw_sync_i210(hw, E1000_SWFW_EEP_SM);
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_acquire_swfw_sync_i210 - Acquire SW/FW semaphore
|
||||
* @hw: pointer to the HW structure
|
||||
* @mask: specifies which semaphore to acquire
|
||||
*
|
||||
* Acquire the SW/FW semaphore to access the PHY or NVM. The mask
|
||||
* will also specify which port we're acquiring the lock for.
|
||||
**/
|
||||
s32 e1000_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask)
|
||||
{
|
||||
u32 swfw_sync;
|
||||
u32 swmask = mask;
|
||||
u32 fwmask = mask << 16;
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
s32 i = 0, timeout = 200; /* FIXME: find real value to use here */
|
||||
|
||||
DEBUGFUNC("e1000_acquire_swfw_sync_i210");
|
||||
|
||||
while (i < timeout) {
|
||||
if (e1000_get_hw_semaphore_i210(hw)) {
|
||||
ret_val = -E1000_ERR_SWFW_SYNC;
|
||||
goto out;
|
||||
}
|
||||
|
||||
swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC);
|
||||
if (!(swfw_sync & fwmask))
|
||||
break;
|
||||
|
||||
/*
|
||||
* Firmware currently using resource (fwmask)
|
||||
*/
|
||||
e1000_put_hw_semaphore_i210(hw);
|
||||
msec_delay_irq(5);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i == timeout) {
|
||||
DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n");
|
||||
ret_val = -E1000_ERR_SWFW_SYNC;
|
||||
goto out;
|
||||
}
|
||||
|
||||
swfw_sync |= swmask;
|
||||
E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync);
|
||||
|
||||
e1000_put_hw_semaphore_i210(hw);
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_release_swfw_sync_i210 - Release SW/FW semaphore
|
||||
* @hw: pointer to the HW structure
|
||||
* @mask: specifies which semaphore to acquire
|
||||
*
|
||||
* Release the SW/FW semaphore used to access the PHY or NVM. The mask
|
||||
* will also specify which port we're releasing the lock for.
|
||||
**/
|
||||
void e1000_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask)
|
||||
{
|
||||
u32 swfw_sync;
|
||||
|
||||
DEBUGFUNC("e1000_release_swfw_sync_i210");
|
||||
|
||||
while (e1000_get_hw_semaphore_i210(hw) != E1000_SUCCESS)
|
||||
; /* Empty */
|
||||
|
||||
swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC);
|
||||
swfw_sync &= ~mask;
|
||||
E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync);
|
||||
|
||||
e1000_put_hw_semaphore_i210(hw);
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_get_hw_semaphore_i210 - Acquire hardware semaphore
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Acquire the HW semaphore to access the PHY or NVM
|
||||
**/
|
||||
static s32 e1000_get_hw_semaphore_i210(struct e1000_hw *hw)
|
||||
{
|
||||
u32 swsm;
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
s32 timeout = hw->nvm.word_size + 1;
|
||||
s32 i = 0;
|
||||
|
||||
DEBUGFUNC("e1000_get_hw_semaphore_i210");
|
||||
|
||||
/* Get the FW semaphore. */
|
||||
for (i = 0; i < timeout; i++) {
|
||||
swsm = E1000_READ_REG(hw, E1000_SWSM);
|
||||
E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI);
|
||||
|
||||
/* Semaphore acquired if bit latched */
|
||||
if (E1000_READ_REG(hw, E1000_SWSM) & E1000_SWSM_SWESMBI)
|
||||
break;
|
||||
|
||||
usec_delay(50);
|
||||
}
|
||||
|
||||
if (i == timeout) {
|
||||
/* Release semaphores */
|
||||
e1000_put_hw_semaphore_generic(hw);
|
||||
DEBUGOUT("Driver can't access the NVM\n");
|
||||
ret_val = -E1000_ERR_NVM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_put_hw_semaphore_i210 - Release hardware semaphore
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Release hardware semaphore used to access the PHY or NVM
|
||||
**/
|
||||
static void e1000_put_hw_semaphore_i210(struct e1000_hw *hw)
|
||||
{
|
||||
u32 swsm;
|
||||
|
||||
DEBUGFUNC("e1000_put_hw_semaphore_i210");
|
||||
|
||||
swsm = E1000_READ_REG(hw, E1000_SWSM);
|
||||
|
||||
swsm &= ~E1000_SWSM_SWESMBI;
|
||||
|
||||
E1000_WRITE_REG(hw, E1000_SWSM, swsm);
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_read_nvm_srrd_i210 - Reads Shadow Ram using EERD register
|
||||
* @hw: pointer to the HW structure
|
||||
* @offset: offset of word in the Shadow Ram to read
|
||||
* @words: number of words to read
|
||||
* @data: word read from the Shadow Ram
|
||||
*
|
||||
* Reads a 16 bit word from the Shadow Ram using the EERD register.
|
||||
* Uses necessary synchronization semaphores.
|
||||
**/
|
||||
s32 e1000_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
u16 *data)
|
||||
{
|
||||
s32 status = E1000_SUCCESS;
|
||||
u16 i, count;
|
||||
|
||||
DEBUGFUNC("e1000_read_nvm_srrd_i210");
|
||||
|
||||
/* We cannot hold synchronization semaphores for too long,
|
||||
* because of forceful takeover procedure. However it is more efficient
|
||||
* to read in bursts than synchronizing access for each word. */
|
||||
for (i = 0; i < words; i += E1000_EERD_EEWR_MAX_COUNT) {
|
||||
count = (words - i) / E1000_EERD_EEWR_MAX_COUNT > 0 ?
|
||||
E1000_EERD_EEWR_MAX_COUNT : (words - i);
|
||||
if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) {
|
||||
status = e1000_read_nvm_eerd(hw, offset, count,
|
||||
data + i);
|
||||
hw->nvm.ops.release(hw);
|
||||
} else {
|
||||
status = E1000_ERR_SWFW_SYNC;
|
||||
}
|
||||
|
||||
if (status != E1000_SUCCESS)
|
||||
break;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_write_nvm_srwr_i210 - Write to Shadow RAM using EEWR
|
||||
* @hw: pointer to the HW structure
|
||||
* @offset: offset within the Shadow RAM to be written to
|
||||
* @words: number of words to write
|
||||
* @data: 16 bit word(s) to be written to the Shadow RAM
|
||||
*
|
||||
* Writes data to Shadow RAM at offset using EEWR register.
|
||||
*
|
||||
* If e1000_update_nvm_checksum is not called after this function , the
|
||||
* data will not be committed to FLASH and also Shadow RAM will most likely
|
||||
* contain an invalid checksum.
|
||||
*
|
||||
* If error code is returned, data and Shadow RAM may be inconsistent - buffer
|
||||
* partially written.
|
||||
**/
|
||||
s32 e1000_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
u16 *data)
|
||||
{
|
||||
s32 status = E1000_SUCCESS;
|
||||
u16 i, count;
|
||||
|
||||
DEBUGFUNC("e1000_write_nvm_srwr_i210");
|
||||
|
||||
/* We cannot hold synchronization semaphores for too long,
|
||||
* because of forceful takeover procedure. However it is more efficient
|
||||
* to write in bursts than synchronizing access for each word. */
|
||||
for (i = 0; i < words; i += E1000_EERD_EEWR_MAX_COUNT) {
|
||||
count = (words - i) / E1000_EERD_EEWR_MAX_COUNT > 0 ?
|
||||
E1000_EERD_EEWR_MAX_COUNT : (words - i);
|
||||
if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) {
|
||||
status = e1000_write_nvm_srwr(hw, offset, count,
|
||||
data + i);
|
||||
hw->nvm.ops.release(hw);
|
||||
} else {
|
||||
status = E1000_ERR_SWFW_SYNC;
|
||||
}
|
||||
|
||||
if (status != E1000_SUCCESS)
|
||||
break;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_write_nvm_srwr - Write to Shadow Ram using EEWR
|
||||
* @hw: pointer to the HW structure
|
||||
* @offset: offset within the Shadow Ram to be written to
|
||||
* @words: number of words to write
|
||||
* @data: 16 bit word(s) to be written to the Shadow Ram
|
||||
*
|
||||
* Writes data to Shadow Ram at offset using EEWR register.
|
||||
*
|
||||
* If e1000_update_nvm_checksum is not called after this function , the
|
||||
* Shadow Ram will most likely contain an invalid checksum.
|
||||
**/
|
||||
static s32 e1000_write_nvm_srwr(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
u16 *data)
|
||||
{
|
||||
struct e1000_nvm_info *nvm = &hw->nvm;
|
||||
u32 i, k, eewr = 0;
|
||||
u32 attempts = 100000;
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
|
||||
DEBUGFUNC("e1000_write_nvm_srwr");
|
||||
|
||||
/*
|
||||
* A check for invalid values: offset too large, too many words,
|
||||
* too many words for the offset, and not enough words.
|
||||
*/
|
||||
if ((offset >= nvm->word_size) || (words > (nvm->word_size - offset)) ||
|
||||
(words == 0)) {
|
||||
DEBUGOUT("nvm parameter(s) out of bounds\n");
|
||||
ret_val = -E1000_ERR_NVM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
for (i = 0; i < words; i++) {
|
||||
eewr = ((offset+i) << E1000_NVM_RW_ADDR_SHIFT) |
|
||||
(data[i] << E1000_NVM_RW_REG_DATA) |
|
||||
E1000_NVM_RW_REG_START;
|
||||
|
||||
E1000_WRITE_REG(hw, E1000_SRWR, eewr);
|
||||
|
||||
for (k = 0; k < attempts; k++) {
|
||||
if (E1000_NVM_RW_REG_DONE &
|
||||
E1000_READ_REG(hw, E1000_SRWR)) {
|
||||
ret_val = E1000_SUCCESS;
|
||||
break;
|
||||
}
|
||||
usec_delay(5);
|
||||
}
|
||||
|
||||
if (ret_val != E1000_SUCCESS) {
|
||||
DEBUGOUT("Shadow RAM write EEWR timed out\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_read_nvm_i211 - Read NVM wrapper function for I211
|
||||
* @hw: pointer to the HW structure
|
||||
* @address: the word address (aka eeprom offset) to read
|
||||
* @data: pointer to the data read
|
||||
*
|
||||
* Wrapper function to return data formerly found in the NVM.
|
||||
**/
|
||||
static s32 e1000_read_nvm_i211(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
u16 *data)
|
||||
{
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
|
||||
DEBUGFUNC("e1000_read_nvm_i211");
|
||||
|
||||
/* Only the MAC addr is required to be present in the iNVM */
|
||||
switch (offset) {
|
||||
case NVM_MAC_ADDR:
|
||||
ret_val = e1000_read_invm_i211(hw, (u8)offset, &data[0]);
|
||||
ret_val |= e1000_read_invm_i211(hw, (u8)offset+1, &data[1]);
|
||||
ret_val |= e1000_read_invm_i211(hw, (u8)offset+2, &data[2]);
|
||||
if (ret_val != E1000_SUCCESS)
|
||||
DEBUGOUT("MAC Addr not found in iNVM\n");
|
||||
break;
|
||||
case NVM_ID_LED_SETTINGS:
|
||||
case NVM_INIT_CTRL_2:
|
||||
case NVM_INIT_CTRL_4:
|
||||
case NVM_LED_1_CFG:
|
||||
case NVM_LED_0_2_CFG:
|
||||
e1000_read_invm_i211(hw, (u8)offset, data);
|
||||
break;
|
||||
case NVM_COMPAT:
|
||||
*data = ID_LED_DEFAULT_I210;
|
||||
break;
|
||||
case NVM_SUB_DEV_ID:
|
||||
*data = hw->subsystem_device_id;
|
||||
break;
|
||||
case NVM_SUB_VEN_ID:
|
||||
*data = hw->subsystem_vendor_id;
|
||||
break;
|
||||
case NVM_DEV_ID:
|
||||
*data = hw->device_id;
|
||||
break;
|
||||
case NVM_VEN_ID:
|
||||
*data = hw->vendor_id;
|
||||
break;
|
||||
default:
|
||||
DEBUGOUT1("NVM word 0x%02x is not mapped.\n", offset);
|
||||
*data = NVM_RESERVED_WORD;
|
||||
break;
|
||||
}
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_read_invm_i211 - Reads OTP
|
||||
* @hw: pointer to the HW structure
|
||||
* @address: the word address (aka eeprom offset) to read
|
||||
* @data: pointer to the data read
|
||||
*
|
||||
* Reads 16-bit words from the OTP. Return error when the word is not
|
||||
* stored in OTP.
|
||||
**/
|
||||
s32 e1000_read_invm_i211(struct e1000_hw *hw, u8 address, u16 *data)
|
||||
{
|
||||
s32 status = -E1000_ERR_INVM_VALUE_NOT_FOUND;
|
||||
u32 invm_dword;
|
||||
u16 i;
|
||||
u8 record_type, word_address;
|
||||
|
||||
DEBUGFUNC("e1000_read_invm_i211");
|
||||
|
||||
for (i = 0; i < E1000_INVM_SIZE; i++) {
|
||||
invm_dword = E1000_READ_REG(hw, E1000_INVM_DATA_REG(i));
|
||||
/* Get record type */
|
||||
record_type = INVM_DWORD_TO_RECORD_TYPE(invm_dword);
|
||||
if (record_type == E1000_INVM_UNINITIALIZED_STRUCTURE)
|
||||
break;
|
||||
if (record_type == E1000_INVM_CSR_AUTOLOAD_STRUCTURE)
|
||||
i += E1000_INVM_CSR_AUTOLOAD_DATA_SIZE_IN_DWORDS;
|
||||
if (record_type == E1000_INVM_RSA_KEY_SHA256_STRUCTURE)
|
||||
i += E1000_INVM_RSA_KEY_SHA256_DATA_SIZE_IN_DWORDS;
|
||||
if (record_type == E1000_INVM_WORD_AUTOLOAD_STRUCTURE) {
|
||||
word_address = INVM_DWORD_TO_WORD_ADDRESS(invm_dword);
|
||||
if (word_address == address) {
|
||||
*data = INVM_DWORD_TO_WORD_DATA(invm_dword);
|
||||
DEBUGOUT2("Read INVM Word 0x%02x = %x",
|
||||
address, *data);
|
||||
status = E1000_SUCCESS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (status != E1000_SUCCESS)
|
||||
DEBUGOUT1("Requested word 0x%02x not found in OTP\n", address);
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_validate_nvm_checksum_i210 - Validate EEPROM checksum
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Calculates the EEPROM checksum by reading/adding each word of the EEPROM
|
||||
* and then verifies that the sum of the EEPROM is equal to 0xBABA.
|
||||
**/
|
||||
s32 e1000_validate_nvm_checksum_i210(struct e1000_hw *hw)
|
||||
{
|
||||
s32 status = E1000_SUCCESS;
|
||||
s32 (*read_op_ptr)(struct e1000_hw *, u16, u16, u16 *);
|
||||
|
||||
DEBUGFUNC("e1000_validate_nvm_checksum_i210");
|
||||
|
||||
if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) {
|
||||
|
||||
/*
|
||||
* Replace the read function with semaphore grabbing with
|
||||
* the one that skips this for a while.
|
||||
* We have semaphore taken already here.
|
||||
*/
|
||||
read_op_ptr = hw->nvm.ops.read;
|
||||
hw->nvm.ops.read = e1000_read_nvm_eerd;
|
||||
|
||||
status = e1000_validate_nvm_checksum_generic(hw);
|
||||
|
||||
/* Revert original read operation. */
|
||||
hw->nvm.ops.read = read_op_ptr;
|
||||
|
||||
hw->nvm.ops.release(hw);
|
||||
} else {
|
||||
status = E1000_ERR_SWFW_SYNC;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* e1000_update_nvm_checksum_i210 - Update EEPROM checksum
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Updates the EEPROM checksum by reading/adding each word of the EEPROM
|
||||
* up to the checksum. Then calculates the EEPROM checksum and writes the
|
||||
* value to the EEPROM. Next commit EEPROM data onto the Flash.
|
||||
**/
|
||||
s32 e1000_update_nvm_checksum_i210(struct e1000_hw *hw)
|
||||
{
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
u16 checksum = 0;
|
||||
u16 i, nvm_data;
|
||||
|
||||
DEBUGFUNC("e1000_update_nvm_checksum_i210");
|
||||
|
||||
/*
|
||||
* Read the first word from the EEPROM. If this times out or fails, do
|
||||
* not continue or we could be in for a very long wait while every
|
||||
* EEPROM read fails
|
||||
*/
|
||||
ret_val = e1000_read_nvm_eerd(hw, 0, 1, &nvm_data);
|
||||
if (ret_val != E1000_SUCCESS) {
|
||||
DEBUGOUT("EEPROM read failed\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (hw->nvm.ops.acquire(hw) == E1000_SUCCESS) {
|
||||
/*
|
||||
* Do not use hw->nvm.ops.write, hw->nvm.ops.read
|
||||
* because we do not want to take the synchronization
|
||||
* semaphores twice here.
|
||||
*/
|
||||
|
||||
for (i = 0; i < NVM_CHECKSUM_REG; i++) {
|
||||
ret_val = e1000_read_nvm_eerd(hw, i, 1, &nvm_data);
|
||||
if (ret_val) {
|
||||
hw->nvm.ops.release(hw);
|
||||
DEBUGOUT("NVM Read Error while updating checksum.\n");
|
||||
goto out;
|
||||
}
|
||||
checksum += nvm_data;
|
||||
}
|
||||
checksum = (u16) NVM_SUM - checksum;
|
||||
ret_val = e1000_write_nvm_srwr(hw, NVM_CHECKSUM_REG, 1,
|
||||
&checksum);
|
||||
if (ret_val != E1000_SUCCESS) {
|
||||
hw->nvm.ops.release(hw);
|
||||
DEBUGOUT("NVM Write Error while updating checksum.\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
hw->nvm.ops.release(hw);
|
||||
|
||||
ret_val = e1000_update_flash_i210(hw);
|
||||
} else {
|
||||
ret_val = E1000_ERR_SWFW_SYNC;
|
||||
}
|
||||
out:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_get_flash_presence_i210 - Check if flash device is detected.
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
**/
|
||||
static bool e1000_get_flash_presence_i210(struct e1000_hw *hw)
|
||||
{
|
||||
u32 eec = 0;
|
||||
bool ret_val = FALSE;
|
||||
|
||||
DEBUGFUNC("e1000_get_flash_presence_i210");
|
||||
|
||||
eec = E1000_READ_REG(hw, E1000_EECD);
|
||||
|
||||
if (eec & E1000_EECD_FLASH_DETECTED_I210)
|
||||
ret_val = TRUE;
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_update_flash_i210 - Commit EEPROM to the flash
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
**/
|
||||
s32 e1000_update_flash_i210(struct e1000_hw *hw)
|
||||
{
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
u32 flup;
|
||||
|
||||
DEBUGFUNC("e1000_update_flash_i210");
|
||||
|
||||
ret_val = e1000_pool_flash_update_done_i210(hw);
|
||||
if (ret_val == -E1000_ERR_NVM) {
|
||||
DEBUGOUT("Flash update time out\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
flup = E1000_READ_REG(hw, E1000_EECD) | E1000_EECD_FLUPD_I210;
|
||||
E1000_WRITE_REG(hw, E1000_EECD, flup);
|
||||
|
||||
ret_val = e1000_pool_flash_update_done_i210(hw);
|
||||
if (ret_val == E1000_SUCCESS)
|
||||
DEBUGOUT("Flash update complete\n");
|
||||
else
|
||||
DEBUGOUT("Flash update time out\n");
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_pool_flash_update_done_i210 - Pool FLUDONE status.
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
**/
|
||||
s32 e1000_pool_flash_update_done_i210(struct e1000_hw *hw)
|
||||
{
|
||||
s32 ret_val = -E1000_ERR_NVM;
|
||||
u32 i, reg;
|
||||
|
||||
DEBUGFUNC("e1000_pool_flash_update_done_i210");
|
||||
|
||||
for (i = 0; i < E1000_FLUDONE_ATTEMPTS; i++) {
|
||||
reg = E1000_READ_REG(hw, E1000_EECD);
|
||||
if (reg & E1000_EECD_FLUDONE_I210) {
|
||||
ret_val = E1000_SUCCESS;
|
||||
break;
|
||||
}
|
||||
usec_delay(5);
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_init_nvm_params_i210 - Initialize i210 NVM function pointers
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Initialize the i210 NVM parameters and function pointers.
|
||||
**/
|
||||
static s32 e1000_init_nvm_params_i210(struct e1000_hw *hw)
|
||||
{
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
struct e1000_nvm_info *nvm = &hw->nvm;
|
||||
|
||||
DEBUGFUNC("e1000_init_nvm_params_i210");
|
||||
|
||||
ret_val = e1000_init_nvm_params_82575(hw);
|
||||
|
||||
nvm->ops.acquire = e1000_acquire_nvm_i210;
|
||||
nvm->ops.release = e1000_release_nvm_i210;
|
||||
nvm->ops.read = e1000_read_nvm_srrd_i210;
|
||||
nvm->ops.write = e1000_write_nvm_srwr_i210;
|
||||
nvm->ops.valid_led_default = e1000_valid_led_default_i210;
|
||||
nvm->ops.validate = e1000_validate_nvm_checksum_i210;
|
||||
nvm->ops.update = e1000_update_nvm_checksum_i210;
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_init_nvm_params_i211 - Initialize i211 NVM function pointers
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Initialize the NVM parameters and function pointers for i211.
|
||||
**/
|
||||
static s32 e1000_init_nvm_params_i211(struct e1000_hw *hw)
|
||||
{
|
||||
struct e1000_nvm_info *nvm = &hw->nvm;
|
||||
|
||||
DEBUGFUNC("e1000_init_nvm_params_i211");
|
||||
|
||||
nvm->ops.acquire = e1000_acquire_nvm_i210;
|
||||
nvm->ops.release = e1000_release_nvm_i210;
|
||||
nvm->ops.read = e1000_read_nvm_i211;
|
||||
nvm->ops.valid_led_default = e1000_valid_led_default_i210;
|
||||
nvm->ops.write = e1000_null_write_nvm;
|
||||
nvm->ops.validate = e1000_null_ops_generic;
|
||||
nvm->ops.update = e1000_null_ops_generic;
|
||||
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_init_function_pointers_i210 - Init func ptrs.
|
||||
* @hw: pointer to the HW structure
|
||||
*
|
||||
* Called to initialize all function pointers and parameters.
|
||||
**/
|
||||
void e1000_init_function_pointers_i210(struct e1000_hw *hw)
|
||||
{
|
||||
e1000_init_function_pointers_82575(hw);
|
||||
|
||||
switch (hw->mac.type) {
|
||||
case e1000_i210:
|
||||
if (e1000_get_flash_presence_i210(hw))
|
||||
hw->nvm.ops.init_params = e1000_init_nvm_params_i210;
|
||||
else
|
||||
hw->nvm.ops.init_params = e1000_init_nvm_params_i211;
|
||||
break;
|
||||
case e1000_i211:
|
||||
hw->nvm.ops.init_params = e1000_init_nvm_params_i211;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_valid_led_default_i210 - Verify a valid default LED config
|
||||
* @hw: pointer to the HW structure
|
||||
* @data: pointer to the NVM (EEPROM)
|
||||
*
|
||||
* Read the EEPROM for the current default LED configuration. If the
|
||||
* LED configuration is not valid, set to a valid LED configuration.
|
||||
**/
|
||||
static s32 e1000_valid_led_default_i210(struct e1000_hw *hw, u16 *data)
|
||||
{
|
||||
s32 ret_val;
|
||||
|
||||
DEBUGFUNC("e1000_valid_led_default_i210");
|
||||
|
||||
ret_val = hw->nvm.ops.read(hw, NVM_ID_LED_SETTINGS, 1, data);
|
||||
if (ret_val) {
|
||||
DEBUGOUT("NVM Read Error\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF) {
|
||||
switch (hw->phy.media_type) {
|
||||
case e1000_media_type_internal_serdes:
|
||||
*data = ID_LED_DEFAULT_I210_SERDES;
|
||||
break;
|
||||
case e1000_media_type_copper:
|
||||
default:
|
||||
*data = ID_LED_DEFAULT_I210;
|
||||
break;
|
||||
}
|
||||
}
|
||||
out:
|
||||
return ret_val;
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2012, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the Intel Corporation nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_I210_H_
|
||||
#define _E1000_I210_H_
|
||||
|
||||
s32 e1000_update_flash_i210(struct e1000_hw *hw);
|
||||
s32 e1000_update_nvm_checksum_i210(struct e1000_hw *hw);
|
||||
s32 e1000_validate_nvm_checksum_i210(struct e1000_hw *hw);
|
||||
s32 e1000_write_nvm_srwr_i210(struct e1000_hw *hw, u16 offset,
|
||||
u16 words, u16 *data);
|
||||
s32 e1000_read_nvm_srrd_i210(struct e1000_hw *hw, u16 offset,
|
||||
u16 words, u16 *data);
|
||||
s32 e1000_read_invm_i211(struct e1000_hw *hw, u8 address, u16 *data);
|
||||
s32 e1000_check_for_copper_link_i210(struct e1000_hw *hw);
|
||||
s32 e1000_set_ltr_i210(struct e1000_hw *hw, bool link);
|
||||
s32 e1000_acquire_swfw_sync_i210(struct e1000_hw *hw, u16 mask);
|
||||
void e1000_release_swfw_sync_i210(struct e1000_hw *hw, u16 mask);
|
||||
|
||||
#define E1000_STM_OPCODE 0xDB00
|
||||
#define E1000_EEPROM_FLASH_SIZE_WORD 0x11
|
||||
|
||||
#define INVM_DWORD_TO_RECORD_TYPE(invm_dword) \
|
||||
(u8)((invm_dword) & 0x7)
|
||||
#define INVM_DWORD_TO_WORD_ADDRESS(invm_dword) \
|
||||
(u8)(((invm_dword) & 0x0000FE00) >> 9)
|
||||
#define INVM_DWORD_TO_WORD_DATA(invm_dword) \
|
||||
(u16)(((invm_dword) & 0xFFFF0000) >> 16)
|
||||
|
||||
enum E1000_INVM_STRUCTURE_TYPE {
|
||||
E1000_INVM_UNINITIALIZED_STRUCTURE = 0x00,
|
||||
E1000_INVM_WORD_AUTOLOAD_STRUCTURE = 0x01,
|
||||
E1000_INVM_CSR_AUTOLOAD_STRUCTURE = 0x02,
|
||||
E1000_INVM_PHY_REGISTER_AUTOLOAD_STRUCTURE = 0x03,
|
||||
E1000_INVM_RSA_KEY_SHA256_STRUCTURE = 0x04,
|
||||
E1000_INVM_INVALIDATED_STRUCTURE = 0x0F,
|
||||
};
|
||||
|
||||
#define E1000_INVM_RSA_KEY_SHA256_DATA_SIZE_IN_DWORDS 8
|
||||
#define E1000_INVM_CSR_AUTOLOAD_DATA_SIZE_IN_DWORDS 1
|
||||
|
||||
#define ID_LED_DEFAULT_I210 ((ID_LED_OFF1_ON2 << 8) | \
|
||||
(ID_LED_DEF1_DEF2 << 4) | \
|
||||
(ID_LED_OFF1_OFF2))
|
||||
#define ID_LED_DEFAULT_I210_SERDES ((ID_LED_DEF1_DEF2 << 8) | \
|
||||
(ID_LED_DEF1_DEF2 << 4) | \
|
||||
(ID_LED_DEF1_DEF2))
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2011, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,187 +30,209 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_ich8lan.h,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_ICH8LAN_H_
|
||||
#define _E1000_ICH8LAN_H_
|
||||
|
||||
#define ICH_FLASH_GFPREG 0x0000
|
||||
#define ICH_FLASH_HSFSTS 0x0004
|
||||
#define ICH_FLASH_HSFCTL 0x0006
|
||||
#define ICH_FLASH_FADDR 0x0008
|
||||
#define ICH_FLASH_FDATA0 0x0010
|
||||
#define ICH_FLASH_GFPREG 0x0000
|
||||
#define ICH_FLASH_HSFSTS 0x0004
|
||||
#define ICH_FLASH_HSFCTL 0x0006
|
||||
#define ICH_FLASH_FADDR 0x0008
|
||||
#define ICH_FLASH_FDATA0 0x0010
|
||||
|
||||
/* Requires up to 10 seconds when MNG might be accessing part. */
|
||||
#define ICH_FLASH_READ_COMMAND_TIMEOUT 10000000
|
||||
#define ICH_FLASH_WRITE_COMMAND_TIMEOUT 10000000
|
||||
#define ICH_FLASH_ERASE_COMMAND_TIMEOUT 10000000
|
||||
#define ICH_FLASH_LINEAR_ADDR_MASK 0x00FFFFFF
|
||||
#define ICH_FLASH_CYCLE_REPEAT_COUNT 10
|
||||
#define ICH_FLASH_READ_COMMAND_TIMEOUT 10000000
|
||||
#define ICH_FLASH_WRITE_COMMAND_TIMEOUT 10000000
|
||||
#define ICH_FLASH_ERASE_COMMAND_TIMEOUT 10000000
|
||||
#define ICH_FLASH_LINEAR_ADDR_MASK 0x00FFFFFF
|
||||
#define ICH_FLASH_CYCLE_REPEAT_COUNT 10
|
||||
|
||||
#define ICH_CYCLE_READ 0
|
||||
#define ICH_CYCLE_WRITE 2
|
||||
#define ICH_CYCLE_ERASE 3
|
||||
#define ICH_CYCLE_READ 0
|
||||
#define ICH_CYCLE_WRITE 2
|
||||
#define ICH_CYCLE_ERASE 3
|
||||
|
||||
#define FLASH_GFPREG_BASE_MASK 0x1FFF
|
||||
#define FLASH_SECTOR_ADDR_SHIFT 12
|
||||
#define FLASH_GFPREG_BASE_MASK 0x1FFF
|
||||
#define FLASH_SECTOR_ADDR_SHIFT 12
|
||||
|
||||
#define ICH_FLASH_SEG_SIZE_256 256
|
||||
#define ICH_FLASH_SEG_SIZE_4K 4096
|
||||
#define ICH_FLASH_SEG_SIZE_8K 8192
|
||||
#define ICH_FLASH_SEG_SIZE_64K 65536
|
||||
#define ICH_FLASH_SECTOR_SIZE 4096
|
||||
#define ICH_FLASH_SEG_SIZE_256 256
|
||||
#define ICH_FLASH_SEG_SIZE_4K 4096
|
||||
#define ICH_FLASH_SEG_SIZE_8K 8192
|
||||
#define ICH_FLASH_SEG_SIZE_64K 65536
|
||||
#define ICH_FLASH_SECTOR_SIZE 4096
|
||||
|
||||
#define ICH_FLASH_REG_MAPSIZE 0x00A0
|
||||
#define ICH_FLASH_REG_MAPSIZE 0x00A0
|
||||
|
||||
#define E1000_ICH_FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI Reset */
|
||||
#define E1000_ICH_FWSM_DISSW 0x10000000 /* FW Disables SW Writes */
|
||||
#define E1000_ICH_FWSM_RSPCIPHY 0x00000040 /* Reset PHY on PCI Reset */
|
||||
#define E1000_ICH_FWSM_DISSW 0x10000000 /* FW Disables SW Writes */
|
||||
/* FW established a valid mode */
|
||||
#define E1000_ICH_FWSM_FW_VALID 0x00008000
|
||||
#define E1000_ICH_FWSM_FW_VALID 0x00008000
|
||||
#define E1000_ICH_FWSM_PCIM2PCI 0x01000000 /* ME PCIm-to-PCI active */
|
||||
#define E1000_ICH_FWSM_PCIM2PCI_COUNT 2000
|
||||
|
||||
#define E1000_ICH_MNG_IAMT_MODE 0x2
|
||||
#define E1000_ICH_MNG_IAMT_MODE 0x2
|
||||
|
||||
#define E1000_FWSM_PROXY_MODE 0x00000008 /* FW is in proxy mode */
|
||||
#define E1000_FWSM_PROXY_MODE 0x00000008 /* FW is in proxy mode */
|
||||
#define E1000_FWSM_MEMC 0x00000010 /* ME Messaging capable */
|
||||
|
||||
/* Shared Receive Address Registers */
|
||||
#define E1000_SHRAL(_i) (0x05438 + ((_i) * 8))
|
||||
#define E1000_SHRAH(_i) (0x0543C + ((_i) * 8))
|
||||
#define E1000_SHRAH_AV 0x80000000 /* Addr Valid bit */
|
||||
#define E1000_SHRAH_MAV 0x40000000 /* Multicast Addr Valid bit */
|
||||
#define E1000_SHRAL(_i) (0x05438 + ((_i) * 8))
|
||||
#define E1000_SHRAH(_i) (0x0543C + ((_i) * 8))
|
||||
#define E1000_SHRAH_AV 0x80000000 /* Addr Valid bit */
|
||||
#define E1000_SHRAH_MAV 0x40000000 /* Multicast Addr Valid bit */
|
||||
|
||||
#define E1000_H2ME 0x05B50 /* Host to ME */
|
||||
#define E1000_H2ME_LSECREQ 0x00000001 /* Linksec Request */
|
||||
#define E1000_H2ME_LSECA 0x00000002 /* Linksec Active */
|
||||
#define E1000_H2ME_LSECSF 0x00000004 /* Linksec Failed */
|
||||
#define E1000_H2ME_LSECD 0x00000008 /* Linksec Disabled */
|
||||
#define E1000_H2ME_SLCAPD 0x00000010 /* Start LCAPD */
|
||||
#define E1000_H2ME_IPV4_ARP_EN 0x00000020 /* Arp Offload enable bit */
|
||||
#define E1000_H2ME_IPV6_NS_EN 0x00000040 /* NS Offload enable bit */
|
||||
#define E1000_H2ME 0x05B50 /* Host to ME */
|
||||
#define E1000_H2ME_LSECREQ 0x00000001 /* Linksec Request */
|
||||
#define E1000_H2ME_LSECA 0x00000002 /* Linksec Active */
|
||||
#define E1000_H2ME_LSECSF 0x00000004 /* Linksec Failed */
|
||||
#define E1000_H2ME_LSECD 0x00000008 /* Linksec Disabled */
|
||||
#define E1000_H2ME_SLCAPD 0x00000010 /* Start LCAPD */
|
||||
#define E1000_H2ME_IPV4_ARP_EN 0x00000020 /* Arp Offload enable bit */
|
||||
#define E1000_H2ME_IPV6_NS_EN 0x00000040 /* NS Offload enable bit */
|
||||
|
||||
#define ID_LED_DEFAULT_ICH8LAN ((ID_LED_DEF1_DEF2 << 12) | \
|
||||
(ID_LED_OFF1_OFF2 << 8) | \
|
||||
(ID_LED_OFF1_ON2 << 4) | \
|
||||
(ID_LED_DEF1_DEF2))
|
||||
#define ID_LED_DEFAULT_ICH8LAN ((ID_LED_DEF1_DEF2 << 12) | \
|
||||
(ID_LED_OFF1_OFF2 << 8) | \
|
||||
(ID_LED_OFF1_ON2 << 4) | \
|
||||
(ID_LED_DEF1_DEF2))
|
||||
|
||||
#define E1000_ICH_NVM_SIG_WORD 0x13
|
||||
#define E1000_ICH_NVM_SIG_MASK 0xC000
|
||||
#define E1000_ICH_NVM_VALID_SIG_MASK 0xC0
|
||||
#define E1000_ICH_NVM_SIG_VALUE 0x80
|
||||
#define E1000_ICH_NVM_SIG_WORD 0x13
|
||||
#define E1000_ICH_NVM_SIG_MASK 0xC000
|
||||
#define E1000_ICH_NVM_VALID_SIG_MASK 0xC0
|
||||
#define E1000_ICH_NVM_SIG_VALUE 0x80
|
||||
|
||||
#define E1000_ICH8_LAN_INIT_TIMEOUT 1500
|
||||
#define E1000_ICH8_LAN_INIT_TIMEOUT 1500
|
||||
|
||||
#define E1000_FEXTNVM_SW_CONFIG 1
|
||||
#define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27) /* Bit redefined for ICH8M */
|
||||
#define E1000_FEXTNVM_SW_CONFIG 1
|
||||
#define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27) /* Bit redefined for ICH8M */
|
||||
|
||||
#define E1000_FEXTNVM4_BEACON_DURATION_MASK 0x7
|
||||
#define E1000_FEXTNVM4_BEACON_DURATION_8USEC 0x7
|
||||
#define E1000_FEXTNVM4_BEACON_DURATION_16USEC 0x3
|
||||
#define E1000_FEXTNVM4_BEACON_DURATION_MASK 0x7
|
||||
#define E1000_FEXTNVM4_BEACON_DURATION_8USEC 0x7
|
||||
#define E1000_FEXTNVM4_BEACON_DURATION_16USEC 0x3
|
||||
|
||||
#define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL
|
||||
#define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL
|
||||
|
||||
#define E1000_ICH_RAR_ENTRIES 7
|
||||
#define E1000_PCH2_RAR_ENTRIES 5 /* RAR[0], SHRA[0-3] */
|
||||
#define E1000_ICH_RAR_ENTRIES 7
|
||||
#define E1000_PCH2_RAR_ENTRIES 5 /* RAR[0], SHRA[0-3] */
|
||||
|
||||
#define PHY_PAGE_SHIFT 5
|
||||
#define PHY_REG(page, reg) (((page) << PHY_PAGE_SHIFT) | \
|
||||
((reg) & MAX_PHY_REG_ADDRESS))
|
||||
#define IGP3_KMRN_DIAG PHY_REG(770, 19) /* KMRN Diagnostic */
|
||||
#define IGP3_VR_CTRL PHY_REG(776, 18) /* Voltage Regulator Control */
|
||||
#define IGP3_CAPABILITY PHY_REG(776, 19) /* Capability */
|
||||
#define IGP3_PM_CTRL PHY_REG(769, 20) /* Power Management Control */
|
||||
#define PHY_PAGE_SHIFT 5
|
||||
#define PHY_REG(page, reg) (((page) << PHY_PAGE_SHIFT) | \
|
||||
((reg) & MAX_PHY_REG_ADDRESS))
|
||||
#define IGP3_KMRN_DIAG PHY_REG(770, 19) /* KMRN Diagnostic */
|
||||
#define IGP3_VR_CTRL PHY_REG(776, 18) /* Voltage Regulator Control */
|
||||
#define IGP3_CAPABILITY PHY_REG(776, 19) /* Capability */
|
||||
#define IGP3_PM_CTRL PHY_REG(769, 20) /* Power Management Control */
|
||||
|
||||
#define IGP3_KMRN_DIAG_PCS_LOCK_LOSS 0x0002
|
||||
#define IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK 0x0300
|
||||
#define IGP3_VR_CTRL_MODE_SHUTDOWN 0x0200
|
||||
#define IGP3_PM_CTRL_FORCE_PWR_DOWN 0x0020
|
||||
#define IGP3_KMRN_DIAG_PCS_LOCK_LOSS 0x0002
|
||||
#define IGP3_VR_CTRL_DEV_POWERDOWN_MODE_MASK 0x0300
|
||||
#define IGP3_VR_CTRL_MODE_SHUTDOWN 0x0200
|
||||
#define IGP3_PM_CTRL_FORCE_PWR_DOWN 0x0020
|
||||
|
||||
/* PHY Wakeup Registers and defines */
|
||||
#define BM_RCTL PHY_REG(BM_WUC_PAGE, 0)
|
||||
#define BM_WUC PHY_REG(BM_WUC_PAGE, 1)
|
||||
#define BM_WUFC PHY_REG(BM_WUC_PAGE, 2)
|
||||
#define BM_WUS PHY_REG(BM_WUC_PAGE, 3)
|
||||
#define BM_RAR_L(_i) (BM_PHY_REG(BM_WUC_PAGE, 16 + ((_i) << 2)))
|
||||
#define BM_RAR_M(_i) (BM_PHY_REG(BM_WUC_PAGE, 17 + ((_i) << 2)))
|
||||
#define BM_RAR_H(_i) (BM_PHY_REG(BM_WUC_PAGE, 18 + ((_i) << 2)))
|
||||
#define BM_RAR_CTRL(_i) (BM_PHY_REG(BM_WUC_PAGE, 19 + ((_i) << 2)))
|
||||
#define BM_MTA(_i) (BM_PHY_REG(BM_WUC_PAGE, 128 + ((_i) << 1)))
|
||||
#define BM_IPAV (BM_PHY_REG(BM_WUC_PAGE, 64))
|
||||
#define BM_IP4AT_L(_i) (BM_PHY_REG(BM_WUC_PAGE, 82 + ((_i) * 2)))
|
||||
#define BM_IP4AT_H(_i) (BM_PHY_REG(BM_WUC_PAGE, 83 + ((_i) * 2)))
|
||||
#define BM_PORT_GEN_CFG PHY_REG(BM_PORT_CTRL_PAGE, 17)
|
||||
#define BM_RCTL PHY_REG(BM_WUC_PAGE, 0)
|
||||
#define BM_WUC PHY_REG(BM_WUC_PAGE, 1)
|
||||
#define BM_WUFC PHY_REG(BM_WUC_PAGE, 2)
|
||||
#define BM_WUS PHY_REG(BM_WUC_PAGE, 3)
|
||||
#define BM_RAR_L(_i) (BM_PHY_REG(BM_WUC_PAGE, 16 + ((_i) << 2)))
|
||||
#define BM_RAR_M(_i) (BM_PHY_REG(BM_WUC_PAGE, 17 + ((_i) << 2)))
|
||||
#define BM_RAR_H(_i) (BM_PHY_REG(BM_WUC_PAGE, 18 + ((_i) << 2)))
|
||||
#define BM_RAR_CTRL(_i) (BM_PHY_REG(BM_WUC_PAGE, 19 + ((_i) << 2)))
|
||||
#define BM_MTA(_i) (BM_PHY_REG(BM_WUC_PAGE, 128 + ((_i) << 1)))
|
||||
#define BM_IPAV (BM_PHY_REG(BM_WUC_PAGE, 64))
|
||||
#define BM_IP4AT_L(_i) (BM_PHY_REG(BM_WUC_PAGE, 82 + ((_i) * 2)))
|
||||
#define BM_IP4AT_H(_i) (BM_PHY_REG(BM_WUC_PAGE, 83 + ((_i) * 2)))
|
||||
|
||||
#define BM_SHRAL_LOWER(_i) (BM_PHY_REG(BM_WUC_PAGE, 44 + ((_i) * 4)))
|
||||
#define BM_SHRAL_UPPER(_i) (BM_PHY_REG(BM_WUC_PAGE, 45 + ((_i) * 4)))
|
||||
#define BM_SHRAH_LOWER(_i) (BM_PHY_REG(BM_WUC_PAGE, 46 + ((_i) * 4)))
|
||||
#define BM_SHRAH_UPPER(_i) (BM_PHY_REG(BM_WUC_PAGE, 47 + ((_i) * 4)))
|
||||
#define BM_SHRAL_LOWER(_i) (BM_PHY_REG(BM_WUC_PAGE, 44 + ((_i) * 4)))
|
||||
#define BM_SHRAL_UPPER(_i) (BM_PHY_REG(BM_WUC_PAGE, 45 + ((_i) * 4)))
|
||||
#define BM_SHRAH_LOWER(_i) (BM_PHY_REG(BM_WUC_PAGE, 46 + ((_i) * 4)))
|
||||
#define BM_SHRAH_UPPER(_i) (BM_PHY_REG(BM_WUC_PAGE, 47 + ((_i) * 4)))
|
||||
|
||||
#define BM_RCTL_UPE 0x0001 /* Unicast Promiscuous Mode */
|
||||
#define BM_RCTL_MPE 0x0002 /* Multicast Promiscuous Mode */
|
||||
#define BM_RCTL_MO_SHIFT 3 /* Multicast Offset Shift */
|
||||
#define BM_RCTL_MO_MASK (3 << 3) /* Multicast Offset Mask */
|
||||
#define BM_RCTL_BAM 0x0020 /* Broadcast Accept Mode */
|
||||
#define BM_RCTL_PMCF 0x0040 /* Pass MAC Control Frames */
|
||||
#define BM_RCTL_RFCE 0x0080 /* Rx Flow Control Enable */
|
||||
#define BM_RCTL_UPE 0x0001 /* Unicast Promiscuous Mode */
|
||||
#define BM_RCTL_MPE 0x0002 /* Multicast Promiscuous Mode */
|
||||
#define BM_RCTL_MO_SHIFT 3 /* Multicast Offset Shift */
|
||||
#define BM_RCTL_MO_MASK (3 << 3) /* Multicast Offset Mask */
|
||||
#define BM_RCTL_BAM 0x0020 /* Broadcast Accept Mode */
|
||||
#define BM_RCTL_PMCF 0x0040 /* Pass MAC Control Frames */
|
||||
#define BM_RCTL_RFCE 0x0080 /* Rx Flow Control Enable */
|
||||
|
||||
#define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */
|
||||
#define HV_MUX_DATA_CTRL PHY_REG(776, 16)
|
||||
#define HV_MUX_DATA_CTRL_GEN_TO_MAC 0x0400
|
||||
#define HV_MUX_DATA_CTRL_FORCE_SPEED 0x0004
|
||||
#define HV_SCC_UPPER PHY_REG(778, 16) /* Single Collision Count */
|
||||
#define HV_SCC_LOWER PHY_REG(778, 17)
|
||||
#define HV_ECOL_UPPER PHY_REG(778, 18) /* Excessive Collision Count */
|
||||
#define HV_ECOL_LOWER PHY_REG(778, 19)
|
||||
#define HV_MCC_UPPER PHY_REG(778, 20) /* Multiple Collision Count */
|
||||
#define HV_MCC_LOWER PHY_REG(778, 21)
|
||||
#define HV_LATECOL_UPPER PHY_REG(778, 23) /* Late Collision Count */
|
||||
#define HV_LATECOL_LOWER PHY_REG(778, 24)
|
||||
#define HV_COLC_UPPER PHY_REG(778, 25) /* Collision Count */
|
||||
#define HV_COLC_LOWER PHY_REG(778, 26)
|
||||
#define HV_DC_UPPER PHY_REG(778, 27) /* Defer Count */
|
||||
#define HV_DC_LOWER PHY_REG(778, 28)
|
||||
#define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */
|
||||
#define HV_TNCRS_LOWER PHY_REG(778, 30)
|
||||
#define HV_LED_CONFIG PHY_REG(768, 30) /* LED Configuration */
|
||||
#define HV_MUX_DATA_CTRL PHY_REG(776, 16)
|
||||
#define HV_MUX_DATA_CTRL_GEN_TO_MAC 0x0400
|
||||
#define HV_MUX_DATA_CTRL_FORCE_SPEED 0x0004
|
||||
#define HV_STATS_PAGE 778
|
||||
#define HV_SCC_UPPER PHY_REG(HV_STATS_PAGE, 16) /* Single Collision Count */
|
||||
#define HV_SCC_LOWER PHY_REG(HV_STATS_PAGE, 17)
|
||||
#define HV_ECOL_UPPER PHY_REG(HV_STATS_PAGE, 18) /* Excessive Coll. Count */
|
||||
#define HV_ECOL_LOWER PHY_REG(HV_STATS_PAGE, 19)
|
||||
#define HV_MCC_UPPER PHY_REG(HV_STATS_PAGE, 20) /* Multiple Coll. Count */
|
||||
#define HV_MCC_LOWER PHY_REG(HV_STATS_PAGE, 21)
|
||||
#define HV_LATECOL_UPPER PHY_REG(HV_STATS_PAGE, 23) /* Late Collision Count */
|
||||
#define HV_LATECOL_LOWER PHY_REG(HV_STATS_PAGE, 24)
|
||||
#define HV_COLC_UPPER PHY_REG(HV_STATS_PAGE, 25) /* Collision Count */
|
||||
#define HV_COLC_LOWER PHY_REG(HV_STATS_PAGE, 26)
|
||||
#define HV_DC_UPPER PHY_REG(HV_STATS_PAGE, 27) /* Defer Count */
|
||||
#define HV_DC_LOWER PHY_REG(HV_STATS_PAGE, 28)
|
||||
#define HV_TNCRS_UPPER PHY_REG(HV_STATS_PAGE, 29) /* Transmit with no CRS */
|
||||
#define HV_TNCRS_LOWER PHY_REG(HV_STATS_PAGE, 30)
|
||||
|
||||
#define E1000_FCRTV_PCH 0x05F40 /* PCH Flow Control Refresh Timer Value */
|
||||
#define E1000_FCRTV_PCH 0x05F40 /* PCH Flow Control Refresh Timer Value */
|
||||
|
||||
#define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */
|
||||
#define E1000_NVM_K1_ENABLE 0x1 /* NVM Enable K1 bit */
|
||||
/*
|
||||
* For ICH, the name used for NVM word 17h is LED1 Config.
|
||||
* For PCH, the word was re-named to OEM Config.
|
||||
*/
|
||||
#define E1000_NVM_LED1_CONFIG 0x17 /* NVM LED1/LPLU Config Word */
|
||||
#define E1000_NVM_LED1_CONFIG_LPLU_NONDOA 0x0400 /* NVM LPLU in non-D0a Bit */
|
||||
#define E1000_NVM_OEM_CONFIG E1000_NVM_LED1_CONFIG
|
||||
#define E1000_NVM_OEM_CONFIG_LPLU_NONDOA E1000_NVM_LED1_CONFIG_LPLU_NONDOA
|
||||
|
||||
#define E1000_NVM_K1_CONFIG 0x1B /* NVM K1 Config Word */
|
||||
#define E1000_NVM_K1_ENABLE 0x1 /* NVM Enable K1 bit */
|
||||
|
||||
/* SMBus Address Phy Register */
|
||||
#define HV_SMB_ADDR PHY_REG(768, 26)
|
||||
#define HV_SMB_ADDR_MASK 0x007F
|
||||
#define HV_SMB_ADDR_PEC_EN 0x0200
|
||||
#define HV_SMB_ADDR_VALID 0x0080
|
||||
#define HV_SMB_ADDR PHY_REG(768, 26)
|
||||
#define HV_SMB_ADDR_MASK 0x007F
|
||||
#define HV_SMB_ADDR_PEC_EN 0x0200
|
||||
#define HV_SMB_ADDR_VALID 0x0080
|
||||
|
||||
/* Strapping Option Register - RO */
|
||||
#define E1000_STRAP 0x0000C
|
||||
#define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000
|
||||
#define E1000_STRAP_SMBUS_ADDRESS_SHIFT 17
|
||||
#define E1000_STRAP 0x0000C
|
||||
#define E1000_STRAP_SMBUS_ADDRESS_MASK 0x00FE0000
|
||||
#define E1000_STRAP_SMBUS_ADDRESS_SHIFT 17
|
||||
|
||||
/* OEM Bits Phy Register */
|
||||
#define HV_OEM_BITS PHY_REG(768, 25)
|
||||
#define HV_OEM_BITS_LPLU 0x0004 /* Low Power Link Up */
|
||||
#define HV_OEM_BITS_GBE_DIS 0x0040 /* Gigabit Disable */
|
||||
#define HV_OEM_BITS_RESTART_AN 0x0400 /* Restart Auto-negotiation */
|
||||
#define HV_OEM_BITS PHY_REG(768, 25)
|
||||
#define HV_OEM_BITS_LPLU 0x0004 /* Low Power Link Up */
|
||||
#define HV_OEM_BITS_GBE_DIS 0x0040 /* Gigabit Disable */
|
||||
#define HV_OEM_BITS_RESTART_AN 0x0400 /* Restart Auto-negotiation */
|
||||
|
||||
#define LCD_CFG_PHY_ADDR_BIT 0x0020 /* Phy address bit from LCD Config word */
|
||||
#define LCD_CFG_PHY_ADDR_BIT 0x0020 /* Phy addr bit from LCD Config word */
|
||||
|
||||
/* KMRN Mode Control */
|
||||
#define HV_KMRN_MODE_CTRL PHY_REG(769, 16)
|
||||
#define HV_KMRN_MDIO_SLOW 0x0400
|
||||
#define HV_KMRN_MODE_CTRL PHY_REG(769, 16)
|
||||
#define HV_KMRN_MDIO_SLOW 0x0400
|
||||
|
||||
/* KMRN FIFO Control and Status */
|
||||
#define HV_KMRN_FIFO_CTRLSTA PHY_REG(770, 16)
|
||||
#define HV_KMRN_FIFO_CTRLSTA_PREAMBLE_MASK 0x7000
|
||||
#define HV_KMRN_FIFO_CTRLSTA_PREAMBLE_SHIFT 12
|
||||
|
||||
/* PHY Power Management Control */
|
||||
#define HV_PM_CTRL PHY_REG(770, 17)
|
||||
#define HV_PM_CTRL PHY_REG(770, 17)
|
||||
|
||||
#define SW_FLAG_TIMEOUT 1000 /* SW Semaphore flag timeout in milliseconds */
|
||||
#define SW_FLAG_TIMEOUT 1000 /* SW Semaphore flag timeout in ms */
|
||||
|
||||
/* PHY Low Power Idle Control */
|
||||
#define I82579_LPI_CTRL PHY_REG(772, 20)
|
||||
#define I82579_LPI_CTRL_ENABLE_MASK 0x6000
|
||||
#define I82579_LPI_CTRL PHY_REG(772, 20)
|
||||
#define I82579_LPI_CTRL_ENABLE_MASK 0x6000
|
||||
#define I82579_LPI_CTRL_FORCE_PLL_LOCK_COUNT 0x80
|
||||
|
||||
/* EMI Registers */
|
||||
#define I82579_EMI_ADDR 0x10
|
||||
#define I82579_EMI_DATA 0x11
|
||||
#define I82579_LPI_UPDATE_TIMER 0x4805 /* in 40ns units + 40 ns base value */
|
||||
#define I82579_EMI_ADDR 0x10
|
||||
#define I82579_EMI_DATA 0x11
|
||||
#define I82579_LPI_UPDATE_TIMER 0x4805 /* in 40ns units + 40 ns base value */
|
||||
#define I82579_MSE_THRESHOLD 0x084F /* Mean Square Error Threshold */
|
||||
#define I82579_MSE_LINK_DOWN 0x2411 /* MSE count before dropping link */
|
||||
|
||||
/*
|
||||
* Additional interrupts need to be handled for ICH family:
|
||||
@@ -219,33 +241,32 @@
|
||||
* EPRST = Manageability reset event
|
||||
*/
|
||||
#define IMS_ICH_ENABLE_MASK (\
|
||||
E1000_IMS_DSW | \
|
||||
E1000_IMS_PHYINT | \
|
||||
E1000_IMS_EPRST)
|
||||
E1000_IMS_DSW | \
|
||||
E1000_IMS_PHYINT | \
|
||||
E1000_IMS_EPRST)
|
||||
|
||||
/* Additional interrupt register bit definitions */
|
||||
#define E1000_ICR_LSECPNC 0x00004000 /* PN threshold - client */
|
||||
#define E1000_IMS_LSECPNC E1000_ICR_LSECPNC /* PN threshold - client */
|
||||
#define E1000_ICS_LSECPNC E1000_ICR_LSECPNC /* PN threshold - client */
|
||||
#define E1000_ICR_LSECPNC 0x00004000 /* PN threshold - client */
|
||||
#define E1000_IMS_LSECPNC E1000_ICR_LSECPNC /* PN threshold - client */
|
||||
#define E1000_ICS_LSECPNC E1000_ICR_LSECPNC /* PN threshold - client */
|
||||
|
||||
/* Security Processing bit Indication */
|
||||
#define E1000_RXDEXT_LINKSEC_STATUS_LSECH 0x01000000
|
||||
#define E1000_RXDEXT_LINKSEC_ERROR_BIT_MASK 0x60000000
|
||||
#define E1000_RXDEXT_LINKSEC_ERROR_NO_SA_MATCH 0x20000000
|
||||
#define E1000_RXDEXT_LINKSEC_ERROR_REPLAY_ERROR 0x40000000
|
||||
#define E1000_RXDEXT_LINKSEC_ERROR_BAD_SIG 0x60000000
|
||||
#define E1000_RXDEXT_LINKSEC_STATUS_LSECH 0x01000000
|
||||
#define E1000_RXDEXT_LINKSEC_ERROR_BIT_MASK 0x60000000
|
||||
#define E1000_RXDEXT_LINKSEC_ERROR_NO_SA_MATCH 0x20000000
|
||||
#define E1000_RXDEXT_LINKSEC_ERROR_REPLAY_ERROR 0x40000000
|
||||
#define E1000_RXDEXT_LINKSEC_ERROR_BAD_SIG 0x60000000
|
||||
|
||||
/* Receive Address Initial CRC Calculation */
|
||||
#define E1000_PCH_RAICC(_n) (0x05F50 + ((_n) * 4))
|
||||
#define E1000_PCH_RAICC(_n) (0x05F50 + ((_n) * 4))
|
||||
|
||||
void e1000_set_kmrn_lock_loss_workaround_ich8lan(struct e1000_hw *hw,
|
||||
bool state);
|
||||
bool state);
|
||||
void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw);
|
||||
void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw);
|
||||
void e1000_disable_gig_wol_ich8lan(struct e1000_hw *hw);
|
||||
void e1000_suspend_workarounds_ich8lan(struct e1000_hw *hw);
|
||||
void e1000_resume_workarounds_pchlan(struct e1000_hw *hw);
|
||||
s32 e1000_configure_k1_ich8lan(struct e1000_hw *hw, bool k1_enable);
|
||||
s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_config);
|
||||
s32 e1000_hv_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw);
|
||||
void e1000_copy_rx_addrs_to_phy_ich8lan(struct e1000_hw *hw);
|
||||
s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable);
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2012, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_mac.h,v 1.3.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_MAC_H_
|
||||
#define _E1000_MAC_H_
|
||||
@@ -64,31 +64,29 @@ void e1000_set_lan_id_single_port(struct e1000_hw *hw);
|
||||
void e1000_set_lan_id_multi_port_pci(struct e1000_hw *hw);
|
||||
s32 e1000_get_hw_semaphore_generic(struct e1000_hw *hw);
|
||||
s32 e1000_get_speed_and_duplex_copper_generic(struct e1000_hw *hw, u16 *speed,
|
||||
u16 *duplex);
|
||||
u16 *duplex);
|
||||
s32 e1000_get_speed_and_duplex_fiber_serdes_generic(struct e1000_hw *hw,
|
||||
u16 *speed, u16 *duplex);
|
||||
u16 *speed, u16 *duplex);
|
||||
s32 e1000_id_led_init_generic(struct e1000_hw *hw);
|
||||
s32 e1000_led_on_generic(struct e1000_hw *hw);
|
||||
s32 e1000_led_off_generic(struct e1000_hw *hw);
|
||||
void e1000_update_mc_addr_list_generic(struct e1000_hw *hw,
|
||||
u8 *mc_addr_list, u32 mc_addr_count);
|
||||
u8 *mc_addr_list, u32 mc_addr_count);
|
||||
s32 e1000_set_default_fc_generic(struct e1000_hw *hw);
|
||||
s32 e1000_set_fc_watermarks_generic(struct e1000_hw *hw);
|
||||
s32 e1000_setup_fiber_serdes_link_generic(struct e1000_hw *hw);
|
||||
s32 e1000_setup_led_generic(struct e1000_hw *hw);
|
||||
s32 e1000_setup_link_generic(struct e1000_hw *hw);
|
||||
s32 e1000_write_8bit_ctrl_reg_generic(struct e1000_hw *hw, u32 reg,
|
||||
u32 offset, u8 data);
|
||||
u32 offset, u8 data);
|
||||
|
||||
u32 e1000_hash_mc_addr_generic(struct e1000_hw *hw, u8 *mc_addr);
|
||||
|
||||
void e1000_clear_hw_cntrs_base_generic(struct e1000_hw *hw);
|
||||
void e1000_clear_vfta_generic(struct e1000_hw *hw);
|
||||
void e1000_config_collision_dist_generic(struct e1000_hw *hw);
|
||||
void e1000_init_rx_addrs_generic(struct e1000_hw *hw, u16 rar_count);
|
||||
void e1000_pcix_mmrbc_workaround_generic(struct e1000_hw *hw);
|
||||
void e1000_put_hw_semaphore_generic(struct e1000_hw *hw);
|
||||
void e1000_rar_set_generic(struct e1000_hw *hw, u8 *addr, u32 index);
|
||||
s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw);
|
||||
void e1000_reset_adaptive_generic(struct e1000_hw *hw);
|
||||
void e1000_set_pcie_no_snoop_generic(struct e1000_hw *hw, u32 no_snoop);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2012, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_manage.c,v 1.2.2.2.4.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#include "e1000_api.h"
|
||||
|
||||
@@ -71,23 +71,20 @@ u8 e1000_calculate_checksum(u8 *buffer, u32 length)
|
||||
s32 e1000_mng_enable_host_if_generic(struct e1000_hw *hw)
|
||||
{
|
||||
u32 hicr;
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
u8 i;
|
||||
|
||||
DEBUGFUNC("e1000_mng_enable_host_if_generic");
|
||||
|
||||
if (!(hw->mac.arc_subsystem_valid)) {
|
||||
if (!hw->mac.arc_subsystem_valid) {
|
||||
DEBUGOUT("ARC subsystem not valid.\n");
|
||||
ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
goto out;
|
||||
return -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
}
|
||||
|
||||
/* Check that the host interface is enabled. */
|
||||
hicr = E1000_READ_REG(hw, E1000_HICR);
|
||||
if ((hicr & E1000_HICR_EN) == 0) {
|
||||
if (!(hicr & E1000_HICR_EN)) {
|
||||
DEBUGOUT("E1000_HOST_EN bit disabled.\n");
|
||||
ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
goto out;
|
||||
return -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
}
|
||||
/* check the previous command is completed */
|
||||
for (i = 0; i < E1000_MNG_DHCP_COMMAND_TIMEOUT; i++) {
|
||||
@@ -99,12 +96,10 @@ s32 e1000_mng_enable_host_if_generic(struct e1000_hw *hw)
|
||||
|
||||
if (i == E1000_MNG_DHCP_COMMAND_TIMEOUT) {
|
||||
DEBUGOUT("Previous command timeout failed .\n");
|
||||
ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
goto out;
|
||||
return -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,7 +117,7 @@ bool e1000_check_mng_mode_generic(struct e1000_hw *hw)
|
||||
|
||||
|
||||
return (fwsm & E1000_FWSM_MODE_MASK) ==
|
||||
(E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT);
|
||||
(E1000_MNG_IAMT_MODE << E1000_FWSM_MODE_SHIFT);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,7 +142,7 @@ bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw)
|
||||
/* No manageability, no filtering */
|
||||
if (!hw->mac.ops.check_mng_mode(hw)) {
|
||||
hw->mac.tx_pkt_filtering = FALSE;
|
||||
goto out;
|
||||
return hw->mac.tx_pkt_filtering;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -157,7 +152,7 @@ bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw)
|
||||
ret_val = hw->mac.ops.mng_enable_host_if(hw);
|
||||
if (ret_val != E1000_SUCCESS) {
|
||||
hw->mac.tx_pkt_filtering = FALSE;
|
||||
goto out;
|
||||
return hw->mac.tx_pkt_filtering;
|
||||
}
|
||||
|
||||
/* Read in the header. Length and offset are in dwords. */
|
||||
@@ -165,11 +160,11 @@ bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw)
|
||||
offset = E1000_MNG_DHCP_COOKIE_OFFSET >> 2;
|
||||
for (i = 0; i < len; i++)
|
||||
*(buffer + i) = E1000_READ_REG_ARRAY_DWORD(hw, E1000_HOST_IF,
|
||||
offset + i);
|
||||
offset + i);
|
||||
hdr_csum = hdr->checksum;
|
||||
hdr->checksum = 0;
|
||||
csum = e1000_calculate_checksum((u8 *)hdr,
|
||||
E1000_MNG_DHCP_COOKIE_LENGTH);
|
||||
E1000_MNG_DHCP_COOKIE_LENGTH);
|
||||
/*
|
||||
* If either the checksums or signature don't match, then
|
||||
* the cookie area isn't considered valid, in which case we
|
||||
@@ -177,66 +172,16 @@ bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw)
|
||||
*/
|
||||
if ((hdr_csum != csum) || (hdr->signature != E1000_IAMT_SIGNATURE)) {
|
||||
hw->mac.tx_pkt_filtering = TRUE;
|
||||
goto out;
|
||||
return hw->mac.tx_pkt_filtering;
|
||||
}
|
||||
|
||||
/* Cookie area is valid, make the final check for filtering. */
|
||||
if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING)) {
|
||||
if (!(hdr->status & E1000_MNG_DHCP_COOKIE_STATUS_PARSING))
|
||||
hw->mac.tx_pkt_filtering = FALSE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
return hw->mac.tx_pkt_filtering;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_mng_write_dhcp_info_generic - Writes DHCP info to host interface
|
||||
* @hw: pointer to the HW structure
|
||||
* @buffer: pointer to the host interface
|
||||
* @length: size of the buffer
|
||||
*
|
||||
* Writes the DHCP information to the host interface.
|
||||
**/
|
||||
s32 e1000_mng_write_dhcp_info_generic(struct e1000_hw *hw, u8 *buffer,
|
||||
u16 length)
|
||||
{
|
||||
struct e1000_host_mng_command_header hdr;
|
||||
s32 ret_val;
|
||||
u32 hicr;
|
||||
|
||||
DEBUGFUNC("e1000_mng_write_dhcp_info_generic");
|
||||
|
||||
hdr.command_id = E1000_MNG_DHCP_TX_PAYLOAD_CMD;
|
||||
hdr.command_length = length;
|
||||
hdr.reserved1 = 0;
|
||||
hdr.reserved2 = 0;
|
||||
hdr.checksum = 0;
|
||||
|
||||
/* Enable the host interface */
|
||||
ret_val = hw->mac.ops.mng_enable_host_if(hw);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
/* Populate the host interface with the contents of "buffer". */
|
||||
ret_val = hw->mac.ops.mng_host_if_write(hw, buffer, length,
|
||||
sizeof(hdr), &(hdr.checksum));
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
/* Write the manageability command header */
|
||||
ret_val = hw->mac.ops.mng_write_cmd_header(hw, &hdr);
|
||||
if (ret_val)
|
||||
goto out;
|
||||
|
||||
/* Tell the ARC a new command is pending. */
|
||||
hicr = E1000_READ_REG(hw, E1000_HICR);
|
||||
E1000_WRITE_REG(hw, E1000_HICR, hicr | E1000_HICR_C);
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_mng_write_cmd_header_generic - Writes manageability command header
|
||||
* @hw: pointer to the HW structure
|
||||
@@ -245,7 +190,7 @@ out:
|
||||
* Writes the command header after does the checksum calculation.
|
||||
**/
|
||||
s32 e1000_mng_write_cmd_header_generic(struct e1000_hw *hw,
|
||||
struct e1000_host_mng_command_header *hdr)
|
||||
struct e1000_host_mng_command_header *hdr)
|
||||
{
|
||||
u16 i, length = sizeof(struct e1000_host_mng_command_header);
|
||||
|
||||
@@ -259,7 +204,7 @@ s32 e1000_mng_write_cmd_header_generic(struct e1000_hw *hw,
|
||||
/* Write the relevant command block into the ram area. */
|
||||
for (i = 0; i < length; i++) {
|
||||
E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, i,
|
||||
*((u32 *) hdr + i));
|
||||
*((u32 *) hdr + i));
|
||||
E1000_WRITE_FLUSH(hw);
|
||||
}
|
||||
|
||||
@@ -279,22 +224,19 @@ s32 e1000_mng_write_cmd_header_generic(struct e1000_hw *hw,
|
||||
* way. Also fills up the sum of the buffer in *buffer parameter.
|
||||
**/
|
||||
s32 e1000_mng_host_if_write_generic(struct e1000_hw *hw, u8 *buffer,
|
||||
u16 length, u16 offset, u8 *sum)
|
||||
u16 length, u16 offset, u8 *sum)
|
||||
{
|
||||
u8 *tmp;
|
||||
u8 *bufptr = buffer;
|
||||
u32 data = 0;
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
u16 remaining, i, j, prev_bytes;
|
||||
|
||||
DEBUGFUNC("e1000_mng_host_if_write_generic");
|
||||
|
||||
/* sum = only sum of the data and it is not checksum */
|
||||
|
||||
if (length == 0 || offset + length > E1000_HI_MAX_MNG_DATA_LENGTH) {
|
||||
ret_val = -E1000_ERR_PARAM;
|
||||
goto out;
|
||||
}
|
||||
if (length == 0 || offset + length > E1000_HI_MAX_MNG_DATA_LENGTH)
|
||||
return -E1000_ERR_PARAM;
|
||||
|
||||
tmp = (u8 *)&data;
|
||||
prev_bytes = offset & 0x3;
|
||||
@@ -328,7 +270,7 @@ s32 e1000_mng_host_if_write_generic(struct e1000_hw *hw, u8 *buffer,
|
||||
}
|
||||
|
||||
E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset + i,
|
||||
data);
|
||||
data);
|
||||
}
|
||||
if (remaining) {
|
||||
for (j = 0; j < sizeof(u32); j++) {
|
||||
@@ -339,11 +281,57 @@ s32 e1000_mng_host_if_write_generic(struct e1000_hw *hw, u8 *buffer,
|
||||
|
||||
*sum += *(tmp + j);
|
||||
}
|
||||
E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset + i, data);
|
||||
E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, offset + i,
|
||||
data);
|
||||
}
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_mng_write_dhcp_info_generic - Writes DHCP info to host interface
|
||||
* @hw: pointer to the HW structure
|
||||
* @buffer: pointer to the host interface
|
||||
* @length: size of the buffer
|
||||
*
|
||||
* Writes the DHCP information to the host interface.
|
||||
**/
|
||||
s32 e1000_mng_write_dhcp_info_generic(struct e1000_hw *hw, u8 *buffer,
|
||||
u16 length)
|
||||
{
|
||||
struct e1000_host_mng_command_header hdr;
|
||||
s32 ret_val;
|
||||
u32 hicr;
|
||||
|
||||
DEBUGFUNC("e1000_mng_write_dhcp_info_generic");
|
||||
|
||||
hdr.command_id = E1000_MNG_DHCP_TX_PAYLOAD_CMD;
|
||||
hdr.command_length = length;
|
||||
hdr.reserved1 = 0;
|
||||
hdr.reserved2 = 0;
|
||||
hdr.checksum = 0;
|
||||
|
||||
/* Enable the host interface */
|
||||
ret_val = hw->mac.ops.mng_enable_host_if(hw);
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
/* Populate the host interface with the contents of "buffer". */
|
||||
ret_val = hw->mac.ops.mng_host_if_write(hw, buffer, length,
|
||||
sizeof(hdr), &(hdr.checksum));
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
/* Write the manageability command header */
|
||||
ret_val = hw->mac.ops.mng_write_cmd_header(hw, &hdr);
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
/* Tell the ARC a new command is pending. */
|
||||
hicr = E1000_READ_REG(hw, E1000_HICR);
|
||||
E1000_WRITE_REG(hw, E1000_HICR, hicr | E1000_HICR_C);
|
||||
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -357,17 +345,16 @@ bool e1000_enable_mng_pass_thru(struct e1000_hw *hw)
|
||||
{
|
||||
u32 manc;
|
||||
u32 fwsm, factps;
|
||||
bool ret_val = FALSE;
|
||||
|
||||
DEBUGFUNC("e1000_enable_mng_pass_thru");
|
||||
|
||||
if (!hw->mac.asf_firmware_present)
|
||||
goto out;
|
||||
return FALSE;
|
||||
|
||||
manc = E1000_READ_REG(hw, E1000_MANC);
|
||||
|
||||
if (!(manc & E1000_MANC_RCV_TCO_EN))
|
||||
goto out;
|
||||
return FALSE;
|
||||
|
||||
if (hw->mac.has_fwsm) {
|
||||
fwsm = E1000_READ_REG(hw, E1000_FWSM);
|
||||
@@ -375,10 +362,8 @@ bool e1000_enable_mng_pass_thru(struct e1000_hw *hw)
|
||||
|
||||
if (!(factps & E1000_FACTPS_MNGCG) &&
|
||||
((fwsm & E1000_FWSM_MODE_MASK) ==
|
||||
(e1000_mng_mode_pt << E1000_FWSM_MODE_SHIFT))) {
|
||||
ret_val = TRUE;
|
||||
goto out;
|
||||
}
|
||||
(e1000_mng_mode_pt << E1000_FWSM_MODE_SHIFT)))
|
||||
return TRUE;
|
||||
} else if ((hw->mac.type == e1000_82574) ||
|
||||
(hw->mac.type == e1000_82583)) {
|
||||
u16 data;
|
||||
@@ -388,18 +373,14 @@ bool e1000_enable_mng_pass_thru(struct e1000_hw *hw)
|
||||
|
||||
if (!(factps & E1000_FACTPS_MNGCG) &&
|
||||
((data & E1000_NVM_INIT_CTRL2_MNGM) ==
|
||||
(e1000_mng_mode_pt << 13))) {
|
||||
ret_val = TRUE;
|
||||
goto out;
|
||||
}
|
||||
(e1000_mng_mode_pt << 13)))
|
||||
return TRUE;
|
||||
} else if ((manc & E1000_MANC_SMBUS_EN) &&
|
||||
!(manc & E1000_MANC_ASF_EN)) {
|
||||
ret_val = TRUE;
|
||||
goto out;
|
||||
!(manc & E1000_MANC_ASF_EN)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -414,33 +395,30 @@ out:
|
||||
s32 e1000_host_interface_command(struct e1000_hw *hw, u8 *buffer, u32 length)
|
||||
{
|
||||
u32 hicr, i;
|
||||
s32 ret_val = E1000_SUCCESS;
|
||||
|
||||
DEBUGFUNC("e1000_host_interface_command");
|
||||
|
||||
if (!(hw->mac.arc_subsystem_valid)) {
|
||||
DEBUGOUT("Hardware doesn't support host interface command.\n");
|
||||
goto out;
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
|
||||
if (!hw->mac.asf_firmware_present) {
|
||||
DEBUGOUT("Firmware is not present.\n");
|
||||
goto out;
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
|
||||
if (length == 0 || length & 0x3 ||
|
||||
length > E1000_HI_MAX_BLOCK_BYTE_LENGTH) {
|
||||
DEBUGOUT("Buffer length failure.\n");
|
||||
ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
goto out;
|
||||
return -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
}
|
||||
|
||||
/* Check that the host interface is enabled. */
|
||||
hicr = E1000_READ_REG(hw, E1000_HICR);
|
||||
if ((hicr & E1000_HICR_EN) == 0) {
|
||||
if (!(hicr & E1000_HICR_EN)) {
|
||||
DEBUGOUT("E1000_HOST_EN bit disabled.\n");
|
||||
ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
goto out;
|
||||
return -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
}
|
||||
|
||||
/* Calculate length in DWORDs */
|
||||
@@ -451,10 +429,8 @@ s32 e1000_host_interface_command(struct e1000_hw *hw, u8 *buffer, u32 length)
|
||||
* into the ram area.
|
||||
*/
|
||||
for (i = 0; i < length; i++)
|
||||
E1000_WRITE_REG_ARRAY_DWORD(hw,
|
||||
E1000_HOST_IF,
|
||||
i,
|
||||
*((u32 *)buffer + i));
|
||||
E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF, i,
|
||||
*((u32 *)buffer + i));
|
||||
|
||||
/* Setting this bit tells the ARC that a new command is pending. */
|
||||
E1000_WRITE_REG(hw, E1000_HICR, hicr | E1000_HICR_C);
|
||||
@@ -470,16 +446,134 @@ s32 e1000_host_interface_command(struct e1000_hw *hw, u8 *buffer, u32 length)
|
||||
if (i == E1000_HI_COMMAND_TIMEOUT ||
|
||||
(!(E1000_READ_REG(hw, E1000_HICR) & E1000_HICR_SV))) {
|
||||
DEBUGOUT("Command has failed with no status valid.\n");
|
||||
ret_val = -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
goto out;
|
||||
return -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
}
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
*((u32 *)buffer + i) = E1000_READ_REG_ARRAY_DWORD(hw,
|
||||
E1000_HOST_IF,
|
||||
i);
|
||||
E1000_HOST_IF,
|
||||
i);
|
||||
|
||||
out:
|
||||
return ret_val;
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
/**
|
||||
* e1000_load_firmware - Writes proxy FW code buffer to host interface
|
||||
* and execute.
|
||||
* @hw: pointer to the HW structure
|
||||
* @buffer: contains a firmware to write
|
||||
* @length: the byte length of the buffer, must be multiple of 4 bytes
|
||||
*
|
||||
* Upon success returns E1000_SUCCESS, returns E1000_ERR_CONFIG if not enabled
|
||||
* in HW else returns E1000_ERR_HOST_INTERFACE_COMMAND.
|
||||
**/
|
||||
s32 e1000_load_firmware(struct e1000_hw *hw, u8 *buffer, u32 length)
|
||||
{
|
||||
u32 hicr, hibba, fwsm, icr, i;
|
||||
|
||||
DEBUGFUNC("e1000_load_firmware");
|
||||
|
||||
if (hw->mac.type < e1000_i210) {
|
||||
DEBUGOUT("Hardware doesn't support loading FW by the driver\n");
|
||||
return -E1000_ERR_CONFIG;
|
||||
}
|
||||
|
||||
/* Check that the host interface is enabled. */
|
||||
hicr = E1000_READ_REG(hw, E1000_HICR);
|
||||
if (!(hicr & E1000_HICR_EN)) {
|
||||
DEBUGOUT("E1000_HOST_EN bit disabled.\n");
|
||||
return -E1000_ERR_CONFIG;
|
||||
}
|
||||
if (!(hicr & E1000_HICR_MEMORY_BASE_EN)) {
|
||||
DEBUGOUT("E1000_HICR_MEMORY_BASE_EN bit disabled.\n");
|
||||
return -E1000_ERR_CONFIG;
|
||||
}
|
||||
|
||||
if (length == 0 || length & 0x3 || length > E1000_HI_FW_MAX_LENGTH) {
|
||||
DEBUGOUT("Buffer length failure.\n");
|
||||
return -E1000_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
/* Clear notification from ROM-FW by reading ICR register */
|
||||
icr = E1000_READ_REG(hw, E1000_ICR_V2);
|
||||
|
||||
/* Reset ROM-FW */
|
||||
hicr = E1000_READ_REG(hw, E1000_HICR);
|
||||
hicr |= E1000_HICR_FW_RESET_ENABLE;
|
||||
E1000_WRITE_REG(hw, E1000_HICR, hicr);
|
||||
hicr |= E1000_HICR_FW_RESET;
|
||||
E1000_WRITE_REG(hw, E1000_HICR, hicr);
|
||||
E1000_WRITE_FLUSH(hw);
|
||||
|
||||
/* Wait till MAC notifies about its readiness after ROM-FW reset */
|
||||
for (i = 0; i < (E1000_HI_COMMAND_TIMEOUT * 2); i++) {
|
||||
icr = E1000_READ_REG(hw, E1000_ICR_V2);
|
||||
if (icr & E1000_ICR_MNG)
|
||||
break;
|
||||
msec_delay(1);
|
||||
}
|
||||
|
||||
/* Check for timeout */
|
||||
if (i == E1000_HI_COMMAND_TIMEOUT) {
|
||||
DEBUGOUT("FW reset failed.\n");
|
||||
return -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
}
|
||||
|
||||
/* Wait till MAC is ready to accept new FW code */
|
||||
for (i = 0; i < E1000_HI_COMMAND_TIMEOUT; i++) {
|
||||
fwsm = E1000_READ_REG(hw, E1000_FWSM);
|
||||
if ((fwsm & E1000_FWSM_FW_VALID) &&
|
||||
((fwsm & E1000_FWSM_MODE_MASK) >> E1000_FWSM_MODE_SHIFT ==
|
||||
E1000_FWSM_HI_EN_ONLY_MODE))
|
||||
break;
|
||||
msec_delay(1);
|
||||
}
|
||||
|
||||
/* Check for timeout */
|
||||
if (i == E1000_HI_COMMAND_TIMEOUT) {
|
||||
DEBUGOUT("FW reset failed.\n");
|
||||
return -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
}
|
||||
|
||||
/* Calculate length in DWORDs */
|
||||
length >>= 2;
|
||||
|
||||
/*
|
||||
* The device driver writes the relevant FW code block
|
||||
* into the ram area in DWORDs via 1kB ram addressing window.
|
||||
*/
|
||||
for (i = 0; i < length; i++) {
|
||||
if (!(i % E1000_HI_FW_BLOCK_DWORD_LENGTH)) {
|
||||
/* Point to correct 1kB ram window */
|
||||
hibba = E1000_HI_FW_BASE_ADDRESS +
|
||||
((E1000_HI_FW_BLOCK_DWORD_LENGTH << 2) *
|
||||
(i / E1000_HI_FW_BLOCK_DWORD_LENGTH));
|
||||
|
||||
E1000_WRITE_REG(hw, E1000_HIBBA, hibba);
|
||||
}
|
||||
|
||||
E1000_WRITE_REG_ARRAY_DWORD(hw, E1000_HOST_IF,
|
||||
i % E1000_HI_FW_BLOCK_DWORD_LENGTH,
|
||||
*((u32 *)buffer + i));
|
||||
}
|
||||
|
||||
/* Setting this bit tells the ARC that a new FW is ready to execute. */
|
||||
hicr = E1000_READ_REG(hw, E1000_HICR);
|
||||
E1000_WRITE_REG(hw, E1000_HICR, hicr | E1000_HICR_C);
|
||||
|
||||
for (i = 0; i < E1000_HI_COMMAND_TIMEOUT; i++) {
|
||||
hicr = E1000_READ_REG(hw, E1000_HICR);
|
||||
if (!(hicr & E1000_HICR_C))
|
||||
break;
|
||||
msec_delay(1);
|
||||
}
|
||||
|
||||
/* Check for successful FW start. */
|
||||
if (i == E1000_HI_COMMAND_TIMEOUT) {
|
||||
DEBUGOUT("New FW did not start within timeout period.\n");
|
||||
return -E1000_ERR_HOST_INTERFACE_COMMAND;
|
||||
}
|
||||
|
||||
return E1000_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2012, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_manage.h,v 1.1.4.1.6.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_MANAGE_H_
|
||||
#define _E1000_MANAGE_H_
|
||||
@@ -39,14 +39,15 @@ bool e1000_check_mng_mode_generic(struct e1000_hw *hw);
|
||||
bool e1000_enable_tx_pkt_filtering_generic(struct e1000_hw *hw);
|
||||
s32 e1000_mng_enable_host_if_generic(struct e1000_hw *hw);
|
||||
s32 e1000_mng_host_if_write_generic(struct e1000_hw *hw, u8 *buffer,
|
||||
u16 length, u16 offset, u8 *sum);
|
||||
u16 length, u16 offset, u8 *sum);
|
||||
s32 e1000_mng_write_cmd_header_generic(struct e1000_hw *hw,
|
||||
struct e1000_host_mng_command_header *hdr);
|
||||
struct e1000_host_mng_command_header *hdr);
|
||||
s32 e1000_mng_write_dhcp_info_generic(struct e1000_hw *hw,
|
||||
u8 *buffer, u16 length);
|
||||
u8 *buffer, u16 length);
|
||||
bool e1000_enable_mng_pass_thru(struct e1000_hw *hw);
|
||||
u8 e1000_calculate_checksum(u8 *buffer, u32 length);
|
||||
s32 e1000_host_interface_command(struct e1000_hw *hw, u8 *buffer, u32 length);
|
||||
s32 e1000_load_firmware(struct e1000_hw *hw, u8 *buffer, u32 length);
|
||||
|
||||
enum e1000_mng_mode {
|
||||
e1000_mng_mode_none = 0,
|
||||
@@ -56,35 +57,40 @@ enum e1000_mng_mode {
|
||||
e1000_mng_mode_host_if_only
|
||||
};
|
||||
|
||||
#define E1000_FACTPS_MNGCG 0x20000000
|
||||
#define E1000_FACTPS_MNGCG 0x20000000
|
||||
|
||||
#define E1000_FWSM_MODE_MASK 0xE
|
||||
#define E1000_FWSM_MODE_SHIFT 1
|
||||
#define E1000_FWSM_MODE_MASK 0xE
|
||||
#define E1000_FWSM_MODE_SHIFT 1
|
||||
#define E1000_FWSM_FW_VALID 0x00008000
|
||||
#define E1000_FWSM_HI_EN_ONLY_MODE 0x4
|
||||
|
||||
#define E1000_MNG_IAMT_MODE 0x3
|
||||
#define E1000_MNG_DHCP_COOKIE_LENGTH 0x10
|
||||
#define E1000_MNG_DHCP_COOKIE_OFFSET 0x6F0
|
||||
#define E1000_MNG_DHCP_COMMAND_TIMEOUT 10
|
||||
#define E1000_MNG_DHCP_TX_PAYLOAD_CMD 64
|
||||
#define E1000_MNG_DHCP_COOKIE_STATUS_PARSING 0x1
|
||||
#define E1000_MNG_DHCP_COOKIE_STATUS_VLAN 0x2
|
||||
#define E1000_MNG_IAMT_MODE 0x3
|
||||
#define E1000_MNG_DHCP_COOKIE_LENGTH 0x10
|
||||
#define E1000_MNG_DHCP_COOKIE_OFFSET 0x6F0
|
||||
#define E1000_MNG_DHCP_COMMAND_TIMEOUT 10
|
||||
#define E1000_MNG_DHCP_TX_PAYLOAD_CMD 64
|
||||
#define E1000_MNG_DHCP_COOKIE_STATUS_PARSING 0x1
|
||||
#define E1000_MNG_DHCP_COOKIE_STATUS_VLAN 0x2
|
||||
|
||||
#define E1000_VFTA_ENTRY_SHIFT 5
|
||||
#define E1000_VFTA_ENTRY_MASK 0x7F
|
||||
#define E1000_VFTA_ENTRY_BIT_SHIFT_MASK 0x1F
|
||||
#define E1000_VFTA_ENTRY_SHIFT 5
|
||||
#define E1000_VFTA_ENTRY_MASK 0x7F
|
||||
#define E1000_VFTA_ENTRY_BIT_SHIFT_MASK 0x1F
|
||||
|
||||
#define E1000_HI_MAX_BLOCK_BYTE_LENGTH 1792 /* Num of bytes in range */
|
||||
#define E1000_HI_MAX_BLOCK_DWORD_LENGTH 448 /* Num of dwords in range */
|
||||
#define E1000_HI_COMMAND_TIMEOUT 500 /* Process HI command limit */
|
||||
|
||||
#define E1000_HICR_EN 0x01 /* Enable bit - RO */
|
||||
#define E1000_HI_MAX_BLOCK_BYTE_LENGTH 1792 /* Num of bytes in range */
|
||||
#define E1000_HI_MAX_BLOCK_DWORD_LENGTH 448 /* Num of dwords in range */
|
||||
#define E1000_HI_COMMAND_TIMEOUT 500 /* Process HI cmd limit */
|
||||
#define E1000_HI_FW_BASE_ADDRESS 0x10000
|
||||
#define E1000_HI_FW_MAX_LENGTH (64 * 1024) /* Num of bytes */
|
||||
#define E1000_HI_FW_BLOCK_DWORD_LENGTH 256 /* Num of DWORDs per page */
|
||||
#define E1000_HICR_MEMORY_BASE_EN 0x200 /* MB Enable bit - RO */
|
||||
#define E1000_HICR_EN 0x01 /* Enable bit - RO */
|
||||
/* Driver sets this bit when done to put command in RAM */
|
||||
#define E1000_HICR_C 0x02
|
||||
#define E1000_HICR_SV 0x04 /* Status Validity */
|
||||
#define E1000_HICR_FW_RESET_ENABLE 0x40
|
||||
#define E1000_HICR_FW_RESET 0x80
|
||||
#define E1000_HICR_C 0x02
|
||||
#define E1000_HICR_SV 0x04 /* Status Validity */
|
||||
#define E1000_HICR_FW_RESET_ENABLE 0x40
|
||||
#define E1000_HICR_FW_RESET 0x80
|
||||
|
||||
/* Intel(R) Active Management Technology signature */
|
||||
#define E1000_IAMT_SIGNATURE 0x544D4149
|
||||
#define E1000_IAMT_SIGNATURE 0x544D4149
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_mbx.c,v 1.1.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#include "e1000_mbx.h"
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_mbx.h,v 1.1.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_MBX_H_
|
||||
#define _E1000_MBX_H_
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2011, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_nvm.c,v 1.3.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#include "e1000_api.h"
|
||||
|
||||
@@ -313,8 +313,7 @@ static void e1000_standby_nvm(struct e1000_hw *hw)
|
||||
usec_delay(nvm->delay_usec);
|
||||
|
||||
e1000_lower_eec_clk(hw, &eecd);
|
||||
} else
|
||||
if (nvm->type == e1000_nvm_eeprom_spi) {
|
||||
} else if (nvm->type == e1000_nvm_eeprom_spi) {
|
||||
/* Toggle CS to flush commands */
|
||||
eecd |= E1000_EECD_CS;
|
||||
E1000_WRITE_REG(hw, E1000_EECD, eecd);
|
||||
@@ -394,13 +393,13 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw)
|
||||
/* Set CS */
|
||||
eecd |= E1000_EECD_CS;
|
||||
E1000_WRITE_REG(hw, E1000_EECD, eecd);
|
||||
} else
|
||||
if (nvm->type == e1000_nvm_eeprom_spi) {
|
||||
} else if (nvm->type == e1000_nvm_eeprom_spi) {
|
||||
u16 timeout = NVM_MAX_RETRY_SPI;
|
||||
|
||||
/* Clear SK and CS */
|
||||
eecd &= ~(E1000_EECD_CS | E1000_EECD_SK);
|
||||
E1000_WRITE_REG(hw, E1000_EECD, eecd);
|
||||
E1000_WRITE_FLUSH(hw);
|
||||
usec_delay(1);
|
||||
|
||||
/*
|
||||
@@ -411,7 +410,7 @@ static s32 e1000_ready_nvm_eeprom(struct e1000_hw *hw)
|
||||
*/
|
||||
while (timeout) {
|
||||
e1000_shift_out_eec_bits(hw, NVM_RDSR_OPCODE_SPI,
|
||||
hw->nvm.opcode_bits);
|
||||
hw->nvm.opcode_bits);
|
||||
spi_stat_reg = (u8)e1000_shift_in_eec_bits(hw, 8);
|
||||
if (!(spi_stat_reg & NVM_STATUS_RDY_SPI))
|
||||
break;
|
||||
@@ -506,7 +505,7 @@ out:
|
||||
* Reads a 16 bit word from the EEPROM.
|
||||
**/
|
||||
s32 e1000_read_nvm_microwire(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
u16 *data)
|
||||
u16 *data)
|
||||
{
|
||||
struct e1000_nvm_info *nvm = &hw->nvm;
|
||||
u32 i = 0;
|
||||
@@ -593,7 +592,7 @@ s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
|
||||
break;
|
||||
|
||||
data[i] = (E1000_READ_REG(hw, E1000_EERD) >>
|
||||
E1000_NVM_RW_REG_DATA);
|
||||
E1000_NVM_RW_REG_DATA);
|
||||
}
|
||||
|
||||
out:
|
||||
@@ -646,7 +645,7 @@ s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
|
||||
|
||||
/* Send the WRITE ENABLE command (8 bit opcode) */
|
||||
e1000_shift_out_eec_bits(hw, NVM_WREN_OPCODE_SPI,
|
||||
nvm->opcode_bits);
|
||||
nvm->opcode_bits);
|
||||
|
||||
e1000_standby_nvm(hw);
|
||||
|
||||
@@ -660,7 +659,7 @@ s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
|
||||
/* Send the Write command (8-bit opcode + addr) */
|
||||
e1000_shift_out_eec_bits(hw, write_opcode, nvm->opcode_bits);
|
||||
e1000_shift_out_eec_bits(hw, (u16)((offset + widx) * 2),
|
||||
nvm->address_bits);
|
||||
nvm->address_bits);
|
||||
|
||||
/* Loop to allow for up to whole page write of eeprom */
|
||||
while (widx < words) {
|
||||
@@ -697,7 +696,7 @@ out:
|
||||
* EEPROM will most likely contain an invalid checksum.
|
||||
**/
|
||||
s32 e1000_write_nvm_microwire(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
u16 *data)
|
||||
u16 *data)
|
||||
{
|
||||
struct e1000_nvm_info *nvm = &hw->nvm;
|
||||
s32 ret_val;
|
||||
@@ -727,7 +726,7 @@ s32 e1000_write_nvm_microwire(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
goto release;
|
||||
|
||||
e1000_shift_out_eec_bits(hw, NVM_EWEN_OPCODE_MICROWIRE,
|
||||
(u16)(nvm->opcode_bits + 2));
|
||||
(u16)(nvm->opcode_bits + 2));
|
||||
|
||||
e1000_shift_out_eec_bits(hw, 0, (u16)(nvm->address_bits - 2));
|
||||
|
||||
@@ -735,10 +734,10 @@ s32 e1000_write_nvm_microwire(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
|
||||
while (words_written < words) {
|
||||
e1000_shift_out_eec_bits(hw, NVM_WRITE_OPCODE_MICROWIRE,
|
||||
nvm->opcode_bits);
|
||||
nvm->opcode_bits);
|
||||
|
||||
e1000_shift_out_eec_bits(hw, (u16)(offset + words_written),
|
||||
nvm->address_bits);
|
||||
nvm->address_bits);
|
||||
|
||||
e1000_shift_out_eec_bits(hw, data[words_written], 16);
|
||||
|
||||
@@ -763,7 +762,7 @@ s32 e1000_write_nvm_microwire(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
}
|
||||
|
||||
e1000_shift_out_eec_bits(hw, NVM_EWDS_OPCODE_MICROWIRE,
|
||||
(u16)(nvm->opcode_bits + 2));
|
||||
(u16)(nvm->opcode_bits + 2));
|
||||
|
||||
e1000_shift_out_eec_bits(hw, 0, (u16)(nvm->address_bits - 2));
|
||||
|
||||
@@ -784,7 +783,7 @@ out:
|
||||
* the value in pba_num.
|
||||
**/
|
||||
s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num,
|
||||
u32 pba_num_size)
|
||||
u32 pba_num_size)
|
||||
{
|
||||
s32 ret_val;
|
||||
u16 nvm_data;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2011, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_nvm.h,v 1.2.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_NVM_H_
|
||||
#define _E1000_NVM_H_
|
||||
@@ -45,25 +45,23 @@ s32 e1000_acquire_nvm_generic(struct e1000_hw *hw);
|
||||
s32 e1000_poll_eerd_eewr_done(struct e1000_hw *hw, int ee_reg);
|
||||
s32 e1000_read_mac_addr_generic(struct e1000_hw *hw);
|
||||
s32 e1000_read_pba_string_generic(struct e1000_hw *hw, u8 *pba_num,
|
||||
u32 pba_num_size);
|
||||
u32 pba_num_size);
|
||||
s32 e1000_read_pba_length_generic(struct e1000_hw *hw, u32 *pba_num_size);
|
||||
s32 e1000_read_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
|
||||
s32 e1000_read_nvm_microwire(struct e1000_hw *hw, u16 offset,
|
||||
u16 words, u16 *data);
|
||||
u16 words, u16 *data);
|
||||
s32 e1000_read_nvm_eerd(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
u16 *data);
|
||||
u16 *data);
|
||||
s32 e1000_valid_led_default_generic(struct e1000_hw *hw, u16 *data);
|
||||
s32 e1000_validate_nvm_checksum_generic(struct e1000_hw *hw);
|
||||
s32 e1000_write_nvm_eewr(struct e1000_hw *hw, u16 offset,
|
||||
u16 words, u16 *data);
|
||||
s32 e1000_write_nvm_microwire(struct e1000_hw *hw, u16 offset,
|
||||
u16 words, u16 *data);
|
||||
u16 words, u16 *data);
|
||||
s32 e1000_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words,
|
||||
u16 *data);
|
||||
u16 *data);
|
||||
s32 e1000_update_nvm_checksum_generic(struct e1000_hw *hw);
|
||||
void e1000_stop_nvm(struct e1000_hw *hw);
|
||||
void e1000_release_nvm_generic(struct e1000_hw *hw);
|
||||
|
||||
#define E1000_STM_OPCODE 0xDB00
|
||||
#define E1000_STM_OPCODE 0xDB00
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_osdep.c,v 1.3.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#include "e1000_api.h"
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_osdep.h,v 1.2.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
|
||||
#ifndef _FREEBSD_OS_H_
|
||||
@@ -72,14 +72,11 @@
|
||||
#define DEBUGOUT7(S,A,B,C,D,E,F,G) do {} while (0)
|
||||
|
||||
#define STATIC static
|
||||
#ifndef __HAIKU__
|
||||
#define FALSE 0
|
||||
#define false FALSE
|
||||
#define TRUE 1
|
||||
#ifndef __bool_true_false_are_defined
|
||||
#define false FALSE
|
||||
#define true TRUE
|
||||
#else
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#define CMD_MEM_WRT_INVALIDATE 0x0010 /* BIT_4 */
|
||||
#define PCI_COMMAND_REGISTER PCIR_COMMAND
|
||||
@@ -87,7 +84,8 @@
|
||||
/* Mutex used in the shared code */
|
||||
#define E1000_MUTEX struct mtx
|
||||
#define E1000_MUTEX_INIT(mutex) mtx_init((mutex), #mutex, \
|
||||
MTX_NETWORK_LOCK, MTX_DEF)
|
||||
MTX_NETWORK_LOCK, \
|
||||
MTX_DEF | MTX_DUPOK)
|
||||
#define E1000_MUTEX_DESTROY(mutex) mtx_destroy(mutex)
|
||||
#define E1000_MUTEX_LOCK(mutex) mtx_lock(mutex)
|
||||
#define E1000_MUTEX_TRYLOCK(mutex) mtx_trylock(mutex)
|
||||
@@ -101,7 +99,7 @@ typedef int64_t s64;
|
||||
typedef int32_t s32;
|
||||
typedef int16_t s16;
|
||||
typedef int8_t s8;
|
||||
#ifndef __HAIKU__
|
||||
#ifndef __bool_true_false_are_defined
|
||||
typedef boolean_t bool;
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2012, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_phy.h,v 1.4.2.3.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_PHY_H_
|
||||
#define _E1000_PHY_H_
|
||||
@@ -40,6 +40,11 @@ s32 e1000_null_read_reg(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
void e1000_null_phy_generic(struct e1000_hw *hw);
|
||||
s32 e1000_null_lplu_state(struct e1000_hw *hw, bool active);
|
||||
s32 e1000_null_write_reg(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 e1000_null_set_page(struct e1000_hw *hw, u16 data);
|
||||
s32 e1000_read_i2c_byte_null(struct e1000_hw *hw, u8 byte_offset,
|
||||
u8 dev_addr, u8 *data);
|
||||
s32 e1000_write_i2c_byte_null(struct e1000_hw *hw, u8 byte_offset,
|
||||
u8 dev_addr, u8 data);
|
||||
s32 e1000_check_downshift_generic(struct e1000_hw *hw);
|
||||
s32 e1000_check_polarity_m88(struct e1000_hw *hw);
|
||||
s32 e1000_check_polarity_igp(struct e1000_hw *hw);
|
||||
@@ -67,6 +72,7 @@ s32 e1000_phy_hw_reset_generic(struct e1000_hw *hw);
|
||||
s32 e1000_phy_reset_dsp_generic(struct e1000_hw *hw);
|
||||
s32 e1000_read_kmrn_reg_generic(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_set_page_igp(struct e1000_hw *hw, u16 page);
|
||||
s32 e1000_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_read_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_read_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
@@ -80,12 +86,14 @@ s32 e1000_write_phy_reg_igp_locked(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 e1000_write_phy_reg_m88(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 e1000_phy_reset_dsp(struct e1000_hw *hw);
|
||||
s32 e1000_phy_has_link_generic(struct e1000_hw *hw, u32 iterations,
|
||||
u32 usec_interval, bool *success);
|
||||
u32 usec_interval, bool *success);
|
||||
s32 e1000_phy_init_script_igp3(struct e1000_hw *hw);
|
||||
enum e1000_phy_type e1000_get_phy_type_from_id(u32 phy_id);
|
||||
s32 e1000_determine_phy_address(struct e1000_hw *hw);
|
||||
s32 e1000_write_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 e1000_read_phy_reg_bm(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_enable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg);
|
||||
s32 e1000_disable_phy_wakeup_reg_access_bm(struct e1000_hw *hw, u16 *phy_reg);
|
||||
s32 e1000_read_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_write_phy_reg_bm2(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
void e1000_power_up_phy_copper(struct e1000_hw *hw);
|
||||
@@ -94,45 +102,62 @@ s32 e1000_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 e1000_read_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_write_phy_reg_i2c(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 e1000_read_sfp_data_byte(struct e1000_hw *hw, u16 offset, u8 *data);
|
||||
s32 e1000_write_sfp_data_byte(struct e1000_hw *hw, u16 offset, u8 data);
|
||||
s32 e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_read_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_read_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
s32 e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 e1000_write_phy_reg_hv_locked(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 e1000_write_phy_reg_page_hv(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw);
|
||||
s32 e1000_copper_link_setup_82577(struct e1000_hw *hw);
|
||||
s32 e1000_check_polarity_82577(struct e1000_hw *hw);
|
||||
s32 e1000_get_phy_info_82577(struct e1000_hw *hw);
|
||||
s32 e1000_phy_force_speed_duplex_82577(struct e1000_hw *hw);
|
||||
s32 e1000_get_cable_length_82577(struct e1000_hw *hw);
|
||||
s32 e1000_write_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 data);
|
||||
s32 e1000_read_phy_reg_gs40g(struct e1000_hw *hw, u32 offset, u16 *data);
|
||||
|
||||
#define E1000_MAX_PHY_ADDR 4
|
||||
#define E1000_MAX_PHY_ADDR 8
|
||||
|
||||
/* IGP01E1000 Specific Registers */
|
||||
#define IGP01E1000_PHY_PORT_CONFIG 0x10 /* Port Config */
|
||||
#define IGP01E1000_PHY_PORT_STATUS 0x11 /* Status */
|
||||
#define IGP01E1000_PHY_PORT_CTRL 0x12 /* Control */
|
||||
#define IGP01E1000_PHY_LINK_HEALTH 0x13 /* PHY Link Health */
|
||||
#define IGP01E1000_GMII_FIFO 0x14 /* GMII FIFO */
|
||||
#define IGP01E1000_PHY_CHANNEL_QUALITY 0x15 /* PHY Channel Quality */
|
||||
#define IGP02E1000_PHY_POWER_MGMT 0x19 /* Power Management */
|
||||
#define IGP01E1000_PHY_PAGE_SELECT 0x1F /* Page Select */
|
||||
#define BM_PHY_PAGE_SELECT 22 /* Page Select for BM */
|
||||
#define IGP_PAGE_SHIFT 5
|
||||
#define PHY_REG_MASK 0x1F
|
||||
#define IGP01E1000_PHY_PORT_CONFIG 0x10 /* Port Config */
|
||||
#define IGP01E1000_PHY_PORT_STATUS 0x11 /* Status */
|
||||
#define IGP01E1000_PHY_PORT_CTRL 0x12 /* Control */
|
||||
#define IGP01E1000_PHY_LINK_HEALTH 0x13 /* PHY Link Health */
|
||||
#define IGP01E1000_GMII_FIFO 0x14 /* GMII FIFO */
|
||||
#define IGP01E1000_PHY_CHANNEL_QUALITY 0x15 /* PHY Channel Quality */
|
||||
#define IGP02E1000_PHY_POWER_MGMT 0x19 /* Power Management */
|
||||
#define IGP01E1000_PHY_PAGE_SELECT 0x1F /* Page Select */
|
||||
#define BM_PHY_PAGE_SELECT 22 /* Page Select for BM */
|
||||
#define IGP_PAGE_SHIFT 5
|
||||
#define PHY_REG_MASK 0x1F
|
||||
|
||||
/* GS40G - I210 PHY defines */
|
||||
#define GS40G_PAGE_SELECT 0x16
|
||||
#define GS40G_PAGE_SHIFT 16
|
||||
#define GS40G_OFFSET_MASK 0xFFFF
|
||||
#define GS40G_PAGE_2 0x20000
|
||||
#define GS40G_MAC_REG2 0x15
|
||||
#define GS40G_MAC_LB 0x4140
|
||||
#define GS40G_MAC_SPEED_1G 0X0006
|
||||
#define GS40G_COPPER_SPEC 0x0010
|
||||
#define GS40G_CS_POWER_DOWN 0x0002
|
||||
|
||||
/* BM/HV Specific Registers */
|
||||
#define BM_PORT_CTRL_PAGE 769
|
||||
#define BM_PORT_GEN_CFG_REG PHY_REG(BM_PORT_CTRL_PAGE, 17)
|
||||
#define BM_PCIE_PAGE 770
|
||||
#define BM_WUC_PAGE 800
|
||||
#define BM_WUC_ADDRESS_OPCODE 0x11
|
||||
#define BM_WUC_DATA_OPCODE 0x12
|
||||
#define BM_WUC_ENABLE_PAGE BM_PORT_CTRL_PAGE
|
||||
#define BM_WUC_ENABLE_REG 17
|
||||
#define BM_WUC_ENABLE_BIT (1 << 2)
|
||||
#define BM_WUC_HOST_WU_BIT (1 << 4)
|
||||
#define BM_PORT_CTRL_PAGE 769
|
||||
#define BM_PCIE_PAGE 770
|
||||
#define BM_WUC_PAGE 800
|
||||
#define BM_WUC_ADDRESS_OPCODE 0x11
|
||||
#define BM_WUC_DATA_OPCODE 0x12
|
||||
#define BM_WUC_ENABLE_PAGE BM_PORT_CTRL_PAGE
|
||||
#define BM_WUC_ENABLE_REG 17
|
||||
#define BM_WUC_ENABLE_BIT (1 << 2)
|
||||
#define BM_WUC_HOST_WU_BIT (1 << 4)
|
||||
#define BM_WUC_ME_WU_BIT (1 << 5)
|
||||
|
||||
#define PHY_UPPER_SHIFT 21
|
||||
#define PHY_UPPER_SHIFT 21
|
||||
#define BM_PHY_REG(page, reg) \
|
||||
(((reg) & MAX_PHY_REG_ADDRESS) |\
|
||||
(((page) & 0xFFFF) << PHY_PAGE_SHIFT) |\
|
||||
@@ -144,132 +169,157 @@ s32 e1000_get_cable_length_82577(struct e1000_hw *hw);
|
||||
(((offset) >> (PHY_UPPER_SHIFT - PHY_PAGE_SHIFT)) &\
|
||||
~MAX_PHY_REG_ADDRESS)))
|
||||
|
||||
#define HV_INTC_FC_PAGE_START 768
|
||||
#define I82578_ADDR_REG 29
|
||||
#define I82577_ADDR_REG 16
|
||||
#define I82577_CFG_REG 22
|
||||
#define I82577_CFG_ASSERT_CRS_ON_TX (1 << 15)
|
||||
#define I82577_CFG_ENABLE_DOWNSHIFT (3 << 10) /* auto downshift 100/10 */
|
||||
#define I82577_CTRL_REG 23
|
||||
#define HV_INTC_FC_PAGE_START 768
|
||||
#define I82578_ADDR_REG 29
|
||||
#define I82577_ADDR_REG 16
|
||||
#define I82577_CFG_REG 22
|
||||
#define I82577_CFG_ASSERT_CRS_ON_TX (1 << 15)
|
||||
#define I82577_CFG_ENABLE_DOWNSHIFT (3 << 10) /* auto downshift 100/10 */
|
||||
#define I82577_CTRL_REG 23
|
||||
|
||||
/* 82577 specific PHY registers */
|
||||
#define I82577_PHY_CTRL_2 18
|
||||
#define I82577_PHY_LBK_CTRL 19
|
||||
#define I82577_PHY_STATUS_2 26
|
||||
#define I82577_PHY_DIAG_STATUS 31
|
||||
#define I82577_PHY_CTRL_2 18
|
||||
#define I82577_PHY_LBK_CTRL 19
|
||||
#define I82577_PHY_STATUS_2 26
|
||||
#define I82577_PHY_DIAG_STATUS 31
|
||||
|
||||
/* I82577 PHY Status 2 */
|
||||
#define I82577_PHY_STATUS2_REV_POLARITY 0x0400
|
||||
#define I82577_PHY_STATUS2_MDIX 0x0800
|
||||
#define I82577_PHY_STATUS2_SPEED_MASK 0x0300
|
||||
#define I82577_PHY_STATUS2_SPEED_1000MBPS 0x0200
|
||||
#define I82577_PHY_STATUS2_SPEED_100MBPS 0x0100
|
||||
#define I82577_PHY_STATUS2_REV_POLARITY 0x0400
|
||||
#define I82577_PHY_STATUS2_MDIX 0x0800
|
||||
#define I82577_PHY_STATUS2_SPEED_MASK 0x0300
|
||||
#define I82577_PHY_STATUS2_SPEED_1000MBPS 0x0200
|
||||
#define I82577_PHY_STATUS2_SPEED_100MBPS 0x0100
|
||||
|
||||
/* I82577 PHY Control 2 */
|
||||
#define I82577_PHY_CTRL2_AUTO_MDIX 0x0400
|
||||
#define I82577_PHY_CTRL2_FORCE_MDI_MDIX 0x0200
|
||||
#define I82577_PHY_CTRL2_MANUAL_MDIX 0x0200
|
||||
#define I82577_PHY_CTRL2_AUTO_MDI_MDIX 0x0400
|
||||
#define I82577_PHY_CTRL2_MDIX_CFG_MASK 0x0600
|
||||
|
||||
/* I82577 PHY Diagnostics Status */
|
||||
#define I82577_DSTATUS_CABLE_LENGTH 0x03FC
|
||||
#define I82577_DSTATUS_CABLE_LENGTH_SHIFT 2
|
||||
#define I82577_DSTATUS_CABLE_LENGTH 0x03FC
|
||||
#define I82577_DSTATUS_CABLE_LENGTH_SHIFT 2
|
||||
|
||||
/* 82580 PHY Power Management */
|
||||
#define E1000_82580_PHY_POWER_MGMT 0xE14
|
||||
#define E1000_82580_PM_SPD 0x0001 /* Smart Power Down */
|
||||
#define E1000_82580_PM_D0_LPLU 0x0002 /* For D0a states */
|
||||
#define E1000_82580_PM_D3_LPLU 0x0004 /* For all other states */
|
||||
#define E1000_82580_PHY_POWER_MGMT 0xE14
|
||||
#define E1000_82580_PM_SPD 0x0001 /* Smart Power Down */
|
||||
#define E1000_82580_PM_D0_LPLU 0x0002 /* For D0a states */
|
||||
#define E1000_82580_PM_D3_LPLU 0x0004 /* For all other states */
|
||||
|
||||
/* BM PHY Copper Specific Control 1 */
|
||||
#define BM_CS_CTRL1 16
|
||||
#define BM_CS_CTRL1_ENERGY_DETECT 0x0300 /* Enable Energy Detect */
|
||||
#define BM_CS_CTRL1 16
|
||||
#define BM_CS_CTRL1_ENERGY_DETECT 0x0300 /* Enable Energy Detect */
|
||||
|
||||
/* BM PHY Copper Specific Status */
|
||||
#define BM_CS_STATUS 17
|
||||
#define BM_CS_STATUS_ENERGY_DETECT 0x0010 /* Energy Detect Status */
|
||||
#define BM_CS_STATUS_LINK_UP 0x0400
|
||||
#define BM_CS_STATUS_RESOLVED 0x0800
|
||||
#define BM_CS_STATUS_SPEED_MASK 0xC000
|
||||
#define BM_CS_STATUS_SPEED_1000 0x8000
|
||||
#define BM_CS_STATUS 17
|
||||
#define BM_CS_STATUS_ENERGY_DETECT 0x0010 /* Energy Detect Status */
|
||||
#define BM_CS_STATUS_LINK_UP 0x0400
|
||||
#define BM_CS_STATUS_RESOLVED 0x0800
|
||||
#define BM_CS_STATUS_SPEED_MASK 0xC000
|
||||
#define BM_CS_STATUS_SPEED_1000 0x8000
|
||||
|
||||
/* 82577 Mobile Phy Status Register */
|
||||
#define HV_M_STATUS 26
|
||||
#define HV_M_STATUS_AUTONEG_COMPLETE 0x1000
|
||||
#define HV_M_STATUS_SPEED_MASK 0x0300
|
||||
#define HV_M_STATUS_SPEED_1000 0x0200
|
||||
#define HV_M_STATUS_LINK_UP 0x0040
|
||||
#define HV_M_STATUS 26
|
||||
#define HV_M_STATUS_AUTONEG_COMPLETE 0x1000
|
||||
#define HV_M_STATUS_SPEED_MASK 0x0300
|
||||
#define HV_M_STATUS_SPEED_1000 0x0200
|
||||
#define HV_M_STATUS_LINK_UP 0x0040
|
||||
|
||||
#define IGP01E1000_PHY_PCS_INIT_REG 0x00B4
|
||||
#define IGP01E1000_PHY_POLARITY_MASK 0x0078
|
||||
#define IGP01E1000_PHY_PCS_INIT_REG 0x00B4
|
||||
#define IGP01E1000_PHY_POLARITY_MASK 0x0078
|
||||
|
||||
#define IGP01E1000_PSCR_AUTO_MDIX 0x1000
|
||||
#define IGP01E1000_PSCR_FORCE_MDI_MDIX 0x2000 /* 0=MDI, 1=MDIX */
|
||||
#define IGP01E1000_PSCR_AUTO_MDIX 0x1000
|
||||
#define IGP01E1000_PSCR_FORCE_MDI_MDIX 0x2000 /* 0=MDI, 1=MDIX */
|
||||
|
||||
#define IGP01E1000_PSCFR_SMART_SPEED 0x0080
|
||||
#define IGP01E1000_PSCFR_SMART_SPEED 0x0080
|
||||
|
||||
/* Enable flexible speed on link-up */
|
||||
#define IGP01E1000_GMII_FLEX_SPD 0x0010
|
||||
#define IGP01E1000_GMII_SPD 0x0020 /* Enable SPD */
|
||||
#define IGP01E1000_GMII_FLEX_SPD 0x0010
|
||||
#define IGP01E1000_GMII_SPD 0x0020 /* Enable SPD */
|
||||
|
||||
#define IGP02E1000_PM_SPD 0x0001 /* Smart Power Down */
|
||||
#define IGP02E1000_PM_D0_LPLU 0x0002 /* For D0a states */
|
||||
#define IGP02E1000_PM_D3_LPLU 0x0004 /* For all other states */
|
||||
#define IGP02E1000_PM_SPD 0x0001 /* Smart Power Down */
|
||||
#define IGP02E1000_PM_D0_LPLU 0x0002 /* For D0a states */
|
||||
#define IGP02E1000_PM_D3_LPLU 0x0004 /* For all other states */
|
||||
|
||||
#define IGP01E1000_PLHR_SS_DOWNGRADE 0x8000
|
||||
#define IGP01E1000_PLHR_SS_DOWNGRADE 0x8000
|
||||
|
||||
#define IGP01E1000_PSSR_POLARITY_REVERSED 0x0002
|
||||
#define IGP01E1000_PSSR_MDIX 0x0800
|
||||
#define IGP01E1000_PSSR_SPEED_MASK 0xC000
|
||||
#define IGP01E1000_PSSR_SPEED_1000MBPS 0xC000
|
||||
#define IGP01E1000_PSSR_POLARITY_REVERSED 0x0002
|
||||
#define IGP01E1000_PSSR_MDIX 0x0800
|
||||
#define IGP01E1000_PSSR_SPEED_MASK 0xC000
|
||||
#define IGP01E1000_PSSR_SPEED_1000MBPS 0xC000
|
||||
|
||||
#define IGP02E1000_PHY_CHANNEL_NUM 4
|
||||
#define IGP02E1000_PHY_AGC_A 0x11B1
|
||||
#define IGP02E1000_PHY_AGC_B 0x12B1
|
||||
#define IGP02E1000_PHY_AGC_C 0x14B1
|
||||
#define IGP02E1000_PHY_AGC_D 0x18B1
|
||||
#define IGP02E1000_PHY_CHANNEL_NUM 4
|
||||
#define IGP02E1000_PHY_AGC_A 0x11B1
|
||||
#define IGP02E1000_PHY_AGC_B 0x12B1
|
||||
#define IGP02E1000_PHY_AGC_C 0x14B1
|
||||
#define IGP02E1000_PHY_AGC_D 0x18B1
|
||||
|
||||
#define IGP02E1000_AGC_LENGTH_SHIFT 9 /* Course - 15:13, Fine - 12:9 */
|
||||
#define IGP02E1000_AGC_LENGTH_MASK 0x7F
|
||||
#define IGP02E1000_AGC_RANGE 15
|
||||
#define IGP02E1000_AGC_LENGTH_SHIFT 9 /* Course - 15:13, Fine - 12:9 */
|
||||
#define IGP02E1000_AGC_LENGTH_MASK 0x7F
|
||||
#define IGP02E1000_AGC_RANGE 15
|
||||
|
||||
#define IGP03E1000_PHY_MISC_CTRL 0x1B
|
||||
#define IGP03E1000_PHY_MISC_DUPLEX_MANUAL_SET 0x1000 /* Manually Set Duplex */
|
||||
#define IGP03E1000_PHY_MISC_CTRL 0x1B
|
||||
#define IGP03E1000_PHY_MISC_DUPLEX_MANUAL_SET 0x1000 /* Manually Set Duplex */
|
||||
|
||||
#define E1000_CABLE_LENGTH_UNDEFINED 0xFF
|
||||
#define E1000_CABLE_LENGTH_UNDEFINED 0xFF
|
||||
|
||||
#define E1000_KMRNCTRLSTA_OFFSET 0x001F0000
|
||||
#define E1000_KMRNCTRLSTA_OFFSET_SHIFT 16
|
||||
#define E1000_KMRNCTRLSTA_REN 0x00200000
|
||||
#define E1000_KMRNCTRLSTA_CTRL_OFFSET 0x1 /* Kumeran Control */
|
||||
#define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3 /* Kumeran Diagnostic */
|
||||
#define E1000_KMRNCTRLSTA_TIMEOUTS 0x4 /* Kumeran Timeouts */
|
||||
#define E1000_KMRNCTRLSTA_INBAND_PARAM 0x9 /* Kumeran InBand Parameters */
|
||||
#define E1000_KMRNCTRLSTA_IBIST_DISABLE 0x0200 /* Kumeran IBIST Disable */
|
||||
#define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000 /* Nearend Loopback mode */
|
||||
#define E1000_KMRNCTRLSTA_K1_CONFIG 0x7
|
||||
#define E1000_KMRNCTRLSTA_K1_ENABLE 0x0002
|
||||
#define E1000_KMRNCTRLSTA_HD_CTRL 0x10 /* Kumeran HD Control */
|
||||
#define E1000_KMRNCTRLSTA_OFFSET 0x001F0000
|
||||
#define E1000_KMRNCTRLSTA_OFFSET_SHIFT 16
|
||||
#define E1000_KMRNCTRLSTA_REN 0x00200000
|
||||
#define E1000_KMRNCTRLSTA_CTRL_OFFSET 0x1 /* Kumeran Control */
|
||||
#define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3 /* Kumeran Diagnostic */
|
||||
#define E1000_KMRNCTRLSTA_TIMEOUTS 0x4 /* Kumeran Timeouts */
|
||||
#define E1000_KMRNCTRLSTA_INBAND_PARAM 0x9 /* Kumeran InBand Parameters */
|
||||
#define E1000_KMRNCTRLSTA_IBIST_DISABLE 0x0200 /* Kumeran IBIST Disable */
|
||||
#define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000 /* Nearend Loopback mode */
|
||||
#define E1000_KMRNCTRLSTA_K1_CONFIG 0x7
|
||||
#define E1000_KMRNCTRLSTA_K1_ENABLE 0x0002
|
||||
#define E1000_KMRNCTRLSTA_HD_CTRL 0x10 /* Kumeran HD Control */
|
||||
|
||||
#define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10
|
||||
#define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Control */
|
||||
#define IFE_PHY_SPECIAL_CONTROL_LED 0x1B /* PHY Special and LED Control */
|
||||
#define IFE_PHY_MDIX_CONTROL 0x1C /* MDI/MDI-X Control */
|
||||
#define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10
|
||||
#define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Control */
|
||||
#define IFE_PHY_SPECIAL_CONTROL_LED 0x1B /* PHY Special and LED Control */
|
||||
#define IFE_PHY_MDIX_CONTROL 0x1C /* MDI/MDI-X Control */
|
||||
|
||||
/* IFE PHY Extended Status Control */
|
||||
#define IFE_PESC_POLARITY_REVERSED 0x0100
|
||||
#define IFE_PESC_POLARITY_REVERSED 0x0100
|
||||
|
||||
/* IFE PHY Special Control */
|
||||
#define IFE_PSC_AUTO_POLARITY_DISABLE 0x0010
|
||||
#define IFE_PSC_FORCE_POLARITY 0x0020
|
||||
#define IFE_PSC_DISABLE_DYNAMIC_POWER_DOWN 0x0100
|
||||
#define IFE_PSC_AUTO_POLARITY_DISABLE 0x0010
|
||||
#define IFE_PSC_FORCE_POLARITY 0x0020
|
||||
#define IFE_PSC_DISABLE_DYNAMIC_POWER_DOWN 0x0100
|
||||
|
||||
/* IFE PHY Special Control and LED Control */
|
||||
#define IFE_PSCL_PROBE_MODE 0x0020
|
||||
#define IFE_PSCL_PROBE_LEDS_OFF 0x0006 /* Force LEDs 0 and 2 off */
|
||||
#define IFE_PSCL_PROBE_LEDS_ON 0x0007 /* Force LEDs 0 and 2 on */
|
||||
#define IFE_PSCL_PROBE_MODE 0x0020
|
||||
#define IFE_PSCL_PROBE_LEDS_OFF 0x0006 /* Force LEDs 0 and 2 off */
|
||||
#define IFE_PSCL_PROBE_LEDS_ON 0x0007 /* Force LEDs 0 and 2 on */
|
||||
|
||||
/* IFE PHY MDIX Control */
|
||||
#define IFE_PMC_MDIX_STATUS 0x0020 /* 1=MDI-X, 0=MDI */
|
||||
#define IFE_PMC_FORCE_MDIX 0x0040 /* 1=force MDI-X, 0=force MDI */
|
||||
#define IFE_PMC_AUTO_MDIX 0x0080 /* 1=enable auto MDI/MDI-X, 0=disable */
|
||||
#define IFE_PMC_MDIX_STATUS 0x0020 /* 1=MDI-X, 0=MDI */
|
||||
#define IFE_PMC_FORCE_MDIX 0x0040 /* 1=force MDI-X, 0=force MDI */
|
||||
#define IFE_PMC_AUTO_MDIX 0x0080 /* 1=enable auto, 0=disable */
|
||||
|
||||
/* SFP modules ID memory locations */
|
||||
#define E1000_SFF_IDENTIFIER_OFFSET 0x00
|
||||
#define E1000_SFF_IDENTIFIER_SFF 0x02
|
||||
#define E1000_SFF_IDENTIFIER_SFP 0x03
|
||||
|
||||
#define E1000_SFF_ETH_FLAGS_OFFSET 0x06
|
||||
/* Flags for SFP modules compatible with ETH up to 1Gb */
|
||||
struct sfp_e1000_flags {
|
||||
u8 e1000_base_sx:1;
|
||||
u8 e1000_base_lx:1;
|
||||
u8 e1000_base_cx:1;
|
||||
u8 e1000_base_t:1;
|
||||
u8 e100_base_lx:1;
|
||||
u8 e100_base_fx:1;
|
||||
u8 e10_base_bx10:1;
|
||||
u8 e10_base_px:1;
|
||||
};
|
||||
|
||||
/* Vendor OUIs: format of OUI is 0x[byte0][byte1][byte2][00] */
|
||||
#define E1000_SFF_VENDOR_OUI_TYCO 0x00407600
|
||||
#define E1000_SFF_VENDOR_OUI_FTL 0x00906500
|
||||
#define E1000_SFF_VENDOR_OUI_AVAGO 0x00176A00
|
||||
#define E1000_SFF_VENDOR_OUI_INTEL 0x001B2100
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2011, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,27 +30,27 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_vf.c,v 1.1.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
|
||||
#include "e1000_api.h"
|
||||
|
||||
|
||||
static s32 e1000_init_phy_params_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_init_nvm_params_vf(struct e1000_hw *hw);
|
||||
static void e1000_release_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_acquire_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_setup_link_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_get_bus_info_pcie_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_init_mac_params_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_check_for_link_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed,
|
||||
u16 *duplex);
|
||||
static s32 e1000_init_hw_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_reset_hw_vf(struct e1000_hw *hw);
|
||||
static void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, u8 *, u32);
|
||||
static void e1000_rar_set_vf(struct e1000_hw *, u8 *, u32);
|
||||
static s32 e1000_read_mac_addr_vf(struct e1000_hw *);
|
||||
static s32 e1000_init_phy_params_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_init_nvm_params_vf(struct e1000_hw *hw);
|
||||
static void e1000_release_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_acquire_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_setup_link_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_get_bus_info_pcie_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_init_mac_params_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_check_for_link_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed,
|
||||
u16 *duplex);
|
||||
static s32 e1000_init_hw_vf(struct e1000_hw *hw);
|
||||
static s32 e1000_reset_hw_vf(struct e1000_hw *hw);
|
||||
static void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, u8 *, u32);
|
||||
static void e1000_rar_set_vf(struct e1000_hw *, u8 *, u32);
|
||||
static s32 e1000_read_mac_addr_vf(struct e1000_hw *);
|
||||
|
||||
/**
|
||||
* e1000_init_phy_params_vf - Inits PHY params
|
||||
@@ -219,7 +219,7 @@ static s32 e1000_get_bus_info_pcie_vf(struct e1000_hw *hw)
|
||||
* the status register's data which is often stale and inaccurate.
|
||||
**/
|
||||
static s32 e1000_get_link_up_info_vf(struct e1000_hw *hw, u16 *speed,
|
||||
u16 *duplex)
|
||||
u16 *duplex)
|
||||
{
|
||||
s32 status;
|
||||
|
||||
@@ -288,7 +288,7 @@ static s32 e1000_reset_hw_vf(struct e1000_hw *hw)
|
||||
ret_val = mbx->ops.read_posted(hw, msgbuf, 3, 0);
|
||||
if (!ret_val) {
|
||||
if (msgbuf[0] == (E1000_VF_RESET |
|
||||
E1000_VT_MSGTYPE_ACK))
|
||||
E1000_VT_MSGTYPE_ACK))
|
||||
memcpy(hw->mac.perm_addr, addr, 6);
|
||||
else
|
||||
ret_val = -E1000_ERR_MAC_INIT;
|
||||
@@ -369,11 +369,22 @@ static u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr)
|
||||
bit_shift++;
|
||||
|
||||
hash_value = hash_mask & (((mc_addr[4] >> (8 - bit_shift)) |
|
||||
(((u16) mc_addr[5]) << bit_shift)));
|
||||
(((u16) mc_addr[5]) << bit_shift)));
|
||||
|
||||
return hash_value;
|
||||
}
|
||||
|
||||
static void e1000_write_msg_read_ack(struct e1000_hw *hw,
|
||||
u32 *msg, u16 size)
|
||||
{
|
||||
struct e1000_mbx_info *mbx = &hw->mbx;
|
||||
u32 retmsg[E1000_VFMAILBOX_SIZE];
|
||||
s32 retval = mbx->ops.write_posted(hw, msg, size, 0);
|
||||
|
||||
if (!retval)
|
||||
mbx->ops.read_posted(hw, retmsg, E1000_VFMAILBOX_SIZE, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* e1000_update_mc_addr_list_vf - Update Multicast addresses
|
||||
* @hw: pointer to the HW structure
|
||||
@@ -384,9 +395,8 @@ static u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr)
|
||||
* The caller must have a packed mc_addr_list of multicast addresses.
|
||||
**/
|
||||
void e1000_update_mc_addr_list_vf(struct e1000_hw *hw,
|
||||
u8 *mc_addr_list, u32 mc_addr_count)
|
||||
u8 *mc_addr_list, u32 mc_addr_count)
|
||||
{
|
||||
struct e1000_mbx_info *mbx = &hw->mbx;
|
||||
u32 msgbuf[E1000_VFMAILBOX_SIZE];
|
||||
u16 *hash_list = (u16 *)&msgbuf[1];
|
||||
u32 hash_value;
|
||||
@@ -420,7 +430,7 @@ void e1000_update_mc_addr_list_vf(struct e1000_hw *hw,
|
||||
mc_addr_list += ETH_ADDR_LEN;
|
||||
}
|
||||
|
||||
mbx->ops.write_posted(hw, msgbuf, E1000_VFMAILBOX_SIZE, 0);
|
||||
e1000_write_msg_read_ack(hw, msgbuf, E1000_VFMAILBOX_SIZE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -431,7 +441,6 @@ void e1000_update_mc_addr_list_vf(struct e1000_hw *hw,
|
||||
**/
|
||||
void e1000_vfta_set_vf(struct e1000_hw *hw, u16 vid, bool set)
|
||||
{
|
||||
struct e1000_mbx_info *mbx = &hw->mbx;
|
||||
u32 msgbuf[2];
|
||||
|
||||
msgbuf[0] = E1000_VF_SET_VLAN;
|
||||
@@ -440,7 +449,7 @@ void e1000_vfta_set_vf(struct e1000_hw *hw, u16 vid, bool set)
|
||||
if (set)
|
||||
msgbuf[0] |= E1000_VF_SET_VLAN_ADD;
|
||||
|
||||
mbx->ops.write_posted(hw, msgbuf, 2, 0);
|
||||
e1000_write_msg_read_ack(hw, msgbuf, 2);
|
||||
}
|
||||
|
||||
/** e1000_rlpml_set_vf - Set the maximum receive packet length
|
||||
@@ -449,13 +458,12 @@ void e1000_vfta_set_vf(struct e1000_hw *hw, u16 vid, bool set)
|
||||
**/
|
||||
void e1000_rlpml_set_vf(struct e1000_hw *hw, u16 max_size)
|
||||
{
|
||||
struct e1000_mbx_info *mbx = &hw->mbx;
|
||||
u32 msgbuf[2];
|
||||
|
||||
msgbuf[0] = E1000_VF_SET_LPE;
|
||||
msgbuf[1] = max_size;
|
||||
|
||||
mbx->ops.write_posted(hw, msgbuf, 2, 0);
|
||||
e1000_write_msg_read_ack(hw, msgbuf, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/e1000_vf.h,v 1.1.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _E1000_VF_H_
|
||||
#define _E1000_VF_H_
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/if_em.h,v 1.5.2.5.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
|
||||
#ifndef _EM_H_DEFINED_
|
||||
@@ -212,7 +212,8 @@
|
||||
#define EM_BAR_MEM_TYPE_64BIT 0x00000004
|
||||
#define EM_MSIX_BAR 3 /* On 82575 */
|
||||
|
||||
#if !defined(SYSCTL_ADD_UQUAD)
|
||||
/* More backward compatibility */
|
||||
#if __FreeBSD_version < 900000
|
||||
#define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD
|
||||
#endif
|
||||
|
||||
@@ -418,11 +419,11 @@ struct adapter {
|
||||
u32 shadow_vfta[EM_VFTA_SIZE];
|
||||
|
||||
/* Info about the interface */
|
||||
u8 link_active;
|
||||
u16 link_active;
|
||||
u16 fc;
|
||||
u16 link_speed;
|
||||
u16 link_duplex;
|
||||
u32 smartspeed;
|
||||
u32 fc_setting;
|
||||
|
||||
struct em_int_delay_info tx_int_delay;
|
||||
struct em_int_delay_info tx_abs_int_delay;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/if_igb.h,v 1.4.2.6.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifndef _IGB_H_DEFINED_
|
||||
#define _IGB_H_DEFINED_
|
||||
@@ -52,7 +52,7 @@
|
||||
#define IGB_MAX_TXD 4096
|
||||
|
||||
/*
|
||||
* IGB_RXD: Maximum number of Transmit Descriptors
|
||||
* IGB_RXD: Maximum number of Receive Descriptors
|
||||
*
|
||||
* This value is the number of receive descriptors allocated by the driver.
|
||||
* Increasing this value allows the driver to buffer more incoming packets.
|
||||
@@ -188,9 +188,13 @@
|
||||
#define IGB_TX_BUFFER_SIZE ((uint32_t) 1514)
|
||||
#define IGB_FC_PAUSE_TIME 0x0680
|
||||
#define IGB_EEPROM_APME 0x400;
|
||||
#define IGB_QUEUE_IDLE 0
|
||||
#define IGB_QUEUE_WORKING 1
|
||||
#define IGB_QUEUE_HUNG 2
|
||||
/* Queue minimum free for use */
|
||||
#define IGB_QUEUE_THRESHOLD (adapter->num_tx_desc / 8)
|
||||
/* Queue bit defines */
|
||||
#define IGB_QUEUE_IDLE 1
|
||||
#define IGB_QUEUE_WORKING 2
|
||||
#define IGB_QUEUE_HUNG 4
|
||||
#define IGB_QUEUE_DEPLETED 8
|
||||
|
||||
/*
|
||||
* TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2011, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,11 +30,12 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/if_lem.c,v 1.3.2.10.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
#ifdef HAVE_KERNEL_OPTION_HEADERS
|
||||
#include "opt_device_polling.h"
|
||||
#include "opt_inet.h"
|
||||
#include "opt_inet6.h"
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -74,11 +75,7 @@
|
||||
#include <netinet/udp.h>
|
||||
|
||||
#include <machine/in_cksum.h>
|
||||
|
||||
#ifndef __HAIKU__
|
||||
#include <dev/led/led.h>
|
||||
#endif
|
||||
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pcireg.h>
|
||||
|
||||
@@ -88,7 +85,7 @@
|
||||
/*********************************************************************
|
||||
* Legacy Em Driver version:
|
||||
*********************************************************************/
|
||||
char lem_driver_version[] = "1.0.3";
|
||||
char lem_driver_version[] = "1.0.4";
|
||||
|
||||
/*********************************************************************
|
||||
* PCI Device ID Table
|
||||
@@ -271,22 +268,12 @@ static device_method_t lem_methods[] = {
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
#ifndef __HAIKU__
|
||||
static driver_t lem_driver = {
|
||||
"em", lem_methods, sizeof(struct adapter),
|
||||
};
|
||||
|
||||
extern devclass_t em_devclass;
|
||||
DRIVER_MODULE(lem, pci, lem_driver, em_devclass, 0, 0);
|
||||
#else
|
||||
static driver_t lem_driver = {
|
||||
"lem", lem_methods, sizeof(struct adapter),
|
||||
};
|
||||
|
||||
devclass_t lem_devclass;
|
||||
DRIVER_MODULE(lem, pci, lem_driver, lem_devclass, 0, 0);
|
||||
#endif
|
||||
|
||||
MODULE_DEPEND(lem, pci, 1, 1, 1);
|
||||
MODULE_DEPEND(lem, ether, 1, 1, 1);
|
||||
|
||||
@@ -330,6 +317,10 @@ TUNABLE_INT("hw.em.fc_setting", &lem_fc_setting);
|
||||
/* Global used in WOL setup with multiport cards */
|
||||
static int global_quad_port_a = 0;
|
||||
|
||||
#ifdef DEV_NETMAP /* see ixgbe.c for details */
|
||||
#include <dev/netmap/if_lem_netmap.h>
|
||||
#endif /* DEV_NETMAP */
|
||||
|
||||
/*********************************************************************
|
||||
* Device identification routine
|
||||
*
|
||||
@@ -400,6 +391,11 @@ lem_attach(device_t dev)
|
||||
|
||||
INIT_DEBUGOUT("lem_attach: begin");
|
||||
|
||||
if (resource_disabled("lem", device_get_unit(dev))) {
|
||||
device_printf(dev, "Disabled by device hint\n");
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
adapter = device_get_softc(dev);
|
||||
adapter->dev = adapter->osdep.dev = dev;
|
||||
EM_CORE_LOCK_INIT(adapter, device_get_nameunit(dev));
|
||||
@@ -463,7 +459,7 @@ lem_attach(device_t dev)
|
||||
|
||||
/* Sysctl for setting the interface flow control */
|
||||
lem_set_flow_cntrl(adapter, "flow_control",
|
||||
"max number of rx packets to process",
|
||||
"flow control setting",
|
||||
&adapter->fc_setting, lem_fc_setting);
|
||||
|
||||
/*
|
||||
@@ -657,11 +653,12 @@ lem_attach(device_t dev)
|
||||
/* Tell the stack that the interface is not active */
|
||||
adapter->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
|
||||
|
||||
#ifndef __HAIKU__
|
||||
adapter->led_dev = led_create(lem_led_func, adapter,
|
||||
device_get_nameunit(dev));
|
||||
#endif
|
||||
|
||||
#ifdef DEV_NETMAP
|
||||
lem_netmap_attach(adapter);
|
||||
#endif /* DEV_NETMAP */
|
||||
INIT_DEBUGOUT("lem_attach: end");
|
||||
|
||||
return (0);
|
||||
@@ -716,10 +713,8 @@ lem_detach(device_t dev)
|
||||
ether_poll_deregister(ifp);
|
||||
#endif
|
||||
|
||||
#ifndef __HAIKU__
|
||||
if (adapter->led_dev != NULL)
|
||||
led_destroy(adapter->led_dev);
|
||||
#endif
|
||||
|
||||
EM_CORE_LOCK(adapter);
|
||||
EM_TX_LOCK(adapter);
|
||||
@@ -742,6 +737,9 @@ lem_detach(device_t dev)
|
||||
callout_drain(&adapter->timer);
|
||||
callout_drain(&adapter->tx_fifo_timer);
|
||||
|
||||
#ifdef DEV_NETMAP
|
||||
netmap_detach(ifp);
|
||||
#endif /* DEV_NETMAP */
|
||||
lem_free_pci_resources(adapter);
|
||||
bus_generic_detach(dev);
|
||||
if_free(ifp);
|
||||
@@ -898,11 +896,12 @@ static int
|
||||
lem_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
{
|
||||
struct adapter *adapter = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
#ifdef INET
|
||||
struct ifaddr *ifa = (struct ifaddr *)data;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
#if defined(INET) || defined(INET6)
|
||||
struct ifaddr *ifa = (struct ifaddr *)data;
|
||||
#endif
|
||||
int error = 0;
|
||||
bool avoid_reset = FALSE;
|
||||
int error = 0;
|
||||
|
||||
if (adapter->in_detach)
|
||||
return (error);
|
||||
@@ -910,23 +909,26 @@ lem_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
|
||||
switch (command) {
|
||||
case SIOCSIFADDR:
|
||||
#ifdef INET
|
||||
if (ifa->ifa_addr->sa_family == AF_INET) {
|
||||
/*
|
||||
* XXX
|
||||
* Since resetting hardware takes a very long time
|
||||
* and results in link renegotiation we only
|
||||
* initialize the hardware only when it is absolutely
|
||||
* required.
|
||||
*/
|
||||
ifp->if_flags |= IFF_UP;
|
||||
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
|
||||
EM_CORE_LOCK(adapter);
|
||||
lem_init_locked(adapter);
|
||||
EM_CORE_UNLOCK(adapter);
|
||||
}
|
||||
arp_ifinit(ifp, ifa);
|
||||
} else
|
||||
if (ifa->ifa_addr->sa_family == AF_INET)
|
||||
avoid_reset = TRUE;
|
||||
#endif
|
||||
#ifdef INET6
|
||||
if (ifa->ifa_addr->sa_family == AF_INET6)
|
||||
avoid_reset = TRUE;
|
||||
#endif
|
||||
/*
|
||||
** Calling init results in link renegotiation,
|
||||
** so we avoid doing it when possible.
|
||||
*/
|
||||
if (avoid_reset) {
|
||||
ifp->if_flags |= IFF_UP;
|
||||
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
|
||||
lem_init(adapter);
|
||||
#ifdef INET
|
||||
if (!(ifp->if_flags & IFF_NOARP))
|
||||
arp_ifinit(ifp, ifa);
|
||||
#endif
|
||||
} else
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
break;
|
||||
case SIOCSIFMTU:
|
||||
@@ -1225,9 +1227,6 @@ lem_init_locked(struct adapter *adapter)
|
||||
/* AMT based hardware can now take control from firmware */
|
||||
if (adapter->has_manage && adapter->has_amt)
|
||||
lem_get_hw_control(adapter);
|
||||
|
||||
/* Don't reset the phy next time init gets called */
|
||||
adapter->hw.phy.reset_disable = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1526,11 +1525,6 @@ lem_media_change(struct ifnet *ifp)
|
||||
device_printf(adapter->dev, "Unsupported media type\n");
|
||||
}
|
||||
|
||||
/* As the speed/duplex settings my have changed we need to
|
||||
* reset the PHY.
|
||||
*/
|
||||
adapter->hw.phy.reset_disable = FALSE;
|
||||
|
||||
lem_init_locked(adapter);
|
||||
EM_CORE_UNLOCK(adapter);
|
||||
|
||||
@@ -2360,7 +2354,6 @@ lem_setup_interface(device_t dev, struct adapter *adapter)
|
||||
return (-1);
|
||||
}
|
||||
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
|
||||
ifp->if_mtu = ETHERMTU;
|
||||
ifp->if_init = lem_init;
|
||||
ifp->if_softc = adapter;
|
||||
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
|
||||
@@ -2601,7 +2594,6 @@ lem_allocate_transmit_structures(struct adapter *adapter)
|
||||
device_t dev = adapter->dev;
|
||||
struct em_buffer *tx_buffer;
|
||||
int error;
|
||||
int i = 0;
|
||||
|
||||
/*
|
||||
* Create DMA tags for tx descriptors
|
||||
@@ -2631,7 +2623,7 @@ lem_allocate_transmit_structures(struct adapter *adapter)
|
||||
}
|
||||
|
||||
/* Create the descriptor buffer dma maps */
|
||||
for (i = 0; i < adapter->num_tx_desc; i++) {
|
||||
for (int i = 0; i < adapter->num_tx_desc; i++) {
|
||||
tx_buffer = &adapter->tx_buffer_area[i];
|
||||
error = bus_dmamap_create(adapter->txtag, 0, &tx_buffer->map);
|
||||
if (error != 0) {
|
||||
@@ -2656,20 +2648,37 @@ static void
|
||||
lem_setup_transmit_structures(struct adapter *adapter)
|
||||
{
|
||||
struct em_buffer *tx_buffer;
|
||||
int i = 0;
|
||||
#ifdef DEV_NETMAP
|
||||
/* we are already locked */
|
||||
struct netmap_adapter *na = NA(adapter->ifp);
|
||||
struct netmap_slot *slot = netmap_reset(na, NR_TX, 0, 0);
|
||||
#endif /* DEV_NETMAP */
|
||||
|
||||
/* Clear the old ring contents */
|
||||
bzero(adapter->tx_desc_base,
|
||||
(sizeof(struct e1000_tx_desc)) * adapter->num_tx_desc);
|
||||
|
||||
/* Free any existing TX buffers */
|
||||
for (i = 0; i < adapter->num_tx_desc; i++, tx_buffer++) {
|
||||
for (int i = 0; i < adapter->num_tx_desc; i++, tx_buffer++) {
|
||||
tx_buffer = &adapter->tx_buffer_area[i];
|
||||
bus_dmamap_sync(adapter->txtag, tx_buffer->map,
|
||||
BUS_DMASYNC_POSTWRITE);
|
||||
bus_dmamap_unload(adapter->txtag, tx_buffer->map);
|
||||
m_freem(tx_buffer->m_head);
|
||||
tx_buffer->m_head = NULL;
|
||||
#ifdef DEV_NETMAP
|
||||
if (slot) {
|
||||
/* the i-th NIC entry goes to slot si */
|
||||
int si = netmap_idx_n2k(&na->tx_rings[0], i);
|
||||
uint64_t paddr;
|
||||
void *addr;
|
||||
|
||||
addr = PNMB(slot + si, &paddr);
|
||||
adapter->tx_desc_base[si].buffer_addr = htole64(paddr);
|
||||
/* reload the map for netmap mode */
|
||||
netmap_load_map(adapter->txtag, tx_buffer->map, addr);
|
||||
}
|
||||
#endif /* DEV_NETMAP */
|
||||
tx_buffer->next_eop = -1;
|
||||
}
|
||||
|
||||
@@ -2762,12 +2771,11 @@ static void
|
||||
lem_free_transmit_structures(struct adapter *adapter)
|
||||
{
|
||||
struct em_buffer *tx_buffer;
|
||||
int i = 0;
|
||||
|
||||
INIT_DEBUGOUT("free_transmit_structures: begin");
|
||||
|
||||
if (adapter->tx_buffer_area != NULL) {
|
||||
for (i = 0; i < adapter->num_tx_desc; i++) {
|
||||
for (int i = 0; i < adapter->num_tx_desc; i++) {
|
||||
tx_buffer = &adapter->tx_buffer_area[i];
|
||||
if (tx_buffer->m_head != NULL) {
|
||||
bus_dmamap_sync(adapter->txtag, tx_buffer->map,
|
||||
@@ -2794,13 +2802,10 @@ lem_free_transmit_structures(struct adapter *adapter)
|
||||
bus_dma_tag_destroy(adapter->txtag);
|
||||
adapter->txtag = NULL;
|
||||
}
|
||||
|
||||
#ifndef __HAIKU__
|
||||
#if __FreeBSD_version >= 800000
|
||||
if (adapter->br != NULL)
|
||||
buf_ring_free(adapter->br, M_DEVBUF);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
@@ -2975,6 +2980,12 @@ lem_txeof(struct adapter *adapter)
|
||||
|
||||
EM_TX_LOCK_ASSERT(adapter);
|
||||
|
||||
#ifdef DEV_NETMAP
|
||||
if (ifp->if_capenable & IFCAP_NETMAP) {
|
||||
selwakeuppri(&NA(ifp)->tx_rings[0].si, PI_NET);
|
||||
return;
|
||||
}
|
||||
#endif /* DEV_NETMAP */
|
||||
if (adapter->num_tx_desc_avail == adapter->num_tx_desc)
|
||||
return;
|
||||
|
||||
@@ -3205,6 +3216,11 @@ lem_setup_receive_structures(struct adapter *adapter)
|
||||
{
|
||||
struct em_buffer *rx_buffer;
|
||||
int i, error;
|
||||
#ifdef DEV_NETMAP
|
||||
/* we are already under lock */
|
||||
struct netmap_adapter *na = NA(adapter->ifp);
|
||||
struct netmap_slot *slot = netmap_reset(na, NR_RX, 0, 0);
|
||||
#endif
|
||||
|
||||
/* Reset descriptor ring */
|
||||
bzero(adapter->rx_desc_base,
|
||||
@@ -3224,6 +3240,20 @@ lem_setup_receive_structures(struct adapter *adapter)
|
||||
|
||||
/* Allocate new ones. */
|
||||
for (i = 0; i < adapter->num_rx_desc; i++) {
|
||||
#ifdef DEV_NETMAP
|
||||
if (slot) {
|
||||
/* the i-th NIC entry goes to slot si */
|
||||
int si = netmap_idx_n2k(&na->rx_rings[0], i);
|
||||
uint64_t paddr;
|
||||
void *addr;
|
||||
|
||||
addr = PNMB(slot + si, &paddr);
|
||||
netmap_load_map(adapter->rxtag, rx_buffer->map, addr);
|
||||
/* Update descriptor */
|
||||
adapter->rx_desc_base[i].buffer_addr = htole64(paddr);
|
||||
continue;
|
||||
}
|
||||
#endif /* DEV_NETMAP */
|
||||
error = lem_get_buf(adapter, i);
|
||||
if (error)
|
||||
return (error);
|
||||
@@ -3251,7 +3281,6 @@ lem_initialize_receive_unit(struct adapter *adapter)
|
||||
struct ifnet *ifp = adapter->ifp;
|
||||
u64 bus_addr;
|
||||
u32 rctl, rxcsum;
|
||||
int i = 0;
|
||||
|
||||
INIT_DEBUGOUT("lem_initialize_receive_unit: begin");
|
||||
|
||||
@@ -3277,7 +3306,7 @@ lem_initialize_receive_unit(struct adapter *adapter)
|
||||
** using the EITR register (82574 only)
|
||||
*/
|
||||
if (adapter->msix)
|
||||
for (i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 4; i++)
|
||||
E1000_WRITE_REG(&adapter->hw,
|
||||
E1000_EITR_82574(i), DEFAULT_ITR);
|
||||
|
||||
@@ -3349,6 +3378,18 @@ lem_initialize_receive_unit(struct adapter *adapter)
|
||||
* Tail Descriptor Pointers
|
||||
*/
|
||||
E1000_WRITE_REG(&adapter->hw, E1000_RDH(0), 0);
|
||||
#ifdef DEV_NETMAP
|
||||
/* preserve buffers already made available to clients */
|
||||
if (ifp->if_capenable & IFCAP_NETMAP) {
|
||||
struct netmap_adapter *na = NA(adapter->ifp);
|
||||
struct netmap_kring *kring = &na->rx_rings[0];
|
||||
int t = na->num_rx_desc - 1 - kring->nr_hwavail;
|
||||
|
||||
if (t >= na->num_rx_desc)
|
||||
t -= na->num_rx_desc;
|
||||
E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), t);
|
||||
} else
|
||||
#endif /* DEV_NETMAP */
|
||||
E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), adapter->num_rx_desc - 1);
|
||||
|
||||
return;
|
||||
@@ -3419,7 +3460,7 @@ lem_free_receive_structures(struct adapter *adapter)
|
||||
static bool
|
||||
lem_rxeof(struct adapter *adapter, int count, int *done)
|
||||
{
|
||||
struct ifnet *ifp = adapter->ifp;
|
||||
struct ifnet *ifp = adapter->ifp;;
|
||||
struct mbuf *mp;
|
||||
u8 status = 0, accept_frame = 0, eop = 0;
|
||||
u16 len, desc_len, prev_len_adj;
|
||||
@@ -3432,6 +3473,16 @@ lem_rxeof(struct adapter *adapter, int count, int *done)
|
||||
bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map,
|
||||
BUS_DMASYNC_POSTREAD);
|
||||
|
||||
#ifdef DEV_NETMAP
|
||||
if (ifp->if_capenable & IFCAP_NETMAP) {
|
||||
struct netmap_adapter *na = NA(ifp);
|
||||
na->rx_rings[0].nr_kflags |= NKR_PENDINTR;
|
||||
selwakeuppri(&na->rx_rings[0].si, PI_NET);
|
||||
EM_RX_UNLOCK(adapter);
|
||||
return (0);
|
||||
}
|
||||
#endif /* DEV_NETMAP */
|
||||
|
||||
if (!((current_desc->status) & E1000_RXD_STAT_DD)) {
|
||||
if (done != NULL)
|
||||
*done = rx_sent;
|
||||
@@ -3535,8 +3586,7 @@ lem_rxeof(struct adapter *adapter, int count, int *done)
|
||||
#endif
|
||||
if (status & E1000_RXD_STAT_VP) {
|
||||
adapter->fmp->m_pkthdr.ether_vtag =
|
||||
(le16toh(current_desc->special) &
|
||||
E1000_RXD_SPC_VLAN_MASK);
|
||||
le16toh(current_desc->special);
|
||||
adapter->fmp->m_flags |= M_VLANTAG;
|
||||
}
|
||||
#ifndef __NO_STRICT_ALIGNMENT
|
||||
@@ -3744,7 +3794,6 @@ lem_setup_vlan_hw_support(struct adapter *adapter)
|
||||
{
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
u32 reg;
|
||||
int i = 0;
|
||||
|
||||
/*
|
||||
** We get here thru init_locked, meaning
|
||||
@@ -3759,7 +3808,7 @@ lem_setup_vlan_hw_support(struct adapter *adapter)
|
||||
** A soft reset zero's out the VFTA, so
|
||||
** we need to repopulate it now.
|
||||
*/
|
||||
for (i = 0; i < EM_VFTA_SIZE; i++)
|
||||
for (int i = 0; i < EM_VFTA_SIZE; i++)
|
||||
if (adapter->shadow_vfta[i] != 0)
|
||||
E1000_WRITE_REG_ARRAY(hw, E1000_VFTA,
|
||||
i, adapter->shadow_vfta[i]);
|
||||
@@ -4027,10 +4076,9 @@ lem_enable_phy_wakeup(struct adapter *adapter)
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
u32 mreg, ret = 0;
|
||||
u16 preg;
|
||||
int i = 0;
|
||||
|
||||
/* copy MAC RARs to PHY RARs */
|
||||
for (i = 0; i < adapter->hw.mac.rar_entry_count; i++) {
|
||||
for (int i = 0; i < adapter->hw.mac.rar_entry_count; i++) {
|
||||
mreg = E1000_READ_REG(hw, E1000_RAL(i));
|
||||
e1000_write_phy_reg(hw, BM_RAR_L(i), (u16)(mreg & 0xFFFF));
|
||||
e1000_write_phy_reg(hw, BM_RAR_M(i),
|
||||
@@ -4042,7 +4090,7 @@ lem_enable_phy_wakeup(struct adapter *adapter)
|
||||
}
|
||||
|
||||
/* copy MAC MTA to PHY MTA */
|
||||
for (i = 0; i < adapter->hw.mac.mta_reg_count; i++) {
|
||||
for (int i = 0; i < adapter->hw.mac.mta_reg_count; i++) {
|
||||
mreg = E1000_READ_REG_ARRAY(hw, E1000_MTA, i);
|
||||
e1000_write_phy_reg(hw, BM_MTA(i), (u16)(mreg & 0xFFFF));
|
||||
e1000_write_phy_reg(hw, BM_MTA(i) + 1,
|
||||
@@ -4277,11 +4325,8 @@ lem_sysctl_reg_handler(SYSCTL_HANDLER_ARGS)
|
||||
struct adapter *adapter;
|
||||
u_int val;
|
||||
|
||||
#ifndef __HAIKU__
|
||||
adapter = oidp->oid_arg1;
|
||||
val = E1000_READ_REG(&adapter->hw, oidp->oid_arg2);
|
||||
#endif
|
||||
|
||||
return (sysctl_handle_int(oidp, &val, 0, req));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
|
||||
Copyright (c) 2001-2010, Intel Corporation
|
||||
Copyright (c) 2001-2011, Intel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -30,7 +30,7 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
******************************************************************************/
|
||||
/*$FreeBSD: src/sys/dev/e1000/if_lem.h,v 1.2.2.5.2.1 2010/12/21 17:09:25 kensmith Exp $*/
|
||||
/*$FreeBSD$*/
|
||||
|
||||
|
||||
#ifndef _LEM_H_DEFINED_
|
||||
@@ -217,7 +217,7 @@
|
||||
#define EM_BAR_MEM_TYPE_64BIT 0x00000004
|
||||
#define EM_MSIX_BAR 3 /* On 82575 */
|
||||
|
||||
#if !defined(SYSCTL_ADD_UQUAD)
|
||||
#if __FreeBSD_version < 900000
|
||||
#define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD
|
||||
#endif
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/jme/if_jme.c,v 1.11.2.8.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@@ -1661,7 +1661,7 @@ jme_resume(device_t dev)
|
||||
sc = device_get_softc(dev);
|
||||
|
||||
JME_LOCK(sc);
|
||||
if (pci_find_cap(sc->jme_dev, PCIY_PMG, &pmc) != 0) {
|
||||
if (pci_find_cap(sc->jme_dev, PCIY_PMG, &pmc) == 0) {
|
||||
pmstat = pci_read_config(sc->jme_dev,
|
||||
pmc + PCIR_POWER_STATUS, 2);
|
||||
/* Disable PME clear PME status. */
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/dev/jme/if_jmereg.h,v 1.6.2.2.2.1 2010/12/21 17:09:25 kensmith Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _IF_JMEREG_H
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/dev/jme/if_jmevar.h,v 1.3.2.1.6.1 2010/12/21 17:09:25 kensmith Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _IF_JMEVAR_H
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/jmphy.c,v 1.1.6.5.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* Driver for the JMicron JMP211 10/100/1000, JMP202 10/100 PHY.
|
||||
@@ -62,7 +62,7 @@ static device_method_t jmphy_methods[] = {
|
||||
DEVMETHOD(device_attach, jmphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ NULL, NULL }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t jmphy_devclass;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD: src/sys/dev/mii/jmphyreg.h,v 1.1.6.1.6.1 2010/12/21 17:09:25 kensmith Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef _DEV_MII_JMPHYREG_H_
|
||||
|
||||
@@ -71,7 +71,7 @@ static device_method_t e1000phy_methods[] = {
|
||||
DEVMETHOD(device_attach, e1000phy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t e1000phy_devclass;
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy.c,v 1.20.10.6.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* driver for generic unknown PHYs
|
||||
@@ -86,7 +86,7 @@ static device_method_t ukphy_methods[] = {
|
||||
DEVMETHOD(device_attach, ukphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t ukphy_devclass;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD: src/sys/dev/mii/ukphy_subr.c,v 1.10.2.4.2.1 2010/12/21 17:09:25 kensmith Exp $");
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
/*
|
||||
* Subroutines shared by the ukphy driver and other PHY drivers.
|
||||
|
||||
@@ -334,11 +334,7 @@ static device_method_t mskc_methods[] = {
|
||||
DEVMETHOD(device_resume, mskc_resume),
|
||||
DEVMETHOD(device_shutdown, mskc_shutdown),
|
||||
|
||||
/* bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
|
||||
|
||||
{ NULL, NULL }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t mskc_driver = {
|
||||
@@ -356,16 +352,12 @@ static device_method_t msk_methods[] = {
|
||||
DEVMETHOD(device_detach, msk_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
/* bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
|
||||
|
||||
/* MII interface */
|
||||
DEVMETHOD(miibus_readreg, msk_miibus_readreg),
|
||||
DEVMETHOD(miibus_writereg, msk_miibus_writereg),
|
||||
DEVMETHOD(miibus_statchg, msk_miibus_statchg),
|
||||
|
||||
{ NULL, NULL }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static driver_t msk_driver = {
|
||||
@@ -700,7 +692,7 @@ msk_init_rx_ring(struct msk_if_softc *sc_if)
|
||||
{
|
||||
struct msk_ring_data *rd;
|
||||
struct msk_rxdesc *rxd;
|
||||
int i, prod;
|
||||
int i, nbuf, prod;
|
||||
|
||||
MSK_IF_LOCK_ASSERT(sc_if);
|
||||
|
||||
@@ -710,11 +702,18 @@ msk_init_rx_ring(struct msk_if_softc *sc_if)
|
||||
|
||||
rd = &sc_if->msk_rdata;
|
||||
bzero(rd->msk_rx_ring, sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT);
|
||||
prod = sc_if->msk_cdata.msk_rx_prod;
|
||||
i = 0;
|
||||
for (i = prod = 0; i < MSK_RX_RING_CNT; i++) {
|
||||
rxd = &sc_if->msk_cdata.msk_rxdesc[prod];
|
||||
rxd->rx_m = NULL;
|
||||
rxd->rx_le = &rd->msk_rx_ring[prod];
|
||||
MSK_INC(prod, MSK_RX_RING_CNT);
|
||||
}
|
||||
nbuf = MSK_RX_BUF_CNT;
|
||||
prod = 0;
|
||||
/* Have controller know how to compute Rx checksum. */
|
||||
if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 &&
|
||||
(sc_if->msk_ifp->if_capenable & IFCAP_RXCSUM) != 0) {
|
||||
#ifdef MSK_64BIT_DMA
|
||||
rxd = &sc_if->msk_cdata.msk_rxdesc[prod];
|
||||
rxd->rx_m = NULL;
|
||||
rxd->rx_le = &rd->msk_rx_ring[prod];
|
||||
@@ -723,15 +722,21 @@ msk_init_rx_ring(struct msk_if_softc *sc_if)
|
||||
rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER);
|
||||
MSK_INC(prod, MSK_RX_RING_CNT);
|
||||
MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT);
|
||||
i++;
|
||||
}
|
||||
for (; i < MSK_RX_RING_CNT; i++) {
|
||||
#endif
|
||||
rxd = &sc_if->msk_cdata.msk_rxdesc[prod];
|
||||
rxd->rx_m = NULL;
|
||||
rxd->rx_le = &rd->msk_rx_ring[prod];
|
||||
rxd->rx_le->msk_addr = htole32(ETHER_HDR_LEN << 16 |
|
||||
ETHER_HDR_LEN);
|
||||
rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER);
|
||||
MSK_INC(prod, MSK_RX_RING_CNT);
|
||||
MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT);
|
||||
nbuf--;
|
||||
}
|
||||
for (i = 0; i < nbuf; i++) {
|
||||
if (msk_newbuf(sc_if, prod) != 0)
|
||||
return (ENOBUFS);
|
||||
MSK_INC(prod, MSK_RX_RING_CNT);
|
||||
MSK_RX_INC(prod, MSK_RX_RING_CNT);
|
||||
}
|
||||
|
||||
bus_dmamap_sync(sc_if->msk_cdata.msk_rx_ring_tag,
|
||||
@@ -739,10 +744,11 @@ msk_init_rx_ring(struct msk_if_softc *sc_if)
|
||||
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
|
||||
|
||||
/* Update prefetch unit. */
|
||||
sc_if->msk_cdata.msk_rx_prod = MSK_RX_RING_CNT - 1;
|
||||
sc_if->msk_cdata.msk_rx_prod = prod;
|
||||
CSR_WRITE_2(sc_if->msk_softc,
|
||||
Y2_PREF_Q_ADDR(sc_if->msk_rxq, PREF_UNIT_PUT_IDX_REG),
|
||||
sc_if->msk_cdata.msk_rx_prod);
|
||||
(sc_if->msk_cdata.msk_rx_prod + MSK_RX_RING_CNT - 1) %
|
||||
MSK_RX_RING_CNT);
|
||||
if (msk_rx_fill(sc_if, 0) != 0)
|
||||
return (ENOBUFS);
|
||||
return (0);
|
||||
@@ -753,7 +759,7 @@ msk_init_jumbo_rx_ring(struct msk_if_softc *sc_if)
|
||||
{
|
||||
struct msk_ring_data *rd;
|
||||
struct msk_rxdesc *rxd;
|
||||
int i, prod;
|
||||
int i, nbuf, prod;
|
||||
|
||||
MSK_IF_LOCK_ASSERT(sc_if);
|
||||
|
||||
@@ -764,11 +770,18 @@ msk_init_jumbo_rx_ring(struct msk_if_softc *sc_if)
|
||||
rd = &sc_if->msk_rdata;
|
||||
bzero(rd->msk_jumbo_rx_ring,
|
||||
sizeof(struct msk_rx_desc) * MSK_JUMBO_RX_RING_CNT);
|
||||
prod = sc_if->msk_cdata.msk_rx_prod;
|
||||
i = 0;
|
||||
for (i = prod = 0; i < MSK_JUMBO_RX_RING_CNT; i++) {
|
||||
rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod];
|
||||
rxd->rx_m = NULL;
|
||||
rxd->rx_le = &rd->msk_jumbo_rx_ring[prod];
|
||||
MSK_INC(prod, MSK_JUMBO_RX_RING_CNT);
|
||||
}
|
||||
nbuf = MSK_RX_BUF_CNT;
|
||||
prod = 0;
|
||||
/* Have controller know how to compute Rx checksum. */
|
||||
if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 &&
|
||||
(sc_if->msk_ifp->if_capenable & IFCAP_RXCSUM) != 0) {
|
||||
#ifdef MSK_64BIT_DMA
|
||||
rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod];
|
||||
rxd->rx_m = NULL;
|
||||
rxd->rx_le = &rd->msk_jumbo_rx_ring[prod];
|
||||
@@ -777,25 +790,33 @@ msk_init_jumbo_rx_ring(struct msk_if_softc *sc_if)
|
||||
rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER);
|
||||
MSK_INC(prod, MSK_JUMBO_RX_RING_CNT);
|
||||
MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT);
|
||||
i++;
|
||||
}
|
||||
for (; i < MSK_JUMBO_RX_RING_CNT; i++) {
|
||||
#endif
|
||||
rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[prod];
|
||||
rxd->rx_m = NULL;
|
||||
rxd->rx_le = &rd->msk_jumbo_rx_ring[prod];
|
||||
rxd->rx_le->msk_addr = htole32(ETHER_HDR_LEN << 16 |
|
||||
ETHER_HDR_LEN);
|
||||
rxd->rx_le->msk_control = htole32(OP_TCPSTART | HW_OWNER);
|
||||
MSK_INC(prod, MSK_JUMBO_RX_RING_CNT);
|
||||
MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT);
|
||||
nbuf--;
|
||||
}
|
||||
for (i = 0; i < nbuf; i++) {
|
||||
if (msk_jumbo_newbuf(sc_if, prod) != 0)
|
||||
return (ENOBUFS);
|
||||
MSK_INC(prod, MSK_JUMBO_RX_RING_CNT);
|
||||
MSK_RX_INC(prod, MSK_JUMBO_RX_RING_CNT);
|
||||
}
|
||||
|
||||
bus_dmamap_sync(sc_if->msk_cdata.msk_jumbo_rx_ring_tag,
|
||||
sc_if->msk_cdata.msk_jumbo_rx_ring_map,
|
||||
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
|
||||
|
||||
sc_if->msk_cdata.msk_rx_prod = MSK_JUMBO_RX_RING_CNT - 1;
|
||||
/* Update prefetch unit. */
|
||||
sc_if->msk_cdata.msk_rx_prod = prod;
|
||||
CSR_WRITE_2(sc_if->msk_softc,
|
||||
Y2_PREF_Q_ADDR(sc_if->msk_rxq, PREF_UNIT_PUT_IDX_REG),
|
||||
sc_if->msk_cdata.msk_rx_prod);
|
||||
(sc_if->msk_cdata.msk_rx_prod + MSK_JUMBO_RX_RING_CNT - 1) %
|
||||
MSK_JUMBO_RX_RING_CNT);
|
||||
if (msk_rx_fill(sc_if, 1) != 0)
|
||||
return (ENOBUFS);
|
||||
return (0);
|
||||
@@ -813,6 +834,7 @@ msk_init_tx_ring(struct msk_if_softc *sc_if)
|
||||
sc_if->msk_cdata.msk_tx_prod = 0;
|
||||
sc_if->msk_cdata.msk_tx_cons = 0;
|
||||
sc_if->msk_cdata.msk_tx_cnt = 0;
|
||||
sc_if->msk_cdata.msk_tx_high_addr = 0;
|
||||
|
||||
rd = &sc_if->msk_rdata;
|
||||
bzero(rd->msk_tx_ring, sizeof(struct msk_tx_desc) * MSK_TX_RING_CNT);
|
||||
@@ -834,6 +856,12 @@ msk_discard_rxbuf(struct msk_if_softc *sc_if, int idx)
|
||||
struct msk_rxdesc *rxd;
|
||||
struct mbuf *m;
|
||||
|
||||
#ifdef MSK_64BIT_DMA
|
||||
rxd = &sc_if->msk_cdata.msk_rxdesc[idx];
|
||||
rx_le = rxd->rx_le;
|
||||
rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER);
|
||||
MSK_INC(idx, MSK_RX_RING_CNT);
|
||||
#endif
|
||||
rxd = &sc_if->msk_cdata.msk_rxdesc[idx];
|
||||
m = rxd->rx_m;
|
||||
rx_le = rxd->rx_le;
|
||||
@@ -847,6 +875,12 @@ msk_discard_jumbo_rxbuf(struct msk_if_softc *sc_if, int idx)
|
||||
struct msk_rxdesc *rxd;
|
||||
struct mbuf *m;
|
||||
|
||||
#ifdef MSK_64BIT_DMA
|
||||
rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx];
|
||||
rx_le = rxd->rx_le;
|
||||
rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER);
|
||||
MSK_INC(idx, MSK_JUMBO_RX_RING_CNT);
|
||||
#endif
|
||||
rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx];
|
||||
m = rxd->rx_m;
|
||||
rx_le = rxd->rx_le;
|
||||
@@ -884,10 +918,18 @@ msk_newbuf(struct msk_if_softc *sc_if, int idx)
|
||||
KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs));
|
||||
|
||||
rxd = &sc_if->msk_cdata.msk_rxdesc[idx];
|
||||
#ifdef MSK_64BIT_DMA
|
||||
rx_le = rxd->rx_le;
|
||||
rx_le->msk_addr = htole32(MSK_ADDR_HI(segs[0].ds_addr));
|
||||
rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER);
|
||||
MSK_INC(idx, MSK_RX_RING_CNT);
|
||||
rxd = &sc_if->msk_cdata.msk_rxdesc[idx];
|
||||
#endif
|
||||
if (rxd->rx_m != NULL) {
|
||||
bus_dmamap_sync(sc_if->msk_cdata.msk_rx_tag, rxd->rx_dmamap,
|
||||
BUS_DMASYNC_POSTREAD);
|
||||
bus_dmamap_unload(sc_if->msk_cdata.msk_rx_tag, rxd->rx_dmamap);
|
||||
rxd->rx_m = NULL;
|
||||
}
|
||||
map = rxd->rx_dmamap;
|
||||
rxd->rx_dmamap = sc_if->msk_cdata.msk_rx_sparemap;
|
||||
@@ -937,11 +979,19 @@ msk_jumbo_newbuf(struct msk_if_softc *sc_if, int idx)
|
||||
KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs));
|
||||
|
||||
rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx];
|
||||
#ifdef MSK_64BIT_DMA
|
||||
rx_le = rxd->rx_le;
|
||||
rx_le->msk_addr = htole32(MSK_ADDR_HI(segs[0].ds_addr));
|
||||
rx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER);
|
||||
MSK_INC(idx, MSK_JUMBO_RX_RING_CNT);
|
||||
rxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[idx];
|
||||
#endif
|
||||
if (rxd->rx_m != NULL) {
|
||||
bus_dmamap_sync(sc_if->msk_cdata.msk_jumbo_rx_tag,
|
||||
rxd->rx_dmamap, BUS_DMASYNC_POSTREAD);
|
||||
bus_dmamap_unload(sc_if->msk_cdata.msk_jumbo_rx_tag,
|
||||
rxd->rx_dmamap);
|
||||
rxd->rx_m = NULL;
|
||||
}
|
||||
map = rxd->rx_dmamap;
|
||||
rxd->rx_dmamap = sc_if->msk_cdata.msk_jumbo_rx_sparemap;
|
||||
@@ -995,9 +1045,9 @@ msk_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
mii = device_get_softc(sc_if->msk_miibus);
|
||||
|
||||
mii_pollstat(mii);
|
||||
MSK_IF_UNLOCK(sc_if);
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
MSK_IF_UNLOCK(sc_if);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -1472,7 +1522,7 @@ mskc_reset(struct msk_softc *sc)
|
||||
|
||||
/* Clear status list. */
|
||||
bzero(sc->msk_stat_ring,
|
||||
sizeof(struct msk_stat_desc) * MSK_STAT_RING_CNT);
|
||||
sizeof(struct msk_stat_desc) * sc->msk_stat_count);
|
||||
sc->msk_stat_cons = 0;
|
||||
bus_dmamap_sync(sc->msk_stat_tag, sc->msk_stat_map,
|
||||
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
|
||||
@@ -1483,7 +1533,7 @@ mskc_reset(struct msk_softc *sc)
|
||||
CSR_WRITE_4(sc, STAT_LIST_ADDR_LO, MSK_ADDR_LO(addr));
|
||||
CSR_WRITE_4(sc, STAT_LIST_ADDR_HI, MSK_ADDR_HI(addr));
|
||||
/* Set the status list last index. */
|
||||
CSR_WRITE_2(sc, STAT_LAST_IDX, MSK_STAT_RING_CNT - 1);
|
||||
CSR_WRITE_2(sc, STAT_LAST_IDX, sc->msk_stat_count - 1);
|
||||
if (sc->msk_hw_id == CHIP_ID_YUKON_EC &&
|
||||
sc->msk_hw_rev == CHIP_REV_YU_EC_A1) {
|
||||
/* WA for dev. #4.3 */
|
||||
@@ -2083,17 +2133,33 @@ static int
|
||||
msk_status_dma_alloc(struct msk_softc *sc)
|
||||
{
|
||||
struct msk_dmamap_arg ctx;
|
||||
int error;
|
||||
bus_size_t stat_sz;
|
||||
int count, error;
|
||||
|
||||
/*
|
||||
* It seems controller requires number of status LE entries
|
||||
* is power of 2 and the maximum number of status LE entries
|
||||
* is 4096. For dual-port controllers, the number of status
|
||||
* LE entries should be large enough to hold both port's
|
||||
* status updates.
|
||||
*/
|
||||
count = 3 * MSK_RX_RING_CNT + MSK_TX_RING_CNT;
|
||||
#ifdef __HAIKU__
|
||||
// TODO check this!
|
||||
#define imin min
|
||||
#endif
|
||||
count = imin(4096, roundup2(count, 1024));
|
||||
sc->msk_stat_count = count;
|
||||
stat_sz = count * sizeof(struct msk_stat_desc);
|
||||
error = bus_dma_tag_create(
|
||||
bus_get_dma_tag(sc->msk_dev), /* parent */
|
||||
MSK_STAT_ALIGN, 0, /* alignment, boundary */
|
||||
BUS_SPACE_MAXADDR, /* lowaddr */
|
||||
BUS_SPACE_MAXADDR, /* highaddr */
|
||||
NULL, NULL, /* filter, filterarg */
|
||||
MSK_STAT_RING_SZ, /* maxsize */
|
||||
stat_sz, /* maxsize */
|
||||
1, /* nsegments */
|
||||
MSK_STAT_RING_SZ, /* maxsegsize */
|
||||
stat_sz, /* maxsegsize */
|
||||
0, /* flags */
|
||||
NULL, NULL, /* lockfunc, lockarg */
|
||||
&sc->msk_stat_tag);
|
||||
@@ -2114,9 +2180,8 @@ msk_status_dma_alloc(struct msk_softc *sc)
|
||||
}
|
||||
|
||||
ctx.msk_busaddr = 0;
|
||||
error = bus_dmamap_load(sc->msk_stat_tag,
|
||||
sc->msk_stat_map, sc->msk_stat_ring, MSK_STAT_RING_SZ,
|
||||
msk_dmamap_cb, &ctx, 0);
|
||||
error = bus_dmamap_load(sc->msk_stat_tag, sc->msk_stat_map,
|
||||
sc->msk_stat_ring, stat_sz, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT);
|
||||
if (error != 0) {
|
||||
device_printf(sc->msk_dev,
|
||||
"failed to load DMA'able memory for status ring\n");
|
||||
@@ -2157,27 +2222,10 @@ msk_txrx_dma_alloc(struct msk_if_softc *sc_if)
|
||||
int error, i;
|
||||
|
||||
/* Create parent DMA tag. */
|
||||
/*
|
||||
* XXX
|
||||
* It seems that Yukon II supports full 64bits DMA operations. But
|
||||
* it needs two descriptors(list elements) for 64bits DMA operations.
|
||||
* Since we don't know what DMA address mappings(32bits or 64bits)
|
||||
* would be used in advance for each mbufs, we limits its DMA space
|
||||
* to be in range of 32bits address space. Otherwise, we should check
|
||||
* what DMA address is used and chain another descriptor for the
|
||||
* 64bits DMA operation. This also means descriptor ring size is
|
||||
* variable. Limiting DMA address to be in 32bit address space greatly
|
||||
* simplifies descriptor handling and possibly would increase
|
||||
* performance a bit due to efficient handling of descriptors.
|
||||
* Apart from harassing checksum offloading mechanisms, it seems
|
||||
* it's really bad idea to use a separate descriptor for 64bit
|
||||
* DMA operation to save small descriptor memory. Anyway, I've
|
||||
* never seen these exotic scheme on ethernet interface hardware.
|
||||
*/
|
||||
error = bus_dma_tag_create(
|
||||
bus_get_dma_tag(sc_if->msk_if_dev), /* parent */
|
||||
1, 0, /* alignment, boundary */
|
||||
BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
|
||||
BUS_SPACE_MAXADDR, /* lowaddr */
|
||||
BUS_SPACE_MAXADDR, /* highaddr */
|
||||
NULL, NULL, /* filter, filterarg */
|
||||
BUS_SPACE_MAXSIZE_32BIT, /* maxsize */
|
||||
@@ -2283,7 +2331,7 @@ msk_txrx_dma_alloc(struct msk_if_softc *sc_if)
|
||||
ctx.msk_busaddr = 0;
|
||||
error = bus_dmamap_load(sc_if->msk_cdata.msk_tx_ring_tag,
|
||||
sc_if->msk_cdata.msk_tx_ring_map, sc_if->msk_rdata.msk_tx_ring,
|
||||
MSK_TX_RING_SZ, msk_dmamap_cb, &ctx, 0);
|
||||
MSK_TX_RING_SZ, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT);
|
||||
if (error != 0) {
|
||||
device_printf(sc_if->msk_if_dev,
|
||||
"failed to load DMA'able memory for Tx ring\n");
|
||||
@@ -2304,7 +2352,7 @@ msk_txrx_dma_alloc(struct msk_if_softc *sc_if)
|
||||
ctx.msk_busaddr = 0;
|
||||
error = bus_dmamap_load(sc_if->msk_cdata.msk_rx_ring_tag,
|
||||
sc_if->msk_cdata.msk_rx_ring_map, sc_if->msk_rdata.msk_rx_ring,
|
||||
MSK_RX_RING_SZ, msk_dmamap_cb, &ctx, 0);
|
||||
MSK_RX_RING_SZ, msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT);
|
||||
if (error != 0) {
|
||||
device_printf(sc_if->msk_if_dev,
|
||||
"failed to load DMA'able memory for Rx ring\n");
|
||||
@@ -2421,7 +2469,7 @@ msk_rx_dma_jalloc(struct msk_if_softc *sc_if)
|
||||
error = bus_dmamap_load(sc_if->msk_cdata.msk_jumbo_rx_ring_tag,
|
||||
sc_if->msk_cdata.msk_jumbo_rx_ring_map,
|
||||
sc_if->msk_rdata.msk_jumbo_rx_ring, MSK_JUMBO_RX_RING_SZ,
|
||||
msk_dmamap_cb, &ctx, 0);
|
||||
msk_dmamap_cb, &ctx, BUS_DMA_NOWAIT);
|
||||
if (error != 0) {
|
||||
device_printf(sc_if->msk_if_dev,
|
||||
"failed to load DMA'able memory for jumbo Rx ring\n");
|
||||
@@ -2781,6 +2829,18 @@ msk_encap(struct msk_if_softc *sc_if, struct mbuf **m_head)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MSK_64BIT_DMA
|
||||
if (MSK_ADDR_HI(txsegs[0].ds_addr) !=
|
||||
sc_if->msk_cdata.msk_tx_high_addr) {
|
||||
sc_if->msk_cdata.msk_tx_high_addr =
|
||||
MSK_ADDR_HI(txsegs[0].ds_addr);
|
||||
tx_le = &sc_if->msk_rdata.msk_tx_ring[prod];
|
||||
tx_le->msk_addr = htole32(MSK_ADDR_HI(txsegs[0].ds_addr));
|
||||
tx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER);
|
||||
sc_if->msk_cdata.msk_tx_cnt++;
|
||||
MSK_INC(prod, MSK_TX_RING_CNT);
|
||||
}
|
||||
#endif
|
||||
si = prod;
|
||||
tx_le = &sc_if->msk_rdata.msk_tx_ring[prod];
|
||||
tx_le->msk_addr = htole32(MSK_ADDR_LO(txsegs[0].ds_addr));
|
||||
@@ -2795,6 +2855,20 @@ msk_encap(struct msk_if_softc *sc_if, struct mbuf **m_head)
|
||||
|
||||
for (i = 1; i < nseg; i++) {
|
||||
tx_le = &sc_if->msk_rdata.msk_tx_ring[prod];
|
||||
#ifdef MSK_64BIT_DMA
|
||||
if (MSK_ADDR_HI(txsegs[i].ds_addr) !=
|
||||
sc_if->msk_cdata.msk_tx_high_addr) {
|
||||
sc_if->msk_cdata.msk_tx_high_addr =
|
||||
MSK_ADDR_HI(txsegs[i].ds_addr);
|
||||
tx_le = &sc_if->msk_rdata.msk_tx_ring[prod];
|
||||
tx_le->msk_addr =
|
||||
htole32(MSK_ADDR_HI(txsegs[i].ds_addr));
|
||||
tx_le->msk_control = htole32(OP_ADDR64 | HW_OWNER);
|
||||
sc_if->msk_cdata.msk_tx_cnt++;
|
||||
MSK_INC(prod, MSK_TX_RING_CNT);
|
||||
tx_le = &sc_if->msk_rdata.msk_tx_ring[prod];
|
||||
}
|
||||
#endif
|
||||
tx_le->msk_addr = htole32(MSK_ADDR_LO(txsegs[i].ds_addr));
|
||||
tx_le->msk_control = htole32(txsegs[i].ds_len | control |
|
||||
OP_BUFFER | HW_OWNER);
|
||||
@@ -3147,7 +3221,12 @@ msk_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control,
|
||||
msk_discard_rxbuf(sc_if, cons);
|
||||
break;
|
||||
}
|
||||
#ifdef MSK_64BIT_DMA
|
||||
rxd = &sc_if->msk_cdata.msk_rxdesc[(cons + 1) %
|
||||
MSK_RX_RING_CNT];
|
||||
#else
|
||||
rxd = &sc_if->msk_cdata.msk_rxdesc[cons];
|
||||
#endif
|
||||
m = rxd->rx_m;
|
||||
if (msk_newbuf(sc_if, cons) != 0) {
|
||||
ifp->if_iqdrops++;
|
||||
@@ -3175,8 +3254,8 @@ msk_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control,
|
||||
MSK_IF_LOCK(sc_if);
|
||||
} while (0);
|
||||
|
||||
MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT);
|
||||
MSK_INC(sc_if->msk_cdata.msk_rx_prod, MSK_RX_RING_CNT);
|
||||
MSK_RX_INC(sc_if->msk_cdata.msk_rx_cons, MSK_RX_RING_CNT);
|
||||
MSK_RX_INC(sc_if->msk_cdata.msk_rx_prod, MSK_RX_RING_CNT);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3207,7 +3286,12 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control,
|
||||
msk_discard_jumbo_rxbuf(sc_if, cons);
|
||||
break;
|
||||
}
|
||||
#ifdef MSK_64BIT_DMA
|
||||
jrxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[(cons + 1) %
|
||||
MSK_JUMBO_RX_RING_CNT];
|
||||
#else
|
||||
jrxd = &sc_if->msk_cdata.msk_jumbo_rxdesc[cons];
|
||||
#endif
|
||||
m = jrxd->rx_m;
|
||||
if (msk_jumbo_newbuf(sc_if, cons) != 0) {
|
||||
ifp->if_iqdrops++;
|
||||
@@ -3235,8 +3319,8 @@ msk_jumbo_rxeof(struct msk_if_softc *sc_if, uint32_t status, uint32_t control,
|
||||
MSK_IF_LOCK(sc_if);
|
||||
} while (0);
|
||||
|
||||
MSK_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT);
|
||||
MSK_INC(sc_if->msk_cdata.msk_rx_prod, MSK_JUMBO_RX_RING_CNT);
|
||||
MSK_RX_INC(sc_if->msk_cdata.msk_rx_cons, MSK_JUMBO_RX_RING_CNT);
|
||||
MSK_RX_INC(sc_if->msk_cdata.msk_rx_prod, MSK_JUMBO_RX_RING_CNT);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3581,7 +3665,7 @@ msk_handle_events(struct msk_softc *sc)
|
||||
control & STLE_OP_MASK);
|
||||
break;
|
||||
}
|
||||
MSK_INC(cons, MSK_STAT_RING_CNT);
|
||||
MSK_INC(cons, sc->msk_stat_count);
|
||||
if (rxprog > sc->msk_process_limit)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2315,35 +2315,48 @@ struct msk_stat_desc {
|
||||
#define BMU_UDP_CHECK (0x57<<16) /* Descr with UDP ext (YUKON only) */
|
||||
#define BMU_BBC 0xffff /* Bit 15.. 0: Buffer Byte Counter */
|
||||
|
||||
/*
|
||||
* Controller requires an additional LE op code for 64bit DMA operation.
|
||||
* Driver uses fixed number of RX buffers such that this limitation
|
||||
* reduces number of available RX buffers with 64bit DMA so double
|
||||
* number of RX buffers on platforms that support 64bit DMA. For TX
|
||||
* side, controller requires an additional OP_ADDR64 op code if a TX
|
||||
* buffer uses different high address value than previously used one.
|
||||
* Driver monitors high DMA address change in TX and inserts an
|
||||
* OP_ADDR64 op code if the high DMA address is changed. Driver
|
||||
* allocates 50% more total TX buffers on platforms that support 64bit
|
||||
* DMA.
|
||||
*/
|
||||
#if (BUS_SPACE_MAXADDR > 0xFFFFFFFF)
|
||||
#define MSK_64BIT_DMA
|
||||
#define MSK_TX_RING_CNT 384
|
||||
#define MSK_RX_RING_CNT 512
|
||||
#else
|
||||
#undef MSK_64BIT_DMA
|
||||
#define MSK_TX_RING_CNT 256
|
||||
#define MSK_RX_RING_CNT 256
|
||||
#endif
|
||||
#define MSK_RX_BUF_ALIGN 8
|
||||
#define MSK_JUMBO_RX_RING_CNT MSK_RX_RING_CNT
|
||||
#define MSK_STAT_RING_CNT ((1 + 3) * (MSK_TX_RING_CNT + MSK_RX_RING_CNT))
|
||||
#define MSK_MAXTXSEGS 32
|
||||
#define MSK_TSO_MAXSGSIZE 4096
|
||||
#define MSK_TSO_MAXSIZE (65535 + sizeof(struct ether_vlan_header))
|
||||
|
||||
/*
|
||||
* It seems that the hardware requires extra decriptors(LEs) to offload
|
||||
* TCP/UDP checksum, VLAN hardware tag inserstion and TSO.
|
||||
* It seems that the hardware requires extra descriptors(LEs) to offload
|
||||
* TCP/UDP checksum, VLAN hardware tag insertion and TSO.
|
||||
*
|
||||
* 1 descriptor for TCP/UDP checksum offload.
|
||||
* 1 descriptor VLAN hardware tag insertion.
|
||||
* 1 descriptor for TSO(TCP Segmentation Offload)
|
||||
* 1 descriptor for 64bits DMA : Not applicatable due to the use of
|
||||
* BUS_SPACE_MAXADDR_32BIT in parent DMA tag creation.
|
||||
* 1 descriptor for each 64bits DMA transfers
|
||||
*/
|
||||
#ifdef MSK_64BIT_DMA
|
||||
#define MSK_RESERVED_TX_DESC_CNT (MSK_MAXTXSEGS + 3)
|
||||
#else
|
||||
#define MSK_RESERVED_TX_DESC_CNT 3
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Jumbo buffer stuff. Note that we must allocate more jumbo
|
||||
* buffers than there are descriptors in the receive ring. This
|
||||
* is because we don't know how long it will take for a packet
|
||||
* to be released after we hand it off to the upper protocol
|
||||
* layers. To be safe, we allocate 1.5 times the number of
|
||||
* receive descriptors.
|
||||
*/
|
||||
#define MSK_JUMBO_FRAMELEN 9022
|
||||
#define MSK_JUMBO_MTU (MSK_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
|
||||
#define MSK_MAX_FRAMELEN \
|
||||
@@ -2380,6 +2393,7 @@ struct msk_chain_data {
|
||||
bus_dmamap_t msk_jumbo_rx_sparemap;
|
||||
uint16_t msk_tso_mtu;
|
||||
uint32_t msk_last_csum;
|
||||
uint32_t msk_tx_high_addr;
|
||||
int msk_tx_prod;
|
||||
int msk_tx_cons;
|
||||
int msk_tx_cnt;
|
||||
@@ -2411,10 +2425,17 @@ struct msk_ring_data {
|
||||
(sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT)
|
||||
#define MSK_JUMBO_RX_RING_SZ \
|
||||
(sizeof(struct msk_rx_desc) * MSK_JUMBO_RX_RING_CNT)
|
||||
#define MSK_STAT_RING_SZ \
|
||||
(sizeof(struct msk_stat_desc) * MSK_STAT_RING_CNT)
|
||||
|
||||
#define MSK_INC(x, y) (x) = (x + 1) % y
|
||||
#ifdef MSK_64BIT_DMA
|
||||
#define MSK_RX_INC(x, y) (x) = (x + 2) % y
|
||||
#define MSK_RX_BUF_CNT (MSK_RX_RING_CNT / 2)
|
||||
#define MSK_JUMBO_RX_BUF_CNT (MSK_JUMBO_RX_RING_CNT / 2)
|
||||
#else
|
||||
#define MSK_RX_INC(x, y) (x) = (x + 1) % y
|
||||
#define MSK_RX_BUF_CNT MSK_RX_RING_CNT
|
||||
#define MSK_JUMBO_RX_BUF_CNT MSK_JUMBO_RX_RING_CNT
|
||||
#endif
|
||||
|
||||
#define MSK_PCI_BUS 0
|
||||
#define MSK_PCIX_BUS 1
|
||||
@@ -2519,6 +2540,7 @@ struct msk_softc {
|
||||
int msk_int_holdoff;
|
||||
int msk_process_limit;
|
||||
int msk_stat_cons;
|
||||
int msk_stat_count;
|
||||
struct mtx msk_mtx;
|
||||
#ifdef __HAIKU__
|
||||
uint32_t haiku_interrupt_status;
|
||||
|
||||
@@ -67,7 +67,7 @@ static device_method_t ciphy_methods[] = {
|
||||
DEVMETHOD(device_attach, ciphy_attach),
|
||||
DEVMETHOD(device_detach, mii_phy_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
{ 0, 0 }
|
||||
DEVMETHOD_END
|
||||
};
|
||||
|
||||
static devclass_t ciphy_devclass;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user