Author: yongari
Date: Mon Aug 22 01:19:05 2016
New Revision: 304575
URL: https://svnweb.freebsd.org/changeset/base/304575

Log:
  Add Killer E2400 Gigabit Ethernet support.
  It seems Killer E2200/E2400 has a BIOS misconfiguration or silicon
  bug which triggers DMA write errors when driver uses advertised
  maximum payload size.  Force the maximum payload size to 128 bytes
  in DMA configuration.
  This change should fix occasional DMA write errors reported on
  Killer E2200.
  
  Tested by:    <psy0...@sys-tek.org>

Modified:
  head/sys/dev/alc/if_alc.c
  head/sys/dev/alc/if_alcreg.h
  head/sys/dev/pci/pci.c

Modified: head/sys/dev/alc/if_alc.c
==============================================================================
--- head/sys/dev/alc/if_alc.c   Mon Aug 22 01:06:54 2016        (r304574)
+++ head/sys/dev/alc/if_alc.c   Mon Aug 22 01:19:05 2016        (r304575)
@@ -121,6 +121,8 @@ static struct alc_ident alc_ident_table[
                "Atheros AR8172 PCIe Fast Ethernet" },
        { VENDORID_ATHEROS, DEVICEID_ATHEROS_E2200, 9 * 1024,
                "Killer E2200 Gigabit Ethernet" },
+       { VENDORID_ATHEROS, DEVICEID_ATHEROS_E2400, 9 * 1024,
+               "Killer E2400 Gigabit Ethernet" },
        { 0, 0, 0, NULL}
 };
 
@@ -1080,6 +1082,7 @@ alc_phy_down(struct alc_softc *sc)
        switch (sc->alc_ident->deviceid) {
        case DEVICEID_ATHEROS_AR8161:
        case DEVICEID_ATHEROS_E2200:
+       case DEVICEID_ATHEROS_E2400:
        case DEVICEID_ATHEROS_AR8162:
        case DEVICEID_ATHEROS_AR8171:
        case DEVICEID_ATHEROS_AR8172:
@@ -1397,12 +1400,15 @@ alc_attach(device_t dev)
         * shows the same PHY model/revision number of AR8131.
         */
        switch (sc->alc_ident->deviceid) {
+       case DEVICEID_ATHEROS_E2200:
+       case DEVICEID_ATHEROS_E2400:
+               sc->alc_flags |= ALC_FLAG_E2X00;
+               /* FALLTHROUGH */
        case DEVICEID_ATHEROS_AR8161:
                if (pci_get_subvendor(dev) == VENDORID_ATHEROS &&
                    pci_get_subdevice(dev) == 0x0091 && sc->alc_rev == 0)
                        sc->alc_flags |= ALC_FLAG_LINK_WAR;
                /* FALLTHROUGH */
-       case DEVICEID_ATHEROS_E2200:
        case DEVICEID_ATHEROS_AR8171:
                sc->alc_flags |= ALC_FLAG_AR816X_FAMILY;
                break;
@@ -1473,6 +1479,12 @@ alc_attach(device_t dev)
                        sc->alc_dma_rd_burst = 3;
                if (alc_dma_burst[sc->alc_dma_wr_burst] > 1024)
                        sc->alc_dma_wr_burst = 3;
+               /*
+                * Force maximum payload size to 128 bytes for E2200/E2400.
+                * Otherwise it triggers DMA write error.
+                */
+               if ((sc->alc_flags & ALC_FLAG_E2X00) != 0)
+                       sc->alc_dma_wr_burst = 0;
                alc_init_pcie(sc);
        }
 

Modified: head/sys/dev/alc/if_alcreg.h
==============================================================================
--- head/sys/dev/alc/if_alcreg.h        Mon Aug 22 01:06:54 2016        
(r304574)
+++ head/sys/dev/alc/if_alcreg.h        Mon Aug 22 01:19:05 2016        
(r304575)
@@ -45,10 +45,11 @@
 #define        DEVICEID_ATHEROS_AR8152_B       0x2060  /* L2C V1.1 */
 #define        DEVICEID_ATHEROS_AR8152_B2      0x2062  /* L2C V2.0 */
 #define        DEVICEID_ATHEROS_AR8161         0x1091
-#define        DEVICEID_ATHEROS_E2200          0xE091
 #define        DEVICEID_ATHEROS_AR8162         0x1090
 #define        DEVICEID_ATHEROS_AR8171         0x10A1
 #define        DEVICEID_ATHEROS_AR8172         0x10A0
+#define        DEVICEID_ATHEROS_E2200          0xE091
+#define        DEVICEID_ATHEROS_E2400          0xE0A1
 
 #define        ATHEROS_AR8152_B_V10            0xC0
 #define        ATHEROS_AR8152_B_V11            0xC1

Modified: head/sys/dev/pci/pci.c
==============================================================================
--- head/sys/dev/pci/pci.c      Mon Aug 22 01:06:54 2016        (r304574)
+++ head/sys/dev/pci/pci.c      Mon Aug 22 01:19:05 2016        (r304575)
@@ -281,12 +281,13 @@ static const struct pci_quirk pci_quirks
        { 0x43851002, PCI_QUIRK_UNMAP_REG,      0x14,   0 },
 
        /*
-        * Atheros AR8161/AR8162/E2200 Ethernet controllers have a bug that
-        * MSI interrupt does not assert if PCIM_CMD_INTxDIS bit of the
-        * command register is set.
+        * Atheros AR8161/AR8162/E2200/E2400 Ethernet controllers have a
+        * bug that MSI interrupt does not assert if PCIM_CMD_INTxDIS bit
+        * of the command register is set.
         */
        { 0x10911969, PCI_QUIRK_MSI_INTX_BUG,   0,      0 },
        { 0xE0911969, PCI_QUIRK_MSI_INTX_BUG,   0,      0 },
+       { 0xE0A11969, PCI_QUIRK_MSI_INTX_BUG,   0,      0 },
        { 0x10901969, PCI_QUIRK_MSI_INTX_BUG,   0,      0 },
 
        /*
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to