1/*- 2 * Copyright (c) 2001 Wind River Systems 3 * Copyright (c) 1997, 1998, 1999, 2001 4 * Bill Paul <wpaul@windriver.com>. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 18 unchanged lines hidden (view full) --- 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/dev/bge/if_bge.c 241388 2012-10-10 01:24:02Z yongari $"); |
36 37/* 38 * Broadcom BCM570x family gigabit ethernet driver for FreeBSD. 39 * 40 * The Broadcom BCM5700 is based on technology originally developed by 41 * Alteon Networks as part of the Tigon I and Tigon II gigabit ethernet 42 * MAC chips. The BCM5700, sometimes referred to as the Tigon III, has 43 * two on-board MIPS R4000 CPUs and can have as much as 16MB of external --- 1417 unchanged lines hidden (view full) --- 1461 } 1462 1463 /* 1464 * Set up the PCI DMA control register. 1465 */ 1466 dma_rw_ctl = BGE_PCIDMARWCTL_RD_CMD_SHIFT(6) | 1467 BGE_PCIDMARWCTL_WR_CMD_SHIFT(7); 1468 if (sc->bge_flags & BGE_FLAG_PCIE) { |
1469 if (sc->bge_mps >= 256) 1470 dma_rw_ctl |= BGE_PCIDMARWCTL_WR_WAT_SHIFT(7); 1471 else 1472 dma_rw_ctl |= BGE_PCIDMARWCTL_WR_WAT_SHIFT(3); |
1473 } else if (sc->bge_flags & BGE_FLAG_PCIX) { 1474 if (BGE_IS_5714_FAMILY(sc)) { 1475 /* 256 bytes for read and write. */ 1476 dma_rw_ctl |= BGE_PCIDMARWCTL_RD_WAT_SHIFT(2) | 1477 BGE_PCIDMARWCTL_WR_WAT_SHIFT(2); 1478 dma_rw_ctl |= (sc->bge_asicrev == BGE_ASICREV_BCM5780) ? 1479 BGE_PCIDMARWCTL_ONEDMA_ATONCE_GLOBAL : 1480 BGE_PCIDMARWCTL_ONEDMA_ATONCE_LOCAL; --- 1677 unchanged lines hidden (view full) --- 3158 */ 3159 if (pci_find_cap(dev, PCIY_EXPRESS, ®) == 0) { 3160 /* 3161 * Found a PCI Express capabilities register, this 3162 * must be a PCI Express device. 3163 */ 3164 sc->bge_flags |= BGE_FLAG_PCIE; 3165 sc->bge_expcap = reg; |
3166 /* Extract supported maximum payload size. */ 3167 sc->bge_mps = pci_read_config(dev, sc->bge_expcap + 3168 PCIER_DEVICE_CAP, 2); 3169 sc->bge_mps = 128 << (sc->bge_mps & PCIEM_CAP_MAX_PAYLOAD); |
3170 if (sc->bge_asicrev == BGE_ASICREV_BCM5719 || 3171 sc->bge_asicrev == BGE_ASICREV_BCM5720) |
3172 sc->bge_expmrq = 2048; 3173 else 3174 sc->bge_expmrq = 4096; 3175 pci_set_max_read_req(dev, sc->bge_expmrq); |
3176 } else { 3177 /* 3178 * Check if the device is in PCI-X Mode. 3179 * (This bit is not valid on PCI Express controllers.) 3180 */ 3181 if (pci_find_cap(dev, PCIY_PCIX, ®) == 0) 3182 sc->bge_pcixcap = reg; 3183 if ((pci_read_config(dev, BGE_PCI_PCISTATE, 4) & --- 460 unchanged lines hidden (view full) --- 3644 } 3645 devctl = pci_read_config(dev, 3646 sc->bge_expcap + PCIER_DEVICE_CTL, 2); 3647 /* Clear enable no snoop and disable relaxed ordering. */ 3648 devctl &= ~(PCIEM_CTL_RELAXED_ORD_ENABLE | 3649 PCIEM_CTL_NOSNOOP_ENABLE); 3650 pci_write_config(dev, sc->bge_expcap + PCIER_DEVICE_CTL, 3651 devctl, 2); |
3652 pci_set_max_read_req(dev, sc->bge_expmrq); |
3653 /* Clear error status. */ 3654 pci_write_config(dev, sc->bge_expcap + PCIER_DEVICE_STA, 3655 PCIEM_STA_CORRECTABLE_ERROR | 3656 PCIEM_STA_NON_FATAL_ERROR | PCIEM_STA_FATAL_ERROR | 3657 PCIEM_STA_UNSUPPORTED_REQ, 2); 3658 } 3659 3660 /* Reset some of the PCI state that got zapped by reset. */ --- 2548 unchanged lines hidden --- |