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:
Florian Pose 2025-06-30 13:53:17 +02:00
commit 0561fa0bd9
83 changed files with 115939 additions and 562 deletions

View File

@ -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

2678
devices/8139too-6.12-orig.c Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

2678
devices/8139too-6.4-orig.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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
#------------------------------------------------------------------------------

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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,

3385
devices/e100-6.12-ethercat.c Normal file

File diff suppressed because it is too large Load Diff

3195
devices/e100-6.12-orig.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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);
}
}

View File

@ -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
#-----------------------------------------------------------------------------

View File

@ -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_ */

View File

@ -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_ */

View File

@ -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_ */

View File

@ -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

View File

@ -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_ */

View File

@ -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_ */

View File

@ -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_ */

View File

@ -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_ */

View File

@ -0,0 +1,727 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 1999 - 2006 Intel Corporation. */
#include "e1000-6.12-ethercat.h"
/* This is the only thing that needs to be changed to adjust the
* maximum number of ports that the driver can manage.
*/
#define E1000_MAX_NIC 32
#define OPTION_UNSET -1
#define OPTION_DISABLED 0
#define OPTION_ENABLED 1
/* All parameters are treated the same, as an integer array of values.
* This macro just reduces the need to repeat the same declaration code
* over and over (plus this helps to avoid typo bugs).
*/
#define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
#define E1000_PARAM(X, desc) \
static int X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
static unsigned int num_##X; \
module_param_array_named(X, X, int, &num_##X, 0); \
MODULE_PARM_DESC(X, desc);
/* Transmit Descriptor Count
*
* Valid Range: 80-256 for 82542 and 82543 gigabit ethernet controllers
* Valid Range: 80-4096 for 82544 and newer
*
* Default Value: 256
*/
E1000_PARAM(TxDescriptors, "Number of transmit descriptors");
/* Receive Descriptor Count
*
* Valid Range: 80-256 for 82542 and 82543 gigabit ethernet controllers
* Valid Range: 80-4096 for 82544 and newer
*
* Default Value: 256
*/
E1000_PARAM(RxDescriptors, "Number of receive descriptors");
/* User Specified Speed Override
*
* Valid Range: 0, 10, 100, 1000
* - 0 - auto-negotiate at all supported speeds
* - 10 - only link at 10 Mbps
* - 100 - only link at 100 Mbps
* - 1000 - only link at 1000 Mbps
*
* Default Value: 0
*/
E1000_PARAM(Speed, "Speed setting");
/* User Specified Duplex Override
*
* Valid Range: 0-2
* - 0 - auto-negotiate for duplex
* - 1 - only link at half duplex
* - 2 - only link at full duplex
*
* Default Value: 0
*/
E1000_PARAM(Duplex, "Duplex setting");
/* Auto-negotiation Advertisement Override
*
* Valid Range: 0x01-0x0F, 0x20-0x2F (copper); 0x20 (fiber)
*
* The AutoNeg value is a bit mask describing which speed and duplex
* combinations should be advertised during auto-negotiation.
* The supported speed and duplex modes are listed below
*
* Bit 7 6 5 4 3 2 1 0
* Speed (Mbps) N/A N/A 1000 N/A 100 100 10 10
* Duplex Full Full Half Full Half
*
* Default Value: 0x2F (copper); 0x20 (fiber)
*/
E1000_PARAM(AutoNeg, "Advertised auto-negotiation setting");
#define AUTONEG_ADV_DEFAULT 0x2F
/* User Specified Flow Control Override
*
* Valid Range: 0-3
* - 0 - No Flow Control
* - 1 - Rx only, respond to PAUSE frames but do not generate them
* - 2 - Tx only, generate PAUSE frames but ignore them on receive
* - 3 - Full Flow Control Support
*
* Default Value: Read flow control settings from the EEPROM
*/
E1000_PARAM(FlowControl, "Flow Control setting");
/* XsumRX - Receive Checksum Offload Enable/Disable
*
* Valid Range: 0, 1
* - 0 - disables all checksum offload
* - 1 - enables receive IP/TCP/UDP checksum offload
* on 82543 and newer -based NICs
*
* Default Value: 1
*/
E1000_PARAM(XsumRX, "Disable or enable Receive Checksum offload");
/* Transmit Interrupt Delay in units of 1.024 microseconds
* Tx interrupt delay needs to typically be set to something non zero
*
* Valid Range: 0-65535
*/
E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay");
#define DEFAULT_TIDV 8
#define MAX_TXDELAY 0xFFFF
#define MIN_TXDELAY 0
/* Transmit Absolute Interrupt Delay in units of 1.024 microseconds
*
* Valid Range: 0-65535
*/
E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay");
#define DEFAULT_TADV 32
#define MAX_TXABSDELAY 0xFFFF
#define MIN_TXABSDELAY 0
/* Receive Interrupt Delay in units of 1.024 microseconds
* hardware will likely hang if you set this to anything but zero.
*
* Valid Range: 0-65535
*/
E1000_PARAM(RxIntDelay, "Receive Interrupt Delay");
#define DEFAULT_RDTR 0
#define MAX_RXDELAY 0xFFFF
#define MIN_RXDELAY 0
/* Receive Absolute Interrupt Delay in units of 1.024 microseconds
*
* Valid Range: 0-65535
*/
E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay");
#define DEFAULT_RADV 8
#define MAX_RXABSDELAY 0xFFFF
#define MIN_RXABSDELAY 0
/* Interrupt Throttle Rate (interrupts/sec)
*
* Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative)
*/
E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
#define DEFAULT_ITR 3
#define MAX_ITR 100000
#define MIN_ITR 100
/* Enable Smart Power Down of the PHY
*
* Valid Range: 0, 1
*
* Default Value: 0 (disabled)
*/
E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
struct e1000_option {
enum { enable_option, range_option, list_option } type;
const char *name;
const char *err;
int def;
union {
struct { /* range_option info */
int min;
int max;
} r;
struct { /* list_option info */
int nr;
const struct e1000_opt_list { int i; char *str; } *p;
} l;
} arg;
};
static int e1000_validate_option(unsigned int *value,
const struct e1000_option *opt,
struct e1000_adapter *adapter)
{
if (*value == OPTION_UNSET) {
*value = opt->def;
return 0;
}
switch (opt->type) {
case enable_option:
switch (*value) {
case OPTION_ENABLED:
e_dev_info("%s Enabled\n", opt->name);
return 0;
case OPTION_DISABLED:
e_dev_info("%s Disabled\n", opt->name);
return 0;
}
break;
case range_option:
if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
e_dev_info("%s set to %i\n", opt->name, *value);
return 0;
}
break;
case list_option: {
int i;
const struct e1000_opt_list *ent;
for (i = 0; i < opt->arg.l.nr; i++) {
ent = &opt->arg.l.p[i];
if (*value == ent->i) {
if (ent->str[0] != '\0')
e_dev_info("%s\n", ent->str);
return 0;
}
}
}
break;
default:
BUG();
}
e_dev_info("Invalid %s value specified (%i) %s\n",
opt->name, *value, opt->err);
*value = opt->def;
return -1;
}
static void e1000_check_fiber_options(struct e1000_adapter *adapter);
static void e1000_check_copper_options(struct e1000_adapter *adapter);
/**
* e1000_check_options - Range Checking for Command Line Parameters
* @adapter: board private structure
*
* This routine checks all command line parameters for valid user
* input. If an invalid value is given, or if no user specified
* value exists, a default value is used. The final value is stored
* in a variable in the adapter structure.
**/
void e1000_check_options(struct e1000_adapter *adapter)
{
struct e1000_option opt;
int bd = adapter->bd_number;
if (bd >= E1000_MAX_NIC) {
e_dev_warn("Warning: no configuration for board #%i "
"using defaults for all values\n", bd);
}
{ /* Transmit Descriptor Count */
struct e1000_tx_ring *tx_ring = adapter->tx_ring;
int i;
e1000_mac_type mac_type = adapter->hw.mac_type;
opt = (struct e1000_option) {
.type = range_option,
.name = "Transmit Descriptors",
.err = "using default of "
__MODULE_STRING(E1000_DEFAULT_TXD),
.def = E1000_DEFAULT_TXD,
.arg = { .r = {
.min = E1000_MIN_TXD,
.max = mac_type < e1000_82544 ? E1000_MAX_TXD : E1000_MAX_82544_TXD
}}
};
if (num_TxDescriptors > bd) {
tx_ring->count = TxDescriptors[bd];
e1000_validate_option(&tx_ring->count, &opt, adapter);
tx_ring->count = ALIGN(tx_ring->count,
REQ_TX_DESCRIPTOR_MULTIPLE);
} else {
tx_ring->count = opt.def;
}
for (i = 0; i < adapter->num_tx_queues; i++)
tx_ring[i].count = tx_ring->count;
}
{ /* Receive Descriptor Count */
struct e1000_rx_ring *rx_ring = adapter->rx_ring;
int i;
e1000_mac_type mac_type = adapter->hw.mac_type;
opt = (struct e1000_option) {
.type = range_option,
.name = "Receive Descriptors",
.err = "using default of "
__MODULE_STRING(E1000_DEFAULT_RXD),
.def = E1000_DEFAULT_RXD,
.arg = { .r = {
.min = E1000_MIN_RXD,
.max = mac_type < e1000_82544 ? E1000_MAX_RXD :
E1000_MAX_82544_RXD
}}
};
if (num_RxDescriptors > bd) {
rx_ring->count = RxDescriptors[bd];
e1000_validate_option(&rx_ring->count, &opt, adapter);
rx_ring->count = ALIGN(rx_ring->count,
REQ_RX_DESCRIPTOR_MULTIPLE);
} else {
rx_ring->count = opt.def;
}
for (i = 0; i < adapter->num_rx_queues; i++)
rx_ring[i].count = rx_ring->count;
}
{ /* Checksum Offload Enable/Disable */
opt = (struct e1000_option) {
.type = enable_option,
.name = "Checksum Offload",
.err = "defaulting to Enabled",
.def = OPTION_ENABLED
};
if (num_XsumRX > bd) {
unsigned int rx_csum = XsumRX[bd];
e1000_validate_option(&rx_csum, &opt, adapter);
adapter->rx_csum = rx_csum;
} else {
adapter->rx_csum = opt.def;
}
}
{ /* Flow Control */
static const struct e1000_opt_list fc_list[] = {
{ E1000_FC_NONE, "Flow Control Disabled" },
{ E1000_FC_RX_PAUSE, "Flow Control Receive Only" },
{ E1000_FC_TX_PAUSE, "Flow Control Transmit Only" },
{ E1000_FC_FULL, "Flow Control Enabled" },
{ E1000_FC_DEFAULT, "Flow Control Hardware Default" }
};
opt = (struct e1000_option) {
.type = list_option,
.name = "Flow Control",
.err = "reading default settings from EEPROM",
.def = E1000_FC_DEFAULT,
.arg = { .l = { .nr = ARRAY_SIZE(fc_list),
.p = fc_list }}
};
if (num_FlowControl > bd) {
unsigned int fc = FlowControl[bd];
e1000_validate_option(&fc, &opt, adapter);
adapter->hw.fc = adapter->hw.original_fc = fc;
} else {
adapter->hw.fc = adapter->hw.original_fc = opt.def;
}
}
{ /* Transmit Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Transmit Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_TIDV),
.def = DEFAULT_TIDV,
.arg = { .r = { .min = MIN_TXDELAY,
.max = MAX_TXDELAY }}
};
if (num_TxIntDelay > bd) {
adapter->tx_int_delay = TxIntDelay[bd];
e1000_validate_option(&adapter->tx_int_delay, &opt,
adapter);
} else {
adapter->tx_int_delay = opt.def;
}
}
{ /* Transmit Absolute Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Transmit Absolute Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_TADV),
.def = DEFAULT_TADV,
.arg = { .r = { .min = MIN_TXABSDELAY,
.max = MAX_TXABSDELAY }}
};
if (num_TxAbsIntDelay > bd) {
adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
adapter);
} else {
adapter->tx_abs_int_delay = opt.def;
}
}
{ /* Receive Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Receive Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_RDTR),
.def = DEFAULT_RDTR,
.arg = { .r = { .min = MIN_RXDELAY,
.max = MAX_RXDELAY }}
};
if (num_RxIntDelay > bd) {
adapter->rx_int_delay = RxIntDelay[bd];
e1000_validate_option(&adapter->rx_int_delay, &opt,
adapter);
} else {
adapter->rx_int_delay = opt.def;
}
}
{ /* Receive Absolute Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Receive Absolute Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_RADV),
.def = DEFAULT_RADV,
.arg = { .r = { .min = MIN_RXABSDELAY,
.max = MAX_RXABSDELAY }}
};
if (num_RxAbsIntDelay > bd) {
adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
adapter);
} else {
adapter->rx_abs_int_delay = opt.def;
}
}
{ /* Interrupt Throttling Rate */
opt = (struct e1000_option) {
.type = range_option,
.name = "Interrupt Throttling Rate (ints/sec)",
.err = "using default of " __MODULE_STRING(DEFAULT_ITR),
.def = DEFAULT_ITR,
.arg = { .r = { .min = MIN_ITR,
.max = MAX_ITR }}
};
if (num_InterruptThrottleRate > bd) {
adapter->itr = InterruptThrottleRate[bd];
switch (adapter->itr) {
case 0:
e_dev_info("%s turned off\n", opt.name);
break;
case 1:
e_dev_info("%s set to dynamic mode\n",
opt.name);
adapter->itr_setting = adapter->itr;
adapter->itr = 20000;
break;
case 3:
e_dev_info("%s set to dynamic conservative "
"mode\n", opt.name);
adapter->itr_setting = adapter->itr;
adapter->itr = 20000;
break;
case 4:
e_dev_info("%s set to simplified "
"(2000-8000) ints mode\n", opt.name);
adapter->itr_setting = adapter->itr;
break;
default:
e1000_validate_option(&adapter->itr, &opt,
adapter);
/* save the setting, because the dynamic bits
* change itr.
* clear the lower two bits because they are
* used as control
*/
adapter->itr_setting = adapter->itr & ~3;
break;
}
} else {
adapter->itr_setting = opt.def;
adapter->itr = 20000;
}
}
{ /* Smart Power Down */
opt = (struct e1000_option) {
.type = enable_option,
.name = "PHY Smart Power Down",
.err = "defaulting to Disabled",
.def = OPTION_DISABLED
};
if (num_SmartPowerDownEnable > bd) {
unsigned int spd = SmartPowerDownEnable[bd];
e1000_validate_option(&spd, &opt, adapter);
adapter->smart_power_down = spd;
} else {
adapter->smart_power_down = opt.def;
}
}
switch (adapter->hw.media_type) {
case e1000_media_type_fiber:
case e1000_media_type_internal_serdes:
e1000_check_fiber_options(adapter);
break;
case e1000_media_type_copper:
e1000_check_copper_options(adapter);
break;
default:
BUG();
}
}
/**
* e1000_check_fiber_options - Range Checking for Link Options, Fiber Version
* @adapter: board private structure
*
* Handles speed and duplex options on fiber adapters
**/
static void e1000_check_fiber_options(struct e1000_adapter *adapter)
{
int bd = adapter->bd_number;
if (num_Speed > bd) {
e_dev_info("Speed not valid for fiber adapters, parameter "
"ignored\n");
}
if (num_Duplex > bd) {
e_dev_info("Duplex not valid for fiber adapters, parameter "
"ignored\n");
}
if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) {
e_dev_info("AutoNeg other than 1000/Full is not valid for fiber"
"adapters, parameter ignored\n");
}
}
/**
* e1000_check_copper_options - Range Checking for Link Options, Copper Version
* @adapter: board private structure
*
* Handles speed and duplex options on copper adapters
**/
static void e1000_check_copper_options(struct e1000_adapter *adapter)
{
struct e1000_option opt;
unsigned int speed, dplx, an;
int bd = adapter->bd_number;
{ /* Speed */
static const struct e1000_opt_list speed_list[] = {
{ 0, "" },
{ SPEED_10, "" },
{ SPEED_100, "" },
{ SPEED_1000, "" }};
opt = (struct e1000_option) {
.type = list_option,
.name = "Speed",
.err = "parameter ignored",
.def = 0,
.arg = { .l = { .nr = ARRAY_SIZE(speed_list),
.p = speed_list }}
};
if (num_Speed > bd) {
speed = Speed[bd];
e1000_validate_option(&speed, &opt, adapter);
} else {
speed = opt.def;
}
}
{ /* Duplex */
static const struct e1000_opt_list dplx_list[] = {
{ 0, "" },
{ HALF_DUPLEX, "" },
{ FULL_DUPLEX, "" }};
opt = (struct e1000_option) {
.type = list_option,
.name = "Duplex",
.err = "parameter ignored",
.def = 0,
.arg = { .l = { .nr = ARRAY_SIZE(dplx_list),
.p = dplx_list }}
};
if (num_Duplex > bd) {
dplx = Duplex[bd];
e1000_validate_option(&dplx, &opt, adapter);
} else {
dplx = opt.def;
}
}
if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) {
e_dev_info("AutoNeg specified along with Speed or Duplex, "
"parameter ignored\n");
adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT;
} else { /* Autoneg */
static const struct e1000_opt_list an_list[] =
#define AA "AutoNeg advertising "
{{ 0x01, AA "10/HD" },
{ 0x02, AA "10/FD" },
{ 0x03, AA "10/FD, 10/HD" },
{ 0x04, AA "100/HD" },
{ 0x05, AA "100/HD, 10/HD" },
{ 0x06, AA "100/HD, 10/FD" },
{ 0x07, AA "100/HD, 10/FD, 10/HD" },
{ 0x08, AA "100/FD" },
{ 0x09, AA "100/FD, 10/HD" },
{ 0x0a, AA "100/FD, 10/FD" },
{ 0x0b, AA "100/FD, 10/FD, 10/HD" },
{ 0x0c, AA "100/FD, 100/HD" },
{ 0x0d, AA "100/FD, 100/HD, 10/HD" },
{ 0x0e, AA "100/FD, 100/HD, 10/FD" },
{ 0x0f, AA "100/FD, 100/HD, 10/FD, 10/HD" },
{ 0x20, AA "1000/FD" },
{ 0x21, AA "1000/FD, 10/HD" },
{ 0x22, AA "1000/FD, 10/FD" },
{ 0x23, AA "1000/FD, 10/FD, 10/HD" },
{ 0x24, AA "1000/FD, 100/HD" },
{ 0x25, AA "1000/FD, 100/HD, 10/HD" },
{ 0x26, AA "1000/FD, 100/HD, 10/FD" },
{ 0x27, AA "1000/FD, 100/HD, 10/FD, 10/HD" },
{ 0x28, AA "1000/FD, 100/FD" },
{ 0x29, AA "1000/FD, 100/FD, 10/HD" },
{ 0x2a, AA "1000/FD, 100/FD, 10/FD" },
{ 0x2b, AA "1000/FD, 100/FD, 10/FD, 10/HD" },
{ 0x2c, AA "1000/FD, 100/FD, 100/HD" },
{ 0x2d, AA "1000/FD, 100/FD, 100/HD, 10/HD" },
{ 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" },
{ 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }};
opt = (struct e1000_option) {
.type = list_option,
.name = "AutoNeg",
.err = "parameter ignored",
.def = AUTONEG_ADV_DEFAULT,
.arg = { .l = { .nr = ARRAY_SIZE(an_list),
.p = an_list }}
};
if (num_AutoNeg > bd) {
an = AutoNeg[bd];
e1000_validate_option(&an, &opt, adapter);
} else {
an = opt.def;
}
adapter->hw.autoneg_advertised = an;
}
switch (speed + dplx) {
case 0:
adapter->hw.autoneg = adapter->fc_autoneg = 1;
if ((num_Speed > bd) && (speed != 0 || dplx != 0))
e_dev_info("Speed and duplex autonegotiation "
"enabled\n");
break;
case HALF_DUPLEX:
e_dev_info("Half Duplex specified without Speed\n");
e_dev_info("Using Autonegotiation at Half Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
ADVERTISE_100_HALF;
break;
case FULL_DUPLEX:
e_dev_info("Full Duplex specified without Speed\n");
e_dev_info("Using Autonegotiation at Full Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_FULL |
ADVERTISE_100_FULL |
ADVERTISE_1000_FULL;
break;
case SPEED_10:
e_dev_info("10 Mbps Speed specified without Duplex\n");
e_dev_info("Using Autonegotiation at 10 Mbps only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
ADVERTISE_10_FULL;
break;
case SPEED_10 + HALF_DUPLEX:
e_dev_info("Forcing to 10 Mbps Half Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_10_half;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_10 + FULL_DUPLEX:
e_dev_info("Forcing to 10 Mbps Full Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_10_full;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_100:
e_dev_info("100 Mbps Speed specified without Duplex\n");
e_dev_info("Using Autonegotiation at 100 Mbps only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_100_HALF |
ADVERTISE_100_FULL;
break;
case SPEED_100 + HALF_DUPLEX:
e_dev_info("Forcing to 100 Mbps Half Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_100_half;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_100 + FULL_DUPLEX:
e_dev_info("Forcing to 100 Mbps Full Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_100_full;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_1000:
e_dev_info("1000 Mbps Speed specified without Duplex\n");
goto full_duplex_only;
case SPEED_1000 + HALF_DUPLEX:
e_dev_info("Half Duplex is not supported at 1000 Mbps\n");
fallthrough;
case SPEED_1000 + FULL_DUPLEX:
full_duplex_only:
e_dev_info("Using Autonegotiation at 1000 Mbps Full Duplex "
"only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
break;
default:
BUG();
}
/* Speed, AutoNeg and MDI/MDI-X must all play nice */
if (e1000_validate_mdi_setting(&(adapter->hw)) < 0) {
e_dev_info("Speed, AutoNeg and MDI-X specs are incompatible. "
"Setting MDI-X to a compatible value.\n");
}
}

View File

@ -0,0 +1,727 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 1999 - 2006 Intel Corporation. */
#include "e1000.h"
/* This is the only thing that needs to be changed to adjust the
* maximum number of ports that the driver can manage.
*/
#define E1000_MAX_NIC 32
#define OPTION_UNSET -1
#define OPTION_DISABLED 0
#define OPTION_ENABLED 1
/* All parameters are treated the same, as an integer array of values.
* This macro just reduces the need to repeat the same declaration code
* over and over (plus this helps to avoid typo bugs).
*/
#define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
#define E1000_PARAM(X, desc) \
static int X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
static unsigned int num_##X; \
module_param_array_named(X, X, int, &num_##X, 0); \
MODULE_PARM_DESC(X, desc);
/* Transmit Descriptor Count
*
* Valid Range: 80-256 for 82542 and 82543 gigabit ethernet controllers
* Valid Range: 80-4096 for 82544 and newer
*
* Default Value: 256
*/
E1000_PARAM(TxDescriptors, "Number of transmit descriptors");
/* Receive Descriptor Count
*
* Valid Range: 80-256 for 82542 and 82543 gigabit ethernet controllers
* Valid Range: 80-4096 for 82544 and newer
*
* Default Value: 256
*/
E1000_PARAM(RxDescriptors, "Number of receive descriptors");
/* User Specified Speed Override
*
* Valid Range: 0, 10, 100, 1000
* - 0 - auto-negotiate at all supported speeds
* - 10 - only link at 10 Mbps
* - 100 - only link at 100 Mbps
* - 1000 - only link at 1000 Mbps
*
* Default Value: 0
*/
E1000_PARAM(Speed, "Speed setting");
/* User Specified Duplex Override
*
* Valid Range: 0-2
* - 0 - auto-negotiate for duplex
* - 1 - only link at half duplex
* - 2 - only link at full duplex
*
* Default Value: 0
*/
E1000_PARAM(Duplex, "Duplex setting");
/* Auto-negotiation Advertisement Override
*
* Valid Range: 0x01-0x0F, 0x20-0x2F (copper); 0x20 (fiber)
*
* The AutoNeg value is a bit mask describing which speed and duplex
* combinations should be advertised during auto-negotiation.
* The supported speed and duplex modes are listed below
*
* Bit 7 6 5 4 3 2 1 0
* Speed (Mbps) N/A N/A 1000 N/A 100 100 10 10
* Duplex Full Full Half Full Half
*
* Default Value: 0x2F (copper); 0x20 (fiber)
*/
E1000_PARAM(AutoNeg, "Advertised auto-negotiation setting");
#define AUTONEG_ADV_DEFAULT 0x2F
/* User Specified Flow Control Override
*
* Valid Range: 0-3
* - 0 - No Flow Control
* - 1 - Rx only, respond to PAUSE frames but do not generate them
* - 2 - Tx only, generate PAUSE frames but ignore them on receive
* - 3 - Full Flow Control Support
*
* Default Value: Read flow control settings from the EEPROM
*/
E1000_PARAM(FlowControl, "Flow Control setting");
/* XsumRX - Receive Checksum Offload Enable/Disable
*
* Valid Range: 0, 1
* - 0 - disables all checksum offload
* - 1 - enables receive IP/TCP/UDP checksum offload
* on 82543 and newer -based NICs
*
* Default Value: 1
*/
E1000_PARAM(XsumRX, "Disable or enable Receive Checksum offload");
/* Transmit Interrupt Delay in units of 1.024 microseconds
* Tx interrupt delay needs to typically be set to something non zero
*
* Valid Range: 0-65535
*/
E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay");
#define DEFAULT_TIDV 8
#define MAX_TXDELAY 0xFFFF
#define MIN_TXDELAY 0
/* Transmit Absolute Interrupt Delay in units of 1.024 microseconds
*
* Valid Range: 0-65535
*/
E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay");
#define DEFAULT_TADV 32
#define MAX_TXABSDELAY 0xFFFF
#define MIN_TXABSDELAY 0
/* Receive Interrupt Delay in units of 1.024 microseconds
* hardware will likely hang if you set this to anything but zero.
*
* Valid Range: 0-65535
*/
E1000_PARAM(RxIntDelay, "Receive Interrupt Delay");
#define DEFAULT_RDTR 0
#define MAX_RXDELAY 0xFFFF
#define MIN_RXDELAY 0
/* Receive Absolute Interrupt Delay in units of 1.024 microseconds
*
* Valid Range: 0-65535
*/
E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay");
#define DEFAULT_RADV 8
#define MAX_RXABSDELAY 0xFFFF
#define MIN_RXABSDELAY 0
/* Interrupt Throttle Rate (interrupts/sec)
*
* Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative)
*/
E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
#define DEFAULT_ITR 3
#define MAX_ITR 100000
#define MIN_ITR 100
/* Enable Smart Power Down of the PHY
*
* Valid Range: 0, 1
*
* Default Value: 0 (disabled)
*/
E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
struct e1000_option {
enum { enable_option, range_option, list_option } type;
const char *name;
const char *err;
int def;
union {
struct { /* range_option info */
int min;
int max;
} r;
struct { /* list_option info */
int nr;
const struct e1000_opt_list { int i; char *str; } *p;
} l;
} arg;
};
static int e1000_validate_option(unsigned int *value,
const struct e1000_option *opt,
struct e1000_adapter *adapter)
{
if (*value == OPTION_UNSET) {
*value = opt->def;
return 0;
}
switch (opt->type) {
case enable_option:
switch (*value) {
case OPTION_ENABLED:
e_dev_info("%s Enabled\n", opt->name);
return 0;
case OPTION_DISABLED:
e_dev_info("%s Disabled\n", opt->name);
return 0;
}
break;
case range_option:
if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
e_dev_info("%s set to %i\n", opt->name, *value);
return 0;
}
break;
case list_option: {
int i;
const struct e1000_opt_list *ent;
for (i = 0; i < opt->arg.l.nr; i++) {
ent = &opt->arg.l.p[i];
if (*value == ent->i) {
if (ent->str[0] != '\0')
e_dev_info("%s\n", ent->str);
return 0;
}
}
}
break;
default:
BUG();
}
e_dev_info("Invalid %s value specified (%i) %s\n",
opt->name, *value, opt->err);
*value = opt->def;
return -1;
}
static void e1000_check_fiber_options(struct e1000_adapter *adapter);
static void e1000_check_copper_options(struct e1000_adapter *adapter);
/**
* e1000_check_options - Range Checking for Command Line Parameters
* @adapter: board private structure
*
* This routine checks all command line parameters for valid user
* input. If an invalid value is given, or if no user specified
* value exists, a default value is used. The final value is stored
* in a variable in the adapter structure.
**/
void e1000_check_options(struct e1000_adapter *adapter)
{
struct e1000_option opt;
int bd = adapter->bd_number;
if (bd >= E1000_MAX_NIC) {
e_dev_warn("Warning: no configuration for board #%i "
"using defaults for all values\n", bd);
}
{ /* Transmit Descriptor Count */
struct e1000_tx_ring *tx_ring = adapter->tx_ring;
int i;
e1000_mac_type mac_type = adapter->hw.mac_type;
opt = (struct e1000_option) {
.type = range_option,
.name = "Transmit Descriptors",
.err = "using default of "
__MODULE_STRING(E1000_DEFAULT_TXD),
.def = E1000_DEFAULT_TXD,
.arg = { .r = {
.min = E1000_MIN_TXD,
.max = mac_type < e1000_82544 ? E1000_MAX_TXD : E1000_MAX_82544_TXD
}}
};
if (num_TxDescriptors > bd) {
tx_ring->count = TxDescriptors[bd];
e1000_validate_option(&tx_ring->count, &opt, adapter);
tx_ring->count = ALIGN(tx_ring->count,
REQ_TX_DESCRIPTOR_MULTIPLE);
} else {
tx_ring->count = opt.def;
}
for (i = 0; i < adapter->num_tx_queues; i++)
tx_ring[i].count = tx_ring->count;
}
{ /* Receive Descriptor Count */
struct e1000_rx_ring *rx_ring = adapter->rx_ring;
int i;
e1000_mac_type mac_type = adapter->hw.mac_type;
opt = (struct e1000_option) {
.type = range_option,
.name = "Receive Descriptors",
.err = "using default of "
__MODULE_STRING(E1000_DEFAULT_RXD),
.def = E1000_DEFAULT_RXD,
.arg = { .r = {
.min = E1000_MIN_RXD,
.max = mac_type < e1000_82544 ? E1000_MAX_RXD :
E1000_MAX_82544_RXD
}}
};
if (num_RxDescriptors > bd) {
rx_ring->count = RxDescriptors[bd];
e1000_validate_option(&rx_ring->count, &opt, adapter);
rx_ring->count = ALIGN(rx_ring->count,
REQ_RX_DESCRIPTOR_MULTIPLE);
} else {
rx_ring->count = opt.def;
}
for (i = 0; i < adapter->num_rx_queues; i++)
rx_ring[i].count = rx_ring->count;
}
{ /* Checksum Offload Enable/Disable */
opt = (struct e1000_option) {
.type = enable_option,
.name = "Checksum Offload",
.err = "defaulting to Enabled",
.def = OPTION_ENABLED
};
if (num_XsumRX > bd) {
unsigned int rx_csum = XsumRX[bd];
e1000_validate_option(&rx_csum, &opt, adapter);
adapter->rx_csum = rx_csum;
} else {
adapter->rx_csum = opt.def;
}
}
{ /* Flow Control */
static const struct e1000_opt_list fc_list[] = {
{ E1000_FC_NONE, "Flow Control Disabled" },
{ E1000_FC_RX_PAUSE, "Flow Control Receive Only" },
{ E1000_FC_TX_PAUSE, "Flow Control Transmit Only" },
{ E1000_FC_FULL, "Flow Control Enabled" },
{ E1000_FC_DEFAULT, "Flow Control Hardware Default" }
};
opt = (struct e1000_option) {
.type = list_option,
.name = "Flow Control",
.err = "reading default settings from EEPROM",
.def = E1000_FC_DEFAULT,
.arg = { .l = { .nr = ARRAY_SIZE(fc_list),
.p = fc_list }}
};
if (num_FlowControl > bd) {
unsigned int fc = FlowControl[bd];
e1000_validate_option(&fc, &opt, adapter);
adapter->hw.fc = adapter->hw.original_fc = fc;
} else {
adapter->hw.fc = adapter->hw.original_fc = opt.def;
}
}
{ /* Transmit Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Transmit Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_TIDV),
.def = DEFAULT_TIDV,
.arg = { .r = { .min = MIN_TXDELAY,
.max = MAX_TXDELAY }}
};
if (num_TxIntDelay > bd) {
adapter->tx_int_delay = TxIntDelay[bd];
e1000_validate_option(&adapter->tx_int_delay, &opt,
adapter);
} else {
adapter->tx_int_delay = opt.def;
}
}
{ /* Transmit Absolute Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Transmit Absolute Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_TADV),
.def = DEFAULT_TADV,
.arg = { .r = { .min = MIN_TXABSDELAY,
.max = MAX_TXABSDELAY }}
};
if (num_TxAbsIntDelay > bd) {
adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
adapter);
} else {
adapter->tx_abs_int_delay = opt.def;
}
}
{ /* Receive Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Receive Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_RDTR),
.def = DEFAULT_RDTR,
.arg = { .r = { .min = MIN_RXDELAY,
.max = MAX_RXDELAY }}
};
if (num_RxIntDelay > bd) {
adapter->rx_int_delay = RxIntDelay[bd];
e1000_validate_option(&adapter->rx_int_delay, &opt,
adapter);
} else {
adapter->rx_int_delay = opt.def;
}
}
{ /* Receive Absolute Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Receive Absolute Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_RADV),
.def = DEFAULT_RADV,
.arg = { .r = { .min = MIN_RXABSDELAY,
.max = MAX_RXABSDELAY }}
};
if (num_RxAbsIntDelay > bd) {
adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
adapter);
} else {
adapter->rx_abs_int_delay = opt.def;
}
}
{ /* Interrupt Throttling Rate */
opt = (struct e1000_option) {
.type = range_option,
.name = "Interrupt Throttling Rate (ints/sec)",
.err = "using default of " __MODULE_STRING(DEFAULT_ITR),
.def = DEFAULT_ITR,
.arg = { .r = { .min = MIN_ITR,
.max = MAX_ITR }}
};
if (num_InterruptThrottleRate > bd) {
adapter->itr = InterruptThrottleRate[bd];
switch (adapter->itr) {
case 0:
e_dev_info("%s turned off\n", opt.name);
break;
case 1:
e_dev_info("%s set to dynamic mode\n",
opt.name);
adapter->itr_setting = adapter->itr;
adapter->itr = 20000;
break;
case 3:
e_dev_info("%s set to dynamic conservative "
"mode\n", opt.name);
adapter->itr_setting = adapter->itr;
adapter->itr = 20000;
break;
case 4:
e_dev_info("%s set to simplified "
"(2000-8000) ints mode\n", opt.name);
adapter->itr_setting = adapter->itr;
break;
default:
e1000_validate_option(&adapter->itr, &opt,
adapter);
/* save the setting, because the dynamic bits
* change itr.
* clear the lower two bits because they are
* used as control
*/
adapter->itr_setting = adapter->itr & ~3;
break;
}
} else {
adapter->itr_setting = opt.def;
adapter->itr = 20000;
}
}
{ /* Smart Power Down */
opt = (struct e1000_option) {
.type = enable_option,
.name = "PHY Smart Power Down",
.err = "defaulting to Disabled",
.def = OPTION_DISABLED
};
if (num_SmartPowerDownEnable > bd) {
unsigned int spd = SmartPowerDownEnable[bd];
e1000_validate_option(&spd, &opt, adapter);
adapter->smart_power_down = spd;
} else {
adapter->smart_power_down = opt.def;
}
}
switch (adapter->hw.media_type) {
case e1000_media_type_fiber:
case e1000_media_type_internal_serdes:
e1000_check_fiber_options(adapter);
break;
case e1000_media_type_copper:
e1000_check_copper_options(adapter);
break;
default:
BUG();
}
}
/**
* e1000_check_fiber_options - Range Checking for Link Options, Fiber Version
* @adapter: board private structure
*
* Handles speed and duplex options on fiber adapters
**/
static void e1000_check_fiber_options(struct e1000_adapter *adapter)
{
int bd = adapter->bd_number;
if (num_Speed > bd) {
e_dev_info("Speed not valid for fiber adapters, parameter "
"ignored\n");
}
if (num_Duplex > bd) {
e_dev_info("Duplex not valid for fiber adapters, parameter "
"ignored\n");
}
if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) {
e_dev_info("AutoNeg other than 1000/Full is not valid for fiber"
"adapters, parameter ignored\n");
}
}
/**
* e1000_check_copper_options - Range Checking for Link Options, Copper Version
* @adapter: board private structure
*
* Handles speed and duplex options on copper adapters
**/
static void e1000_check_copper_options(struct e1000_adapter *adapter)
{
struct e1000_option opt;
unsigned int speed, dplx, an;
int bd = adapter->bd_number;
{ /* Speed */
static const struct e1000_opt_list speed_list[] = {
{ 0, "" },
{ SPEED_10, "" },
{ SPEED_100, "" },
{ SPEED_1000, "" }};
opt = (struct e1000_option) {
.type = list_option,
.name = "Speed",
.err = "parameter ignored",
.def = 0,
.arg = { .l = { .nr = ARRAY_SIZE(speed_list),
.p = speed_list }}
};
if (num_Speed > bd) {
speed = Speed[bd];
e1000_validate_option(&speed, &opt, adapter);
} else {
speed = opt.def;
}
}
{ /* Duplex */
static const struct e1000_opt_list dplx_list[] = {
{ 0, "" },
{ HALF_DUPLEX, "" },
{ FULL_DUPLEX, "" }};
opt = (struct e1000_option) {
.type = list_option,
.name = "Duplex",
.err = "parameter ignored",
.def = 0,
.arg = { .l = { .nr = ARRAY_SIZE(dplx_list),
.p = dplx_list }}
};
if (num_Duplex > bd) {
dplx = Duplex[bd];
e1000_validate_option(&dplx, &opt, adapter);
} else {
dplx = opt.def;
}
}
if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) {
e_dev_info("AutoNeg specified along with Speed or Duplex, "
"parameter ignored\n");
adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT;
} else { /* Autoneg */
static const struct e1000_opt_list an_list[] =
#define AA "AutoNeg advertising "
{{ 0x01, AA "10/HD" },
{ 0x02, AA "10/FD" },
{ 0x03, AA "10/FD, 10/HD" },
{ 0x04, AA "100/HD" },
{ 0x05, AA "100/HD, 10/HD" },
{ 0x06, AA "100/HD, 10/FD" },
{ 0x07, AA "100/HD, 10/FD, 10/HD" },
{ 0x08, AA "100/FD" },
{ 0x09, AA "100/FD, 10/HD" },
{ 0x0a, AA "100/FD, 10/FD" },
{ 0x0b, AA "100/FD, 10/FD, 10/HD" },
{ 0x0c, AA "100/FD, 100/HD" },
{ 0x0d, AA "100/FD, 100/HD, 10/HD" },
{ 0x0e, AA "100/FD, 100/HD, 10/FD" },
{ 0x0f, AA "100/FD, 100/HD, 10/FD, 10/HD" },
{ 0x20, AA "1000/FD" },
{ 0x21, AA "1000/FD, 10/HD" },
{ 0x22, AA "1000/FD, 10/FD" },
{ 0x23, AA "1000/FD, 10/FD, 10/HD" },
{ 0x24, AA "1000/FD, 100/HD" },
{ 0x25, AA "1000/FD, 100/HD, 10/HD" },
{ 0x26, AA "1000/FD, 100/HD, 10/FD" },
{ 0x27, AA "1000/FD, 100/HD, 10/FD, 10/HD" },
{ 0x28, AA "1000/FD, 100/FD" },
{ 0x29, AA "1000/FD, 100/FD, 10/HD" },
{ 0x2a, AA "1000/FD, 100/FD, 10/FD" },
{ 0x2b, AA "1000/FD, 100/FD, 10/FD, 10/HD" },
{ 0x2c, AA "1000/FD, 100/FD, 100/HD" },
{ 0x2d, AA "1000/FD, 100/FD, 100/HD, 10/HD" },
{ 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" },
{ 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }};
opt = (struct e1000_option) {
.type = list_option,
.name = "AutoNeg",
.err = "parameter ignored",
.def = AUTONEG_ADV_DEFAULT,
.arg = { .l = { .nr = ARRAY_SIZE(an_list),
.p = an_list }}
};
if (num_AutoNeg > bd) {
an = AutoNeg[bd];
e1000_validate_option(&an, &opt, adapter);
} else {
an = opt.def;
}
adapter->hw.autoneg_advertised = an;
}
switch (speed + dplx) {
case 0:
adapter->hw.autoneg = adapter->fc_autoneg = 1;
if ((num_Speed > bd) && (speed != 0 || dplx != 0))
e_dev_info("Speed and duplex autonegotiation "
"enabled\n");
break;
case HALF_DUPLEX:
e_dev_info("Half Duplex specified without Speed\n");
e_dev_info("Using Autonegotiation at Half Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
ADVERTISE_100_HALF;
break;
case FULL_DUPLEX:
e_dev_info("Full Duplex specified without Speed\n");
e_dev_info("Using Autonegotiation at Full Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_FULL |
ADVERTISE_100_FULL |
ADVERTISE_1000_FULL;
break;
case SPEED_10:
e_dev_info("10 Mbps Speed specified without Duplex\n");
e_dev_info("Using Autonegotiation at 10 Mbps only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
ADVERTISE_10_FULL;
break;
case SPEED_10 + HALF_DUPLEX:
e_dev_info("Forcing to 10 Mbps Half Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_10_half;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_10 + FULL_DUPLEX:
e_dev_info("Forcing to 10 Mbps Full Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_10_full;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_100:
e_dev_info("100 Mbps Speed specified without Duplex\n");
e_dev_info("Using Autonegotiation at 100 Mbps only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_100_HALF |
ADVERTISE_100_FULL;
break;
case SPEED_100 + HALF_DUPLEX:
e_dev_info("Forcing to 100 Mbps Half Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_100_half;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_100 + FULL_DUPLEX:
e_dev_info("Forcing to 100 Mbps Full Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_100_full;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_1000:
e_dev_info("1000 Mbps Speed specified without Duplex\n");
goto full_duplex_only;
case SPEED_1000 + HALF_DUPLEX:
e_dev_info("Half Duplex is not supported at 1000 Mbps\n");
fallthrough;
case SPEED_1000 + FULL_DUPLEX:
full_duplex_only:
e_dev_info("Using Autonegotiation at 1000 Mbps Full Duplex "
"only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
break;
default:
BUG();
}
/* Speed, AutoNeg and MDI/MDI-X must all play nice */
if (e1000_validate_mdi_setting(&(adapter->hw)) < 0) {
e_dev_info("Speed, AutoNeg and MDI-X specs are incompatible. "
"Setting MDI-X to a compatible value.\n");
}
}

View File

@ -0,0 +1,727 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 1999 - 2006 Intel Corporation. */
#include "e1000-6.4-ethercat.h"
/* This is the only thing that needs to be changed to adjust the
* maximum number of ports that the driver can manage.
*/
#define E1000_MAX_NIC 32
#define OPTION_UNSET -1
#define OPTION_DISABLED 0
#define OPTION_ENABLED 1
/* All parameters are treated the same, as an integer array of values.
* This macro just reduces the need to repeat the same declaration code
* over and over (plus this helps to avoid typo bugs).
*/
#define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
#define E1000_PARAM(X, desc) \
static int X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
static unsigned int num_##X; \
module_param_array_named(X, X, int, &num_##X, 0); \
MODULE_PARM_DESC(X, desc);
/* Transmit Descriptor Count
*
* Valid Range: 80-256 for 82542 and 82543 gigabit ethernet controllers
* Valid Range: 80-4096 for 82544 and newer
*
* Default Value: 256
*/
E1000_PARAM(TxDescriptors, "Number of transmit descriptors");
/* Receive Descriptor Count
*
* Valid Range: 80-256 for 82542 and 82543 gigabit ethernet controllers
* Valid Range: 80-4096 for 82544 and newer
*
* Default Value: 256
*/
E1000_PARAM(RxDescriptors, "Number of receive descriptors");
/* User Specified Speed Override
*
* Valid Range: 0, 10, 100, 1000
* - 0 - auto-negotiate at all supported speeds
* - 10 - only link at 10 Mbps
* - 100 - only link at 100 Mbps
* - 1000 - only link at 1000 Mbps
*
* Default Value: 0
*/
E1000_PARAM(Speed, "Speed setting");
/* User Specified Duplex Override
*
* Valid Range: 0-2
* - 0 - auto-negotiate for duplex
* - 1 - only link at half duplex
* - 2 - only link at full duplex
*
* Default Value: 0
*/
E1000_PARAM(Duplex, "Duplex setting");
/* Auto-negotiation Advertisement Override
*
* Valid Range: 0x01-0x0F, 0x20-0x2F (copper); 0x20 (fiber)
*
* The AutoNeg value is a bit mask describing which speed and duplex
* combinations should be advertised during auto-negotiation.
* The supported speed and duplex modes are listed below
*
* Bit 7 6 5 4 3 2 1 0
* Speed (Mbps) N/A N/A 1000 N/A 100 100 10 10
* Duplex Full Full Half Full Half
*
* Default Value: 0x2F (copper); 0x20 (fiber)
*/
E1000_PARAM(AutoNeg, "Advertised auto-negotiation setting");
#define AUTONEG_ADV_DEFAULT 0x2F
/* User Specified Flow Control Override
*
* Valid Range: 0-3
* - 0 - No Flow Control
* - 1 - Rx only, respond to PAUSE frames but do not generate them
* - 2 - Tx only, generate PAUSE frames but ignore them on receive
* - 3 - Full Flow Control Support
*
* Default Value: Read flow control settings from the EEPROM
*/
E1000_PARAM(FlowControl, "Flow Control setting");
/* XsumRX - Receive Checksum Offload Enable/Disable
*
* Valid Range: 0, 1
* - 0 - disables all checksum offload
* - 1 - enables receive IP/TCP/UDP checksum offload
* on 82543 and newer -based NICs
*
* Default Value: 1
*/
E1000_PARAM(XsumRX, "Disable or enable Receive Checksum offload");
/* Transmit Interrupt Delay in units of 1.024 microseconds
* Tx interrupt delay needs to typically be set to something non zero
*
* Valid Range: 0-65535
*/
E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay");
#define DEFAULT_TIDV 8
#define MAX_TXDELAY 0xFFFF
#define MIN_TXDELAY 0
/* Transmit Absolute Interrupt Delay in units of 1.024 microseconds
*
* Valid Range: 0-65535
*/
E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay");
#define DEFAULT_TADV 32
#define MAX_TXABSDELAY 0xFFFF
#define MIN_TXABSDELAY 0
/* Receive Interrupt Delay in units of 1.024 microseconds
* hardware will likely hang if you set this to anything but zero.
*
* Valid Range: 0-65535
*/
E1000_PARAM(RxIntDelay, "Receive Interrupt Delay");
#define DEFAULT_RDTR 0
#define MAX_RXDELAY 0xFFFF
#define MIN_RXDELAY 0
/* Receive Absolute Interrupt Delay in units of 1.024 microseconds
*
* Valid Range: 0-65535
*/
E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay");
#define DEFAULT_RADV 8
#define MAX_RXABSDELAY 0xFFFF
#define MIN_RXABSDELAY 0
/* Interrupt Throttle Rate (interrupts/sec)
*
* Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative)
*/
E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
#define DEFAULT_ITR 3
#define MAX_ITR 100000
#define MIN_ITR 100
/* Enable Smart Power Down of the PHY
*
* Valid Range: 0, 1
*
* Default Value: 0 (disabled)
*/
E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
struct e1000_option {
enum { enable_option, range_option, list_option } type;
const char *name;
const char *err;
int def;
union {
struct { /* range_option info */
int min;
int max;
} r;
struct { /* list_option info */
int nr;
const struct e1000_opt_list { int i; char *str; } *p;
} l;
} arg;
};
static int e1000_validate_option(unsigned int *value,
const struct e1000_option *opt,
struct e1000_adapter *adapter)
{
if (*value == OPTION_UNSET) {
*value = opt->def;
return 0;
}
switch (opt->type) {
case enable_option:
switch (*value) {
case OPTION_ENABLED:
e_dev_info("%s Enabled\n", opt->name);
return 0;
case OPTION_DISABLED:
e_dev_info("%s Disabled\n", opt->name);
return 0;
}
break;
case range_option:
if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
e_dev_info("%s set to %i\n", opt->name, *value);
return 0;
}
break;
case list_option: {
int i;
const struct e1000_opt_list *ent;
for (i = 0; i < opt->arg.l.nr; i++) {
ent = &opt->arg.l.p[i];
if (*value == ent->i) {
if (ent->str[0] != '\0')
e_dev_info("%s\n", ent->str);
return 0;
}
}
}
break;
default:
BUG();
}
e_dev_info("Invalid %s value specified (%i) %s\n",
opt->name, *value, opt->err);
*value = opt->def;
return -1;
}
static void e1000_check_fiber_options(struct e1000_adapter *adapter);
static void e1000_check_copper_options(struct e1000_adapter *adapter);
/**
* e1000_check_options - Range Checking for Command Line Parameters
* @adapter: board private structure
*
* This routine checks all command line parameters for valid user
* input. If an invalid value is given, or if no user specified
* value exists, a default value is used. The final value is stored
* in a variable in the adapter structure.
**/
void e1000_check_options(struct e1000_adapter *adapter)
{
struct e1000_option opt;
int bd = adapter->bd_number;
if (bd >= E1000_MAX_NIC) {
e_dev_warn("Warning: no configuration for board #%i "
"using defaults for all values\n", bd);
}
{ /* Transmit Descriptor Count */
struct e1000_tx_ring *tx_ring = adapter->tx_ring;
int i;
e1000_mac_type mac_type = adapter->hw.mac_type;
opt = (struct e1000_option) {
.type = range_option,
.name = "Transmit Descriptors",
.err = "using default of "
__MODULE_STRING(E1000_DEFAULT_TXD),
.def = E1000_DEFAULT_TXD,
.arg = { .r = {
.min = E1000_MIN_TXD,
.max = mac_type < e1000_82544 ? E1000_MAX_TXD : E1000_MAX_82544_TXD
}}
};
if (num_TxDescriptors > bd) {
tx_ring->count = TxDescriptors[bd];
e1000_validate_option(&tx_ring->count, &opt, adapter);
tx_ring->count = ALIGN(tx_ring->count,
REQ_TX_DESCRIPTOR_MULTIPLE);
} else {
tx_ring->count = opt.def;
}
for (i = 0; i < adapter->num_tx_queues; i++)
tx_ring[i].count = tx_ring->count;
}
{ /* Receive Descriptor Count */
struct e1000_rx_ring *rx_ring = adapter->rx_ring;
int i;
e1000_mac_type mac_type = adapter->hw.mac_type;
opt = (struct e1000_option) {
.type = range_option,
.name = "Receive Descriptors",
.err = "using default of "
__MODULE_STRING(E1000_DEFAULT_RXD),
.def = E1000_DEFAULT_RXD,
.arg = { .r = {
.min = E1000_MIN_RXD,
.max = mac_type < e1000_82544 ? E1000_MAX_RXD :
E1000_MAX_82544_RXD
}}
};
if (num_RxDescriptors > bd) {
rx_ring->count = RxDescriptors[bd];
e1000_validate_option(&rx_ring->count, &opt, adapter);
rx_ring->count = ALIGN(rx_ring->count,
REQ_RX_DESCRIPTOR_MULTIPLE);
} else {
rx_ring->count = opt.def;
}
for (i = 0; i < adapter->num_rx_queues; i++)
rx_ring[i].count = rx_ring->count;
}
{ /* Checksum Offload Enable/Disable */
opt = (struct e1000_option) {
.type = enable_option,
.name = "Checksum Offload",
.err = "defaulting to Enabled",
.def = OPTION_ENABLED
};
if (num_XsumRX > bd) {
unsigned int rx_csum = XsumRX[bd];
e1000_validate_option(&rx_csum, &opt, adapter);
adapter->rx_csum = rx_csum;
} else {
adapter->rx_csum = opt.def;
}
}
{ /* Flow Control */
static const struct e1000_opt_list fc_list[] = {
{ E1000_FC_NONE, "Flow Control Disabled" },
{ E1000_FC_RX_PAUSE, "Flow Control Receive Only" },
{ E1000_FC_TX_PAUSE, "Flow Control Transmit Only" },
{ E1000_FC_FULL, "Flow Control Enabled" },
{ E1000_FC_DEFAULT, "Flow Control Hardware Default" }
};
opt = (struct e1000_option) {
.type = list_option,
.name = "Flow Control",
.err = "reading default settings from EEPROM",
.def = E1000_FC_DEFAULT,
.arg = { .l = { .nr = ARRAY_SIZE(fc_list),
.p = fc_list }}
};
if (num_FlowControl > bd) {
unsigned int fc = FlowControl[bd];
e1000_validate_option(&fc, &opt, adapter);
adapter->hw.fc = adapter->hw.original_fc = fc;
} else {
adapter->hw.fc = adapter->hw.original_fc = opt.def;
}
}
{ /* Transmit Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Transmit Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_TIDV),
.def = DEFAULT_TIDV,
.arg = { .r = { .min = MIN_TXDELAY,
.max = MAX_TXDELAY }}
};
if (num_TxIntDelay > bd) {
adapter->tx_int_delay = TxIntDelay[bd];
e1000_validate_option(&adapter->tx_int_delay, &opt,
adapter);
} else {
adapter->tx_int_delay = opt.def;
}
}
{ /* Transmit Absolute Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Transmit Absolute Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_TADV),
.def = DEFAULT_TADV,
.arg = { .r = { .min = MIN_TXABSDELAY,
.max = MAX_TXABSDELAY }}
};
if (num_TxAbsIntDelay > bd) {
adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
adapter);
} else {
adapter->tx_abs_int_delay = opt.def;
}
}
{ /* Receive Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Receive Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_RDTR),
.def = DEFAULT_RDTR,
.arg = { .r = { .min = MIN_RXDELAY,
.max = MAX_RXDELAY }}
};
if (num_RxIntDelay > bd) {
adapter->rx_int_delay = RxIntDelay[bd];
e1000_validate_option(&adapter->rx_int_delay, &opt,
adapter);
} else {
adapter->rx_int_delay = opt.def;
}
}
{ /* Receive Absolute Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Receive Absolute Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_RADV),
.def = DEFAULT_RADV,
.arg = { .r = { .min = MIN_RXABSDELAY,
.max = MAX_RXABSDELAY }}
};
if (num_RxAbsIntDelay > bd) {
adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
adapter);
} else {
adapter->rx_abs_int_delay = opt.def;
}
}
{ /* Interrupt Throttling Rate */
opt = (struct e1000_option) {
.type = range_option,
.name = "Interrupt Throttling Rate (ints/sec)",
.err = "using default of " __MODULE_STRING(DEFAULT_ITR),
.def = DEFAULT_ITR,
.arg = { .r = { .min = MIN_ITR,
.max = MAX_ITR }}
};
if (num_InterruptThrottleRate > bd) {
adapter->itr = InterruptThrottleRate[bd];
switch (adapter->itr) {
case 0:
e_dev_info("%s turned off\n", opt.name);
break;
case 1:
e_dev_info("%s set to dynamic mode\n",
opt.name);
adapter->itr_setting = adapter->itr;
adapter->itr = 20000;
break;
case 3:
e_dev_info("%s set to dynamic conservative "
"mode\n", opt.name);
adapter->itr_setting = adapter->itr;
adapter->itr = 20000;
break;
case 4:
e_dev_info("%s set to simplified "
"(2000-8000) ints mode\n", opt.name);
adapter->itr_setting = adapter->itr;
break;
default:
e1000_validate_option(&adapter->itr, &opt,
adapter);
/* save the setting, because the dynamic bits
* change itr.
* clear the lower two bits because they are
* used as control
*/
adapter->itr_setting = adapter->itr & ~3;
break;
}
} else {
adapter->itr_setting = opt.def;
adapter->itr = 20000;
}
}
{ /* Smart Power Down */
opt = (struct e1000_option) {
.type = enable_option,
.name = "PHY Smart Power Down",
.err = "defaulting to Disabled",
.def = OPTION_DISABLED
};
if (num_SmartPowerDownEnable > bd) {
unsigned int spd = SmartPowerDownEnable[bd];
e1000_validate_option(&spd, &opt, adapter);
adapter->smart_power_down = spd;
} else {
adapter->smart_power_down = opt.def;
}
}
switch (adapter->hw.media_type) {
case e1000_media_type_fiber:
case e1000_media_type_internal_serdes:
e1000_check_fiber_options(adapter);
break;
case e1000_media_type_copper:
e1000_check_copper_options(adapter);
break;
default:
BUG();
}
}
/**
* e1000_check_fiber_options - Range Checking for Link Options, Fiber Version
* @adapter: board private structure
*
* Handles speed and duplex options on fiber adapters
**/
static void e1000_check_fiber_options(struct e1000_adapter *adapter)
{
int bd = adapter->bd_number;
if (num_Speed > bd) {
e_dev_info("Speed not valid for fiber adapters, parameter "
"ignored\n");
}
if (num_Duplex > bd) {
e_dev_info("Duplex not valid for fiber adapters, parameter "
"ignored\n");
}
if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) {
e_dev_info("AutoNeg other than 1000/Full is not valid for fiber"
"adapters, parameter ignored\n");
}
}
/**
* e1000_check_copper_options - Range Checking for Link Options, Copper Version
* @adapter: board private structure
*
* Handles speed and duplex options on copper adapters
**/
static void e1000_check_copper_options(struct e1000_adapter *adapter)
{
struct e1000_option opt;
unsigned int speed, dplx, an;
int bd = adapter->bd_number;
{ /* Speed */
static const struct e1000_opt_list speed_list[] = {
{ 0, "" },
{ SPEED_10, "" },
{ SPEED_100, "" },
{ SPEED_1000, "" }};
opt = (struct e1000_option) {
.type = list_option,
.name = "Speed",
.err = "parameter ignored",
.def = 0,
.arg = { .l = { .nr = ARRAY_SIZE(speed_list),
.p = speed_list }}
};
if (num_Speed > bd) {
speed = Speed[bd];
e1000_validate_option(&speed, &opt, adapter);
} else {
speed = opt.def;
}
}
{ /* Duplex */
static const struct e1000_opt_list dplx_list[] = {
{ 0, "" },
{ HALF_DUPLEX, "" },
{ FULL_DUPLEX, "" }};
opt = (struct e1000_option) {
.type = list_option,
.name = "Duplex",
.err = "parameter ignored",
.def = 0,
.arg = { .l = { .nr = ARRAY_SIZE(dplx_list),
.p = dplx_list }}
};
if (num_Duplex > bd) {
dplx = Duplex[bd];
e1000_validate_option(&dplx, &opt, adapter);
} else {
dplx = opt.def;
}
}
if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) {
e_dev_info("AutoNeg specified along with Speed or Duplex, "
"parameter ignored\n");
adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT;
} else { /* Autoneg */
static const struct e1000_opt_list an_list[] =
#define AA "AutoNeg advertising "
{{ 0x01, AA "10/HD" },
{ 0x02, AA "10/FD" },
{ 0x03, AA "10/FD, 10/HD" },
{ 0x04, AA "100/HD" },
{ 0x05, AA "100/HD, 10/HD" },
{ 0x06, AA "100/HD, 10/FD" },
{ 0x07, AA "100/HD, 10/FD, 10/HD" },
{ 0x08, AA "100/FD" },
{ 0x09, AA "100/FD, 10/HD" },
{ 0x0a, AA "100/FD, 10/FD" },
{ 0x0b, AA "100/FD, 10/FD, 10/HD" },
{ 0x0c, AA "100/FD, 100/HD" },
{ 0x0d, AA "100/FD, 100/HD, 10/HD" },
{ 0x0e, AA "100/FD, 100/HD, 10/FD" },
{ 0x0f, AA "100/FD, 100/HD, 10/FD, 10/HD" },
{ 0x20, AA "1000/FD" },
{ 0x21, AA "1000/FD, 10/HD" },
{ 0x22, AA "1000/FD, 10/FD" },
{ 0x23, AA "1000/FD, 10/FD, 10/HD" },
{ 0x24, AA "1000/FD, 100/HD" },
{ 0x25, AA "1000/FD, 100/HD, 10/HD" },
{ 0x26, AA "1000/FD, 100/HD, 10/FD" },
{ 0x27, AA "1000/FD, 100/HD, 10/FD, 10/HD" },
{ 0x28, AA "1000/FD, 100/FD" },
{ 0x29, AA "1000/FD, 100/FD, 10/HD" },
{ 0x2a, AA "1000/FD, 100/FD, 10/FD" },
{ 0x2b, AA "1000/FD, 100/FD, 10/FD, 10/HD" },
{ 0x2c, AA "1000/FD, 100/FD, 100/HD" },
{ 0x2d, AA "1000/FD, 100/FD, 100/HD, 10/HD" },
{ 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" },
{ 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }};
opt = (struct e1000_option) {
.type = list_option,
.name = "AutoNeg",
.err = "parameter ignored",
.def = AUTONEG_ADV_DEFAULT,
.arg = { .l = { .nr = ARRAY_SIZE(an_list),
.p = an_list }}
};
if (num_AutoNeg > bd) {
an = AutoNeg[bd];
e1000_validate_option(&an, &opt, adapter);
} else {
an = opt.def;
}
adapter->hw.autoneg_advertised = an;
}
switch (speed + dplx) {
case 0:
adapter->hw.autoneg = adapter->fc_autoneg = 1;
if ((num_Speed > bd) && (speed != 0 || dplx != 0))
e_dev_info("Speed and duplex autonegotiation "
"enabled\n");
break;
case HALF_DUPLEX:
e_dev_info("Half Duplex specified without Speed\n");
e_dev_info("Using Autonegotiation at Half Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
ADVERTISE_100_HALF;
break;
case FULL_DUPLEX:
e_dev_info("Full Duplex specified without Speed\n");
e_dev_info("Using Autonegotiation at Full Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_FULL |
ADVERTISE_100_FULL |
ADVERTISE_1000_FULL;
break;
case SPEED_10:
e_dev_info("10 Mbps Speed specified without Duplex\n");
e_dev_info("Using Autonegotiation at 10 Mbps only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
ADVERTISE_10_FULL;
break;
case SPEED_10 + HALF_DUPLEX:
e_dev_info("Forcing to 10 Mbps Half Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_10_half;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_10 + FULL_DUPLEX:
e_dev_info("Forcing to 10 Mbps Full Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_10_full;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_100:
e_dev_info("100 Mbps Speed specified without Duplex\n");
e_dev_info("Using Autonegotiation at 100 Mbps only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_100_HALF |
ADVERTISE_100_FULL;
break;
case SPEED_100 + HALF_DUPLEX:
e_dev_info("Forcing to 100 Mbps Half Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_100_half;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_100 + FULL_DUPLEX:
e_dev_info("Forcing to 100 Mbps Full Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_100_full;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_1000:
e_dev_info("1000 Mbps Speed specified without Duplex\n");
goto full_duplex_only;
case SPEED_1000 + HALF_DUPLEX:
e_dev_info("Half Duplex is not supported at 1000 Mbps\n");
fallthrough;
case SPEED_1000 + FULL_DUPLEX:
full_duplex_only:
e_dev_info("Using Autonegotiation at 1000 Mbps Full Duplex "
"only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
break;
default:
BUG();
}
/* Speed, AutoNeg and MDI/MDI-X must all play nice */
if (e1000_validate_mdi_setting(&(adapter->hw)) < 0) {
e_dev_info("Speed, AutoNeg and MDI-X specs are incompatible. "
"Setting MDI-X to a compatible value.\n");
}
}

View File

@ -0,0 +1,727 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright(c) 1999 - 2006 Intel Corporation. */
#include "e1000.h"
/* This is the only thing that needs to be changed to adjust the
* maximum number of ports that the driver can manage.
*/
#define E1000_MAX_NIC 32
#define OPTION_UNSET -1
#define OPTION_DISABLED 0
#define OPTION_ENABLED 1
/* All parameters are treated the same, as an integer array of values.
* This macro just reduces the need to repeat the same declaration code
* over and over (plus this helps to avoid typo bugs).
*/
#define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
#define E1000_PARAM(X, desc) \
static int X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
static unsigned int num_##X; \
module_param_array_named(X, X, int, &num_##X, 0); \
MODULE_PARM_DESC(X, desc);
/* Transmit Descriptor Count
*
* Valid Range: 80-256 for 82542 and 82543 gigabit ethernet controllers
* Valid Range: 80-4096 for 82544 and newer
*
* Default Value: 256
*/
E1000_PARAM(TxDescriptors, "Number of transmit descriptors");
/* Receive Descriptor Count
*
* Valid Range: 80-256 for 82542 and 82543 gigabit ethernet controllers
* Valid Range: 80-4096 for 82544 and newer
*
* Default Value: 256
*/
E1000_PARAM(RxDescriptors, "Number of receive descriptors");
/* User Specified Speed Override
*
* Valid Range: 0, 10, 100, 1000
* - 0 - auto-negotiate at all supported speeds
* - 10 - only link at 10 Mbps
* - 100 - only link at 100 Mbps
* - 1000 - only link at 1000 Mbps
*
* Default Value: 0
*/
E1000_PARAM(Speed, "Speed setting");
/* User Specified Duplex Override
*
* Valid Range: 0-2
* - 0 - auto-negotiate for duplex
* - 1 - only link at half duplex
* - 2 - only link at full duplex
*
* Default Value: 0
*/
E1000_PARAM(Duplex, "Duplex setting");
/* Auto-negotiation Advertisement Override
*
* Valid Range: 0x01-0x0F, 0x20-0x2F (copper); 0x20 (fiber)
*
* The AutoNeg value is a bit mask describing which speed and duplex
* combinations should be advertised during auto-negotiation.
* The supported speed and duplex modes are listed below
*
* Bit 7 6 5 4 3 2 1 0
* Speed (Mbps) N/A N/A 1000 N/A 100 100 10 10
* Duplex Full Full Half Full Half
*
* Default Value: 0x2F (copper); 0x20 (fiber)
*/
E1000_PARAM(AutoNeg, "Advertised auto-negotiation setting");
#define AUTONEG_ADV_DEFAULT 0x2F
/* User Specified Flow Control Override
*
* Valid Range: 0-3
* - 0 - No Flow Control
* - 1 - Rx only, respond to PAUSE frames but do not generate them
* - 2 - Tx only, generate PAUSE frames but ignore them on receive
* - 3 - Full Flow Control Support
*
* Default Value: Read flow control settings from the EEPROM
*/
E1000_PARAM(FlowControl, "Flow Control setting");
/* XsumRX - Receive Checksum Offload Enable/Disable
*
* Valid Range: 0, 1
* - 0 - disables all checksum offload
* - 1 - enables receive IP/TCP/UDP checksum offload
* on 82543 and newer -based NICs
*
* Default Value: 1
*/
E1000_PARAM(XsumRX, "Disable or enable Receive Checksum offload");
/* Transmit Interrupt Delay in units of 1.024 microseconds
* Tx interrupt delay needs to typically be set to something non zero
*
* Valid Range: 0-65535
*/
E1000_PARAM(TxIntDelay, "Transmit Interrupt Delay");
#define DEFAULT_TIDV 8
#define MAX_TXDELAY 0xFFFF
#define MIN_TXDELAY 0
/* Transmit Absolute Interrupt Delay in units of 1.024 microseconds
*
* Valid Range: 0-65535
*/
E1000_PARAM(TxAbsIntDelay, "Transmit Absolute Interrupt Delay");
#define DEFAULT_TADV 32
#define MAX_TXABSDELAY 0xFFFF
#define MIN_TXABSDELAY 0
/* Receive Interrupt Delay in units of 1.024 microseconds
* hardware will likely hang if you set this to anything but zero.
*
* Valid Range: 0-65535
*/
E1000_PARAM(RxIntDelay, "Receive Interrupt Delay");
#define DEFAULT_RDTR 0
#define MAX_RXDELAY 0xFFFF
#define MIN_RXDELAY 0
/* Receive Absolute Interrupt Delay in units of 1.024 microseconds
*
* Valid Range: 0-65535
*/
E1000_PARAM(RxAbsIntDelay, "Receive Absolute Interrupt Delay");
#define DEFAULT_RADV 8
#define MAX_RXABSDELAY 0xFFFF
#define MIN_RXABSDELAY 0
/* Interrupt Throttle Rate (interrupts/sec)
*
* Valid Range: 100-100000 (0=off, 1=dynamic, 3=dynamic conservative)
*/
E1000_PARAM(InterruptThrottleRate, "Interrupt Throttling Rate");
#define DEFAULT_ITR 3
#define MAX_ITR 100000
#define MIN_ITR 100
/* Enable Smart Power Down of the PHY
*
* Valid Range: 0, 1
*
* Default Value: 0 (disabled)
*/
E1000_PARAM(SmartPowerDownEnable, "Enable PHY smart power down");
struct e1000_option {
enum { enable_option, range_option, list_option } type;
const char *name;
const char *err;
int def;
union {
struct { /* range_option info */
int min;
int max;
} r;
struct { /* list_option info */
int nr;
const struct e1000_opt_list { int i; char *str; } *p;
} l;
} arg;
};
static int e1000_validate_option(unsigned int *value,
const struct e1000_option *opt,
struct e1000_adapter *adapter)
{
if (*value == OPTION_UNSET) {
*value = opt->def;
return 0;
}
switch (opt->type) {
case enable_option:
switch (*value) {
case OPTION_ENABLED:
e_dev_info("%s Enabled\n", opt->name);
return 0;
case OPTION_DISABLED:
e_dev_info("%s Disabled\n", opt->name);
return 0;
}
break;
case range_option:
if (*value >= opt->arg.r.min && *value <= opt->arg.r.max) {
e_dev_info("%s set to %i\n", opt->name, *value);
return 0;
}
break;
case list_option: {
int i;
const struct e1000_opt_list *ent;
for (i = 0; i < opt->arg.l.nr; i++) {
ent = &opt->arg.l.p[i];
if (*value == ent->i) {
if (ent->str[0] != '\0')
e_dev_info("%s\n", ent->str);
return 0;
}
}
}
break;
default:
BUG();
}
e_dev_info("Invalid %s value specified (%i) %s\n",
opt->name, *value, opt->err);
*value = opt->def;
return -1;
}
static void e1000_check_fiber_options(struct e1000_adapter *adapter);
static void e1000_check_copper_options(struct e1000_adapter *adapter);
/**
* e1000_check_options - Range Checking for Command Line Parameters
* @adapter: board private structure
*
* This routine checks all command line parameters for valid user
* input. If an invalid value is given, or if no user specified
* value exists, a default value is used. The final value is stored
* in a variable in the adapter structure.
**/
void e1000_check_options(struct e1000_adapter *adapter)
{
struct e1000_option opt;
int bd = adapter->bd_number;
if (bd >= E1000_MAX_NIC) {
e_dev_warn("Warning: no configuration for board #%i "
"using defaults for all values\n", bd);
}
{ /* Transmit Descriptor Count */
struct e1000_tx_ring *tx_ring = adapter->tx_ring;
int i;
e1000_mac_type mac_type = adapter->hw.mac_type;
opt = (struct e1000_option) {
.type = range_option,
.name = "Transmit Descriptors",
.err = "using default of "
__MODULE_STRING(E1000_DEFAULT_TXD),
.def = E1000_DEFAULT_TXD,
.arg = { .r = {
.min = E1000_MIN_TXD,
.max = mac_type < e1000_82544 ? E1000_MAX_TXD : E1000_MAX_82544_TXD
}}
};
if (num_TxDescriptors > bd) {
tx_ring->count = TxDescriptors[bd];
e1000_validate_option(&tx_ring->count, &opt, adapter);
tx_ring->count = ALIGN(tx_ring->count,
REQ_TX_DESCRIPTOR_MULTIPLE);
} else {
tx_ring->count = opt.def;
}
for (i = 0; i < adapter->num_tx_queues; i++)
tx_ring[i].count = tx_ring->count;
}
{ /* Receive Descriptor Count */
struct e1000_rx_ring *rx_ring = adapter->rx_ring;
int i;
e1000_mac_type mac_type = adapter->hw.mac_type;
opt = (struct e1000_option) {
.type = range_option,
.name = "Receive Descriptors",
.err = "using default of "
__MODULE_STRING(E1000_DEFAULT_RXD),
.def = E1000_DEFAULT_RXD,
.arg = { .r = {
.min = E1000_MIN_RXD,
.max = mac_type < e1000_82544 ? E1000_MAX_RXD :
E1000_MAX_82544_RXD
}}
};
if (num_RxDescriptors > bd) {
rx_ring->count = RxDescriptors[bd];
e1000_validate_option(&rx_ring->count, &opt, adapter);
rx_ring->count = ALIGN(rx_ring->count,
REQ_RX_DESCRIPTOR_MULTIPLE);
} else {
rx_ring->count = opt.def;
}
for (i = 0; i < adapter->num_rx_queues; i++)
rx_ring[i].count = rx_ring->count;
}
{ /* Checksum Offload Enable/Disable */
opt = (struct e1000_option) {
.type = enable_option,
.name = "Checksum Offload",
.err = "defaulting to Enabled",
.def = OPTION_ENABLED
};
if (num_XsumRX > bd) {
unsigned int rx_csum = XsumRX[bd];
e1000_validate_option(&rx_csum, &opt, adapter);
adapter->rx_csum = rx_csum;
} else {
adapter->rx_csum = opt.def;
}
}
{ /* Flow Control */
static const struct e1000_opt_list fc_list[] = {
{ E1000_FC_NONE, "Flow Control Disabled" },
{ E1000_FC_RX_PAUSE, "Flow Control Receive Only" },
{ E1000_FC_TX_PAUSE, "Flow Control Transmit Only" },
{ E1000_FC_FULL, "Flow Control Enabled" },
{ E1000_FC_DEFAULT, "Flow Control Hardware Default" }
};
opt = (struct e1000_option) {
.type = list_option,
.name = "Flow Control",
.err = "reading default settings from EEPROM",
.def = E1000_FC_DEFAULT,
.arg = { .l = { .nr = ARRAY_SIZE(fc_list),
.p = fc_list }}
};
if (num_FlowControl > bd) {
unsigned int fc = FlowControl[bd];
e1000_validate_option(&fc, &opt, adapter);
adapter->hw.fc = adapter->hw.original_fc = fc;
} else {
adapter->hw.fc = adapter->hw.original_fc = opt.def;
}
}
{ /* Transmit Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Transmit Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_TIDV),
.def = DEFAULT_TIDV,
.arg = { .r = { .min = MIN_TXDELAY,
.max = MAX_TXDELAY }}
};
if (num_TxIntDelay > bd) {
adapter->tx_int_delay = TxIntDelay[bd];
e1000_validate_option(&adapter->tx_int_delay, &opt,
adapter);
} else {
adapter->tx_int_delay = opt.def;
}
}
{ /* Transmit Absolute Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Transmit Absolute Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_TADV),
.def = DEFAULT_TADV,
.arg = { .r = { .min = MIN_TXABSDELAY,
.max = MAX_TXABSDELAY }}
};
if (num_TxAbsIntDelay > bd) {
adapter->tx_abs_int_delay = TxAbsIntDelay[bd];
e1000_validate_option(&adapter->tx_abs_int_delay, &opt,
adapter);
} else {
adapter->tx_abs_int_delay = opt.def;
}
}
{ /* Receive Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Receive Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_RDTR),
.def = DEFAULT_RDTR,
.arg = { .r = { .min = MIN_RXDELAY,
.max = MAX_RXDELAY }}
};
if (num_RxIntDelay > bd) {
adapter->rx_int_delay = RxIntDelay[bd];
e1000_validate_option(&adapter->rx_int_delay, &opt,
adapter);
} else {
adapter->rx_int_delay = opt.def;
}
}
{ /* Receive Absolute Interrupt Delay */
opt = (struct e1000_option) {
.type = range_option,
.name = "Receive Absolute Interrupt Delay",
.err = "using default of " __MODULE_STRING(DEFAULT_RADV),
.def = DEFAULT_RADV,
.arg = { .r = { .min = MIN_RXABSDELAY,
.max = MAX_RXABSDELAY }}
};
if (num_RxAbsIntDelay > bd) {
adapter->rx_abs_int_delay = RxAbsIntDelay[bd];
e1000_validate_option(&adapter->rx_abs_int_delay, &opt,
adapter);
} else {
adapter->rx_abs_int_delay = opt.def;
}
}
{ /* Interrupt Throttling Rate */
opt = (struct e1000_option) {
.type = range_option,
.name = "Interrupt Throttling Rate (ints/sec)",
.err = "using default of " __MODULE_STRING(DEFAULT_ITR),
.def = DEFAULT_ITR,
.arg = { .r = { .min = MIN_ITR,
.max = MAX_ITR }}
};
if (num_InterruptThrottleRate > bd) {
adapter->itr = InterruptThrottleRate[bd];
switch (adapter->itr) {
case 0:
e_dev_info("%s turned off\n", opt.name);
break;
case 1:
e_dev_info("%s set to dynamic mode\n",
opt.name);
adapter->itr_setting = adapter->itr;
adapter->itr = 20000;
break;
case 3:
e_dev_info("%s set to dynamic conservative "
"mode\n", opt.name);
adapter->itr_setting = adapter->itr;
adapter->itr = 20000;
break;
case 4:
e_dev_info("%s set to simplified "
"(2000-8000) ints mode\n", opt.name);
adapter->itr_setting = adapter->itr;
break;
default:
e1000_validate_option(&adapter->itr, &opt,
adapter);
/* save the setting, because the dynamic bits
* change itr.
* clear the lower two bits because they are
* used as control
*/
adapter->itr_setting = adapter->itr & ~3;
break;
}
} else {
adapter->itr_setting = opt.def;
adapter->itr = 20000;
}
}
{ /* Smart Power Down */
opt = (struct e1000_option) {
.type = enable_option,
.name = "PHY Smart Power Down",
.err = "defaulting to Disabled",
.def = OPTION_DISABLED
};
if (num_SmartPowerDownEnable > bd) {
unsigned int spd = SmartPowerDownEnable[bd];
e1000_validate_option(&spd, &opt, adapter);
adapter->smart_power_down = spd;
} else {
adapter->smart_power_down = opt.def;
}
}
switch (adapter->hw.media_type) {
case e1000_media_type_fiber:
case e1000_media_type_internal_serdes:
e1000_check_fiber_options(adapter);
break;
case e1000_media_type_copper:
e1000_check_copper_options(adapter);
break;
default:
BUG();
}
}
/**
* e1000_check_fiber_options - Range Checking for Link Options, Fiber Version
* @adapter: board private structure
*
* Handles speed and duplex options on fiber adapters
**/
static void e1000_check_fiber_options(struct e1000_adapter *adapter)
{
int bd = adapter->bd_number;
if (num_Speed > bd) {
e_dev_info("Speed not valid for fiber adapters, parameter "
"ignored\n");
}
if (num_Duplex > bd) {
e_dev_info("Duplex not valid for fiber adapters, parameter "
"ignored\n");
}
if ((num_AutoNeg > bd) && (AutoNeg[bd] != 0x20)) {
e_dev_info("AutoNeg other than 1000/Full is not valid for fiber"
"adapters, parameter ignored\n");
}
}
/**
* e1000_check_copper_options - Range Checking for Link Options, Copper Version
* @adapter: board private structure
*
* Handles speed and duplex options on copper adapters
**/
static void e1000_check_copper_options(struct e1000_adapter *adapter)
{
struct e1000_option opt;
unsigned int speed, dplx, an;
int bd = adapter->bd_number;
{ /* Speed */
static const struct e1000_opt_list speed_list[] = {
{ 0, "" },
{ SPEED_10, "" },
{ SPEED_100, "" },
{ SPEED_1000, "" }};
opt = (struct e1000_option) {
.type = list_option,
.name = "Speed",
.err = "parameter ignored",
.def = 0,
.arg = { .l = { .nr = ARRAY_SIZE(speed_list),
.p = speed_list }}
};
if (num_Speed > bd) {
speed = Speed[bd];
e1000_validate_option(&speed, &opt, adapter);
} else {
speed = opt.def;
}
}
{ /* Duplex */
static const struct e1000_opt_list dplx_list[] = {
{ 0, "" },
{ HALF_DUPLEX, "" },
{ FULL_DUPLEX, "" }};
opt = (struct e1000_option) {
.type = list_option,
.name = "Duplex",
.err = "parameter ignored",
.def = 0,
.arg = { .l = { .nr = ARRAY_SIZE(dplx_list),
.p = dplx_list }}
};
if (num_Duplex > bd) {
dplx = Duplex[bd];
e1000_validate_option(&dplx, &opt, adapter);
} else {
dplx = opt.def;
}
}
if ((num_AutoNeg > bd) && (speed != 0 || dplx != 0)) {
e_dev_info("AutoNeg specified along with Speed or Duplex, "
"parameter ignored\n");
adapter->hw.autoneg_advertised = AUTONEG_ADV_DEFAULT;
} else { /* Autoneg */
static const struct e1000_opt_list an_list[] =
#define AA "AutoNeg advertising "
{{ 0x01, AA "10/HD" },
{ 0x02, AA "10/FD" },
{ 0x03, AA "10/FD, 10/HD" },
{ 0x04, AA "100/HD" },
{ 0x05, AA "100/HD, 10/HD" },
{ 0x06, AA "100/HD, 10/FD" },
{ 0x07, AA "100/HD, 10/FD, 10/HD" },
{ 0x08, AA "100/FD" },
{ 0x09, AA "100/FD, 10/HD" },
{ 0x0a, AA "100/FD, 10/FD" },
{ 0x0b, AA "100/FD, 10/FD, 10/HD" },
{ 0x0c, AA "100/FD, 100/HD" },
{ 0x0d, AA "100/FD, 100/HD, 10/HD" },
{ 0x0e, AA "100/FD, 100/HD, 10/FD" },
{ 0x0f, AA "100/FD, 100/HD, 10/FD, 10/HD" },
{ 0x20, AA "1000/FD" },
{ 0x21, AA "1000/FD, 10/HD" },
{ 0x22, AA "1000/FD, 10/FD" },
{ 0x23, AA "1000/FD, 10/FD, 10/HD" },
{ 0x24, AA "1000/FD, 100/HD" },
{ 0x25, AA "1000/FD, 100/HD, 10/HD" },
{ 0x26, AA "1000/FD, 100/HD, 10/FD" },
{ 0x27, AA "1000/FD, 100/HD, 10/FD, 10/HD" },
{ 0x28, AA "1000/FD, 100/FD" },
{ 0x29, AA "1000/FD, 100/FD, 10/HD" },
{ 0x2a, AA "1000/FD, 100/FD, 10/FD" },
{ 0x2b, AA "1000/FD, 100/FD, 10/FD, 10/HD" },
{ 0x2c, AA "1000/FD, 100/FD, 100/HD" },
{ 0x2d, AA "1000/FD, 100/FD, 100/HD, 10/HD" },
{ 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" },
{ 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }};
opt = (struct e1000_option) {
.type = list_option,
.name = "AutoNeg",
.err = "parameter ignored",
.def = AUTONEG_ADV_DEFAULT,
.arg = { .l = { .nr = ARRAY_SIZE(an_list),
.p = an_list }}
};
if (num_AutoNeg > bd) {
an = AutoNeg[bd];
e1000_validate_option(&an, &opt, adapter);
} else {
an = opt.def;
}
adapter->hw.autoneg_advertised = an;
}
switch (speed + dplx) {
case 0:
adapter->hw.autoneg = adapter->fc_autoneg = 1;
if ((num_Speed > bd) && (speed != 0 || dplx != 0))
e_dev_info("Speed and duplex autonegotiation "
"enabled\n");
break;
case HALF_DUPLEX:
e_dev_info("Half Duplex specified without Speed\n");
e_dev_info("Using Autonegotiation at Half Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
ADVERTISE_100_HALF;
break;
case FULL_DUPLEX:
e_dev_info("Full Duplex specified without Speed\n");
e_dev_info("Using Autonegotiation at Full Duplex only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_FULL |
ADVERTISE_100_FULL |
ADVERTISE_1000_FULL;
break;
case SPEED_10:
e_dev_info("10 Mbps Speed specified without Duplex\n");
e_dev_info("Using Autonegotiation at 10 Mbps only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_10_HALF |
ADVERTISE_10_FULL;
break;
case SPEED_10 + HALF_DUPLEX:
e_dev_info("Forcing to 10 Mbps Half Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_10_half;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_10 + FULL_DUPLEX:
e_dev_info("Forcing to 10 Mbps Full Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_10_full;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_100:
e_dev_info("100 Mbps Speed specified without Duplex\n");
e_dev_info("Using Autonegotiation at 100 Mbps only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_100_HALF |
ADVERTISE_100_FULL;
break;
case SPEED_100 + HALF_DUPLEX:
e_dev_info("Forcing to 100 Mbps Half Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_100_half;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_100 + FULL_DUPLEX:
e_dev_info("Forcing to 100 Mbps Full Duplex\n");
adapter->hw.autoneg = adapter->fc_autoneg = 0;
adapter->hw.forced_speed_duplex = e1000_100_full;
adapter->hw.autoneg_advertised = 0;
break;
case SPEED_1000:
e_dev_info("1000 Mbps Speed specified without Duplex\n");
goto full_duplex_only;
case SPEED_1000 + HALF_DUPLEX:
e_dev_info("Half Duplex is not supported at 1000 Mbps\n");
fallthrough;
case SPEED_1000 + FULL_DUPLEX:
full_duplex_only:
e_dev_info("Using Autonegotiation at 1000 Mbps Full Duplex "
"only\n");
adapter->hw.autoneg = adapter->fc_autoneg = 1;
adapter->hw.autoneg_advertised = ADVERTISE_1000_FULL;
break;
default:
BUG();
}
/* Speed, AutoNeg and MDI/MDI-X must all play nice */
if (e1000_validate_mdi_setting(&(adapter->hw)) < 0) {
e_dev_info("Speed, AutoNeg and MDI-X specs are incompatible. "
"Setting MDI-X to a compatible value.\n");
}
}

View File

@ -26,4 +26,5 @@ for f in $KERNELDIR/drivers/net/ethernet/intel/e1000/*.[ch]; do
git add $o $e
echo -e "\t$e \\\\\n\t$o \\\\" >> Makefile.am
done
echo "Remember to update Makefile.am!"

View File

@ -22,12 +22,6 @@
include $(top_srcdir)/Makefile.kbuild
EXTRA_DIST = \
80003es2lan-3.4-ethercat.c \
80003es2lan-3.4-orig.c \
80003es2lan-3.6-ethercat.c \
80003es2lan-3.6-orig.c \
80003es2lan-3.8-ethercat.c \
80003es2lan-3.8-orig.c \
80003es2lan-3.10-ethercat.c \
80003es2lan-3.10-ethercat.h \
80003es2lan-3.10-orig.c \
@ -44,14 +38,16 @@ EXTRA_DIST = \
80003es2lan-3.16-ethercat.h \
80003es2lan-3.16-orig.c \
80003es2lan-3.16-orig.h \
80003es2lan-3.4-ethercat.c \
80003es2lan-3.4-orig.c \
80003es2lan-3.6-ethercat.c \
80003es2lan-3.6-orig.c \
80003es2lan-3.8-ethercat.c \
80003es2lan-3.8-orig.c \
80003es2lan-4.4-ethercat.c \
80003es2lan-4.4-ethercat.h \
80003es2lan-4.4-orig.c \
80003es2lan-4.4-orig.h \
80003es2lan-5.4-ethercat.c \
80003es2lan-5.4-ethercat.h \
80003es2lan-5.4-orig.c \
80003es2lan-5.4-orig.h \
80003es2lan-5.10-ethercat.c \
80003es2lan-5.10-ethercat.h \
80003es2lan-5.10-orig.c \
@ -64,26 +60,22 @@ EXTRA_DIST = \
80003es2lan-5.15-ethercat.h \
80003es2lan-5.15-orig.c \
80003es2lan-5.15-orig.h \
80003es2lan-5.4-ethercat.c \
80003es2lan-5.4-ethercat.h \
80003es2lan-5.4-orig.c \
80003es2lan-5.4-orig.h \
80003es2lan-6.1-ethercat.c \
80003es2lan-6.1-ethercat.h \
80003es2lan-6.1-orig.c \
80003es2lan-6.1-orig.h \
80003es2lan-6.4-ethercat.c \
80003es2lan-6.4-ethercat.h \
80003es2lan-6.4-orig.c \
80003es2lan-6.4-orig.h \
80003es2lan-6.12-ethercat.c \
80003es2lan-6.12-ethercat.h \
80003es2lan-6.12-orig.c \
80003es2lan-6.12-orig.h \
82571-3.2-ethercat.c \
82571-3.2-orig.c \
82571-3.4-ethercat.c \
82571-3.4-orig.c \
82571-3.6-ethercat.c \
82571-3.6-orig.c \
82571-3.8-ethercat.c \
82571-3.8-orig.c \
80003es2lan-6.4-ethercat.c \
80003es2lan-6.4-ethercat.h \
80003es2lan-6.4-orig.c \
80003es2lan-6.4-orig.h \
82571-3.10-ethercat.c \
82571-3.10-ethercat.h \
82571-3.10-orig.c \
@ -100,14 +92,18 @@ EXTRA_DIST = \
82571-3.16-ethercat.h \
82571-3.16-orig.c \
82571-3.16-orig.h \
82571-3.2-ethercat.c \
82571-3.2-orig.c \
82571-3.4-ethercat.c \
82571-3.4-orig.c \
82571-3.6-ethercat.c \
82571-3.6-orig.c \
82571-3.8-ethercat.c \
82571-3.8-orig.c \
82571-4.4-ethercat.c \
82571-4.4-ethercat.h \
82571-4.4-orig.c \
82571-4.4-orig.h \
82571-5.4-ethercat.c \
82571-5.4-ethercat.h \
82571-5.4-orig.c \
82571-5.4-orig.h \
82571-5.10-ethercat.c \
82571-5.10-ethercat.h \
82571-5.10-orig.c \
@ -120,26 +116,22 @@ EXTRA_DIST = \
82571-5.15-ethercat.h \
82571-5.15-orig.c \
82571-5.15-orig.h \
82571-5.4-ethercat.c \
82571-5.4-ethercat.h \
82571-5.4-orig.c \
82571-5.4-orig.h \
82571-6.1-ethercat.c \
82571-6.1-ethercat.h \
82571-6.1-orig.c \
82571-6.1-orig.h \
82571-6.4-ethercat.c \
82571-6.4-ethercat.h \
82571-6.4-orig.c \
82571-6.4-orig.h \
82571-6.12-ethercat.c \
82571-6.12-ethercat.h \
82571-6.12-orig.c \
82571-6.12-orig.h \
defines-3.2-ethercat.h \
defines-3.2-orig.h \
defines-3.4-ethercat.h \
defines-3.4-orig.h \
defines-3.6-ethercat.h \
defines-3.6-orig.h \
defines-3.8-ethercat.h \
defines-3.8-orig.h \
82571-6.4-ethercat.c \
82571-6.4-ethercat.h \
82571-6.4-orig.c \
82571-6.4-orig.h \
defines-3.10-ethercat.h \
defines-3.10-orig.h \
defines-3.12-ethercat.h \
@ -148,34 +140,30 @@ EXTRA_DIST = \
defines-3.14-orig.h \
defines-3.16-ethercat.h \
defines-3.16-orig.h \
defines-3.2-ethercat.h \
defines-3.2-orig.h \
defines-3.4-ethercat.h \
defines-3.4-orig.h \
defines-3.6-ethercat.h \
defines-3.6-orig.h \
defines-3.8-ethercat.h \
defines-3.8-orig.h \
defines-4.4-ethercat.h \
defines-4.4-orig.h \
defines-5.4-ethercat.h \
defines-5.4-orig.h \
defines-5.10-ethercat.h \
defines-5.10-orig.h \
defines-5.14-ethercat.h \
defines-5.14-orig.h \
defines-5.15-ethercat.h \
defines-5.15-orig.h \
defines-5.4-ethercat.h \
defines-5.4-orig.h \
defines-6.1-ethercat.h \
defines-6.1-orig.h \
defines-6.4-ethercat.h \
defines-6.4-orig.h \
defines-6.12-ethercat.h \
defines-6.12-orig.h \
e1000e_trace-6.4-ethercat.h \
e1000e_trace-6.4-orig.h \
e1000e_trace-6.12-ethercat.h \
e1000e_trace-6.12-orig.h \
e1000-3.2-ethercat.h \
e1000-3.2-orig.h \
e1000-3.4-ethercat.h \
e1000-3.4-orig.h \
e1000-3.6-ethercat.h \
e1000-3.6-orig.h \
e1000-3.8-ethercat.h \
e1000-3.8-orig.h \
defines-6.4-ethercat.h \
defines-6.4-orig.h \
e1000-3.10-ethercat.h \
e1000-3.10-orig.h \
e1000-3.12-ethercat.h \
@ -184,32 +172,36 @@ EXTRA_DIST = \
e1000-3.14-orig.h \
e1000-3.16-ethercat.h \
e1000-3.16-orig.h \
e1000-3.2-ethercat.h \
e1000-3.2-orig.h \
e1000-3.4-ethercat.h \
e1000-3.4-orig.h \
e1000-3.6-ethercat.h \
e1000-3.6-orig.h \
e1000-3.8-ethercat.h \
e1000-3.8-orig.h \
e1000-4.4-ethercat.h \
e1000-4.4-orig.h \
e1000-5.4-ethercat.h \
e1000-5.4-orig.h \
e1000-5.10-ethercat.h \
e1000-5.10-orig.h \
e1000-5.14-ethercat.h \
e1000-5.14-orig.h \
e1000-5.15-ethercat.h \
e1000-5.15-orig.h \
e1000-5.4-ethercat.h \
e1000-5.4-orig.h \
e1000-6.1-ethercat.h \
e1000-6.1-orig.h \
e1000-6.4-ethercat.h \
e1000-6.4-orig.h \
e1000-6.12-ethercat.h \
e1000-6.12-orig.h \
e1000-6.4-ethercat.h \
e1000-6.4-orig.h \
e1000e_trace-6.12-ethercat.h \
e1000e_trace-6.12-orig.h \
e1000e_trace-6.4-ethercat.h \
e1000e_trace-6.4-orig.h \
es2lan-3.2-ethercat.c \
es2lan-3.2-orig.c \
ethtool-3.2-ethercat.c \
ethtool-3.2-orig.c \
ethtool-3.4-ethercat.c \
ethtool-3.4-orig.c \
ethtool-3.6-ethercat.c \
ethtool-3.6-orig.c \
ethtool-3.8-ethercat.c \
ethtool-3.8-orig.c \
ethtool-3.10-ethercat.c \
ethtool-3.10-orig.c \
ethtool-3.12-ethercat.c \
@ -218,30 +210,30 @@ EXTRA_DIST = \
ethtool-3.14-orig.c \
ethtool-3.16-ethercat.c \
ethtool-3.16-orig.c \
ethtool-3.2-ethercat.c \
ethtool-3.2-orig.c \
ethtool-3.4-ethercat.c \
ethtool-3.4-orig.c \
ethtool-3.6-ethercat.c \
ethtool-3.6-orig.c \
ethtool-3.8-ethercat.c \
ethtool-3.8-orig.c \
ethtool-4.4-ethercat.c \
ethtool-4.4-orig.c \
ethtool-5.4-ethercat.c \
ethtool-5.4-orig.c \
ethtool-5.10-ethercat.c \
ethtool-5.10-orig.c \
ethtool-5.14-ethercat.c \
ethtool-5.14-orig.c \
ethtool-5.15-ethercat.c \
ethtool-5.15-orig.c \
ethtool-5.4-ethercat.c \
ethtool-5.4-orig.c \
ethtool-6.1-ethercat.c \
ethtool-6.1-orig.c \
ethtool-6.4-ethercat.c \
ethtool-6.4-orig.c \
ethtool-6.12-ethercat.c \
ethtool-6.12-orig.c \
hw-3.2-ethercat.h \
hw-3.2-orig.h \
hw-3.4-ethercat.h \
hw-3.4-orig.h \
hw-3.6-ethercat.h \
hw-3.6-orig.h \
hw-3.8-ethercat.h \
hw-3.8-orig.h \
ethtool-6.4-ethercat.c \
ethtool-6.4-orig.c \
hw-3.10-ethercat.h \
hw-3.10-orig.h \
hw-3.12-ethercat.h \
@ -250,30 +242,30 @@ EXTRA_DIST = \
hw-3.14-orig.h \
hw-3.16-ethercat.h \
hw-3.16-orig.h \
hw-3.2-ethercat.h \
hw-3.2-orig.h \
hw-3.4-ethercat.h \
hw-3.4-orig.h \
hw-3.6-ethercat.h \
hw-3.6-orig.h \
hw-3.8-ethercat.h \
hw-3.8-orig.h \
hw-4.4-ethercat.h \
hw-4.4-orig.h \
hw-5.4-ethercat.h \
hw-5.4-orig.h \
hw-5.10-ethercat.h \
hw-5.10-orig.h \
hw-5.14-ethercat.h \
hw-5.14-orig.h \
hw-5.15-ethercat.h \
hw-5.15-orig.h \
hw-5.4-ethercat.h \
hw-5.4-orig.h \
hw-6.1-ethercat.h \
hw-6.1-orig.h \
hw-6.4-ethercat.h \
hw-6.4-orig.h \
hw-6.12-ethercat.h \
hw-6.12-orig.h \
ich8lan-3.2-ethercat.c \
ich8lan-3.2-orig.c \
ich8lan-3.4-ethercat.c \
ich8lan-3.4-orig.c \
ich8lan-3.6-ethercat.c \
ich8lan-3.6-orig.c \
ich8lan-3.8-ethercat.c \
ich8lan-3.8-orig.c \
hw-6.4-ethercat.h \
hw-6.4-orig.h \
ich8lan-3.10-ethercat.c \
ich8lan-3.10-ethercat.h \
ich8lan-3.10-orig.c \
@ -290,14 +282,18 @@ EXTRA_DIST = \
ich8lan-3.16-ethercat.h \
ich8lan-3.16-orig.c \
ich8lan-3.16-orig.h \
ich8lan-3.2-ethercat.c \
ich8lan-3.2-orig.c \
ich8lan-3.4-ethercat.c \
ich8lan-3.4-orig.c \
ich8lan-3.6-ethercat.c \
ich8lan-3.6-orig.c \
ich8lan-3.8-ethercat.c \
ich8lan-3.8-orig.c \
ich8lan-4.4-ethercat.c \
ich8lan-4.4-ethercat.h \
ich8lan-4.4-orig.c \
ich8lan-4.4-orig.h \
ich8lan-5.4-ethercat.c \
ich8lan-5.4-ethercat.h \
ich8lan-5.4-orig.c \
ich8lan-5.4-orig.h \
ich8lan-5.10-ethercat.c \
ich8lan-5.10-ethercat.h \
ich8lan-5.10-orig.c \
@ -310,26 +306,24 @@ EXTRA_DIST = \
ich8lan-5.15-ethercat.h \
ich8lan-5.15-orig.c \
ich8lan-5.15-orig.h \
ich8lan-5.4-ethercat.c \
ich8lan-5.4-ethercat.h \
ich8lan-5.4-orig.c \
ich8lan-5.4-orig.h \
ich8lan-6.1-ethercat.c \
ich8lan-6.1-ethercat.h \
ich8lan-6.1-orig.c \
ich8lan-6.1-orig.h \
ich8lan-6.4-ethercat.c \
ich8lan-6.4-ethercat.h \
ich8lan-6.4-orig.c \
ich8lan-6.4-orig.h \
ich8lan-6.12-ethercat.c \
ich8lan-6.12-ethercat.h \
ich8lan-6.12-orig.c \
ich8lan-6.12-orig.h \
ich8lan-6.4-ethercat.c \
ich8lan-6.4-ethercat.h \
ich8lan-6.4-orig.c \
ich8lan-6.4-orig.h \
lib-3.2-ethercat.c \
lib-3.2-orig.c \
mac-3.4-ethercat.c \
mac-3.4-orig.c \
mac-3.6-ethercat.c \
mac-3.6-orig.c \
mac-3.8-ethercat.c \
mac-3.8-orig.c \
mac-3.10-ethercat.c \
mac-3.10-ethercat.h \
mac-3.10-orig.c \
@ -346,14 +340,16 @@ EXTRA_DIST = \
mac-3.16-ethercat.h \
mac-3.16-orig.c \
mac-3.16-orig.h \
mac-3.4-ethercat.c \
mac-3.4-orig.c \
mac-3.6-ethercat.c \
mac-3.6-orig.c \
mac-3.8-ethercat.c \
mac-3.8-orig.c \
mac-4.4-ethercat.c \
mac-4.4-ethercat.h \
mac-4.4-orig.c \
mac-4.4-orig.h \
mac-5.4-ethercat.c \
mac-5.4-ethercat.h \
mac-5.4-orig.c \
mac-5.4-orig.h \
mac-5.10-ethercat.c \
mac-5.10-ethercat.h \
mac-5.10-orig.c \
@ -366,24 +362,22 @@ EXTRA_DIST = \
mac-5.15-ethercat.h \
mac-5.15-orig.c \
mac-5.15-orig.h \
mac-5.4-ethercat.c \
mac-5.4-ethercat.h \
mac-5.4-orig.c \
mac-5.4-orig.h \
mac-6.1-ethercat.c \
mac-6.1-ethercat.h \
mac-6.1-orig.c \
mac-6.1-orig.h \
mac-6.4-ethercat.c \
mac-6.4-ethercat.h \
mac-6.4-orig.c \
mac-6.4-orig.h \
mac-6.12-ethercat.c \
mac-6.12-ethercat.h \
mac-6.12-orig.c \
mac-6.12-orig.h \
manage-3.4-ethercat.c \
manage-3.4-orig.c \
manage-3.6-ethercat.c \
manage-3.6-orig.c \
manage-3.8-ethercat.c \
manage-3.8-orig.c \
mac-6.4-ethercat.c \
mac-6.4-ethercat.h \
mac-6.4-orig.c \
mac-6.4-orig.h \
manage-3.10-ethercat.c \
manage-3.10-ethercat.h \
manage-3.10-orig.c \
@ -400,14 +394,16 @@ EXTRA_DIST = \
manage-3.16-ethercat.h \
manage-3.16-orig.c \
manage-3.16-orig.h \
manage-3.4-ethercat.c \
manage-3.4-orig.c \
manage-3.6-ethercat.c \
manage-3.6-orig.c \
manage-3.8-ethercat.c \
manage-3.8-orig.c \
manage-4.4-ethercat.c \
manage-4.4-ethercat.h \
manage-4.4-orig.c \
manage-4.4-orig.h \
manage-5.4-ethercat.c \
manage-5.4-ethercat.h \
manage-5.4-orig.c \
manage-5.4-orig.h \
manage-5.10-ethercat.c \
manage-5.10-ethercat.h \
manage-5.10-orig.c \
@ -420,26 +416,22 @@ EXTRA_DIST = \
manage-5.15-ethercat.h \
manage-5.15-orig.c \
manage-5.15-orig.h \
manage-5.4-ethercat.c \
manage-5.4-ethercat.h \
manage-5.4-orig.c \
manage-5.4-orig.h \
manage-6.1-ethercat.c \
manage-6.1-ethercat.h \
manage-6.1-orig.c \
manage-6.1-orig.h \
manage-6.4-ethercat.c \
manage-6.4-ethercat.h \
manage-6.4-orig.c \
manage-6.4-orig.h \
manage-6.12-ethercat.c \
manage-6.12-ethercat.h \
manage-6.12-orig.c \
manage-6.12-orig.h \
netdev-3.2-ethercat.c \
netdev-3.2-orig.c \
netdev-3.4-ethercat.c \
netdev-3.4-orig.c \
netdev-3.6-ethercat.c \
netdev-3.6-orig.c \
netdev-3.8-ethercat.c \
netdev-3.8-orig.c \
manage-6.4-ethercat.c \
manage-6.4-ethercat.h \
manage-6.4-orig.c \
manage-6.4-orig.h \
netdev-3.10-ethercat.c \
netdev-3.10-orig.c \
netdev-3.12-ethercat.c \
@ -448,28 +440,30 @@ EXTRA_DIST = \
netdev-3.14-orig.c \
netdev-3.16-ethercat.c \
netdev-3.16-orig.c \
netdev-3.2-ethercat.c \
netdev-3.2-orig.c \
netdev-3.4-ethercat.c \
netdev-3.4-orig.c \
netdev-3.6-ethercat.c \
netdev-3.6-orig.c \
netdev-3.8-ethercat.c \
netdev-3.8-orig.c \
netdev-4.4-ethercat.c \
netdev-4.4-orig.c \
netdev-5.4-ethercat.c \
netdev-5.4-orig.c \
netdev-5.10-ethercat.c \
netdev-5.10-orig.c \
netdev-5.14-ethercat.c \
netdev-5.14-orig.c \
netdev-5.15-ethercat.c \
netdev-5.15-orig.c \
netdev-5.4-ethercat.c \
netdev-5.4-orig.c \
netdev-6.1-ethercat.c \
netdev-6.1-orig.c \
netdev-6.4-ethercat.c \
netdev-6.4-orig.c \
netdev-6.12-ethercat.c \
netdev-6.12-orig.c \
nvm-3.4-ethercat.c \
nvm-3.4-orig.c \
nvm-3.6-ethercat.c \
nvm-3.6-orig.c \
nvm-3.8-ethercat.c \
nvm-3.8-orig.c \
netdev-6.4-ethercat.c \
netdev-6.4-orig.c \
nvm-3.10-ethercat.c \
nvm-3.10-ethercat.h \
nvm-3.10-orig.c \
@ -486,14 +480,16 @@ EXTRA_DIST = \
nvm-3.16-ethercat.h \
nvm-3.16-orig.c \
nvm-3.16-orig.h \
nvm-3.4-ethercat.c \
nvm-3.4-orig.c \
nvm-3.6-ethercat.c \
nvm-3.6-orig.c \
nvm-3.8-ethercat.c \
nvm-3.8-orig.c \
nvm-4.4-ethercat.c \
nvm-4.4-ethercat.h \
nvm-4.4-orig.c \
nvm-4.4-orig.h \
nvm-5.4-ethercat.c \
nvm-5.4-ethercat.h \
nvm-5.4-orig.c \
nvm-5.4-orig.h \
nvm-5.10-ethercat.c \
nvm-5.10-ethercat.h \
nvm-5.10-orig.c \
@ -506,26 +502,22 @@ EXTRA_DIST = \
nvm-5.15-ethercat.h \
nvm-5.15-orig.c \
nvm-5.15-orig.h \
nvm-5.4-ethercat.c \
nvm-5.4-ethercat.h \
nvm-5.4-orig.c \
nvm-5.4-orig.h \
nvm-6.1-ethercat.c \
nvm-6.1-ethercat.h \
nvm-6.1-orig.c \
nvm-6.1-orig.h \
nvm-6.4-ethercat.c \
nvm-6.4-ethercat.h \
nvm-6.4-orig.c \
nvm-6.4-orig.h \
nvm-6.12-ethercat.c \
nvm-6.12-ethercat.h \
nvm-6.12-orig.c \
nvm-6.12-orig.h \
param-3.2-ethercat.c \
param-3.2-orig.c \
param-3.4-ethercat.c \
param-3.4-orig.c \
param-3.6-ethercat.c \
param-3.6-orig.c \
param-3.8-ethercat.c \
param-3.8-orig.c \
nvm-6.4-ethercat.c \
nvm-6.4-ethercat.h \
nvm-6.4-orig.c \
nvm-6.4-orig.h \
param-3.10-ethercat.c \
param-3.10-orig.c \
param-3.12-ethercat.c \
@ -534,30 +526,30 @@ EXTRA_DIST = \
param-3.14-orig.c \
param-3.16-ethercat.c \
param-3.16-orig.c \
param-3.2-ethercat.c \
param-3.2-orig.c \
param-3.4-ethercat.c \
param-3.4-orig.c \
param-3.6-ethercat.c \
param-3.6-orig.c \
param-3.8-ethercat.c \
param-3.8-orig.c \
param-4.4-ethercat.c \
param-4.4-orig.c \
param-5.4-ethercat.c \
param-5.4-orig.c \
param-5.10-ethercat.c \
param-5.10-orig.c \
param-5.14-ethercat.c \
param-5.14-orig.c \
param-5.15-ethercat.c \
param-5.15-orig.c \
param-5.4-ethercat.c \
param-5.4-orig.c \
param-6.1-ethercat.c \
param-6.1-orig.c \
param-6.4-ethercat.c \
param-6.4-orig.c \
param-6.12-ethercat.c \
param-6.12-orig.c \
phy-3.2-ethercat.c \
phy-3.2-orig.c \
phy-3.4-ethercat.c \
phy-3.4-orig.c \
phy-3.6-ethercat.c \
phy-3.6-orig.c \
phy-3.8-ethercat.c \
phy-3.8-orig.c \
param-6.4-ethercat.c \
param-6.4-orig.c \
phy-3.10-ethercat.c \
phy-3.10-ethercat.h \
phy-3.10-orig.c \
@ -574,14 +566,18 @@ EXTRA_DIST = \
phy-3.16-ethercat.h \
phy-3.16-orig.c \
phy-3.16-orig.h \
phy-3.2-ethercat.c \
phy-3.2-orig.c \
phy-3.4-ethercat.c \
phy-3.4-orig.c \
phy-3.6-ethercat.c \
phy-3.6-orig.c \
phy-3.8-ethercat.c \
phy-3.8-orig.c \
phy-4.4-ethercat.c \
phy-4.4-ethercat.h \
phy-4.4-orig.c \
phy-4.4-orig.h \
phy-5.4-ethercat.c \
phy-5.4-ethercat.h \
phy-5.4-orig.c \
phy-5.4-orig.h \
phy-5.10-ethercat.c \
phy-5.10-ethercat.h \
phy-5.10-orig.c \
@ -594,18 +590,22 @@ EXTRA_DIST = \
phy-5.15-ethercat.h \
phy-5.15-orig.c \
phy-5.15-orig.h \
phy-5.4-ethercat.c \
phy-5.4-ethercat.h \
phy-5.4-orig.c \
phy-5.4-orig.h \
phy-6.1-ethercat.c \
phy-6.1-ethercat.h \
phy-6.1-orig.c \
phy-6.1-orig.h \
phy-6.4-ethercat.c \
phy-6.4-ethercat.h \
phy-6.4-orig.c \
phy-6.4-orig.h \
phy-6.12-ethercat.c \
phy-6.12-ethercat.h \
phy-6.12-orig.c \
phy-6.12-orig.h \
phy-6.4-ethercat.c \
phy-6.4-ethercat.h \
phy-6.4-orig.c \
phy-6.4-orig.h \
ptp-3.10-ethercat.c \
ptp-3.10-orig.c \
ptp-3.12-ethercat.c \
@ -616,20 +616,20 @@ EXTRA_DIST = \
ptp-3.16-orig.c \
ptp-4.4-ethercat.c \
ptp-4.4-orig.c \
ptp-5.4-ethercat.c \
ptp-5.4-orig.c \
ptp-5.10-ethercat.c \
ptp-5.10-orig.c \
ptp-5.14-ethercat.c \
ptp-5.14-orig.c \
ptp-5.15-ethercat.c \
ptp-5.15-orig.c \
ptp-5.4-ethercat.c \
ptp-5.4-orig.c \
ptp-6.1-ethercat.c \
ptp-6.1-orig.c \
ptp-6.4-ethercat.c \
ptp-6.4-orig.c \
ptp-6.12-ethercat.c \
ptp-6.12-orig.c \
ptp-6.4-ethercat.c \
ptp-6.4-orig.c \
regs-3.10-ethercat.h \
regs-3.10-orig.h \
regs-3.12-ethercat.h \
@ -640,20 +640,20 @@ EXTRA_DIST = \
regs-3.16-orig.h \
regs-4.4-ethercat.h \
regs-4.4-orig.h \
regs-5.4-ethercat.h \
regs-5.4-orig.h \
regs-5.10-ethercat.h \
regs-5.10-orig.h \
regs-5.14-ethercat.h \
regs-5.14-orig.h \
regs-5.15-ethercat.h \
regs-5.15-orig.h \
regs-5.4-ethercat.h \
regs-5.4-orig.h \
regs-6.1-ethercat.h \
regs-6.1-orig.h \
regs-6.4-ethercat.h \
regs-6.4-orig.h \
regs-6.12-ethercat.h \
regs-6.12-orig.h \
regs-6.4-ethercat.h \
regs-6.4-orig.h \
update.sh
#-----------------------------------------------------------------------------

View File

@ -34,41 +34,42 @@ EXTRA_DIST = \
bcmgenet-6.1-ethercat.h \
bcmgenet-6.1-orig.c \
bcmgenet-6.1-orig.h \
bcmgenet-6.4-ethercat.c \
bcmgenet-6.4-ethercat.h \
bcmgenet-6.4-orig.c \
bcmgenet-6.4-orig.h \
bcmgenet-6.12-ethercat.c \
bcmgenet-6.12-ethercat.h \
bcmgenet-6.12-orig.c \
bcmgenet-6.12-orig.h \
bcmgenet-6.4-ethercat.c \
bcmgenet-6.4-ethercat.h \
bcmgenet-6.4-orig.c \
bcmgenet-6.4-orig.h \
bcmgenet_wol-5.10-ethercat.c \
bcmgenet_wol-5.10-orig.c \
bcmgenet_wol-5.14-ethercat.c \
bcmgenet_wol-5.14-orig.c \
bcmgenet_wol-6.1-ethercat.c \
bcmgenet_wol-6.1-orig.c \
bcmgenet_wol-6.4-ethercat.c \
bcmgenet_wol-6.4-orig.c \
bcmgenet_wol-6.12-ethercat.c \
bcmgenet_wol-6.12-orig.c \
bcmmii-5.14-ethercat.c \
bcmmii-5.14-orig.c \
bcmgenet_wol-6.4-ethercat.c \
bcmgenet_wol-6.4-orig.c \
bcmmii-5.10-ethercat.c \
bcmmii-5.10-orig.c \
bcmmii-5.14-ethercat.c \
bcmmii-5.14-orig.c \
bcmmii-6.1-ethercat.c \
bcmmii-6.1-orig.c \
bcmmii-6.4-ethercat.c \
bcmmii-6.4-orig.c \
bcmmii-6.12-ethercat.c \
bcmmii-6.12-orig.c \
bcmmii-6.4-ethercat.c \
bcmmii-6.4-orig.c \
unimac-5.14-ethercat.h \
unimac-5.14-orig.h \
unimac-6.1-ethercat.h \
unimac-6.1-orig.h \
unimac-6.12-ethercat.h \
unimac-6.12-orig.h \
unimac-6.4-ethercat.h \
unimac-6.4-orig.h \
unimac-6.12-ethercat.h \
unimac-6.12-orig.h
update.sh
#------------------------------------------------------------------------------

View File

@ -28,25 +28,29 @@ EXTRA_DIST = \
igc-5.15-orig.h \
igc-6.1-ethercat.h \
igc-6.1-orig.h \
igc-6.12-ethercat.h \
igc-6.12-orig.h \
igc-6.4-ethercat.h \
igc-6.4-orig.h \
igc-6.6-ethercat.h \
igc-6.6-orig.h \
igc-6.12-ethercat.h \
igc-6.12-orig.h \
igc_base-5.14-ethercat.c \
igc_base-5.14-ethercat.h \
igc_base-5.14-orig.c \
igc_base-5.14-orig.h \
igc_base-5.15-ethercat.c \
igc_base-5.15-ethercat.h \
igc_base-5.15-orig.h \
igc_base-5.15-orig.c \
igc_base-5.15-orig.h \
igc_base-5.15-orig.h \
igc_base-6.1-ethercat.c \
igc_base-6.1-ethercat.h \
igc_base-6.1-orig.c \
igc_base-6.1-orig.h \
igc_base-6.12-ethercat.c \
igc_base-6.12-ethercat.h \
igc_base-6.12-orig.c \
igc_base-6.12-orig.h \
igc_base-6.4-ethercat.c \
igc_base-6.4-ethercat.h \
igc_base-6.4-orig.c \
@ -55,22 +59,18 @@ EXTRA_DIST = \
igc_base-6.6-ethercat.h \
igc_base-6.6-orig.c \
igc_base-6.6-orig.h \
igc_base-6.12-ethercat.c \
igc_base-6.12-ethercat.h \
igc_base-6.12-orig.c \
igc_base-6.12-orig.h \
igc_defines-5.14-ethercat.h \
igc_defines-5.14-orig.h \
igc_defines-5.15-ethercat.h \
igc_defines-5.15-orig.h \
igc_defines-6.1-ethercat.h \
igc_defines-6.1-orig.h \
igc_defines-6.12-ethercat.h \
igc_defines-6.12-orig.h \
igc_defines-6.4-ethercat.h \
igc_defines-6.4-orig.h \
igc_defines-6.6-ethercat.h \
igc_defines-6.6-orig.h \
igc_defines-6.12-ethercat.h \
igc_defines-6.12-orig.h \
igc_diag-5.14-ethercat.c \
igc_diag-5.14-ethercat.h \
igc_diag-5.14-orig.c \
@ -83,6 +83,10 @@ EXTRA_DIST = \
igc_diag-6.1-ethercat.h \
igc_diag-6.1-orig.c \
igc_diag-6.1-orig.h \
igc_diag-6.12-ethercat.c \
igc_diag-6.12-ethercat.h \
igc_diag-6.12-orig.c \
igc_diag-6.12-orig.h \
igc_diag-6.4-ethercat.c \
igc_diag-6.4-ethercat.h \
igc_diag-6.4-orig.c \
@ -91,46 +95,42 @@ EXTRA_DIST = \
igc_diag-6.6-ethercat.h \
igc_diag-6.6-orig.c \
igc_diag-6.6-orig.h \
igc_diag-6.12-ethercat.c \
igc_diag-6.12-ethercat.h \
igc_diag-6.12-orig.c \
igc_diag-6.12-orig.h \
igc_dump-5.14-ethercat.c \
igc_dump-5.14-orig.c \
igc_dump-5.15-ethercat.c \
igc_dump-5.15-orig.c \
igc_dump-6.1-ethercat.c \
igc_dump-6.1-orig.c \
igc_dump-6.12-ethercat.c \
igc_dump-6.12-orig.c \
igc_dump-6.4-ethercat.c \
igc_dump-6.4-orig.c \
igc_dump-6.6-ethercat.c \
igc_dump-6.6-orig.c \
igc_dump-6.12-ethercat.c \
igc_dump-6.12-orig.c \
igc_ethtool-5.14-ethercat.c \
igc_ethtool-5.14-orig.c \
igc_ethtool-5.15-ethercat.c \
igc_ethtool-5.15-orig.c \
igc_ethtool-6.1-ethercat.c \
igc_ethtool-6.1-orig.c \
igc_ethtool-6.12-ethercat.c \
igc_ethtool-6.12-orig.c \
igc_ethtool-6.4-ethercat.c \
igc_ethtool-6.4-orig.c \
igc_ethtool-6.6-ethercat.c \
igc_ethtool-6.6-orig.c \
igc_ethtool-6.12-ethercat.c \
igc_ethtool-6.12-orig.c \
igc_hw-5.14-ethercat.h \
igc_hw-5.14-orig.h \
igc_hw-5.15-ethercat.h \
igc_hw-5.15-orig.h \
igc_hw-6.1-ethercat.h \
igc_hw-6.1-orig.h \
igc_hw-6.12-ethercat.h \
igc_hw-6.12-orig.h \
igc_hw-6.4-ethercat.h \
igc_hw-6.4-orig.h \
igc_hw-6.6-ethercat.h \
igc_hw-6.6-orig.h \
igc_hw-6.12-ethercat.h \
igc_hw-6.12-orig.h \
igc_i225-5.14-ethercat.c \
igc_i225-5.14-ethercat.h \
igc_i225-5.14-orig.c \
@ -143,6 +143,10 @@ EXTRA_DIST = \
igc_i225-6.1-ethercat.h \
igc_i225-6.1-orig.c \
igc_i225-6.1-orig.h \
igc_i225-6.12-ethercat.c \
igc_i225-6.12-ethercat.h \
igc_i225-6.12-orig.c \
igc_i225-6.12-orig.h \
igc_i225-6.4-ethercat.c \
igc_i225-6.4-ethercat.h \
igc_i225-6.4-orig.c \
@ -151,10 +155,6 @@ EXTRA_DIST = \
igc_i225-6.6-ethercat.h \
igc_i225-6.6-orig.c \
igc_i225-6.6-orig.h \
igc_i225-6.12-ethercat.c \
igc_i225-6.12-ethercat.h \
igc_i225-6.12-orig.c \
igc_i225-6.12-orig.h \
igc_leds-6.12-ethercat.c \
igc_leds-6.12-orig.c \
igc_mac-5.14-ethercat.c \
@ -169,6 +169,10 @@ EXTRA_DIST = \
igc_mac-6.1-ethercat.h \
igc_mac-6.1-orig.c \
igc_mac-6.1-orig.h \
igc_mac-6.12-ethercat.c \
igc_mac-6.12-ethercat.h \
igc_mac-6.12-orig.c \
igc_mac-6.12-orig.h \
igc_mac-6.4-ethercat.c \
igc_mac-6.4-ethercat.h \
igc_mac-6.4-orig.c \
@ -177,34 +181,34 @@ EXTRA_DIST = \
igc_mac-6.6-ethercat.h \
igc_mac-6.6-orig.c \
igc_mac-6.6-orig.h \
igc_mac-6.12-ethercat.c \
igc_mac-6.12-ethercat.h \
igc_mac-6.12-orig.c \
igc_mac-6.12-orig.h \
igc_main-5.14-ethercat.c \
igc_main-5.14-orig.c \
igc_main-5.15-ethercat.c \
igc_main-5.15-orig.c \
igc_main-6.1-ethercat.c \
igc_main-6.1-orig.c \
igc_main-6.12-ethercat.c \
igc_main-6.12-orig.c \
igc_main-6.4-ethercat.c \
igc_main-6.4-orig.c \
igc_main-6.6-ethercat.c \
igc_main-6.6-orig.c \
igc_main-6.12-ethercat.c \
igc_main-6.12-orig.c \
igc_nvm-5.14-ethercat.c \
igc_nvm-5.14-ethercat.h \
igc_nvm-5.14-orig.c \
igc_nvm-5.14-orig.h \
igc_nvm-5.15-ethercat.c \
igc_nvm-5.15-ethercat.h \
igc_nvm-5.15-orig.h \
igc_nvm-5.15-orig.c \
igc_nvm-5.15-orig.h \
igc_nvm-6.1-ethercat.c \
igc_nvm-6.1-ethercat.h \
igc_nvm-6.1-orig.c \
igc_nvm-6.1-orig.h \
igc_nvm-6.12-ethercat.c \
igc_nvm-6.12-ethercat.h \
igc_nvm-6.12-orig.c \
igc_nvm-6.12-orig.h \
igc_nvm-6.4-ethercat.c \
igc_nvm-6.4-ethercat.h \
igc_nvm-6.4-orig.c \
@ -213,22 +217,22 @@ EXTRA_DIST = \
igc_nvm-6.6-ethercat.h \
igc_nvm-6.6-orig.c \
igc_nvm-6.6-orig.h \
igc_nvm-6.12-ethercat.c \
igc_nvm-6.12-ethercat.h \
igc_nvm-6.12-orig.c \
igc_nvm-6.12-orig.h \
igc_phy-5.14-ethercat.c \
igc_phy-5.14-ethercat.h \
igc_phy-5.14-orig.c \
igc_phy-5.14-orig.h \
igc_phy-5.15-ethercat.c \
igc_phy-5.15-ethercat.h \
igc_phy-5.15-orig.h \
igc_phy-5.15-orig.c \
igc_phy-5.15-orig.h \
igc_phy-6.1-ethercat.c \
igc_phy-6.1-ethercat.h \
igc_phy-6.1-orig.c \
igc_phy-6.1-orig.h \
igc_phy-6.12-ethercat.c \
igc_phy-6.12-ethercat.h \
igc_phy-6.12-orig.c \
igc_phy-6.12-orig.h \
igc_phy-6.4-ethercat.c \
igc_phy-6.4-ethercat.h \
igc_phy-6.4-orig.c \
@ -237,46 +241,46 @@ EXTRA_DIST = \
igc_phy-6.6-ethercat.h \
igc_phy-6.6-orig.c \
igc_phy-6.6-orig.h \
igc_phy-6.12-ethercat.c \
igc_phy-6.12-ethercat.h \
igc_phy-6.12-orig.h \
igc_phy-6.12-orig.c \
igc_ptp-5.14-ethercat.c \
igc_ptp-5.14-orig.c \
igc_ptp-5.15-ethercat.c \
igc_ptp-5.15-orig.c \
igc_ptp-6.1-ethercat.c \
igc_ptp-6.1-orig.c \
igc_ptp-6.12-ethercat.c \
igc_ptp-6.12-orig.c \
igc_ptp-6.4-ethercat.c \
igc_ptp-6.4-orig.c \
igc_ptp-6.6-ethercat.c \
igc_ptp-6.6-orig.c \
igc_ptp-6.12-ethercat.c \
igc_ptp-6.12-orig.c \
igc_regs-5.14-ethercat.h \
igc_regs-5.14-orig.h \
igc_regs-5.15-ethercat.h \
igc_regs-5.15-orig.h \
igc_regs-6.1-ethercat.h \
igc_regs-6.1-orig.h \
igc_regs-6.12-ethercat.h \
igc_regs-6.12-orig.h \
igc_regs-6.4-ethercat.h \
igc_regs-6.4-orig.h \
igc_regs-6.6-ethercat.h \
igc_regs-6.6-orig.h \
igc_regs-6.12-ethercat.h \
igc_regs-6.12-orig.h \
igc_tsn-5.14-ethercat.c \
igc_tsn-5.14-ethercat.h \
igc_tsn-5.14-orig.c \
igc_tsn-5.14-orig.h \
igc_tsn-5.15-ethercat.c \
igc_tsn-5.15-ethercat.h \
igc_tsn-5.15-orig.h \
igc_tsn-5.15-orig.c \
igc_tsn-5.15-orig.h \
igc_tsn-6.1-ethercat.c \
igc_tsn-6.1-ethercat.h \
igc_tsn-6.1-orig.c \
igc_tsn-6.1-orig.h \
igc_tsn-6.12-ethercat.c \
igc_tsn-6.12-ethercat.h \
igc_tsn-6.12-orig.c \
igc_tsn-6.12-orig.h \
igc_tsn-6.4-ethercat.c \
igc_tsn-6.4-ethercat.h \
igc_tsn-6.4-orig.c \
@ -285,22 +289,22 @@ EXTRA_DIST = \
igc_tsn-6.6-ethercat.h \
igc_tsn-6.6-orig.c \
igc_tsn-6.6-orig.h \
igc_tsn-6.12-ethercat.c \
igc_tsn-6.12-ethercat.h \
igc_tsn-6.12-orig.c \
igc_tsn-6.12-orig.h \
igc_xdp-5.14-ethercat.c \
igc_xdp-5.14-ethercat.h \
igc_xdp-5.14-orig.c \
igc_xdp-5.14-orig.h \
igc_xdp-5.15-ethercat.c \
igc_xdp-5.15-ethercat.h \
igc_xdp-5.15-orig.h \
igc_xdp-5.15-orig.c \
igc_xdp-5.15-orig.h \
igc_xdp-6.1-ethercat.c \
igc_xdp-6.1-ethercat.h \
igc_xdp-6.1-orig.c \
igc_xdp-6.1-orig.h \
igc_xdp-6.12-ethercat.c \
igc_xdp-6.12-ethercat.h \
igc_xdp-6.12-orig.c \
igc_xdp-6.12-orig.h \
igc_xdp-6.4-ethercat.c \
igc_xdp-6.4-ethercat.h \
igc_xdp-6.4-orig.c \
@ -309,7 +313,4 @@ EXTRA_DIST = \
igc_xdp-6.6-ethercat.h \
igc_xdp-6.6-orig.c \
igc_xdp-6.6-orig.h \
igc_xdp-6.12-ethercat.c \
igc_xdp-6.12-orig.c \
igc_xdp-6.12-ethercat.h \
igc_xdp-6.12-orig.h
update.sh

View File

@ -43,6 +43,10 @@ ifeq (@R8169_IN_SUBDIR@,1)
r8169_main-@KERNEL_R8169@-ethercat.o \
r8169_phy_config-@KERNEL_R8169@-ethercat.o
ifeq (@HAS_R8169_LEDS@,1)
ec_r8169-objs += r8169_leds-@KERNEL_IGC@-ethercat.o
endif
CFLAGS_r8169_main-@KERNEL_R8169@-ethercat.o = -DREV=$(REV)
ifeq (@ENABLE_DRIVER_RESOURCE_VERIFYING@,1)

View File

@ -22,45 +22,68 @@
include $(top_srcdir)/Makefile.kbuild
EXTRA_DIST = \
r8169-5.10-ethercat.h \
r8169-5.10-orig.h \
r8169-5.14-ethercat.h \
r8169-5.14-orig.h \
r8169-5.15-ethercat.h \
r8169-5.15-orig.h \
r8169-5.10-ethercat.h \
r8169-5.10-orig.h \
r8169-5.14-ethercat.h \
r8169-5.14-orig.h \
r8169-5.15-ethercat.h \
r8169-5.15-orig.h \
r8169-6.1-ethercat.h \
r8169-6.1-orig.h \
r8169_firmware-5.10-ethercat.c \
r8169_firmware-5.10-ethercat.h \
r8169_firmware-5.10-orig.c \
r8169_firmware-5.10-orig.h \
r8169_firmware-5.14-ethercat.c \
r8169_firmware-5.14-ethercat.h \
r8169_firmware-5.14-orig.c \
r8169_firmware-5.14-orig.h \
r8169_firmware-5.15-ethercat.c \
r8169_firmware-5.15-ethercat.h \
r8169_firmware-5.15-orig.c \
r8169_firmware-5.15-orig.h \
r8169-6.12-ethercat.h \
r8169-6.12-orig.h \
r8169-6.4-ethercat.h \
r8169-6.4-orig.h \
r8169_firmware-5.10-ethercat.c \
r8169_firmware-5.10-ethercat.h \
r8169_firmware-5.10-orig.c \
r8169_firmware-5.10-orig.h \
r8169_firmware-5.14-ethercat.c \
r8169_firmware-5.14-ethercat.h \
r8169_firmware-5.14-orig.c \
r8169_firmware-5.14-orig.h \
r8169_firmware-5.15-ethercat.c \
r8169_firmware-5.15-ethercat.h \
r8169_firmware-5.15-orig.c \
r8169_firmware-5.15-orig.h \
r8169_firmware-6.1-ethercat.c \
r8169_firmware-6.1-ethercat.h \
r8169_firmware-6.1-orig.c \
r8169_firmware-6.1-orig.h \
r8169_main-5.10-ethercat.c \
r8169_main-5.10-orig.c \
r8169_main-5.14-ethercat.c \
r8169_main-5.14-orig.c \
r8169_main-5.15-ethercat.c \
r8169_main-5.15-orig.c \
r8169_firmware-6.12-ethercat.c \
r8169_firmware-6.12-ethercat.h \
r8169_firmware-6.12-orig.c \
r8169_firmware-6.12-orig.h \
r8169_firmware-6.4-ethercat.c \
r8169_firmware-6.4-ethercat.h \
r8169_firmware-6.4-orig.c \
r8169_firmware-6.4-orig.h \
r8169_leds-6.12-ethercat.c \
r8169_leds-6.12-orig.c \
r8169_main-5.10-ethercat.c \
r8169_main-5.10-orig.c \
r8169_main-5.14-ethercat.c \
r8169_main-5.14-orig.c \
r8169_main-5.15-ethercat.c \
r8169_main-5.15-orig.c \
r8169_main-6.1-ethercat.c \
r8169_main-6.1-orig.c \
r8169_phy_config-5.10-ethercat.c \
r8169_phy_config-5.10-orig.c \
r8169_phy_config-5.14-ethercat.c \
r8169_phy_config-5.14-orig.c \
r8169_phy_config-5.15-ethercat.c \
r8169_phy_config-5.15-orig.c \
r8169_main-6.12-ethercat.c \
r8169_main-6.12-orig.c \
r8169_main-6.4-ethercat.c \
r8169_main-6.4-orig.c \
r8169_phy_config-5.10-ethercat.c \
r8169_phy_config-5.10-orig.c \
r8169_phy_config-5.14-ethercat.c \
r8169_phy_config-5.14-orig.c \
r8169_phy_config-5.15-ethercat.c \
r8169_phy_config-5.15-orig.c \
r8169_phy_config-6.1-ethercat.c \
r8169_phy_config-6.1-orig.c
r8169_phy_config-6.1-orig.c \
r8169_phy_config-6.12-ethercat.c \
r8169_phy_config-6.12-orig.c \
r8169_phy_config-6.4-ethercat.c \
r8169_phy_config-6.4-orig.c \
update.sh
#-----------------------------------------------------------------------------

View File

@ -0,0 +1,93 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* r8169.h: RealTek 8169/8168/8101 ethernet driver.
*
* Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
* Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
* Copyright (c) a lot of people too. Please respect their work.
*
* See MAINTAINERS file for support contact information.
*/
#include <linux/netdevice.h>
#include <linux/types.h>
#include <linux/phy.h>
enum mac_version {
/* support for ancient RTL_GIGA_MAC_VER_01 has been removed */
RTL_GIGA_MAC_VER_02,
RTL_GIGA_MAC_VER_03,
RTL_GIGA_MAC_VER_04,
RTL_GIGA_MAC_VER_05,
RTL_GIGA_MAC_VER_06,
RTL_GIGA_MAC_VER_07,
RTL_GIGA_MAC_VER_08,
RTL_GIGA_MAC_VER_09,
RTL_GIGA_MAC_VER_10,
RTL_GIGA_MAC_VER_11,
/* RTL_GIGA_MAC_VER_12 was handled the same as VER_17 */
/* RTL_GIGA_MAC_VER_13 was merged with VER_10 */
RTL_GIGA_MAC_VER_14,
/* RTL_GIGA_MAC_VER_16 was merged with VER_10 */
RTL_GIGA_MAC_VER_17,
RTL_GIGA_MAC_VER_18,
RTL_GIGA_MAC_VER_19,
RTL_GIGA_MAC_VER_20,
RTL_GIGA_MAC_VER_21,
RTL_GIGA_MAC_VER_22,
RTL_GIGA_MAC_VER_23,
RTL_GIGA_MAC_VER_24,
RTL_GIGA_MAC_VER_25,
RTL_GIGA_MAC_VER_26,
/* support for RTL_GIGA_MAC_VER_27 has been removed */
RTL_GIGA_MAC_VER_28,
RTL_GIGA_MAC_VER_29,
RTL_GIGA_MAC_VER_30,
RTL_GIGA_MAC_VER_31,
RTL_GIGA_MAC_VER_32,
RTL_GIGA_MAC_VER_33,
RTL_GIGA_MAC_VER_34,
RTL_GIGA_MAC_VER_35,
RTL_GIGA_MAC_VER_36,
RTL_GIGA_MAC_VER_37,
RTL_GIGA_MAC_VER_38,
RTL_GIGA_MAC_VER_39,
RTL_GIGA_MAC_VER_40,
/* support for RTL_GIGA_MAC_VER_41 has been removed */
RTL_GIGA_MAC_VER_42,
RTL_GIGA_MAC_VER_43,
RTL_GIGA_MAC_VER_44,
/* support for RTL_GIGA_MAC_VER_45 has been removed */
RTL_GIGA_MAC_VER_46,
/* support for RTL_GIGA_MAC_VER_47 has been removed */
RTL_GIGA_MAC_VER_48,
/* support for RTL_GIGA_MAC_VER_49 has been removed */
/* support for RTL_GIGA_MAC_VER_50 has been removed */
RTL_GIGA_MAC_VER_51,
RTL_GIGA_MAC_VER_52,
RTL_GIGA_MAC_VER_53,
/* support for RTL_GIGA_MAC_VER_60 has been removed */
RTL_GIGA_MAC_VER_61,
RTL_GIGA_MAC_VER_63,
RTL_GIGA_MAC_VER_65,
RTL_GIGA_MAC_VER_66,
RTL_GIGA_MAC_NONE
};
struct rtl8169_private;
struct r8169_led_classdev;
void r8169_apply_firmware(struct rtl8169_private *tp);
u16 rtl8168h_2_get_adc_bias_ioffset(struct rtl8169_private *tp);
u8 rtl8168d_efuse_read(struct rtl8169_private *tp, int reg_addr);
void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev,
enum mac_version ver);
void r8169_get_led_name(struct rtl8169_private *tp, int idx,
char *buf, int buf_len);
int rtl8168_get_led_mode(struct rtl8169_private *tp);
int rtl8168_led_mod_ctrl(struct rtl8169_private *tp, u16 mask, u16 val);
struct r8169_led_classdev *rtl8168_init_leds(struct net_device *ndev);
int rtl8125_get_led_mode(struct rtl8169_private *tp, int index);
int rtl8125_set_led_mode(struct rtl8169_private *tp, int index, u16 mode);
struct r8169_led_classdev *rtl8125_init_leds(struct net_device *ndev);
void r8169_remove_leds(struct r8169_led_classdev *leds);

View File

@ -0,0 +1,93 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* r8169.h: RealTek 8169/8168/8101 ethernet driver.
*
* Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
* Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
* Copyright (c) a lot of people too. Please respect their work.
*
* See MAINTAINERS file for support contact information.
*/
#include <linux/netdevice.h>
#include <linux/types.h>
#include <linux/phy.h>
enum mac_version {
/* support for ancient RTL_GIGA_MAC_VER_01 has been removed */
RTL_GIGA_MAC_VER_02,
RTL_GIGA_MAC_VER_03,
RTL_GIGA_MAC_VER_04,
RTL_GIGA_MAC_VER_05,
RTL_GIGA_MAC_VER_06,
RTL_GIGA_MAC_VER_07,
RTL_GIGA_MAC_VER_08,
RTL_GIGA_MAC_VER_09,
RTL_GIGA_MAC_VER_10,
RTL_GIGA_MAC_VER_11,
/* RTL_GIGA_MAC_VER_12 was handled the same as VER_17 */
/* RTL_GIGA_MAC_VER_13 was merged with VER_10 */
RTL_GIGA_MAC_VER_14,
/* RTL_GIGA_MAC_VER_16 was merged with VER_10 */
RTL_GIGA_MAC_VER_17,
RTL_GIGA_MAC_VER_18,
RTL_GIGA_MAC_VER_19,
RTL_GIGA_MAC_VER_20,
RTL_GIGA_MAC_VER_21,
RTL_GIGA_MAC_VER_22,
RTL_GIGA_MAC_VER_23,
RTL_GIGA_MAC_VER_24,
RTL_GIGA_MAC_VER_25,
RTL_GIGA_MAC_VER_26,
/* support for RTL_GIGA_MAC_VER_27 has been removed */
RTL_GIGA_MAC_VER_28,
RTL_GIGA_MAC_VER_29,
RTL_GIGA_MAC_VER_30,
RTL_GIGA_MAC_VER_31,
RTL_GIGA_MAC_VER_32,
RTL_GIGA_MAC_VER_33,
RTL_GIGA_MAC_VER_34,
RTL_GIGA_MAC_VER_35,
RTL_GIGA_MAC_VER_36,
RTL_GIGA_MAC_VER_37,
RTL_GIGA_MAC_VER_38,
RTL_GIGA_MAC_VER_39,
RTL_GIGA_MAC_VER_40,
/* support for RTL_GIGA_MAC_VER_41 has been removed */
RTL_GIGA_MAC_VER_42,
RTL_GIGA_MAC_VER_43,
RTL_GIGA_MAC_VER_44,
/* support for RTL_GIGA_MAC_VER_45 has been removed */
RTL_GIGA_MAC_VER_46,
/* support for RTL_GIGA_MAC_VER_47 has been removed */
RTL_GIGA_MAC_VER_48,
/* support for RTL_GIGA_MAC_VER_49 has been removed */
/* support for RTL_GIGA_MAC_VER_50 has been removed */
RTL_GIGA_MAC_VER_51,
RTL_GIGA_MAC_VER_52,
RTL_GIGA_MAC_VER_53,
/* support for RTL_GIGA_MAC_VER_60 has been removed */
RTL_GIGA_MAC_VER_61,
RTL_GIGA_MAC_VER_63,
RTL_GIGA_MAC_VER_65,
RTL_GIGA_MAC_VER_66,
RTL_GIGA_MAC_NONE
};
struct rtl8169_private;
struct r8169_led_classdev;
void r8169_apply_firmware(struct rtl8169_private *tp);
u16 rtl8168h_2_get_adc_bias_ioffset(struct rtl8169_private *tp);
u8 rtl8168d_efuse_read(struct rtl8169_private *tp, int reg_addr);
void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev,
enum mac_version ver);
void r8169_get_led_name(struct rtl8169_private *tp, int idx,
char *buf, int buf_len);
int rtl8168_get_led_mode(struct rtl8169_private *tp);
int rtl8168_led_mod_ctrl(struct rtl8169_private *tp, u16 mask, u16 val);
struct r8169_led_classdev *rtl8168_init_leds(struct net_device *ndev);
int rtl8125_get_led_mode(struct rtl8169_private *tp, int index);
int rtl8125_set_led_mode(struct rtl8169_private *tp, int index, u16 mode);
struct r8169_led_classdev *rtl8125_init_leds(struct net_device *ndev);
void r8169_remove_leds(struct r8169_led_classdev *leds);

View File

@ -0,0 +1,79 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* r8169.h: RealTek 8169/8168/8101 ethernet driver.
*
* Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
* Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
* Copyright (c) a lot of people too. Please respect their work.
*
* See MAINTAINERS file for support contact information.
*/
#include <linux/types.h>
#include <linux/phy.h>
enum mac_version {
/* support for ancient RTL_GIGA_MAC_VER_01 has been removed */
RTL_GIGA_MAC_VER_02,
RTL_GIGA_MAC_VER_03,
RTL_GIGA_MAC_VER_04,
RTL_GIGA_MAC_VER_05,
RTL_GIGA_MAC_VER_06,
RTL_GIGA_MAC_VER_07,
RTL_GIGA_MAC_VER_08,
RTL_GIGA_MAC_VER_09,
RTL_GIGA_MAC_VER_10,
RTL_GIGA_MAC_VER_11,
/* RTL_GIGA_MAC_VER_12 was handled the same as VER_17 */
/* RTL_GIGA_MAC_VER_13 was merged with VER_10 */
RTL_GIGA_MAC_VER_14,
/* RTL_GIGA_MAC_VER_16 was merged with VER_10 */
RTL_GIGA_MAC_VER_17,
RTL_GIGA_MAC_VER_18,
RTL_GIGA_MAC_VER_19,
RTL_GIGA_MAC_VER_20,
RTL_GIGA_MAC_VER_21,
RTL_GIGA_MAC_VER_22,
RTL_GIGA_MAC_VER_23,
RTL_GIGA_MAC_VER_24,
RTL_GIGA_MAC_VER_25,
RTL_GIGA_MAC_VER_26,
/* support for RTL_GIGA_MAC_VER_27 has been removed */
RTL_GIGA_MAC_VER_28,
RTL_GIGA_MAC_VER_29,
RTL_GIGA_MAC_VER_30,
RTL_GIGA_MAC_VER_31,
RTL_GIGA_MAC_VER_32,
RTL_GIGA_MAC_VER_33,
RTL_GIGA_MAC_VER_34,
RTL_GIGA_MAC_VER_35,
RTL_GIGA_MAC_VER_36,
RTL_GIGA_MAC_VER_37,
RTL_GIGA_MAC_VER_38,
RTL_GIGA_MAC_VER_39,
RTL_GIGA_MAC_VER_40,
/* support for RTL_GIGA_MAC_VER_41 has been removed */
RTL_GIGA_MAC_VER_42,
RTL_GIGA_MAC_VER_43,
RTL_GIGA_MAC_VER_44,
/* support for RTL_GIGA_MAC_VER_45 has been removed */
RTL_GIGA_MAC_VER_46,
/* support for RTL_GIGA_MAC_VER_47 has been removed */
RTL_GIGA_MAC_VER_48,
/* support for RTL_GIGA_MAC_VER_49 has been removed */
/* support for RTL_GIGA_MAC_VER_50 has been removed */
RTL_GIGA_MAC_VER_51,
RTL_GIGA_MAC_VER_52,
RTL_GIGA_MAC_VER_53,
/* support for RTL_GIGA_MAC_VER_60 has been removed */
RTL_GIGA_MAC_VER_61,
RTL_GIGA_MAC_VER_63,
RTL_GIGA_MAC_NONE
};
struct rtl8169_private;
void r8169_apply_firmware(struct rtl8169_private *tp);
u16 rtl8168h_2_get_adc_bias_ioffset(struct rtl8169_private *tp);
u8 rtl8168d_efuse_read(struct rtl8169_private *tp, int reg_addr);
void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev,
enum mac_version ver);

View File

@ -0,0 +1,79 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* r8169.h: RealTek 8169/8168/8101 ethernet driver.
*
* Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
* Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
* Copyright (c) a lot of people too. Please respect their work.
*
* See MAINTAINERS file for support contact information.
*/
#include <linux/types.h>
#include <linux/phy.h>
enum mac_version {
/* support for ancient RTL_GIGA_MAC_VER_01 has been removed */
RTL_GIGA_MAC_VER_02,
RTL_GIGA_MAC_VER_03,
RTL_GIGA_MAC_VER_04,
RTL_GIGA_MAC_VER_05,
RTL_GIGA_MAC_VER_06,
RTL_GIGA_MAC_VER_07,
RTL_GIGA_MAC_VER_08,
RTL_GIGA_MAC_VER_09,
RTL_GIGA_MAC_VER_10,
RTL_GIGA_MAC_VER_11,
/* RTL_GIGA_MAC_VER_12 was handled the same as VER_17 */
/* RTL_GIGA_MAC_VER_13 was merged with VER_10 */
RTL_GIGA_MAC_VER_14,
/* RTL_GIGA_MAC_VER_16 was merged with VER_10 */
RTL_GIGA_MAC_VER_17,
RTL_GIGA_MAC_VER_18,
RTL_GIGA_MAC_VER_19,
RTL_GIGA_MAC_VER_20,
RTL_GIGA_MAC_VER_21,
RTL_GIGA_MAC_VER_22,
RTL_GIGA_MAC_VER_23,
RTL_GIGA_MAC_VER_24,
RTL_GIGA_MAC_VER_25,
RTL_GIGA_MAC_VER_26,
/* support for RTL_GIGA_MAC_VER_27 has been removed */
RTL_GIGA_MAC_VER_28,
RTL_GIGA_MAC_VER_29,
RTL_GIGA_MAC_VER_30,
RTL_GIGA_MAC_VER_31,
RTL_GIGA_MAC_VER_32,
RTL_GIGA_MAC_VER_33,
RTL_GIGA_MAC_VER_34,
RTL_GIGA_MAC_VER_35,
RTL_GIGA_MAC_VER_36,
RTL_GIGA_MAC_VER_37,
RTL_GIGA_MAC_VER_38,
RTL_GIGA_MAC_VER_39,
RTL_GIGA_MAC_VER_40,
/* support for RTL_GIGA_MAC_VER_41 has been removed */
RTL_GIGA_MAC_VER_42,
RTL_GIGA_MAC_VER_43,
RTL_GIGA_MAC_VER_44,
/* support for RTL_GIGA_MAC_VER_45 has been removed */
RTL_GIGA_MAC_VER_46,
/* support for RTL_GIGA_MAC_VER_47 has been removed */
RTL_GIGA_MAC_VER_48,
/* support for RTL_GIGA_MAC_VER_49 has been removed */
/* support for RTL_GIGA_MAC_VER_50 has been removed */
RTL_GIGA_MAC_VER_51,
RTL_GIGA_MAC_VER_52,
RTL_GIGA_MAC_VER_53,
/* support for RTL_GIGA_MAC_VER_60 has been removed */
RTL_GIGA_MAC_VER_61,
RTL_GIGA_MAC_VER_63,
RTL_GIGA_MAC_NONE
};
struct rtl8169_private;
void r8169_apply_firmware(struct rtl8169_private *tp);
u16 rtl8168h_2_get_adc_bias_ioffset(struct rtl8169_private *tp);
u8 rtl8168d_efuse_read(struct rtl8169_private *tp, int reg_addr);
void r8169_hw_phy_config(struct rtl8169_private *tp, struct phy_device *phydev,
enum mac_version ver);

View File

@ -0,0 +1,233 @@
// SPDX-License-Identifier: GPL-2.0-only
/* r8169_firmware.c: RealTek 8169/8168/8101 ethernet driver.
*
* Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
* Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
* Copyright (c) a lot of people too. Please respect their work.
*
* See MAINTAINERS file for support contact information.
*/
#include <linux/delay.h>
#include <linux/firmware.h>
#include "r8169_firmware-6.12-ethercat.h"
enum rtl_fw_opcode {
PHY_READ = 0x0,
PHY_DATA_OR = 0x1,
PHY_DATA_AND = 0x2,
PHY_BJMPN = 0x3,
PHY_MDIO_CHG = 0x4,
PHY_CLEAR_READCOUNT = 0x7,
PHY_WRITE = 0x8,
PHY_READCOUNT_EQ_SKIP = 0x9,
PHY_COMP_EQ_SKIPN = 0xa,
PHY_COMP_NEQ_SKIPN = 0xb,
PHY_WRITE_PREVIOUS = 0xc,
PHY_SKIPN = 0xd,
PHY_DELAY_MS = 0xe,
};
struct fw_info {
u32 magic;
char version[RTL_VER_SIZE];
__le32 fw_start;
__le32 fw_len;
u8 chksum;
} __packed;
#define FW_OPCODE_SIZE sizeof_field(struct rtl_fw_phy_action, code[0])
static bool rtl_fw_format_ok(struct rtl_fw *rtl_fw)
{
const struct firmware *fw = rtl_fw->fw;
struct fw_info *fw_info = (struct fw_info *)fw->data;
struct rtl_fw_phy_action *pa = &rtl_fw->phy_action;
if (fw->size < FW_OPCODE_SIZE)
return false;
if (!fw_info->magic) {
size_t i, size, start;
u8 checksum = 0;
if (fw->size < sizeof(*fw_info))
return false;
for (i = 0; i < fw->size; i++)
checksum += fw->data[i];
if (checksum != 0)
return false;
start = le32_to_cpu(fw_info->fw_start);
if (start > fw->size)
return false;
size = le32_to_cpu(fw_info->fw_len);
if (size > (fw->size - start) / FW_OPCODE_SIZE)
return false;
strscpy(rtl_fw->version, fw_info->version, RTL_VER_SIZE);
pa->code = (__le32 *)(fw->data + start);
pa->size = size;
} else {
if (fw->size % FW_OPCODE_SIZE)
return false;
strscpy(rtl_fw->version, rtl_fw->fw_name, RTL_VER_SIZE);
pa->code = (__le32 *)fw->data;
pa->size = fw->size / FW_OPCODE_SIZE;
}
return true;
}
static bool rtl_fw_data_ok(struct rtl_fw *rtl_fw)
{
struct rtl_fw_phy_action *pa = &rtl_fw->phy_action;
size_t index;
for (index = 0; index < pa->size; index++) {
u32 action = le32_to_cpu(pa->code[index]);
u32 val = action & 0x0000ffff;
u32 regno = (action & 0x0fff0000) >> 16;
switch (action >> 28) {
case PHY_READ:
case PHY_DATA_OR:
case PHY_DATA_AND:
case PHY_CLEAR_READCOUNT:
case PHY_WRITE:
case PHY_WRITE_PREVIOUS:
case PHY_DELAY_MS:
break;
case PHY_MDIO_CHG:
if (val > 1)
goto out;
break;
case PHY_BJMPN:
if (regno > index)
goto out;
break;
case PHY_READCOUNT_EQ_SKIP:
if (index + 2 >= pa->size)
goto out;
break;
case PHY_COMP_EQ_SKIPN:
case PHY_COMP_NEQ_SKIPN:
case PHY_SKIPN:
if (index + 1 + regno >= pa->size)
goto out;
break;
default:
dev_err(rtl_fw->dev, "Invalid action 0x%08x\n", action);
return false;
}
}
return true;
out:
dev_err(rtl_fw->dev, "Out of range of firmware\n");
return false;
}
void rtl_fw_write_firmware(struct rtl8169_private *tp, struct rtl_fw *rtl_fw)
{
struct rtl_fw_phy_action *pa = &rtl_fw->phy_action;
rtl_fw_write_t fw_write = rtl_fw->phy_write;
rtl_fw_read_t fw_read = rtl_fw->phy_read;
int predata = 0, count = 0;
size_t index;
for (index = 0; index < pa->size; index++) {
u32 action = le32_to_cpu(pa->code[index]);
u32 data = action & 0x0000ffff;
u32 regno = (action & 0x0fff0000) >> 16;
enum rtl_fw_opcode opcode = action >> 28;
switch (opcode) {
case PHY_READ:
predata = fw_read(tp, regno);
count++;
break;
case PHY_DATA_OR:
predata |= data;
break;
case PHY_DATA_AND:
predata &= data;
break;
case PHY_BJMPN:
index -= (regno + 1);
break;
case PHY_MDIO_CHG:
if (data) {
fw_write = rtl_fw->mac_mcu_write;
fw_read = rtl_fw->mac_mcu_read;
} else {
fw_write = rtl_fw->phy_write;
fw_read = rtl_fw->phy_read;
}
break;
case PHY_CLEAR_READCOUNT:
count = 0;
break;
case PHY_WRITE:
fw_write(tp, regno, data);
break;
case PHY_READCOUNT_EQ_SKIP:
if (count == data)
index++;
break;
case PHY_COMP_EQ_SKIPN:
if (predata == data)
index += regno;
break;
case PHY_COMP_NEQ_SKIPN:
if (predata != data)
index += regno;
break;
case PHY_WRITE_PREVIOUS:
fw_write(tp, regno, predata);
break;
case PHY_SKIPN:
index += regno;
break;
case PHY_DELAY_MS:
msleep(data);
break;
}
}
}
void rtl_fw_release_firmware(struct rtl_fw *rtl_fw)
{
release_firmware(rtl_fw->fw);
}
int rtl_fw_request_firmware(struct rtl_fw *rtl_fw)
{
int rc;
rc = request_firmware(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev);
if (rc < 0)
goto out;
if (!rtl_fw_format_ok(rtl_fw) || !rtl_fw_data_ok(rtl_fw)) {
release_firmware(rtl_fw->fw);
rc = -EINVAL;
goto out;
}
return 0;
out:
dev_err(rtl_fw->dev, "Unable to load firmware %s (%d)\n",
rtl_fw->fw_name, rc);
return rc;
}

View File

@ -0,0 +1,39 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* r8169_firmware.h: RealTek 8169/8168/8101 ethernet driver.
*
* Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
* Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
* Copyright (c) a lot of people too. Please respect their work.
*
* See MAINTAINERS file for support contact information.
*/
#include <linux/device.h>
#include <linux/firmware.h>
struct rtl8169_private;
typedef void (*rtl_fw_write_t)(struct rtl8169_private *tp, int reg, int val);
typedef int (*rtl_fw_read_t)(struct rtl8169_private *tp, int reg);
#define RTL_VER_SIZE 32
struct rtl_fw {
rtl_fw_write_t phy_write;
rtl_fw_read_t phy_read;
rtl_fw_write_t mac_mcu_write;
rtl_fw_read_t mac_mcu_read;
const struct firmware *fw;
const char *fw_name;
struct device *dev;
char version[RTL_VER_SIZE];
struct rtl_fw_phy_action {
__le32 *code;
size_t size;
} phy_action;
};
int rtl_fw_request_firmware(struct rtl_fw *rtl_fw);
void rtl_fw_release_firmware(struct rtl_fw *rtl_fw);
void rtl_fw_write_firmware(struct rtl8169_private *tp, struct rtl_fw *rtl_fw);

View File

@ -0,0 +1,233 @@
// SPDX-License-Identifier: GPL-2.0-only
/* r8169_firmware.c: RealTek 8169/8168/8101 ethernet driver.
*
* Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
* Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
* Copyright (c) a lot of people too. Please respect their work.
*
* See MAINTAINERS file for support contact information.
*/
#include <linux/delay.h>
#include <linux/firmware.h>
#include "r8169_firmware.h"
enum rtl_fw_opcode {
PHY_READ = 0x0,
PHY_DATA_OR = 0x1,
PHY_DATA_AND = 0x2,
PHY_BJMPN = 0x3,
PHY_MDIO_CHG = 0x4,
PHY_CLEAR_READCOUNT = 0x7,
PHY_WRITE = 0x8,
PHY_READCOUNT_EQ_SKIP = 0x9,
PHY_COMP_EQ_SKIPN = 0xa,
PHY_COMP_NEQ_SKIPN = 0xb,
PHY_WRITE_PREVIOUS = 0xc,
PHY_SKIPN = 0xd,
PHY_DELAY_MS = 0xe,
};
struct fw_info {
u32 magic;
char version[RTL_VER_SIZE];
__le32 fw_start;
__le32 fw_len;
u8 chksum;
} __packed;
#define FW_OPCODE_SIZE sizeof_field(struct rtl_fw_phy_action, code[0])
static bool rtl_fw_format_ok(struct rtl_fw *rtl_fw)
{
const struct firmware *fw = rtl_fw->fw;
struct fw_info *fw_info = (struct fw_info *)fw->data;
struct rtl_fw_phy_action *pa = &rtl_fw->phy_action;
if (fw->size < FW_OPCODE_SIZE)
return false;
if (!fw_info->magic) {
size_t i, size, start;
u8 checksum = 0;
if (fw->size < sizeof(*fw_info))
return false;
for (i = 0; i < fw->size; i++)
checksum += fw->data[i];
if (checksum != 0)
return false;
start = le32_to_cpu(fw_info->fw_start);
if (start > fw->size)
return false;
size = le32_to_cpu(fw_info->fw_len);
if (size > (fw->size - start) / FW_OPCODE_SIZE)
return false;
strscpy(rtl_fw->version, fw_info->version, RTL_VER_SIZE);
pa->code = (__le32 *)(fw->data + start);
pa->size = size;
} else {
if (fw->size % FW_OPCODE_SIZE)
return false;
strscpy(rtl_fw->version, rtl_fw->fw_name, RTL_VER_SIZE);
pa->code = (__le32 *)fw->data;
pa->size = fw->size / FW_OPCODE_SIZE;
}
return true;
}
static bool rtl_fw_data_ok(struct rtl_fw *rtl_fw)
{
struct rtl_fw_phy_action *pa = &rtl_fw->phy_action;
size_t index;
for (index = 0; index < pa->size; index++) {
u32 action = le32_to_cpu(pa->code[index]);
u32 val = action & 0x0000ffff;
u32 regno = (action & 0x0fff0000) >> 16;
switch (action >> 28) {
case PHY_READ:
case PHY_DATA_OR:
case PHY_DATA_AND:
case PHY_CLEAR_READCOUNT:
case PHY_WRITE:
case PHY_WRITE_PREVIOUS:
case PHY_DELAY_MS:
break;
case PHY_MDIO_CHG:
if (val > 1)
goto out;
break;
case PHY_BJMPN:
if (regno > index)
goto out;
break;
case PHY_READCOUNT_EQ_SKIP:
if (index + 2 >= pa->size)
goto out;
break;
case PHY_COMP_EQ_SKIPN:
case PHY_COMP_NEQ_SKIPN:
case PHY_SKIPN:
if (index + 1 + regno >= pa->size)
goto out;
break;
default:
dev_err(rtl_fw->dev, "Invalid action 0x%08x\n", action);
return false;
}
}
return true;
out:
dev_err(rtl_fw->dev, "Out of range of firmware\n");
return false;
}
void rtl_fw_write_firmware(struct rtl8169_private *tp, struct rtl_fw *rtl_fw)
{
struct rtl_fw_phy_action *pa = &rtl_fw->phy_action;
rtl_fw_write_t fw_write = rtl_fw->phy_write;
rtl_fw_read_t fw_read = rtl_fw->phy_read;
int predata = 0, count = 0;
size_t index;
for (index = 0; index < pa->size; index++) {
u32 action = le32_to_cpu(pa->code[index]);
u32 data = action & 0x0000ffff;
u32 regno = (action & 0x0fff0000) >> 16;
enum rtl_fw_opcode opcode = action >> 28;
switch (opcode) {
case PHY_READ:
predata = fw_read(tp, regno);
count++;
break;
case PHY_DATA_OR:
predata |= data;
break;
case PHY_DATA_AND:
predata &= data;
break;
case PHY_BJMPN:
index -= (regno + 1);
break;
case PHY_MDIO_CHG:
if (data) {
fw_write = rtl_fw->mac_mcu_write;
fw_read = rtl_fw->mac_mcu_read;
} else {
fw_write = rtl_fw->phy_write;
fw_read = rtl_fw->phy_read;
}
break;
case PHY_CLEAR_READCOUNT:
count = 0;
break;
case PHY_WRITE:
fw_write(tp, regno, data);
break;
case PHY_READCOUNT_EQ_SKIP:
if (count == data)
index++;
break;
case PHY_COMP_EQ_SKIPN:
if (predata == data)
index += regno;
break;
case PHY_COMP_NEQ_SKIPN:
if (predata != data)
index += regno;
break;
case PHY_WRITE_PREVIOUS:
fw_write(tp, regno, predata);
break;
case PHY_SKIPN:
index += regno;
break;
case PHY_DELAY_MS:
msleep(data);
break;
}
}
}
void rtl_fw_release_firmware(struct rtl_fw *rtl_fw)
{
release_firmware(rtl_fw->fw);
}
int rtl_fw_request_firmware(struct rtl_fw *rtl_fw)
{
int rc;
rc = request_firmware(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev);
if (rc < 0)
goto out;
if (!rtl_fw_format_ok(rtl_fw) || !rtl_fw_data_ok(rtl_fw)) {
release_firmware(rtl_fw->fw);
rc = -EINVAL;
goto out;
}
return 0;
out:
dev_err(rtl_fw->dev, "Unable to load firmware %s (%d)\n",
rtl_fw->fw_name, rc);
return rc;
}

View File

@ -0,0 +1,39 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* r8169_firmware.h: RealTek 8169/8168/8101 ethernet driver.
*
* Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
* Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
* Copyright (c) a lot of people too. Please respect their work.
*
* See MAINTAINERS file for support contact information.
*/
#include <linux/device.h>
#include <linux/firmware.h>
struct rtl8169_private;
typedef void (*rtl_fw_write_t)(struct rtl8169_private *tp, int reg, int val);
typedef int (*rtl_fw_read_t)(struct rtl8169_private *tp, int reg);
#define RTL_VER_SIZE 32
struct rtl_fw {
rtl_fw_write_t phy_write;
rtl_fw_read_t phy_read;
rtl_fw_write_t mac_mcu_write;
rtl_fw_read_t mac_mcu_read;
const struct firmware *fw;
const char *fw_name;
struct device *dev;
char version[RTL_VER_SIZE];
struct rtl_fw_phy_action {
__le32 *code;
size_t size;
} phy_action;
};
int rtl_fw_request_firmware(struct rtl_fw *rtl_fw);
void rtl_fw_release_firmware(struct rtl_fw *rtl_fw);
void rtl_fw_write_firmware(struct rtl8169_private *tp, struct rtl_fw *rtl_fw);

View File

@ -0,0 +1,236 @@
// SPDX-License-Identifier: GPL-2.0-only
/* r8169_firmware.c: RealTek 8169/8168/8101 ethernet driver.
*
* Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
* Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
* Copyright (c) a lot of people too. Please respect their work.
*
* See MAINTAINERS file for support contact information.
*/
#include <linux/delay.h>
#include <linux/firmware.h>
#include "r8169_firmware-6.4-ethercat.h"
enum rtl_fw_opcode {
PHY_READ = 0x0,
PHY_DATA_OR = 0x1,
PHY_DATA_AND = 0x2,
PHY_BJMPN = 0x3,
PHY_MDIO_CHG = 0x4,
PHY_CLEAR_READCOUNT = 0x7,
PHY_WRITE = 0x8,
PHY_READCOUNT_EQ_SKIP = 0x9,
PHY_COMP_EQ_SKIPN = 0xa,
PHY_COMP_NEQ_SKIPN = 0xb,
PHY_WRITE_PREVIOUS = 0xc,
PHY_SKIPN = 0xd,
PHY_DELAY_MS = 0xe,
};
struct fw_info {
u32 magic;
char version[RTL_VER_SIZE];
__le32 fw_start;
__le32 fw_len;
u8 chksum;
} __packed;
#define FW_OPCODE_SIZE sizeof_field(struct rtl_fw_phy_action, code[0])
static bool rtl_fw_format_ok(struct rtl_fw *rtl_fw)
{
const struct firmware *fw = rtl_fw->fw;
struct fw_info *fw_info = (struct fw_info *)fw->data;
struct rtl_fw_phy_action *pa = &rtl_fw->phy_action;
if (fw->size < FW_OPCODE_SIZE)
return false;
if (!fw_info->magic) {
size_t i, size, start;
u8 checksum = 0;
if (fw->size < sizeof(*fw_info))
return false;
for (i = 0; i < fw->size; i++)
checksum += fw->data[i];
if (checksum != 0)
return false;
start = le32_to_cpu(fw_info->fw_start);
if (start > fw->size)
return false;
size = le32_to_cpu(fw_info->fw_len);
if (size > (fw->size - start) / FW_OPCODE_SIZE)
return false;
strscpy(rtl_fw->version, fw_info->version, RTL_VER_SIZE);
pa->code = (__le32 *)(fw->data + start);
pa->size = size;
} else {
if (fw->size % FW_OPCODE_SIZE)
return false;
strscpy(rtl_fw->version, rtl_fw->fw_name, RTL_VER_SIZE);
pa->code = (__le32 *)fw->data;
pa->size = fw->size / FW_OPCODE_SIZE;
}
return true;
}
static bool rtl_fw_data_ok(struct rtl_fw *rtl_fw)
{
struct rtl_fw_phy_action *pa = &rtl_fw->phy_action;
size_t index;
for (index = 0; index < pa->size; index++) {
u32 action = le32_to_cpu(pa->code[index]);
u32 val = action & 0x0000ffff;
u32 regno = (action & 0x0fff0000) >> 16;
switch (action >> 28) {
case PHY_READ:
case PHY_DATA_OR:
case PHY_DATA_AND:
case PHY_CLEAR_READCOUNT:
case PHY_WRITE:
case PHY_WRITE_PREVIOUS:
case PHY_DELAY_MS:
break;
case PHY_MDIO_CHG:
if (val > 1)
goto out;
break;
case PHY_BJMPN:
if (regno > index)
goto out;
break;
case PHY_READCOUNT_EQ_SKIP:
if (index + 2 >= pa->size)
goto out;
break;
case PHY_COMP_EQ_SKIPN:
case PHY_COMP_NEQ_SKIPN:
case PHY_SKIPN:
if (index + 1 + regno >= pa->size)
goto out;
break;
default:
dev_err(rtl_fw->dev, "Invalid action 0x%08x\n", action);
return false;
}
}
return true;
out:
dev_err(rtl_fw->dev, "Out of range of firmware\n");
return false;
}
void rtl_fw_write_firmware(struct rtl8169_private *tp, struct rtl_fw *rtl_fw)
{
struct rtl_fw_phy_action *pa = &rtl_fw->phy_action;
rtl_fw_write_t fw_write = rtl_fw->phy_write;
rtl_fw_read_t fw_read = rtl_fw->phy_read;
int predata = 0, count = 0;
size_t index;
for (index = 0; index < pa->size; index++) {
u32 action = le32_to_cpu(pa->code[index]);
u32 data = action & 0x0000ffff;
u32 regno = (action & 0x0fff0000) >> 16;
enum rtl_fw_opcode opcode = action >> 28;
if (!action)
break;
switch (opcode) {
case PHY_READ:
predata = fw_read(tp, regno);
count++;
break;
case PHY_DATA_OR:
predata |= data;
break;
case PHY_DATA_AND:
predata &= data;
break;
case PHY_BJMPN:
index -= (regno + 1);
break;
case PHY_MDIO_CHG:
if (data) {
fw_write = rtl_fw->mac_mcu_write;
fw_read = rtl_fw->mac_mcu_read;
} else {
fw_write = rtl_fw->phy_write;
fw_read = rtl_fw->phy_read;
}
break;
case PHY_CLEAR_READCOUNT:
count = 0;
break;
case PHY_WRITE:
fw_write(tp, regno, data);
break;
case PHY_READCOUNT_EQ_SKIP:
if (count == data)
index++;
break;
case PHY_COMP_EQ_SKIPN:
if (predata == data)
index += regno;
break;
case PHY_COMP_NEQ_SKIPN:
if (predata != data)
index += regno;
break;
case PHY_WRITE_PREVIOUS:
fw_write(tp, regno, predata);
break;
case PHY_SKIPN:
index += regno;
break;
case PHY_DELAY_MS:
msleep(data);
break;
}
}
}
void rtl_fw_release_firmware(struct rtl_fw *rtl_fw)
{
release_firmware(rtl_fw->fw);
}
int rtl_fw_request_firmware(struct rtl_fw *rtl_fw)
{
int rc;
rc = request_firmware(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev);
if (rc < 0)
goto out;
if (!rtl_fw_format_ok(rtl_fw) || !rtl_fw_data_ok(rtl_fw)) {
release_firmware(rtl_fw->fw);
rc = -EINVAL;
goto out;
}
return 0;
out:
dev_err(rtl_fw->dev, "Unable to load firmware %s (%d)\n",
rtl_fw->fw_name, rc);
return rc;
}

View File

@ -0,0 +1,39 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* r8169_firmware.h: RealTek 8169/8168/8101 ethernet driver.
*
* Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
* Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
* Copyright (c) a lot of people too. Please respect their work.
*
* See MAINTAINERS file for support contact information.
*/
#include <linux/device.h>
#include <linux/firmware.h>
struct rtl8169_private;
typedef void (*rtl_fw_write_t)(struct rtl8169_private *tp, int reg, int val);
typedef int (*rtl_fw_read_t)(struct rtl8169_private *tp, int reg);
#define RTL_VER_SIZE 32
struct rtl_fw {
rtl_fw_write_t phy_write;
rtl_fw_read_t phy_read;
rtl_fw_write_t mac_mcu_write;
rtl_fw_read_t mac_mcu_read;
const struct firmware *fw;
const char *fw_name;
struct device *dev;
char version[RTL_VER_SIZE];
struct rtl_fw_phy_action {
__le32 *code;
size_t size;
} phy_action;
};
int rtl_fw_request_firmware(struct rtl_fw *rtl_fw);
void rtl_fw_release_firmware(struct rtl_fw *rtl_fw);
void rtl_fw_write_firmware(struct rtl8169_private *tp, struct rtl_fw *rtl_fw);

View File

@ -0,0 +1,236 @@
// SPDX-License-Identifier: GPL-2.0-only
/* r8169_firmware.c: RealTek 8169/8168/8101 ethernet driver.
*
* Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
* Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
* Copyright (c) a lot of people too. Please respect their work.
*
* See MAINTAINERS file for support contact information.
*/
#include <linux/delay.h>
#include <linux/firmware.h>
#include "r8169_firmware.h"
enum rtl_fw_opcode {
PHY_READ = 0x0,
PHY_DATA_OR = 0x1,
PHY_DATA_AND = 0x2,
PHY_BJMPN = 0x3,
PHY_MDIO_CHG = 0x4,
PHY_CLEAR_READCOUNT = 0x7,
PHY_WRITE = 0x8,
PHY_READCOUNT_EQ_SKIP = 0x9,
PHY_COMP_EQ_SKIPN = 0xa,
PHY_COMP_NEQ_SKIPN = 0xb,
PHY_WRITE_PREVIOUS = 0xc,
PHY_SKIPN = 0xd,
PHY_DELAY_MS = 0xe,
};
struct fw_info {
u32 magic;
char version[RTL_VER_SIZE];
__le32 fw_start;
__le32 fw_len;
u8 chksum;
} __packed;
#define FW_OPCODE_SIZE sizeof_field(struct rtl_fw_phy_action, code[0])
static bool rtl_fw_format_ok(struct rtl_fw *rtl_fw)
{
const struct firmware *fw = rtl_fw->fw;
struct fw_info *fw_info = (struct fw_info *)fw->data;
struct rtl_fw_phy_action *pa = &rtl_fw->phy_action;
if (fw->size < FW_OPCODE_SIZE)
return false;
if (!fw_info->magic) {
size_t i, size, start;
u8 checksum = 0;
if (fw->size < sizeof(*fw_info))
return false;
for (i = 0; i < fw->size; i++)
checksum += fw->data[i];
if (checksum != 0)
return false;
start = le32_to_cpu(fw_info->fw_start);
if (start > fw->size)
return false;
size = le32_to_cpu(fw_info->fw_len);
if (size > (fw->size - start) / FW_OPCODE_SIZE)
return false;
strscpy(rtl_fw->version, fw_info->version, RTL_VER_SIZE);
pa->code = (__le32 *)(fw->data + start);
pa->size = size;
} else {
if (fw->size % FW_OPCODE_SIZE)
return false;
strscpy(rtl_fw->version, rtl_fw->fw_name, RTL_VER_SIZE);
pa->code = (__le32 *)fw->data;
pa->size = fw->size / FW_OPCODE_SIZE;
}
return true;
}
static bool rtl_fw_data_ok(struct rtl_fw *rtl_fw)
{
struct rtl_fw_phy_action *pa = &rtl_fw->phy_action;
size_t index;
for (index = 0; index < pa->size; index++) {
u32 action = le32_to_cpu(pa->code[index]);
u32 val = action & 0x0000ffff;
u32 regno = (action & 0x0fff0000) >> 16;
switch (action >> 28) {
case PHY_READ:
case PHY_DATA_OR:
case PHY_DATA_AND:
case PHY_CLEAR_READCOUNT:
case PHY_WRITE:
case PHY_WRITE_PREVIOUS:
case PHY_DELAY_MS:
break;
case PHY_MDIO_CHG:
if (val > 1)
goto out;
break;
case PHY_BJMPN:
if (regno > index)
goto out;
break;
case PHY_READCOUNT_EQ_SKIP:
if (index + 2 >= pa->size)
goto out;
break;
case PHY_COMP_EQ_SKIPN:
case PHY_COMP_NEQ_SKIPN:
case PHY_SKIPN:
if (index + 1 + regno >= pa->size)
goto out;
break;
default:
dev_err(rtl_fw->dev, "Invalid action 0x%08x\n", action);
return false;
}
}
return true;
out:
dev_err(rtl_fw->dev, "Out of range of firmware\n");
return false;
}
void rtl_fw_write_firmware(struct rtl8169_private *tp, struct rtl_fw *rtl_fw)
{
struct rtl_fw_phy_action *pa = &rtl_fw->phy_action;
rtl_fw_write_t fw_write = rtl_fw->phy_write;
rtl_fw_read_t fw_read = rtl_fw->phy_read;
int predata = 0, count = 0;
size_t index;
for (index = 0; index < pa->size; index++) {
u32 action = le32_to_cpu(pa->code[index]);
u32 data = action & 0x0000ffff;
u32 regno = (action & 0x0fff0000) >> 16;
enum rtl_fw_opcode opcode = action >> 28;
if (!action)
break;
switch (opcode) {
case PHY_READ:
predata = fw_read(tp, regno);
count++;
break;
case PHY_DATA_OR:
predata |= data;
break;
case PHY_DATA_AND:
predata &= data;
break;
case PHY_BJMPN:
index -= (regno + 1);
break;
case PHY_MDIO_CHG:
if (data) {
fw_write = rtl_fw->mac_mcu_write;
fw_read = rtl_fw->mac_mcu_read;
} else {
fw_write = rtl_fw->phy_write;
fw_read = rtl_fw->phy_read;
}
break;
case PHY_CLEAR_READCOUNT:
count = 0;
break;
case PHY_WRITE:
fw_write(tp, regno, data);
break;
case PHY_READCOUNT_EQ_SKIP:
if (count == data)
index++;
break;
case PHY_COMP_EQ_SKIPN:
if (predata == data)
index += regno;
break;
case PHY_COMP_NEQ_SKIPN:
if (predata != data)
index += regno;
break;
case PHY_WRITE_PREVIOUS:
fw_write(tp, regno, predata);
break;
case PHY_SKIPN:
index += regno;
break;
case PHY_DELAY_MS:
msleep(data);
break;
}
}
}
void rtl_fw_release_firmware(struct rtl_fw *rtl_fw)
{
release_firmware(rtl_fw->fw);
}
int rtl_fw_request_firmware(struct rtl_fw *rtl_fw)
{
int rc;
rc = request_firmware(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev);
if (rc < 0)
goto out;
if (!rtl_fw_format_ok(rtl_fw) || !rtl_fw_data_ok(rtl_fw)) {
release_firmware(rtl_fw->fw);
rc = -EINVAL;
goto out;
}
return 0;
out:
dev_err(rtl_fw->dev, "Unable to load firmware %s (%d)\n",
rtl_fw->fw_name, rc);
return rc;
}

View File

@ -0,0 +1,39 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/* r8169_firmware.h: RealTek 8169/8168/8101 ethernet driver.
*
* Copyright (c) 2002 ShuChen <shuchen@realtek.com.tw>
* Copyright (c) 2003 - 2007 Francois Romieu <romieu@fr.zoreil.com>
* Copyright (c) a lot of people too. Please respect their work.
*
* See MAINTAINERS file for support contact information.
*/
#include <linux/device.h>
#include <linux/firmware.h>
struct rtl8169_private;
typedef void (*rtl_fw_write_t)(struct rtl8169_private *tp, int reg, int val);
typedef int (*rtl_fw_read_t)(struct rtl8169_private *tp, int reg);
#define RTL_VER_SIZE 32
struct rtl_fw {
rtl_fw_write_t phy_write;
rtl_fw_read_t phy_read;
rtl_fw_write_t mac_mcu_write;
rtl_fw_read_t mac_mcu_read;
const struct firmware *fw;
const char *fw_name;
struct device *dev;
char version[RTL_VER_SIZE];
struct rtl_fw_phy_action {
__le32 *code;
size_t size;
} phy_action;
};
int rtl_fw_request_firmware(struct rtl_fw *rtl_fw);
void rtl_fw_release_firmware(struct rtl_fw *rtl_fw);
void rtl_fw_write_firmware(struct rtl8169_private *tp, struct rtl_fw *rtl_fw);

View File

@ -0,0 +1,275 @@
// SPDX-License-Identifier: GPL-2.0-only
/* r8169_leds.c: Realtek 8169/8168/8101/8125 ethernet driver.
*
* Copyright (c) 2023 Heiner Kallweit <hkallweit1@gmail.com>
*
* See MAINTAINERS file for support contact information.
*/
#include <linux/leds.h>
#include <linux/netdevice.h>
#include <uapi/linux/uleds.h>
#include "r8169-6.12-ethercat.h"
#define RTL8168_LED_CTRL_OPTION2 BIT(15)
#define RTL8168_LED_CTRL_ACT BIT(3)
#define RTL8168_LED_CTRL_LINK_1000 BIT(2)
#define RTL8168_LED_CTRL_LINK_100 BIT(1)
#define RTL8168_LED_CTRL_LINK_10 BIT(0)
#define RTL8125_LED_CTRL_ACT BIT(9)
#define RTL8125_LED_CTRL_LINK_2500 BIT(5)
#define RTL8125_LED_CTRL_LINK_1000 BIT(3)
#define RTL8125_LED_CTRL_LINK_100 BIT(1)
#define RTL8125_LED_CTRL_LINK_10 BIT(0)
#define RTL8168_NUM_LEDS 3
#define RTL8125_NUM_LEDS 4
struct r8169_led_classdev {
struct led_classdev led;
struct net_device *ndev;
int index;
};
#define lcdev_to_r8169_ldev(lcdev) container_of(lcdev, struct r8169_led_classdev, led)
static bool r8169_trigger_mode_is_valid(unsigned long flags)
{
bool rx, tx;
if (flags & BIT(TRIGGER_NETDEV_HALF_DUPLEX))
return false;
if (flags & BIT(TRIGGER_NETDEV_FULL_DUPLEX))
return false;
rx = flags & BIT(TRIGGER_NETDEV_RX);
tx = flags & BIT(TRIGGER_NETDEV_TX);
return rx == tx;
}
static int rtl8168_led_hw_control_is_supported(struct led_classdev *led_cdev,
unsigned long flags)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
struct rtl8169_private *tp = netdev_priv(ldev->ndev);
int shift = ldev->index * 4;
if (!r8169_trigger_mode_is_valid(flags)) {
/* Switch LED off to indicate that mode isn't supported */
rtl8168_led_mod_ctrl(tp, 0x000f << shift, 0);
return -EOPNOTSUPP;
}
return 0;
}
static int rtl8168_led_hw_control_set(struct led_classdev *led_cdev,
unsigned long flags)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
struct rtl8169_private *tp = netdev_priv(ldev->ndev);
int shift = ldev->index * 4;
u16 mode = 0;
if (flags & BIT(TRIGGER_NETDEV_LINK_10))
mode |= RTL8168_LED_CTRL_LINK_10;
if (flags & BIT(TRIGGER_NETDEV_LINK_100))
mode |= RTL8168_LED_CTRL_LINK_100;
if (flags & BIT(TRIGGER_NETDEV_LINK_1000))
mode |= RTL8168_LED_CTRL_LINK_1000;
if (flags & BIT(TRIGGER_NETDEV_TX))
mode |= RTL8168_LED_CTRL_ACT;
return rtl8168_led_mod_ctrl(tp, 0x000f << shift, mode << shift);
}
static int rtl8168_led_hw_control_get(struct led_classdev *led_cdev,
unsigned long *flags)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
struct rtl8169_private *tp = netdev_priv(ldev->ndev);
int shift = ldev->index * 4;
int mode;
mode = rtl8168_get_led_mode(tp);
if (mode < 0)
return mode;
if (mode & RTL8168_LED_CTRL_OPTION2) {
rtl8168_led_mod_ctrl(tp, RTL8168_LED_CTRL_OPTION2, 0);
netdev_notice(ldev->ndev, "Deactivating unsupported Option2 LED mode\n");
}
mode = (mode >> shift) & 0x000f;
if (mode & RTL8168_LED_CTRL_ACT)
*flags |= BIT(TRIGGER_NETDEV_TX) | BIT(TRIGGER_NETDEV_RX);
if (mode & RTL8168_LED_CTRL_LINK_10)
*flags |= BIT(TRIGGER_NETDEV_LINK_10);
if (mode & RTL8168_LED_CTRL_LINK_100)
*flags |= BIT(TRIGGER_NETDEV_LINK_100);
if (mode & RTL8168_LED_CTRL_LINK_1000)
*flags |= BIT(TRIGGER_NETDEV_LINK_1000);
return 0;
}
static struct device *
r8169_led_hw_control_get_device(struct led_classdev *led_cdev)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
return &ldev->ndev->dev;
}
static void rtl8168_setup_ldev(struct r8169_led_classdev *ldev,
struct net_device *ndev, int index)
{
struct rtl8169_private *tp = netdev_priv(ndev);
struct led_classdev *led_cdev = &ldev->led;
char led_name[LED_MAX_NAME_SIZE];
ldev->ndev = ndev;
ldev->index = index;
r8169_get_led_name(tp, index, led_name, LED_MAX_NAME_SIZE);
led_cdev->name = led_name;
led_cdev->hw_control_trigger = "netdev";
led_cdev->flags |= LED_RETAIN_AT_SHUTDOWN;
led_cdev->hw_control_is_supported = rtl8168_led_hw_control_is_supported;
led_cdev->hw_control_set = rtl8168_led_hw_control_set;
led_cdev->hw_control_get = rtl8168_led_hw_control_get;
led_cdev->hw_control_get_device = r8169_led_hw_control_get_device;
/* ignore errors */
led_classdev_register(&ndev->dev, led_cdev);
}
struct r8169_led_classdev *rtl8168_init_leds(struct net_device *ndev)
{
struct r8169_led_classdev *leds;
int i;
leds = kcalloc(RTL8168_NUM_LEDS + 1, sizeof(*leds), GFP_KERNEL);
if (!leds)
return NULL;
for (i = 0; i < RTL8168_NUM_LEDS; i++)
rtl8168_setup_ldev(leds + i, ndev, i);
return leds;
}
static int rtl8125_led_hw_control_is_supported(struct led_classdev *led_cdev,
unsigned long flags)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
struct rtl8169_private *tp = netdev_priv(ldev->ndev);
if (!r8169_trigger_mode_is_valid(flags)) {
/* Switch LED off to indicate that mode isn't supported */
rtl8125_set_led_mode(tp, ldev->index, 0);
return -EOPNOTSUPP;
}
return 0;
}
static int rtl8125_led_hw_control_set(struct led_classdev *led_cdev,
unsigned long flags)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
struct rtl8169_private *tp = netdev_priv(ldev->ndev);
u16 mode = 0;
if (flags & BIT(TRIGGER_NETDEV_LINK_10))
mode |= RTL8125_LED_CTRL_LINK_10;
if (flags & BIT(TRIGGER_NETDEV_LINK_100))
mode |= RTL8125_LED_CTRL_LINK_100;
if (flags & BIT(TRIGGER_NETDEV_LINK_1000))
mode |= RTL8125_LED_CTRL_LINK_1000;
if (flags & BIT(TRIGGER_NETDEV_LINK_2500))
mode |= RTL8125_LED_CTRL_LINK_2500;
if (flags & (BIT(TRIGGER_NETDEV_TX) | BIT(TRIGGER_NETDEV_RX)))
mode |= RTL8125_LED_CTRL_ACT;
return rtl8125_set_led_mode(tp, ldev->index, mode);
}
static int rtl8125_led_hw_control_get(struct led_classdev *led_cdev,
unsigned long *flags)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
struct rtl8169_private *tp = netdev_priv(ldev->ndev);
int mode;
mode = rtl8125_get_led_mode(tp, ldev->index);
if (mode < 0)
return mode;
if (mode & RTL8125_LED_CTRL_LINK_10)
*flags |= BIT(TRIGGER_NETDEV_LINK_10);
if (mode & RTL8125_LED_CTRL_LINK_100)
*flags |= BIT(TRIGGER_NETDEV_LINK_100);
if (mode & RTL8125_LED_CTRL_LINK_1000)
*flags |= BIT(TRIGGER_NETDEV_LINK_1000);
if (mode & RTL8125_LED_CTRL_LINK_2500)
*flags |= BIT(TRIGGER_NETDEV_LINK_2500);
if (mode & RTL8125_LED_CTRL_ACT)
*flags |= BIT(TRIGGER_NETDEV_TX) | BIT(TRIGGER_NETDEV_RX);
return 0;
}
static void rtl8125_setup_led_ldev(struct r8169_led_classdev *ldev,
struct net_device *ndev, int index)
{
struct rtl8169_private *tp = netdev_priv(ndev);
struct led_classdev *led_cdev = &ldev->led;
char led_name[LED_MAX_NAME_SIZE];
ldev->ndev = ndev;
ldev->index = index;
r8169_get_led_name(tp, index, led_name, LED_MAX_NAME_SIZE);
led_cdev->name = led_name;
led_cdev->hw_control_trigger = "netdev";
led_cdev->flags |= LED_RETAIN_AT_SHUTDOWN;
led_cdev->hw_control_is_supported = rtl8125_led_hw_control_is_supported;
led_cdev->hw_control_set = rtl8125_led_hw_control_set;
led_cdev->hw_control_get = rtl8125_led_hw_control_get;
led_cdev->hw_control_get_device = r8169_led_hw_control_get_device;
/* ignore errors */
led_classdev_register(&ndev->dev, led_cdev);
}
struct r8169_led_classdev *rtl8125_init_leds(struct net_device *ndev)
{
struct r8169_led_classdev *leds;
int i;
leds = kcalloc(RTL8125_NUM_LEDS + 1, sizeof(*leds), GFP_KERNEL);
if (!leds)
return NULL;
for (i = 0; i < RTL8125_NUM_LEDS; i++)
rtl8125_setup_led_ldev(leds + i, ndev, i);
return leds;
}
void r8169_remove_leds(struct r8169_led_classdev *leds)
{
if (!leds)
return;
for (struct r8169_led_classdev *l = leds; l->ndev; l++)
led_classdev_unregister(&l->led);
kfree(leds);
}

View File

@ -0,0 +1,275 @@
// SPDX-License-Identifier: GPL-2.0-only
/* r8169_leds.c: Realtek 8169/8168/8101/8125 ethernet driver.
*
* Copyright (c) 2023 Heiner Kallweit <hkallweit1@gmail.com>
*
* See MAINTAINERS file for support contact information.
*/
#include <linux/leds.h>
#include <linux/netdevice.h>
#include <uapi/linux/uleds.h>
#include "r8169.h"
#define RTL8168_LED_CTRL_OPTION2 BIT(15)
#define RTL8168_LED_CTRL_ACT BIT(3)
#define RTL8168_LED_CTRL_LINK_1000 BIT(2)
#define RTL8168_LED_CTRL_LINK_100 BIT(1)
#define RTL8168_LED_CTRL_LINK_10 BIT(0)
#define RTL8125_LED_CTRL_ACT BIT(9)
#define RTL8125_LED_CTRL_LINK_2500 BIT(5)
#define RTL8125_LED_CTRL_LINK_1000 BIT(3)
#define RTL8125_LED_CTRL_LINK_100 BIT(1)
#define RTL8125_LED_CTRL_LINK_10 BIT(0)
#define RTL8168_NUM_LEDS 3
#define RTL8125_NUM_LEDS 4
struct r8169_led_classdev {
struct led_classdev led;
struct net_device *ndev;
int index;
};
#define lcdev_to_r8169_ldev(lcdev) container_of(lcdev, struct r8169_led_classdev, led)
static bool r8169_trigger_mode_is_valid(unsigned long flags)
{
bool rx, tx;
if (flags & BIT(TRIGGER_NETDEV_HALF_DUPLEX))
return false;
if (flags & BIT(TRIGGER_NETDEV_FULL_DUPLEX))
return false;
rx = flags & BIT(TRIGGER_NETDEV_RX);
tx = flags & BIT(TRIGGER_NETDEV_TX);
return rx == tx;
}
static int rtl8168_led_hw_control_is_supported(struct led_classdev *led_cdev,
unsigned long flags)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
struct rtl8169_private *tp = netdev_priv(ldev->ndev);
int shift = ldev->index * 4;
if (!r8169_trigger_mode_is_valid(flags)) {
/* Switch LED off to indicate that mode isn't supported */
rtl8168_led_mod_ctrl(tp, 0x000f << shift, 0);
return -EOPNOTSUPP;
}
return 0;
}
static int rtl8168_led_hw_control_set(struct led_classdev *led_cdev,
unsigned long flags)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
struct rtl8169_private *tp = netdev_priv(ldev->ndev);
int shift = ldev->index * 4;
u16 mode = 0;
if (flags & BIT(TRIGGER_NETDEV_LINK_10))
mode |= RTL8168_LED_CTRL_LINK_10;
if (flags & BIT(TRIGGER_NETDEV_LINK_100))
mode |= RTL8168_LED_CTRL_LINK_100;
if (flags & BIT(TRIGGER_NETDEV_LINK_1000))
mode |= RTL8168_LED_CTRL_LINK_1000;
if (flags & BIT(TRIGGER_NETDEV_TX))
mode |= RTL8168_LED_CTRL_ACT;
return rtl8168_led_mod_ctrl(tp, 0x000f << shift, mode << shift);
}
static int rtl8168_led_hw_control_get(struct led_classdev *led_cdev,
unsigned long *flags)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
struct rtl8169_private *tp = netdev_priv(ldev->ndev);
int shift = ldev->index * 4;
int mode;
mode = rtl8168_get_led_mode(tp);
if (mode < 0)
return mode;
if (mode & RTL8168_LED_CTRL_OPTION2) {
rtl8168_led_mod_ctrl(tp, RTL8168_LED_CTRL_OPTION2, 0);
netdev_notice(ldev->ndev, "Deactivating unsupported Option2 LED mode\n");
}
mode = (mode >> shift) & 0x000f;
if (mode & RTL8168_LED_CTRL_ACT)
*flags |= BIT(TRIGGER_NETDEV_TX) | BIT(TRIGGER_NETDEV_RX);
if (mode & RTL8168_LED_CTRL_LINK_10)
*flags |= BIT(TRIGGER_NETDEV_LINK_10);
if (mode & RTL8168_LED_CTRL_LINK_100)
*flags |= BIT(TRIGGER_NETDEV_LINK_100);
if (mode & RTL8168_LED_CTRL_LINK_1000)
*flags |= BIT(TRIGGER_NETDEV_LINK_1000);
return 0;
}
static struct device *
r8169_led_hw_control_get_device(struct led_classdev *led_cdev)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
return &ldev->ndev->dev;
}
static void rtl8168_setup_ldev(struct r8169_led_classdev *ldev,
struct net_device *ndev, int index)
{
struct rtl8169_private *tp = netdev_priv(ndev);
struct led_classdev *led_cdev = &ldev->led;
char led_name[LED_MAX_NAME_SIZE];
ldev->ndev = ndev;
ldev->index = index;
r8169_get_led_name(tp, index, led_name, LED_MAX_NAME_SIZE);
led_cdev->name = led_name;
led_cdev->hw_control_trigger = "netdev";
led_cdev->flags |= LED_RETAIN_AT_SHUTDOWN;
led_cdev->hw_control_is_supported = rtl8168_led_hw_control_is_supported;
led_cdev->hw_control_set = rtl8168_led_hw_control_set;
led_cdev->hw_control_get = rtl8168_led_hw_control_get;
led_cdev->hw_control_get_device = r8169_led_hw_control_get_device;
/* ignore errors */
led_classdev_register(&ndev->dev, led_cdev);
}
struct r8169_led_classdev *rtl8168_init_leds(struct net_device *ndev)
{
struct r8169_led_classdev *leds;
int i;
leds = kcalloc(RTL8168_NUM_LEDS + 1, sizeof(*leds), GFP_KERNEL);
if (!leds)
return NULL;
for (i = 0; i < RTL8168_NUM_LEDS; i++)
rtl8168_setup_ldev(leds + i, ndev, i);
return leds;
}
static int rtl8125_led_hw_control_is_supported(struct led_classdev *led_cdev,
unsigned long flags)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
struct rtl8169_private *tp = netdev_priv(ldev->ndev);
if (!r8169_trigger_mode_is_valid(flags)) {
/* Switch LED off to indicate that mode isn't supported */
rtl8125_set_led_mode(tp, ldev->index, 0);
return -EOPNOTSUPP;
}
return 0;
}
static int rtl8125_led_hw_control_set(struct led_classdev *led_cdev,
unsigned long flags)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
struct rtl8169_private *tp = netdev_priv(ldev->ndev);
u16 mode = 0;
if (flags & BIT(TRIGGER_NETDEV_LINK_10))
mode |= RTL8125_LED_CTRL_LINK_10;
if (flags & BIT(TRIGGER_NETDEV_LINK_100))
mode |= RTL8125_LED_CTRL_LINK_100;
if (flags & BIT(TRIGGER_NETDEV_LINK_1000))
mode |= RTL8125_LED_CTRL_LINK_1000;
if (flags & BIT(TRIGGER_NETDEV_LINK_2500))
mode |= RTL8125_LED_CTRL_LINK_2500;
if (flags & (BIT(TRIGGER_NETDEV_TX) | BIT(TRIGGER_NETDEV_RX)))
mode |= RTL8125_LED_CTRL_ACT;
return rtl8125_set_led_mode(tp, ldev->index, mode);
}
static int rtl8125_led_hw_control_get(struct led_classdev *led_cdev,
unsigned long *flags)
{
struct r8169_led_classdev *ldev = lcdev_to_r8169_ldev(led_cdev);
struct rtl8169_private *tp = netdev_priv(ldev->ndev);
int mode;
mode = rtl8125_get_led_mode(tp, ldev->index);
if (mode < 0)
return mode;
if (mode & RTL8125_LED_CTRL_LINK_10)
*flags |= BIT(TRIGGER_NETDEV_LINK_10);
if (mode & RTL8125_LED_CTRL_LINK_100)
*flags |= BIT(TRIGGER_NETDEV_LINK_100);
if (mode & RTL8125_LED_CTRL_LINK_1000)
*flags |= BIT(TRIGGER_NETDEV_LINK_1000);
if (mode & RTL8125_LED_CTRL_LINK_2500)
*flags |= BIT(TRIGGER_NETDEV_LINK_2500);
if (mode & RTL8125_LED_CTRL_ACT)
*flags |= BIT(TRIGGER_NETDEV_TX) | BIT(TRIGGER_NETDEV_RX);
return 0;
}
static void rtl8125_setup_led_ldev(struct r8169_led_classdev *ldev,
struct net_device *ndev, int index)
{
struct rtl8169_private *tp = netdev_priv(ndev);
struct led_classdev *led_cdev = &ldev->led;
char led_name[LED_MAX_NAME_SIZE];
ldev->ndev = ndev;
ldev->index = index;
r8169_get_led_name(tp, index, led_name, LED_MAX_NAME_SIZE);
led_cdev->name = led_name;
led_cdev->hw_control_trigger = "netdev";
led_cdev->flags |= LED_RETAIN_AT_SHUTDOWN;
led_cdev->hw_control_is_supported = rtl8125_led_hw_control_is_supported;
led_cdev->hw_control_set = rtl8125_led_hw_control_set;
led_cdev->hw_control_get = rtl8125_led_hw_control_get;
led_cdev->hw_control_get_device = r8169_led_hw_control_get_device;
/* ignore errors */
led_classdev_register(&ndev->dev, led_cdev);
}
struct r8169_led_classdev *rtl8125_init_leds(struct net_device *ndev)
{
struct r8169_led_classdev *leds;
int i;
leds = kcalloc(RTL8125_NUM_LEDS + 1, sizeof(*leds), GFP_KERNEL);
if (!leds)
return NULL;
for (i = 0; i < RTL8125_NUM_LEDS; i++)
rtl8125_setup_led_ldev(leds + i, ndev, i);
return leds;
}
void r8169_remove_leds(struct r8169_led_classdev *leds)
{
if (!leds)
return;
for (struct r8169_led_classdev *l = leds; l->ndev; l++)
led_classdev_unregister(&l->led);
kfree(leds);
}

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

30
devices/r8169/update.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
if [ $# -ne 3 ]; then
echo "Need 3 arguments: 1) kernel source dir, 2) previous version, 3) version to add"
exit 1
fi
KERNELDIR=$1
PREVER=$2
KERNELVER=$3
set -x
for f in $KERNELDIR/drivers/net/ethernet/realtek/r8169*; do
echo Driver $f
b=$(basename $f)
o=${b/\./-$KERNELVER-orig.}
e=${b/\./-$KERNELVER-ethercat.}
cp -v $f $o
chmod 644 $o
cp -v $o $e
op=${b/\./-$PREVER-orig.}
ep=${b/\./-$PREVER-ethercat.}
diff -u $op $ep | patch -p1 $e
sed -i s/$PREVER-ethercat.h/$KERNELVER-ethercat.h/ $e
git add $o $e
echo -e "\t$e \\\\\n\t$o \\\\" >> Makefile.am
done
echo "Remember to update Makefile.am!"

View File

@ -24,290 +24,292 @@ include $(top_srcdir)/Makefile.kbuild
EXTRA_DIST = \
chain_mode-6.1-ethercat.c \
chain_mode-6.1-orig.c \
chain_mode-6.4-ethercat.c \
chain_mode-6.4-orig.c \
chain_mode-6.12-ethercat.c \
chain_mode-6.12-orig.c \
chain_mode-6.4-ethercat.c \
chain_mode-6.4-orig.c \
common-6.1-ethercat.h \
common-6.1-orig.h \
common-6.4-ethercat.h \
common-6.4-orig.h \
common-6.12-ethercat.h \
common-6.12-orig.h \
common-6.4-ethercat.h \
common-6.4-orig.h \
descs-6.1-ethercat.h \
descs-6.1-orig.h \
descs-6.4-ethercat.h \
descs-6.4-orig.h \
descs-6.12-ethercat.h \
descs-6.12-orig.h \
descs-6.4-ethercat.h \
descs-6.4-orig.h \
descs_com-6.1-ethercat.h \
descs_com-6.1-orig.h \
descs_com-6.4-ethercat.h \
descs_com-6.4-orig.h \
descs_com-6.12-ethercat.h \
descs_com-6.12-orig.h \
dwmac4-6.1-ethercat.h \
dwmac4-6.1-orig.h \
dwmac4-6.4-ethercat.h \
dwmac4-6.4-orig.h \
dwmac4-6.12-ethercat.h \
dwmac4-6.12-orig.h \
dwmac4_core-6.1-ethercat.c \
dwmac4_core-6.1-orig.c \
dwmac4_core-6.4-ethercat.c \
dwmac4_core-6.4-orig.c \
dwmac4_core-6.12-ethercat.c \
dwmac4_core-6.12-orig.c \
dwmac4_descs-6.1-ethercat.c \
dwmac4_descs-6.1-ethercat.h \
dwmac4_descs-6.1-orig.c \
dwmac4_descs-6.1-orig.h \
dwmac4_descs-6.4-ethercat.c \
dwmac4_descs-6.4-ethercat.h \
dwmac4_descs-6.4-orig.c \
dwmac4_descs-6.4-orig.h \
dwmac4_descs-6.12-ethercat.c \
dwmac4_descs-6.12-ethercat.h \
dwmac4_descs-6.12-orig.c \
dwmac4_descs-6.12-orig.h \
dwmac4_dma-6.1-ethercat.c \
dwmac4_dma-6.1-ethercat.h \
dwmac4_dma-6.1-orig.c \
dwmac4_dma-6.1-orig.h \
dwmac4_dma-6.4-ethercat.c \
dwmac4_dma-6.4-ethercat.h \
dwmac4_dma-6.4-orig.c \
dwmac4_dma-6.4-orig.h \
dwmac4_dma-6.12-ethercat.c \
dwmac4_dma-6.12-ethercat.h \
dwmac4_dma-6.12-orig.c \
dwmac4_dma-6.12-orig.h \
dwmac4_lib-6.1-ethercat.c \
dwmac4_lib-6.1-orig.c \
dwmac4_lib-6.4-ethercat.c \
dwmac4_lib-6.4-orig.c \
dwmac4_lib-6.12-ethercat.c \
dwmac4_lib-6.12-orig.c \
dwmac5-6.1-ethercat.c \
dwmac5-6.1-ethercat.h \
dwmac5-6.1-orig.c \
dwmac5-6.1-orig.h \
dwmac5-6.4-ethercat.c \
dwmac5-6.4-ethercat.h \
dwmac5-6.4-orig.c \
dwmac5-6.4-orig.h \
dwmac5-6.12-ethercat.c \
dwmac5-6.12-ethercat.h \
dwmac5-6.12-orig.c \
dwmac5-6.12-orig.h \
dwmac100-6.1-ethercat.h \
dwmac100-6.1-orig.h \
dwmac100-6.4-ethercat.h \
dwmac100-6.4-orig.h \
dwmac100-6.12-ethercat.h \
dwmac100-6.12-orig.h \
dwmac100_core-6.1-ethercat.c \
dwmac100_core-6.1-orig.c \
dwmac100_core-6.4-ethercat.c \
dwmac100_core-6.4-orig.c \
dwmac100_core-6.12-ethercat.c \
dwmac100_core-6.12-orig.c \
dwmac100_dma-6.1-ethercat.c \
dwmac100_dma-6.1-orig.c \
dwmac100_dma-6.4-ethercat.c \
dwmac100_dma-6.4-orig.c \
dwmac100_dma-6.12-ethercat.c \
dwmac100_dma-6.12-orig.c \
dwmac1000-6.1-ethercat.h \
dwmac1000-6.1-orig.h \
dwmac1000-6.4-ethercat.h \
dwmac1000-6.4-orig.h \
dwmac1000-6.12-ethercat.h \
dwmac1000-6.12-orig.h \
dwmac1000_core-6.1-ethercat.c \
dwmac1000_core-6.1-orig.c \
dwmac1000_core-6.4-ethercat.c \
dwmac1000_core-6.4-orig.c \
dwmac1000_core-6.12-ethercat.c \
dwmac1000_core-6.12-orig.c \
dwmac1000_dma-6.1-ethercat.c \
dwmac1000_dma-6.1-orig.c \
dwmac1000_dma-6.4-ethercat.c \
dwmac1000_dma-6.4-orig.c \
dwmac1000_dma-6.12-ethercat.c \
dwmac1000_dma-6.12-orig.c \
descs_com-6.4-ethercat.h \
descs_com-6.4-orig.h \
dwmac-intel-6.1-ethercat.c \
dwmac-intel-6.1-ethercat.h \
dwmac-intel-6.1-orig.c \
dwmac-intel-6.1-orig.h \
dwmac-intel-6.4-ethercat.c \
dwmac-intel-6.4-ethercat.h \
dwmac-intel-6.4-orig.c \
dwmac-intel-6.4-orig.h \
dwmac-intel-6.12-ethercat.c \
dwmac-intel-6.12-ethercat.h \
dwmac-intel-6.12-orig.c \
dwmac-intel-6.12-orig.h \
dwmac-intel-6.4-ethercat.c \
dwmac-intel-6.4-ethercat.h \
dwmac-intel-6.4-orig.c \
dwmac-intel-6.4-orig.h \
dwmac100-6.1-ethercat.h \
dwmac100-6.1-orig.h \
dwmac100-6.12-ethercat.h \
dwmac100-6.12-orig.h \
dwmac100-6.4-ethercat.h \
dwmac100-6.4-orig.h \
dwmac1000-6.1-ethercat.h \
dwmac1000-6.1-orig.h \
dwmac1000-6.12-ethercat.h \
dwmac1000-6.12-orig.h \
dwmac1000-6.4-ethercat.h \
dwmac1000-6.4-orig.h \
dwmac1000_core-6.1-ethercat.c \
dwmac1000_core-6.1-orig.c \
dwmac1000_core-6.12-ethercat.c \
dwmac1000_core-6.12-orig.c \
dwmac1000_core-6.4-ethercat.c \
dwmac1000_core-6.4-orig.c \
dwmac1000_dma-6.1-ethercat.c \
dwmac1000_dma-6.1-orig.c \
dwmac1000_dma-6.12-ethercat.c \
dwmac1000_dma-6.12-orig.c \
dwmac1000_dma-6.4-ethercat.c \
dwmac1000_dma-6.4-orig.c \
dwmac100_core-6.1-ethercat.c \
dwmac100_core-6.1-orig.c \
dwmac100_core-6.12-ethercat.c \
dwmac100_core-6.12-orig.c \
dwmac100_core-6.4-ethercat.c \
dwmac100_core-6.4-orig.c \
dwmac100_dma-6.1-ethercat.c \
dwmac100_dma-6.1-orig.c \
dwmac100_dma-6.12-ethercat.c \
dwmac100_dma-6.12-orig.c \
dwmac100_dma-6.4-ethercat.c \
dwmac100_dma-6.4-orig.c \
dwmac4-6.1-ethercat.h \
dwmac4-6.1-orig.h \
dwmac4-6.12-ethercat.h \
dwmac4-6.12-orig.h \
dwmac4-6.4-ethercat.h \
dwmac4-6.4-orig.h \
dwmac4_core-6.1-ethercat.c \
dwmac4_core-6.1-orig.c \
dwmac4_core-6.12-ethercat.c \
dwmac4_core-6.12-orig.c \
dwmac4_core-6.4-ethercat.c \
dwmac4_core-6.4-orig.c \
dwmac4_descs-6.1-ethercat.c \
dwmac4_descs-6.1-ethercat.h \
dwmac4_descs-6.1-orig.c \
dwmac4_descs-6.1-orig.h \
dwmac4_descs-6.12-ethercat.c \
dwmac4_descs-6.12-ethercat.h \
dwmac4_descs-6.12-orig.c \
dwmac4_descs-6.12-orig.h \
dwmac4_descs-6.4-ethercat.c \
dwmac4_descs-6.4-ethercat.h \
dwmac4_descs-6.4-orig.c \
dwmac4_descs-6.4-orig.h \
dwmac4_dma-6.1-ethercat.c \
dwmac4_dma-6.1-ethercat.h \
dwmac4_dma-6.1-orig.c \
dwmac4_dma-6.1-orig.h \
dwmac4_dma-6.12-ethercat.c \
dwmac4_dma-6.12-ethercat.h \
dwmac4_dma-6.12-orig.c \
dwmac4_dma-6.12-orig.h \
dwmac4_dma-6.4-ethercat.c \
dwmac4_dma-6.4-ethercat.h \
dwmac4_dma-6.4-orig.c \
dwmac4_dma-6.4-orig.h \
dwmac4_lib-6.1-ethercat.c \
dwmac4_lib-6.1-orig.c \
dwmac4_lib-6.12-ethercat.c \
dwmac4_lib-6.12-orig.c \
dwmac4_lib-6.4-ethercat.c \
dwmac4_lib-6.4-orig.c \
dwmac5-6.1-ethercat.c \
dwmac5-6.1-ethercat.h \
dwmac5-6.1-orig.c \
dwmac5-6.1-orig.h \
dwmac5-6.12-ethercat.c \
dwmac5-6.12-ethercat.h \
dwmac5-6.12-orig.c \
dwmac5-6.12-orig.h \
dwmac5-6.4-ethercat.c \
dwmac5-6.4-ethercat.h \
dwmac5-6.4-orig.c \
dwmac5-6.4-orig.h \
dwmac_dma-6.1-ethercat.h \
dwmac_dma-6.1-ethercat.h \
dwmac_dma-6.1-orig.h \
dwmac_dma-6.4-ethercat.h \
dwmac_dma-6.4-orig.h \
dwmac_dma-6.1-orig.h \
dwmac_dma-6.12-ethercat.h \
dwmac_dma-6.12-orig.h \
dwmac_dma-6.4-ethercat.h \
dwmac_dma-6.4-orig.h \
dwmac_lib-6.1-ethercat.c \
dwmac_lib-6.1-orig.c \
dwmac_lib-6.4-ethercat.c \
dwmac_lib-6.4-orig.c \
dwmac_lib-6.12-ethercat.c \
dwmac_lib-6.12-orig.c \
dwmac_lib-6.4-ethercat.c \
dwmac_lib-6.4-orig.c \
dwxgmac2-6.1-ethercat.h \
dwxgmac2-6.1-orig.h \
dwxgmac2-6.4-ethercat.h \
dwxgmac2-6.4-orig.h \
dwxgmac2-6.12-ethercat.h \
dwxgmac2-6.12-orig.h \
dwxgmac2-6.4-ethercat.h \
dwxgmac2-6.4-orig.h \
dwxgmac2_core-6.1-ethercat.c \
dwxgmac2_core-6.1-orig.c \
dwxgmac2_core-6.4-ethercat.c \
dwxgmac2_core-6.4-orig.c \
dwxgmac2_core-6.12-ethercat.c \
dwxgmac2_core-6.12-orig.c \
dwxgmac2_core-6.4-ethercat.c \
dwxgmac2_core-6.4-orig.c \
dwxgmac2_descs-6.1-ethercat.c \
dwxgmac2_descs-6.1-orig.c \
dwxgmac2_descs-6.4-ethercat.c \
dwxgmac2_descs-6.4-orig.c \
dwxgmac2_descs-6.12-ethercat.c \
dwxgmac2_descs-6.12-orig.c \
dwxgmac2_descs-6.4-ethercat.c \
dwxgmac2_descs-6.4-orig.c \
dwxgmac2_dma-6.1-ethercat.c \
dwxgmac2_dma-6.1-orig.c \
dwxgmac2_dma-6.4-ethercat.c \
dwxgmac2_dma-6.4-orig.c \
dwxgmac2_dma-6.12-ethercat.c \
dwxgmac2_dma-6.12-orig.c \
dwxgmac2_dma-6.4-ethercat.c \
dwxgmac2_dma-6.4-orig.c \
dwxlgmac2-6.1-ethercat.h \
dwxlgmac2-6.1-orig.h \
dwxlgmac2-6.4-ethercat.h \
dwxlgmac2-6.4-orig.h \
dwxlgmac2-6.12-ethercat.h \
dwxlgmac2-6.12-orig.h \
dwxlgmac2-6.4-ethercat.h \
dwxlgmac2-6.4-orig.h \
enh_desc-6.1-ethercat.c \
enh_desc-6.1-orig.c \
enh_desc-6.4-ethercat.c \
enh_desc-6.4-orig.c \
enh_desc-6.12-ethercat.c \
enh_desc-6.12-orig.c \
enh_desc-6.4-ethercat.c \
enh_desc-6.4-orig.c \
hwif-6.1-ethercat.c \
hwif-6.1-ethercat.h \
hwif-6.1-orig.c \
hwif-6.1-orig.h \
hwif-6.4-ethercat.c \
hwif-6.4-ethercat.h \
hwif-6.4-orig.c \
hwif-6.4-orig.h \
hwif-6.12-ethercat.c \
hwif-6.12-ethercat.h \
hwif-6.12-orig.c \
hwif-6.12-orig.h \
hwif-6.4-ethercat.c \
hwif-6.4-ethercat.h \
hwif-6.4-orig.c \
hwif-6.4-orig.h \
mmc-6.1-ethercat.h \
mmc-6.1-orig.h \
mmc-6.4-ethercat.h \
mmc-6.4-orig.h \
mmc-6.12-ethercat.h \
mmc-6.12-orig.h \
mmc-6.4-ethercat.h \
mmc-6.4-orig.h \
mmc_core-6.1-ethercat.c \
mmc_core-6.1-orig.c \
mmc_core-6.4-ethercat.c \
mmc_core-6.4-orig.c \
mmc_core-6.12-ethercat.c \
mmc_core-6.12-orig.c \
mmc_core-6.4-ethercat.c \
mmc_core-6.4-orig.c \
norm_desc-6.1-ethercat.c \
norm_desc-6.1-orig.c \
norm_desc-6.4-ethercat.c \
norm_desc-6.4-orig.c \
norm_desc-6.12-ethercat.c \
norm_desc-6.12-orig.c \
norm_desc-6.4-ethercat.c \
norm_desc-6.4-orig.c \
ring_mode-6.1-ethercat.c \
ring_mode-6.1-orig.c \
ring_mode-6.4-ethercat.c \
ring_mode-6.4-orig.c \
ring_mode-6.12-ethercat.c \
ring_mode-6.12-orig.c \
ring_mode-6.4-ethercat.c \
ring_mode-6.4-orig.c \
stmmac-6.1-ethercat.h \
stmmac-6.1-orig.h \
stmmac-6.4-ethercat.h \
stmmac-6.4-orig.h \
stmmac-6.12-ethercat.h \
stmmac-6.12-orig.h \
stmmac-6.4-ethercat.h \
stmmac-6.4-orig.h \
stmmac_est-6.12-ethercat.c \
stmmac_est-6.12-ethercat.h \
stmmac_est-6.12-orig.c \
stmmac_est-6.12-orig.h \
stmmac_ethtool-6.1-ethercat.c \
stmmac_ethtool-6.1-orig.c \
stmmac_ethtool-6.4-ethercat.c \
stmmac_ethtool-6.4-orig.c \
stmmac_ethtool-6.12-ethercat.c \
stmmac_ethtool-6.12-orig.c \
stmmac_ethtool-6.4-ethercat.c \
stmmac_ethtool-6.4-orig.c \
stmmac_hwtstamp-6.1-ethercat.c \
stmmac_hwtstamp-6.1-orig.c \
stmmac_hwtstamp-6.4-ethercat.c \
stmmac_hwtstamp-6.4-orig.c \
stmmac_hwtstamp-6.12-ethercat.c \
stmmac_hwtstamp-6.12-orig.c \
stmmac_hwtstamp-6.4-ethercat.c \
stmmac_hwtstamp-6.4-orig.c \
stmmac_main-6.1-ethercat.c \
stmmac_main-6.1-orig.c \
stmmac_main-6.4-ethercat.c \
stmmac_main-6.4-orig.c \
stmmac_main-6.12-ethercat.c \
stmmac_main-6.12-orig.c \
stmmac_main-6.4-ethercat.c \
stmmac_main-6.4-orig.c \
stmmac_mdio-6.1-ethercat.c \
stmmac_mdio-6.1-orig.c \
stmmac_mdio-6.4-ethercat.c \
stmmac_mdio-6.4-orig.c \
stmmac_mdio-6.12-ethercat.c \
stmmac_mdio-6.12-orig.c \
stmmac_mdio-6.4-ethercat.c \
stmmac_mdio-6.4-orig.c \
stmmac_pci-6.1-ethercat.c \
stmmac_pci-6.1-orig.c \
stmmac_pci-6.4-ethercat.c \
stmmac_pci-6.4-orig.c \
stmmac_pci-6.12-ethercat.c \
stmmac_pci-6.12-orig.c \
stmmac_pci-6.4-ethercat.c \
stmmac_pci-6.4-orig.c \
stmmac_pcs-6.1-ethercat.h \
stmmac_pcs-6.1-orig.h \
stmmac_pcs-6.4-ethercat.h \
stmmac_pcs-6.4-orig.h \
stmmac_pcs-6.12-ethercat.h \
stmmac_pcs-6.12-orig.h \
stmmac_pcs-6.4-ethercat.h \
stmmac_pcs-6.4-orig.h \
stmmac_ptp-6.1-ethercat.c \
stmmac_ptp-6.1-ethercat.h \
stmmac_ptp-6.1-orig.c \
stmmac_ptp-6.1-orig.h \
stmmac_ptp-6.4-ethercat.c \
stmmac_ptp-6.4-ethercat.h \
stmmac_ptp-6.4-orig.c \
stmmac_ptp-6.4-orig.h \
stmmac_ptp-6.12-ethercat.c \
stmmac_ptp-6.12-ethercat.h \
stmmac_ptp-6.12-orig.c \
stmmac_ptp-6.12-orig.h \
stmmac_ptp-6.4-ethercat.c \
stmmac_ptp-6.4-ethercat.h \
stmmac_ptp-6.4-orig.c \
stmmac_ptp-6.4-orig.h \
stmmac_tc-6.1-ethercat.c \
stmmac_tc-6.1-orig.c \
stmmac_tc-6.4-ethercat.c \
stmmac_tc-6.4-orig.c \
stmmac_tc-6.12-ethercat.c \
stmmac_tc-6.12-orig.c \
stmmac_tc-6.4-ethercat.c \
stmmac_tc-6.4-orig.c \
stmmac_xdp-6.1-ethercat.c \
stmmac_xdp-6.1-ethercat.h \
stmmac_xdp-6.1-orig.c \
stmmac_xdp-6.1-orig.h \
stmmac_xdp-6.4-ethercat.c \
stmmac_xdp-6.4-ethercat.h \
stmmac_xdp-6.4-orig.c \
stmmac_xdp-6.4-orig.h \
stmmac_xdp-6.12-ethercat.c \
stmmac_xdp-6.12-ethercat.h \
stmmac_xdp-6.12-orig.c \
stmmac_xdp-6.12-orig.h \
stmmac_xdp-6.4-ethercat.c \
stmmac_xdp-6.4-ethercat.h \
stmmac_xdp-6.4-orig.c \
stmmac_xdp-6.4-orig.h \
update.sh
#-----------------------------------------------------------------------------

View File

@ -1,12 +1,17 @@
#!/bin/bash
if [ $# -ne 3 ]; then
echo "Need 3 arguments: 1) kernel source dir, 2) previous version, 3) version to add"
exit 1
fi
KERNELDIR=$1
PREVER=$2
KERNELVER=$3
set -x
KERNELDIR=/vol/data/kernel/linux-5.10.186
KERNELVER=5.10
PREVER=4.4
for f in $KERNELDIR/drivers/net/ethernet/{realtek/8139too,realtek/r8169,intel/e100}.c; do
for f in $KERNELDIR/drivers/net/ethernet/{realtek/8139too.c,intel/e100.c}; do
echo Driver $f
b=$(basename $f)
o=${b/\./-$KERNELVER-orig.}
@ -18,4 +23,7 @@ for f in $KERNELDIR/drivers/net/ethernet/{realtek/8139too,realtek/r8169,intel/e1
ep=${b/\./-$PREVER-ethercat.}
diff -u $op $ep | patch -p1 $e
git add $o $e
echo -e "\t$e \\\\\n\t$o \\\\" >> Makefile.am
done
echo "Remember to update Makefile.am!"