diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2006-12-06 23:25:59 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2006-12-06 23:25:59 +0000 |
commit | 52c2140848df1b8c9e690b5e2749b0b980851fcf (patch) | |
tree | 925de09a0023fd75e7d7a908913c9ea451dbd282 /sys/dev/pci/if_em.c | |
parent | a00f964bb0548c03ef9a902ee64eb1cd90758328 (diff) |
Implement em_read_pcie_cap_reg(), where we set the max read size on
PCIe to 4k.
>From kmacy@FreeBSD
Tested by mk@ and Johan Mson Lindman <tybollt at solace dot mh dot se>
with the 82573 chipset.
ok brad@ mglocker@ mk@
Diffstat (limited to 'sys/dev/pci/if_em.c')
-rw-r--r-- | sys/dev/pci/if_em.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index fed9a28c7cf..13709d601d5 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.161 2006/12/04 14:35:20 reyk Exp $ */ +/* $OpenBSD: if_em.c,v 1.162 2006/12/06 23:25:58 reyk Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include <dev/pci/if_em.h> @@ -2776,14 +2776,26 @@ em_pci_clear_mwi(struct em_hw *hw) (hw->pci_cmd_word & ~CMD_MEM_WRT_INVALIDATE)); } -/* - * We may eventually really do this, but its unnecessary - * for now so we just return unsupported. - */ int32_t em_read_pcie_cap_reg(struct em_hw *hw, uint32_t reg, uint16_t *value) { - return (0); + struct pci_attach_args *pa = &((struct em_osdep *)hw->back)->em_pa; + int32_t rc; + u_int16_t pectl; + + /* find the PCIe link width and set max read request to 4KB */ + if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_PCIEXPRESS, + NULL, NULL) != 0) { + em_read_pci_cfg(hw, reg + 0x12, value); + + em_read_pci_cfg(hw, reg + 0x8, &pectl); + pectl = (pectl & ~0x7000) | (5 << 12); + em_write_pci_cfg(hw, reg + 0x8, &pectl); + rc = 0; + } else + rc = -1; + + return (rc); } /********************************************************************* |