-/* $OpenBSD: rtl81x9reg.h,v 1.90 2015/01/20 04:33:06 brad Exp $ */
+/* $OpenBSD: rtl81x9reg.h,v 1.91 2015/01/26 09:58:47 brad Exp $ */
/*
* Copyright (c) 1997, 1998
bus_space_handle_t rl_bhandle; /* bus space handle */
bus_space_tag_t rl_btag; /* bus space tag */
bus_dma_tag_t sc_dmat;
+ u_int32_t rl_expcap;
bus_dma_segment_t sc_rx_seg;
bus_dmamap_t sc_rx_dmamap;
struct arpcom sc_arpcom; /* interface info */
-/* $OpenBSD: if_re_pci.c,v 1.44 2014/12/22 02:28:52 tedu Exp $ */
+/* $OpenBSD: if_re_pci.c,v 1.45 2015/01/26 09:58:47 brad Exp $ */
/*
* Copyright (c) 2005 Peter Valchev <pvalchev@openbsd.org>
pci_chipset_tag_t pc = pa->pa_pc;
pci_intr_handle_t ih;
const char *intrstr = NULL;
+ pcireg_t reg;
+ int rrs;
pci_set_powerstate(pa->pa_pc, pa->pa_tag, PCI_PMCSR_STATE_D0);
* PCI Express check.
*/
if (pci_get_capability(pc, pa->pa_tag, PCI_CAP_PCIEXPRESS,
- NULL, NULL))
+ &sc->rl_expcap, NULL)) {
+ if (!(PCI_VENDOR(pa->pa_id) == PCI_VENDOR_REALTEK &&
+ PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_REALTEK_RT8101E)) {
+ /* Set PCIe maximum read request size to 2048. */
+ reg = pci_conf_read(pa->pa_pc, pa->pa_tag,
+ sc->rl_expcap + PCI_PCIE_DCSR);
+ reg = (reg & ~PCI_PCIE_DCSR_MPS);
+ reg >>= 12;
+ rrs = (1 << (reg + 7));
+ if (rrs < 2048) {
+ reg = pci_conf_read(pa->pa_pc, pa->pa_tag,
+ sc->rl_expcap + PCI_PCIE_DCSR);
+ reg = (reg & ~PCI_PCIE_DCSR_MPS) |
+ (fls(2048) - 8) << 12;
+ pci_conf_write(pa->pa_pc, pa->pa_tag,
+ sc->rl_expcap + PCI_PCIE_DCSR, 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)) {