From 04eb0cef68496548960901d65a2b715262420f69 Mon Sep 17 00:00:00 2001 From: Sepherosa Ziehau Date: Thu, 5 Jul 2012 15:22:42 +0800 Subject: [PATCH] em/emx: Correct ASPM settings for 82571/82572/82573 --- sys/dev/netif/em/if_em.c | 34 +++++++++++++++++++++++++++------- sys/dev/netif/emx/if_emx.c | 26 +++++++++++++++++++++++--- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/sys/dev/netif/em/if_em.c b/sys/dev/netif/em/if_em.c index 7174210df2..6abf0f7aa4 100644 --- a/sys/dev/netif/em/if_em.c +++ b/sys/dev/netif/em/if_em.c @@ -4135,20 +4135,38 @@ em_set_itr(struct adapter *adapter, uint32_t itr) } } -/* - * Disable the L0s, Errata #20 - */ static void em_disable_aspm(struct adapter *adapter) { - uint16_t link_cap, link_ctrl; + uint16_t link_cap, link_ctrl, disable; uint8_t pcie_ptr, reg; device_t dev = adapter->dev; switch (adapter->hw.mac.type) { + case e1000_82571: + case e1000_82572: case e1000_82573: + /* + * 82573 specification update + * #8 disable L0s + * #41 disable L1 + * + * 82571/82572 specification update + # #13 disable L1 + * #68 disable L0s + */ + disable = PCIEM_LNKCTL_ASPM_L0S | PCIEM_LNKCTL_ASPM_L1; + break; + case e1000_82574: case e1000_82583: + /* + * 82574 specification update #20 + * 82583 specification update #9 + * + * There is no need to disable L1 + */ + disable = PCIEM_LNKCTL_ASPM_L0S; break; default: @@ -4163,11 +4181,13 @@ em_disable_aspm(struct adapter *adapter) if ((link_cap & PCIEM_LNKCAP_ASPM_MASK) == 0) return; - if (bootverbose) - if_printf(&adapter->arpcom.ac_if, "disable L0s\n"); + if (bootverbose) { + if_printf(&adapter->arpcom.ac_if, + "disable ASPM %#02x\n", disable); + } reg = pcie_ptr + PCIER_LINKCTRL; link_ctrl = pci_read_config(dev, reg, 2); - link_ctrl &= ~PCIEM_LNKCTL_ASPM_L0S; + link_ctrl &= ~disable; pci_write_config(dev, reg, link_ctrl, 2); } diff --git a/sys/dev/netif/emx/if_emx.c b/sys/dev/netif/emx/if_emx.c index baca0ca098..4e24936b16 100644 --- a/sys/dev/netif/emx/if_emx.c +++ b/sys/dev/netif/emx/if_emx.c @@ -3746,13 +3746,33 @@ emx_set_itr(struct emx_softc *sc, uint32_t itr) static void emx_disable_aspm(struct emx_softc *sc) { - uint16_t link_cap, link_ctrl; + uint16_t link_cap, link_ctrl, disable; uint8_t pcie_ptr, reg; device_t dev = sc->dev; switch (sc->hw.mac.type) { + case e1000_82571: + case e1000_82572: case e1000_82573: + /* + * 82573 specification update + * #8 disable L0s + * #41 disable L1 + * + * 82571/82572 specification update + # #13 disable L1 + * #68 disable L0s + */ + disable = PCIEM_LNKCTL_ASPM_L0S | PCIEM_LNKCTL_ASPM_L1; + break; + case e1000_82574: + /* + * 82574 specification update #20 + * + * There is no need to disable L1 + */ + disable = PCIEM_LNKCTL_ASPM_L0S; break; default: @@ -3768,10 +3788,10 @@ emx_disable_aspm(struct emx_softc *sc) return; if (bootverbose) - if_printf(&sc->arpcom.ac_if, "disable L0s\n"); + if_printf(&sc->arpcom.ac_if, "disable ASPM %#02x\n", disable); reg = pcie_ptr + PCIER_LINKCTRL; link_ctrl = pci_read_config(dev, reg, 2); - link_ctrl &= ~PCIEM_LNKCTL_ASPM_L0S; + link_ctrl &= ~disable; pci_write_config(dev, reg, link_ctrl, 2); } -- 2.41.0