mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-08-18 00:57:23 +08:00
Merge branch '8139too-6.4-6.12' into 'stable-1.6'
Add 8139too, e100, e1000 and r8169 for kernels 6.4 and 6.12 Closes #160 See merge request etherlab.org/ethercat!172
This commit is contained in:
+62
-49
@@ -82,7 +82,7 @@ else
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_KERNEL, test "x$enablekernel" = "x1")
|
||||
AC_SUBST(ENABLE_KERNEL,[$enablekernel])
|
||||
AC_SUBST(ENABLE_KERNEL, [$enablekernel])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Linux sources
|
||||
@@ -141,7 +141,7 @@ fi
|
||||
# Extract numbers from kernel release
|
||||
linuxversion=`echo $kernelrelease | grep -oE "$regex"`
|
||||
|
||||
AC_SUBST(LINUX_SOURCE_DIR,[$sourcedir])
|
||||
AC_SUBST(LINUX_SOURCE_DIR, [$sourcedir])
|
||||
AC_MSG_RESULT([$LINUX_SOURCE_DIR (Kernel $linuxversion)])
|
||||
|
||||
fi
|
||||
@@ -156,7 +156,7 @@ AC_ARG_WITH([module-dir],
|
||||
[moddir=[$withval]],
|
||||
[moddir="ethercat"]
|
||||
)
|
||||
AC_SUBST(INSTALL_MOD_DIR,[$moddir])
|
||||
AC_SUBST(INSTALL_MOD_DIR, [$moddir])
|
||||
|
||||
AC_MSG_CHECKING([for Linux modules installation directory])
|
||||
AC_MSG_RESULT([$INSTALL_MOD_DIR])
|
||||
@@ -190,7 +190,7 @@ else
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_DRIVER_RESOURCE_VERIFYING, test "x$enableverifying" = "x1")
|
||||
AC_SUBST(ENABLE_DRIVER_RESOURCE_VERIFYING,[$enableverifying])
|
||||
AC_SUBST(ENABLE_DRIVER_RESOURCE_VERIFYING, [$enableverifying])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Generic Ethernet driver
|
||||
@@ -213,7 +213,7 @@ AC_ARG_ENABLE([generic],
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_GENERIC, test "x$enablegeneric" = "x1")
|
||||
AC_SUBST(ENABLE_GENERIC,[$enablegeneric])
|
||||
AC_SUBST(ENABLE_GENERIC, [$enablegeneric])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# 8139too driver
|
||||
@@ -236,7 +236,7 @@ AC_ARG_ENABLE([8139too],
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_8139TOO, test "x$enable8139too" = "x1")
|
||||
AC_SUBST(ENABLE_8139TOO,[$enable8139too])
|
||||
AC_SUBST(ENABLE_8139TOO, [$enable8139too])
|
||||
|
||||
AC_ARG_WITH([8139too-kernel],
|
||||
AS_HELP_STRING([--with-8139too-kernel=<X.Y.Z>],
|
||||
@@ -266,7 +266,7 @@ if test "x${enable8139too}" = "x1"; then
|
||||
AC_MSG_RESULT([$kernel8139too])
|
||||
fi
|
||||
|
||||
AC_SUBST(KERNEL_8139TOO,[$kernel8139too])
|
||||
AC_SUBST(KERNEL_8139TOO, [$kernel8139too])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# e100 driver
|
||||
@@ -289,7 +289,7 @@ AC_ARG_ENABLE([e100],
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_E100, test "x$enablee100" = "x1")
|
||||
AC_SUBST(ENABLE_E100,[$enablee100])
|
||||
AC_SUBST(ENABLE_E100, [$enablee100])
|
||||
|
||||
AC_ARG_WITH([e100-kernel],
|
||||
AS_HELP_STRING([--with-e100-kernel=<X.Y.Z>],
|
||||
@@ -319,7 +319,7 @@ if test "x${enablee100}" = "x1"; then
|
||||
AC_MSG_RESULT([$kernele100])
|
||||
fi
|
||||
|
||||
AC_SUBST(KERNEL_E100,[$kernele100])
|
||||
AC_SUBST(KERNEL_E100, [$kernele100])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# e1000 driver
|
||||
@@ -342,7 +342,7 @@ AC_ARG_ENABLE([e1000],
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_E1000, test "x$enablee1000" = "x1")
|
||||
AC_SUBST(ENABLE_E1000,[$enablee1000])
|
||||
AC_SUBST(ENABLE_E1000, [$enablee1000])
|
||||
|
||||
AC_ARG_WITH([e1000-kernel],
|
||||
AS_HELP_STRING([--with-e1000-kernel=<X.Y.Z>],
|
||||
@@ -372,7 +372,7 @@ if test "x${enablee1000}" = "x1"; then
|
||||
AC_MSG_RESULT([$kernele1000])
|
||||
fi
|
||||
|
||||
AC_SUBST(KERNEL_E1000,[$kernele1000])
|
||||
AC_SUBST(KERNEL_E1000, [$kernele1000])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# e1000e driver
|
||||
@@ -395,7 +395,7 @@ AC_ARG_ENABLE([e1000e],
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_E1000E, test "x$enablee1000e" = "x1")
|
||||
AC_SUBST(ENABLE_E1000E,[$enablee1000e])
|
||||
AC_SUBST(ENABLE_E1000E, [$enablee1000e])
|
||||
|
||||
AC_ARG_WITH([e1000e-kernel],
|
||||
AS_HELP_STRING([--with-e1000e-kernel=<X.Y.Z>],
|
||||
@@ -444,7 +444,7 @@ if test "x${enablee1000e}" = "x1"; then
|
||||
|
||||
fi
|
||||
|
||||
AC_SUBST(KERNEL_E1000E,[$kernele1000e])
|
||||
AC_SUBST(KERNEL_E1000E, [$kernele1000e])
|
||||
AC_SUBST(E1000E_LAYOUT, [$e1000elayout])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
@@ -468,7 +468,7 @@ AC_ARG_ENABLE([genet],
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_GENET, test "x$enablegenet" = "x1")
|
||||
AC_SUBST(ENABLE_GENET,[$enablegenet])
|
||||
AC_SUBST(ENABLE_GENET, [$enablegenet])
|
||||
|
||||
AC_ARG_WITH([genet-kernel],
|
||||
AS_HELP_STRING([--with-genet-kernel=<X.Y.Z>],
|
||||
@@ -491,7 +491,7 @@ if test "x${enablegenet}" = "x1"; then
|
||||
AC_MSG_RESULT([$kernelgenet])
|
||||
fi
|
||||
|
||||
AC_SUBST(KERNEL_GENET,[$kernelgenet])
|
||||
AC_SUBST(KERNEL_GENET, [$kernelgenet])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# igb driver
|
||||
@@ -514,7 +514,7 @@ AC_ARG_ENABLE([igb],
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_IGB, test "x$enableigb" = "x1")
|
||||
AC_SUBST(ENABLE_IGB,[$enableigb])
|
||||
AC_SUBST(ENABLE_IGB, [$enableigb])
|
||||
|
||||
AC_ARG_WITH([igb-kernel],
|
||||
AS_HELP_STRING([--with-igb-kernel=<X.Y.Z>],
|
||||
@@ -538,7 +538,7 @@ if test "x${enableigb}" = "x1"; then
|
||||
AC_MSG_RESULT([$kerneligb])
|
||||
fi
|
||||
|
||||
AC_SUBST(KERNEL_IGB,[$kerneligb])
|
||||
AC_SUBST(KERNEL_IGB, [$kerneligb])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# igc driver
|
||||
@@ -561,7 +561,7 @@ AC_ARG_ENABLE([igc],
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_IGC, test "x$enableigc" = "x1")
|
||||
AC_SUBST(ENABLE_IGC,[$enableigc])
|
||||
AC_SUBST(ENABLE_IGC, [$enableigc])
|
||||
|
||||
AC_ARG_WITH([igc-kernel],
|
||||
AS_HELP_STRING([--with-igc-kernel=<X.Y.Z>],
|
||||
@@ -597,13 +597,15 @@ if test "x${enableigc}" = "x1"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(KERNEL_IGC,[$kerneligc])
|
||||
AC_SUBST(HAS_IGC_LEDS,[$has_igc_leds])
|
||||
AC_SUBST(KERNEL_IGC, [$kerneligc])
|
||||
AC_SUBST(HAS_IGC_LEDS, [$has_igc_leds])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# r8169 driver
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
has_r8169_leds=0
|
||||
|
||||
AC_ARG_ENABLE([r8169],
|
||||
AS_HELP_STRING([--enable-r8169],
|
||||
[Enable r8169 driver]),
|
||||
@@ -621,7 +623,7 @@ AC_ARG_ENABLE([r8169],
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_R8169, test "x$enable_r8169" = "x1")
|
||||
AC_SUBST(ENABLE_R8169,[$enable_r8169])
|
||||
AC_SUBST(ENABLE_R8169, [$enable_r8169])
|
||||
|
||||
AC_ARG_WITH([r8169-kernel],
|
||||
AS_HELP_STRING([--with-r8169-kernel=<X.Y.Z>],
|
||||
@@ -658,9 +660,20 @@ if test "x${enable_r8169}" = "x1"; then
|
||||
|
||||
AC_SUBST(R8169_IN_SUBDIR, [$found_subdir])
|
||||
AC_MSG_RESULT([$kernel_r8169])
|
||||
|
||||
AC_MSG_CHECKING([for r8169_leds.c])
|
||||
|
||||
if test -r "${srcdir}/devices/r8169/r8169_leds-${kernel_r8169}-ethercat.c"; then
|
||||
AC_MSG_RESULT([yes])
|
||||
has_r8169_leds=1
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
has_r8169_leds=0
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(KERNEL_R8169,[$kernel_r8169])
|
||||
AC_SUBST(KERNEL_R8169, [$kernel_r8169])
|
||||
AC_SUBST(HAS_R8169_LEDS, [$has_r8169_leds])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# stmmac-pci and dwmac-intel driver
|
||||
@@ -686,7 +699,7 @@ AC_ARG_ENABLE([stmmac-pci],
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_STMMACPCI, test "x$enablestmmacpci" = "x1")
|
||||
AC_SUBST(ENABLE_STMMACPCI,[$enablestmmacpci])
|
||||
AC_SUBST(ENABLE_STMMACPCI, [$enablestmmacpci])
|
||||
|
||||
AC_ARG_ENABLE([dwmac-intel],
|
||||
AS_HELP_STRING([--enable-dwmac-intel],
|
||||
@@ -706,7 +719,7 @@ AC_ARG_ENABLE([dwmac-intel],
|
||||
)
|
||||
|
||||
AM_CONDITIONAL(ENABLE_DWMACINTEL, test "x$enabledwmacintel" = "x1")
|
||||
AC_SUBST(ENABLE_DWMACINTEL,[$enabledwmacintel])
|
||||
AC_SUBST(ENABLE_DWMACINTEL, [$enabledwmacintel])
|
||||
|
||||
AM_CONDITIONAL(ENABLE_STMMAC, test "x$enablestmmac" = "x1")
|
||||
AC_SUBST(ENABLE_STMMAC, [$enablestmmac])
|
||||
@@ -742,8 +755,8 @@ if test "x${enablestmmac}" = "x1"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(KERNEL_STMMAC,[$kernelstmmac])
|
||||
AC_SUBST(HAS_STMMAC_EST,[$has_stmmac_est])
|
||||
AC_SUBST(KERNEL_STMMAC, [$kernelstmmac])
|
||||
AC_SUBST(HAS_STMMAC_EST, [$has_stmmac_est])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# CCAT driver
|
||||
@@ -774,7 +787,7 @@ else
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_CCAT, test "x$enableccat" = "x1")
|
||||
AC_SUBST(ENABLE_CCAT,[$enableccat])
|
||||
AC_SUBST(ENABLE_CCAT, [$enableccat])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# RTAI path (optional)
|
||||
@@ -809,14 +822,14 @@ else
|
||||
rtai_kernel_cflags=`$rtaidir/bin/rtai-config --kernel-cflags`
|
||||
fi
|
||||
|
||||
AC_SUBST(RTAI_DIR,[$rtaidir])
|
||||
AC_SUBST(RTAI_DIR, [$rtaidir])
|
||||
AM_CONDITIONAL(ENABLE_RTAI, test "x$rtai" = "x1")
|
||||
AC_SUBST(ENABLE_RTAI,[$rtai])
|
||||
AC_SUBST(ENABLE_RTAI, [$rtai])
|
||||
|
||||
AC_SUBST(RTAI_LXRT_CFLAGS,[$rtai_lxrt_cflags])
|
||||
AC_SUBST(RTAI_LXRT_LDFLAGS,[$rtai_lxrt_ldflags])
|
||||
AC_SUBST(RTAI_MODULE_DIR,[$rtai_module_dir])
|
||||
AC_SUBST(RTAI_KERNEL_CFLAGS,[$rtai_kernel_cflags])
|
||||
AC_SUBST(RTAI_LXRT_CFLAGS, [$rtai_lxrt_cflags])
|
||||
AC_SUBST(RTAI_LXRT_LDFLAGS, [$rtai_lxrt_ldflags])
|
||||
AC_SUBST(RTAI_MODULE_DIR, [$rtai_module_dir])
|
||||
AC_SUBST(RTAI_KERNEL_CFLAGS, [$rtai_kernel_cflags])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Xenomai path (optional)
|
||||
@@ -880,20 +893,20 @@ else
|
||||
xeno_rtdm_cflags=`$xenomaiconfig --skin rtdm --cflags`
|
||||
fi
|
||||
|
||||
AC_SUBST(XENOMAI_DIR,[$xenomaidir])
|
||||
AC_SUBST(XENOMAI_DIR, [$xenomaidir])
|
||||
AM_CONDITIONAL(ENABLE_XENOMAI, test "x$xeno" = "x1")
|
||||
AC_SUBST(ENABLE_XENOMAI,[$xeno])
|
||||
AC_SUBST(ENABLE_XENOMAI, [$xeno])
|
||||
AM_CONDITIONAL(ENABLE_XENOMAI_V3, test "x$xeno_v3" = "x1")
|
||||
AC_SUBST(ENABLE_XENOMAI_V3,[$xeno_v3])
|
||||
AC_SUBST(ENABLE_XENOMAI_V3, [$xeno_v3])
|
||||
|
||||
AC_SUBST(XENOMAI_ALCHEMY_CFLAGS,[$xeno_alchemy_cflags])
|
||||
AC_SUBST(XENOMAI_ALCHEMY_LDFLAGS,[$xeno_alchemy_ldflags])
|
||||
AC_SUBST(XENOMAI_NATIVE_CFLAGS,[$xeno_native_cflags])
|
||||
AC_SUBST(XENOMAI_NATIVE_LDFLAGS,[$xeno_native_ldflags])
|
||||
AC_SUBST(XENOMAI_POSIX_CFLAGS,[$xeno_posix_cflags])
|
||||
AC_SUBST(XENOMAI_POSIX_LDFLAGS,[$xeno_posix_ldflags])
|
||||
AC_SUBST(XENOMAI_RTDM_CFLAGS,[$xeno_rtdm_cflags])
|
||||
AC_SUBST(XENOMAI_RTDM_LDFLAGS,[$xeno_rtdm_ldflags])
|
||||
AC_SUBST(XENOMAI_ALCHEMY_CFLAGS, [$xeno_alchemy_cflags])
|
||||
AC_SUBST(XENOMAI_ALCHEMY_LDFLAGS, [$xeno_alchemy_ldflags])
|
||||
AC_SUBST(XENOMAI_NATIVE_CFLAGS, [$xeno_native_cflags])
|
||||
AC_SUBST(XENOMAI_NATIVE_LDFLAGS, [$xeno_native_ldflags])
|
||||
AC_SUBST(XENOMAI_POSIX_CFLAGS, [$xeno_posix_cflags])
|
||||
AC_SUBST(XENOMAI_POSIX_LDFLAGS, [$xeno_posix_ldflags])
|
||||
AC_SUBST(XENOMAI_RTDM_CFLAGS, [$xeno_rtdm_cflags])
|
||||
AC_SUBST(XENOMAI_RTDM_LDFLAGS, [$xeno_rtdm_ldflags])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# RTDM interface (optional)
|
||||
@@ -925,7 +938,7 @@ else
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_RTDM, test "x$rtdm" = "x1")
|
||||
AC_SUBST(ENABLE_RTDM,[$rtdm])
|
||||
AC_SUBST(ENABLE_RTDM, [$rtdm])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Debug interface
|
||||
@@ -957,7 +970,7 @@ else
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_DEBUG_IF, test "x$dbg" = "x1")
|
||||
AC_SUBST(ENABLE_DEBUG_IF,[$dbg])
|
||||
AC_SUBST(ENABLE_DEBUG_IF, [$dbg])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Debug ring
|
||||
@@ -1018,7 +1031,7 @@ else
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_EOE, test "x$eoe" = "x1")
|
||||
AC_SUBST(ENABLE_EOE,[$eoe])
|
||||
AC_SUBST(ENABLE_EOE, [$eoe])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# CPU timestamp counter support
|
||||
@@ -1227,7 +1240,7 @@ else
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(ENABLE_TTY, test "x$tty" = "x1")
|
||||
AC_SUBST(ENABLE_TTY,[$tty])
|
||||
AC_SUBST(ENABLE_TTY, [$tty])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Slave identification wildcards
|
||||
@@ -1384,7 +1397,7 @@ case "${with_systemdsystemunitdir}" in
|
||||
esac
|
||||
|
||||
AM_CONDITIONAL(HAVE_SYSTEMD, test "x$with_systemdsystemunitdir" != "x")
|
||||
AC_SUBST(systemdsystemunitdir,[$with_systemdsystemunitdir])
|
||||
AC_SUBST(systemdsystemunitdir, [$with_systemdsystemunitdir])
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+12
-6
@@ -1,6 +1,6 @@
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (C) 2006-2023 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
# Copyright (C) 2006-2025 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
#
|
||||
# This file is part of the IgH EtherCAT Master.
|
||||
#
|
||||
@@ -31,8 +31,7 @@ SUBDIRS = \
|
||||
r8169 \
|
||||
stmmac
|
||||
|
||||
# using HEADERS to enable tags target
|
||||
noinst_HEADERS = \
|
||||
EXTRA_DIST = \
|
||||
8139too-3.0-ethercat.c \
|
||||
8139too-3.0-orig.c \
|
||||
8139too-3.10-ethercat.c \
|
||||
@@ -61,6 +60,10 @@ noinst_HEADERS = \
|
||||
8139too-5.15-orig.c \
|
||||
8139too-6.1-ethercat.c \
|
||||
8139too-6.1-orig.c \
|
||||
8139too-6.12-ethercat.c \
|
||||
8139too-6.12-orig.c \
|
||||
8139too-6.4-ethercat.c \
|
||||
8139too-6.4-orig.c \
|
||||
create_driver_table.py \
|
||||
device_drivers_template.md \
|
||||
e100-3.0-ethercat.c \
|
||||
@@ -81,16 +84,18 @@ noinst_HEADERS = \
|
||||
e100-3.8-orig.c \
|
||||
e100-4.4-ethercat.c \
|
||||
e100-4.4-orig.c \
|
||||
e100-5.4-ethercat.c \
|
||||
e100-5.4-orig.c \
|
||||
e100-5.10-ethercat.c \
|
||||
e100-5.10-orig.c \
|
||||
e100-5.14-ethercat.c \
|
||||
e100-5.14-orig.c \
|
||||
e100-5.15-ethercat.c \
|
||||
e100-5.15-orig.c \
|
||||
e100-5.4-ethercat.c \
|
||||
e100-5.4-orig.c \
|
||||
e100-6.1-ethercat.c \
|
||||
e100-6.1-orig.c \
|
||||
e100-6.12-ethercat.c \
|
||||
e100-6.12-orig.c \
|
||||
e100-6.4-ethercat.c \
|
||||
e100-6.4-orig.c \
|
||||
ecdev.h \
|
||||
@@ -112,6 +117,7 @@ noinst_HEADERS = \
|
||||
r8169-3.8-ethercat.c \
|
||||
r8169-3.8-orig.c \
|
||||
r8169-4.4-ethercat.c \
|
||||
r8169-4.4-orig.c
|
||||
r8169-4.4-orig.c \
|
||||
update.sh
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@@ -3001,7 +3001,10 @@ static int __devinit e100_probe(struct pci_dev *pdev,
|
||||
// offer device to EtherCAT master module
|
||||
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (nic->ecdev) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
|
||||
@@ -3104,7 +3104,10 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
// offer device to EtherCAT master module
|
||||
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (nic->ecdev) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
|
||||
@@ -3101,7 +3101,10 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
// offer device to EtherCAT master module
|
||||
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (nic->ecdev) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
|
||||
@@ -3101,7 +3101,10 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
// offer device to EtherCAT master module
|
||||
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (nic->ecdev) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
|
||||
@@ -3101,7 +3101,10 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
// offer device to EtherCAT master module
|
||||
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (nic->ecdev) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
|
||||
@@ -3068,7 +3068,10 @@ static int __devinit e100_probe(struct pci_dev *pdev,
|
||||
// offer device to EtherCAT master module
|
||||
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (nic->ecdev) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
|
||||
@@ -3092,7 +3092,10 @@ static int __devinit e100_probe(struct pci_dev *pdev,
|
||||
// offer device to EtherCAT master module
|
||||
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (nic->ecdev) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
|
||||
@@ -3091,7 +3091,10 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
// offer device to EtherCAT master module
|
||||
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (nic->ecdev) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
|
||||
@@ -3104,7 +3104,10 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
// offer device to EtherCAT master module
|
||||
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (nic->ecdev) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
|
||||
@@ -3086,7 +3086,10 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
// offer device to EtherCAT master module
|
||||
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (nic->ecdev) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
|
||||
@@ -3124,7 +3124,10 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
// offer device to EtherCAT master module
|
||||
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (nic->ecdev) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
|
||||
@@ -3092,7 +3092,10 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
// offer device to EtherCAT master module
|
||||
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (nic->ecdev) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
|
||||
@@ -3090,7 +3090,10 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
// offer device to EtherCAT master module
|
||||
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (nic->ecdev) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
|
||||
@@ -3101,7 +3101,10 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
nic->ecdev_ = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
nic->ecdev_initialized = true;
|
||||
|
||||
if (!get_ecdev(nic)) {
|
||||
if (get_ecdev(nic)) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+62
-49
@@ -646,10 +646,19 @@ struct nic {
|
||||
__le16 eeprom[256];
|
||||
spinlock_t mdio_lock;
|
||||
const struct firmware *fw;
|
||||
ec_device_t *ecdev;
|
||||
ec_device_t *ecdev_;
|
||||
unsigned long ec_watchdog_jiffies;
|
||||
bool ecdev_initialized;
|
||||
};
|
||||
|
||||
static inline ec_device_t *get_ecdev(struct nic *adapter)
|
||||
{
|
||||
#ifdef EC_ENABLE_DRIVER_RESOURCE_VERIFYING
|
||||
WARN_ON(!adapter->ecdev_initialized);
|
||||
#endif
|
||||
return adapter->ecdev_;
|
||||
}
|
||||
|
||||
static inline void e100_write_flush(struct nic *nic)
|
||||
{
|
||||
/* Flush previous PCI writes through intermediate bridges
|
||||
@@ -661,7 +670,7 @@ static void e100_enable_irq(struct nic *nic)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
if (nic->ecdev)
|
||||
if (get_ecdev(nic))
|
||||
return;
|
||||
|
||||
spin_lock_irqsave(&nic->cmd_lock, flags);
|
||||
@@ -674,11 +683,11 @@ static void e100_disable_irq(struct nic *nic)
|
||||
{
|
||||
unsigned long flags = 0;
|
||||
|
||||
if (!nic->ecdev)
|
||||
if (!nic->ecdev_)
|
||||
spin_lock_irqsave(&nic->cmd_lock, flags);
|
||||
iowrite8(irq_mask_all, &nic->csr->scb.cmd_hi);
|
||||
e100_write_flush(nic);
|
||||
if (!nic->ecdev)
|
||||
if (!nic->ecdev_)
|
||||
spin_unlock_irqrestore(&nic->cmd_lock, flags);
|
||||
}
|
||||
|
||||
@@ -868,7 +877,7 @@ static int e100_exec_cmd(struct nic *nic, u8 cmd, dma_addr_t dma_addr)
|
||||
unsigned int i;
|
||||
int err = 0;
|
||||
|
||||
if (!nic->ecdev)
|
||||
if (!get_ecdev(nic))
|
||||
spin_lock_irqsave(&nic->cmd_lock, flags);
|
||||
|
||||
/* Previous command is accepted when SCB clears */
|
||||
@@ -889,7 +898,7 @@ static int e100_exec_cmd(struct nic *nic, u8 cmd, dma_addr_t dma_addr)
|
||||
iowrite8(cmd, &nic->csr->scb.cmd_lo);
|
||||
|
||||
err_unlock:
|
||||
if (!nic->ecdev)
|
||||
if (!get_ecdev(nic))
|
||||
spin_unlock_irqrestore(&nic->cmd_lock, flags);
|
||||
|
||||
return err;
|
||||
@@ -902,7 +911,7 @@ static int e100_exec_cb(struct nic *nic, struct sk_buff *skb,
|
||||
unsigned long flags;
|
||||
int err;
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (!get_ecdev(nic)) {
|
||||
spin_lock_irqsave(&nic->cb_lock, flags);
|
||||
}
|
||||
|
||||
@@ -950,7 +959,7 @@ static int e100_exec_cb(struct nic *nic, struct sk_buff *skb,
|
||||
}
|
||||
|
||||
err_unlock:
|
||||
if (!nic->ecdev) {
|
||||
if (!get_ecdev(nic)) {
|
||||
spin_unlock_irqrestore(&nic->cb_lock, flags);
|
||||
}
|
||||
|
||||
@@ -984,7 +993,7 @@ static u16 mdio_ctrl_hw(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data)
|
||||
* manipulation of the MDI control registers is a multi-step
|
||||
* procedure it should be done under lock.
|
||||
*/
|
||||
if (!nic->ecdev)
|
||||
if (!nic->ecdev_) /* exemption of initialization check */
|
||||
spin_lock_irqsave(&nic->mdio_lock, flags);
|
||||
for (i = 100; i; --i) {
|
||||
if (ioread32(&nic->csr->mdi_ctrl) & mdi_ready)
|
||||
@@ -993,7 +1002,7 @@ static u16 mdio_ctrl_hw(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data)
|
||||
}
|
||||
if (unlikely(!i)) {
|
||||
netdev_err(nic->netdev, "e100.mdio_ctrl won't go Ready\n");
|
||||
if (!nic->ecdev)
|
||||
if (!get_ecdev(nic))
|
||||
spin_unlock_irqrestore(&nic->mdio_lock, flags);
|
||||
return 0; /* No way to indicate timeout error */
|
||||
}
|
||||
@@ -1004,7 +1013,7 @@ static u16 mdio_ctrl_hw(struct nic *nic, u32 addr, u32 dir, u32 reg, u16 data)
|
||||
if ((data_out = ioread32(&nic->csr->mdi_ctrl)) & mdi_ready)
|
||||
break;
|
||||
}
|
||||
if (!nic->ecdev)
|
||||
if (!nic->ecdev_)
|
||||
spin_unlock_irqrestore(&nic->mdio_lock, flags);
|
||||
netif_printk(nic, hw, KERN_DEBUG, nic->netdev,
|
||||
"%s:addr=%d, reg=%d, data_in=0x%04X, data_out=0x%04X\n",
|
||||
@@ -1182,7 +1191,7 @@ static int e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
|
||||
config->multicast_all = 0x1; /* 1=accept, 0=no */
|
||||
|
||||
/* disable WoL when up */
|
||||
if (nic->ecdev ||
|
||||
if (get_ecdev(nic) ||
|
||||
(netif_running(nic->netdev) || !(nic->flags & wol_magic)))
|
||||
config->magic_packet_disable = 0x1; /* 1=off, 0=on */
|
||||
|
||||
@@ -1748,8 +1757,8 @@ static void e100_watchdog_impl(struct nic *nic)
|
||||
struct ethtool_cmd cmd = { .cmd = ETHTOOL_GSET };
|
||||
u32 speed;
|
||||
|
||||
if (nic->ecdev) {
|
||||
ecdev_set_link(nic->ecdev, mii_link_ok(&nic->mii) ? 1 : 0);
|
||||
if (get_ecdev(nic)) {
|
||||
ecdev_set_link(get_ecdev(nic), mii_link_ok(&nic->mii) ? 1 : 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1862,14 +1871,14 @@ static netdev_tx_t e100_xmit_frame(struct sk_buff *skb,
|
||||
/* We queued the skb, but now we're out of space. */
|
||||
netif_printk(nic, tx_err, KERN_DEBUG, nic->netdev,
|
||||
"No space for CB\n");
|
||||
if (!nic->ecdev)
|
||||
if (!get_ecdev(nic))
|
||||
netif_stop_queue(netdev);
|
||||
break;
|
||||
case -ENOMEM:
|
||||
/* This is a hard error - log it. */
|
||||
netif_printk(nic, tx_err, KERN_DEBUG, nic->netdev,
|
||||
"Out of Tx resources, returning skb\n");
|
||||
if (!nic->ecdev)
|
||||
if (!get_ecdev(nic))
|
||||
netif_stop_queue(netdev);
|
||||
return NETDEV_TX_BUSY;
|
||||
}
|
||||
@@ -1883,7 +1892,7 @@ static int e100_tx_clean(struct nic *nic)
|
||||
struct cb *cb;
|
||||
int tx_cleaned = 0;
|
||||
|
||||
if (!nic->ecdev)
|
||||
if (!get_ecdev(nic))
|
||||
spin_lock(&nic->cb_lock);
|
||||
|
||||
/* Clean CBs marked complete */
|
||||
@@ -1904,7 +1913,7 @@ static int e100_tx_clean(struct nic *nic)
|
||||
le32_to_cpu(cb->u.tcb.tbd.buf_addr),
|
||||
le16_to_cpu(cb->u.tcb.tbd.size),
|
||||
DMA_TO_DEVICE);
|
||||
if (!nic->ecdev)
|
||||
if (!get_ecdev(nic))
|
||||
dev_kfree_skb_any(cb->skb);
|
||||
cb->skb = NULL;
|
||||
tx_cleaned = 1;
|
||||
@@ -1913,7 +1922,7 @@ static int e100_tx_clean(struct nic *nic)
|
||||
nic->cbs_avail++;
|
||||
}
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (!get_ecdev(nic)) {
|
||||
spin_unlock(&nic->cb_lock);
|
||||
|
||||
/* Recover from running out of Tx resources in xmit_frame */
|
||||
@@ -1934,7 +1943,7 @@ static void e100_clean_cbs(struct nic *nic)
|
||||
le32_to_cpu(cb->u.tcb.tbd.buf_addr),
|
||||
le16_to_cpu(cb->u.tcb.tbd.size),
|
||||
DMA_TO_DEVICE);
|
||||
if (!nic->ecdev)
|
||||
if (!get_ecdev(nic))
|
||||
dev_kfree_skb(cb->skb);
|
||||
}
|
||||
nic->cb_to_clean = nic->cb_to_clean->next;
|
||||
@@ -2089,7 +2098,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
|
||||
nic->ru_running = RU_SUSPENDED;
|
||||
}
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (!get_ecdev(nic)) {
|
||||
/* Pull off the RFD and put the actual data (minus eth hdr) */
|
||||
skb_reserve(skb, sizeof(struct rfd));
|
||||
skb_put(skb, actual_size);
|
||||
@@ -2107,27 +2116,27 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
|
||||
}
|
||||
|
||||
if (unlikely(!(rfd_status & cb_ok))) {
|
||||
if (!nic->ecdev) {
|
||||
if (!get_ecdev(nic)) {
|
||||
/* Don't indicate if hardware indicates errors */
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
} else if (actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN + fcs_pad) {
|
||||
/* Don't indicate oversized frames */
|
||||
nic->rx_over_length_errors++;
|
||||
if (!nic->ecdev) {
|
||||
if (!get_ecdev(nic)) {
|
||||
dev_kfree_skb_any(skb);
|
||||
}
|
||||
} else {
|
||||
process_skb:
|
||||
dev->stats.rx_packets++;
|
||||
dev->stats.rx_bytes += (actual_size - fcs_pad);
|
||||
if (nic->ecdev) {
|
||||
ecdev_receive(nic->ecdev,
|
||||
if (get_ecdev(nic)) {
|
||||
ecdev_receive(get_ecdev(nic),
|
||||
skb->data + sizeof(struct rfd), actual_size - fcs_pad);
|
||||
|
||||
// No need to detect link status as
|
||||
// long as frames are received: Reset watchdog.
|
||||
if (ecdev_get_link(nic->ecdev)) {
|
||||
if (ecdev_get_link(get_ecdev(nic))) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
} else {
|
||||
@@ -2137,7 +2146,7 @@ process_skb:
|
||||
(*work_done)++;
|
||||
}
|
||||
|
||||
if (nic->ecdev) {
|
||||
if (get_ecdev(nic)) {
|
||||
// make receive frame descriptior usable again
|
||||
memcpy(skb->data, &nic->blank_rfd, sizeof(struct rfd));
|
||||
rx->dma_addr = dma_map_single(&nic->pdev->dev, skb->data,
|
||||
@@ -2191,7 +2200,7 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
|
||||
old_before_last_rx = nic->rx_to_use->prev->prev;
|
||||
old_before_last_rfd = (struct rfd *)old_before_last_rx->skb->data;
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (!get_ecdev(nic)) {
|
||||
/* Alloc new skbs to refill list */
|
||||
for(rx = nic->rx_to_use; !rx->skb; rx = nic->rx_to_use = rx->next) {
|
||||
if(unlikely(e100_rx_alloc_skb(nic, rx)))
|
||||
@@ -2288,7 +2297,7 @@ static int e100_rx_alloc_list(struct nic *nic)
|
||||
}
|
||||
}
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (!get_ecdev(nic)) {
|
||||
/* Set the el-bit on the buffer that is before the last buffer.
|
||||
* This lets us update the next pointer on the last buffer without
|
||||
* worrying about hardware touching it.
|
||||
@@ -2330,7 +2339,7 @@ static irqreturn_t e100_intr(int irq, void *dev_id)
|
||||
if (stat_ack & stat_ack_rnr)
|
||||
nic->ru_running = RU_SUSPENDED;
|
||||
|
||||
if (!nic->ecdev && likely(napi_schedule_prep(&nic->napi))) {
|
||||
if (!get_ecdev(nic) && likely(napi_schedule_prep(&nic->napi))) {
|
||||
e100_disable_irq(nic);
|
||||
__napi_schedule(&nic->napi);
|
||||
}
|
||||
@@ -2418,13 +2427,13 @@ static int e100_up(struct nic *nic)
|
||||
goto err_clean_cbs;
|
||||
e100_set_multicast_list(nic->netdev);
|
||||
e100_start_receiver(nic, NULL);
|
||||
if (!nic->ecdev) {
|
||||
if (!get_ecdev(nic)) {
|
||||
mod_timer(&nic->watchdog, jiffies);
|
||||
}
|
||||
if ((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED,
|
||||
nic->netdev->name, nic->netdev)))
|
||||
goto err_no_irq;
|
||||
if (!nic->ecdev) {
|
||||
if (!get_ecdev(nic)) {
|
||||
netif_wake_queue(nic->netdev);
|
||||
napi_enable(&nic->napi);
|
||||
/* enable ints _after_ enabling poll, preventing a race between
|
||||
@@ -2434,7 +2443,7 @@ static int e100_up(struct nic *nic)
|
||||
return 0;
|
||||
|
||||
err_no_irq:
|
||||
if (!nic->ecdev)
|
||||
if (!get_ecdev(nic))
|
||||
del_timer_sync(&nic->watchdog);
|
||||
err_clean_cbs:
|
||||
e100_clean_cbs(nic);
|
||||
@@ -2445,14 +2454,14 @@ err_rx_clean_list:
|
||||
|
||||
static void e100_down(struct nic *nic)
|
||||
{
|
||||
if (!nic->ecdev) {
|
||||
if (!get_ecdev(nic)) {
|
||||
/* wait here for poll to complete */
|
||||
napi_disable(&nic->napi);
|
||||
netif_stop_queue(nic->netdev);
|
||||
}
|
||||
e100_hw_reset(nic);
|
||||
free_irq(nic->pdev->irq, nic->netdev);
|
||||
if (!nic->ecdev) {
|
||||
if (!get_ecdev(nic)) {
|
||||
del_timer_sync(&nic->watchdog);
|
||||
netif_carrier_off(nic->netdev);
|
||||
}
|
||||
@@ -2929,7 +2938,7 @@ static int e100_open(struct net_device *netdev)
|
||||
struct nic *nic = netdev_priv(netdev);
|
||||
int err = 0;
|
||||
|
||||
if (!nic->ecdev)
|
||||
if (!get_ecdev(nic))
|
||||
netif_carrier_off(netdev);
|
||||
if ((err = e100_up(nic)))
|
||||
netif_err(nic, ifup, nic->netdev, "Cannot open interface, aborting\n");
|
||||
@@ -3089,9 +3098,13 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
pci_pme_active(pdev, false);
|
||||
|
||||
// offer device to EtherCAT master module
|
||||
nic->ecdev = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
nic->ecdev_ = ecdev_offer(netdev, e100_ec_poll, THIS_MODULE);
|
||||
nic->ecdev_initialized = true;
|
||||
|
||||
if (!nic->ecdev) {
|
||||
if (get_ecdev(nic)) {
|
||||
nic->ec_watchdog_jiffies = jiffies;
|
||||
}
|
||||
else {
|
||||
strcpy(netdev->name, "eth%d");
|
||||
if ((err = register_netdev(netdev))) {
|
||||
netif_err(nic, probe, nic->netdev,
|
||||
@@ -3115,10 +3128,10 @@ static int e100_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
|
||||
(unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0),
|
||||
pdev->irq, netdev->dev_addr);
|
||||
|
||||
if (nic->ecdev) {
|
||||
err = ecdev_open(nic->ecdev);
|
||||
if (get_ecdev(nic)) {
|
||||
err = ecdev_open(get_ecdev(nic));
|
||||
if (err) {
|
||||
ecdev_withdraw(nic->ecdev);
|
||||
ecdev_withdraw(get_ecdev(nic));
|
||||
goto err_out_free;
|
||||
}
|
||||
}
|
||||
@@ -3146,9 +3159,9 @@ static void e100_remove(struct pci_dev *pdev)
|
||||
|
||||
if (netdev) {
|
||||
struct nic *nic = netdev_priv(netdev);
|
||||
if (nic->ecdev) {
|
||||
ecdev_close(nic->ecdev);
|
||||
ecdev_withdraw(nic->ecdev);
|
||||
if (get_ecdev(nic)) {
|
||||
ecdev_close(get_ecdev(nic));
|
||||
ecdev_withdraw(get_ecdev(nic));
|
||||
} else {
|
||||
unregister_netdev(netdev);
|
||||
}
|
||||
@@ -3263,7 +3276,7 @@ static pci_ers_result_t e100_io_error_detected(struct pci_dev *pdev, pci_channel
|
||||
struct net_device *netdev = pci_get_drvdata(pdev);
|
||||
struct nic *nic = netdev_priv(netdev);
|
||||
|
||||
if (nic->ecdev)
|
||||
if (get_ecdev(nic))
|
||||
return -EBUSY;
|
||||
|
||||
netif_device_detach(netdev);
|
||||
@@ -3290,7 +3303,7 @@ static pci_ers_result_t e100_io_slot_reset(struct pci_dev *pdev)
|
||||
struct net_device *netdev = pci_get_drvdata(pdev);
|
||||
struct nic *nic = netdev_priv(netdev);
|
||||
|
||||
if (nic->ecdev)
|
||||
if (get_ecdev(nic))
|
||||
return -EBUSY;
|
||||
|
||||
if (pci_enable_device(pdev)) {
|
||||
@@ -3323,11 +3336,11 @@ static void e100_io_resume(struct pci_dev *pdev)
|
||||
/* ack any pending wake events, disable PME */
|
||||
pci_enable_wake(pdev, PCI_D0, 0);
|
||||
|
||||
if (!nic->ecdev)
|
||||
if (!get_ecdev(nic))
|
||||
netif_device_attach(netdev);
|
||||
if (nic->ecdev || netif_running(netdev)) {
|
||||
if (get_ecdev(nic) || netif_running(netdev)) {
|
||||
e100_open(netdev);
|
||||
if (!nic->ecdev)
|
||||
if (!get_ecdev(nic))
|
||||
mod_timer(&nic->watchdog, jiffies);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,10 @@ EXTRA_DIST = \
|
||||
e1000-5.15-orig.h \
|
||||
e1000-6.1-ethercat.h \
|
||||
e1000-6.1-orig.h \
|
||||
e1000-6.12-ethercat.h \
|
||||
e1000-6.12-orig.h \
|
||||
e1000-6.4-ethercat.h \
|
||||
e1000-6.4-orig.h \
|
||||
e1000_ethtool-3.0-ethercat.c \
|
||||
e1000_ethtool-3.0-orig.c \
|
||||
e1000_ethtool-3.10-ethercat.c \
|
||||
@@ -75,6 +79,10 @@ EXTRA_DIST = \
|
||||
e1000_ethtool-5.15-orig.c \
|
||||
e1000_ethtool-6.1-ethercat.c \
|
||||
e1000_ethtool-6.1-orig.c \
|
||||
e1000_ethtool-6.12-ethercat.c \
|
||||
e1000_ethtool-6.12-orig.c \
|
||||
e1000_ethtool-6.4-ethercat.c \
|
||||
e1000_ethtool-6.4-orig.c \
|
||||
e1000_hw-3.0-ethercat.c \
|
||||
e1000_hw-3.0-ethercat.h \
|
||||
e1000_hw-3.0-orig.c \
|
||||
@@ -127,6 +135,14 @@ EXTRA_DIST = \
|
||||
e1000_hw-6.1-ethercat.h \
|
||||
e1000_hw-6.1-orig.c \
|
||||
e1000_hw-6.1-orig.h \
|
||||
e1000_hw-6.12-ethercat.c \
|
||||
e1000_hw-6.12-ethercat.h \
|
||||
e1000_hw-6.12-orig.c \
|
||||
e1000_hw-6.12-orig.h \
|
||||
e1000_hw-6.4-ethercat.c \
|
||||
e1000_hw-6.4-ethercat.h \
|
||||
e1000_hw-6.4-orig.c \
|
||||
e1000_hw-6.4-orig.h \
|
||||
e1000_main-3.0-ethercat.c \
|
||||
e1000_main-3.0-orig.c \
|
||||
e1000_main-3.10-ethercat.c \
|
||||
@@ -153,6 +169,10 @@ EXTRA_DIST = \
|
||||
e1000_main-5.15-orig.c \
|
||||
e1000_main-6.1-ethercat.c \
|
||||
e1000_main-6.1-orig.c \
|
||||
e1000_main-6.12-ethercat.c \
|
||||
e1000_main-6.12-orig.c \
|
||||
e1000_main-6.4-ethercat.c \
|
||||
e1000_main-6.4-orig.c \
|
||||
e1000_osdep-3.0-ethercat.h \
|
||||
e1000_osdep-3.0-orig.h \
|
||||
e1000_osdep-3.10-ethercat.h \
|
||||
@@ -179,6 +199,10 @@ EXTRA_DIST = \
|
||||
e1000_osdep-5.15-orig.h \
|
||||
e1000_osdep-6.1-ethercat.h \
|
||||
e1000_osdep-6.1-orig.h \
|
||||
e1000_osdep-6.12-ethercat.h \
|
||||
e1000_osdep-6.12-orig.h \
|
||||
e1000_osdep-6.4-ethercat.h \
|
||||
e1000_osdep-6.4-orig.h \
|
||||
e1000_param-3.0-ethercat.c \
|
||||
e1000_param-3.0-orig.c \
|
||||
e1000_param-3.10-ethercat.c \
|
||||
@@ -204,6 +228,11 @@ EXTRA_DIST = \
|
||||
e1000_param-5.15-ethercat.c \
|
||||
e1000_param-5.15-orig.c \
|
||||
e1000_param-6.1-ethercat.c \
|
||||
e1000_param-6.1-orig.c
|
||||
e1000_param-6.1-orig.c \
|
||||
e1000_param-6.12-ethercat.c \
|
||||
e1000_param-6.12-orig.c \
|
||||
e1000_param-6.4-ethercat.c \
|
||||
e1000_param-6.4-orig.c \
|
||||
update.sh
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,367 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright(c) 1999 - 2006 Intel Corporation. */
|
||||
|
||||
/* Linux PRO/1000 Ethernet Driver main header file */
|
||||
|
||||
#ifndef _E1000_H_
|
||||
#define _E1000_H_
|
||||
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/irq.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/ipv6.h>
|
||||
#include <linux/irq_work.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/udp.h>
|
||||
#include <net/pkt_sched.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <net/checksum.h>
|
||||
#include <linux/mii.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include "../ecdev.h"
|
||||
|
||||
|
||||
#define BAR_0 0
|
||||
#define BAR_1 1
|
||||
|
||||
#define INTEL_E1000_ETHERNET_DEVICE(device_id) {\
|
||||
PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)}
|
||||
|
||||
struct e1000_adapter;
|
||||
|
||||
#include "e1000_hw-6.12-ethercat.h"
|
||||
|
||||
#define E1000_MAX_INTR 10
|
||||
|
||||
/*
|
||||
* Count for polling __E1000_RESET condition every 10-20msec.
|
||||
*/
|
||||
#define E1000_CHECK_RESET_COUNT 50
|
||||
|
||||
/* TX/RX descriptor defines */
|
||||
#define E1000_DEFAULT_TXD 256
|
||||
#define E1000_MAX_TXD 256
|
||||
#define E1000_MIN_TXD 48
|
||||
#define E1000_MAX_82544_TXD 4096
|
||||
|
||||
#define E1000_DEFAULT_RXD 256
|
||||
#define E1000_MAX_RXD 256
|
||||
#define E1000_MIN_RXD 48
|
||||
#define E1000_MAX_82544_RXD 4096
|
||||
|
||||
#define E1000_MIN_ITR_USECS 10 /* 100000 irq/sec */
|
||||
#define E1000_MAX_ITR_USECS 10000 /* 100 irq/sec */
|
||||
|
||||
/* this is the size past which hardware will drop packets when setting LPE=0 */
|
||||
#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
|
||||
|
||||
/* Supported Rx Buffer Sizes */
|
||||
#define E1000_RXBUFFER_128 128 /* Used for packet split */
|
||||
#define E1000_RXBUFFER_256 256 /* Used for packet split */
|
||||
#define E1000_RXBUFFER_512 512
|
||||
#define E1000_RXBUFFER_1024 1024
|
||||
#define E1000_RXBUFFER_2048 2048
|
||||
#define E1000_RXBUFFER_4096 4096
|
||||
#define E1000_RXBUFFER_8192 8192
|
||||
#define E1000_RXBUFFER_16384 16384
|
||||
|
||||
/* SmartSpeed delimiters */
|
||||
#define E1000_SMARTSPEED_DOWNSHIFT 3
|
||||
#define E1000_SMARTSPEED_MAX 15
|
||||
|
||||
/* Packet Buffer allocations */
|
||||
#define E1000_PBA_BYTES_SHIFT 0xA
|
||||
#define E1000_TX_HEAD_ADDR_SHIFT 7
|
||||
#define E1000_PBA_TX_MASK 0xFFFF0000
|
||||
|
||||
/* Flow Control Watermarks */
|
||||
#define E1000_FC_HIGH_DIFF 0x1638 /* High: 5688 bytes below Rx FIFO size */
|
||||
#define E1000_FC_LOW_DIFF 0x1640 /* Low: 5696 bytes below Rx FIFO size */
|
||||
|
||||
#define E1000_FC_PAUSE_TIME 0xFFFF /* pause for the max or until send xon */
|
||||
|
||||
/* How many Tx Descriptors do we need to call netif_wake_queue ? */
|
||||
#define E1000_TX_QUEUE_WAKE 16
|
||||
/* How many Rx Buffers do we bundle into one write to the hardware ? */
|
||||
#define E1000_RX_BUFFER_WRITE 16 /* Must be power of 2 */
|
||||
|
||||
#define AUTO_ALL_MODES 0
|
||||
#define E1000_EEPROM_82544_APM 0x0004
|
||||
#define E1000_EEPROM_APME 0x0400
|
||||
|
||||
#ifndef E1000_MASTER_SLAVE
|
||||
/* Switch to override PHY master/slave setting */
|
||||
#define E1000_MASTER_SLAVE e1000_ms_hw_default
|
||||
#endif
|
||||
|
||||
#define E1000_MNG_VLAN_NONE (-1)
|
||||
|
||||
/* wrapper around a pointer to a socket buffer,
|
||||
* so a DMA handle can be stored along with the buffer
|
||||
*/
|
||||
struct e1000_tx_buffer {
|
||||
struct sk_buff *skb;
|
||||
dma_addr_t dma;
|
||||
unsigned long time_stamp;
|
||||
u16 length;
|
||||
u16 next_to_watch;
|
||||
bool mapped_as_page;
|
||||
unsigned short segs;
|
||||
unsigned int bytecount;
|
||||
};
|
||||
|
||||
struct e1000_rx_buffer {
|
||||
union {
|
||||
struct page *page; /* jumbo: alloc_page */
|
||||
u8 *data; /* else, netdev_alloc_frag */
|
||||
} rxbuf;
|
||||
dma_addr_t dma;
|
||||
};
|
||||
|
||||
struct e1000_tx_ring {
|
||||
/* pointer to the descriptor ring memory */
|
||||
void *desc;
|
||||
/* physical address of the descriptor ring */
|
||||
dma_addr_t dma;
|
||||
/* length of descriptor ring in bytes */
|
||||
unsigned int size;
|
||||
/* number of descriptors in the ring */
|
||||
unsigned int count;
|
||||
/* next descriptor to associate a buffer with */
|
||||
unsigned int next_to_use;
|
||||
/* next descriptor to check for DD status bit */
|
||||
unsigned int next_to_clean;
|
||||
/* array of buffer information structs */
|
||||
struct e1000_tx_buffer *buffer_info;
|
||||
|
||||
u16 tdh;
|
||||
u16 tdt;
|
||||
bool last_tx_tso;
|
||||
};
|
||||
|
||||
struct e1000_rx_ring {
|
||||
/* pointer to the descriptor ring memory */
|
||||
void *desc;
|
||||
/* physical address of the descriptor ring */
|
||||
dma_addr_t dma;
|
||||
/* length of descriptor ring in bytes */
|
||||
unsigned int size;
|
||||
/* number of descriptors in the ring */
|
||||
unsigned int count;
|
||||
/* next descriptor to associate a buffer with */
|
||||
unsigned int next_to_use;
|
||||
/* next descriptor to check for DD status bit */
|
||||
unsigned int next_to_clean;
|
||||
/* array of buffer information structs */
|
||||
struct e1000_rx_buffer *buffer_info;
|
||||
struct sk_buff *rx_skb_top;
|
||||
|
||||
/* cpu for rx queue */
|
||||
int cpu;
|
||||
|
||||
u16 rdh;
|
||||
u16 rdt;
|
||||
};
|
||||
|
||||
#define E1000_DESC_UNUSED(R) \
|
||||
({ \
|
||||
unsigned int clean = smp_load_acquire(&(R)->next_to_clean); \
|
||||
unsigned int use = READ_ONCE((R)->next_to_use); \
|
||||
(clean > use ? 0 : (R)->count) + clean - use - 1; \
|
||||
})
|
||||
|
||||
#define E1000_RX_DESC_EXT(R, i) \
|
||||
(&(((union e1000_rx_desc_extended *)((R).desc))[i]))
|
||||
#define E1000_GET_DESC(R, i, type) (&(((struct type *)((R).desc))[i]))
|
||||
#define E1000_RX_DESC(R, i) E1000_GET_DESC(R, i, e1000_rx_desc)
|
||||
#define E1000_TX_DESC(R, i) E1000_GET_DESC(R, i, e1000_tx_desc)
|
||||
#define E1000_CONTEXT_DESC(R, i) E1000_GET_DESC(R, i, e1000_context_desc)
|
||||
|
||||
/* board specific private data structure */
|
||||
|
||||
struct e1000_adapter {
|
||||
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
|
||||
u16 mng_vlan_id;
|
||||
u32 bd_number;
|
||||
u32 rx_buffer_len;
|
||||
u32 wol;
|
||||
u32 smartspeed;
|
||||
u32 en_mng_pt;
|
||||
u16 link_speed;
|
||||
u16 link_duplex;
|
||||
spinlock_t stats_lock;
|
||||
unsigned int total_tx_bytes;
|
||||
unsigned int total_tx_packets;
|
||||
unsigned int total_rx_bytes;
|
||||
unsigned int total_rx_packets;
|
||||
/* Interrupt Throttle Rate */
|
||||
u32 itr;
|
||||
u32 itr_setting;
|
||||
u16 tx_itr;
|
||||
u16 rx_itr;
|
||||
|
||||
u8 fc_autoneg;
|
||||
|
||||
/* TX */
|
||||
struct e1000_tx_ring *tx_ring; /* One per active queue */
|
||||
unsigned int restart_queue;
|
||||
u32 txd_cmd;
|
||||
u32 tx_int_delay;
|
||||
u32 tx_abs_int_delay;
|
||||
u32 gotcl;
|
||||
u64 gotcl_old;
|
||||
u64 tpt_old;
|
||||
u64 colc_old;
|
||||
u32 tx_timeout_count;
|
||||
u32 tx_fifo_head;
|
||||
u32 tx_head_addr;
|
||||
u32 tx_fifo_size;
|
||||
u8 tx_timeout_factor;
|
||||
atomic_t tx_fifo_stall;
|
||||
bool pcix_82544;
|
||||
bool detect_tx_hung;
|
||||
bool dump_buffers;
|
||||
|
||||
/* RX */
|
||||
bool (*clean_rx)(struct e1000_adapter *adapter,
|
||||
struct e1000_rx_ring *rx_ring,
|
||||
int *work_done, int work_to_do);
|
||||
void (*alloc_rx_buf)(struct e1000_adapter *adapter,
|
||||
struct e1000_rx_ring *rx_ring,
|
||||
int cleaned_count);
|
||||
struct e1000_rx_ring *rx_ring; /* One per active queue */
|
||||
struct napi_struct napi;
|
||||
|
||||
int num_tx_queues;
|
||||
int num_rx_queues;
|
||||
|
||||
u64 hw_csum_err;
|
||||
u64 hw_csum_good;
|
||||
u32 alloc_rx_buff_failed;
|
||||
u32 rx_int_delay;
|
||||
u32 rx_abs_int_delay;
|
||||
bool rx_csum;
|
||||
u32 gorcl;
|
||||
u64 gorcl_old;
|
||||
|
||||
/* OS defined structs */
|
||||
struct net_device *netdev;
|
||||
struct pci_dev *pdev;
|
||||
|
||||
/* structs defined in e1000_hw.h */
|
||||
struct e1000_hw hw;
|
||||
struct e1000_hw_stats stats;
|
||||
struct e1000_phy_info phy_info;
|
||||
struct e1000_phy_stats phy_stats;
|
||||
|
||||
u32 test_icr;
|
||||
struct e1000_tx_ring test_tx_ring;
|
||||
struct e1000_rx_ring test_rx_ring;
|
||||
|
||||
int msg_enable;
|
||||
|
||||
/* to not mess up cache alignment, always add to the bottom */
|
||||
bool tso_force;
|
||||
bool smart_power_down; /* phy smart power down */
|
||||
bool quad_port_a;
|
||||
unsigned long flags;
|
||||
u32 eeprom_wol;
|
||||
|
||||
/* for ioport free */
|
||||
int bars;
|
||||
int need_ioport;
|
||||
|
||||
bool discarding;
|
||||
|
||||
struct work_struct reset_task;
|
||||
struct delayed_work watchdog_task;
|
||||
struct delayed_work fifo_stall_task;
|
||||
struct delayed_work phy_info_task;
|
||||
|
||||
ec_device_t *ecdev_;
|
||||
unsigned long ec_watchdog_jiffies;
|
||||
struct irq_work ec_watchdog_kicker;
|
||||
bool ecdev_initialized;
|
||||
};
|
||||
|
||||
static inline ec_device_t *get_ecdev(struct e1000_adapter *adapter)
|
||||
{
|
||||
#ifdef EC_ENABLE_DRIVER_RESOURCE_VERIFYING
|
||||
WARN_ON(!adapter->ecdev_initialized);
|
||||
#endif
|
||||
return adapter->ecdev_;
|
||||
}
|
||||
|
||||
enum e1000_state_t {
|
||||
__E1000_TESTING,
|
||||
__E1000_RESETTING,
|
||||
__E1000_DOWN,
|
||||
__E1000_DISABLED
|
||||
};
|
||||
|
||||
#undef pr_fmt
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
struct net_device *e1000_get_hw_dev(struct e1000_hw *hw);
|
||||
#define e_dbg(format, arg...) \
|
||||
netdev_dbg(e1000_get_hw_dev(hw), format, ## arg)
|
||||
#define e_err(msglvl, format, arg...) \
|
||||
netif_err(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_info(msglvl, format, arg...) \
|
||||
netif_info(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_warn(msglvl, format, arg...) \
|
||||
netif_warn(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_notice(msglvl, format, arg...) \
|
||||
netif_notice(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_dev_info(format, arg...) \
|
||||
dev_info(&adapter->pdev->dev, format, ## arg)
|
||||
#define e_dev_warn(format, arg...) \
|
||||
dev_warn(&adapter->pdev->dev, format, ## arg)
|
||||
#define e_dev_err(format, arg...) \
|
||||
dev_err(&adapter->pdev->dev, format, ## arg)
|
||||
|
||||
extern char e1000_driver_name[];
|
||||
|
||||
int e1000_open(struct net_device *netdev);
|
||||
int e1000_close(struct net_device *netdev);
|
||||
int e1000_up(struct e1000_adapter *adapter);
|
||||
void e1000_down(struct e1000_adapter *adapter);
|
||||
void e1000_reinit_locked(struct e1000_adapter *adapter);
|
||||
void e1000_reset(struct e1000_adapter *adapter);
|
||||
int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx);
|
||||
int e1000_setup_all_rx_resources(struct e1000_adapter *adapter);
|
||||
int e1000_setup_all_tx_resources(struct e1000_adapter *adapter);
|
||||
void e1000_free_all_rx_resources(struct e1000_adapter *adapter);
|
||||
void e1000_free_all_tx_resources(struct e1000_adapter *adapter);
|
||||
void e1000_update_stats(struct e1000_adapter *adapter);
|
||||
bool e1000_has_link(struct e1000_adapter *adapter);
|
||||
void e1000_power_up_phy(struct e1000_adapter *);
|
||||
void e1000_set_ethtool_ops(struct net_device *netdev);
|
||||
void e1000_check_options(struct e1000_adapter *adapter);
|
||||
|
||||
#endif /* _E1000_H_ */
|
||||
@@ -0,0 +1,351 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright(c) 1999 - 2006 Intel Corporation. */
|
||||
|
||||
/* Linux PRO/1000 Ethernet Driver main header file */
|
||||
|
||||
#ifndef _E1000_H_
|
||||
#define _E1000_H_
|
||||
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/irq.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/ipv6.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/udp.h>
|
||||
#include <net/pkt_sched.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <net/checksum.h>
|
||||
#include <linux/mii.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/if_vlan.h>
|
||||
|
||||
#define BAR_0 0
|
||||
#define BAR_1 1
|
||||
|
||||
#define INTEL_E1000_ETHERNET_DEVICE(device_id) {\
|
||||
PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)}
|
||||
|
||||
struct e1000_adapter;
|
||||
|
||||
#include "e1000_hw.h"
|
||||
|
||||
#define E1000_MAX_INTR 10
|
||||
|
||||
/*
|
||||
* Count for polling __E1000_RESET condition every 10-20msec.
|
||||
*/
|
||||
#define E1000_CHECK_RESET_COUNT 50
|
||||
|
||||
/* TX/RX descriptor defines */
|
||||
#define E1000_DEFAULT_TXD 256
|
||||
#define E1000_MAX_TXD 256
|
||||
#define E1000_MIN_TXD 48
|
||||
#define E1000_MAX_82544_TXD 4096
|
||||
|
||||
#define E1000_DEFAULT_RXD 256
|
||||
#define E1000_MAX_RXD 256
|
||||
#define E1000_MIN_RXD 48
|
||||
#define E1000_MAX_82544_RXD 4096
|
||||
|
||||
#define E1000_MIN_ITR_USECS 10 /* 100000 irq/sec */
|
||||
#define E1000_MAX_ITR_USECS 10000 /* 100 irq/sec */
|
||||
|
||||
/* this is the size past which hardware will drop packets when setting LPE=0 */
|
||||
#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
|
||||
|
||||
/* Supported Rx Buffer Sizes */
|
||||
#define E1000_RXBUFFER_128 128 /* Used for packet split */
|
||||
#define E1000_RXBUFFER_256 256 /* Used for packet split */
|
||||
#define E1000_RXBUFFER_512 512
|
||||
#define E1000_RXBUFFER_1024 1024
|
||||
#define E1000_RXBUFFER_2048 2048
|
||||
#define E1000_RXBUFFER_4096 4096
|
||||
#define E1000_RXBUFFER_8192 8192
|
||||
#define E1000_RXBUFFER_16384 16384
|
||||
|
||||
/* SmartSpeed delimiters */
|
||||
#define E1000_SMARTSPEED_DOWNSHIFT 3
|
||||
#define E1000_SMARTSPEED_MAX 15
|
||||
|
||||
/* Packet Buffer allocations */
|
||||
#define E1000_PBA_BYTES_SHIFT 0xA
|
||||
#define E1000_TX_HEAD_ADDR_SHIFT 7
|
||||
#define E1000_PBA_TX_MASK 0xFFFF0000
|
||||
|
||||
/* Flow Control Watermarks */
|
||||
#define E1000_FC_HIGH_DIFF 0x1638 /* High: 5688 bytes below Rx FIFO size */
|
||||
#define E1000_FC_LOW_DIFF 0x1640 /* Low: 5696 bytes below Rx FIFO size */
|
||||
|
||||
#define E1000_FC_PAUSE_TIME 0xFFFF /* pause for the max or until send xon */
|
||||
|
||||
/* How many Tx Descriptors do we need to call netif_wake_queue ? */
|
||||
#define E1000_TX_QUEUE_WAKE 16
|
||||
/* How many Rx Buffers do we bundle into one write to the hardware ? */
|
||||
#define E1000_RX_BUFFER_WRITE 16 /* Must be power of 2 */
|
||||
|
||||
#define AUTO_ALL_MODES 0
|
||||
#define E1000_EEPROM_82544_APM 0x0004
|
||||
#define E1000_EEPROM_APME 0x0400
|
||||
|
||||
#ifndef E1000_MASTER_SLAVE
|
||||
/* Switch to override PHY master/slave setting */
|
||||
#define E1000_MASTER_SLAVE e1000_ms_hw_default
|
||||
#endif
|
||||
|
||||
#define E1000_MNG_VLAN_NONE (-1)
|
||||
|
||||
/* wrapper around a pointer to a socket buffer,
|
||||
* so a DMA handle can be stored along with the buffer
|
||||
*/
|
||||
struct e1000_tx_buffer {
|
||||
struct sk_buff *skb;
|
||||
dma_addr_t dma;
|
||||
unsigned long time_stamp;
|
||||
u16 length;
|
||||
u16 next_to_watch;
|
||||
bool mapped_as_page;
|
||||
unsigned short segs;
|
||||
unsigned int bytecount;
|
||||
};
|
||||
|
||||
struct e1000_rx_buffer {
|
||||
union {
|
||||
struct page *page; /* jumbo: alloc_page */
|
||||
u8 *data; /* else, netdev_alloc_frag */
|
||||
} rxbuf;
|
||||
dma_addr_t dma;
|
||||
};
|
||||
|
||||
struct e1000_tx_ring {
|
||||
/* pointer to the descriptor ring memory */
|
||||
void *desc;
|
||||
/* physical address of the descriptor ring */
|
||||
dma_addr_t dma;
|
||||
/* length of descriptor ring in bytes */
|
||||
unsigned int size;
|
||||
/* number of descriptors in the ring */
|
||||
unsigned int count;
|
||||
/* next descriptor to associate a buffer with */
|
||||
unsigned int next_to_use;
|
||||
/* next descriptor to check for DD status bit */
|
||||
unsigned int next_to_clean;
|
||||
/* array of buffer information structs */
|
||||
struct e1000_tx_buffer *buffer_info;
|
||||
|
||||
u16 tdh;
|
||||
u16 tdt;
|
||||
bool last_tx_tso;
|
||||
};
|
||||
|
||||
struct e1000_rx_ring {
|
||||
/* pointer to the descriptor ring memory */
|
||||
void *desc;
|
||||
/* physical address of the descriptor ring */
|
||||
dma_addr_t dma;
|
||||
/* length of descriptor ring in bytes */
|
||||
unsigned int size;
|
||||
/* number of descriptors in the ring */
|
||||
unsigned int count;
|
||||
/* next descriptor to associate a buffer with */
|
||||
unsigned int next_to_use;
|
||||
/* next descriptor to check for DD status bit */
|
||||
unsigned int next_to_clean;
|
||||
/* array of buffer information structs */
|
||||
struct e1000_rx_buffer *buffer_info;
|
||||
struct sk_buff *rx_skb_top;
|
||||
|
||||
/* cpu for rx queue */
|
||||
int cpu;
|
||||
|
||||
u16 rdh;
|
||||
u16 rdt;
|
||||
};
|
||||
|
||||
#define E1000_DESC_UNUSED(R) \
|
||||
({ \
|
||||
unsigned int clean = smp_load_acquire(&(R)->next_to_clean); \
|
||||
unsigned int use = READ_ONCE((R)->next_to_use); \
|
||||
(clean > use ? 0 : (R)->count) + clean - use - 1; \
|
||||
})
|
||||
|
||||
#define E1000_RX_DESC_EXT(R, i) \
|
||||
(&(((union e1000_rx_desc_extended *)((R).desc))[i]))
|
||||
#define E1000_GET_DESC(R, i, type) (&(((struct type *)((R).desc))[i]))
|
||||
#define E1000_RX_DESC(R, i) E1000_GET_DESC(R, i, e1000_rx_desc)
|
||||
#define E1000_TX_DESC(R, i) E1000_GET_DESC(R, i, e1000_tx_desc)
|
||||
#define E1000_CONTEXT_DESC(R, i) E1000_GET_DESC(R, i, e1000_context_desc)
|
||||
|
||||
/* board specific private data structure */
|
||||
|
||||
struct e1000_adapter {
|
||||
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
|
||||
u16 mng_vlan_id;
|
||||
u32 bd_number;
|
||||
u32 rx_buffer_len;
|
||||
u32 wol;
|
||||
u32 smartspeed;
|
||||
u32 en_mng_pt;
|
||||
u16 link_speed;
|
||||
u16 link_duplex;
|
||||
spinlock_t stats_lock;
|
||||
unsigned int total_tx_bytes;
|
||||
unsigned int total_tx_packets;
|
||||
unsigned int total_rx_bytes;
|
||||
unsigned int total_rx_packets;
|
||||
/* Interrupt Throttle Rate */
|
||||
u32 itr;
|
||||
u32 itr_setting;
|
||||
u16 tx_itr;
|
||||
u16 rx_itr;
|
||||
|
||||
u8 fc_autoneg;
|
||||
|
||||
/* TX */
|
||||
struct e1000_tx_ring *tx_ring; /* One per active queue */
|
||||
unsigned int restart_queue;
|
||||
u32 txd_cmd;
|
||||
u32 tx_int_delay;
|
||||
u32 tx_abs_int_delay;
|
||||
u32 gotcl;
|
||||
u64 gotcl_old;
|
||||
u64 tpt_old;
|
||||
u64 colc_old;
|
||||
u32 tx_timeout_count;
|
||||
u32 tx_fifo_head;
|
||||
u32 tx_head_addr;
|
||||
u32 tx_fifo_size;
|
||||
u8 tx_timeout_factor;
|
||||
atomic_t tx_fifo_stall;
|
||||
bool pcix_82544;
|
||||
bool detect_tx_hung;
|
||||
bool dump_buffers;
|
||||
|
||||
/* RX */
|
||||
bool (*clean_rx)(struct e1000_adapter *adapter,
|
||||
struct e1000_rx_ring *rx_ring,
|
||||
int *work_done, int work_to_do);
|
||||
void (*alloc_rx_buf)(struct e1000_adapter *adapter,
|
||||
struct e1000_rx_ring *rx_ring,
|
||||
int cleaned_count);
|
||||
struct e1000_rx_ring *rx_ring; /* One per active queue */
|
||||
struct napi_struct napi;
|
||||
|
||||
int num_tx_queues;
|
||||
int num_rx_queues;
|
||||
|
||||
u64 hw_csum_err;
|
||||
u64 hw_csum_good;
|
||||
u32 alloc_rx_buff_failed;
|
||||
u32 rx_int_delay;
|
||||
u32 rx_abs_int_delay;
|
||||
bool rx_csum;
|
||||
u32 gorcl;
|
||||
u64 gorcl_old;
|
||||
|
||||
/* OS defined structs */
|
||||
struct net_device *netdev;
|
||||
struct pci_dev *pdev;
|
||||
|
||||
/* structs defined in e1000_hw.h */
|
||||
struct e1000_hw hw;
|
||||
struct e1000_hw_stats stats;
|
||||
struct e1000_phy_info phy_info;
|
||||
struct e1000_phy_stats phy_stats;
|
||||
|
||||
u32 test_icr;
|
||||
struct e1000_tx_ring test_tx_ring;
|
||||
struct e1000_rx_ring test_rx_ring;
|
||||
|
||||
int msg_enable;
|
||||
|
||||
/* to not mess up cache alignment, always add to the bottom */
|
||||
bool tso_force;
|
||||
bool smart_power_down; /* phy smart power down */
|
||||
bool quad_port_a;
|
||||
unsigned long flags;
|
||||
u32 eeprom_wol;
|
||||
|
||||
/* for ioport free */
|
||||
int bars;
|
||||
int need_ioport;
|
||||
|
||||
bool discarding;
|
||||
|
||||
struct work_struct reset_task;
|
||||
struct delayed_work watchdog_task;
|
||||
struct delayed_work fifo_stall_task;
|
||||
struct delayed_work phy_info_task;
|
||||
};
|
||||
|
||||
enum e1000_state_t {
|
||||
__E1000_TESTING,
|
||||
__E1000_RESETTING,
|
||||
__E1000_DOWN,
|
||||
__E1000_DISABLED
|
||||
};
|
||||
|
||||
#undef pr_fmt
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
struct net_device *e1000_get_hw_dev(struct e1000_hw *hw);
|
||||
#define e_dbg(format, arg...) \
|
||||
netdev_dbg(e1000_get_hw_dev(hw), format, ## arg)
|
||||
#define e_err(msglvl, format, arg...) \
|
||||
netif_err(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_info(msglvl, format, arg...) \
|
||||
netif_info(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_warn(msglvl, format, arg...) \
|
||||
netif_warn(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_notice(msglvl, format, arg...) \
|
||||
netif_notice(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_dev_info(format, arg...) \
|
||||
dev_info(&adapter->pdev->dev, format, ## arg)
|
||||
#define e_dev_warn(format, arg...) \
|
||||
dev_warn(&adapter->pdev->dev, format, ## arg)
|
||||
#define e_dev_err(format, arg...) \
|
||||
dev_err(&adapter->pdev->dev, format, ## arg)
|
||||
|
||||
extern char e1000_driver_name[];
|
||||
|
||||
int e1000_open(struct net_device *netdev);
|
||||
int e1000_close(struct net_device *netdev);
|
||||
int e1000_up(struct e1000_adapter *adapter);
|
||||
void e1000_down(struct e1000_adapter *adapter);
|
||||
void e1000_reinit_locked(struct e1000_adapter *adapter);
|
||||
void e1000_reset(struct e1000_adapter *adapter);
|
||||
int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx);
|
||||
int e1000_setup_all_rx_resources(struct e1000_adapter *adapter);
|
||||
int e1000_setup_all_tx_resources(struct e1000_adapter *adapter);
|
||||
void e1000_free_all_rx_resources(struct e1000_adapter *adapter);
|
||||
void e1000_free_all_tx_resources(struct e1000_adapter *adapter);
|
||||
void e1000_update_stats(struct e1000_adapter *adapter);
|
||||
bool e1000_has_link(struct e1000_adapter *adapter);
|
||||
void e1000_power_up_phy(struct e1000_adapter *);
|
||||
void e1000_set_ethtool_ops(struct net_device *netdev);
|
||||
void e1000_check_options(struct e1000_adapter *adapter);
|
||||
|
||||
#endif /* _E1000_H_ */
|
||||
@@ -0,0 +1,368 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright(c) 1999 - 2006 Intel Corporation. */
|
||||
|
||||
/* Linux PRO/1000 Ethernet Driver main header file */
|
||||
|
||||
#ifndef _E1000_H_
|
||||
#define _E1000_H_
|
||||
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/irq.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/ipv6.h>
|
||||
#include <linux/irq_work.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/udp.h>
|
||||
#include <net/pkt_sched.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <net/checksum.h>
|
||||
#include <linux/mii.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/if_vlan.h>
|
||||
#include "../ecdev.h"
|
||||
|
||||
|
||||
#define BAR_0 0
|
||||
#define BAR_1 1
|
||||
|
||||
#define INTEL_E1000_ETHERNET_DEVICE(device_id) {\
|
||||
PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)}
|
||||
|
||||
struct e1000_adapter;
|
||||
|
||||
#include "e1000_hw-6.4-ethercat.h"
|
||||
|
||||
#define E1000_MAX_INTR 10
|
||||
|
||||
/*
|
||||
* Count for polling __E1000_RESET condition every 10-20msec.
|
||||
*/
|
||||
#define E1000_CHECK_RESET_COUNT 50
|
||||
|
||||
/* TX/RX descriptor defines */
|
||||
#define E1000_DEFAULT_TXD 256
|
||||
#define E1000_MAX_TXD 256
|
||||
#define E1000_MIN_TXD 48
|
||||
#define E1000_MAX_82544_TXD 4096
|
||||
|
||||
#define E1000_DEFAULT_RXD 256
|
||||
#define E1000_MAX_RXD 256
|
||||
#define E1000_MIN_RXD 48
|
||||
#define E1000_MAX_82544_RXD 4096
|
||||
|
||||
#define E1000_MIN_ITR_USECS 10 /* 100000 irq/sec */
|
||||
#define E1000_MAX_ITR_USECS 10000 /* 100 irq/sec */
|
||||
|
||||
/* this is the size past which hardware will drop packets when setting LPE=0 */
|
||||
#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
|
||||
|
||||
/* Supported Rx Buffer Sizes */
|
||||
#define E1000_RXBUFFER_128 128 /* Used for packet split */
|
||||
#define E1000_RXBUFFER_256 256 /* Used for packet split */
|
||||
#define E1000_RXBUFFER_512 512
|
||||
#define E1000_RXBUFFER_1024 1024
|
||||
#define E1000_RXBUFFER_2048 2048
|
||||
#define E1000_RXBUFFER_4096 4096
|
||||
#define E1000_RXBUFFER_8192 8192
|
||||
#define E1000_RXBUFFER_16384 16384
|
||||
|
||||
/* SmartSpeed delimiters */
|
||||
#define E1000_SMARTSPEED_DOWNSHIFT 3
|
||||
#define E1000_SMARTSPEED_MAX 15
|
||||
|
||||
/* Packet Buffer allocations */
|
||||
#define E1000_PBA_BYTES_SHIFT 0xA
|
||||
#define E1000_TX_HEAD_ADDR_SHIFT 7
|
||||
#define E1000_PBA_TX_MASK 0xFFFF0000
|
||||
|
||||
/* Flow Control Watermarks */
|
||||
#define E1000_FC_HIGH_DIFF 0x1638 /* High: 5688 bytes below Rx FIFO size */
|
||||
#define E1000_FC_LOW_DIFF 0x1640 /* Low: 5696 bytes below Rx FIFO size */
|
||||
|
||||
#define E1000_FC_PAUSE_TIME 0xFFFF /* pause for the max or until send xon */
|
||||
|
||||
/* How many Tx Descriptors do we need to call netif_wake_queue ? */
|
||||
#define E1000_TX_QUEUE_WAKE 16
|
||||
/* How many Rx Buffers do we bundle into one write to the hardware ? */
|
||||
#define E1000_RX_BUFFER_WRITE 16 /* Must be power of 2 */
|
||||
|
||||
#define AUTO_ALL_MODES 0
|
||||
#define E1000_EEPROM_82544_APM 0x0004
|
||||
#define E1000_EEPROM_APME 0x0400
|
||||
|
||||
#ifndef E1000_MASTER_SLAVE
|
||||
/* Switch to override PHY master/slave setting */
|
||||
#define E1000_MASTER_SLAVE e1000_ms_hw_default
|
||||
#endif
|
||||
|
||||
#define E1000_MNG_VLAN_NONE (-1)
|
||||
|
||||
/* wrapper around a pointer to a socket buffer,
|
||||
* so a DMA handle can be stored along with the buffer
|
||||
*/
|
||||
struct e1000_tx_buffer {
|
||||
struct sk_buff *skb;
|
||||
dma_addr_t dma;
|
||||
unsigned long time_stamp;
|
||||
u16 length;
|
||||
u16 next_to_watch;
|
||||
bool mapped_as_page;
|
||||
unsigned short segs;
|
||||
unsigned int bytecount;
|
||||
};
|
||||
|
||||
struct e1000_rx_buffer {
|
||||
union {
|
||||
struct page *page; /* jumbo: alloc_page */
|
||||
u8 *data; /* else, netdev_alloc_frag */
|
||||
} rxbuf;
|
||||
dma_addr_t dma;
|
||||
};
|
||||
|
||||
struct e1000_tx_ring {
|
||||
/* pointer to the descriptor ring memory */
|
||||
void *desc;
|
||||
/* physical address of the descriptor ring */
|
||||
dma_addr_t dma;
|
||||
/* length of descriptor ring in bytes */
|
||||
unsigned int size;
|
||||
/* number of descriptors in the ring */
|
||||
unsigned int count;
|
||||
/* next descriptor to associate a buffer with */
|
||||
unsigned int next_to_use;
|
||||
/* next descriptor to check for DD status bit */
|
||||
unsigned int next_to_clean;
|
||||
/* array of buffer information structs */
|
||||
struct e1000_tx_buffer *buffer_info;
|
||||
|
||||
u16 tdh;
|
||||
u16 tdt;
|
||||
bool last_tx_tso;
|
||||
};
|
||||
|
||||
struct e1000_rx_ring {
|
||||
/* pointer to the descriptor ring memory */
|
||||
void *desc;
|
||||
/* physical address of the descriptor ring */
|
||||
dma_addr_t dma;
|
||||
/* length of descriptor ring in bytes */
|
||||
unsigned int size;
|
||||
/* number of descriptors in the ring */
|
||||
unsigned int count;
|
||||
/* next descriptor to associate a buffer with */
|
||||
unsigned int next_to_use;
|
||||
/* next descriptor to check for DD status bit */
|
||||
unsigned int next_to_clean;
|
||||
/* array of buffer information structs */
|
||||
struct e1000_rx_buffer *buffer_info;
|
||||
struct sk_buff *rx_skb_top;
|
||||
|
||||
/* cpu for rx queue */
|
||||
int cpu;
|
||||
|
||||
u16 rdh;
|
||||
u16 rdt;
|
||||
};
|
||||
|
||||
#define E1000_DESC_UNUSED(R) \
|
||||
({ \
|
||||
unsigned int clean = smp_load_acquire(&(R)->next_to_clean); \
|
||||
unsigned int use = READ_ONCE((R)->next_to_use); \
|
||||
(clean > use ? 0 : (R)->count) + clean - use - 1; \
|
||||
})
|
||||
|
||||
#define E1000_RX_DESC_EXT(R, i) \
|
||||
(&(((union e1000_rx_desc_extended *)((R).desc))[i]))
|
||||
#define E1000_GET_DESC(R, i, type) (&(((struct type *)((R).desc))[i]))
|
||||
#define E1000_RX_DESC(R, i) E1000_GET_DESC(R, i, e1000_rx_desc)
|
||||
#define E1000_TX_DESC(R, i) E1000_GET_DESC(R, i, e1000_tx_desc)
|
||||
#define E1000_CONTEXT_DESC(R, i) E1000_GET_DESC(R, i, e1000_context_desc)
|
||||
|
||||
/* board specific private data structure */
|
||||
|
||||
struct e1000_adapter {
|
||||
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
|
||||
u16 mng_vlan_id;
|
||||
u32 bd_number;
|
||||
u32 rx_buffer_len;
|
||||
u32 wol;
|
||||
u32 smartspeed;
|
||||
u32 en_mng_pt;
|
||||
u16 link_speed;
|
||||
u16 link_duplex;
|
||||
spinlock_t stats_lock;
|
||||
unsigned int total_tx_bytes;
|
||||
unsigned int total_tx_packets;
|
||||
unsigned int total_rx_bytes;
|
||||
unsigned int total_rx_packets;
|
||||
/* Interrupt Throttle Rate */
|
||||
u32 itr;
|
||||
u32 itr_setting;
|
||||
u16 tx_itr;
|
||||
u16 rx_itr;
|
||||
|
||||
u8 fc_autoneg;
|
||||
|
||||
/* TX */
|
||||
struct e1000_tx_ring *tx_ring; /* One per active queue */
|
||||
unsigned int restart_queue;
|
||||
u32 txd_cmd;
|
||||
u32 tx_int_delay;
|
||||
u32 tx_abs_int_delay;
|
||||
u32 gotcl;
|
||||
u64 gotcl_old;
|
||||
u64 tpt_old;
|
||||
u64 colc_old;
|
||||
u32 tx_timeout_count;
|
||||
u32 tx_fifo_head;
|
||||
u32 tx_head_addr;
|
||||
u32 tx_fifo_size;
|
||||
u8 tx_timeout_factor;
|
||||
atomic_t tx_fifo_stall;
|
||||
bool pcix_82544;
|
||||
bool detect_tx_hung;
|
||||
bool dump_buffers;
|
||||
|
||||
/* RX */
|
||||
bool (*clean_rx)(struct e1000_adapter *adapter,
|
||||
struct e1000_rx_ring *rx_ring,
|
||||
int *work_done, int work_to_do);
|
||||
void (*alloc_rx_buf)(struct e1000_adapter *adapter,
|
||||
struct e1000_rx_ring *rx_ring,
|
||||
int cleaned_count);
|
||||
struct e1000_rx_ring *rx_ring; /* One per active queue */
|
||||
struct napi_struct napi;
|
||||
|
||||
int num_tx_queues;
|
||||
int num_rx_queues;
|
||||
|
||||
u64 hw_csum_err;
|
||||
u64 hw_csum_good;
|
||||
u32 alloc_rx_buff_failed;
|
||||
u32 rx_int_delay;
|
||||
u32 rx_abs_int_delay;
|
||||
bool rx_csum;
|
||||
u32 gorcl;
|
||||
u64 gorcl_old;
|
||||
|
||||
/* OS defined structs */
|
||||
struct net_device *netdev;
|
||||
struct pci_dev *pdev;
|
||||
|
||||
/* structs defined in e1000_hw.h */
|
||||
struct e1000_hw hw;
|
||||
struct e1000_hw_stats stats;
|
||||
struct e1000_phy_info phy_info;
|
||||
struct e1000_phy_stats phy_stats;
|
||||
|
||||
u32 test_icr;
|
||||
struct e1000_tx_ring test_tx_ring;
|
||||
struct e1000_rx_ring test_rx_ring;
|
||||
|
||||
int msg_enable;
|
||||
|
||||
/* to not mess up cache alignment, always add to the bottom */
|
||||
bool tso_force;
|
||||
bool smart_power_down; /* phy smart power down */
|
||||
bool quad_port_a;
|
||||
unsigned long flags;
|
||||
u32 eeprom_wol;
|
||||
|
||||
/* for ioport free */
|
||||
int bars;
|
||||
int need_ioport;
|
||||
|
||||
bool discarding;
|
||||
|
||||
struct work_struct reset_task;
|
||||
struct delayed_work watchdog_task;
|
||||
struct delayed_work fifo_stall_task;
|
||||
struct delayed_work phy_info_task;
|
||||
|
||||
ec_device_t *ecdev_;
|
||||
unsigned long ec_watchdog_jiffies;
|
||||
struct irq_work ec_watchdog_kicker;
|
||||
bool ecdev_initialized;
|
||||
};
|
||||
|
||||
static inline ec_device_t *get_ecdev(struct e1000_adapter *adapter)
|
||||
{
|
||||
#ifdef EC_ENABLE_DRIVER_RESOURCE_VERIFYING
|
||||
WARN_ON(!adapter->ecdev_initialized);
|
||||
#endif
|
||||
return adapter->ecdev_;
|
||||
}
|
||||
|
||||
enum e1000_state_t {
|
||||
__E1000_TESTING,
|
||||
__E1000_RESETTING,
|
||||
__E1000_DOWN,
|
||||
__E1000_DISABLED
|
||||
};
|
||||
|
||||
#undef pr_fmt
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
struct net_device *e1000_get_hw_dev(struct e1000_hw *hw);
|
||||
#define e_dbg(format, arg...) \
|
||||
netdev_dbg(e1000_get_hw_dev(hw), format, ## arg)
|
||||
#define e_err(msglvl, format, arg...) \
|
||||
netif_err(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_info(msglvl, format, arg...) \
|
||||
netif_info(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_warn(msglvl, format, arg...) \
|
||||
netif_warn(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_notice(msglvl, format, arg...) \
|
||||
netif_notice(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_dev_info(format, arg...) \
|
||||
dev_info(&adapter->pdev->dev, format, ## arg)
|
||||
#define e_dev_warn(format, arg...) \
|
||||
dev_warn(&adapter->pdev->dev, format, ## arg)
|
||||
#define e_dev_err(format, arg...) \
|
||||
dev_err(&adapter->pdev->dev, format, ## arg)
|
||||
|
||||
extern char e1000_driver_name[];
|
||||
|
||||
int e1000_open(struct net_device *netdev);
|
||||
int e1000_close(struct net_device *netdev);
|
||||
int e1000_up(struct e1000_adapter *adapter);
|
||||
void e1000_down(struct e1000_adapter *adapter);
|
||||
void e1000_reinit_locked(struct e1000_adapter *adapter);
|
||||
void e1000_reset(struct e1000_adapter *adapter);
|
||||
int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx);
|
||||
int e1000_setup_all_rx_resources(struct e1000_adapter *adapter);
|
||||
int e1000_setup_all_tx_resources(struct e1000_adapter *adapter);
|
||||
void e1000_free_all_rx_resources(struct e1000_adapter *adapter);
|
||||
void e1000_free_all_tx_resources(struct e1000_adapter *adapter);
|
||||
void e1000_update_stats(struct e1000_adapter *adapter);
|
||||
bool e1000_has_link(struct e1000_adapter *adapter);
|
||||
void e1000_power_up_phy(struct e1000_adapter *);
|
||||
void e1000_set_ethtool_ops(struct net_device *netdev);
|
||||
void e1000_check_options(struct e1000_adapter *adapter);
|
||||
char *e1000_get_hw_dev_name(struct e1000_hw *hw);
|
||||
|
||||
#endif /* _E1000_H_ */
|
||||
@@ -0,0 +1,352 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright(c) 1999 - 2006 Intel Corporation. */
|
||||
|
||||
/* Linux PRO/1000 Ethernet Driver main header file */
|
||||
|
||||
#ifndef _E1000_H_
|
||||
#define _E1000_H_
|
||||
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/irq.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/in.h>
|
||||
#include <linux/ip.h>
|
||||
#include <linux/ipv6.h>
|
||||
#include <linux/tcp.h>
|
||||
#include <linux/udp.h>
|
||||
#include <net/pkt_sched.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <net/checksum.h>
|
||||
#include <linux/mii.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/if_vlan.h>
|
||||
|
||||
#define BAR_0 0
|
||||
#define BAR_1 1
|
||||
|
||||
#define INTEL_E1000_ETHERNET_DEVICE(device_id) {\
|
||||
PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)}
|
||||
|
||||
struct e1000_adapter;
|
||||
|
||||
#include "e1000_hw.h"
|
||||
|
||||
#define E1000_MAX_INTR 10
|
||||
|
||||
/*
|
||||
* Count for polling __E1000_RESET condition every 10-20msec.
|
||||
*/
|
||||
#define E1000_CHECK_RESET_COUNT 50
|
||||
|
||||
/* TX/RX descriptor defines */
|
||||
#define E1000_DEFAULT_TXD 256
|
||||
#define E1000_MAX_TXD 256
|
||||
#define E1000_MIN_TXD 48
|
||||
#define E1000_MAX_82544_TXD 4096
|
||||
|
||||
#define E1000_DEFAULT_RXD 256
|
||||
#define E1000_MAX_RXD 256
|
||||
#define E1000_MIN_RXD 48
|
||||
#define E1000_MAX_82544_RXD 4096
|
||||
|
||||
#define E1000_MIN_ITR_USECS 10 /* 100000 irq/sec */
|
||||
#define E1000_MAX_ITR_USECS 10000 /* 100 irq/sec */
|
||||
|
||||
/* this is the size past which hardware will drop packets when setting LPE=0 */
|
||||
#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
|
||||
|
||||
/* Supported Rx Buffer Sizes */
|
||||
#define E1000_RXBUFFER_128 128 /* Used for packet split */
|
||||
#define E1000_RXBUFFER_256 256 /* Used for packet split */
|
||||
#define E1000_RXBUFFER_512 512
|
||||
#define E1000_RXBUFFER_1024 1024
|
||||
#define E1000_RXBUFFER_2048 2048
|
||||
#define E1000_RXBUFFER_4096 4096
|
||||
#define E1000_RXBUFFER_8192 8192
|
||||
#define E1000_RXBUFFER_16384 16384
|
||||
|
||||
/* SmartSpeed delimiters */
|
||||
#define E1000_SMARTSPEED_DOWNSHIFT 3
|
||||
#define E1000_SMARTSPEED_MAX 15
|
||||
|
||||
/* Packet Buffer allocations */
|
||||
#define E1000_PBA_BYTES_SHIFT 0xA
|
||||
#define E1000_TX_HEAD_ADDR_SHIFT 7
|
||||
#define E1000_PBA_TX_MASK 0xFFFF0000
|
||||
|
||||
/* Flow Control Watermarks */
|
||||
#define E1000_FC_HIGH_DIFF 0x1638 /* High: 5688 bytes below Rx FIFO size */
|
||||
#define E1000_FC_LOW_DIFF 0x1640 /* Low: 5696 bytes below Rx FIFO size */
|
||||
|
||||
#define E1000_FC_PAUSE_TIME 0xFFFF /* pause for the max or until send xon */
|
||||
|
||||
/* How many Tx Descriptors do we need to call netif_wake_queue ? */
|
||||
#define E1000_TX_QUEUE_WAKE 16
|
||||
/* How many Rx Buffers do we bundle into one write to the hardware ? */
|
||||
#define E1000_RX_BUFFER_WRITE 16 /* Must be power of 2 */
|
||||
|
||||
#define AUTO_ALL_MODES 0
|
||||
#define E1000_EEPROM_82544_APM 0x0004
|
||||
#define E1000_EEPROM_APME 0x0400
|
||||
|
||||
#ifndef E1000_MASTER_SLAVE
|
||||
/* Switch to override PHY master/slave setting */
|
||||
#define E1000_MASTER_SLAVE e1000_ms_hw_default
|
||||
#endif
|
||||
|
||||
#define E1000_MNG_VLAN_NONE (-1)
|
||||
|
||||
/* wrapper around a pointer to a socket buffer,
|
||||
* so a DMA handle can be stored along with the buffer
|
||||
*/
|
||||
struct e1000_tx_buffer {
|
||||
struct sk_buff *skb;
|
||||
dma_addr_t dma;
|
||||
unsigned long time_stamp;
|
||||
u16 length;
|
||||
u16 next_to_watch;
|
||||
bool mapped_as_page;
|
||||
unsigned short segs;
|
||||
unsigned int bytecount;
|
||||
};
|
||||
|
||||
struct e1000_rx_buffer {
|
||||
union {
|
||||
struct page *page; /* jumbo: alloc_page */
|
||||
u8 *data; /* else, netdev_alloc_frag */
|
||||
} rxbuf;
|
||||
dma_addr_t dma;
|
||||
};
|
||||
|
||||
struct e1000_tx_ring {
|
||||
/* pointer to the descriptor ring memory */
|
||||
void *desc;
|
||||
/* physical address of the descriptor ring */
|
||||
dma_addr_t dma;
|
||||
/* length of descriptor ring in bytes */
|
||||
unsigned int size;
|
||||
/* number of descriptors in the ring */
|
||||
unsigned int count;
|
||||
/* next descriptor to associate a buffer with */
|
||||
unsigned int next_to_use;
|
||||
/* next descriptor to check for DD status bit */
|
||||
unsigned int next_to_clean;
|
||||
/* array of buffer information structs */
|
||||
struct e1000_tx_buffer *buffer_info;
|
||||
|
||||
u16 tdh;
|
||||
u16 tdt;
|
||||
bool last_tx_tso;
|
||||
};
|
||||
|
||||
struct e1000_rx_ring {
|
||||
/* pointer to the descriptor ring memory */
|
||||
void *desc;
|
||||
/* physical address of the descriptor ring */
|
||||
dma_addr_t dma;
|
||||
/* length of descriptor ring in bytes */
|
||||
unsigned int size;
|
||||
/* number of descriptors in the ring */
|
||||
unsigned int count;
|
||||
/* next descriptor to associate a buffer with */
|
||||
unsigned int next_to_use;
|
||||
/* next descriptor to check for DD status bit */
|
||||
unsigned int next_to_clean;
|
||||
/* array of buffer information structs */
|
||||
struct e1000_rx_buffer *buffer_info;
|
||||
struct sk_buff *rx_skb_top;
|
||||
|
||||
/* cpu for rx queue */
|
||||
int cpu;
|
||||
|
||||
u16 rdh;
|
||||
u16 rdt;
|
||||
};
|
||||
|
||||
#define E1000_DESC_UNUSED(R) \
|
||||
({ \
|
||||
unsigned int clean = smp_load_acquire(&(R)->next_to_clean); \
|
||||
unsigned int use = READ_ONCE((R)->next_to_use); \
|
||||
(clean > use ? 0 : (R)->count) + clean - use - 1; \
|
||||
})
|
||||
|
||||
#define E1000_RX_DESC_EXT(R, i) \
|
||||
(&(((union e1000_rx_desc_extended *)((R).desc))[i]))
|
||||
#define E1000_GET_DESC(R, i, type) (&(((struct type *)((R).desc))[i]))
|
||||
#define E1000_RX_DESC(R, i) E1000_GET_DESC(R, i, e1000_rx_desc)
|
||||
#define E1000_TX_DESC(R, i) E1000_GET_DESC(R, i, e1000_tx_desc)
|
||||
#define E1000_CONTEXT_DESC(R, i) E1000_GET_DESC(R, i, e1000_context_desc)
|
||||
|
||||
/* board specific private data structure */
|
||||
|
||||
struct e1000_adapter {
|
||||
unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
|
||||
u16 mng_vlan_id;
|
||||
u32 bd_number;
|
||||
u32 rx_buffer_len;
|
||||
u32 wol;
|
||||
u32 smartspeed;
|
||||
u32 en_mng_pt;
|
||||
u16 link_speed;
|
||||
u16 link_duplex;
|
||||
spinlock_t stats_lock;
|
||||
unsigned int total_tx_bytes;
|
||||
unsigned int total_tx_packets;
|
||||
unsigned int total_rx_bytes;
|
||||
unsigned int total_rx_packets;
|
||||
/* Interrupt Throttle Rate */
|
||||
u32 itr;
|
||||
u32 itr_setting;
|
||||
u16 tx_itr;
|
||||
u16 rx_itr;
|
||||
|
||||
u8 fc_autoneg;
|
||||
|
||||
/* TX */
|
||||
struct e1000_tx_ring *tx_ring; /* One per active queue */
|
||||
unsigned int restart_queue;
|
||||
u32 txd_cmd;
|
||||
u32 tx_int_delay;
|
||||
u32 tx_abs_int_delay;
|
||||
u32 gotcl;
|
||||
u64 gotcl_old;
|
||||
u64 tpt_old;
|
||||
u64 colc_old;
|
||||
u32 tx_timeout_count;
|
||||
u32 tx_fifo_head;
|
||||
u32 tx_head_addr;
|
||||
u32 tx_fifo_size;
|
||||
u8 tx_timeout_factor;
|
||||
atomic_t tx_fifo_stall;
|
||||
bool pcix_82544;
|
||||
bool detect_tx_hung;
|
||||
bool dump_buffers;
|
||||
|
||||
/* RX */
|
||||
bool (*clean_rx)(struct e1000_adapter *adapter,
|
||||
struct e1000_rx_ring *rx_ring,
|
||||
int *work_done, int work_to_do);
|
||||
void (*alloc_rx_buf)(struct e1000_adapter *adapter,
|
||||
struct e1000_rx_ring *rx_ring,
|
||||
int cleaned_count);
|
||||
struct e1000_rx_ring *rx_ring; /* One per active queue */
|
||||
struct napi_struct napi;
|
||||
|
||||
int num_tx_queues;
|
||||
int num_rx_queues;
|
||||
|
||||
u64 hw_csum_err;
|
||||
u64 hw_csum_good;
|
||||
u32 alloc_rx_buff_failed;
|
||||
u32 rx_int_delay;
|
||||
u32 rx_abs_int_delay;
|
||||
bool rx_csum;
|
||||
u32 gorcl;
|
||||
u64 gorcl_old;
|
||||
|
||||
/* OS defined structs */
|
||||
struct net_device *netdev;
|
||||
struct pci_dev *pdev;
|
||||
|
||||
/* structs defined in e1000_hw.h */
|
||||
struct e1000_hw hw;
|
||||
struct e1000_hw_stats stats;
|
||||
struct e1000_phy_info phy_info;
|
||||
struct e1000_phy_stats phy_stats;
|
||||
|
||||
u32 test_icr;
|
||||
struct e1000_tx_ring test_tx_ring;
|
||||
struct e1000_rx_ring test_rx_ring;
|
||||
|
||||
int msg_enable;
|
||||
|
||||
/* to not mess up cache alignment, always add to the bottom */
|
||||
bool tso_force;
|
||||
bool smart_power_down; /* phy smart power down */
|
||||
bool quad_port_a;
|
||||
unsigned long flags;
|
||||
u32 eeprom_wol;
|
||||
|
||||
/* for ioport free */
|
||||
int bars;
|
||||
int need_ioport;
|
||||
|
||||
bool discarding;
|
||||
|
||||
struct work_struct reset_task;
|
||||
struct delayed_work watchdog_task;
|
||||
struct delayed_work fifo_stall_task;
|
||||
struct delayed_work phy_info_task;
|
||||
};
|
||||
|
||||
enum e1000_state_t {
|
||||
__E1000_TESTING,
|
||||
__E1000_RESETTING,
|
||||
__E1000_DOWN,
|
||||
__E1000_DISABLED
|
||||
};
|
||||
|
||||
#undef pr_fmt
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
struct net_device *e1000_get_hw_dev(struct e1000_hw *hw);
|
||||
#define e_dbg(format, arg...) \
|
||||
netdev_dbg(e1000_get_hw_dev(hw), format, ## arg)
|
||||
#define e_err(msglvl, format, arg...) \
|
||||
netif_err(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_info(msglvl, format, arg...) \
|
||||
netif_info(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_warn(msglvl, format, arg...) \
|
||||
netif_warn(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_notice(msglvl, format, arg...) \
|
||||
netif_notice(adapter, msglvl, adapter->netdev, format, ## arg)
|
||||
#define e_dev_info(format, arg...) \
|
||||
dev_info(&adapter->pdev->dev, format, ## arg)
|
||||
#define e_dev_warn(format, arg...) \
|
||||
dev_warn(&adapter->pdev->dev, format, ## arg)
|
||||
#define e_dev_err(format, arg...) \
|
||||
dev_err(&adapter->pdev->dev, format, ## arg)
|
||||
|
||||
extern char e1000_driver_name[];
|
||||
|
||||
int e1000_open(struct net_device *netdev);
|
||||
int e1000_close(struct net_device *netdev);
|
||||
int e1000_up(struct e1000_adapter *adapter);
|
||||
void e1000_down(struct e1000_adapter *adapter);
|
||||
void e1000_reinit_locked(struct e1000_adapter *adapter);
|
||||
void e1000_reset(struct e1000_adapter *adapter);
|
||||
int e1000_set_spd_dplx(struct e1000_adapter *adapter, u32 spd, u8 dplx);
|
||||
int e1000_setup_all_rx_resources(struct e1000_adapter *adapter);
|
||||
int e1000_setup_all_tx_resources(struct e1000_adapter *adapter);
|
||||
void e1000_free_all_rx_resources(struct e1000_adapter *adapter);
|
||||
void e1000_free_all_tx_resources(struct e1000_adapter *adapter);
|
||||
void e1000_update_stats(struct e1000_adapter *adapter);
|
||||
bool e1000_has_link(struct e1000_adapter *adapter);
|
||||
void e1000_power_up_phy(struct e1000_adapter *);
|
||||
void e1000_set_ethtool_ops(struct net_device *netdev);
|
||||
void e1000_check_options(struct e1000_adapter *adapter);
|
||||
char *e1000_get_hw_dev_name(struct e1000_hw *hw);
|
||||
|
||||
#endif /* _E1000_H_ */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,83 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright(c) 1999 - 2006 Intel Corporation. */
|
||||
|
||||
/* glue for the OS independent part of e1000
|
||||
* includes register access macros
|
||||
*/
|
||||
|
||||
#ifndef _E1000_OSDEP_H_
|
||||
#define _E1000_OSDEP_H_
|
||||
|
||||
#include <asm/io.h>
|
||||
|
||||
#define CONFIG_RAM_BASE 0x60000
|
||||
#define GBE_CONFIG_OFFSET 0x0
|
||||
|
||||
#define GBE_CONFIG_RAM_BASE \
|
||||
((unsigned int)(CONFIG_RAM_BASE + GBE_CONFIG_OFFSET))
|
||||
|
||||
#define GBE_CONFIG_BASE_VIRT \
|
||||
((void __iomem *)phys_to_virt(GBE_CONFIG_RAM_BASE))
|
||||
|
||||
#define GBE_CONFIG_FLASH_WRITE(base, offset, count, data) \
|
||||
(iowrite16_rep(base + offset, data, count))
|
||||
|
||||
#define GBE_CONFIG_FLASH_READ(base, offset, count, data) \
|
||||
(ioread16_rep(base + (offset << 1), data, count))
|
||||
|
||||
#define er32(reg) \
|
||||
(readl(hw->hw_addr + ((hw->mac_type >= e1000_82543) \
|
||||
? E1000_##reg : E1000_82542_##reg)))
|
||||
|
||||
#define ew32(reg, value) \
|
||||
(writel((value), (hw->hw_addr + ((hw->mac_type >= e1000_82543) \
|
||||
? E1000_##reg : E1000_82542_##reg))))
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \
|
||||
writel((value), ((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 2))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY(a, reg, offset) ( \
|
||||
readl((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 2)))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
|
||||
#define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY_WORD(a, reg, offset, value) ( \
|
||||
writew((value), ((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 1))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_WORD(a, reg, offset) ( \
|
||||
readw((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 1)))
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY_BYTE(a, reg, offset, value) ( \
|
||||
writeb((value), ((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
(offset))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_BYTE(a, reg, offset) ( \
|
||||
readb((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
(offset)))
|
||||
|
||||
#define E1000_WRITE_FLUSH() er32(STATUS)
|
||||
|
||||
#define E1000_WRITE_ICH_FLASH_REG(a, reg, value) ( \
|
||||
writel((value), ((a)->flash_address + reg)))
|
||||
|
||||
#define E1000_READ_ICH_FLASH_REG(a, reg) ( \
|
||||
readl((a)->flash_address + reg))
|
||||
|
||||
#define E1000_WRITE_ICH_FLASH_REG16(a, reg, value) ( \
|
||||
writew((value), ((a)->flash_address + reg)))
|
||||
|
||||
#define E1000_READ_ICH_FLASH_REG16(a, reg) ( \
|
||||
readw((a)->flash_address + reg))
|
||||
|
||||
#endif /* _E1000_OSDEP_H_ */
|
||||
@@ -0,0 +1,83 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright(c) 1999 - 2006 Intel Corporation. */
|
||||
|
||||
/* glue for the OS independent part of e1000
|
||||
* includes register access macros
|
||||
*/
|
||||
|
||||
#ifndef _E1000_OSDEP_H_
|
||||
#define _E1000_OSDEP_H_
|
||||
|
||||
#include <asm/io.h>
|
||||
|
||||
#define CONFIG_RAM_BASE 0x60000
|
||||
#define GBE_CONFIG_OFFSET 0x0
|
||||
|
||||
#define GBE_CONFIG_RAM_BASE \
|
||||
((unsigned int)(CONFIG_RAM_BASE + GBE_CONFIG_OFFSET))
|
||||
|
||||
#define GBE_CONFIG_BASE_VIRT \
|
||||
((void __iomem *)phys_to_virt(GBE_CONFIG_RAM_BASE))
|
||||
|
||||
#define GBE_CONFIG_FLASH_WRITE(base, offset, count, data) \
|
||||
(iowrite16_rep(base + offset, data, count))
|
||||
|
||||
#define GBE_CONFIG_FLASH_READ(base, offset, count, data) \
|
||||
(ioread16_rep(base + (offset << 1), data, count))
|
||||
|
||||
#define er32(reg) \
|
||||
(readl(hw->hw_addr + ((hw->mac_type >= e1000_82543) \
|
||||
? E1000_##reg : E1000_82542_##reg)))
|
||||
|
||||
#define ew32(reg, value) \
|
||||
(writel((value), (hw->hw_addr + ((hw->mac_type >= e1000_82543) \
|
||||
? E1000_##reg : E1000_82542_##reg))))
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \
|
||||
writel((value), ((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 2))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY(a, reg, offset) ( \
|
||||
readl((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 2)))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
|
||||
#define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY_WORD(a, reg, offset, value) ( \
|
||||
writew((value), ((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 1))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_WORD(a, reg, offset) ( \
|
||||
readw((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 1)))
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY_BYTE(a, reg, offset, value) ( \
|
||||
writeb((value), ((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
(offset))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_BYTE(a, reg, offset) ( \
|
||||
readb((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
(offset)))
|
||||
|
||||
#define E1000_WRITE_FLUSH() er32(STATUS)
|
||||
|
||||
#define E1000_WRITE_ICH_FLASH_REG(a, reg, value) ( \
|
||||
writel((value), ((a)->flash_address + reg)))
|
||||
|
||||
#define E1000_READ_ICH_FLASH_REG(a, reg) ( \
|
||||
readl((a)->flash_address + reg))
|
||||
|
||||
#define E1000_WRITE_ICH_FLASH_REG16(a, reg, value) ( \
|
||||
writew((value), ((a)->flash_address + reg)))
|
||||
|
||||
#define E1000_READ_ICH_FLASH_REG16(a, reg) ( \
|
||||
readw((a)->flash_address + reg))
|
||||
|
||||
#endif /* _E1000_OSDEP_H_ */
|
||||
@@ -0,0 +1,83 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright(c) 1999 - 2006 Intel Corporation. */
|
||||
|
||||
/* glue for the OS independent part of e1000
|
||||
* includes register access macros
|
||||
*/
|
||||
|
||||
#ifndef _E1000_OSDEP_H_
|
||||
#define _E1000_OSDEP_H_
|
||||
|
||||
#include <asm/io.h>
|
||||
|
||||
#define CONFIG_RAM_BASE 0x60000
|
||||
#define GBE_CONFIG_OFFSET 0x0
|
||||
|
||||
#define GBE_CONFIG_RAM_BASE \
|
||||
((unsigned int)(CONFIG_RAM_BASE + GBE_CONFIG_OFFSET))
|
||||
|
||||
#define GBE_CONFIG_BASE_VIRT \
|
||||
((void __iomem *)phys_to_virt(GBE_CONFIG_RAM_BASE))
|
||||
|
||||
#define GBE_CONFIG_FLASH_WRITE(base, offset, count, data) \
|
||||
(iowrite16_rep(base + offset, data, count))
|
||||
|
||||
#define GBE_CONFIG_FLASH_READ(base, offset, count, data) \
|
||||
(ioread16_rep(base + (offset << 1), data, count))
|
||||
|
||||
#define er32(reg) \
|
||||
(readl(hw->hw_addr + ((hw->mac_type >= e1000_82543) \
|
||||
? E1000_##reg : E1000_82542_##reg)))
|
||||
|
||||
#define ew32(reg, value) \
|
||||
(writel((value), (hw->hw_addr + ((hw->mac_type >= e1000_82543) \
|
||||
? E1000_##reg : E1000_82542_##reg))))
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \
|
||||
writel((value), ((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 2))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY(a, reg, offset) ( \
|
||||
readl((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 2)))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
|
||||
#define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY_WORD(a, reg, offset, value) ( \
|
||||
writew((value), ((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 1))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_WORD(a, reg, offset) ( \
|
||||
readw((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 1)))
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY_BYTE(a, reg, offset, value) ( \
|
||||
writeb((value), ((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
(offset))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_BYTE(a, reg, offset) ( \
|
||||
readb((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
(offset)))
|
||||
|
||||
#define E1000_WRITE_FLUSH() er32(STATUS)
|
||||
|
||||
#define E1000_WRITE_ICH_FLASH_REG(a, reg, value) ( \
|
||||
writel((value), ((a)->flash_address + reg)))
|
||||
|
||||
#define E1000_READ_ICH_FLASH_REG(a, reg) ( \
|
||||
readl((a)->flash_address + reg))
|
||||
|
||||
#define E1000_WRITE_ICH_FLASH_REG16(a, reg, value) ( \
|
||||
writew((value), ((a)->flash_address + reg)))
|
||||
|
||||
#define E1000_READ_ICH_FLASH_REG16(a, reg) ( \
|
||||
readw((a)->flash_address + reg))
|
||||
|
||||
#endif /* _E1000_OSDEP_H_ */
|
||||
@@ -0,0 +1,83 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/* Copyright(c) 1999 - 2006 Intel Corporation. */
|
||||
|
||||
/* glue for the OS independent part of e1000
|
||||
* includes register access macros
|
||||
*/
|
||||
|
||||
#ifndef _E1000_OSDEP_H_
|
||||
#define _E1000_OSDEP_H_
|
||||
|
||||
#include <asm/io.h>
|
||||
|
||||
#define CONFIG_RAM_BASE 0x60000
|
||||
#define GBE_CONFIG_OFFSET 0x0
|
||||
|
||||
#define GBE_CONFIG_RAM_BASE \
|
||||
((unsigned int)(CONFIG_RAM_BASE + GBE_CONFIG_OFFSET))
|
||||
|
||||
#define GBE_CONFIG_BASE_VIRT \
|
||||
((void __iomem *)phys_to_virt(GBE_CONFIG_RAM_BASE))
|
||||
|
||||
#define GBE_CONFIG_FLASH_WRITE(base, offset, count, data) \
|
||||
(iowrite16_rep(base + offset, data, count))
|
||||
|
||||
#define GBE_CONFIG_FLASH_READ(base, offset, count, data) \
|
||||
(ioread16_rep(base + (offset << 1), data, count))
|
||||
|
||||
#define er32(reg) \
|
||||
(readl(hw->hw_addr + ((hw->mac_type >= e1000_82543) \
|
||||
? E1000_##reg : E1000_82542_##reg)))
|
||||
|
||||
#define ew32(reg, value) \
|
||||
(writel((value), (hw->hw_addr + ((hw->mac_type >= e1000_82543) \
|
||||
? E1000_##reg : E1000_82542_##reg))))
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) ( \
|
||||
writel((value), ((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 2))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY(a, reg, offset) ( \
|
||||
readl((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 2)))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_DWORD E1000_READ_REG_ARRAY
|
||||
#define E1000_WRITE_REG_ARRAY_DWORD E1000_WRITE_REG_ARRAY
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY_WORD(a, reg, offset, value) ( \
|
||||
writew((value), ((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 1))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_WORD(a, reg, offset) ( \
|
||||
readw((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
((offset) << 1)))
|
||||
|
||||
#define E1000_WRITE_REG_ARRAY_BYTE(a, reg, offset, value) ( \
|
||||
writeb((value), ((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
(offset))))
|
||||
|
||||
#define E1000_READ_REG_ARRAY_BYTE(a, reg, offset) ( \
|
||||
readb((a)->hw_addr + \
|
||||
(((a)->mac_type >= e1000_82543) ? E1000_##reg : E1000_82542_##reg) + \
|
||||
(offset)))
|
||||
|
||||
#define E1000_WRITE_FLUSH() er32(STATUS)
|
||||
|
||||
#define E1000_WRITE_ICH_FLASH_REG(a, reg, value) ( \
|
||||
writel((value), ((a)->flash_address + reg)))
|
||||
|
||||
#define E1000_READ_ICH_FLASH_REG(a, reg) ( \
|
||||
readl((a)->flash_address + reg))
|
||||
|
||||
#define E1000_WRITE_ICH_FLASH_REG16(a, reg, value) ( \
|
||||
writew((value), ((a)->flash_address + reg)))
|
||||
|
||||
#define E1000_READ_ICH_FLASH_REG16(a, reg) ( \
|
||||
readw((a)->flash_address + reg))
|
||||
|
||||
#endif /* _E1000_OSDEP_H_ */
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user