diff options
author | Kevin Lo <kevlo@cvs.openbsd.org> | 2017-06-12 03:00:27 +0000 |
---|---|---|
committer | Kevin Lo <kevlo@cvs.openbsd.org> | 2017-06-12 03:00:27 +0000 |
commit | 8ab4587ca0fab4b0c14e8896707fdc47de0f2b9f (patch) | |
tree | e445f80d038c94564a88e254500537586f2a85d8 /sys/dev/pci/if_re_pci.c | |
parent | 2dd53aa4756f52d9393623099ee938336172a777 (diff) |
From FreeBSD (r227593, r307982):
More and more RealTek controllers started to implement EEE feature.
Vendor driver seems to load a kind of firmware for EEE with
additional PHY fixups. It is known that the EEE feature may need
ASPM support. Unfortunately there is no documentation for EEE of
the controller so enabling ASPM may cause more problems.
The Realtek vendor drivers for FreeBSD and Linux also disable ASPM and
clock request. While here, add a define for the ECPM (Enable Clock Power
Management) bit.
Tested by stsp@ and myself.
ok stsp@
Diffstat (limited to 'sys/dev/pci/if_re_pci.c')
-rw-r--r-- | sys/dev/pci/if_re_pci.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/dev/pci/if_re_pci.c b/sys/dev/pci/if_re_pci.c index 8a29f45cc93..84d1f3f2b04 100644 --- a/sys/dev/pci/if_re_pci.c +++ b/sys/dev/pci/if_re_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_re_pci.c,v 1.50 2015/12/28 05:49:15 jmatthew Exp $ */ +/* $OpenBSD: if_re_pci.c,v 1.51 2017/06/12 03:00:26 kevlo Exp $ */ /* * Copyright (c) 2005 Peter Valchev <pvalchev@openbsd.org> @@ -128,6 +128,8 @@ re_pci_attach(struct device *parent, struct device *self, void *aux) pci_chipset_tag_t pc = pa->pa_pc; pci_intr_handle_t ih; const char *intrstr = NULL; + pcireg_t reg; + int offset; pci_set_powerstate(pa->pa_pc, pa->pa_tag, PCI_PMCSR_STATE_D0); @@ -172,8 +174,14 @@ re_pci_attach(struct device *parent, struct device *self, void *aux) * PCI Express check. */ if (pci_get_capability(pc, pa->pa_tag, PCI_CAP_PCIEXPRESS, - NULL, NULL)) + &offset, NULL)) { + /* Disable PCIe ASPM and ECPM. */ + reg = pci_conf_read(pc, pa->pa_tag, offset + PCI_PCIE_LCSR); + reg &= ~(PCI_PCIE_LCSR_ASPM_L0S | PCI_PCIE_LCSR_ASPM_L1 | + PCI_PCIE_LCSR_ECPM); + pci_conf_write(pc, pa->pa_tag, offset + PCI_PCIE_LCSR, reg); sc->rl_flags |= RL_FLAG_PCIE; + } if (!(PCI_VENDOR(pa->pa_id) == PCI_VENDOR_REALTEK && PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_REALTEK_RT8139)) { |