etherfabric.c File Reference

#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <assert.h>
#include <byteswap.h>
#include <console.h>
#include <gpxe/io.h>
#include <gpxe/pci.h>
#include <gpxe/malloc.h>
#include <gpxe/ethernet.h>
#include <gpxe/iobuf.h>
#include <gpxe/netdevice.h>
#include <gpxe/timer.h>
#include <mii.h>
#include "etherfabric.h"
#include "etherfabric_nic.h"

Go to the source code of this file.

Data Structures

struct  falcon_nv_config_ver2
struct  falcon_nv_extra

Defines

#define EFAB_REGDUMP(...)
#define EFAB_TRACE(...)   DBGP(__VA_ARGS__)
#define EFAB_LOG(...)   DBG(__VA_ARGS__)
#define EFAB_ERR(...)   DBG(__VA_ARGS__)
#define FALCON_USE_IO_BAR   0
#define HZ   100
#define EFAB_BYTE   1
#define FQS(_prefix, _x)
#define EFAB_MAX_FRAME_LEN(mtu)   ( ( ( ( mtu ) + 4/* FCS */ ) + 7 ) & ~7 )
#define GMII_PSSR   0x11
#define LPA_EF_1000FULL   0x00020000
#define LPA_EF_1000HALF   0x00010000
#define LPA_EF_10000FULL   0x00040000
#define LPA_EF_10000HALF   0x00080000
#define LPA_100   (LPA_100FULL | LPA_100HALF | LPA_100BASE4)
#define LPA_EF_1000   ( LPA_EF_1000FULL | LPA_EF_1000HALF )
#define LPA_EF_10000   ( LPA_EF_10000FULL | LPA_EF_10000HALF )
#define LPA_EF_DUPLEX
#define LPA_OTHER
#define PSSR_LSTATUS   0x0400
#define MDIO_MMD_PMAPMD   (1)
#define MDIO_MMD_WIS   (2)
#define MDIO_MMD_PCS   (3)
#define MDIO_MMD_PHYXS   (4)
#define MDIO_MMD_DTEXS   (5)
#define MDIO_MMD_TC   (6)
#define MDIO_MMD_AN   (7)
#define MDIO_MMDREG_CTRL1   (0)
#define MDIO_MMDREG_STAT1   (1)
#define MDIO_MMDREG_DEVS0   (5)
#define MDIO_MMDREG_STAT2   (8)
#define MDIO_MMDREG_CTRL1_RESET_LBN   (15)
#define MDIO_MMDREG_CTRL1_RESET_WIDTH   (1)
#define MDIO_MMDREG_STAT1_FAULT_LBN   (7)
#define MDIO_MMDREG_STAT1_FAULT_WIDTH   (1)
#define MDIO_MMDREG_STAT1_LINK_LBN   (2)
#define MDIO_MMDREG_STAT1_LINK_WIDTH   (1)
#define DEV_PRESENT_BIT(_b)   (1 << _b)
#define MDIO_MMDREG_DEVS0_DTEXS   DEV_PRESENT_BIT(MDIO_MMD_DTEXS)
#define MDIO_MMDREG_DEVS0_PHYXS   DEV_PRESENT_BIT(MDIO_MMD_PHYXS)
#define MDIO_MMDREG_DEVS0_PCS   DEV_PRESENT_BIT(MDIO_MMD_PCS)
#define MDIO_MMDREG_DEVS0_WIS   DEV_PRESENT_BIT(MDIO_MMD_WIS)
#define MDIO_MMDREG_DEVS0_PMAPMD   DEV_PRESENT_BIT(MDIO_MMD_PMAPMD)
#define MDIO_MMDREG_DEVS0_AN   DEV_PRESENT_BIT(MDIO_MMD_AN)
#define MDIO_MMDREG_STAT2_PRESENT_VAL   (2)
#define MDIO_MMDREG_STAT2_PRESENT_LBN   (14)
#define MDIO_MMDREG_STAT2_PRESENT_WIDTH   (2)
#define MDIO_PHYXS_LANE_STATE   (0x18)
#define MDIO_PHYXS_LANE_ALIGNED_LBN   (12)
#define MDIO_PHYXS_LANE_SYNC0_LBN   (0)
#define MDIO_PHYXS_LANE_SYNC1_LBN   (1)
#define MDIO_PHYXS_LANE_SYNC2_LBN   (2)
#define MDIO_PHYXS_LANE_SYNC3_LBN   (3)
#define MDIO45_RESET_TRIES   100
#define MDIO45_RESET_SPINTIME   10
#define FCN_IOM_IND_ADR_REG   0x0
#define FCN_IOM_IND_DAT_REG   0x4
#define FCN_ADR_REGION_REG_KER   0x00
#define FCN_ADR_REGION0_LBN   0
#define FCN_ADR_REGION0_WIDTH   18
#define FCN_ADR_REGION1_LBN   32
#define FCN_ADR_REGION1_WIDTH   18
#define FCN_ADR_REGION2_LBN   64
#define FCN_ADR_REGION2_WIDTH   18
#define FCN_ADR_REGION3_LBN   96
#define FCN_ADR_REGION3_WIDTH   18
#define FCN_INT_EN_REG_KER   0x0010
#define FCN_MEM_PERR_INT_EN_KER_LBN   5
#define FCN_MEM_PERR_INT_EN_KER_WIDTH   1
#define FCN_KER_INT_CHAR_LBN   4
#define FCN_KER_INT_CHAR_WIDTH   1
#define FCN_KER_INT_KER_LBN   3
#define FCN_KER_INT_KER_WIDTH   1
#define FCN_ILL_ADR_ERR_INT_EN_KER_LBN   2
#define FCN_ILL_ADR_ERR_INT_EN_KER_WIDTH   1
#define FCN_SRM_PERR_INT_EN_KER_LBN   1
#define FCN_SRM_PERR_INT_EN_KER_WIDTH   1
#define FCN_DRV_INT_EN_KER_LBN   0
#define FCN_DRV_INT_EN_KER_WIDTH   1
#define FCN_INT_ADR_REG_KER   0x0030
#define FCN_INT_ADR_KER_LBN   0
#define FCN_INT_ADR_KER_WIDTH   EFAB_DMA_TYPE_WIDTH ( 64 )
#define INT_ISR0_B0   0x90
#define INT_ISR1_B0   0xA0
#define FCN_INT_ACK_KER_REG_A1   0x0050
#define INT_ACK_DUMMY_DATA_LBN   0
#define INT_ACK_DUMMY_DATA_WIDTH   32
#define WORK_AROUND_BROKEN_PCI_READS_REG_KER_A1   0x0070
#define FCN_HW_INIT_REG_KER   0x00c0
#define FCN_BCSR_TARGET_MASK_LBN   101
#define FCN_BCSR_TARGET_MASK_WIDTH   4
#define FCN_EE_SPI_HCMD_REG   0x0100
#define FCN_EE_SPI_HCMD_CMD_EN_LBN   31
#define FCN_EE_SPI_HCMD_CMD_EN_WIDTH   1
#define FCN_EE_WR_TIMER_ACTIVE_LBN   28
#define FCN_EE_WR_TIMER_ACTIVE_WIDTH   1
#define FCN_EE_SPI_HCMD_SF_SEL_LBN   24
#define FCN_EE_SPI_HCMD_SF_SEL_WIDTH   1
#define FCN_EE_SPI_EEPROM   0
#define FCN_EE_SPI_FLASH   1
#define FCN_EE_SPI_HCMD_DABCNT_LBN   16
#define FCN_EE_SPI_HCMD_DABCNT_WIDTH   5
#define FCN_EE_SPI_HCMD_READ_LBN   15
#define FCN_EE_SPI_HCMD_READ_WIDTH   1
#define FCN_EE_SPI_READ   1
#define FCN_EE_SPI_WRITE   0
#define FCN_EE_SPI_HCMD_DUBCNT_LBN   12
#define FCN_EE_SPI_HCMD_DUBCNT_WIDTH   2
#define FCN_EE_SPI_HCMD_ADBCNT_LBN   8
#define FCN_EE_SPI_HCMD_ADBCNT_WIDTH   2
#define FCN_EE_SPI_HCMD_ENC_LBN   0
#define FCN_EE_SPI_HCMD_ENC_WIDTH   8
#define FCN_EE_SPI_HADR_REG   0x0110
#define FCN_EE_SPI_HADR_DUBYTE_LBN   24
#define FCN_EE_SPI_HADR_DUBYTE_WIDTH   8
#define FCN_EE_SPI_HADR_ADR_LBN   0
#define FCN_EE_SPI_HADR_ADR_WIDTH   24
#define FCN_EE_SPI_HDATA_REG   0x0120
#define FCN_EE_SPI_HDATA3_LBN   96
#define FCN_EE_SPI_HDATA3_WIDTH   32
#define FCN_EE_SPI_HDATA2_LBN   64
#define FCN_EE_SPI_HDATA2_WIDTH   32
#define FCN_EE_SPI_HDATA1_LBN   32
#define FCN_EE_SPI_HDATA1_WIDTH   32
#define FCN_EE_SPI_HDATA0_LBN   0
#define FCN_EE_SPI_HDATA0_WIDTH   32
#define FCN_EE_VPD_CFG_REG   0x0140
#define FCN_EE_VPD_EN_LBN   0
#define FCN_EE_VPD_EN_WIDTH   1
#define FCN_EE_VPD_EN_AD9_MODE_LBN   1
#define FCN_EE_VPD_EN_AD9_MODE_WIDTH   1
#define FCN_EE_EE_CLOCK_DIV_LBN   112
#define FCN_EE_EE_CLOCK_DIV_WIDTH   7
#define FCN_EE_SF_CLOCK_DIV_LBN   120
#define FCN_EE_SF_CLOCK_DIV_WIDTH   7
#define FCN_NIC_STAT_REG   0x0200
#define FCN_ONCHIP_SRAM_LBN   16
#define FCN_ONCHIP_SRAM_WIDTH   1
#define FCN_SF_PRST_LBN   9
#define FCN_SF_PRST_WIDTH   1
#define FCN_EE_PRST_LBN   8
#define FCN_EE_PRST_WIDTH   1
#define FCN_EE_STRAP_LBN   7
#define FCN_EE_STRAP_WIDTH   1
#define FCN_PCI_PCIX_MODE_LBN   4
#define FCN_PCI_PCIX_MODE_WIDTH   3
#define FCN_PCI_PCIX_MODE_PCI33_DECODE   0
#define FCN_PCI_PCIX_MODE_PCI66_DECODE   1
#define FCN_PCI_PCIX_MODE_PCIX66_DECODE   5
#define FCN_PCI_PCIX_MODE_PCIX100_DECODE   6
#define FCN_PCI_PCIX_MODE_PCIX133_DECODE   7
#define FCN_STRAP_ISCSI_EN_LBN   3
#define FCN_STRAP_ISCSI_EN_WIDTH   1
#define FCN_STRAP_PINS_LBN   0
#define FCN_STRAP_PINS_WIDTH   3
#define FCN_STRAP_10G_LBN   2
#define FCN_STRAP_10G_WIDTH   1
#define FCN_STRAP_DUAL_PORT_LBN   1
#define FCN_STRAP_DUAL_PORT_WIDTH   1
#define FCN_STRAP_PCIE_LBN   0
#define FCN_STRAP_PCIE_WIDTH   1
#define FALCON_REV_A0   0
#define FALCON_REV_A1   1
#define FALCON_REV_B0   2
#define FCN_GPIO_CTL_REG_KER   0x0210
#define FCN_GPIO_CTL_REG_KER   0x0210
#define FCN_GPIO3_OEN_LBN   27
#define FCN_GPIO3_OEN_WIDTH   1
#define FCN_GPIO2_OEN_LBN   26
#define FCN_GPIO2_OEN_WIDTH   1
#define FCN_GPIO1_OEN_LBN   25
#define FCN_GPIO1_OEN_WIDTH   1
#define FCN_GPIO0_OEN_LBN   24
#define FCN_GPIO0_OEN_WIDTH   1
#define FCN_GPIO3_OUT_LBN   19
#define FCN_GPIO3_OUT_WIDTH   1
#define FCN_GPIO2_OUT_LBN   18
#define FCN_GPIO2_OUT_WIDTH   1
#define FCN_GPIO1_OUT_LBN   17
#define FCN_GPIO1_OUT_WIDTH   1
#define FCN_GPIO0_OUT_LBN   16
#define FCN_GPIO0_OUT_WIDTH   1
#define FCN_GPIO3_IN_LBN   11
#define FCN_GPIO3_IN_WIDTH   1
#define FCN_GPIO2_IN_LBN   10
#define FCN_GPIO2_IN_WIDTH   1
#define FCN_GPIO1_IN_LBN   9
#define FCN_GPIO1_IN_WIDTH   1
#define FCN_GPIO0_IN_LBN   8
#define FCN_GPIO0_IN_WIDTH   1
#define FCN_FLASH_PRESENT_LBN   7
#define FCN_FLASH_PRESENT_WIDTH   1
#define FCN_EEPROM_PRESENT_LBN   6
#define FCN_EEPROM_PRESENT_WIDTH   1
#define FCN_BOOTED_USING_NVDEVICE_LBN   3
#define FCN_BOOTED_USING_NVDEVICE_WIDTH   1
#define FCN_NV_MAGIC_NUMBER   0xFA1C
#define FCN_GLB_CTL_REG_KER   0x0220
#define FCN_EXT_PHY_RST_CTL_LBN   63
#define FCN_EXT_PHY_RST_CTL_WIDTH   1
#define FCN_PCIE_SD_RST_CTL_LBN   61
#define FCN_PCIE_SD_RST_CTL_WIDTH   1
#define FCN_PCIE_STCK_RST_CTL_LBN   59
#define FCN_PCIE_STCK_RST_CTL_WIDTH   1
#define FCN_PCIE_NSTCK_RST_CTL_LBN   58
#define FCN_PCIE_NSTCK_RST_CTL_WIDTH   1
#define FCN_PCIE_CORE_RST_CTL_LBN   57
#define FCN_PCIE_CORE_RST_CTL_WIDTH   1
#define FCN_EE_RST_CTL_LBN   49
#define FCN_EE_RST_CTL_WIDTH   1
#define FCN_RST_EXT_PHY_LBN   31
#define FCN_RST_EXT_PHY_WIDTH   1
#define FCN_EXT_PHY_RST_DUR_LBN   1
#define FCN_EXT_PHY_RST_DUR_WIDTH   3
#define FCN_SWRST_LBN   0
#define FCN_SWRST_WIDTH   1
#define INCLUDE_IN_RESET   0
#define EXCLUDE_FROM_RESET   1
#define FCN_ALTERA_BUILD_REG_KER   0x0300
#define FCN_VER_MAJOR_LBN   24
#define FCN_VER_MAJOR_WIDTH   8
#define FCN_VER_MINOR_LBN   16
#define FCN_VER_MINOR_WIDTH   8
#define FCN_VER_BUILD_LBN   0
#define FCN_VER_BUILD_WIDTH   16
#define FCN_VER_ALL_LBN   0
#define FCN_VER_ALL_WIDTH   32
#define FCN_SPARE_REG_KER   0x310
#define FCN_MEM_PERR_EN_TX_DATA_LBN   72
#define FCN_MEM_PERR_EN_TX_DATA_WIDTH   2
#define FCN_TIMER_CMD_REG_KER   0x420
#define FCN_TIMER_MODE_LBN   12
#define FCN_TIMER_MODE_WIDTH   2
#define FCN_TIMER_MODE_DIS   0
#define FCN_TIMER_MODE_INT_HLDOFF   1
#define FCN_TIMER_VAL_LBN   0
#define FCN_TIMER_VAL_WIDTH   12
#define FCN_RX_CFG_REG_KER   0x800
#define FCN_RX_XOFF_EN_LBN   0
#define FCN_RX_XOFF_EN_WIDTH   1
#define FCN_SRM_RX_DC_CFG_REG_KER   0x610
#define FCN_SRM_RX_DC_BASE_ADR_LBN   0
#define FCN_SRM_RX_DC_BASE_ADR_WIDTH   21
#define FCN_SRM_TX_DC_CFG_REG_KER   0x620
#define FCN_SRM_TX_DC_BASE_ADR_LBN   0
#define FCN_SRM_TX_DC_BASE_ADR_WIDTH   21
#define FCN_SRM_CFG_REG_KER   0x630
#define FCN_SRAM_OOB_ADR_INTEN_LBN   5
#define FCN_SRAM_OOB_ADR_INTEN_WIDTH   1
#define FCN_SRAM_OOB_BUF_INTEN_LBN   4
#define FCN_SRAM_OOB_BUF_INTEN_WIDTH   1
#define FCN_SRAM_OOB_BT_INIT_EN_LBN   3
#define FCN_SRAM_OOB_BT_INIT_EN_WIDTH   1
#define FCN_SRM_NUM_BANK_LBN   2
#define FCN_SRM_NUM_BANK_WIDTH   1
#define FCN_SRM_BANK_SIZE_LBN   0
#define FCN_SRM_BANK_SIZE_WIDTH   2
#define FCN_SRM_NUM_BANKS_AND_BANK_SIZE_LBN   0
#define FCN_SRM_NUM_BANKS_AND_BANK_SIZE_WIDTH   3
#define FCN_RX_CFG_REG_KER   0x800
#define FCN_RX_INGR_EN_B0_LBN   47
#define FCN_RX_INGR_EN_B0_WIDTH   1
#define FCN_RX_USR_BUF_SIZE_B0_LBN   19
#define FCN_RX_USR_BUF_SIZE_B0_WIDTH   9
#define FCN_RX_XON_MAC_TH_B0_LBN   10
#define FCN_RX_XON_MAC_TH_B0_WIDTH   9
#define FCN_RX_XOFF_MAC_TH_B0_LBN   1
#define FCN_RX_XOFF_MAC_TH_B0_WIDTH   9
#define FCN_RX_XOFF_MAC_EN_B0_LBN   0
#define FCN_RX_XOFF_MAC_EN_B0_WIDTH   1
#define FCN_RX_USR_BUF_SIZE_A1_LBN   11
#define FCN_RX_USR_BUF_SIZE_A1_WIDTH   9
#define FCN_RX_XON_MAC_TH_A1_LBN   6
#define FCN_RX_XON_MAC_TH_A1_WIDTH   5
#define FCN_RX_XOFF_MAC_TH_A1_LBN   1
#define FCN_RX_XOFF_MAC_TH_A1_WIDTH   5
#define FCN_RX_XOFF_MAC_EN_A1_LBN   0
#define FCN_RX_XOFF_MAC_EN_A1_WIDTH   1
#define FCN_RX_USR_BUF_SIZE_A1_LBN   11
#define FCN_RX_USR_BUF_SIZE_A1_WIDTH   9
#define FCN_RX_XOFF_MAC_EN_A1_LBN   0
#define FCN_RX_XOFF_MAC_EN_A1_WIDTH   1
#define FCN_RX_FILTER_CTL_REG_KER   0x810
#define FCN_UDP_FULL_SRCH_LIMIT_LBN   32
#define FCN_UDP_FULL_SRCH_LIMIT_WIDTH   8
#define FCN_NUM_KER_LBN   24
#define FCN_NUM_KER_WIDTH   2
#define FCN_UDP_WILD_SRCH_LIMIT_LBN   16
#define FCN_UDP_WILD_SRCH_LIMIT_WIDTH   8
#define FCN_TCP_WILD_SRCH_LIMIT_LBN   8
#define FCN_TCP_WILD_SRCH_LIMIT_WIDTH   8
#define FCN_TCP_FULL_SRCH_LIMIT_LBN   0
#define FCN_TCP_FULL_SRCH_LIMIT_WIDTH   8
#define FCN_RX_FLUSH_DESCQ_REG_KER   0x0820
#define FCN_RX_FLUSH_DESCQ_CMD_LBN   24
#define FCN_RX_FLUSH_DESCQ_CMD_WIDTH   1
#define FCN_RX_FLUSH_DESCQ_LBN   0
#define FCN_RX_FLUSH_DESCQ_WIDTH   12
#define FCN_RX_DESC_UPD_REG_KER   0x0830
#define FCN_RX_DESC_WPTR_LBN   96
#define FCN_RX_DESC_WPTR_WIDTH   12
#define FCN_RX_DESC_UPD_REG_KER_DWORD   ( FCN_RX_DESC_UPD_REG_KER + 12 )
#define FCN_RX_DESC_WPTR_DWORD_LBN   0
#define FCN_RX_DESC_WPTR_DWORD_WIDTH   12
#define FCN_RX_DC_CFG_REG_KER   0x840
#define FCN_RX_DC_SIZE_LBN   0
#define FCN_RX_DC_SIZE_WIDTH   2
#define FCN_RX_SELF_RST_REG_KER   0x890
#define FCN_RX_ISCSI_DIS_LBN   17
#define FCN_RX_ISCSI_DIS_WIDTH   1
#define FCN_RX_NODESC_WAIT_DIS_LBN   9
#define FCN_RX_NODESC_WAIT_DIS_WIDTH   1
#define FCN_RX_RECOVERY_EN_LBN   8
#define FCN_RX_RECOVERY_EN_WIDTH   1
#define FCN_TX_FLUSH_DESCQ_REG_KER   0x0a00
#define FCN_TX_FLUSH_DESCQ_CMD_LBN   12
#define FCN_TX_FLUSH_DESCQ_CMD_WIDTH   1
#define FCN_TX_FLUSH_DESCQ_LBN   0
#define FCN_TX_FLUSH_DESCQ_WIDTH   12
#define FCN_TX_CFG2_REG_KER   0xa80
#define FCN_TX_DIS_NON_IP_EV_LBN   17
#define FCN_TX_DIS_NON_IP_EV_WIDTH   1
#define FCN_TX_DESC_UPD_REG_KER   0x0a10
#define FCN_TX_DESC_WPTR_LBN   96
#define FCN_TX_DESC_WPTR_WIDTH   12
#define FCN_TX_DESC_UPD_REG_KER_DWORD   ( FCN_TX_DESC_UPD_REG_KER + 12 )
#define FCN_TX_DESC_WPTR_DWORD_LBN   0
#define FCN_TX_DESC_WPTR_DWORD_WIDTH   12
#define FCN_TX_DC_CFG_REG_KER   0xa20
#define FCN_TX_DC_SIZE_LBN   0
#define FCN_TX_DC_SIZE_WIDTH   2
#define FCN_MD_TXD_REG_KER   0xc00
#define FCN_MD_TXD_LBN   0
#define FCN_MD_TXD_WIDTH   16
#define FCN_MD_RXD_REG_KER   0xc10
#define FCN_MD_RXD_LBN   0
#define FCN_MD_RXD_WIDTH   16
#define FCN_MD_CS_REG_KER   0xc20
#define FCN_MD_GC_LBN   4
#define FCN_MD_GC_WIDTH   1
#define FCN_MD_RIC_LBN   2
#define FCN_MD_RIC_WIDTH   1
#define FCN_MD_RDC_LBN   1
#define FCN_MD_RDC_WIDTH   1
#define FCN_MD_WRC_LBN   0
#define FCN_MD_WRC_WIDTH   1
#define FCN_MD_PHY_ADR_REG_KER   0xc30
#define FCN_MD_PHY_ADR_LBN   0
#define FCN_MD_PHY_ADR_WIDTH   16
#define FCN_MD_ID_REG_KER   0xc40
#define FCN_MD_PRT_ADR_LBN   11
#define FCN_MD_PRT_ADR_WIDTH   5
#define FCN_MD_DEV_ADR_LBN   6
#define FCN_MD_DEV_ADR_WIDTH   5
#define FCN_MD_STAT_REG_KER   0xc50
#define FCN_MD_PINT_LBN   4
#define FCN_MD_PINT_WIDTH   1
#define FCN_MD_DONE_LBN   3
#define FCN_MD_DONE_WIDTH   1
#define FCN_MD_BSERR_LBN   2
#define FCN_MD_BSERR_WIDTH   1
#define FCN_MD_LNFL_LBN   1
#define FCN_MD_LNFL_WIDTH   1
#define FCN_MD_BSY_LBN   0
#define FCN_MD_BSY_WIDTH   1
#define FCN_MAC0_CTRL_REG_KER   0xc80
#define FCN_MAC1_CTRL_REG_KER   0xc90
#define FCN_MAC_XOFF_VAL_LBN   16
#define FCN_MAC_XOFF_VAL_WIDTH   16
#define FCN_MAC_BCAD_ACPT_LBN   4
#define FCN_MAC_BCAD_ACPT_WIDTH   1
#define FCN_MAC_UC_PROM_LBN   3
#define FCN_MAC_UC_PROM_WIDTH   1
#define FCN_MAC_LINK_STATUS_LBN   2
#define FCN_MAC_LINK_STATUS_WIDTH   1
#define FCN_MAC_SPEED_LBN   0
#define FCN_MAC_SPEED_WIDTH   2
#define XX_TXDRV_DEQ_DEFAULT   0xe
#define XX_TXDRV_DTX_DEFAULT   0x5
#define XX_SD_CTL_DRV_DEFAULT   0
#define FALCON_GMAC_REGBANK   0xe00
#define FALCON_GMAC_REGBANK_SIZE   0x200
#define FALCON_GMAC_REG_SIZE   0x10
#define FALCON_XMAC_REGBANK   0x1200
#define FALCON_XMAC_REGBANK_SIZE   0x200
#define FALCON_XMAC_REG_SIZE   0x10
#define FCN_XM_ADR_LO_REG_MAC   0x00
#define FCN_XM_ADR_3_LBN   24
#define FCN_XM_ADR_3_WIDTH   8
#define FCN_XM_ADR_2_LBN   16
#define FCN_XM_ADR_2_WIDTH   8
#define FCN_XM_ADR_1_LBN   8
#define FCN_XM_ADR_1_WIDTH   8
#define FCN_XM_ADR_0_LBN   0
#define FCN_XM_ADR_0_WIDTH   8
#define FCN_XM_ADR_HI_REG_MAC   0x01
#define FCN_XM_ADR_5_LBN   8
#define FCN_XM_ADR_5_WIDTH   8
#define FCN_XM_ADR_4_LBN   0
#define FCN_XM_ADR_4_WIDTH   8
#define FCN_XM_GLB_CFG_REG_MAC   0x02
#define FCN_XM_RX_STAT_EN_LBN   11
#define FCN_XM_RX_STAT_EN_WIDTH   1
#define FCN_XM_TX_STAT_EN_LBN   10
#define FCN_XM_TX_STAT_EN_WIDTH   1
#define FCN_XM_RX_JUMBO_MODE_LBN   6
#define FCN_XM_RX_JUMBO_MODE_WIDTH   1
#define FCN_XM_CORE_RST_LBN   0
#define FCN_XM_CORE_RST_WIDTH   1
#define FCN_XM_TX_CFG_REG_MAC   0x03
#define FCN_XM_IPG_LBN   16
#define FCN_XM_IPG_WIDTH   4
#define FCN_XM_FCNTL_LBN   10
#define FCN_XM_FCNTL_WIDTH   1
#define FCN_XM_TXCRC_LBN   8
#define FCN_XM_TXCRC_WIDTH   1
#define FCN_XM_AUTO_PAD_LBN   5
#define FCN_XM_AUTO_PAD_WIDTH   1
#define FCN_XM_TX_PRMBL_LBN   2
#define FCN_XM_TX_PRMBL_WIDTH   1
#define FCN_XM_TXEN_LBN   1
#define FCN_XM_TXEN_WIDTH   1
#define FCN_XM_RX_CFG_REG_MAC   0x04
#define FCN_XM_PASS_CRC_ERR_LBN   25
#define FCN_XM_PASS_CRC_ERR_WIDTH   1
#define FCN_XM_AUTO_DEPAD_LBN   8
#define FCN_XM_AUTO_DEPAD_WIDTH   1
#define FCN_XM_RXEN_LBN   1
#define FCN_XM_RXEN_WIDTH   1
#define FCN_XM_MGT_INT_MSK_REG_MAC_B0   0x5
#define FCN_XM_MSK_PRMBLE_ERR_LBN   2
#define FCN_XM_MSK_PRMBLE_ERR_WIDTH   1
#define FCN_XM_MSK_RMTFLT_LBN   1
#define FCN_XM_MSK_RMTFLT_WIDTH   1
#define FCN_XM_MSK_LCLFLT_LBN   0
#define FCN_XM_MSK_LCLFLT_WIDTH   1
#define FCN_XM_FC_REG_MAC   0x7
#define FCN_XM_PAUSE_TIME_LBN   16
#define FCN_XM_PAUSE_TIME_WIDTH   16
#define FCN_XM_DIS_FCNTL_LBN   0
#define FCN_XM_DIS_FCNTL_WIDTH   1
#define FCN_XM_TX_PARAM_REG_MAC   0x0d
#define FCN_XM_TX_JUMBO_MODE_LBN   31
#define FCN_XM_TX_JUMBO_MODE_WIDTH   1
#define FCN_XM_MAX_TX_FRM_SIZE_LBN   16
#define FCN_XM_MAX_TX_FRM_SIZE_WIDTH   14
#define FCN_XM_ACPT_ALL_MCAST_LBN   11
#define FCN_XM_ACPT_ALL_MCAST_WIDTH   1
#define FCN_XM_RX_PARAM_REG_MAC   0x0e
#define FCN_XM_MAX_RX_FRM_SIZE_LBN   0
#define FCN_XM_MAX_RX_FRM_SIZE_WIDTH   14
#define FCN_XM_MGT_INT_REG_MAC_B0   0x0f
#define FCN_XM_PRMBLE_ERR   2
#define FCN_XM_PRMBLE_WIDTH   1
#define FCN_XM_RMTFLT_LBN   1
#define FCN_XM_RMTFLT_WIDTH   1
#define FCN_XM_LCLFLT_LBN   0
#define FCN_XM_LCLFLT_WIDTH   1
#define FCN_XX_ALIGN_DONE_LBN   20
#define FCN_XX_ALIGN_DONE_WIDTH   1
#define FCN_XX_CORE_STAT_REG_MAC   0x16
#define FCN_XX_SYNC_STAT_LBN   16
#define FCN_XX_SYNC_STAT_WIDTH   4
#define FCN_XX_SYNC_STAT_DECODE_SYNCED   0xf
#define FCN_XX_COMMA_DET_LBN   12
#define FCN_XX_COMMA_DET_WIDTH   4
#define FCN_XX_COMMA_DET_RESET   0xf
#define FCN_XX_CHARERR_LBN   4
#define FCN_XX_CHARERR_WIDTH   4
#define FCN_XX_CHARERR_RESET   0xf
#define FCN_XX_DISPERR_LBN   0
#define FCN_XX_DISPERR_WIDTH   4
#define FCN_XX_DISPERR_RESET   0xf
#define FCN_XX_PWR_RST_REG_MAC   0x10
#define FCN_XX_PWRDND_EN_LBN   15
#define FCN_XX_PWRDND_EN_WIDTH   1
#define FCN_XX_PWRDNC_EN_LBN   14
#define FCN_XX_PWRDNC_EN_WIDTH   1
#define FCN_XX_PWRDNB_EN_LBN   13
#define FCN_XX_PWRDNB_EN_WIDTH   1
#define FCN_XX_PWRDNA_EN_LBN   12
#define FCN_XX_PWRDNA_EN_WIDTH   1
#define FCN_XX_RSTPLLCD_EN_LBN   9
#define FCN_XX_RSTPLLCD_EN_WIDTH   1
#define FCN_XX_RSTPLLAB_EN_LBN   8
#define FCN_XX_RSTPLLAB_EN_WIDTH   1
#define FCN_XX_RESETD_EN_LBN   7
#define FCN_XX_RESETD_EN_WIDTH   1
#define FCN_XX_RESETC_EN_LBN   6
#define FCN_XX_RESETC_EN_WIDTH   1
#define FCN_XX_RESETB_EN_LBN   5
#define FCN_XX_RESETB_EN_WIDTH   1
#define FCN_XX_RESETA_EN_LBN   4
#define FCN_XX_RESETA_EN_WIDTH   1
#define FCN_XX_RSTXGXSRX_EN_LBN   2
#define FCN_XX_RSTXGXSRX_EN_WIDTH   1
#define FCN_XX_RSTXGXSTX_EN_LBN   1
#define FCN_XX_RSTXGXSTX_EN_WIDTH   1
#define FCN_XX_RST_XX_EN_LBN   0
#define FCN_XX_RST_XX_EN_WIDTH   1
#define FCN_XX_SD_CTL_REG_MAC   0x11
#define FCN_XX_TERMADJ1_LBN   17
#define FCN_XX_TERMADJ1_WIDTH   1
#define FCN_XX_TERMADJ0_LBN   16
#define FCN_XX_TERMADJ0_WIDTH   1
#define FCN_XX_HIDRVD_LBN   15
#define FCN_XX_HIDRVD_WIDTH   1
#define FCN_XX_LODRVD_LBN   14
#define FCN_XX_LODRVD_WIDTH   1
#define FCN_XX_HIDRVC_LBN   13
#define FCN_XX_HIDRVC_WIDTH   1
#define FCN_XX_LODRVC_LBN   12
#define FCN_XX_LODRVC_WIDTH   1
#define FCN_XX_HIDRVB_LBN   11
#define FCN_XX_HIDRVB_WIDTH   1
#define FCN_XX_LODRVB_LBN   10
#define FCN_XX_LODRVB_WIDTH   1
#define FCN_XX_HIDRVA_LBN   9
#define FCN_XX_HIDRVA_WIDTH   1
#define FCN_XX_LODRVA_LBN   8
#define FCN_XX_LODRVA_WIDTH   1
#define FCN_XX_LPBKD_LBN   3
#define FCN_XX_LPBKD_WIDTH   1
#define FCN_XX_LPBKC_LBN   2
#define FCN_XX_LPBKC_WIDTH   1
#define FCN_XX_LPBKB_LBN   1
#define FCN_XX_LPBKB_WIDTH   1
#define FCN_XX_LPBKA_LBN   0
#define FCN_XX_LPBKA_WIDTH   1
#define FCN_XX_TXDRV_CTL_REG_MAC   0x12
#define FCN_XX_DEQD_LBN   28
#define FCN_XX_DEQD_WIDTH   4
#define FCN_XX_DEQC_LBN   24
#define FCN_XX_DEQC_WIDTH   4
#define FCN_XX_DEQB_LBN   20
#define FCN_XX_DEQB_WIDTH   4
#define FCN_XX_DEQA_LBN   16
#define FCN_XX_DEQA_WIDTH   4
#define FCN_XX_DTXD_LBN   12
#define FCN_XX_DTXD_WIDTH   4
#define FCN_XX_DTXC_LBN   8
#define FCN_XX_DTXC_WIDTH   4
#define FCN_XX_DTXB_LBN   4
#define FCN_XX_DTXB_WIDTH   4
#define FCN_XX_DTXA_LBN   0
#define FCN_XX_DTXA_WIDTH   4
#define FCN_RX_FILTER_TBL0   0xF00000
#define FCN_RX_DESC_PTR_TBL_KER_A1   0x11800
#define FCN_RX_DESC_PTR_TBL_KER_B0   0xF40000
#define FCN_RX_ISCSI_DDIG_EN_LBN   88
#define FCN_RX_ISCSI_DDIG_EN_WIDTH   1
#define FCN_RX_ISCSI_HDIG_EN_LBN   87
#define FCN_RX_ISCSI_HDIG_EN_WIDTH   1
#define FCN_RX_DESCQ_BUF_BASE_ID_LBN   36
#define FCN_RX_DESCQ_BUF_BASE_ID_WIDTH   20
#define FCN_RX_DESCQ_EVQ_ID_LBN   24
#define FCN_RX_DESCQ_EVQ_ID_WIDTH   12
#define FCN_RX_DESCQ_OWNER_ID_LBN   10
#define FCN_RX_DESCQ_OWNER_ID_WIDTH   14
#define FCN_RX_DESCQ_SIZE_LBN   3
#define FCN_RX_DESCQ_SIZE_WIDTH   2
#define FCN_RX_DESCQ_SIZE_4K   3
#define FCN_RX_DESCQ_SIZE_2K   2
#define FCN_RX_DESCQ_SIZE_1K   1
#define FCN_RX_DESCQ_SIZE_512   0
#define FCN_RX_DESCQ_TYPE_LBN   2
#define FCN_RX_DESCQ_TYPE_WIDTH   1
#define FCN_RX_DESCQ_JUMBO_LBN   1
#define FCN_RX_DESCQ_JUMBO_WIDTH   1
#define FCN_RX_DESCQ_EN_LBN   0
#define FCN_RX_DESCQ_EN_WIDTH   1
#define FCN_TX_DESC_PTR_TBL_KER_A1   0x11900
#define FCN_TX_DESC_PTR_TBL_KER_B0   0xF50000
#define FCN_TX_NON_IP_DROP_DIS_B0_LBN   91
#define FCN_TX_NON_IP_DROP_DIS_B0_WIDTH   1
#define FCN_TX_DESCQ_EN_LBN   88
#define FCN_TX_DESCQ_EN_WIDTH   1
#define FCN_TX_ISCSI_DDIG_EN_LBN   87
#define FCN_TX_ISCSI_DDIG_EN_WIDTH   1
#define FCN_TX_ISCSI_HDIG_EN_LBN   86
#define FCN_TX_ISCSI_HDIG_EN_WIDTH   1
#define FCN_TX_DESCQ_BUF_BASE_ID_LBN   36
#define FCN_TX_DESCQ_BUF_BASE_ID_WIDTH   20
#define FCN_TX_DESCQ_EVQ_ID_LBN   24
#define FCN_TX_DESCQ_EVQ_ID_WIDTH   12
#define FCN_TX_DESCQ_OWNER_ID_LBN   10
#define FCN_TX_DESCQ_OWNER_ID_WIDTH   14
#define FCN_TX_DESCQ_SIZE_LBN   3
#define FCN_TX_DESCQ_SIZE_WIDTH   2
#define FCN_TX_DESCQ_SIZE_4K   3
#define FCN_TX_DESCQ_SIZE_2K   2
#define FCN_TX_DESCQ_SIZE_1K   1
#define FCN_TX_DESCQ_SIZE_512   0
#define FCN_TX_DESCQ_TYPE_LBN   1
#define FCN_TX_DESCQ_TYPE_WIDTH   2
#define FCN_TX_DESCQ_FLUSH_LBN   0
#define FCN_TX_DESCQ_FLUSH_WIDTH   1
#define FCN_EVQ_PTR_TBL_KER_A1   0x11a00
#define FCN_EVQ_PTR_TBL_KER_B0   0xf60000
#define FCN_EVQ_EN_LBN   23
#define FCN_EVQ_EN_WIDTH   1
#define FCN_EVQ_SIZE_LBN   20
#define FCN_EVQ_SIZE_WIDTH   3
#define FCN_EVQ_SIZE_32K   6
#define FCN_EVQ_SIZE_16K   5
#define FCN_EVQ_SIZE_8K   4
#define FCN_EVQ_SIZE_4K   3
#define FCN_EVQ_SIZE_2K   2
#define FCN_EVQ_SIZE_1K   1
#define FCN_EVQ_SIZE_512   0
#define FCN_EVQ_BUF_BASE_ID_LBN   0
#define FCN_EVQ_BUF_BASE_ID_WIDTH   20
#define FCN_RX_RSS_INDIR_TBL_B0   0xFB0000
#define FCN_EVQ_RPTR_REG_KER_A1   0x11b00
#define FCN_EVQ_RPTR_REG_KER_B0   0xfa0000
#define FCN_EVQ_RPTR_LBN   0
#define FCN_EVQ_RPTR_WIDTH   14
#define FCN_EVQ_RPTR_REG_KER_DWORD_A1   ( FCN_EVQ_RPTR_REG_KER_A1 + 0 )
#define FCN_EVQ_RPTR_REG_KER_DWORD_B0   ( FCN_EVQ_RPTR_REG_KER_B0 + 0 )
#define FCN_EVQ_RPTR_DWORD_LBN   0
#define FCN_EVQ_RPTR_DWORD_WIDTH   14
#define FCN_BUF_FULL_TBL_KER_A1   0x18000
#define FCN_BUF_FULL_TBL_KER_B0   0x800000
#define FCN_IP_DAT_BUF_SIZE_LBN   50
#define FCN_IP_DAT_BUF_SIZE_WIDTH   1
#define FCN_IP_DAT_BUF_SIZE_8K   1
#define FCN_IP_DAT_BUF_SIZE_4K   0
#define FCN_BUF_ADR_FBUF_LBN   14
#define FCN_BUF_ADR_FBUF_WIDTH   34
#define FCN_BUF_OWNER_ID_FBUF_LBN   0
#define FCN_BUF_OWNER_ID_FBUF_WIDTH   14
#define FALCON_GMAC_REG(efab, mac_reg)
 Offset of a GMAC register within Falcon.
#define FALCON_XMAC_REG(efab_port, mac_reg)
 Offset of an XMAC register within Falcon.
#define FCN_MAC_DATA_LBN   0
#define FCN_MAC_DATA_WIDTH   32
#define FCN_TX_KER_PORT_LBN   63
#define FCN_TX_KER_PORT_WIDTH   1
#define FCN_TX_KER_BYTE_CNT_LBN   48
#define FCN_TX_KER_BYTE_CNT_WIDTH   14
#define FCN_TX_KER_BUF_ADR_LBN   0
#define FCN_TX_KER_BUF_ADR_WIDTH   EFAB_DMA_TYPE_WIDTH ( 46 )
#define FCN_RX_KER_BUF_SIZE_LBN   48
#define FCN_RX_KER_BUF_SIZE_WIDTH   14
#define FCN_RX_KER_BUF_ADR_LBN   0
#define FCN_RX_KER_BUF_ADR_WIDTH   EFAB_DMA_TYPE_WIDTH ( 46 )
#define FCN_EV_CODE_LBN   60
#define FCN_EV_CODE_WIDTH   4
#define FCN_RX_IP_EV_DECODE   0
#define FCN_TX_IP_EV_DECODE   2
#define FCN_DRIVER_EV_DECODE   5
#define FCN_RX_EV_PKT_OK_LBN   56
#define FCN_RX_EV_PKT_OK_WIDTH   1
#define FCN_RX_PORT_LBN   30
#define FCN_RX_PORT_WIDTH   1
#define FCN_RX_EV_BYTE_CNT_LBN   16
#define FCN_RX_EV_BYTE_CNT_WIDTH   14
#define FCN_RX_EV_DESC_PTR_LBN   0
#define FCN_RX_EV_DESC_PTR_WIDTH   12
#define FCN_TX_EV_DESC_PTR_LBN   0
#define FCN_TX_EV_DESC_PTR_WIDTH   12
#define FCN_REVISION_REG(efab, reg)   ( ( efab->pci_revision == FALCON_REV_B0 ) ? reg ## _B0 : reg ## _A1 )
#define EFAB_SET_OWORD_FIELD_VER(efab, reg, field, val)
#define _falcon_writel(efab, value, reg)   writel ( (value), (efab)->membase + (reg) )
#define _falcon_readl(efab, reg)   readl ( (efab)->membase + (reg) )
#define FCN_DUMP_REG(efab, _reg)
#define FCN_DUMP_MAC_REG(efab, _mac_reg)
#define FALCON_SPI_MAX_LEN   16
 Maximum length for a single SPI transaction.
#define GM_CFG1_REG_MAC   0x00
#define GM_SW_RST_LBN   31
#define GM_SW_RST_WIDTH   1
#define GM_RX_FC_EN_LBN   5
#define GM_RX_FC_EN_WIDTH   1
#define GM_TX_FC_EN_LBN   4
#define GM_TX_FC_EN_WIDTH   1
#define GM_RX_EN_LBN   2
#define GM_RX_EN_WIDTH   1
#define GM_TX_EN_LBN   0
#define GM_TX_EN_WIDTH   1
#define GM_CFG2_REG_MAC   0x01
#define GM_PAMBL_LEN_LBN   12
#define GM_PAMBL_LEN_WIDTH   4
#define GM_IF_MODE_LBN   8
#define GM_IF_MODE_WIDTH   2
#define GM_PAD_CRC_EN_LBN   2
#define GM_PAD_CRC_EN_WIDTH   1
#define GM_FD_LBN   0
#define GM_FD_WIDTH   1
#define GM_MAX_FLEN_REG_MAC   0x04
#define GM_MAX_FLEN_LBN   0
#define GM_MAX_FLEN_WIDTH   16
#define GM_MII_MGMT_CFG_REG_MAC   0x08
#define GM_MGMT_CLK_SEL_LBN   0
#define GM_MGMT_CLK_SEL_WIDTH   3
#define GM_MII_MGMT_CMD_REG_MAC   0x09
#define GM_MGMT_SCAN_CYC_LBN   1
#define GM_MGMT_SCAN_CYC_WIDTH   1
#define GM_MGMT_RD_CYC_LBN   0
#define GM_MGMT_RD_CYC_WIDTH   1
#define GM_MII_MGMT_ADR_REG_MAC   0x0a
#define GM_MGMT_PHY_ADDR_LBN   8
#define GM_MGMT_PHY_ADDR_WIDTH   5
#define GM_MGMT_REG_ADDR_LBN   0
#define GM_MGMT_REG_ADDR_WIDTH   5
#define GM_MII_MGMT_CTL_REG_MAC   0x0b
#define GM_MGMT_CTL_LBN   0
#define GM_MGMT_CTL_WIDTH   16
#define GM_MII_MGMT_STAT_REG_MAC   0x0c
#define GM_MGMT_STAT_LBN   0
#define GM_MGMT_STAT_WIDTH   16
#define GM_MII_MGMT_IND_REG_MAC   0x0d
#define GM_MGMT_BUSY_LBN   0
#define GM_MGMT_BUSY_WIDTH   1
#define GM_ADR1_REG_MAC   0x10
#define GM_HWADDR_5_LBN   24
#define GM_HWADDR_5_WIDTH   8
#define GM_HWADDR_4_LBN   16
#define GM_HWADDR_4_WIDTH   8
#define GM_HWADDR_3_LBN   8
#define GM_HWADDR_3_WIDTH   8
#define GM_HWADDR_2_LBN   0
#define GM_HWADDR_2_WIDTH   8
#define GM_ADR2_REG_MAC   0x11
#define GM_HWADDR_1_LBN   24
#define GM_HWADDR_1_WIDTH   8
#define GM_HWADDR_0_LBN   16
#define GM_HWADDR_0_WIDTH   8
#define GMF_CFG0_REG_MAC   0x12
#define GMF_FTFENREQ_LBN   12
#define GMF_FTFENREQ_WIDTH   1
#define GMF_STFENREQ_LBN   11
#define GMF_STFENREQ_WIDTH   1
#define GMF_FRFENREQ_LBN   10
#define GMF_FRFENREQ_WIDTH   1
#define GMF_SRFENREQ_LBN   9
#define GMF_SRFENREQ_WIDTH   1
#define GMF_WTMENREQ_LBN   8
#define GMF_WTMENREQ_WIDTH   1
#define GMF_CFG1_REG_MAC   0x13
#define GMF_CFGFRTH_LBN   16
#define GMF_CFGFRTH_WIDTH   5
#define GMF_CFGXOFFRTX_LBN   0
#define GMF_CFGXOFFRTX_WIDTH   16
#define GMF_CFG2_REG_MAC   0x14
#define GMF_CFGHWM_LBN   16
#define GMF_CFGHWM_WIDTH   6
#define GMF_CFGLWM_LBN   0
#define GMF_CFGLWM_WIDTH   6
#define GMF_CFG3_REG_MAC   0x15
#define GMF_CFGHWMFT_LBN   16
#define GMF_CFGHWMFT_WIDTH   6
#define GMF_CFGFTTH_LBN   0
#define GMF_CFGFTTH_WIDTH   6
#define GMF_CFG4_REG_MAC   0x16
#define GMF_HSTFLTRFRM_PAUSE_LBN   12
#define GMF_HSTFLTRFRM_PAUSE_WIDTH   12
#define GMF_CFG5_REG_MAC   0x17
#define GMF_CFGHDPLX_LBN   22
#define GMF_CFGHDPLX_WIDTH   1
#define GMF_CFGBYTMODE_LBN   19
#define GMF_CFGBYTMODE_WIDTH   1
#define GMF_HSTDRPLT64_LBN   18
#define GMF_HSTDRPLT64_WIDTH   1
#define GMF_HSTFLTRFRMDC_PAUSE_LBN   12
#define GMF_HSTFLTRFRMDC_PAUSE_WIDTH   1
#define XFP_REQUIRED_DEVS
#define TXC_GLRGS_GLCMD   (0xc004)
#define TXC_GLCMD_LMTSWRST_LBN   (14)
#define TXC_ALRGS_ATXAMP0   (0xc041)
#define TXC_ALRGS_ATXAMP1   (0xc042)
#define TXC_ATXAMP_LANE02_LBN   (3)
#define TXC_ATXAMP_LANE13_LBN   (11)
#define TXC_ATXAMP_1280_mV   (0)
#define TXC_ATXAMP_1200_mV   (8)
#define TXC_ATXAMP_1120_mV   (12)
#define TXC_ATXAMP_1060_mV   (14)
#define TXC_ATXAMP_0820_mV   (25)
#define TXC_ATXAMP_0720_mV   (26)
#define TXC_ATXAMP_0580_mV   (27)
#define TXC_ATXAMP_0440_mV   (28)
#define TXC_ATXAMP_0820_BOTH
#define TXC_ATXAMP_DEFAULT   (0x6060)
#define TXC_ALRGS_ATXPRE0   (0xc043)
#define TXC_ALRGS_ATXPRE1   (0xc044)
#define TXC_ATXPRE_NONE   (0)
#define TXC_ATXPRE_DEFAULT   (0x1010)
#define TXC_REQUIRED_DEVS
#define TENXPRESS_REQUIRED_DEVS
#define PCS_TEST_SELECT_REG   0xd807
#define CLK312_EN_LBN   3
#define CLK312_EN_WIDTH   1
#define PCS_CLOCK_CTRL_REG   0xd801
#define PLL312_RST_N_LBN   2
#define PMA_PMD_EXT_CTRL_REG   49152
#define PMA_PMD_EXT_SSR_LBN   15
#define PCS_BOOT_STATUS_REG   0xd000
#define PCS_BOOT_FATAL_ERR_LBN   0
#define PCS_BOOT_PROGRESS_LBN   1
#define PCS_BOOT_PROGRESS_WIDTH   2
#define PCS_BOOT_COMPLETE_LBN   3
#define PCS_SOFT_RST2_REG   0xd806
#define SERDES_RST_N_LBN   13
#define XGXS_RST_N_LBN   12
#define PM8358_REQUIRED_DEVS   (MDIO_MMDREG_DEVS0_DTEXS)
#define PMC_MASTER_REG   (0xd000)
#define PMC_MASTER_ANLG_CTRL   (1<< 11)
#define PMC_MCONF2_REG   (0xd002)
#define PMC_MCONF2_TEDGE   (1 << 2)
#define PMC_MCONF2_REDGE   (1 << 3)
#define PMC_ANALOG_RX_CFG0   (0xd025)
#define PMC_ANALOG_RX_CFG1   (0xd02d)
#define PMC_ANALOG_RX_CFG2   (0xd035)
#define PMC_ANALOG_RX_CFG3   (0xd03d)
#define PMC_ANALOG_RX_TERM   (1 << 15)
#define PMC_ANALOG_RX_EQ_MASK   (3 << 8)
#define PMC_ANALOG_RX_EQ_NONE   (0 << 8)
#define PMC_ANALOG_RX_EQ_HALF   (1 << 8)
#define PMC_ANALOG_RX_EQ_FULL   (2 << 8)
#define PMC_ANALOG_RX_EQ_RSVD   (3 << 8)
#define MAX_TEMP_THRESH   90
#define PCA9539   0x74
#define P0_IN   0x00
#define P0_OUT   0x02
#define P0_CONFIG   0x06
#define P0_EN_1V0X_LBN   0
#define P0_EN_1V0X_WIDTH   1
#define P0_EN_1V2_LBN   1
#define P0_EN_1V2_WIDTH   1
#define P0_EN_2V5_LBN   2
#define P0_EN_2V5_WIDTH   1
#define P0_EN_3V3X_LBN   3
#define P0_EN_3V3X_WIDTH   1
#define P0_EN_5V_LBN   4
#define P0_EN_5V_WIDTH   1
#define P0_X_TRST_LBN   6
#define P0_X_TRST_WIDTH   1
#define P1_IN   0x01
#define P1_CONFIG   0x07
#define P1_AFE_PWD_LBN   0
#define P1_AFE_PWD_WIDTH   1
#define P1_DSP_PWD25_LBN   1
#define P1_DSP_PWD25_WIDTH   1
#define P1_SPARE_LBN   4
#define P1_SPARE_WIDTH   4
#define MAX6647   0x4e
#define RSL   0x02
#define RLHN   0x05
#define WLHO   0x0b
#define FALCON_MAC_ADDRESS_OFFSET   0x310
 Offset of MAC address within EEPROM or Flash.
#define SF_NV_CONFIG_BASE   0x300
#define SF_NV_CONFIG_EXTRA   0xA0
#define BOARD_TYPE(_rev)   (_rev >> 8)

Functions

 FILE_LICENCE (GPL_ANY)
static void falcon_mdio_write (struct efab_nic *efab, int device, int location, int value)
static int falcon_mdio_read (struct efab_nic *efab, int device, int location)
static unsigned int gmii_autoneg_advertised (struct efab_nic *efab)
 Retrieve GMII autonegotiation advertised abilities.
static unsigned int gmii_autoneg_lpa (struct efab_nic *efab)
 Retrieve GMII autonegotiation link partner abilities.
static unsigned int gmii_nway_result (unsigned int negotiated)
 Calculate GMII autonegotiated link technology.
static int gmii_link_ok (struct efab_nic *efab)
 Check GMII PHY link status.
static int mdio_clause45_wait_reset_mmds (struct efab_nic *efab)
static int mdio_clause45_reset_mmd (struct efab_nic *efab, int mmd)
static int mdio_clause45_links_ok (struct efab_nic *efab)
static int mdio_clause45_check_mmds (struct efab_nic *efab)
static void falcon_write (struct efab_nic *efab, efab_oword_t *value, unsigned int reg)
 Write to a Falcon register.
static void falcon_write_sram (struct efab_nic *efab, efab_qword_t *value, unsigned int index)
 Write to Falcon SRAM.
static void falcon_writel (struct efab_nic *efab, efab_dword_t *value, unsigned int reg)
 Write dword to Falcon register that allows partial writes.
static void falcon_read (struct efab_nic *efab, efab_oword_t *value, unsigned int reg)
 Read from a Falcon register.
static void falcon_read_sram (struct efab_nic *efab, efab_qword_t *value, unsigned int index)
 Read from Falcon SRAM.
static void falcon_readl (struct efab_nic *efab, efab_dword_t *value, unsigned int reg)
 Read dword from a portion of a Falcon register.
static int falcon_event_present (falcon_event_t *event)
 See if an event is present.
static void falcon_eventq_read_ack (struct efab_nic *efab, struct efab_ev_queue *ev_queue)
static void falcon_interrupts (struct efab_nic *efab, int enabled, int force)
static int falcon_spi_wait (struct efab_nic *efab)
static int falcon_spi_rw (struct spi_bus *bus, struct spi_device *device, unsigned int command, int address, const void *data_out, void *data_in, size_t len)
static void falcon_i2c_bit_write (struct bit_basher *basher, unsigned int bit_id, unsigned long data)
static int falcon_i2c_bit_read (struct bit_basher *basher, unsigned int bit_id)
static int falcon_gmii_wait (struct efab_nic *efab)
static void falcon_reconfigure_mac_wrapper (struct efab_nic *efab)
static void falcon_gmac_writel (struct efab_nic *efab, efab_dword_t *value, unsigned int mac_reg)
static void falcon_gmac_readl (struct efab_nic *efab, efab_dword_t *value, unsigned int mac_reg)
static void mentormac_reset (struct efab_nic *efab)
static void mentormac_init (struct efab_nic *efab)
static int falcon_init_gmac (struct efab_nic *efab)
static void falcon_xmac_writel (struct efab_nic *efab, efab_dword_t *value, unsigned int mac_reg)
 Write dword to a Falcon XMAC register.
static void falcon_xmac_readl (struct efab_nic *efab, efab_dword_t *value, unsigned int mac_reg)
 Read dword from a Falcon XMAC register.
static void falcon_setup_xaui (struct efab_nic *efab)
 Configure Falcon XAUI output.
static int falcon_xgmii_status (struct efab_nic *efab)
static void falcon_mask_status_intr (struct efab_nic *efab, int enable)
static int falcon_reset_xmac (struct efab_nic *efab)
 Reset 10G MAC connected to port.
static int falcon_reset_xaui (struct efab_nic *efab)
static int falcon_xaui_link_ok (struct efab_nic *efab)
static void falcon_reconfigure_xmac (struct efab_nic *efab)
 Initialise XMAC.
static int falcon_init_xmac (struct efab_nic *efab)
static int falcon_xaui_phy_init (struct efab_nic *efab)
static int alaska_init (struct efab_nic *efab)
 Initialise Alaska PHY.
static int falcon_xfp_phy_init (struct efab_nic *efab)
static int falcon_txc_logic_reset (struct efab_nic *efab)
static int falcon_txc_phy_init (struct efab_nic *efab)
static int falcon_tenxpress_check_c11 (struct efab_nic *efab)
static int falcon_tenxpress_phy_init (struct efab_nic *efab)
static int falcon_pm8358_phy_init (struct efab_nic *efab)
static int sfe4001_init (struct efab_nic *efab)
static void sfe4001_fini (struct efab_nic *efab)
static int sfe4002_init (struct efab_nic *efab)
static void sfe4002_fini (struct efab_nic *efab)
static int sfe4003_init (struct efab_nic *efab)
static void sfe4003_fini (struct efab_nic *efab)
static void falcon_free_special_buffer (void *p)
static void * falcon_alloc_special_buffer (struct efab_nic *efab, int bytes, struct efab_special_buffer *entry)
static void clear_b0_fpga_memories (struct efab_nic *efab)
static int falcon_reset (struct efab_nic *efab)
static void falcon_probe_nic_variant (struct efab_nic *efab, struct pci_device *pci)
static void falcon_init_spi_device (struct efab_nic *efab, struct spi_device *spi)
static int falcon_probe_spi (struct efab_nic *efab)
static int falcon_probe_nvram (struct efab_nic *efab)
static int falcon_init_sram (struct efab_nic *efab)
static void falcon_setup_nic (struct efab_nic *efab)
static void falcon_init_resources (struct efab_nic *efab)
static void falcon_fini_resources (struct efab_nic *efab)
static void falcon_build_rx_desc (falcon_rx_desc_t *rxd, struct io_buffer *iob)
static void falcon_notify_rx_desc (struct efab_nic *efab, struct efab_rx_queue *rx_queue)
static void falcon_build_tx_desc (falcon_tx_desc_t *txd, struct io_buffer *iob)
static void falcon_notify_tx_desc (struct efab_nic *efab, struct efab_tx_queue *tx_queue)
static int efab_fill_rx_queue (struct efab_nic *efab, struct efab_rx_queue *rx_queue)
static void efab_receive (struct efab_nic *efab, unsigned int id, int len, int drop)
static int efab_transmit (struct net_device *netdev, struct io_buffer *iob)
static int efab_transmit_done (struct efab_nic *efab, int id)
static void falcon_clear_interrupts (struct efab_nic *efab)
static void falcon_handle_event (struct efab_nic *efab, falcon_event_t *evt)
static void efab_poll (struct net_device *netdev)
static void efab_irq (struct net_device *netdev, int enable)
static void efab_free_resources (struct efab_nic *efab)
static int efab_alloc_resources (struct efab_nic *efab)
static int efab_init_mac (struct efab_nic *efab)
static void efab_close (struct net_device *netdev)
static int efab_open (struct net_device *netdev)
static void efab_remove (struct pci_device *pci)
static int efab_probe (struct pci_device *pci, const struct pci_device_id *id)

Variables

int __invalid_queue_size
static struct nvo_fragment falcon_nvo_fragments []
 Portion of EEPROM available for non-volatile options.
static struct bit_basher_operations falcon_i2c_bit_ops
static struct efab_mac_operations falcon_gmac_operations
static struct efab_mac_operations falcon_xmac_operations
static struct efab_phy_operations falcon_xaui_phy_ops
static struct efab_phy_operations falcon_alaska_phy_ops
static struct efab_phy_operations falcon_xfp_phy_ops
static struct efab_phy_operations falcon_txc_phy_ops
static struct efab_phy_operations falcon_tenxpress_phy_ops
static struct efab_phy_operations falcon_pm8358_phy_ops
static struct i2c_device i2c_pca9539
static struct i2c_device i2c_max6647
struct efab_board_operations sfe4001_ops
struct efab_board_operations sfe4002_ops
struct efab_board_operations sfe4003_ops
static struct net_device_operations efab_operations
static struct pci_device_id efab_nics []
struct pci_driver
etherfabric_driver 
__pci_driver


Define Documentation

#define EFAB_REGDUMP ( ...   ) 

#define EFAB_TRACE ( ...   )     DBGP(__VA_ARGS__)

#define EFAB_LOG ( ...   )     DBG(__VA_ARGS__)

#define EFAB_ERR ( ...   )     DBG(__VA_ARGS__)

#define FALCON_USE_IO_BAR   0

Definition at line 53 of file etherfabric.c.

#define HZ   100

Definition at line 55 of file etherfabric.c.

#define EFAB_BYTE   1

Definition at line 56 of file etherfabric.c.

Referenced by sfe4001_fini(), and sfe4001_init().

#define FQS ( _prefix,
_x   ) 

Value:

( ( (_x) == 512 ) ? _prefix ## _SIZE_512 :              \
          ( ( (_x) == 1024 ) ? _prefix ## _SIZE_1K :            \
            ( ( (_x) == 2048 ) ? _prefix ## _SIZE_2K :          \
              ( ( (_x) == 4096) ? _prefix ## _SIZE_4K :         \
                __invalid_queue_size ) ) ) )

Definition at line 65 of file etherfabric.c.

Referenced by falcon_init_resources().

#define EFAB_MAX_FRAME_LEN ( mtu   )     ( ( ( ( mtu ) + 4/* FCS */ ) + 7 ) & ~7 )

Definition at line 73 of file etherfabric.c.

Referenced by falcon_reconfigure_xmac(), and mentormac_init().

#define GMII_PSSR   0x11

Definition at line 88 of file etherfabric.c.

Referenced by gmii_link_ok().

#define LPA_EF_1000FULL   0x00020000

Definition at line 91 of file etherfabric.c.

Referenced by gmii_nway_result().

#define LPA_EF_1000HALF   0x00010000

Definition at line 92 of file etherfabric.c.

Referenced by gmii_nway_result().

#define LPA_EF_10000FULL   0x00040000

#define LPA_EF_10000HALF   0x00080000

Definition at line 94 of file etherfabric.c.

#define LPA_100   (LPA_100FULL | LPA_100HALF | LPA_100BASE4)

Definition at line 96 of file etherfabric.c.

Referenced by efab_init_mac(), and falcon_reconfigure_mac_wrapper().

#define LPA_EF_1000   ( LPA_EF_1000FULL | LPA_EF_1000HALF )

Definition at line 97 of file etherfabric.c.

Referenced by efab_init_mac(), falcon_reconfigure_mac_wrapper(), and mentormac_init().

#define LPA_EF_10000   ( LPA_EF_10000FULL | LPA_EF_10000HALF )

Definition at line 98 of file etherfabric.c.

Referenced by efab_init_mac(), and falcon_reconfigure_mac_wrapper().

#define LPA_EF_DUPLEX

Value:

Definition at line 99 of file etherfabric.c.

Referenced by efab_init_mac(), and mentormac_init().

#define LPA_OTHER

Value:

Definition at line 103 of file etherfabric.c.

Referenced by gmii_nway_result().

#define PSSR_LSTATUS   0x0400

Definition at line 107 of file etherfabric.c.

Referenced by gmii_link_ok().

#define MDIO_MMD_PMAPMD   (1)

Definition at line 204 of file etherfabric.c.

Referenced by falcon_txc_phy_init().

#define MDIO_MMD_WIS   (2)

Definition at line 206 of file etherfabric.c.

#define MDIO_MMD_PCS   (3)

#define MDIO_MMD_PHYXS   (4)

#define MDIO_MMD_DTEXS   (5)

Definition at line 212 of file etherfabric.c.

Referenced by falcon_pm8358_phy_init().

#define MDIO_MMD_TC   (6)

Definition at line 214 of file etherfabric.c.

#define MDIO_MMD_AN   (7)

Definition at line 216 of file etherfabric.c.

#define MDIO_MMDREG_CTRL1   (0)

Definition at line 219 of file etherfabric.c.

Referenced by mdio_clause45_reset_mmd(), and mdio_clause45_wait_reset_mmds().

#define MDIO_MMDREG_STAT1   (1)

Definition at line 220 of file etherfabric.c.

Referenced by mdio_clause45_links_ok().

#define MDIO_MMDREG_DEVS0   (5)

Definition at line 221 of file etherfabric.c.

Referenced by mdio_clause45_check_mmds().

#define MDIO_MMDREG_STAT2   (8)

Definition at line 222 of file etherfabric.c.

Referenced by mdio_clause45_check_mmds().

#define MDIO_MMDREG_CTRL1_RESET_LBN   (15)

Definition at line 226 of file etherfabric.c.

Referenced by mdio_clause45_reset_mmd(), and mdio_clause45_wait_reset_mmds().

#define MDIO_MMDREG_CTRL1_RESET_WIDTH   (1)

Definition at line 227 of file etherfabric.c.

#define MDIO_MMDREG_STAT1_FAULT_LBN   (7)

Definition at line 230 of file etherfabric.c.

#define MDIO_MMDREG_STAT1_FAULT_WIDTH   (1)

Definition at line 231 of file etherfabric.c.

#define MDIO_MMDREG_STAT1_LINK_LBN   (2)

Definition at line 234 of file etherfabric.c.

Referenced by mdio_clause45_links_ok().

#define MDIO_MMDREG_STAT1_LINK_WIDTH   (1)

Definition at line 235 of file etherfabric.c.

#define DEV_PRESENT_BIT ( _b   )     (1 << _b)

Definition at line 238 of file etherfabric.c.

#define MDIO_MMDREG_DEVS0_DTEXS   DEV_PRESENT_BIT(MDIO_MMD_DTEXS)

Definition at line 240 of file etherfabric.c.

Referenced by falcon_pm8358_phy_init().

#define MDIO_MMDREG_DEVS0_PHYXS   DEV_PRESENT_BIT(MDIO_MMD_PHYXS)

Definition at line 241 of file etherfabric.c.

#define MDIO_MMDREG_DEVS0_PCS   DEV_PRESENT_BIT(MDIO_MMD_PCS)

Definition at line 242 of file etherfabric.c.

#define MDIO_MMDREG_DEVS0_WIS   DEV_PRESENT_BIT(MDIO_MMD_WIS)

Definition at line 243 of file etherfabric.c.

#define MDIO_MMDREG_DEVS0_PMAPMD   DEV_PRESENT_BIT(MDIO_MMD_PMAPMD)

Definition at line 244 of file etherfabric.c.

#define MDIO_MMDREG_DEVS0_AN   DEV_PRESENT_BIT(MDIO_MMD_AN)

Definition at line 246 of file etherfabric.c.

#define MDIO_MMDREG_STAT2_PRESENT_VAL   (2)

Definition at line 249 of file etherfabric.c.

Referenced by mdio_clause45_check_mmds().

#define MDIO_MMDREG_STAT2_PRESENT_LBN   (14)

Definition at line 250 of file etherfabric.c.

#define MDIO_MMDREG_STAT2_PRESENT_WIDTH   (2)

Definition at line 251 of file etherfabric.c.

#define MDIO_PHYXS_LANE_STATE   (0x18)

Definition at line 254 of file etherfabric.c.

Referenced by falcon_xaui_link_ok().

#define MDIO_PHYXS_LANE_ALIGNED_LBN   (12)

Definition at line 255 of file etherfabric.c.

Referenced by falcon_xaui_link_ok().

#define MDIO_PHYXS_LANE_SYNC0_LBN   (0)

Definition at line 256 of file etherfabric.c.

#define MDIO_PHYXS_LANE_SYNC1_LBN   (1)

Definition at line 257 of file etherfabric.c.

#define MDIO_PHYXS_LANE_SYNC2_LBN   (2)

Definition at line 258 of file etherfabric.c.

#define MDIO_PHYXS_LANE_SYNC3_LBN   (3)

Definition at line 259 of file etherfabric.c.

#define MDIO45_RESET_TRIES   100

Definition at line 262 of file etherfabric.c.

Referenced by mdio_clause45_reset_mmd(), and mdio_clause45_wait_reset_mmds().

#define MDIO45_RESET_SPINTIME   10

Definition at line 263 of file etherfabric.c.

Referenced by mdio_clause45_reset_mmd(), and mdio_clause45_wait_reset_mmds().

#define FCN_IOM_IND_ADR_REG   0x0

Definition at line 395 of file etherfabric.c.

#define FCN_IOM_IND_DAT_REG   0x4

Definition at line 398 of file etherfabric.c.

#define FCN_ADR_REGION_REG_KER   0x00

Definition at line 401 of file etherfabric.c.

Referenced by clear_b0_fpga_memories().

#define FCN_ADR_REGION0_LBN   0

Definition at line 402 of file etherfabric.c.

#define FCN_ADR_REGION0_WIDTH   18

Definition at line 403 of file etherfabric.c.

#define FCN_ADR_REGION1_LBN   32

Definition at line 404 of file etherfabric.c.

#define FCN_ADR_REGION1_WIDTH   18

Definition at line 405 of file etherfabric.c.

#define FCN_ADR_REGION2_LBN   64

Definition at line 406 of file etherfabric.c.

#define FCN_ADR_REGION2_WIDTH   18

Definition at line 407 of file etherfabric.c.

#define FCN_ADR_REGION3_LBN   96

Definition at line 408 of file etherfabric.c.

#define FCN_ADR_REGION3_WIDTH   18

Definition at line 409 of file etherfabric.c.

#define FCN_INT_EN_REG_KER   0x0010

Definition at line 412 of file etherfabric.c.

Referenced by falcon_interrupts().

#define FCN_MEM_PERR_INT_EN_KER_LBN   5

Definition at line 413 of file etherfabric.c.

#define FCN_MEM_PERR_INT_EN_KER_WIDTH   1

Definition at line 414 of file etherfabric.c.

#define FCN_KER_INT_CHAR_LBN   4

Definition at line 415 of file etherfabric.c.

#define FCN_KER_INT_CHAR_WIDTH   1

Definition at line 416 of file etherfabric.c.

#define FCN_KER_INT_KER_LBN   3

Definition at line 417 of file etherfabric.c.

#define FCN_KER_INT_KER_WIDTH   1

Definition at line 418 of file etherfabric.c.

#define FCN_ILL_ADR_ERR_INT_EN_KER_LBN   2

Definition at line 419 of file etherfabric.c.

#define FCN_ILL_ADR_ERR_INT_EN_KER_WIDTH   1

Definition at line 420 of file etherfabric.c.

#define FCN_SRM_PERR_INT_EN_KER_LBN   1

Definition at line 421 of file etherfabric.c.

#define FCN_SRM_PERR_INT_EN_KER_WIDTH   1

Definition at line 422 of file etherfabric.c.

#define FCN_DRV_INT_EN_KER_LBN   0

Definition at line 423 of file etherfabric.c.

#define FCN_DRV_INT_EN_KER_WIDTH   1

Definition at line 424 of file etherfabric.c.

#define FCN_INT_ADR_REG_KER   0x0030

Definition at line 427 of file etherfabric.c.

Referenced by falcon_init_resources().

#define FCN_INT_ADR_KER_LBN   0

Definition at line 428 of file etherfabric.c.

#define FCN_INT_ADR_KER_WIDTH   EFAB_DMA_TYPE_WIDTH ( 64 )

Definition at line 429 of file etherfabric.c.

#define INT_ISR0_B0   0x90

Definition at line 432 of file etherfabric.c.

Referenced by falcon_clear_interrupts().

#define INT_ISR1_B0   0xA0

Definition at line 433 of file etherfabric.c.

#define FCN_INT_ACK_KER_REG_A1   0x0050

Definition at line 436 of file etherfabric.c.

Referenced by falcon_clear_interrupts().

#define INT_ACK_DUMMY_DATA_LBN   0

Definition at line 437 of file etherfabric.c.

#define INT_ACK_DUMMY_DATA_WIDTH   32

Definition at line 438 of file etherfabric.c.

#define WORK_AROUND_BROKEN_PCI_READS_REG_KER_A1   0x0070

Definition at line 441 of file etherfabric.c.

Referenced by falcon_clear_interrupts().

#define FCN_HW_INIT_REG_KER   0x00c0

Definition at line 444 of file etherfabric.c.

#define FCN_BCSR_TARGET_MASK_LBN   101

Definition at line 445 of file etherfabric.c.

#define FCN_BCSR_TARGET_MASK_WIDTH   4

Definition at line 446 of file etherfabric.c.

#define FCN_EE_SPI_HCMD_REG   0x0100

Definition at line 449 of file etherfabric.c.

Referenced by falcon_spi_rw(), and falcon_spi_wait().

#define FCN_EE_SPI_HCMD_CMD_EN_LBN   31

Definition at line 450 of file etherfabric.c.

#define FCN_EE_SPI_HCMD_CMD_EN_WIDTH   1

Definition at line 451 of file etherfabric.c.

#define FCN_EE_WR_TIMER_ACTIVE_LBN   28

Definition at line 452 of file etherfabric.c.

#define FCN_EE_WR_TIMER_ACTIVE_WIDTH   1

Definition at line 453 of file etherfabric.c.

#define FCN_EE_SPI_HCMD_SF_SEL_LBN   24

Definition at line 454 of file etherfabric.c.

#define FCN_EE_SPI_HCMD_SF_SEL_WIDTH   1

Definition at line 455 of file etherfabric.c.

#define FCN_EE_SPI_EEPROM   0

Definition at line 456 of file etherfabric.c.

Referenced by falcon_spi_rw().

#define FCN_EE_SPI_FLASH   1

Definition at line 457 of file etherfabric.c.

Referenced by falcon_spi_rw().

#define FCN_EE_SPI_HCMD_DABCNT_LBN   16

Definition at line 458 of file etherfabric.c.

#define FCN_EE_SPI_HCMD_DABCNT_WIDTH   5

Definition at line 459 of file etherfabric.c.

#define FCN_EE_SPI_HCMD_READ_LBN   15

Definition at line 460 of file etherfabric.c.

#define FCN_EE_SPI_HCMD_READ_WIDTH   1

Definition at line 461 of file etherfabric.c.

#define FCN_EE_SPI_READ   1

Definition at line 462 of file etherfabric.c.

Referenced by falcon_spi_rw().

#define FCN_EE_SPI_WRITE   0

Definition at line 463 of file etherfabric.c.

Referenced by falcon_spi_rw().

#define FCN_EE_SPI_HCMD_DUBCNT_LBN   12

Definition at line 464 of file etherfabric.c.

#define FCN_EE_SPI_HCMD_DUBCNT_WIDTH   2

Definition at line 465 of file etherfabric.c.

#define FCN_EE_SPI_HCMD_ADBCNT_LBN   8

Definition at line 466 of file etherfabric.c.

#define FCN_EE_SPI_HCMD_ADBCNT_WIDTH   2

Definition at line 467 of file etherfabric.c.

#define FCN_EE_SPI_HCMD_ENC_LBN   0

Definition at line 468 of file etherfabric.c.

#define FCN_EE_SPI_HCMD_ENC_WIDTH   8

Definition at line 469 of file etherfabric.c.

#define FCN_EE_SPI_HADR_REG   0x0110

Definition at line 472 of file etherfabric.c.

Referenced by falcon_spi_rw().

#define FCN_EE_SPI_HADR_DUBYTE_LBN   24

Definition at line 473 of file etherfabric.c.

#define FCN_EE_SPI_HADR_DUBYTE_WIDTH   8

Definition at line 474 of file etherfabric.c.

#define FCN_EE_SPI_HADR_ADR_LBN   0

Definition at line 475 of file etherfabric.c.

#define FCN_EE_SPI_HADR_ADR_WIDTH   24

Definition at line 476 of file etherfabric.c.

#define FCN_EE_SPI_HDATA_REG   0x0120

Definition at line 479 of file etherfabric.c.

Referenced by falcon_spi_rw().

#define FCN_EE_SPI_HDATA3_LBN   96

Definition at line 480 of file etherfabric.c.

#define FCN_EE_SPI_HDATA3_WIDTH   32

Definition at line 481 of file etherfabric.c.

#define FCN_EE_SPI_HDATA2_LBN   64

Definition at line 482 of file etherfabric.c.

#define FCN_EE_SPI_HDATA2_WIDTH   32

Definition at line 483 of file etherfabric.c.

#define FCN_EE_SPI_HDATA1_LBN   32

Definition at line 484 of file etherfabric.c.

#define FCN_EE_SPI_HDATA1_WIDTH   32

Definition at line 485 of file etherfabric.c.

#define FCN_EE_SPI_HDATA0_LBN   0

Definition at line 486 of file etherfabric.c.

#define FCN_EE_SPI_HDATA0_WIDTH   32

Definition at line 487 of file etherfabric.c.

#define FCN_EE_VPD_CFG_REG   0x0140

Definition at line 490 of file etherfabric.c.

Referenced by falcon_probe_spi().

#define FCN_EE_VPD_EN_LBN   0

Definition at line 491 of file etherfabric.c.

#define FCN_EE_VPD_EN_WIDTH   1

Definition at line 492 of file etherfabric.c.

#define FCN_EE_VPD_EN_AD9_MODE_LBN   1

Definition at line 493 of file etherfabric.c.

#define FCN_EE_VPD_EN_AD9_MODE_WIDTH   1

Definition at line 494 of file etherfabric.c.

#define FCN_EE_EE_CLOCK_DIV_LBN   112

Definition at line 495 of file etherfabric.c.

#define FCN_EE_EE_CLOCK_DIV_WIDTH   7

Definition at line 496 of file etherfabric.c.

#define FCN_EE_SF_CLOCK_DIV_LBN   120

Definition at line 497 of file etherfabric.c.

#define FCN_EE_SF_CLOCK_DIV_WIDTH   7

Definition at line 498 of file etherfabric.c.

#define FCN_NIC_STAT_REG   0x0200

Definition at line 502 of file etherfabric.c.

Referenced by falcon_init_sram(), falcon_probe_nic_variant(), and falcon_probe_spi().

#define FCN_ONCHIP_SRAM_LBN   16

Definition at line 503 of file etherfabric.c.

#define FCN_ONCHIP_SRAM_WIDTH   1

Definition at line 504 of file etherfabric.c.

#define FCN_SF_PRST_LBN   9

Definition at line 505 of file etherfabric.c.

#define FCN_SF_PRST_WIDTH   1

Definition at line 506 of file etherfabric.c.

#define FCN_EE_PRST_LBN   8

Definition at line 507 of file etherfabric.c.

#define FCN_EE_PRST_WIDTH   1

Definition at line 508 of file etherfabric.c.

#define FCN_EE_STRAP_LBN   7

Definition at line 509 of file etherfabric.c.

#define FCN_EE_STRAP_WIDTH   1

Definition at line 510 of file etherfabric.c.

#define FCN_PCI_PCIX_MODE_LBN   4

Definition at line 511 of file etherfabric.c.

#define FCN_PCI_PCIX_MODE_WIDTH   3

Definition at line 512 of file etherfabric.c.

#define FCN_PCI_PCIX_MODE_PCI33_DECODE   0

Definition at line 513 of file etherfabric.c.

#define FCN_PCI_PCIX_MODE_PCI66_DECODE   1

Definition at line 514 of file etherfabric.c.

#define FCN_PCI_PCIX_MODE_PCIX66_DECODE   5

Definition at line 515 of file etherfabric.c.

#define FCN_PCI_PCIX_MODE_PCIX100_DECODE   6

Definition at line 516 of file etherfabric.c.

#define FCN_PCI_PCIX_MODE_PCIX133_DECODE   7

Definition at line 517 of file etherfabric.c.

#define FCN_STRAP_ISCSI_EN_LBN   3

Definition at line 518 of file etherfabric.c.

#define FCN_STRAP_ISCSI_EN_WIDTH   1

Definition at line 519 of file etherfabric.c.

#define FCN_STRAP_PINS_LBN   0

Definition at line 520 of file etherfabric.c.

#define FCN_STRAP_PINS_WIDTH   3

Definition at line 521 of file etherfabric.c.

#define FCN_STRAP_10G_LBN   2

Definition at line 522 of file etherfabric.c.

#define FCN_STRAP_10G_WIDTH   1

Definition at line 523 of file etherfabric.c.

#define FCN_STRAP_DUAL_PORT_LBN   1

Definition at line 524 of file etherfabric.c.

#define FCN_STRAP_DUAL_PORT_WIDTH   1

Definition at line 525 of file etherfabric.c.

#define FCN_STRAP_PCIE_LBN   0

Definition at line 526 of file etherfabric.c.

#define FCN_STRAP_PCIE_WIDTH   1

Definition at line 527 of file etherfabric.c.

#define FALCON_REV_A0   0

Definition at line 530 of file etherfabric.c.

#define FALCON_REV_A1   1

Definition at line 531 of file etherfabric.c.

#define FALCON_REV_B0   2

#define FCN_GPIO_CTL_REG_KER   0x0210

#define FCN_GPIO_CTL_REG_KER   0x0210

Definition at line 536 of file etherfabric.c.

#define FCN_GPIO3_OEN_LBN   27

Definition at line 538 of file etherfabric.c.

#define FCN_GPIO3_OEN_WIDTH   1

Definition at line 539 of file etherfabric.c.

#define FCN_GPIO2_OEN_LBN   26

Definition at line 540 of file etherfabric.c.

#define FCN_GPIO2_OEN_WIDTH   1

Definition at line 541 of file etherfabric.c.

#define FCN_GPIO1_OEN_LBN   25

Definition at line 542 of file etherfabric.c.

#define FCN_GPIO1_OEN_WIDTH   1

Definition at line 543 of file etherfabric.c.

#define FCN_GPIO0_OEN_LBN   24

Definition at line 544 of file etherfabric.c.

#define FCN_GPIO0_OEN_WIDTH   1

Definition at line 545 of file etherfabric.c.

#define FCN_GPIO3_OUT_LBN   19

Definition at line 547 of file etherfabric.c.

#define FCN_GPIO3_OUT_WIDTH   1

Definition at line 548 of file etherfabric.c.

#define FCN_GPIO2_OUT_LBN   18

Definition at line 549 of file etherfabric.c.

#define FCN_GPIO2_OUT_WIDTH   1

Definition at line 550 of file etherfabric.c.

#define FCN_GPIO1_OUT_LBN   17

Definition at line 551 of file etherfabric.c.

#define FCN_GPIO1_OUT_WIDTH   1

Definition at line 552 of file etherfabric.c.

#define FCN_GPIO0_OUT_LBN   16

Definition at line 553 of file etherfabric.c.

#define FCN_GPIO0_OUT_WIDTH   1

Definition at line 554 of file etherfabric.c.

#define FCN_GPIO3_IN_LBN   11

Definition at line 556 of file etherfabric.c.

#define FCN_GPIO3_IN_WIDTH   1

Definition at line 557 of file etherfabric.c.

#define FCN_GPIO2_IN_LBN   10

Definition at line 558 of file etherfabric.c.

#define FCN_GPIO2_IN_WIDTH   1

Definition at line 559 of file etherfabric.c.

#define FCN_GPIO1_IN_LBN   9

Definition at line 560 of file etherfabric.c.

#define FCN_GPIO1_IN_WIDTH   1

Definition at line 561 of file etherfabric.c.

#define FCN_GPIO0_IN_LBN   8

Definition at line 562 of file etherfabric.c.

#define FCN_GPIO0_IN_WIDTH   1

Definition at line 563 of file etherfabric.c.

#define FCN_FLASH_PRESENT_LBN   7

Definition at line 565 of file etherfabric.c.

#define FCN_FLASH_PRESENT_WIDTH   1

Definition at line 566 of file etherfabric.c.

#define FCN_EEPROM_PRESENT_LBN   6

Definition at line 567 of file etherfabric.c.

#define FCN_EEPROM_PRESENT_WIDTH   1

Definition at line 568 of file etherfabric.c.

#define FCN_BOOTED_USING_NVDEVICE_LBN   3

Definition at line 569 of file etherfabric.c.

#define FCN_BOOTED_USING_NVDEVICE_WIDTH   1

Definition at line 570 of file etherfabric.c.

#define FCN_NV_MAGIC_NUMBER   0xFA1C

Definition at line 573 of file etherfabric.c.

Referenced by falcon_probe_nvram().

#define FCN_GLB_CTL_REG_KER   0x0220

Definition at line 576 of file etherfabric.c.

Referenced by falcon_reset().

#define FCN_EXT_PHY_RST_CTL_LBN   63

Definition at line 577 of file etherfabric.c.

#define FCN_EXT_PHY_RST_CTL_WIDTH   1

Definition at line 578 of file etherfabric.c.

#define FCN_PCIE_SD_RST_CTL_LBN   61

Definition at line 579 of file etherfabric.c.

#define FCN_PCIE_SD_RST_CTL_WIDTH   1

Definition at line 580 of file etherfabric.c.

#define FCN_PCIE_STCK_RST_CTL_LBN   59

Definition at line 581 of file etherfabric.c.

#define FCN_PCIE_STCK_RST_CTL_WIDTH   1

Definition at line 582 of file etherfabric.c.

#define FCN_PCIE_NSTCK_RST_CTL_LBN   58

Definition at line 583 of file etherfabric.c.

#define FCN_PCIE_NSTCK_RST_CTL_WIDTH   1

Definition at line 584 of file etherfabric.c.

#define FCN_PCIE_CORE_RST_CTL_LBN   57

Definition at line 585 of file etherfabric.c.

#define FCN_PCIE_CORE_RST_CTL_WIDTH   1

Definition at line 586 of file etherfabric.c.

#define FCN_EE_RST_CTL_LBN   49

Definition at line 587 of file etherfabric.c.

#define FCN_EE_RST_CTL_WIDTH   1

Definition at line 588 of file etherfabric.c.

#define FCN_RST_EXT_PHY_LBN   31

Definition at line 589 of file etherfabric.c.

#define FCN_RST_EXT_PHY_WIDTH   1

Definition at line 590 of file etherfabric.c.

#define FCN_EXT_PHY_RST_DUR_LBN   1

Definition at line 591 of file etherfabric.c.

#define FCN_EXT_PHY_RST_DUR_WIDTH   3

Definition at line 592 of file etherfabric.c.

#define FCN_SWRST_LBN   0

Definition at line 593 of file etherfabric.c.

#define FCN_SWRST_WIDTH   1

Definition at line 594 of file etherfabric.c.

#define INCLUDE_IN_RESET   0

Definition at line 595 of file etherfabric.c.

#define EXCLUDE_FROM_RESET   1

Definition at line 596 of file etherfabric.c.

Referenced by falcon_reset().

#define FCN_ALTERA_BUILD_REG_KER   0x0300

Definition at line 599 of file etherfabric.c.

Referenced by falcon_probe_nic_variant().

#define FCN_VER_MAJOR_LBN   24

Definition at line 600 of file etherfabric.c.

#define FCN_VER_MAJOR_WIDTH   8

Definition at line 601 of file etherfabric.c.

#define FCN_VER_MINOR_LBN   16

Definition at line 602 of file etherfabric.c.

#define FCN_VER_MINOR_WIDTH   8

Definition at line 603 of file etherfabric.c.

#define FCN_VER_BUILD_LBN   0

Definition at line 604 of file etherfabric.c.

#define FCN_VER_BUILD_WIDTH   16

Definition at line 605 of file etherfabric.c.

#define FCN_VER_ALL_LBN   0

Definition at line 606 of file etherfabric.c.

#define FCN_VER_ALL_WIDTH   32

Definition at line 607 of file etherfabric.c.

#define FCN_SPARE_REG_KER   0x310

Definition at line 610 of file etherfabric.c.

Referenced by falcon_setup_nic().

#define FCN_MEM_PERR_EN_TX_DATA_LBN   72

Definition at line 611 of file etherfabric.c.

#define FCN_MEM_PERR_EN_TX_DATA_WIDTH   2

Definition at line 612 of file etherfabric.c.

#define FCN_TIMER_CMD_REG_KER   0x420

Definition at line 615 of file etherfabric.c.

Referenced by falcon_setup_nic().

#define FCN_TIMER_MODE_LBN   12

Definition at line 616 of file etherfabric.c.

#define FCN_TIMER_MODE_WIDTH   2

Definition at line 617 of file etherfabric.c.

#define FCN_TIMER_MODE_DIS   0

Definition at line 618 of file etherfabric.c.

Referenced by falcon_setup_nic().

#define FCN_TIMER_MODE_INT_HLDOFF   1

Definition at line 619 of file etherfabric.c.

#define FCN_TIMER_VAL_LBN   0

Definition at line 620 of file etherfabric.c.

#define FCN_TIMER_VAL_WIDTH   12

Definition at line 621 of file etherfabric.c.

#define FCN_RX_CFG_REG_KER   0x800

Definition at line 653 of file etherfabric.c.

Referenced by falcon_setup_nic().

#define FCN_RX_XOFF_EN_LBN   0

Definition at line 625 of file etherfabric.c.

#define FCN_RX_XOFF_EN_WIDTH   1

Definition at line 626 of file etherfabric.c.

#define FCN_SRM_RX_DC_CFG_REG_KER   0x610

Definition at line 629 of file etherfabric.c.

Referenced by falcon_setup_nic().

#define FCN_SRM_RX_DC_BASE_ADR_LBN   0

Definition at line 630 of file etherfabric.c.

#define FCN_SRM_RX_DC_BASE_ADR_WIDTH   21

Definition at line 631 of file etherfabric.c.

#define FCN_SRM_TX_DC_CFG_REG_KER   0x620

Definition at line 634 of file etherfabric.c.

Referenced by falcon_setup_nic().

#define FCN_SRM_TX_DC_BASE_ADR_LBN   0

Definition at line 635 of file etherfabric.c.

#define FCN_SRM_TX_DC_BASE_ADR_WIDTH   21

Definition at line 636 of file etherfabric.c.

#define FCN_SRM_CFG_REG_KER   0x630

Definition at line 639 of file etherfabric.c.

Referenced by falcon_init_sram().

#define FCN_SRAM_OOB_ADR_INTEN_LBN   5

Definition at line 640 of file etherfabric.c.

#define FCN_SRAM_OOB_ADR_INTEN_WIDTH   1

Definition at line 641 of file etherfabric.c.

#define FCN_SRAM_OOB_BUF_INTEN_LBN   4

Definition at line 642 of file etherfabric.c.

#define FCN_SRAM_OOB_BUF_INTEN_WIDTH   1

Definition at line 643 of file etherfabric.c.

#define FCN_SRAM_OOB_BT_INIT_EN_LBN   3

Definition at line 644 of file etherfabric.c.

#define FCN_SRAM_OOB_BT_INIT_EN_WIDTH   1

Definition at line 645 of file etherfabric.c.

#define FCN_SRM_NUM_BANK_LBN   2

Definition at line 646 of file etherfabric.c.

#define FCN_SRM_NUM_BANK_WIDTH   1

Definition at line 647 of file etherfabric.c.

#define FCN_SRM_BANK_SIZE_LBN   0

Definition at line 648 of file etherfabric.c.

#define FCN_SRM_BANK_SIZE_WIDTH   2

Definition at line 649 of file etherfabric.c.

#define FCN_SRM_NUM_BANKS_AND_BANK_SIZE_LBN   0

Definition at line 650 of file etherfabric.c.

#define FCN_SRM_NUM_BANKS_AND_BANK_SIZE_WIDTH   3

Definition at line 651 of file etherfabric.c.

#define FCN_RX_CFG_REG_KER   0x800

Definition at line 653 of file etherfabric.c.

#define FCN_RX_INGR_EN_B0_LBN   47

Definition at line 654 of file etherfabric.c.

#define FCN_RX_INGR_EN_B0_WIDTH   1

Definition at line 655 of file etherfabric.c.

#define FCN_RX_USR_BUF_SIZE_B0_LBN   19

Definition at line 656 of file etherfabric.c.

#define FCN_RX_USR_BUF_SIZE_B0_WIDTH   9

Definition at line 657 of file etherfabric.c.

#define FCN_RX_XON_MAC_TH_B0_LBN   10

Definition at line 658 of file etherfabric.c.

#define FCN_RX_XON_MAC_TH_B0_WIDTH   9

Definition at line 659 of file etherfabric.c.

#define FCN_RX_XOFF_MAC_TH_B0_LBN   1

Definition at line 660 of file etherfabric.c.

#define FCN_RX_XOFF_MAC_TH_B0_WIDTH   9

Definition at line 661 of file etherfabric.c.

#define FCN_RX_XOFF_MAC_EN_B0_LBN   0

Definition at line 662 of file etherfabric.c.

#define FCN_RX_XOFF_MAC_EN_B0_WIDTH   1

Definition at line 663 of file etherfabric.c.

#define FCN_RX_USR_BUF_SIZE_A1_LBN   11

Definition at line 673 of file etherfabric.c.

#define FCN_RX_USR_BUF_SIZE_A1_WIDTH   9

Definition at line 674 of file etherfabric.c.

#define FCN_RX_XON_MAC_TH_A1_LBN   6

Definition at line 666 of file etherfabric.c.

#define FCN_RX_XON_MAC_TH_A1_WIDTH   5

Definition at line 667 of file etherfabric.c.

#define FCN_RX_XOFF_MAC_TH_A1_LBN   1

Definition at line 668 of file etherfabric.c.

#define FCN_RX_XOFF_MAC_TH_A1_WIDTH   5

Definition at line 669 of file etherfabric.c.

#define FCN_RX_XOFF_MAC_EN_A1_LBN   0

Definition at line 675 of file etherfabric.c.

#define FCN_RX_XOFF_MAC_EN_A1_WIDTH   1

Definition at line 676 of file etherfabric.c.

#define FCN_RX_USR_BUF_SIZE_A1_LBN   11

Definition at line 673 of file etherfabric.c.

#define FCN_RX_USR_BUF_SIZE_A1_WIDTH   9

Definition at line 674 of file etherfabric.c.

#define FCN_RX_XOFF_MAC_EN_A1_LBN   0

Definition at line 675 of file etherfabric.c.

#define FCN_RX_XOFF_MAC_EN_A1_WIDTH   1

Definition at line 676 of file etherfabric.c.

#define FCN_RX_FILTER_CTL_REG_KER   0x810

Definition at line 679 of file etherfabric.c.

Referenced by falcon_setup_nic().

#define FCN_UDP_FULL_SRCH_LIMIT_LBN   32

Definition at line 680 of file etherfabric.c.

#define FCN_UDP_FULL_SRCH_LIMIT_WIDTH   8

Definition at line 681 of file etherfabric.c.

#define FCN_NUM_KER_LBN   24

Definition at line 682 of file etherfabric.c.

#define FCN_NUM_KER_WIDTH   2

Definition at line 683 of file etherfabric.c.

#define FCN_UDP_WILD_SRCH_LIMIT_LBN   16

Definition at line 684 of file etherfabric.c.

#define FCN_UDP_WILD_SRCH_LIMIT_WIDTH   8

Definition at line 685 of file etherfabric.c.

#define FCN_TCP_WILD_SRCH_LIMIT_LBN   8

Definition at line 686 of file etherfabric.c.

#define FCN_TCP_WILD_SRCH_LIMIT_WIDTH   8

Definition at line 687 of file etherfabric.c.

#define FCN_TCP_FULL_SRCH_LIMIT_LBN   0

Definition at line 688 of file etherfabric.c.

#define FCN_TCP_FULL_SRCH_LIMIT_WIDTH   8

Definition at line 689 of file etherfabric.c.

#define FCN_RX_FLUSH_DESCQ_REG_KER   0x0820

Definition at line 692 of file etherfabric.c.

#define FCN_RX_FLUSH_DESCQ_CMD_LBN   24

Definition at line 693 of file etherfabric.c.

#define FCN_RX_FLUSH_DESCQ_CMD_WIDTH   1

Definition at line 694 of file etherfabric.c.

#define FCN_RX_FLUSH_DESCQ_LBN   0

Definition at line 695 of file etherfabric.c.

#define FCN_RX_FLUSH_DESCQ_WIDTH   12

Definition at line 696 of file etherfabric.c.

#define FCN_RX_DESC_UPD_REG_KER   0x0830

Definition at line 699 of file etherfabric.c.

#define FCN_RX_DESC_WPTR_LBN   96

Definition at line 700 of file etherfabric.c.

#define FCN_RX_DESC_WPTR_WIDTH   12

Definition at line 701 of file etherfabric.c.

#define FCN_RX_DESC_UPD_REG_KER_DWORD   ( FCN_RX_DESC_UPD_REG_KER + 12 )

Definition at line 702 of file etherfabric.c.

Referenced by falcon_notify_rx_desc().

#define FCN_RX_DESC_WPTR_DWORD_LBN   0

Definition at line 703 of file etherfabric.c.

#define FCN_RX_DESC_WPTR_DWORD_WIDTH   12

Definition at line 704 of file etherfabric.c.

#define FCN_RX_DC_CFG_REG_KER   0x840

Definition at line 707 of file etherfabric.c.

Referenced by falcon_setup_nic().

#define FCN_RX_DC_SIZE_LBN   0

Definition at line 708 of file etherfabric.c.

#define FCN_RX_DC_SIZE_WIDTH   2

Definition at line 709 of file etherfabric.c.

#define FCN_RX_SELF_RST_REG_KER   0x890

Definition at line 711 of file etherfabric.c.

Referenced by falcon_setup_nic().

#define FCN_RX_ISCSI_DIS_LBN   17

Definition at line 712 of file etherfabric.c.

#define FCN_RX_ISCSI_DIS_WIDTH   1

Definition at line 713 of file etherfabric.c.

#define FCN_RX_NODESC_WAIT_DIS_LBN   9

Definition at line 714 of file etherfabric.c.

#define FCN_RX_NODESC_WAIT_DIS_WIDTH   1

Definition at line 715 of file etherfabric.c.

#define FCN_RX_RECOVERY_EN_LBN   8

Definition at line 716 of file etherfabric.c.

#define FCN_RX_RECOVERY_EN_WIDTH   1

Definition at line 717 of file etherfabric.c.

#define FCN_TX_FLUSH_DESCQ_REG_KER   0x0a00

Definition at line 720 of file etherfabric.c.

#define FCN_TX_FLUSH_DESCQ_CMD_LBN   12

Definition at line 721 of file etherfabric.c.

#define FCN_TX_FLUSH_DESCQ_CMD_WIDTH   1

Definition at line 722 of file etherfabric.c.

#define FCN_TX_FLUSH_DESCQ_LBN   0

Definition at line 723 of file etherfabric.c.

#define FCN_TX_FLUSH_DESCQ_WIDTH   12

Definition at line 724 of file etherfabric.c.

#define FCN_TX_CFG2_REG_KER   0xa80

Definition at line 727 of file etherfabric.c.

Referenced by falcon_setup_nic().

#define FCN_TX_DIS_NON_IP_EV_LBN   17

Definition at line 728 of file etherfabric.c.

#define FCN_TX_DIS_NON_IP_EV_WIDTH   1

Definition at line 729 of file etherfabric.c.

#define FCN_TX_DESC_UPD_REG_KER   0x0a10

Definition at line 732 of file etherfabric.c.

#define FCN_TX_DESC_WPTR_LBN   96

Definition at line 733 of file etherfabric.c.

#define FCN_TX_DESC_WPTR_WIDTH   12

Definition at line 734 of file etherfabric.c.

#define FCN_TX_DESC_UPD_REG_KER_DWORD   ( FCN_TX_DESC_UPD_REG_KER + 12 )

Definition at line 735 of file etherfabric.c.

Referenced by falcon_notify_tx_desc().

#define FCN_TX_DESC_WPTR_DWORD_LBN   0

Definition at line 736 of file etherfabric.c.

#define FCN_TX_DESC_WPTR_DWORD_WIDTH   12

Definition at line 737 of file etherfabric.c.

#define FCN_TX_DC_CFG_REG_KER   0xa20

Definition at line 740 of file etherfabric.c.

Referenced by falcon_setup_nic().

#define FCN_TX_DC_SIZE_LBN   0

Definition at line 741 of file etherfabric.c.

#define FCN_TX_DC_SIZE_WIDTH   2

Definition at line 742 of file etherfabric.c.

#define FCN_MD_TXD_REG_KER   0xc00

Definition at line 745 of file etherfabric.c.

Referenced by falcon_mdio_write().

#define FCN_MD_TXD_LBN   0

Definition at line 746 of file etherfabric.c.

#define FCN_MD_TXD_WIDTH   16

Definition at line 747 of file etherfabric.c.

#define FCN_MD_RXD_REG_KER   0xc10

Definition at line 750 of file etherfabric.c.

Referenced by falcon_mdio_read().

#define FCN_MD_RXD_LBN   0

Definition at line 751 of file etherfabric.c.

#define FCN_MD_RXD_WIDTH   16

Definition at line 752 of file etherfabric.c.

#define FCN_MD_CS_REG_KER   0xc20

Definition at line 755 of file etherfabric.c.

Referenced by falcon_mdio_read(), and falcon_mdio_write().

#define FCN_MD_GC_LBN   4

Definition at line 756 of file etherfabric.c.

#define FCN_MD_GC_WIDTH   1

Definition at line 757 of file etherfabric.c.

#define FCN_MD_RIC_LBN   2

Definition at line 758 of file etherfabric.c.

#define FCN_MD_RIC_WIDTH   1

Definition at line 759 of file etherfabric.c.

#define FCN_MD_RDC_LBN   1

Definition at line 760 of file etherfabric.c.

#define FCN_MD_RDC_WIDTH   1

Definition at line 761 of file etherfabric.c.

#define FCN_MD_WRC_LBN   0

Definition at line 762 of file etherfabric.c.

#define FCN_MD_WRC_WIDTH   1

Definition at line 763 of file etherfabric.c.

#define FCN_MD_PHY_ADR_REG_KER   0xc30

Definition at line 766 of file etherfabric.c.

Referenced by falcon_mdio_read(), and falcon_mdio_write().

#define FCN_MD_PHY_ADR_LBN   0

Definition at line 767 of file etherfabric.c.

#define FCN_MD_PHY_ADR_WIDTH   16

Definition at line 768 of file etherfabric.c.

#define FCN_MD_ID_REG_KER   0xc40

Definition at line 771 of file etherfabric.c.

Referenced by falcon_mdio_read(), and falcon_mdio_write().

#define FCN_MD_PRT_ADR_LBN   11

Definition at line 772 of file etherfabric.c.

#define FCN_MD_PRT_ADR_WIDTH   5

Definition at line 773 of file etherfabric.c.

#define FCN_MD_DEV_ADR_LBN   6

Definition at line 774 of file etherfabric.c.

#define FCN_MD_DEV_ADR_WIDTH   5

Definition at line 775 of file etherfabric.c.

#define FCN_MD_STAT_REG_KER   0xc50

Definition at line 778 of file etherfabric.c.

Referenced by falcon_gmii_wait().

#define FCN_MD_PINT_LBN   4

Definition at line 779 of file etherfabric.c.

#define FCN_MD_PINT_WIDTH   1

Definition at line 780 of file etherfabric.c.

#define FCN_MD_DONE_LBN   3

Definition at line 781 of file etherfabric.c.

#define FCN_MD_DONE_WIDTH   1

Definition at line 782 of file etherfabric.c.

#define FCN_MD_BSERR_LBN   2

Definition at line 783 of file etherfabric.c.

#define FCN_MD_BSERR_WIDTH   1

Definition at line 784 of file etherfabric.c.

#define FCN_MD_LNFL_LBN   1

Definition at line 785 of file etherfabric.c.

#define FCN_MD_LNFL_WIDTH   1

Definition at line 786 of file etherfabric.c.

#define FCN_MD_BSY_LBN   0

Definition at line 787 of file etherfabric.c.

#define FCN_MD_BSY_WIDTH   1

Definition at line 788 of file etherfabric.c.

#define FCN_MAC0_CTRL_REG_KER   0xc80

Definition at line 791 of file etherfabric.c.

Referenced by falcon_reconfigure_mac_wrapper().

#define FCN_MAC1_CTRL_REG_KER   0xc90

Definition at line 792 of file etherfabric.c.

#define FCN_MAC_XOFF_VAL_LBN   16

Definition at line 793 of file etherfabric.c.

#define FCN_MAC_XOFF_VAL_WIDTH   16

Definition at line 794 of file etherfabric.c.

#define FCN_MAC_BCAD_ACPT_LBN   4

Definition at line 795 of file etherfabric.c.

#define FCN_MAC_BCAD_ACPT_WIDTH   1

Definition at line 796 of file etherfabric.c.

#define FCN_MAC_UC_PROM_LBN   3

Definition at line 797 of file etherfabric.c.

#define FCN_MAC_UC_PROM_WIDTH   1

Definition at line 798 of file etherfabric.c.

#define FCN_MAC_LINK_STATUS_LBN   2

Definition at line 799 of file etherfabric.c.

#define FCN_MAC_LINK_STATUS_WIDTH   1

Definition at line 800 of file etherfabric.c.

#define FCN_MAC_SPEED_LBN   0

Definition at line 801 of file etherfabric.c.

#define FCN_MAC_SPEED_WIDTH   2

Definition at line 802 of file etherfabric.c.

#define XX_TXDRV_DEQ_DEFAULT   0xe

Definition at line 805 of file etherfabric.c.

Referenced by falcon_setup_xaui().

#define XX_TXDRV_DTX_DEFAULT   0x5

Definition at line 806 of file etherfabric.c.

Referenced by falcon_setup_xaui().

#define XX_SD_CTL_DRV_DEFAULT   0

Definition at line 807 of file etherfabric.c.

Referenced by falcon_setup_xaui().

#define FALCON_GMAC_REGBANK   0xe00

Definition at line 810 of file etherfabric.c.

#define FALCON_GMAC_REGBANK_SIZE   0x200

Definition at line 811 of file etherfabric.c.

#define FALCON_GMAC_REG_SIZE   0x10

Definition at line 812 of file etherfabric.c.

#define FALCON_XMAC_REGBANK   0x1200

Definition at line 815 of file etherfabric.c.

#define FALCON_XMAC_REGBANK_SIZE   0x200

Definition at line 816 of file etherfabric.c.

#define FALCON_XMAC_REG_SIZE   0x10

Definition at line 817 of file etherfabric.c.

#define FCN_XM_ADR_LO_REG_MAC   0x00

Definition at line 820 of file etherfabric.c.

Referenced by falcon_reconfigure_xmac().

#define FCN_XM_ADR_3_LBN   24

Definition at line 821 of file etherfabric.c.

#define FCN_XM_ADR_3_WIDTH   8

Definition at line 822 of file etherfabric.c.

#define FCN_XM_ADR_2_LBN   16

Definition at line 823 of file etherfabric.c.

#define FCN_XM_ADR_2_WIDTH   8

Definition at line 824 of file etherfabric.c.

#define FCN_XM_ADR_1_LBN   8

Definition at line 825 of file etherfabric.c.

#define FCN_XM_ADR_1_WIDTH   8

Definition at line 826 of file etherfabric.c.

#define FCN_XM_ADR_0_LBN   0

Definition at line 827 of file etherfabric.c.

#define FCN_XM_ADR_0_WIDTH   8

Definition at line 828 of file etherfabric.c.

#define FCN_XM_ADR_HI_REG_MAC   0x01

Definition at line 831 of file etherfabric.c.

Referenced by falcon_reconfigure_xmac().

#define FCN_XM_ADR_5_LBN   8

Definition at line 832 of file etherfabric.c.

#define FCN_XM_ADR_5_WIDTH   8

Definition at line 833 of file etherfabric.c.

#define FCN_XM_ADR_4_LBN   0

Definition at line 834 of file etherfabric.c.

#define FCN_XM_ADR_4_WIDTH   8

Definition at line 835 of file etherfabric.c.

#define FCN_XM_GLB_CFG_REG_MAC   0x02

Definition at line 838 of file etherfabric.c.

Referenced by falcon_reconfigure_xmac(), and falcon_reset_xmac().

#define FCN_XM_RX_STAT_EN_LBN   11

Definition at line 839 of file etherfabric.c.

#define FCN_XM_RX_STAT_EN_WIDTH   1

Definition at line 840 of file etherfabric.c.

#define FCN_XM_TX_STAT_EN_LBN   10

Definition at line 841 of file etherfabric.c.

#define FCN_XM_TX_STAT_EN_WIDTH   1

Definition at line 842 of file etherfabric.c.

#define FCN_XM_RX_JUMBO_MODE_LBN   6

Definition at line 843 of file etherfabric.c.

#define FCN_XM_RX_JUMBO_MODE_WIDTH   1

Definition at line 844 of file etherfabric.c.

#define FCN_XM_CORE_RST_LBN   0

Definition at line 845 of file etherfabric.c.

#define FCN_XM_CORE_RST_WIDTH   1

Definition at line 846 of file etherfabric.c.

#define FCN_XM_TX_CFG_REG_MAC   0x03

Definition at line 849 of file etherfabric.c.

Referenced by falcon_reconfigure_xmac().

#define FCN_XM_IPG_LBN   16

Definition at line 850 of file etherfabric.c.

#define FCN_XM_IPG_WIDTH   4

Definition at line 851 of file etherfabric.c.

#define FCN_XM_FCNTL_LBN   10

Definition at line 852 of file etherfabric.c.

#define FCN_XM_FCNTL_WIDTH   1

Definition at line 853 of file etherfabric.c.

#define FCN_XM_TXCRC_LBN   8

Definition at line 854 of file etherfabric.c.

#define FCN_XM_TXCRC_WIDTH   1

Definition at line 855 of file etherfabric.c.

#define FCN_XM_AUTO_PAD_LBN   5

Definition at line 856 of file etherfabric.c.

#define FCN_XM_AUTO_PAD_WIDTH   1

Definition at line 857 of file etherfabric.c.

#define FCN_XM_TX_PRMBL_LBN   2

Definition at line 858 of file etherfabric.c.

#define FCN_XM_TX_PRMBL_WIDTH   1

Definition at line 859 of file etherfabric.c.

#define FCN_XM_TXEN_LBN   1

Definition at line 860 of file etherfabric.c.

#define FCN_XM_TXEN_WIDTH   1

Definition at line 861 of file etherfabric.c.

#define FCN_XM_RX_CFG_REG_MAC   0x04

Definition at line 864 of file etherfabric.c.

Referenced by falcon_reconfigure_xmac().

#define FCN_XM_PASS_CRC_ERR_LBN   25

Definition at line 865 of file etherfabric.c.

#define FCN_XM_PASS_CRC_ERR_WIDTH   1

Definition at line 866 of file etherfabric.c.

#define FCN_XM_AUTO_DEPAD_LBN   8

Definition at line 867 of file etherfabric.c.

#define FCN_XM_AUTO_DEPAD_WIDTH   1

Definition at line 868 of file etherfabric.c.

#define FCN_XM_RXEN_LBN   1

Definition at line 869 of file etherfabric.c.

#define FCN_XM_RXEN_WIDTH   1

Definition at line 870 of file etherfabric.c.

#define FCN_XM_MGT_INT_MSK_REG_MAC_B0   0x5

Definition at line 873 of file etherfabric.c.

Referenced by falcon_mask_status_intr().

#define FCN_XM_MSK_PRMBLE_ERR_LBN   2

Definition at line 874 of file etherfabric.c.

#define FCN_XM_MSK_PRMBLE_ERR_WIDTH   1

Definition at line 875 of file etherfabric.c.

#define FCN_XM_MSK_RMTFLT_LBN   1

Definition at line 876 of file etherfabric.c.

#define FCN_XM_MSK_RMTFLT_WIDTH   1

Definition at line 877 of file etherfabric.c.

#define FCN_XM_MSK_LCLFLT_LBN   0

Definition at line 878 of file etherfabric.c.

#define FCN_XM_MSK_LCLFLT_WIDTH   1

Definition at line 879 of file etherfabric.c.

#define FCN_XM_FC_REG_MAC   0x7

Definition at line 882 of file etherfabric.c.

Referenced by falcon_reconfigure_xmac().

#define FCN_XM_PAUSE_TIME_LBN   16

Definition at line 883 of file etherfabric.c.

#define FCN_XM_PAUSE_TIME_WIDTH   16

Definition at line 884 of file etherfabric.c.

#define FCN_XM_DIS_FCNTL_LBN   0

Definition at line 885 of file etherfabric.c.

#define FCN_XM_DIS_FCNTL_WIDTH   1

Definition at line 886 of file etherfabric.c.

#define FCN_XM_TX_PARAM_REG_MAC   0x0d

Definition at line 889 of file etherfabric.c.

Referenced by falcon_reconfigure_xmac().

#define FCN_XM_TX_JUMBO_MODE_LBN   31

Definition at line 890 of file etherfabric.c.

#define FCN_XM_TX_JUMBO_MODE_WIDTH   1

Definition at line 891 of file etherfabric.c.

#define FCN_XM_MAX_TX_FRM_SIZE_LBN   16

Definition at line 892 of file etherfabric.c.

#define FCN_XM_MAX_TX_FRM_SIZE_WIDTH   14

Definition at line 893 of file etherfabric.c.

#define FCN_XM_ACPT_ALL_MCAST_LBN   11

Definition at line 894 of file etherfabric.c.

#define FCN_XM_ACPT_ALL_MCAST_WIDTH   1

Definition at line 895 of file etherfabric.c.

#define FCN_XM_RX_PARAM_REG_MAC   0x0e

Definition at line 898 of file etherfabric.c.

Referenced by falcon_reconfigure_xmac().

#define FCN_XM_MAX_RX_FRM_SIZE_LBN   0

Definition at line 899 of file etherfabric.c.

#define FCN_XM_MAX_RX_FRM_SIZE_WIDTH   14

Definition at line 900 of file etherfabric.c.

#define FCN_XM_MGT_INT_REG_MAC_B0   0x0f

Definition at line 903 of file etherfabric.c.

Referenced by falcon_mask_status_intr(), and falcon_xgmii_status().

#define FCN_XM_PRMBLE_ERR   2

Definition at line 904 of file etherfabric.c.

#define FCN_XM_PRMBLE_WIDTH   1

Definition at line 905 of file etherfabric.c.

#define FCN_XM_RMTFLT_LBN   1

Definition at line 906 of file etherfabric.c.

#define FCN_XM_RMTFLT_WIDTH   1

Definition at line 907 of file etherfabric.c.

#define FCN_XM_LCLFLT_LBN   0

Definition at line 908 of file etherfabric.c.

#define FCN_XM_LCLFLT_WIDTH   1

Definition at line 909 of file etherfabric.c.

#define FCN_XX_ALIGN_DONE_LBN   20

Definition at line 912 of file etherfabric.c.

#define FCN_XX_ALIGN_DONE_WIDTH   1

Definition at line 913 of file etherfabric.c.

#define FCN_XX_CORE_STAT_REG_MAC   0x16

Definition at line 914 of file etherfabric.c.

Referenced by falcon_xaui_link_ok().

#define FCN_XX_SYNC_STAT_LBN   16

Definition at line 915 of file etherfabric.c.

#define FCN_XX_SYNC_STAT_WIDTH   4

Definition at line 916 of file etherfabric.c.

#define FCN_XX_SYNC_STAT_DECODE_SYNCED   0xf

Definition at line 917 of file etherfabric.c.

Referenced by falcon_xaui_link_ok().

#define FCN_XX_COMMA_DET_LBN   12

Definition at line 918 of file etherfabric.c.

#define FCN_XX_COMMA_DET_WIDTH   4

Definition at line 919 of file etherfabric.c.

#define FCN_XX_COMMA_DET_RESET   0xf

Definition at line 920 of file etherfabric.c.

Referenced by falcon_xaui_link_ok().

#define FCN_XX_CHARERR_LBN   4

Definition at line 921 of file etherfabric.c.

#define FCN_XX_CHARERR_WIDTH   4

Definition at line 922 of file etherfabric.c.

#define FCN_XX_CHARERR_RESET   0xf

Definition at line 923 of file etherfabric.c.

Referenced by falcon_xaui_link_ok().

#define FCN_XX_DISPERR_LBN   0

Definition at line 924 of file etherfabric.c.

#define FCN_XX_DISPERR_WIDTH   4

Definition at line 925 of file etherfabric.c.

#define FCN_XX_DISPERR_RESET   0xf

Definition at line 926 of file etherfabric.c.

Referenced by falcon_xaui_link_ok().

#define FCN_XX_PWR_RST_REG_MAC   0x10

Definition at line 929 of file etherfabric.c.

Referenced by falcon_reset_xaui(), and sfe4001_init().

#define FCN_XX_PWRDND_EN_LBN   15

Definition at line 930 of file etherfabric.c.

#define FCN_XX_PWRDND_EN_WIDTH   1

Definition at line 931 of file etherfabric.c.

#define FCN_XX_PWRDNC_EN_LBN   14

Definition at line 932 of file etherfabric.c.

#define FCN_XX_PWRDNC_EN_WIDTH   1

Definition at line 933 of file etherfabric.c.

#define FCN_XX_PWRDNB_EN_LBN   13

Definition at line 934 of file etherfabric.c.

#define FCN_XX_PWRDNB_EN_WIDTH   1

Definition at line 935 of file etherfabric.c.

#define FCN_XX_PWRDNA_EN_LBN   12

Definition at line 936 of file etherfabric.c.

#define FCN_XX_PWRDNA_EN_WIDTH   1

Definition at line 937 of file etherfabric.c.

#define FCN_XX_RSTPLLCD_EN_LBN   9

Definition at line 938 of file etherfabric.c.

#define FCN_XX_RSTPLLCD_EN_WIDTH   1

Definition at line 939 of file etherfabric.c.

#define FCN_XX_RSTPLLAB_EN_LBN   8

Definition at line 940 of file etherfabric.c.

#define FCN_XX_RSTPLLAB_EN_WIDTH   1

Definition at line 941 of file etherfabric.c.

#define FCN_XX_RESETD_EN_LBN   7

Definition at line 942 of file etherfabric.c.

#define FCN_XX_RESETD_EN_WIDTH   1

Definition at line 943 of file etherfabric.c.

#define FCN_XX_RESETC_EN_LBN   6

Definition at line 944 of file etherfabric.c.

#define FCN_XX_RESETC_EN_WIDTH   1

Definition at line 945 of file etherfabric.c.

#define FCN_XX_RESETB_EN_LBN   5

Definition at line 946 of file etherfabric.c.

#define FCN_XX_RESETB_EN_WIDTH   1

Definition at line 947 of file etherfabric.c.

#define FCN_XX_RESETA_EN_LBN   4

Definition at line 948 of file etherfabric.c.

#define FCN_XX_RESETA_EN_WIDTH   1

Definition at line 949 of file etherfabric.c.

#define FCN_XX_RSTXGXSRX_EN_LBN   2

Definition at line 950 of file etherfabric.c.

#define FCN_XX_RSTXGXSRX_EN_WIDTH   1

Definition at line 951 of file etherfabric.c.

#define FCN_XX_RSTXGXSTX_EN_LBN   1

Definition at line 952 of file etherfabric.c.

#define FCN_XX_RSTXGXSTX_EN_WIDTH   1

Definition at line 953 of file etherfabric.c.

#define FCN_XX_RST_XX_EN_LBN   0

Definition at line 954 of file etherfabric.c.

#define FCN_XX_RST_XX_EN_WIDTH   1

Definition at line 955 of file etherfabric.c.

#define FCN_XX_SD_CTL_REG_MAC   0x11

Definition at line 959 of file etherfabric.c.

Referenced by falcon_setup_xaui().

#define FCN_XX_TERMADJ1_LBN   17

Definition at line 960 of file etherfabric.c.

#define FCN_XX_TERMADJ1_WIDTH   1

Definition at line 961 of file etherfabric.c.

#define FCN_XX_TERMADJ0_LBN   16

Definition at line 962 of file etherfabric.c.

#define FCN_XX_TERMADJ0_WIDTH   1

Definition at line 963 of file etherfabric.c.

#define FCN_XX_HIDRVD_LBN   15

Definition at line 964 of file etherfabric.c.

#define FCN_XX_HIDRVD_WIDTH   1

Definition at line 965 of file etherfabric.c.

#define FCN_XX_LODRVD_LBN   14

Definition at line 966 of file etherfabric.c.

#define FCN_XX_LODRVD_WIDTH   1

Definition at line 967 of file etherfabric.c.

#define FCN_XX_HIDRVC_LBN   13

Definition at line 968 of file etherfabric.c.

#define FCN_XX_HIDRVC_WIDTH   1

Definition at line 969 of file etherfabric.c.

#define FCN_XX_LODRVC_LBN   12

Definition at line 970 of file etherfabric.c.

#define FCN_XX_LODRVC_WIDTH   1

Definition at line 971 of file etherfabric.c.

#define FCN_XX_HIDRVB_LBN   11

Definition at line 972 of file etherfabric.c.

#define FCN_XX_HIDRVB_WIDTH   1

Definition at line 973 of file etherfabric.c.

#define FCN_XX_LODRVB_LBN   10

Definition at line 974 of file etherfabric.c.

#define FCN_XX_LODRVB_WIDTH   1

Definition at line 975 of file etherfabric.c.

#define FCN_XX_HIDRVA_LBN   9

Definition at line 976 of file etherfabric.c.

#define FCN_XX_HIDRVA_WIDTH   1

Definition at line 977 of file etherfabric.c.

#define FCN_XX_LODRVA_LBN   8

Definition at line 978 of file etherfabric.c.

#define FCN_XX_LODRVA_WIDTH   1

Definition at line 979 of file etherfabric.c.

#define FCN_XX_LPBKD_LBN   3

Definition at line 980 of file etherfabric.c.

#define FCN_XX_LPBKD_WIDTH   1

Definition at line 981 of file etherfabric.c.

#define FCN_XX_LPBKC_LBN   2

Definition at line 982 of file etherfabric.c.

#define FCN_XX_LPBKC_WIDTH   1

Definition at line 983 of file etherfabric.c.

#define FCN_XX_LPBKB_LBN   1

Definition at line 984 of file etherfabric.c.

#define FCN_XX_LPBKB_WIDTH   1

Definition at line 985 of file etherfabric.c.

#define FCN_XX_LPBKA_LBN   0

Definition at line 986 of file etherfabric.c.

#define FCN_XX_LPBKA_WIDTH   1

Definition at line 987 of file etherfabric.c.

#define FCN_XX_TXDRV_CTL_REG_MAC   0x12

Definition at line 989 of file etherfabric.c.

Referenced by falcon_setup_xaui().

#define FCN_XX_DEQD_LBN   28

Definition at line 990 of file etherfabric.c.

#define FCN_XX_DEQD_WIDTH   4

Definition at line 991 of file etherfabric.c.

#define FCN_XX_DEQC_LBN   24

Definition at line 992 of file etherfabric.c.

#define FCN_XX_DEQC_WIDTH   4

Definition at line 993 of file etherfabric.c.

#define FCN_XX_DEQB_LBN   20

Definition at line 994 of file etherfabric.c.

#define FCN_XX_DEQB_WIDTH   4

Definition at line 995 of file etherfabric.c.

#define FCN_XX_DEQA_LBN   16

Definition at line 996 of file etherfabric.c.

#define FCN_XX_DEQA_WIDTH   4

Definition at line 997 of file etherfabric.c.

#define FCN_XX_DTXD_LBN   12

Definition at line 998 of file etherfabric.c.

#define FCN_XX_DTXD_WIDTH   4

Definition at line 999 of file etherfabric.c.

#define FCN_XX_DTXC_LBN   8

Definition at line 1000 of file etherfabric.c.

#define FCN_XX_DTXC_WIDTH   4

Definition at line 1001 of file etherfabric.c.

#define FCN_XX_DTXB_LBN   4

Definition at line 1002 of file etherfabric.c.

#define FCN_XX_DTXB_WIDTH   4

Definition at line 1003 of file etherfabric.c.

#define FCN_XX_DTXA_LBN   0

Definition at line 1004 of file etherfabric.c.

#define FCN_XX_DTXA_WIDTH   4

Definition at line 1005 of file etherfabric.c.

#define FCN_RX_FILTER_TBL0   0xF00000

Definition at line 1008 of file etherfabric.c.

Referenced by clear_b0_fpga_memories().

#define FCN_RX_DESC_PTR_TBL_KER_A1   0x11800

Definition at line 1011 of file etherfabric.c.

#define FCN_RX_DESC_PTR_TBL_KER_B0   0xF40000

Definition at line 1012 of file etherfabric.c.

#define FCN_RX_ISCSI_DDIG_EN_LBN   88

Definition at line 1013 of file etherfabric.c.

#define FCN_RX_ISCSI_DDIG_EN_WIDTH   1

Definition at line 1014 of file etherfabric.c.

#define FCN_RX_ISCSI_HDIG_EN_LBN   87

Definition at line 1015 of file etherfabric.c.

#define FCN_RX_ISCSI_HDIG_EN_WIDTH   1

Definition at line 1016 of file etherfabric.c.

#define FCN_RX_DESCQ_BUF_BASE_ID_LBN   36

Definition at line 1017 of file etherfabric.c.

#define FCN_RX_DESCQ_BUF_BASE_ID_WIDTH   20

Definition at line 1018 of file etherfabric.c.

#define FCN_RX_DESCQ_EVQ_ID_LBN   24

Definition at line 1019 of file etherfabric.c.

#define FCN_RX_DESCQ_EVQ_ID_WIDTH   12

Definition at line 1020 of file etherfabric.c.

#define FCN_RX_DESCQ_OWNER_ID_LBN   10

Definition at line 1021 of file etherfabric.c.

#define FCN_RX_DESCQ_OWNER_ID_WIDTH   14

Definition at line 1022 of file etherfabric.c.

#define FCN_RX_DESCQ_SIZE_LBN   3

Definition at line 1023 of file etherfabric.c.

#define FCN_RX_DESCQ_SIZE_WIDTH   2

Definition at line 1024 of file etherfabric.c.

#define FCN_RX_DESCQ_SIZE_4K   3

Definition at line 1025 of file etherfabric.c.

#define FCN_RX_DESCQ_SIZE_2K   2

Definition at line 1026 of file etherfabric.c.

#define FCN_RX_DESCQ_SIZE_1K   1

Definition at line 1027 of file etherfabric.c.

#define FCN_RX_DESCQ_SIZE_512   0

Definition at line 1028 of file etherfabric.c.

#define FCN_RX_DESCQ_TYPE_LBN   2

Definition at line 1029 of file etherfabric.c.

#define FCN_RX_DESCQ_TYPE_WIDTH   1

Definition at line 1030 of file etherfabric.c.

#define FCN_RX_DESCQ_JUMBO_LBN   1

Definition at line 1031 of file etherfabric.c.

#define FCN_RX_DESCQ_JUMBO_WIDTH   1

Definition at line 1032 of file etherfabric.c.

#define FCN_RX_DESCQ_EN_LBN   0

Definition at line 1033 of file etherfabric.c.

#define FCN_RX_DESCQ_EN_WIDTH   1

Definition at line 1034 of file etherfabric.c.

#define FCN_TX_DESC_PTR_TBL_KER_A1   0x11900

Definition at line 1037 of file etherfabric.c.

#define FCN_TX_DESC_PTR_TBL_KER_B0   0xF50000

Definition at line 1038 of file etherfabric.c.

#define FCN_TX_NON_IP_DROP_DIS_B0_LBN   91

Definition at line 1039 of file etherfabric.c.

#define FCN_TX_NON_IP_DROP_DIS_B0_WIDTH   1

Definition at line 1040 of file etherfabric.c.

#define FCN_TX_DESCQ_EN_LBN   88

Definition at line 1041 of file etherfabric.c.

#define FCN_TX_DESCQ_EN_WIDTH   1

Definition at line 1042 of file etherfabric.c.

#define FCN_TX_ISCSI_DDIG_EN_LBN   87

Definition at line 1043 of file etherfabric.c.

#define FCN_TX_ISCSI_DDIG_EN_WIDTH   1

Definition at line 1044 of file etherfabric.c.

#define FCN_TX_ISCSI_HDIG_EN_LBN   86

Definition at line 1045 of file etherfabric.c.

#define FCN_TX_ISCSI_HDIG_EN_WIDTH   1

Definition at line 1046 of file etherfabric.c.

#define FCN_TX_DESCQ_BUF_BASE_ID_LBN   36

Definition at line 1047 of file etherfabric.c.

#define FCN_TX_DESCQ_BUF_BASE_ID_WIDTH   20

Definition at line 1048 of file etherfabric.c.

#define FCN_TX_DESCQ_EVQ_ID_LBN   24

Definition at line 1049 of file etherfabric.c.

#define FCN_TX_DESCQ_EVQ_ID_WIDTH   12

Definition at line 1050 of file etherfabric.c.

#define FCN_TX_DESCQ_OWNER_ID_LBN   10

Definition at line 1051 of file etherfabric.c.

#define FCN_TX_DESCQ_OWNER_ID_WIDTH   14

Definition at line 1052 of file etherfabric.c.

#define FCN_TX_DESCQ_SIZE_LBN   3

Definition at line 1053 of file etherfabric.c.

#define FCN_TX_DESCQ_SIZE_WIDTH   2

Definition at line 1054 of file etherfabric.c.

#define FCN_TX_DESCQ_SIZE_4K   3

Definition at line 1055 of file etherfabric.c.

#define FCN_TX_DESCQ_SIZE_2K   2

Definition at line 1056 of file etherfabric.c.

#define FCN_TX_DESCQ_SIZE_1K   1

Definition at line 1057 of file etherfabric.c.

#define FCN_TX_DESCQ_SIZE_512   0

Definition at line 1058 of file etherfabric.c.

#define FCN_TX_DESCQ_TYPE_LBN   1

Definition at line 1059 of file etherfabric.c.

#define FCN_TX_DESCQ_TYPE_WIDTH   2

Definition at line 1060 of file etherfabric.c.

#define FCN_TX_DESCQ_FLUSH_LBN   0

Definition at line 1061 of file etherfabric.c.

#define FCN_TX_DESCQ_FLUSH_WIDTH   1

Definition at line 1062 of file etherfabric.c.

#define FCN_EVQ_PTR_TBL_KER_A1   0x11a00

Definition at line 1065 of file etherfabric.c.

#define FCN_EVQ_PTR_TBL_KER_B0   0xf60000

Definition at line 1066 of file etherfabric.c.

#define FCN_EVQ_EN_LBN   23

Definition at line 1067 of file etherfabric.c.

#define FCN_EVQ_EN_WIDTH   1

Definition at line 1068 of file etherfabric.c.

#define FCN_EVQ_SIZE_LBN   20

Definition at line 1069 of file etherfabric.c.

#define FCN_EVQ_SIZE_WIDTH   3

Definition at line 1070 of file etherfabric.c.

#define FCN_EVQ_SIZE_32K   6

Definition at line 1071 of file etherfabric.c.

#define FCN_EVQ_SIZE_16K   5

Definition at line 1072 of file etherfabric.c.

#define FCN_EVQ_SIZE_8K   4

Definition at line 1073 of file etherfabric.c.

#define FCN_EVQ_SIZE_4K   3

Definition at line 1074 of file etherfabric.c.

#define FCN_EVQ_SIZE_2K   2

Definition at line 1075 of file etherfabric.c.

#define FCN_EVQ_SIZE_1K   1

Definition at line 1076 of file etherfabric.c.

#define FCN_EVQ_SIZE_512   0

Definition at line 1077 of file etherfabric.c.

#define FCN_EVQ_BUF_BASE_ID_LBN   0

Definition at line 1078 of file etherfabric.c.

#define FCN_EVQ_BUF_BASE_ID_WIDTH   20

Definition at line 1079 of file etherfabric.c.

#define FCN_RX_RSS_INDIR_TBL_B0   0xFB0000

Definition at line 1082 of file etherfabric.c.

Referenced by clear_b0_fpga_memories().

#define FCN_EVQ_RPTR_REG_KER_A1   0x11b00

Definition at line 1085 of file etherfabric.c.

#define FCN_EVQ_RPTR_REG_KER_B0   0xfa0000

Definition at line 1086 of file etherfabric.c.

#define FCN_EVQ_RPTR_LBN   0

Definition at line 1087 of file etherfabric.c.

#define FCN_EVQ_RPTR_WIDTH   14

Definition at line 1088 of file etherfabric.c.

#define FCN_EVQ_RPTR_REG_KER_DWORD_A1   ( FCN_EVQ_RPTR_REG_KER_A1 + 0 )

Definition at line 1089 of file etherfabric.c.

#define FCN_EVQ_RPTR_REG_KER_DWORD_B0   ( FCN_EVQ_RPTR_REG_KER_B0 + 0 )

Definition at line 1090 of file etherfabric.c.

#define FCN_EVQ_RPTR_DWORD_LBN   0

Definition at line 1091 of file etherfabric.c.

#define FCN_EVQ_RPTR_DWORD_WIDTH   14

Definition at line 1092 of file etherfabric.c.

#define FCN_BUF_FULL_TBL_KER_A1   0x18000

Definition at line 1095 of file etherfabric.c.

#define FCN_BUF_FULL_TBL_KER_B0   0x800000

Definition at line 1096 of file etherfabric.c.

#define FCN_IP_DAT_BUF_SIZE_LBN   50

Definition at line 1097 of file etherfabric.c.

#define FCN_IP_DAT_BUF_SIZE_WIDTH   1

Definition at line 1098 of file etherfabric.c.

#define FCN_IP_DAT_BUF_SIZE_8K   1

Definition at line 1099 of file etherfabric.c.

#define FCN_IP_DAT_BUF_SIZE_4K   0

Definition at line 1100 of file etherfabric.c.

Referenced by falcon_alloc_special_buffer().

#define FCN_BUF_ADR_FBUF_LBN   14

Definition at line 1101 of file etherfabric.c.

#define FCN_BUF_ADR_FBUF_WIDTH   34

Definition at line 1102 of file etherfabric.c.

#define FCN_BUF_OWNER_ID_FBUF_LBN   0

Definition at line 1103 of file etherfabric.c.

#define FCN_BUF_OWNER_ID_FBUF_WIDTH   14

Definition at line 1104 of file etherfabric.c.

#define FALCON_GMAC_REG ( efab,
mac_reg   ) 

Value:

( FALCON_GMAC_REGBANK +                                 \
          ( (mac_reg) * FALCON_GMAC_REG_SIZE ) )
Offset of a GMAC register within Falcon.

Definition at line 1107 of file etherfabric.c.

Referenced by falcon_gmac_readl(), and falcon_gmac_writel().

#define FALCON_XMAC_REG ( efab_port,
mac_reg   ) 

Value:

( FALCON_XMAC_REGBANK +                                 \
          ( (mac_reg) * FALCON_XMAC_REG_SIZE ) )
Offset of an XMAC register within Falcon.

Definition at line 1112 of file etherfabric.c.

Referenced by falcon_xmac_readl(), and falcon_xmac_writel().

#define FCN_MAC_DATA_LBN   0

Definition at line 1116 of file etherfabric.c.

#define FCN_MAC_DATA_WIDTH   32

Definition at line 1117 of file etherfabric.c.

#define FCN_TX_KER_PORT_LBN   63

Definition at line 1120 of file etherfabric.c.

#define FCN_TX_KER_PORT_WIDTH   1

Definition at line 1121 of file etherfabric.c.

#define FCN_TX_KER_BYTE_CNT_LBN   48

Definition at line 1122 of file etherfabric.c.

#define FCN_TX_KER_BYTE_CNT_WIDTH   14

Definition at line 1123 of file etherfabric.c.

#define FCN_TX_KER_BUF_ADR_LBN   0

Definition at line 1124 of file etherfabric.c.

#define FCN_TX_KER_BUF_ADR_WIDTH   EFAB_DMA_TYPE_WIDTH ( 46 )

Definition at line 1125 of file etherfabric.c.

#define FCN_RX_KER_BUF_SIZE_LBN   48

Definition at line 1129 of file etherfabric.c.

#define FCN_RX_KER_BUF_SIZE_WIDTH   14

Definition at line 1130 of file etherfabric.c.

#define FCN_RX_KER_BUF_ADR_LBN   0

Definition at line 1131 of file etherfabric.c.

#define FCN_RX_KER_BUF_ADR_WIDTH   EFAB_DMA_TYPE_WIDTH ( 46 )

Definition at line 1132 of file etherfabric.c.

#define FCN_EV_CODE_LBN   60

Definition at line 1135 of file etherfabric.c.

#define FCN_EV_CODE_WIDTH   4

Definition at line 1136 of file etherfabric.c.

#define FCN_RX_IP_EV_DECODE   0

Definition at line 1137 of file etherfabric.c.

Referenced by falcon_handle_event().

#define FCN_TX_IP_EV_DECODE   2

Definition at line 1138 of file etherfabric.c.

Referenced by falcon_handle_event().

#define FCN_DRIVER_EV_DECODE   5

Definition at line 1139 of file etherfabric.c.

#define FCN_RX_EV_PKT_OK_LBN   56

Definition at line 1142 of file etherfabric.c.

#define FCN_RX_EV_PKT_OK_WIDTH   1

Definition at line 1143 of file etherfabric.c.

#define FCN_RX_PORT_LBN   30

Definition at line 1144 of file etherfabric.c.

#define FCN_RX_PORT_WIDTH   1

Definition at line 1145 of file etherfabric.c.

#define FCN_RX_EV_BYTE_CNT_LBN   16

Definition at line 1146 of file etherfabric.c.

#define FCN_RX_EV_BYTE_CNT_WIDTH   14

Definition at line 1147 of file etherfabric.c.

#define FCN_RX_EV_DESC_PTR_LBN   0

Definition at line 1148 of file etherfabric.c.

#define FCN_RX_EV_DESC_PTR_WIDTH   12

Definition at line 1149 of file etherfabric.c.

#define FCN_TX_EV_DESC_PTR_LBN   0

Definition at line 1152 of file etherfabric.c.

#define FCN_TX_EV_DESC_PTR_WIDTH   12

Definition at line 1153 of file etherfabric.c.

#define FCN_REVISION_REG ( efab,
reg   )     ( ( efab->pci_revision == FALCON_REV_B0 ) ? reg ## _B0 : reg ## _A1 )

#define EFAB_SET_OWORD_FIELD_VER ( efab,
reg,
field,
val   ) 

Value:

if ( efab->pci_revision == FALCON_REV_B0 )                      \
                EFAB_SET_OWORD_FIELD ( reg, field ## _B0, val );        \
        else                                                            \
                EFAB_SET_OWORD_FIELD ( reg, field ## _A1, val );

Definition at line 1166 of file etherfabric.c.

Referenced by falcon_setup_nic().

#define _falcon_writel ( efab,
value,
reg   )     writel ( (value), (efab)->membase + (reg) )

#define _falcon_readl ( efab,
reg   )     readl ( (efab)->membase + (reg) )

Definition at line 1192 of file etherfabric.c.

Referenced by falcon_read(), falcon_read_sram(), and falcon_readl().

#define FCN_DUMP_REG ( efab,
_reg   ) 

Value:

do {                            \
                efab_oword_t reg;                               \
                falcon_read ( efab, &reg, _reg );               \
                EFAB_LOG ( #_reg " = " EFAB_OWORD_FMT "\n",     \
                           EFAB_OWORD_VAL ( reg ) );            \
        } while ( 0 );

Definition at line 1292 of file etherfabric.c.

#define FCN_DUMP_MAC_REG ( efab,
_mac_reg   ) 

Value:

do {                            \
                efab_dword_t reg;                                       \
                efab->mac_op->mac_readl ( efab, &reg, _mac_reg );       \
                EFAB_LOG ( #_mac_reg " = " EFAB_DWORD_FMT "\n",         \
                           EFAB_DWORD_VAL ( reg ) );                    \
        } while ( 0 );

Definition at line 1299 of file etherfabric.c.

#define FALCON_SPI_MAX_LEN   16

Maximum length for a single SPI transaction.

Definition at line 1398 of file etherfabric.c.

Referenced by falcon_init_spi_device(), and falcon_spi_rw().

#define GM_CFG1_REG_MAC   0x00

Definition at line 1756 of file etherfabric.c.

Referenced by mentormac_init(), and mentormac_reset().

#define GM_SW_RST_LBN   31

Definition at line 1757 of file etherfabric.c.

#define GM_SW_RST_WIDTH   1

Definition at line 1758 of file etherfabric.c.

#define GM_RX_FC_EN_LBN   5

Definition at line 1759 of file etherfabric.c.

#define GM_RX_FC_EN_WIDTH   1

Definition at line 1760 of file etherfabric.c.

#define GM_TX_FC_EN_LBN   4

Definition at line 1761 of file etherfabric.c.

#define GM_TX_FC_EN_WIDTH   1

Definition at line 1762 of file etherfabric.c.

#define GM_RX_EN_LBN   2

Definition at line 1763 of file etherfabric.c.

#define GM_RX_EN_WIDTH   1

Definition at line 1764 of file etherfabric.c.

#define GM_TX_EN_LBN   0

Definition at line 1765 of file etherfabric.c.

#define GM_TX_EN_WIDTH   1

Definition at line 1766 of file etherfabric.c.

#define GM_CFG2_REG_MAC   0x01

Definition at line 1769 of file etherfabric.c.

Referenced by mentormac_init().

#define GM_PAMBL_LEN_LBN   12

Definition at line 1770 of file etherfabric.c.

#define GM_PAMBL_LEN_WIDTH   4

Definition at line 1771 of file etherfabric.c.

#define GM_IF_MODE_LBN   8

Definition at line 1772 of file etherfabric.c.

#define GM_IF_MODE_WIDTH   2

Definition at line 1773 of file etherfabric.c.

#define GM_PAD_CRC_EN_LBN   2

Definition at line 1774 of file etherfabric.c.

#define GM_PAD_CRC_EN_WIDTH   1

Definition at line 1775 of file etherfabric.c.

#define GM_FD_LBN   0

Definition at line 1776 of file etherfabric.c.

#define GM_FD_WIDTH   1

Definition at line 1777 of file etherfabric.c.

#define GM_MAX_FLEN_REG_MAC   0x04

Definition at line 1780 of file etherfabric.c.

Referenced by mentormac_init().

#define GM_MAX_FLEN_LBN   0

Definition at line 1781 of file etherfabric.c.

#define GM_MAX_FLEN_WIDTH   16

Definition at line 1782 of file etherfabric.c.

#define GM_MII_MGMT_CFG_REG_MAC   0x08

Definition at line 1785 of file etherfabric.c.

Referenced by mentormac_reset().

#define GM_MGMT_CLK_SEL_LBN   0

Definition at line 1786 of file etherfabric.c.

#define GM_MGMT_CLK_SEL_WIDTH   3

Definition at line 1787 of file etherfabric.c.

#define GM_MII_MGMT_CMD_REG_MAC   0x09

Definition at line 1790 of file etherfabric.c.

#define GM_MGMT_SCAN_CYC_LBN   1

Definition at line 1791 of file etherfabric.c.

#define GM_MGMT_SCAN_CYC_WIDTH   1

Definition at line 1792 of file etherfabric.c.

#define GM_MGMT_RD_CYC_LBN   0

Definition at line 1793 of file etherfabric.c.

#define GM_MGMT_RD_CYC_WIDTH   1

Definition at line 1794 of file etherfabric.c.

#define GM_MII_MGMT_ADR_REG_MAC   0x0a

Definition at line 1797 of file etherfabric.c.

#define GM_MGMT_PHY_ADDR_LBN   8

Definition at line 1798 of file etherfabric.c.

#define GM_MGMT_PHY_ADDR_WIDTH   5

Definition at line 1799 of file etherfabric.c.

#define GM_MGMT_REG_ADDR_LBN   0

Definition at line 1800 of file etherfabric.c.

#define GM_MGMT_REG_ADDR_WIDTH   5

Definition at line 1801 of file etherfabric.c.

#define GM_MII_MGMT_CTL_REG_MAC   0x0b

Definition at line 1804 of file etherfabric.c.

#define GM_MGMT_CTL_LBN   0

Definition at line 1805 of file etherfabric.c.

#define GM_MGMT_CTL_WIDTH   16

Definition at line 1806 of file etherfabric.c.

#define GM_MII_MGMT_STAT_REG_MAC   0x0c

Definition at line 1809 of file etherfabric.c.

#define GM_MGMT_STAT_LBN   0

Definition at line 1810 of file etherfabric.c.

#define GM_MGMT_STAT_WIDTH   16

Definition at line 1811 of file etherfabric.c.

#define GM_MII_MGMT_IND_REG_MAC   0x0d

Definition at line 1814 of file etherfabric.c.

#define GM_MGMT_BUSY_LBN   0

Definition at line 1815 of file etherfabric.c.

#define GM_MGMT_BUSY_WIDTH   1

Definition at line 1816 of file etherfabric.c.

#define GM_ADR1_REG_MAC   0x10

Definition at line 1819 of file etherfabric.c.

Referenced by mentormac_init().

#define GM_HWADDR_5_LBN   24

Definition at line 1820 of file etherfabric.c.

#define GM_HWADDR_5_WIDTH   8

Definition at line 1821 of file etherfabric.c.

#define GM_HWADDR_4_LBN   16

Definition at line 1822 of file etherfabric.c.

#define GM_HWADDR_4_WIDTH   8

Definition at line 1823 of file etherfabric.c.

#define GM_HWADDR_3_LBN   8

Definition at line 1824 of file etherfabric.c.

#define GM_HWADDR_3_WIDTH   8

Definition at line 1825 of file etherfabric.c.

#define GM_HWADDR_2_LBN   0

Definition at line 1826 of file etherfabric.c.

#define GM_HWADDR_2_WIDTH   8

Definition at line 1827 of file etherfabric.c.

#define GM_ADR2_REG_MAC   0x11

Definition at line 1830 of file etherfabric.c.

Referenced by mentormac_init().

#define GM_HWADDR_1_LBN   24

Definition at line 1831 of file etherfabric.c.

#define GM_HWADDR_1_WIDTH   8

Definition at line 1832 of file etherfabric.c.

#define GM_HWADDR_0_LBN   16

Definition at line 1833 of file etherfabric.c.

#define GM_HWADDR_0_WIDTH   8

Definition at line 1834 of file etherfabric.c.

#define GMF_CFG0_REG_MAC   0x12

Definition at line 1837 of file etherfabric.c.

Referenced by mentormac_init().

#define GMF_FTFENREQ_LBN   12

Definition at line 1838 of file etherfabric.c.

#define GMF_FTFENREQ_WIDTH   1

Definition at line 1839 of file etherfabric.c.

#define GMF_STFENREQ_LBN   11

Definition at line 1840 of file etherfabric.c.

#define GMF_STFENREQ_WIDTH   1

Definition at line 1841 of file etherfabric.c.

#define GMF_FRFENREQ_LBN   10

Definition at line 1842 of file etherfabric.c.

#define GMF_FRFENREQ_WIDTH   1

Definition at line 1843 of file etherfabric.c.

#define GMF_SRFENREQ_LBN   9

Definition at line 1844 of file etherfabric.c.

#define GMF_SRFENREQ_WIDTH   1

Definition at line 1845 of file etherfabric.c.

#define GMF_WTMENREQ_LBN   8

Definition at line 1846 of file etherfabric.c.

#define GMF_WTMENREQ_WIDTH   1

Definition at line 1847 of file etherfabric.c.

#define GMF_CFG1_REG_MAC   0x13

Definition at line 1850 of file etherfabric.c.

Referenced by mentormac_init().

#define GMF_CFGFRTH_LBN   16

Definition at line 1851 of file etherfabric.c.

#define GMF_CFGFRTH_WIDTH   5

Definition at line 1852 of file etherfabric.c.

#define GMF_CFGXOFFRTX_LBN   0

Definition at line 1853 of file etherfabric.c.

#define GMF_CFGXOFFRTX_WIDTH   16

Definition at line 1854 of file etherfabric.c.

#define GMF_CFG2_REG_MAC   0x14

Definition at line 1857 of file etherfabric.c.

Referenced by mentormac_init().

#define GMF_CFGHWM_LBN   16

Definition at line 1858 of file etherfabric.c.

#define GMF_CFGHWM_WIDTH   6

Definition at line 1859 of file etherfabric.c.

#define GMF_CFGLWM_LBN   0

Definition at line 1860 of file etherfabric.c.

#define GMF_CFGLWM_WIDTH   6

Definition at line 1861 of file etherfabric.c.

#define GMF_CFG3_REG_MAC   0x15

Definition at line 1864 of file etherfabric.c.

Referenced by mentormac_init().

#define GMF_CFGHWMFT_LBN   16

Definition at line 1865 of file etherfabric.c.

#define GMF_CFGHWMFT_WIDTH   6

Definition at line 1866 of file etherfabric.c.

#define GMF_CFGFTTH_LBN   0

Definition at line 1867 of file etherfabric.c.

#define GMF_CFGFTTH_WIDTH   6

Definition at line 1868 of file etherfabric.c.

#define GMF_CFG4_REG_MAC   0x16

Definition at line 1871 of file etherfabric.c.

Referenced by mentormac_init().

#define GMF_HSTFLTRFRM_PAUSE_LBN   12

Definition at line 1872 of file etherfabric.c.

#define GMF_HSTFLTRFRM_PAUSE_WIDTH   12

Definition at line 1873 of file etherfabric.c.

#define GMF_CFG5_REG_MAC   0x17

Definition at line 1876 of file etherfabric.c.

Referenced by mentormac_init().

#define GMF_CFGHDPLX_LBN   22

Definition at line 1877 of file etherfabric.c.

#define GMF_CFGHDPLX_WIDTH   1

Definition at line 1878 of file etherfabric.c.

#define GMF_CFGBYTMODE_LBN   19

Definition at line 1879 of file etherfabric.c.

#define GMF_CFGBYTMODE_WIDTH   1

Definition at line 1880 of file etherfabric.c.

#define GMF_HSTDRPLT64_LBN   18

Definition at line 1881 of file etherfabric.c.

#define GMF_HSTDRPLT64_WIDTH   1

Definition at line 1882 of file etherfabric.c.

#define GMF_HSTFLTRFRMDC_PAUSE_LBN   12

Definition at line 1883 of file etherfabric.c.

#define GMF_HSTFLTRFRMDC_PAUSE_WIDTH   1

Definition at line 1884 of file etherfabric.c.

#define XFP_REQUIRED_DEVS

#define TXC_GLRGS_GLCMD   (0xc004)

Definition at line 2492 of file etherfabric.c.

Referenced by falcon_txc_logic_reset().

#define TXC_GLCMD_LMTSWRST_LBN   (14)

Definition at line 2493 of file etherfabric.c.

Referenced by falcon_txc_logic_reset().

#define TXC_ALRGS_ATXAMP0   (0xc041)

Definition at line 2496 of file etherfabric.c.

Referenced by falcon_txc_phy_init().

#define TXC_ALRGS_ATXAMP1   (0xc042)

Definition at line 2497 of file etherfabric.c.

Referenced by falcon_txc_phy_init().

#define TXC_ATXAMP_LANE02_LBN   (3)

Definition at line 2499 of file etherfabric.c.

#define TXC_ATXAMP_LANE13_LBN   (11)

Definition at line 2500 of file etherfabric.c.

#define TXC_ATXAMP_1280_mV   (0)

Definition at line 2502 of file etherfabric.c.

#define TXC_ATXAMP_1200_mV   (8)

Definition at line 2503 of file etherfabric.c.

#define TXC_ATXAMP_1120_mV   (12)

Definition at line 2504 of file etherfabric.c.

#define TXC_ATXAMP_1060_mV   (14)

Definition at line 2505 of file etherfabric.c.

#define TXC_ATXAMP_0820_mV   (25)

Definition at line 2506 of file etherfabric.c.

#define TXC_ATXAMP_0720_mV   (26)

Definition at line 2507 of file etherfabric.c.

#define TXC_ATXAMP_0580_mV   (27)

Definition at line 2508 of file etherfabric.c.

#define TXC_ATXAMP_0440_mV   (28)

Definition at line 2509 of file etherfabric.c.

#define TXC_ATXAMP_0820_BOTH

#define TXC_ATXAMP_DEFAULT   (0x6060)

Definition at line 2514 of file etherfabric.c.

Referenced by falcon_txc_phy_init().

#define TXC_ALRGS_ATXPRE0   (0xc043)

Definition at line 2517 of file etherfabric.c.

Referenced by falcon_txc_phy_init().

#define TXC_ALRGS_ATXPRE1   (0xc044)

Definition at line 2518 of file etherfabric.c.

Referenced by falcon_txc_phy_init().

#define TXC_ATXPRE_NONE   (0)

Definition at line 2520 of file etherfabric.c.

Referenced by falcon_txc_phy_init().

#define TXC_ATXPRE_DEFAULT   (0x1010)

Definition at line 2521 of file etherfabric.c.

Referenced by falcon_txc_phy_init().

#define TXC_REQUIRED_DEVS

#define TENXPRESS_REQUIRED_DEVS

#define PCS_TEST_SELECT_REG   0xd807

Definition at line 2625 of file etherfabric.c.

Referenced by falcon_tenxpress_phy_init().

#define CLK312_EN_LBN   3

Definition at line 2626 of file etherfabric.c.

Referenced by falcon_tenxpress_phy_init().

#define CLK312_EN_WIDTH   1

Definition at line 2627 of file etherfabric.c.

#define PCS_CLOCK_CTRL_REG   0xd801

Definition at line 2629 of file etherfabric.c.

#define PLL312_RST_N_LBN   2

Definition at line 2630 of file etherfabric.c.

#define PMA_PMD_EXT_CTRL_REG   49152

Definition at line 2633 of file etherfabric.c.

#define PMA_PMD_EXT_SSR_LBN   15

Definition at line 2634 of file etherfabric.c.

#define PCS_BOOT_STATUS_REG   0xd000

Definition at line 2637 of file etherfabric.c.

Referenced by falcon_tenxpress_check_c11().

#define PCS_BOOT_FATAL_ERR_LBN   0

Definition at line 2638 of file etherfabric.c.

#define PCS_BOOT_PROGRESS_LBN   1

Definition at line 2639 of file etherfabric.c.

#define PCS_BOOT_PROGRESS_WIDTH   2

Definition at line 2640 of file etherfabric.c.

#define PCS_BOOT_COMPLETE_LBN   3

Definition at line 2641 of file etherfabric.c.

Referenced by falcon_tenxpress_check_c11().

#define PCS_SOFT_RST2_REG   0xd806

Definition at line 2643 of file etherfabric.c.

#define SERDES_RST_N_LBN   13

Definition at line 2644 of file etherfabric.c.

#define XGXS_RST_N_LBN   12

Definition at line 2645 of file etherfabric.c.

#define PM8358_REQUIRED_DEVS   (MDIO_MMDREG_DEVS0_DTEXS)

Definition at line 2717 of file etherfabric.c.

#define PMC_MASTER_REG   (0xd000)

Definition at line 2721 of file etherfabric.c.

Referenced by falcon_pm8358_phy_init().

#define PMC_MASTER_ANLG_CTRL   (1<< 11)

Definition at line 2723 of file etherfabric.c.

Referenced by falcon_pm8358_phy_init().

#define PMC_MCONF2_REG   (0xd002)

Definition at line 2726 of file etherfabric.c.

Referenced by falcon_pm8358_phy_init().

#define PMC_MCONF2_TEDGE   (1 << 2)

Definition at line 2728 of file etherfabric.c.

Referenced by falcon_pm8358_phy_init().

#define PMC_MCONF2_REDGE   (1 << 3)

Definition at line 2730 of file etherfabric.c.

Referenced by falcon_pm8358_phy_init().

#define PMC_ANALOG_RX_CFG0   (0xd025)

Definition at line 2733 of file etherfabric.c.

Referenced by falcon_pm8358_phy_init().

#define PMC_ANALOG_RX_CFG1   (0xd02d)

Definition at line 2734 of file etherfabric.c.

#define PMC_ANALOG_RX_CFG2   (0xd035)

Definition at line 2735 of file etherfabric.c.

#define PMC_ANALOG_RX_CFG3   (0xd03d)

Definition at line 2736 of file etherfabric.c.

#define PMC_ANALOG_RX_TERM   (1 << 15)

Definition at line 2739 of file etherfabric.c.

#define PMC_ANALOG_RX_EQ_MASK   (3 << 8)

Definition at line 2741 of file etherfabric.c.

Referenced by falcon_pm8358_phy_init().

#define PMC_ANALOG_RX_EQ_NONE   (0 << 8)

Definition at line 2742 of file etherfabric.c.

#define PMC_ANALOG_RX_EQ_HALF   (1 << 8)

Definition at line 2743 of file etherfabric.c.

#define PMC_ANALOG_RX_EQ_FULL   (2 << 8)

Definition at line 2744 of file etherfabric.c.

Referenced by falcon_pm8358_phy_init().

#define PMC_ANALOG_RX_EQ_RSVD   (3 << 8)

Definition at line 2745 of file etherfabric.c.

#define MAX_TEMP_THRESH   90

Definition at line 2794 of file etherfabric.c.

Referenced by sfe4001_init().

#define PCA9539   0x74

Definition at line 2797 of file etherfabric.c.

#define P0_IN   0x00

Definition at line 2799 of file etherfabric.c.

#define P0_OUT   0x02

Definition at line 2800 of file etherfabric.c.

Referenced by sfe4001_fini(), and sfe4001_init().

#define P0_CONFIG   0x06

Definition at line 2801 of file etherfabric.c.

Referenced by sfe4001_fini(), and sfe4001_init().

#define P0_EN_1V0X_LBN   0

Definition at line 2803 of file etherfabric.c.

Referenced by sfe4001_init().

#define P0_EN_1V0X_WIDTH   1

Definition at line 2804 of file etherfabric.c.

#define P0_EN_1V2_LBN   1

Definition at line 2805 of file etherfabric.c.

Referenced by sfe4001_init().

#define P0_EN_1V2_WIDTH   1

Definition at line 2806 of file etherfabric.c.

#define P0_EN_2V5_LBN   2

Definition at line 2807 of file etherfabric.c.

Referenced by sfe4001_init().

#define P0_EN_2V5_WIDTH   1

Definition at line 2808 of file etherfabric.c.

#define P0_EN_3V3X_LBN   3

Definition at line 2809 of file etherfabric.c.

Referenced by sfe4001_init().

#define P0_EN_3V3X_WIDTH   1

Definition at line 2810 of file etherfabric.c.

#define P0_EN_5V_LBN   4

Definition at line 2811 of file etherfabric.c.

Referenced by sfe4001_init().

#define P0_EN_5V_WIDTH   1

Definition at line 2812 of file etherfabric.c.

#define P0_X_TRST_LBN   6

Definition at line 2813 of file etherfabric.c.

Referenced by sfe4001_init().

#define P0_X_TRST_WIDTH   1

Definition at line 2814 of file etherfabric.c.

#define P1_IN   0x01

Definition at line 2816 of file etherfabric.c.

Referenced by sfe4001_init().

#define P1_CONFIG   0x07

Definition at line 2817 of file etherfabric.c.

Referenced by sfe4001_fini(), and sfe4001_init().

#define P1_AFE_PWD_LBN   0

Definition at line 2819 of file etherfabric.c.

Referenced by sfe4001_init().

#define P1_AFE_PWD_WIDTH   1

Definition at line 2820 of file etherfabric.c.

#define P1_DSP_PWD25_LBN   1

Definition at line 2821 of file etherfabric.c.

#define P1_DSP_PWD25_WIDTH   1

Definition at line 2822 of file etherfabric.c.

#define P1_SPARE_LBN   4

Definition at line 2823 of file etherfabric.c.

Referenced by sfe4001_init().

#define P1_SPARE_WIDTH   4

Definition at line 2824 of file etherfabric.c.

#define MAX6647   0x4e

Definition at line 2827 of file etherfabric.c.

#define RSL   0x02

Definition at line 2829 of file etherfabric.c.

Referenced by sfe4001_fini(), and sfe4001_init().

#define RLHN   0x05

Definition at line 2830 of file etherfabric.c.

Referenced by sfe4001_init().

#define WLHO   0x0b

Definition at line 2831 of file etherfabric.c.

Referenced by sfe4001_init().

#define FALCON_MAC_ADDRESS_OFFSET   0x310

Offset of MAC address within EEPROM or Flash.

Definition at line 3150 of file etherfabric.c.

Referenced by falcon_probe_nvram().

#define SF_NV_CONFIG_BASE   0x300

Definition at line 3155 of file etherfabric.c.

Referenced by falcon_probe_nvram().

#define SF_NV_CONFIG_EXTRA   0xA0

Definition at line 3156 of file etherfabric.c.

Referenced by falcon_probe_nvram().

#define BOARD_TYPE ( _rev   )     (_rev >> 8)

Definition at line 3178 of file etherfabric.c.

Referenced by falcon_probe_nvram().


Function Documentation

FILE_LICENCE ( GPL_ANY   ) 

static void falcon_mdio_write ( struct efab_nic efab,
int  device,
int  location,
int  value 
) [static]

Definition at line 1597 of file etherfabric.c.

References assert, EFAB_POPULATE_OWORD_1, EFAB_POPULATE_OWORD_2, EFAB_TRACE, falcon_gmii_wait(), falcon_write(), FCN_MD_CS_REG_KER, FCN_MD_ID_REG_KER, FCN_MD_PHY_ADR_REG_KER, FCN_MD_TXD_REG_KER, efab_nic::phy_10g, efab_nic::phy_addr, and udelay().

Referenced by falcon_pm8358_phy_init(), falcon_tenxpress_phy_init(), falcon_txc_logic_reset(), falcon_txc_phy_init(), and mdio_clause45_reset_mmd().

01599 {
01600         efab_oword_t reg;
01601 
01602         EFAB_TRACE ( "Writing GMII %d register %02x with %04x\n",
01603                      device, location, value );
01604 
01605         /* Check MII not currently being accessed */
01606         if ( falcon_gmii_wait ( efab ) )
01607                 return;
01608 
01609         /* Write the address/ID register */
01610         EFAB_POPULATE_OWORD_1 ( reg, FCN_MD_PHY_ADR, location );
01611         falcon_write ( efab, &reg, FCN_MD_PHY_ADR_REG_KER );
01612 
01613         if ( efab->phy_10g ) {
01614                 /* clause45 */
01615                 EFAB_POPULATE_OWORD_2 ( reg, 
01616                                         FCN_MD_PRT_ADR, efab->phy_addr,
01617                                         FCN_MD_DEV_ADR, device );
01618         }
01619         else {
01620                 /* clause22 */
01621                 assert ( device == 0 );
01622 
01623                 EFAB_POPULATE_OWORD_2 ( reg,
01624                                         FCN_MD_PRT_ADR, efab->phy_addr,
01625                                         FCN_MD_DEV_ADR, location );
01626         }
01627         falcon_write ( efab, &reg, FCN_MD_ID_REG_KER );
01628                 
01629 
01630         /* Write data */
01631         EFAB_POPULATE_OWORD_1 ( reg, FCN_MD_TXD, value );
01632         falcon_write ( efab, &reg, FCN_MD_TXD_REG_KER );
01633 
01634         EFAB_POPULATE_OWORD_2 ( reg,
01635                                 FCN_MD_WRC, 1,
01636                                 FCN_MD_GC, ( efab->phy_10g ? 0 : 1 ) );
01637         falcon_write ( efab, &reg, FCN_MD_CS_REG_KER );
01638                 
01639         /* Wait for data to be written */
01640         if ( falcon_gmii_wait ( efab ) ) {
01641                 /* Abort the write operation */
01642                 EFAB_POPULATE_OWORD_2 ( reg,
01643                                         FCN_MD_WRC, 0,
01644                                         FCN_MD_GC, 1);
01645                 falcon_write ( efab, &reg, FCN_MD_CS_REG_KER );
01646                 udelay(10);
01647         }
01648 }

static int falcon_mdio_read ( struct efab_nic efab,
int  device,
int  location 
) [static]

Definition at line 1651 of file etherfabric.c.

References assert, EFAB_OWORD_FIELD, EFAB_POPULATE_OWORD_1, EFAB_POPULATE_OWORD_2, EFAB_TRACE, falcon_gmii_wait(), falcon_read(), falcon_write(), FCN_MD_CS_REG_KER, FCN_MD_ID_REG_KER, FCN_MD_PHY_ADR_REG_KER, FCN_MD_RXD_REG_KER, efab_nic::phy_10g, efab_nic::phy_addr, and udelay().

Referenced by falcon_pm8358_phy_init(), falcon_tenxpress_check_c11(), falcon_txc_logic_reset(), falcon_xaui_link_ok(), gmii_autoneg_advertised(), gmii_autoneg_lpa(), gmii_link_ok(), mdio_clause45_check_mmds(), mdio_clause45_links_ok(), mdio_clause45_reset_mmd(), and mdio_clause45_wait_reset_mmds().

01652 {
01653         efab_oword_t reg;
01654         int value;
01655 
01656         /* Check MII not currently being accessed */
01657         if ( falcon_gmii_wait ( efab ) ) 
01658                 return -1;
01659 
01660         if ( efab->phy_10g ) {
01661                 /* clause45 */
01662                 EFAB_POPULATE_OWORD_1 ( reg, FCN_MD_PHY_ADR, location );
01663                 falcon_write ( efab, &reg, FCN_MD_PHY_ADR_REG_KER );
01664 
01665                 EFAB_POPULATE_OWORD_2 ( reg,
01666                                         FCN_MD_PRT_ADR, efab->phy_addr,
01667                                         FCN_MD_DEV_ADR, device );
01668                 falcon_write ( efab, &reg, FCN_MD_ID_REG_KER);
01669 
01670                 /* request data to be read */
01671                 EFAB_POPULATE_OWORD_2 ( reg,
01672                                         FCN_MD_RDC, 1,
01673                                         FCN_MD_GC, 0 );
01674         }
01675         else {
01676                 /* clause22 */
01677                 assert ( device == 0 );
01678 
01679                 EFAB_POPULATE_OWORD_2 ( reg,
01680                                         FCN_MD_PRT_ADR, efab->phy_addr,
01681                                         FCN_MD_DEV_ADR, location );
01682                 falcon_write ( efab, &reg, FCN_MD_ID_REG_KER );
01683 
01684                 /* Request data to be read */
01685                 EFAB_POPULATE_OWORD_2 ( reg,
01686                                         FCN_MD_RIC, 1,
01687                                         FCN_MD_GC, 1 );
01688         }
01689 
01690         falcon_write ( efab, &reg, FCN_MD_CS_REG_KER );
01691                 
01692         /* Wait for data to become available */
01693         if ( falcon_gmii_wait ( efab ) ) {
01694                 /* Abort the read operation */
01695                 EFAB_POPULATE_OWORD_2 ( reg,
01696                                         FCN_MD_RIC, 0,
01697                                         FCN_MD_GC, 1 );
01698                 falcon_write ( efab, &reg, FCN_MD_CS_REG_KER );
01699                 udelay ( 10 );
01700                 value = -1;
01701         }
01702         else {
01703                 /* Read the data */
01704                 falcon_read ( efab, &reg, FCN_MD_RXD_REG_KER );
01705                 value = EFAB_OWORD_FIELD ( reg, FCN_MD_RXD );
01706         }
01707 
01708         EFAB_TRACE ( "Read from GMII %d register %02x, got %04x\n",
01709                      device, location, value );
01710 
01711         return value;
01712 }

static unsigned int gmii_autoneg_advertised ( struct efab_nic efab  )  [static]

Retrieve GMII autonegotiation advertised abilities.

Definition at line 114 of file etherfabric.c.

References falcon_mdio_read(), MII_ADVERTISE, and MII_CTRL1000.

Referenced by alaska_init().

00115 {
00116         unsigned int mii_advertise;
00117         unsigned int gmii_advertise;
00118 
00119         /* Extended bits are in bits 8 and 9 of MII_CTRL1000 */
00120         mii_advertise = falcon_mdio_read ( efab, 0, MII_ADVERTISE );
00121         gmii_advertise = ( ( falcon_mdio_read ( efab, 0, MII_CTRL1000 ) >> 8 )
00122                            & 0x03 );
00123         return ( ( gmii_advertise << 16 ) | mii_advertise );
00124 }

static unsigned int gmii_autoneg_lpa ( struct efab_nic efab  )  [static]

Retrieve GMII autonegotiation link partner abilities.

Definition at line 131 of file etherfabric.c.

References falcon_mdio_read(), MII_LPA, and MII_STAT1000.

Referenced by alaska_init().

00132 {
00133         unsigned int mii_lpa;
00134         unsigned int gmii_lpa;
00135 
00136         /* Extended bits are in bits 10 and 11 of MII_STAT1000 */
00137         mii_lpa = falcon_mdio_read ( efab, 0, MII_LPA );
00138         gmii_lpa = ( falcon_mdio_read ( efab, 0, MII_STAT1000 ) >> 10 ) & 0x03;
00139         return ( ( gmii_lpa << 16 ) | mii_lpa );
00140 }

static unsigned int gmii_nway_result ( unsigned int  negotiated  )  [static]

Calculate GMII autonegotiated link technology.

Definition at line 147 of file etherfabric.c.

References LPA_100BASE4, LPA_100FULL, LPA_100HALF, LPA_10FULL, LPA_10HALF, LPA_EF_1000FULL, LPA_EF_1000HALF, and LPA_OTHER.

Referenced by alaska_init().

00148 {
00149         unsigned int other_bits;
00150 
00151         /* Mask out the speed and duplexity bits */
00152         other_bits = negotiated & LPA_OTHER;
00153 
00154         if ( negotiated & LPA_EF_1000FULL )
00155                 return ( other_bits | LPA_EF_1000FULL );
00156         else if ( negotiated & LPA_EF_1000HALF )
00157                 return ( other_bits | LPA_EF_1000HALF );
00158         else if ( negotiated & LPA_100FULL )
00159                 return ( other_bits | LPA_100FULL );
00160         else if ( negotiated & LPA_100BASE4 )
00161                 return ( other_bits | LPA_100BASE4 );
00162         else if ( negotiated & LPA_100HALF )
00163                 return ( other_bits | LPA_100HALF );
00164         else if ( negotiated & LPA_10FULL )
00165                 return ( other_bits | LPA_10FULL );
00166         else return ( other_bits | LPA_10HALF );
00167 }

static int gmii_link_ok ( struct efab_nic efab  )  [static]

Check GMII PHY link status.

Definition at line 174 of file etherfabric.c.

References BMSR_LSTATUS, falcon_mdio_read(), GMII_PSSR, MII_BMSR, and PSSR_LSTATUS.

Referenced by alaska_init().

00175 {
00176         int status;
00177         int phy_status;
00178 
00179         /* BMSR is latching - it returns "link down" if the link has
00180          * been down at any point since the last read.  To get a
00181          * real-time status, we therefore read the register twice and
00182          * use the result of the second read.
00183          */
00184         (void) falcon_mdio_read ( efab, 0, MII_BMSR );
00185         status = falcon_mdio_read ( efab, 0, MII_BMSR );
00186 
00187         /* Read the PHY-specific Status Register.  This is
00188          * non-latching, so we need do only a single read.
00189          */
00190         phy_status = falcon_mdio_read ( efab, 0, GMII_PSSR );
00191 
00192         return ( ( status & BMSR_LSTATUS ) && ( phy_status & PSSR_LSTATUS ) );
00193 }

static int mdio_clause45_wait_reset_mmds ( struct efab_nic efab  )  [static]

Definition at line 266 of file etherfabric.c.

References EFAB_ERR, ETIMEDOUT, falcon_mdio_read(), mdelay(), MDIO45_RESET_SPINTIME, MDIO45_RESET_TRIES, MDIO_MMDREG_CTRL1, MDIO_MMDREG_CTRL1_RESET_LBN, efab_phy_operations::mmds, and efab_nic::phy_op.

Referenced by falcon_tenxpress_phy_init().

00267 {
00268         int tries = MDIO45_RESET_TRIES;
00269         int in_reset;
00270 
00271         while(tries) {
00272                 int mask = efab->phy_op->mmds;
00273                 int mmd = 0;
00274                 in_reset = 0;
00275                 while(mask) {
00276                         if (mask & 1) {
00277                                 int stat = falcon_mdio_read ( efab,  mmd,
00278                                                               MDIO_MMDREG_CTRL1 );
00279                                 if (stat < 0) {
00280                                         EFAB_ERR("Failed to read status of MMD %d\n",
00281                                                  mmd );
00282                                         in_reset = 1;
00283                                         break;
00284                                 }
00285                                 if (stat & (1 << MDIO_MMDREG_CTRL1_RESET_LBN))
00286                                         in_reset |= (1 << mmd);
00287                         }
00288                         mask = mask >> 1;
00289                         mmd++;
00290                 }
00291                 if (!in_reset)
00292                         break;
00293                 tries--;
00294                 mdelay ( MDIO45_RESET_SPINTIME );
00295         }
00296         if (in_reset != 0) {
00297                 EFAB_ERR("Not all MMDs came out of reset in time. MMDs "
00298                          "still in reset: %x\n", in_reset);
00299                 return -ETIMEDOUT;
00300         }
00301         return 0;
00302 }

static int mdio_clause45_reset_mmd ( struct efab_nic efab,
int  mmd 
) [static]

Definition at line 305 of file etherfabric.c.

References EFAB_ERR, ETIMEDOUT, falcon_mdio_read(), falcon_mdio_write(), mdelay(), MDIO45_RESET_SPINTIME, MDIO45_RESET_TRIES, MDIO_MMDREG_CTRL1, and MDIO_MMDREG_CTRL1_RESET_LBN.

Referenced by falcon_pm8358_phy_init(), falcon_txc_phy_init(), and falcon_xfp_phy_init().

00306 {
00307         int tries = MDIO45_RESET_TRIES;
00308         int ctrl;
00309 
00310         falcon_mdio_write ( efab, mmd, MDIO_MMDREG_CTRL1,
00311                             ( 1 << MDIO_MMDREG_CTRL1_RESET_LBN ) );
00312 
00313         /* Wait for the reset bit to clear. */
00314         do {
00315                 mdelay ( MDIO45_RESET_SPINTIME );
00316 
00317                 ctrl = falcon_mdio_read ( efab, mmd, MDIO_MMDREG_CTRL1 );
00318                 if ( ~ctrl & ( 1 << MDIO_MMDREG_CTRL1_RESET_LBN ) )
00319                         return 0;
00320         } while ( --tries );
00321 
00322         EFAB_ERR ( "Failed to reset mmd %d\n", mmd );
00323 
00324         return -ETIMEDOUT;
00325 }

static int mdio_clause45_links_ok ( struct efab_nic efab  )  [static]

Definition at line 328 of file etherfabric.c.

References falcon_mdio_read(), MDIO_MMDREG_STAT1, MDIO_MMDREG_STAT1_LINK_LBN, efab_phy_operations::mmds, and efab_nic::phy_op.

Referenced by falcon_init_xmac().

00329 {
00330         int status, good;
00331         int ok = 1;
00332         int mmd = 0;
00333         int mmd_mask = efab->phy_op->mmds;
00334 
00335         while (mmd_mask) {
00336                 if (mmd_mask & 1) {
00337                         /* Double reads because link state is latched, and a
00338                          * read moves the current state into the register */
00339                         status = falcon_mdio_read ( efab, mmd,
00340                                                     MDIO_MMDREG_STAT1 );
00341                         status = falcon_mdio_read ( efab, mmd,
00342                                                     MDIO_MMDREG_STAT1 );
00343 
00344                         good = status & (1 << MDIO_MMDREG_STAT1_LINK_LBN);
00345                         ok = ok && good;
00346                 }
00347                 mmd_mask = (mmd_mask >> 1);
00348                 mmd++;
00349         }
00350         return ok;
00351 }

static int mdio_clause45_check_mmds ( struct efab_nic efab  )  [static]

Definition at line 354 of file etherfabric.c.

References EFAB_DWORD_FIELD, EFAB_ERR, EIO, falcon_mdio_read(), MDIO_MMD_PHYXS, MDIO_MMDREG_DEVS0, MDIO_MMDREG_STAT2, MDIO_MMDREG_STAT2_PRESENT_VAL, efab_phy_operations::mmds, efab_dword::opaque, and efab_nic::phy_op.

Referenced by falcon_tenxpress_phy_init(), and falcon_txc_phy_init().

00355 {
00356         int mmd = 0;
00357         int devices = falcon_mdio_read ( efab, MDIO_MMD_PHYXS,
00358                                          MDIO_MMDREG_DEVS0 );
00359         int mmd_mask = efab->phy_op->mmds;
00360 
00361         /* Check all the expected MMDs are present */
00362         if ( devices < 0 ) {
00363                 EFAB_ERR ( "Failed to read devices present\n" );
00364                 return -EIO;
00365         }
00366         if ( ( devices & mmd_mask ) != mmd_mask ) {
00367                 EFAB_ERR ( "required MMDs not present: got %x, wanted %x\n",
00368                            devices, mmd_mask );
00369                 return -EIO;
00370         }
00371 
00372         /* Check all required MMDs are responding and happy. */
00373         while ( mmd_mask ) {
00374                 if ( mmd_mask & 1 ) {
00375                         efab_dword_t reg;
00376                         int status;
00377                         reg.opaque = falcon_mdio_read ( efab, mmd,
00378                                                         MDIO_MMDREG_STAT2 );
00379                         status = EFAB_DWORD_FIELD ( reg,
00380                                                     MDIO_MMDREG_STAT2_PRESENT );
00381                         if ( status != MDIO_MMDREG_STAT2_PRESENT_VAL ) {
00382 
00383 
00384                                 return -EIO;
00385                         }
00386                 }
00387                 mmd_mask >>= 1;
00388                 mmd++;
00389         }
00390 
00391         return 0;
00392 }

static void falcon_write ( struct efab_nic efab,
efab_oword_t value,
unsigned int  reg 
) [inline, static]

Write to a Falcon register.

Definition at line 1201 of file etherfabric.c.

References _falcon_writel, EFAB_OWORD_FMT, EFAB_OWORD_VAL, EFAB_REGDUMP, efab_oword::u32, and wmb.

Referenced by clear_b0_fpga_memories(), falcon_fini_resources(), falcon_gmac_writel(), falcon_i2c_bit_write(), falcon_init_resources(), falcon_init_sram(), falcon_interrupts(), falcon_mdio_read(), falcon_mdio_write(), falcon_reconfigure_mac_wrapper(), falcon_reset(), falcon_setup_nic(), falcon_spi_rw(), and falcon_xmac_writel().

01202 {
01203 
01204         EFAB_REGDUMP ( "Writing register %x with " EFAB_OWORD_FMT "\n",
01205                        reg, EFAB_OWORD_VAL ( *value ) );
01206 
01207         _falcon_writel ( efab, value->u32[0], reg + 0  );
01208         _falcon_writel ( efab, value->u32[1], reg + 4  );
01209         _falcon_writel ( efab, value->u32[2], reg + 8  );
01210         wmb();
01211         _falcon_writel ( efab, value->u32[3], reg + 12 );
01212         wmb();
01213 }

static void falcon_write_sram ( struct efab_nic efab,
efab_qword_t value,
unsigned int  index 
) [inline, static]

Write to Falcon SRAM.

Definition at line 1220 of file etherfabric.c.

References _falcon_writel, EFAB_QWORD_FMT, EFAB_QWORD_VAL, EFAB_REGDUMP, FCN_REVISION_REG, efab_qword::u32, and wmb.

Referenced by falcon_alloc_special_buffer().

01222 {
01223         unsigned int reg = ( FCN_REVISION_REG ( efab, FCN_BUF_FULL_TBL_KER ) +
01224                              ( index * sizeof ( *value ) ) );
01225 
01226         EFAB_REGDUMP ( "Writing SRAM register %x with " EFAB_QWORD_FMT "\n",
01227                        reg, EFAB_QWORD_VAL ( *value ) );
01228 
01229         _falcon_writel ( efab, value->u32[0], reg + 0  );
01230         _falcon_writel ( efab, value->u32[1], reg + 4  );
01231         wmb();
01232 }

static void falcon_writel ( struct efab_nic efab,
efab_dword_t value,
unsigned int  reg 
) [inline, static]

Write dword to Falcon register that allows partial writes.

Definition at line 1239 of file etherfabric.c.

References _falcon_writel, EFAB_DWORD_FMT, EFAB_DWORD_VAL, EFAB_REGDUMP, and efab_dword::u32.

Referenced by falcon_clear_interrupts(), falcon_eventq_read_ack(), falcon_notify_rx_desc(), falcon_notify_tx_desc(), and falcon_setup_nic().

01240 {
01241         EFAB_REGDUMP ( "Writing partial register %x with " EFAB_DWORD_FMT "\n",
01242                        reg, EFAB_DWORD_VAL ( *value ) );
01243         _falcon_writel ( efab, value->u32[0], reg );
01244 }

static void falcon_read ( struct efab_nic efab,
efab_oword_t value,
unsigned int  reg 
) [inline, static]

Read from a Falcon register.

Definition at line 1251 of file etherfabric.c.

References _falcon_readl, EFAB_OWORD_FMT, EFAB_OWORD_VAL, EFAB_REGDUMP, efab_oword::u32, and wmb.

Referenced by falcon_gmac_readl(), falcon_i2c_bit_read(), falcon_i2c_bit_write(), falcon_init_sram(), falcon_mdio_read(), falcon_probe_nic_variant(), falcon_probe_spi(), falcon_reset(), falcon_setup_nic(), falcon_spi_rw(), falcon_spi_wait(), and falcon_xmac_readl().

01252 {
01253         value->u32[0] = _falcon_readl ( efab, reg + 0  );
01254         wmb();
01255         value->u32[1] = _falcon_readl ( efab, reg + 4  );
01256         value->u32[2] = _falcon_readl ( efab, reg + 8  );
01257         value->u32[3] = _falcon_readl ( efab, reg + 12 );
01258 
01259         EFAB_REGDUMP ( "Read from register %x, got " EFAB_OWORD_FMT "\n",
01260                        reg, EFAB_OWORD_VAL ( *value ) );
01261 }

static void falcon_read_sram ( struct efab_nic efab,
efab_qword_t value,
unsigned int  index 
) [inline, static]

Read from Falcon SRAM.

Definition at line 1268 of file etherfabric.c.

References _falcon_readl, EFAB_QWORD_FMT, EFAB_QWORD_VAL, EFAB_REGDUMP, FCN_REVISION_REG, and efab_qword::u32.

01270 {
01271         unsigned int reg = ( FCN_REVISION_REG ( efab, FCN_BUF_FULL_TBL_KER ) +
01272                              ( index * sizeof ( *value ) ) );
01273 
01274         value->u32[0] = _falcon_readl ( efab, reg + 0 );
01275         value->u32[1] = _falcon_readl ( efab, reg + 4 );
01276         EFAB_REGDUMP ( "Read from SRAM register %x, got " EFAB_QWORD_FMT "\n",
01277                        reg, EFAB_QWORD_VAL ( *value ) );
01278 }

static void falcon_readl ( struct efab_nic efab,
efab_dword_t value,
unsigned int  reg 
) [inline, static]

Read dword from a portion of a Falcon register.

Definition at line 1285 of file etherfabric.c.

References _falcon_readl, EFAB_DWORD_FMT, EFAB_DWORD_VAL, EFAB_REGDUMP, and efab_dword::u32.

Referenced by falcon_clear_interrupts(), and falcon_gmii_wait().

01286 {
01287         value->u32[0] = _falcon_readl ( efab, reg );
01288         EFAB_REGDUMP ( "Read from register %x, got " EFAB_DWORD_FMT "\n",
01289                        reg, EFAB_DWORD_VAL ( *value ) );
01290 }

static int falcon_event_present ( falcon_event_t event  )  [inline, static]

See if an event is present.

Parameters:
event Falcon event structure
Return values:
True An event is pending
False No event is pending
We check both the high and low dword of the event for all ones. We wrote all ones when we cleared the event, and no valid event can have all ones in either its high or low dwords. This approach is robust against reordering.

Note that using a single 64-bit comparison is incorrect; even though the CPU read will be atomic, the DMA write may not be.

Definition at line 1322 of file etherfabric.c.

References efab_qword::dword, and EFAB_DWORD_IS_ALL_ONES.

Referenced by efab_poll().

01323 {
01324         return ( ! ( EFAB_DWORD_IS_ALL_ONES ( event->dword[0] ) |
01325                      EFAB_DWORD_IS_ALL_ONES ( event->dword[1] ) ) );
01326 }

static void falcon_eventq_read_ack ( struct efab_nic efab,
struct efab_ev_queue ev_queue 
) [static]

Definition at line 1329 of file etherfabric.c.

References EFAB_POPULATE_DWORD_1, falcon_writel(), FCN_REVISION_REG, and efab_ev_queue::read_ptr.

Referenced by efab_irq(), efab_poll(), and falcon_init_resources().

01330 {
01331         efab_dword_t reg;
01332 
01333         EFAB_POPULATE_DWORD_1 ( reg, FCN_EVQ_RPTR_DWORD, ev_queue->read_ptr );
01334         falcon_writel ( efab, &reg,
01335                         FCN_REVISION_REG ( efab, FCN_EVQ_RPTR_REG_KER_DWORD ) );
01336 }

static void falcon_interrupts ( struct efab_nic efab,
int  enabled,
int  force 
) [static]

Definition at line 1378 of file etherfabric.c.

References EFAB_POPULATE_OWORD_2, falcon_write(), and FCN_INT_EN_REG_KER.

Referenced by efab_irq(), and falcon_fini_resources().

01379 {
01380         efab_oword_t int_en_reg_ker;
01381 
01382         EFAB_POPULATE_OWORD_2 ( int_en_reg_ker,
01383                                 FCN_KER_INT_KER, force,
01384                                 FCN_DRV_INT_EN_KER, enabled );
01385         falcon_write ( efab, &int_en_reg_ker, FCN_INT_EN_REG_KER );     
01386 }

static int falcon_spi_wait ( struct efab_nic efab  )  [static]

Definition at line 1401 of file etherfabric.c.

References EFAB_ERR, EFAB_OWORD_FIELD, ETIMEDOUT, falcon_read(), FCN_EE_SPI_HCMD_REG, and udelay().

Referenced by falcon_spi_rw().

01402 {
01403         efab_oword_t reg;
01404         int count;
01405 
01406         count = 0;
01407         do {
01408                 udelay ( 100 );
01409                 falcon_read ( efab, &reg, FCN_EE_SPI_HCMD_REG );
01410                 if ( EFAB_OWORD_FIELD ( reg, FCN_EE_SPI_HCMD_CMD_EN ) == 0 )
01411                         return 0;
01412         } while ( ++count < 1000 );
01413 
01414         EFAB_ERR ( "Timed out waiting for SPI\n" );
01415         return -ETIMEDOUT;
01416 }

static int falcon_spi_rw ( struct spi_bus bus,
struct spi_device device,
unsigned int  command,
int  address,
const void *  data_out,
void *  data_in,
size_t  len 
) [static]

Definition at line 1419 of file etherfabric.c.

References spi_device::address_len, assert, container_of, EFAB_ERR, EFAB_POPULATE_OWORD_1, EFAB_POPULATE_OWORD_7, EFAB_TRACE, EINVAL, falcon_read(), FALCON_SPI_MAX_LEN, falcon_spi_wait(), falcon_write(), FCN_EE_SPI_EEPROM, FCN_EE_SPI_FLASH, FCN_EE_SPI_HADR_REG, FCN_EE_SPI_HCMD_REG, FCN_EE_SPI_HDATA_REG, FCN_EE_SPI_READ, FCN_EE_SPI_WRITE, memcpy, efab_nic::spi_eeprom, and efab_nic::spi_flash.

Referenced by falcon_probe_spi().

01422 {
01423         struct efab_nic *efab = container_of ( bus, struct efab_nic, spi_bus );
01424         int address_len, rc, device_id, read_cmd;
01425         efab_oword_t reg;
01426 
01427         /* falcon_init_spi_device() should have reduced the block size
01428          * down so this constraint holds */
01429         assert ( len <= FALCON_SPI_MAX_LEN );
01430 
01431         /* Is this the FLASH or EEPROM device? */
01432         if ( device == &efab->spi_flash )
01433                 device_id = FCN_EE_SPI_FLASH;
01434         else if ( device == &efab->spi_eeprom )
01435                 device_id = FCN_EE_SPI_EEPROM;
01436         else {
01437                 EFAB_ERR ( "Unknown device %p\n", device );
01438                 return -EINVAL;
01439         }
01440 
01441         EFAB_TRACE ( "Executing spi command %d on device %d at %d for %zd bytes\n",
01442                      command, device_id, address, len );
01443 
01444         /* The bus must be idle */
01445         rc = falcon_spi_wait ( efab );
01446         if ( rc )
01447                 goto fail1;
01448 
01449         /* Copy data out */
01450         if ( data_out ) {
01451                 memcpy ( &reg, data_out, len );
01452                 falcon_write ( efab, &reg, FCN_EE_SPI_HDATA_REG );
01453         }
01454 
01455         /* Program address register */
01456         if ( address >= 0 ) {
01457                 EFAB_POPULATE_OWORD_1 ( reg, FCN_EE_SPI_HADR_ADR, address );
01458                 falcon_write ( efab, &reg, FCN_EE_SPI_HADR_REG );
01459         }
01460 
01461         /* Issue command */
01462         address_len = ( address >= 0 ) ? device->address_len / 8 : 0;
01463         read_cmd = ( data_in ? FCN_EE_SPI_READ : FCN_EE_SPI_WRITE );
01464         EFAB_POPULATE_OWORD_7 ( reg,
01465                                 FCN_EE_SPI_HCMD_CMD_EN, 1,
01466                                 FCN_EE_SPI_HCMD_SF_SEL, device_id,
01467                                 FCN_EE_SPI_HCMD_DABCNT, len,
01468                                 FCN_EE_SPI_HCMD_READ, read_cmd,
01469                                 FCN_EE_SPI_HCMD_DUBCNT, 0,
01470                                 FCN_EE_SPI_HCMD_ADBCNT, address_len,
01471                                 FCN_EE_SPI_HCMD_ENC, command );
01472         falcon_write ( efab, &reg, FCN_EE_SPI_HCMD_REG );
01473 
01474         /* Wait for the command to complete */
01475         rc = falcon_spi_wait ( efab );
01476         if ( rc )
01477                 goto fail2;
01478 
01479         /* Copy data in */
01480         if ( data_in ) {
01481                 falcon_read ( efab, &reg, FCN_EE_SPI_HDATA_REG );
01482                 memcpy ( data_in, &reg, len );
01483         }
01484 
01485         return 0;
01486 
01487 fail2:
01488 fail1:
01489         EFAB_ERR ( "Failed SPI command %d to device %d address 0x%x len 0x%zx\n",
01490                    command, device_id, address, len );
01491 
01492         return rc;
01493 }

static void falcon_i2c_bit_write ( struct bit_basher basher,
unsigned int  bit_id,
unsigned long  data 
) [static]

Definition at line 1510 of file etherfabric.c.

References i2c_bit_basher::basher, container_of, EFAB_ERR, EFAB_SET_OWORD_FIELD, falcon_read(), falcon_write(), FCN_GPIO_CTL_REG_KER, efab_nic::i2c_bb, I2C_BIT_SCL, and I2C_BIT_SDA.

01512 {
01513         struct efab_nic *efab = container_of ( basher, struct efab_nic,
01514                                                i2c_bb.basher );
01515         efab_oword_t reg;
01516 
01517         falcon_read ( efab, &reg, FCN_GPIO_CTL_REG_KER );
01518         switch ( bit_id ) {
01519         case I2C_BIT_SCL:
01520                 EFAB_SET_OWORD_FIELD ( reg, FCN_GPIO0_OEN, ( data ? 0 : 1 ) );
01521                 break;
01522         case I2C_BIT_SDA:
01523                 EFAB_SET_OWORD_FIELD ( reg, FCN_GPIO3_OEN, ( data ? 0 : 1 ) );
01524                 break;
01525         default:
01526                 EFAB_ERR ( "%s bit=%d\n", __func__, bit_id );
01527                 break;
01528         }
01529 
01530         falcon_write ( efab, &reg,  FCN_GPIO_CTL_REG_KER );
01531 }

static int falcon_i2c_bit_read ( struct bit_basher basher,
unsigned int  bit_id 
) [static]

Definition at line 1534 of file etherfabric.c.

References i2c_bit_basher::basher, container_of, EFAB_ERR, EFAB_OWORD_FIELD, falcon_read(), FCN_GPIO_CTL_REG_KER, efab_nic::i2c_bb, I2C_BIT_SCL, and I2C_BIT_SDA.

01535 {
01536         struct efab_nic *efab = container_of ( basher, struct efab_nic,
01537                                                i2c_bb.basher );
01538         efab_oword_t reg;
01539         
01540         falcon_read ( efab, &reg, FCN_GPIO_CTL_REG_KER );
01541         switch ( bit_id ) {
01542         case I2C_BIT_SCL:
01543                 return EFAB_OWORD_FIELD ( reg, FCN_GPIO0_IN );
01544                 break;
01545         case I2C_BIT_SDA:
01546                 return EFAB_OWORD_FIELD ( reg, FCN_GPIO3_IN );
01547                 break;
01548         default:
01549                 EFAB_ERR ( "%s bit=%d\n", __func__, bit_id );
01550                 break;
01551         }
01552 
01553         return -1;
01554 }

static int falcon_gmii_wait ( struct efab_nic efab  )  [static]

Definition at line 1571 of file etherfabric.c.

References EFAB_DWORD_FIELD, EFAB_DWORD_FMT, EFAB_DWORD_VAL, EFAB_ERR, EIO, ETIMEDOUT, falcon_readl(), FCN_MD_STAT_REG_KER, and udelay().

Referenced by falcon_mdio_read(), and falcon_mdio_write().

01572 {
01573         efab_dword_t md_stat;
01574         int count;
01575 
01576         /* wait upto 10ms */
01577         for (count = 0; count < 1000; count++) {
01578                 falcon_readl ( efab, &md_stat, FCN_MD_STAT_REG_KER );
01579                 if ( EFAB_DWORD_FIELD ( md_stat, FCN_MD_BSY ) == 0 ) {
01580                         if ( EFAB_DWORD_FIELD ( md_stat, FCN_MD_LNFL ) != 0 ||
01581                              EFAB_DWORD_FIELD ( md_stat, FCN_MD_BSERR ) != 0 ) {
01582                                 EFAB_ERR ( "Error from GMII access "
01583                                            EFAB_DWORD_FMT"\n",
01584                                            EFAB_DWORD_VAL ( md_stat ));
01585                                 return -EIO;
01586                         }
01587                         return 0;
01588                 }
01589                 udelay(10);
01590         }
01591 
01592         EFAB_ERR ( "Timed out waiting for GMII\n" );
01593         return -ETIMEDOUT;
01594 }

static void falcon_reconfigure_mac_wrapper ( struct efab_nic efab  )  [static]

Definition at line 1723 of file etherfabric.c.

References EFAB_POPULATE_OWORD_5, falcon_write(), FCN_MAC0_CTRL_REG_KER, efab_nic::link_options, LPA_100, LPA_EF_1000, and LPA_EF_10000.

Referenced by falcon_init_gmac(), and falcon_init_xmac().

01724 {
01725         efab_oword_t reg;
01726         int link_speed;
01727 
01728         if ( efab->link_options & LPA_EF_10000 ) {
01729                 link_speed = 0x3;
01730         } else if ( efab->link_options & LPA_EF_1000 ) {
01731                 link_speed = 0x2;
01732         } else if ( efab->link_options & LPA_100 ) {
01733                 link_speed = 0x1;
01734         } else {
01735                 link_speed = 0x0;
01736         }
01737         EFAB_POPULATE_OWORD_5 ( reg,
01738                                 FCN_MAC_XOFF_VAL, 0xffff /* datasheet */,
01739                                 FCN_MAC_BCAD_ACPT, 1,
01740                                 FCN_MAC_UC_PROM, 0,
01741                                 FCN_MAC_LINK_STATUS, 1,
01742                                 FCN_MAC_SPEED, link_speed );
01743 
01744         falcon_write ( efab, &reg, FCN_MAC0_CTRL_REG_KER );
01745 }

static void falcon_gmac_writel ( struct efab_nic efab,
efab_dword_t value,
unsigned int  mac_reg 
) [static]

Definition at line 1887 of file etherfabric.c.

References EFAB_DWORD_FIELD, EFAB_POPULATE_OWORD_1, FALCON_GMAC_REG, and falcon_write().

Referenced by mentormac_init(), and mentormac_reset().

01889 {
01890         efab_oword_t temp;
01891 
01892         EFAB_POPULATE_OWORD_1 ( temp, FCN_MAC_DATA,
01893                                 EFAB_DWORD_FIELD ( *value, FCN_MAC_DATA ) );
01894         falcon_write ( efab, &temp, FALCON_GMAC_REG ( efab, mac_reg ) );
01895 }

static void falcon_gmac_readl ( struct efab_nic efab,
efab_dword_t value,
unsigned int  mac_reg 
) [static]

Definition at line 1898 of file etherfabric.c.

References EFAB_OWORD_FIELD, EFAB_POPULATE_DWORD_1, FALCON_GMAC_REG, and falcon_read().

Referenced by mentormac_init().

01900 {
01901         efab_oword_t temp;
01902 
01903         falcon_read ( efab, &temp, FALCON_GMAC_REG ( efab, mac_reg ) );
01904         EFAB_POPULATE_DWORD_1 ( *value, FCN_MAC_DATA,
01905                                 EFAB_OWORD_FIELD ( temp, FCN_MAC_DATA ) );
01906 }

static void mentormac_reset ( struct efab_nic efab  )  [static]

Definition at line 1909 of file etherfabric.c.

References EFAB_POPULATE_DWORD_1, falcon_gmac_writel(), GM_CFG1_REG_MAC, GM_MII_MGMT_CFG_REG_MAC, and udelay().

Referenced by falcon_init_gmac().

01910 {
01911         efab_dword_t reg;
01912 
01913         /* Take into reset */
01914         EFAB_POPULATE_DWORD_1 ( reg, GM_SW_RST, 1 );
01915         falcon_gmac_writel ( efab, &reg, GM_CFG1_REG_MAC );
01916         udelay ( 1000 );
01917 
01918         /* Take out of reset */
01919         EFAB_POPULATE_DWORD_1 ( reg, GM_SW_RST, 0 );
01920         falcon_gmac_writel ( efab, &reg, GM_CFG1_REG_MAC );
01921         udelay ( 1000 );
01922 
01923         /* Configure GMII interface so PHY is accessible.  Note that
01924          * GMII interface is connected only to port 0, and that on
01925          * Falcon this is a no-op.
01926          */
01927         EFAB_POPULATE_DWORD_1 ( reg, GM_MGMT_CLK_SEL, 0x4 );
01928         falcon_gmac_writel ( efab, &reg, GM_MII_MGMT_CFG_REG_MAC );
01929         udelay ( 10 );
01930 }

static void mentormac_init ( struct efab_nic efab  )  [static]

Definition at line 1933 of file etherfabric.c.

References EFAB_MAX_FRAME_LEN, EFAB_POPULATE_DWORD_1, EFAB_POPULATE_DWORD_2, EFAB_POPULATE_DWORD_4, EFAB_POPULATE_DWORD_5, EFAB_SET_DWORD_FIELD, ETH_FRAME_LEN, falcon_gmac_readl(), falcon_gmac_writel(), full_duplex, GM_ADR1_REG_MAC, GM_ADR2_REG_MAC, GM_CFG1_REG_MAC, GM_CFG2_REG_MAC, GM_MAX_FLEN_REG_MAC, GMF_CFG0_REG_MAC, GMF_CFG1_REG_MAC, GMF_CFG2_REG_MAC, GMF_CFG3_REG_MAC, GMF_CFG4_REG_MAC, GMF_CFG5_REG_MAC, efab_nic::link_options, LPA_EF_1000, LPA_EF_DUPLEX, LPA_PAUSE_CAP, efab_nic::mac_addr, pause(), and udelay().

Referenced by falcon_init_gmac().

01934 {
01935         int pause, if_mode, full_duplex, bytemode, half_duplex;
01936         efab_dword_t reg;
01937 
01938         /* Configuration register 1 */
01939         pause = ( efab->link_options & LPA_PAUSE_CAP ) ? 1 : 0;
01940         if ( ! ( efab->link_options & LPA_EF_DUPLEX ) ) {
01941                 /* Half-duplex operation requires TX flow control */
01942                 pause = 1;
01943         }
01944         EFAB_POPULATE_DWORD_4 ( reg,
01945                                 GM_TX_EN, 1,
01946                                 GM_TX_FC_EN, pause,
01947                                 GM_RX_EN, 1,
01948                                 GM_RX_FC_EN, 1 );
01949         falcon_gmac_writel ( efab, &reg, GM_CFG1_REG_MAC );
01950         udelay ( 10 );
01951 
01952         /* Configuration register 2 */
01953         if_mode = ( efab->link_options & LPA_EF_1000 ) ? 2 : 1;
01954         full_duplex = ( efab->link_options & LPA_EF_DUPLEX ) ? 1 : 0;
01955         EFAB_POPULATE_DWORD_4 ( reg,
01956                                 GM_IF_MODE, if_mode,
01957                                 GM_PAD_CRC_EN, 1,
01958                                 GM_FD, full_duplex,
01959                                 GM_PAMBL_LEN, 0x7 /* ? */ );
01960         falcon_gmac_writel ( efab, &reg, GM_CFG2_REG_MAC );
01961         udelay ( 10 );
01962 
01963         /* Max frame len register */
01964         EFAB_POPULATE_DWORD_1 ( reg, GM_MAX_FLEN,
01965                                 EFAB_MAX_FRAME_LEN ( ETH_FRAME_LEN ) );
01966         falcon_gmac_writel ( efab, &reg, GM_MAX_FLEN_REG_MAC );
01967         udelay ( 10 );
01968 
01969         /* FIFO configuration register 0 */
01970         EFAB_POPULATE_DWORD_5 ( reg,
01971                                 GMF_FTFENREQ, 1,
01972                                 GMF_STFENREQ, 1,
01973                                 GMF_FRFENREQ, 1,
01974                                 GMF_SRFENREQ, 1,
01975                                 GMF_WTMENREQ, 1 );
01976         falcon_gmac_writel ( efab, &reg, GMF_CFG0_REG_MAC );
01977         udelay ( 10 );
01978 
01979         /* FIFO configuration register 1 */
01980         EFAB_POPULATE_DWORD_2 ( reg,
01981                                 GMF_CFGFRTH, 0x12,
01982                                 GMF_CFGXOFFRTX, 0xffff );
01983         falcon_gmac_writel ( efab, &reg, GMF_CFG1_REG_MAC );
01984         udelay ( 10 );
01985 
01986         /* FIFO configuration register 2 */
01987         EFAB_POPULATE_DWORD_2 ( reg,
01988                                 GMF_CFGHWM, 0x3f,
01989                                 GMF_CFGLWM, 0xa );
01990         falcon_gmac_writel ( efab, &reg, GMF_CFG2_REG_MAC );
01991         udelay ( 10 );
01992 
01993         /* FIFO configuration register 3 */
01994         EFAB_POPULATE_DWORD_2 ( reg,
01995                                 GMF_CFGHWMFT, 0x1c,
01996                                 GMF_CFGFTTH, 0x08 );
01997         falcon_gmac_writel ( efab, &reg, GMF_CFG3_REG_MAC );
01998         udelay ( 10 );
01999 
02000         /* FIFO configuration register 4 */
02001         EFAB_POPULATE_DWORD_1 ( reg, GMF_HSTFLTRFRM_PAUSE, 1 );
02002         falcon_gmac_writel ( efab, &reg, GMF_CFG4_REG_MAC );
02003         udelay ( 10 );
02004         
02005         /* FIFO configuration register 5 */
02006         bytemode = ( efab->link_options & LPA_EF_1000 ) ? 1 : 0;
02007         half_duplex = ( efab->link_options & LPA_EF_DUPLEX ) ? 0 : 1;
02008         falcon_gmac_readl ( efab, &reg, GMF_CFG5_REG_MAC );
02009         EFAB_SET_DWORD_FIELD ( reg, GMF_CFGBYTMODE, bytemode );
02010         EFAB_SET_DWORD_FIELD ( reg, GMF_CFGHDPLX, half_duplex );
02011         EFAB_SET_DWORD_FIELD ( reg, GMF_HSTDRPLT64, half_duplex );
02012         EFAB_SET_DWORD_FIELD ( reg, GMF_HSTFLTRFRMDC_PAUSE, 0 );
02013         falcon_gmac_writel ( efab, &reg, GMF_CFG5_REG_MAC );
02014         udelay ( 10 );
02015         
02016         /* MAC address */
02017         EFAB_POPULATE_DWORD_4 ( reg,
02018                                 GM_HWADDR_5, efab->mac_addr[5],
02019                                 GM_HWADDR_4, efab->mac_addr[4],
02020                                 GM_HWADDR_3, efab->mac_addr[3],
02021                                 GM_HWADDR_2, efab->mac_addr[2] );
02022         falcon_gmac_writel ( efab, &reg, GM_ADR1_REG_MAC );
02023         udelay ( 10 );
02024         EFAB_POPULATE_DWORD_2 ( reg,
02025                                 GM_HWADDR_1, efab->mac_addr[1],
02026                                 GM_HWADDR_0, efab->mac_addr[0] );
02027         falcon_gmac_writel ( efab, &reg, GM_ADR2_REG_MAC );
02028         udelay ( 10 );
02029 }

static int falcon_init_gmac ( struct efab_nic efab  )  [static]

Definition at line 2032 of file etherfabric.c.

References EAGAIN, falcon_reconfigure_mac_wrapper(), efab_phy_operations::init, efab_nic::link_up, mentormac_init(), mentormac_reset(), and efab_nic::phy_op.

02033 {
02034         /* Reset the MAC */
02035         mentormac_reset ( efab );
02036 
02037         /* Initialise PHY */
02038         efab->phy_op->init ( efab );
02039 
02040         /* check the link is up */
02041         if ( !efab->link_up )
02042                 return -EAGAIN;
02043 
02044         /* Initialise MAC */
02045         mentormac_init ( efab );
02046 
02047         /* reconfigure the MAC wrapper */
02048         falcon_reconfigure_mac_wrapper ( efab );
02049 
02050         return 0;
02051 }

static void falcon_xmac_writel ( struct efab_nic efab,
efab_dword_t value,
unsigned int  mac_reg 
) [static]

Write dword to a Falcon XMAC register.

Definition at line 2071 of file etherfabric.c.

References EFAB_DWORD_FIELD, EFAB_POPULATE_OWORD_1, falcon_write(), and FALCON_XMAC_REG.

Referenced by falcon_reconfigure_xmac(), falcon_reset_xaui(), falcon_reset_xmac(), falcon_setup_xaui(), falcon_xaui_link_ok(), and sfe4001_init().

02073 {
02074         efab_oword_t temp;
02075 
02076         EFAB_POPULATE_OWORD_1 ( temp, FCN_MAC_DATA,
02077                                 EFAB_DWORD_FIELD ( *value, FCN_MAC_DATA ) );
02078         falcon_write ( efab, &temp,
02079                        FALCON_XMAC_REG ( efab, mac_reg ) );
02080 }

static void falcon_xmac_readl ( struct efab_nic efab,
efab_dword_t value,
unsigned int  mac_reg 
) [static]

Read dword from a Falcon XMAC register.

Definition at line 2087 of file etherfabric.c.

References EFAB_OWORD_FIELD, EFAB_POPULATE_DWORD_1, falcon_read(), and FALCON_XMAC_REG.

Referenced by falcon_mask_status_intr(), falcon_reset_xaui(), falcon_reset_xmac(), falcon_setup_xaui(), falcon_xaui_link_ok(), and falcon_xgmii_status().

02089 {
02090         efab_oword_t temp;
02091 
02092         falcon_read ( efab, &temp,
02093                       FALCON_XMAC_REG ( efab, mac_reg ) );
02094         EFAB_POPULATE_DWORD_1 ( *value, FCN_MAC_DATA,
02095                                 EFAB_OWORD_FIELD ( temp, FCN_MAC_DATA ) );
02096 }

static void falcon_setup_xaui ( struct efab_nic efab  )  [static]

Configure Falcon XAUI output.

Definition at line 2102 of file etherfabric.c.

References EFAB_POPULATE_DWORD_8, EFAB_SET_DWORD_FIELD, falcon_xmac_readl(), falcon_xmac_writel(), FCN_XX_SD_CTL_REG_MAC, FCN_XX_TXDRV_CTL_REG_MAC, XX_SD_CTL_DRV_DEFAULT, XX_TXDRV_DEQ_DEFAULT, and XX_TXDRV_DTX_DEFAULT.

Referenced by falcon_reset_xaui().

02103 {
02104         efab_dword_t sdctl, txdrv;
02105 
02106         falcon_xmac_readl ( efab, &sdctl, FCN_XX_SD_CTL_REG_MAC );
02107         EFAB_SET_DWORD_FIELD ( sdctl, FCN_XX_HIDRVD, XX_SD_CTL_DRV_DEFAULT );
02108         EFAB_SET_DWORD_FIELD ( sdctl, FCN_XX_LODRVD, XX_SD_CTL_DRV_DEFAULT );
02109         EFAB_SET_DWORD_FIELD ( sdctl, FCN_XX_HIDRVC, XX_SD_CTL_DRV_DEFAULT );
02110         EFAB_SET_DWORD_FIELD ( sdctl, FCN_XX_LODRVC, XX_SD_CTL_DRV_DEFAULT );
02111         EFAB_SET_DWORD_FIELD ( sdctl, FCN_XX_HIDRVB, XX_SD_CTL_DRV_DEFAULT );
02112         EFAB_SET_DWORD_FIELD ( sdctl, FCN_XX_LODRVB, XX_SD_CTL_DRV_DEFAULT );
02113         EFAB_SET_DWORD_FIELD ( sdctl, FCN_XX_HIDRVA, XX_SD_CTL_DRV_DEFAULT );
02114         EFAB_SET_DWORD_FIELD ( sdctl, FCN_XX_LODRVA, XX_SD_CTL_DRV_DEFAULT );
02115         falcon_xmac_writel ( efab, &sdctl, FCN_XX_SD_CTL_REG_MAC );
02116 
02117         EFAB_POPULATE_DWORD_8 ( txdrv,
02118                                 FCN_XX_DEQD, XX_TXDRV_DEQ_DEFAULT,
02119                                 FCN_XX_DEQC, XX_TXDRV_DEQ_DEFAULT,
02120                                 FCN_XX_DEQB, XX_TXDRV_DEQ_DEFAULT,
02121                                 FCN_XX_DEQA, XX_TXDRV_DEQ_DEFAULT,
02122                                 FCN_XX_DTXD, XX_TXDRV_DTX_DEFAULT,
02123                                 FCN_XX_DTXC, XX_TXDRV_DTX_DEFAULT,
02124                                 FCN_XX_DTXB, XX_TXDRV_DTX_DEFAULT,
02125                                 FCN_XX_DTXA, XX_TXDRV_DTX_DEFAULT);
02126         falcon_xmac_writel ( efab, &txdrv, FCN_XX_TXDRV_CTL_REG_MAC);
02127 }

static int falcon_xgmii_status ( struct efab_nic efab  )  [static]

Definition at line 2130 of file etherfabric.c.

References EFAB_DWORD_FIELD, EFAB_DWORD_FMT, EFAB_DWORD_VAL, EFAB_TRACE, FALCON_REV_B0, falcon_xmac_readl(), FCN_XM_MGT_INT_REG_MAC_B0, and efab_nic::pci_revision.

Referenced by falcon_init_xmac().

02131 {
02132         efab_dword_t reg;
02133 
02134         if ( efab->pci_revision  < FALCON_REV_B0 )
02135                 return 1;
02136         /* The ISR latches, so clear it and re-read */
02137         falcon_xmac_readl ( efab, &reg, FCN_XM_MGT_INT_REG_MAC_B0 );
02138         falcon_xmac_readl ( efab, &reg, FCN_XM_MGT_INT_REG_MAC_B0 );
02139 
02140         if ( EFAB_DWORD_FIELD ( reg, FCN_XM_LCLFLT ) ||
02141              EFAB_DWORD_FIELD ( reg, FCN_XM_RMTFLT ) ) {
02142                 EFAB_TRACE ( "MGT_INT: "EFAB_DWORD_FMT"\n",
02143                              EFAB_DWORD_VAL ( reg ) );
02144                 return 0;
02145         }
02146 
02147         return 1;
02148 }

static void falcon_mask_status_intr ( struct efab_nic efab,
int  enable 
) [static]

Definition at line 2151 of file etherfabric.c.

References EFAB_POPULATE_DWORD_2, FALCON_REV_B0, falcon_xmac_readl(), FCN_XM_MGT_INT_MSK_REG_MAC_B0, FCN_XM_MGT_INT_REG_MAC_B0, and efab_nic::pci_revision.

Referenced by falcon_init_xmac().

02152 {
02153         efab_dword_t reg;
02154 
02155         if ( efab->pci_revision  < FALCON_REV_B0 )
02156                 return;
02157 
02158         /* Flush the ISR */
02159         if ( enable )
02160                 falcon_xmac_readl ( efab, &reg, FCN_XM_MGT_INT_REG_MAC_B0 );
02161 
02162         EFAB_POPULATE_DWORD_2 ( reg,
02163                                 FCN_XM_MSK_RMTFLT, !enable,
02164                                 FCN_XM_MSK_LCLFLT, !enable);
02165         falcon_xmac_readl ( efab, &reg, FCN_XM_MGT_INT_MSK_REG_MAC_B0 );
02166 }

static int falcon_reset_xmac ( struct efab_nic efab  )  [static]

Reset 10G MAC connected to port.

Definition at line 2173 of file etherfabric.c.

References EFAB_DWORD_FIELD, EFAB_POPULATE_DWORD_1, ETIMEDOUT, falcon_xmac_readl(), falcon_xmac_writel(), FCN_XM_GLB_CFG_REG_MAC, and udelay().

Referenced by falcon_init_xmac().

02174 {
02175         efab_dword_t reg;
02176         int count;
02177 
02178         EFAB_POPULATE_DWORD_1 ( reg, FCN_XM_CORE_RST, 1 );
02179         falcon_xmac_writel ( efab, &reg, FCN_XM_GLB_CFG_REG_MAC );
02180 
02181         for ( count = 0 ; count < 1000 ; count++ ) {
02182                 udelay ( 10 );
02183                 falcon_xmac_readl ( efab, &reg,
02184                                     FCN_XM_GLB_CFG_REG_MAC );
02185                 if ( EFAB_DWORD_FIELD ( reg, FCN_XM_CORE_RST ) == 0 )
02186                         return 0;
02187         }
02188         return -ETIMEDOUT;
02189 }

static int falcon_reset_xaui ( struct efab_nic efab  )  [static]

Definition at line 2193 of file etherfabric.c.

References EFAB_DWORD_FIELD, EFAB_ERR, EFAB_POPULATE_DWORD_1, ETIMEDOUT, falcon_setup_xaui(), falcon_xmac_readl(), falcon_xmac_writel(), FCN_XX_PWR_RST_REG_MAC, efab_nic::is_asic, and udelay().

Referenced by falcon_init_xmac().

02194 {
02195         efab_dword_t reg;
02196         int count;
02197 
02198         if (!efab->is_asic)
02199                 return 0;
02200 
02201         EFAB_POPULATE_DWORD_1 ( reg, FCN_XX_RST_XX_EN, 1 );
02202         falcon_xmac_writel ( efab, &reg, FCN_XX_PWR_RST_REG_MAC );
02203 
02204         /* Give some time for the link to establish */
02205         for (count = 0; count < 1000; count++) { /* wait upto 10ms */
02206                 falcon_xmac_readl ( efab, &reg, FCN_XX_PWR_RST_REG_MAC );
02207                 if ( EFAB_DWORD_FIELD ( reg, FCN_XX_RST_XX_EN ) == 0 ) {
02208                         falcon_setup_xaui ( efab );
02209                         return 0;
02210                 }
02211                 udelay(10);
02212         }
02213         EFAB_ERR ( "timed out waiting for XAUI/XGXS reset\n" );
02214         return -ETIMEDOUT;
02215 }

static int falcon_xaui_link_ok ( struct efab_nic efab  )  [static]

Definition at line 2218 of file etherfabric.c.

References EFAB_DWORD_FIELD, EFAB_LOG, EFAB_SET_DWORD_FIELD, falcon_mdio_read(), falcon_xmac_readl(), falcon_xmac_writel(), FCN_XX_CHARERR_RESET, FCN_XX_COMMA_DET_RESET, FCN_XX_CORE_STAT_REG_MAC, FCN_XX_DISPERR_RESET, FCN_XX_SYNC_STAT_DECODE_SYNCED, efab_nic::is_asic, MDIO_MMD_PHYXS, MDIO_PHYXS_LANE_ALIGNED_LBN, MDIO_PHYXS_LANE_STATE, efab_phy_operations::mmds, and efab_nic::phy_op.

Referenced by falcon_init_xmac().

02219 {
02220         efab_dword_t reg;
02221         int align_done, lane_status, sync;
02222         int has_phyxs;
02223         int link_ok = 1;
02224 
02225         /* Read Falcon XAUI side */
02226         if ( efab->is_asic ) {
02227                 /* Read link status */
02228                 falcon_xmac_readl ( efab, &reg, FCN_XX_CORE_STAT_REG_MAC );
02229                 align_done = EFAB_DWORD_FIELD ( reg, FCN_XX_ALIGN_DONE );
02230 
02231                 sync = EFAB_DWORD_FIELD ( reg, FCN_XX_SYNC_STAT );
02232                 sync = ( sync == FCN_XX_SYNC_STAT_DECODE_SYNCED );
02233                 
02234                 link_ok = align_done && sync;
02235         }
02236 
02237         /* Clear link status ready for next read */
02238         EFAB_SET_DWORD_FIELD ( reg, FCN_XX_COMMA_DET, FCN_XX_COMMA_DET_RESET );
02239         EFAB_SET_DWORD_FIELD ( reg, FCN_XX_CHARERR, FCN_XX_CHARERR_RESET);
02240         EFAB_SET_DWORD_FIELD ( reg, FCN_XX_DISPERR, FCN_XX_DISPERR_RESET);
02241         falcon_xmac_writel ( efab, &reg, FCN_XX_CORE_STAT_REG_MAC );
02242 
02243         has_phyxs = ( efab->phy_op->mmds & ( 1 << MDIO_MMD_PHYXS ) );
02244         if ( link_ok && has_phyxs ) {
02245                 lane_status = falcon_mdio_read ( efab, MDIO_MMD_PHYXS,
02246                                                  MDIO_PHYXS_LANE_STATE );
02247                 link_ok = ( lane_status & ( 1 << MDIO_PHYXS_LANE_ALIGNED_LBN ) );
02248 
02249                 if (!link_ok )
02250                         EFAB_LOG ( "XGXS lane status: %x\n", lane_status );
02251         }
02252 
02253         return link_ok;
02254 }

static void falcon_reconfigure_xmac ( struct efab_nic efab  )  [static]

Initialise XMAC.

Definition at line 2261 of file etherfabric.c.

References EFAB_MAX_FRAME_LEN, EFAB_POPULATE_DWORD_1, EFAB_POPULATE_DWORD_2, EFAB_POPULATE_DWORD_3, EFAB_POPULATE_DWORD_4, EFAB_POPULATE_DWORD_6, ETH_FRAME_LEN, falcon_xmac_writel(), FCN_XM_ADR_HI_REG_MAC, FCN_XM_ADR_LO_REG_MAC, FCN_XM_FC_REG_MAC, FCN_XM_GLB_CFG_REG_MAC, FCN_XM_RX_CFG_REG_MAC, FCN_XM_RX_PARAM_REG_MAC, FCN_XM_TX_CFG_REG_MAC, FCN_XM_TX_PARAM_REG_MAC, and efab_nic::mac_addr.

Referenced by falcon_init_xmac().

02262 {
02263         efab_dword_t reg;
02264         int max_frame_len;
02265 
02266         /* Configure MAC - cut-thru mode is hard wired on */
02267         EFAB_POPULATE_DWORD_3 ( reg,
02268                                 FCN_XM_RX_JUMBO_MODE, 1,
02269                                 FCN_XM_TX_STAT_EN, 1,
02270                                 FCN_XM_RX_STAT_EN, 1);
02271         falcon_xmac_writel ( efab, &reg, FCN_XM_GLB_CFG_REG_MAC );
02272 
02273         /* Configure TX */
02274         EFAB_POPULATE_DWORD_6 ( reg, 
02275                                 FCN_XM_TXEN, 1,
02276                                 FCN_XM_TX_PRMBL, 1,
02277                                 FCN_XM_AUTO_PAD, 1,
02278                                 FCN_XM_TXCRC, 1,
02279                                 FCN_XM_FCNTL, 1,
02280                                 FCN_XM_IPG, 0x3 );
02281         falcon_xmac_writel ( efab, &reg, FCN_XM_TX_CFG_REG_MAC );
02282 
02283         /* Configure RX */
02284         EFAB_POPULATE_DWORD_4 ( reg,
02285                                 FCN_XM_RXEN, 1,
02286                                 FCN_XM_AUTO_DEPAD, 0,
02287                                 FCN_XM_ACPT_ALL_MCAST, 1,
02288                                 FCN_XM_PASS_CRC_ERR, 1 );
02289         falcon_xmac_writel ( efab, &reg, FCN_XM_RX_CFG_REG_MAC );
02290 
02291         /* Set frame length */
02292         max_frame_len = EFAB_MAX_FRAME_LEN ( ETH_FRAME_LEN );
02293         EFAB_POPULATE_DWORD_1 ( reg,
02294                                 FCN_XM_MAX_RX_FRM_SIZE, max_frame_len );
02295         falcon_xmac_writel ( efab, &reg, FCN_XM_RX_PARAM_REG_MAC );
02296         EFAB_POPULATE_DWORD_2 ( reg,
02297                                 FCN_XM_MAX_TX_FRM_SIZE, max_frame_len,
02298                                 FCN_XM_TX_JUMBO_MODE, 1 );
02299         falcon_xmac_writel ( efab, &reg, FCN_XM_TX_PARAM_REG_MAC );
02300 
02301         /* Enable flow control receipt */
02302         EFAB_POPULATE_DWORD_2 ( reg,
02303                                 FCN_XM_PAUSE_TIME, 0xfffe,
02304                                 FCN_XM_DIS_FCNTL, 0 );
02305         falcon_xmac_writel ( efab, &reg, FCN_XM_FC_REG_MAC );
02306 
02307         /* Set MAC address */
02308         EFAB_POPULATE_DWORD_4 ( reg,
02309                                 FCN_XM_ADR_0, efab->mac_addr[0],
02310                                 FCN_XM_ADR_1, efab->mac_addr[1],
02311                                 FCN_XM_ADR_2, efab->mac_addr[2],
02312                                 FCN_XM_ADR_3, efab->mac_addr[3] );
02313         falcon_xmac_writel ( efab, &reg, FCN_XM_ADR_LO_REG_MAC );
02314         EFAB_POPULATE_DWORD_2 ( reg,
02315                                 FCN_XM_ADR_4, efab->mac_addr[4],
02316                                 FCN_XM_ADR_5, efab->mac_addr[5] );
02317         falcon_xmac_writel ( efab, &reg, FCN_XM_ADR_HI_REG_MAC );
02318 }

static int falcon_init_xmac ( struct efab_nic efab  )  [static]

Now wait for the link to come up. This may take a while for some slower PHY's.

Definition at line 2321 of file etherfabric.c.

References EFAB_ERR, ETIMEDOUT, falcon_mask_status_intr(), falcon_reconfigure_mac_wrapper(), falcon_reconfigure_xmac(), falcon_reset_xaui(), falcon_reset_xmac(), falcon_xaui_link_ok(), falcon_xgmii_status(), efab_phy_operations::init, efab_nic::link_up, mdelay(), mdio_clause45_links_ok(), efab_nic::phy_op, and putchar().

02322 {
02323         int count, rc;
02324 
02325         /* Mask the PHY management interrupt */
02326         falcon_mask_status_intr ( efab, 0 );
02327 
02328         /* Initialise the PHY to instantiate the clock. */
02329         rc = efab->phy_op->init ( efab );
02330         if ( rc ) {
02331                 EFAB_ERR ( "unable to initialise PHY\n" );
02332                 goto fail1;
02333         }
02334 
02335         falcon_reset_xaui ( efab );
02336 
02337         /* Give the PHY and MAC time to faff */
02338         mdelay ( 100 );
02339 
02340         /* Reset and reconfigure the XMAC */
02341         rc = falcon_reset_xmac ( efab );
02342         if ( rc )
02343                 goto fail2;
02344         falcon_reconfigure_xmac ( efab );
02345         falcon_reconfigure_mac_wrapper ( efab );
02346         /**
02347          * Now wait for the link to come up. This may take a while
02348          * for some slower PHY's.
02349          */
02350         for (count=0; count<50; count++) {
02351                 int link_ok = 1;
02352 
02353                 /* Wait a while for the link to come up. */
02354                 mdelay ( 100 );
02355                 if ((count % 5) == 0)
02356                         putchar ( '.' );
02357 
02358                 /* Does the PHY think the wire-side link is up? */
02359                 link_ok = mdio_clause45_links_ok ( efab );
02360                 /* Ensure the XAUI link to the PHY is good */
02361                 if ( link_ok ) {
02362                         link_ok = falcon_xaui_link_ok ( efab );
02363                         if ( !link_ok )
02364                                 falcon_reset_xaui ( efab );
02365                 }
02366 
02367                 /* Check fault indication */
02368                 if ( link_ok )
02369                         link_ok = falcon_xgmii_status ( efab );
02370 
02371                 efab->link_up = link_ok;
02372                 if ( link_ok ) {
02373                         /* unmask the status interrupt */
02374                         falcon_mask_status_intr ( efab, 1 );
02375                         return 0;
02376                 }
02377         }
02378 
02379         /* Link failed to come up, but initialisation was fine. */
02380         rc = -ETIMEDOUT;
02381 
02382 fail2:
02383 fail1:
02384         return rc;
02385 }

static int falcon_xaui_phy_init ( struct efab_nic efab  )  [static]

Definition at line 2400 of file etherfabric.c.

References efab_nic::link_options, and LPA_EF_10000FULL.

02401 {
02402         /* CX4 is always 10000FD only */
02403         efab->link_options = LPA_EF_10000FULL;
02404 
02405         /* There is no PHY! */
02406         return 0;
02407 }

static int alaska_init ( struct efab_nic efab  )  [static]

Initialise Alaska PHY.

Definition at line 2428 of file etherfabric.c.

References EIO, gmii_autoneg_advertised(), gmii_autoneg_lpa(), gmii_link_ok(), gmii_nway_result(), efab_nic::link_options, and efab_nic::link_up.

02429 {
02430         unsigned int advertised, lpa;
02431 
02432         /* Read link up status */
02433         efab->link_up = gmii_link_ok ( efab );
02434 
02435         if ( ! efab->link_up )
02436                 return -EIO;
02437 
02438         /* Determine link options from PHY. */
02439         advertised = gmii_autoneg_advertised ( efab );
02440         lpa = gmii_autoneg_lpa ( efab );
02441         efab->link_options = gmii_nway_result ( advertised & lpa );
02442 
02443         return 0;
02444 }

static int falcon_xfp_phy_init ( struct efab_nic efab  )  [static]

Definition at line 2463 of file etherfabric.c.

References efab_nic::link_options, LPA_EF_10000FULL, mdio_clause45_reset_mmd(), and MDIO_MMD_PHYXS.

02464 {
02465         int rc;
02466 
02467         /* Optical link is always 10000FD only */
02468         efab->link_options = LPA_EF_10000FULL;
02469 
02470         /* Reset the PHY */
02471         rc = mdio_clause45_reset_mmd ( efab, MDIO_MMD_PHYXS );
02472         if ( rc )
02473                 return rc;
02474 
02475         return 0;
02476 }

static int falcon_txc_logic_reset ( struct efab_nic efab  )  [static]

Definition at line 2528 of file etherfabric.c.

References EFAB_ERR, ETIMEDOUT, falcon_mdio_read(), falcon_mdio_write(), MDIO_MMD_PCS, TXC_GLCMD_LMTSWRST_LBN, TXC_GLRGS_GLCMD, and udelay().

Referenced by falcon_txc_phy_init().

02529 {
02530         int val;
02531         int tries = 50;
02532 
02533         val = falcon_mdio_read ( efab, MDIO_MMD_PCS, TXC_GLRGS_GLCMD );
02534         val |= (1 << TXC_GLCMD_LMTSWRST_LBN);
02535         falcon_mdio_write ( efab, MDIO_MMD_PCS, TXC_GLRGS_GLCMD, val );
02536 
02537         while ( tries--) {
02538                 val = falcon_mdio_read ( efab, MDIO_MMD_PCS, TXC_GLRGS_GLCMD );
02539                 if ( ~val & ( 1 << TXC_GLCMD_LMTSWRST_LBN ) )
02540                         return 0;
02541                 udelay(1);
02542         }
02543 
02544         EFAB_ERR ( "logic reset failed\n" );
02545 
02546         return -ETIMEDOUT;
02547 }

static int falcon_txc_phy_init ( struct efab_nic efab  )  [static]

Definition at line 2550 of file etherfabric.c.

References falcon_mdio_write(), falcon_txc_logic_reset(), efab_nic::link_options, LPA_EF_10000FULL, mdio_clause45_check_mmds(), mdio_clause45_reset_mmd(), MDIO_MMD_PHYXS, MDIO_MMD_PMAPMD, TXC_ALRGS_ATXAMP0, TXC_ALRGS_ATXAMP1, TXC_ALRGS_ATXPRE0, TXC_ALRGS_ATXPRE1, TXC_ATXAMP_0820_BOTH, TXC_ATXAMP_DEFAULT, TXC_ATXPRE_DEFAULT, and TXC_ATXPRE_NONE.

02551 {
02552         int rc;
02553 
02554         /* CX4 is always 10000FD only */
02555         efab->link_options = LPA_EF_10000FULL;
02556 
02557         /* reset the phy */
02558         rc = mdio_clause45_reset_mmd ( efab, MDIO_MMD_PMAPMD );
02559         if ( rc )
02560                 goto fail1;
02561 
02562         rc = mdio_clause45_check_mmds ( efab );
02563         if ( rc )
02564                 goto fail2;
02565 
02566         /* Turn amplitude down and preemphasis off on the host side
02567          * (PHY<->MAC) as this is believed less likely to upset falcon
02568          * and no adverse effects have been noted. It probably also 
02569          * saves a picowatt or two */
02570 
02571         /* Turn off preemphasis */
02572         falcon_mdio_write ( efab, MDIO_MMD_PHYXS, TXC_ALRGS_ATXPRE0,
02573                             TXC_ATXPRE_NONE );
02574         falcon_mdio_write ( efab, MDIO_MMD_PHYXS, TXC_ALRGS_ATXPRE1,
02575                             TXC_ATXPRE_NONE );
02576 
02577         /* Turn down the amplitude */
02578         falcon_mdio_write ( efab, MDIO_MMD_PHYXS, TXC_ALRGS_ATXAMP0,
02579                             TXC_ATXAMP_0820_BOTH );
02580         falcon_mdio_write ( efab, MDIO_MMD_PHYXS, TXC_ALRGS_ATXAMP1,
02581                             TXC_ATXAMP_0820_BOTH );
02582 
02583         /* Set the line side amplitude and preemphasis to the databook
02584          * defaults as an erratum causes them to be 0 on at least some
02585          * PHY rev.s */
02586         falcon_mdio_write ( efab, MDIO_MMD_PMAPMD, TXC_ALRGS_ATXPRE0,
02587                             TXC_ATXPRE_DEFAULT );
02588         falcon_mdio_write ( efab, MDIO_MMD_PMAPMD, TXC_ALRGS_ATXPRE1,
02589                             TXC_ATXPRE_DEFAULT );
02590         falcon_mdio_write ( efab, MDIO_MMD_PMAPMD, TXC_ALRGS_ATXAMP0,
02591                             TXC_ATXAMP_DEFAULT );
02592         falcon_mdio_write ( efab, MDIO_MMD_PMAPMD, TXC_ALRGS_ATXAMP1,
02593                             TXC_ATXAMP_DEFAULT );
02594 
02595         rc = falcon_txc_logic_reset ( efab );
02596         if ( rc )
02597                 goto fail3;
02598 
02599         return 0;
02600 
02601 fail3:
02602 fail2:
02603 fail1:
02604         return rc;
02605 }

static int falcon_tenxpress_check_c11 ( struct efab_nic efab  )  [static]

Definition at line 2648 of file etherfabric.c.

References EFAB_ERR, ETIMEDOUT, falcon_mdio_read(), MDIO_MMD_PCS, PCS_BOOT_COMPLETE_LBN, PCS_BOOT_STATUS_REG, and udelay().

Referenced by falcon_tenxpress_phy_init().

02649 {
02650         int count;
02651         uint32_t boot_stat;
02652 
02653         /* Check that the C11 CPU has booted */
02654         for (count=0; count<10; count++) {
02655                 boot_stat = falcon_mdio_read ( efab, MDIO_MMD_PCS,
02656                                                PCS_BOOT_STATUS_REG );
02657                 if ( boot_stat & ( 1 << PCS_BOOT_COMPLETE_LBN ) )
02658                         return 0;
02659 
02660                 udelay(10);
02661         }
02662 
02663         EFAB_ERR ( "C11 failed to boot\n" );
02664         return -ETIMEDOUT;
02665 }

static int falcon_tenxpress_phy_init ( struct efab_nic efab  )  [static]

Definition at line 2668 of file etherfabric.c.

References CLK312_EN_LBN, falcon_mdio_write(), falcon_tenxpress_check_c11(), efab_nic::link_options, LPA_EF_10000FULL, mdelay(), mdio_clause45_check_mmds(), mdio_clause45_wait_reset_mmds(), MDIO_MMD_PCS, and PCS_TEST_SELECT_REG.

02669 {
02670         int rc, reg;
02671 
02672         /* 10XPRESS is always 10000FD (at the moment) */
02673         efab->link_options = LPA_EF_10000FULL;
02674 
02675         /* Wait for the blocks to come out of reset */
02676         rc = mdio_clause45_wait_reset_mmds ( efab );
02677         if ( rc )
02678                 goto fail1;
02679 
02680         rc = mdio_clause45_check_mmds ( efab );
02681         if ( rc )
02682                 goto fail2;
02683 
02684         /* Turn on the clock  */
02685         reg = (1 << CLK312_EN_LBN);
02686         falcon_mdio_write ( efab, MDIO_MMD_PCS, PCS_TEST_SELECT_REG, reg);
02687 
02688         /* Wait 200ms for the PHY to boot */
02689         mdelay(200);
02690 
02691         rc = falcon_tenxpress_check_c11 ( efab );
02692         if ( rc )
02693                 goto fail3;
02694 
02695         return 0;
02696 
02697 fail3:
02698 fail2:
02699 fail1:
02700         return rc;
02701 }

static int falcon_pm8358_phy_init ( struct efab_nic efab  )  [static]

Definition at line 2748 of file etherfabric.c.

References falcon_mdio_read(), falcon_mdio_write(), efab_nic::link_options, LPA_EF_10000FULL, mdio_clause45_reset_mmd(), MDIO_MMD_DTEXS, MDIO_MMDREG_DEVS0_DTEXS, PMC_ANALOG_RX_CFG0, PMC_ANALOG_RX_EQ_FULL, PMC_ANALOG_RX_EQ_MASK, PMC_MASTER_ANLG_CTRL, PMC_MASTER_REG, PMC_MCONF2_REDGE, PMC_MCONF2_REG, and PMC_MCONF2_TEDGE.

02749 {
02750         int rc, reg, i;
02751 
02752         /* This is a XAUI retimer part */
02753         efab->link_options = LPA_EF_10000FULL;
02754 
02755         rc = mdio_clause45_reset_mmd ( efab, MDIO_MMDREG_DEVS0_DTEXS );
02756         if ( rc )
02757                 return rc;
02758         
02759         /* Enable software control of analogue settings */
02760         reg = falcon_mdio_read ( efab, MDIO_MMD_DTEXS,  PMC_MASTER_REG );
02761         reg |= PMC_MASTER_ANLG_CTRL;
02762         falcon_mdio_write ( efab, MDIO_MMD_DTEXS, PMC_MASTER_REG, reg );
02763 
02764         /* Turn rx eq on for all channels */
02765         for (i=0; i< 3; i++) {
02766                 /* The analog CFG registers are evenly spaced 8 apart */
02767                 uint16_t addr = PMC_ANALOG_RX_CFG0 + 8*i;
02768                 reg = falcon_mdio_read ( efab, MDIO_MMD_DTEXS, addr );
02769                 reg = ( reg & ~PMC_ANALOG_RX_EQ_MASK ) | PMC_ANALOG_RX_EQ_FULL;
02770                 falcon_mdio_write ( efab, MDIO_MMD_DTEXS, addr, reg );
02771         }
02772 
02773         /* Set TEDGE, clear REDGE */
02774         reg = falcon_mdio_read ( efab, MDIO_MMD_DTEXS, PMC_MCONF2_REG );
02775         reg = ( reg & ~PMC_MCONF2_REDGE) | PMC_MCONF2_TEDGE;
02776         falcon_mdio_write ( efab, MDIO_MMD_DTEXS, PMC_MCONF2_REG, reg );
02777 
02778         return 0;
02779 }

static int sfe4001_init ( struct efab_nic efab  )  [static]

Definition at line 2847 of file etherfabric.c.

References cfg, EFAB_BYTE, EFAB_ERR, EFAB_LOG, EFAB_POPULATE_DWORD_7, EIO, ETIMEDOUT, falcon_xmac_writel(), FCN_XX_PWR_RST_REG_MAC, i2c_bit_basher::i2c, efab_nic::i2c_bb, MAX_TEMP_THRESH, mdelay(), P0_CONFIG, P0_EN_1V0X_LBN, P0_EN_1V2_LBN, P0_EN_2V5_LBN, P0_EN_3V3X_LBN, P0_EN_5V_LBN, P0_OUT, P0_X_TRST_LBN, P1_AFE_PWD_LBN, P1_CONFIG, P1_IN, P1_SPARE_LBN, i2c_interface::read, RLHN, RSL, udelay(), WLHO, and i2c_interface::write.

02848 {
02849         struct i2c_interface *i2c = &efab->i2c_bb.i2c;
02850         efab_dword_t reg;
02851         uint8_t in, cfg, out;
02852         int count, rc;
02853 
02854         EFAB_LOG ( "Initialise SFE4001 board\n" );
02855 
02856         /* Ensure XGXS and XAUI SerDes are held in reset */
02857         EFAB_POPULATE_DWORD_7 ( reg,
02858                                 FCN_XX_PWRDNA_EN, 1,
02859                                 FCN_XX_PWRDNB_EN, 1,
02860                                 FCN_XX_RSTPLLAB_EN, 1,
02861                                 FCN_XX_RESETA_EN, 1,
02862                                 FCN_XX_RESETB_EN, 1,
02863                                 FCN_XX_RSTXGXSRX_EN, 1,
02864                                 FCN_XX_RSTXGXSTX_EN, 1 );
02865         falcon_xmac_writel ( efab, &reg, FCN_XX_PWR_RST_REG_MAC);
02866         udelay(10);
02867 
02868         /* Set DSP over-temperature alert threshold */
02869         cfg = MAX_TEMP_THRESH;
02870         rc = i2c->write ( i2c, &i2c_max6647, WLHO, &cfg, EFAB_BYTE );
02871         if ( rc )
02872                 goto fail1;
02873 
02874         /* Read it back and verify */
02875         rc = i2c->read ( i2c, &i2c_max6647, RLHN, &in, EFAB_BYTE );
02876         if ( rc )
02877                 goto fail2;
02878 
02879         if ( in != MAX_TEMP_THRESH ) {
02880                 EFAB_ERR ( "Unable to verify MAX6647 limit (requested=%d "
02881                            "confirmed=%d)\n", cfg, in );
02882                 rc = -EIO;
02883                 goto fail3;
02884         }
02885 
02886         /* Clear any previous over-temperature alert */
02887         rc = i2c->read ( i2c, &i2c_max6647, RSL, &in, EFAB_BYTE );
02888         if ( rc )
02889                 goto fail4;
02890 
02891         /* Enable port 0 and 1 outputs on IO expander */
02892         cfg = 0x00;
02893         rc = i2c->write ( i2c, &i2c_pca9539, P0_CONFIG, &cfg, EFAB_BYTE );
02894         if ( rc )
02895                 goto fail5;
02896         cfg = 0xff & ~(1 << P1_SPARE_LBN);
02897         rc = i2c->write ( i2c, &i2c_pca9539, P1_CONFIG, &cfg, EFAB_BYTE );
02898         if ( rc )
02899                 goto fail6;
02900 
02901         /* Turn all power off then wait 1 sec. This ensures PHY is reset */
02902         out = 0xff & ~((0 << P0_EN_1V2_LBN) | (0 << P0_EN_2V5_LBN) |
02903                        (0 << P0_EN_3V3X_LBN) | (0 << P0_EN_5V_LBN) |
02904                        (0 << P0_EN_1V0X_LBN));
02905 
02906         rc = i2c->write ( i2c, &i2c_pca9539, P0_OUT, &out, EFAB_BYTE );
02907         if ( rc )
02908                 goto fail7;
02909 
02910         mdelay(1000);
02911 
02912         for (count=0; count<20; count++) {
02913                 /* Turn on 1.2V, 2.5V, 3.3V and 5V power rails */
02914                 out = 0xff & ~( (1 << P0_EN_1V2_LBN)  | (1 << P0_EN_2V5_LBN) |
02915                                 (1 << P0_EN_3V3X_LBN) | (1 << P0_EN_5V_LBN)  | 
02916                                 (1 << P0_X_TRST_LBN) );
02917 
02918                 rc = i2c->write ( i2c, &i2c_pca9539, P0_OUT, &out, EFAB_BYTE );
02919                 if ( rc )
02920                         goto fail8;
02921 
02922                 mdelay ( 10 );
02923                 
02924                 /* Turn on the 1V power rail */
02925                 out  &= ~( 1 << P0_EN_1V0X_LBN );
02926                 rc = i2c->write ( i2c, &i2c_pca9539, P0_OUT, &out, EFAB_BYTE );
02927                 if ( rc )
02928                         goto fail9;
02929 
02930                 EFAB_LOG ( "Waiting for power...(attempt %d)\n", count);
02931                 mdelay ( 1000 );
02932 
02933                 /* Check DSP is powered */
02934                 rc = i2c->read ( i2c, &i2c_pca9539, P1_IN, &in, EFAB_BYTE );
02935                 if ( rc )
02936                         goto fail10;
02937 
02938                 if ( in & ( 1 << P1_AFE_PWD_LBN ) )
02939                         return 0;
02940         }
02941 
02942         rc = -ETIMEDOUT;
02943 
02944 fail10:
02945 fail9:
02946 fail8:
02947 fail7:
02948         /* Turn off power rails */
02949         out = 0xff;
02950         (void) i2c->write ( i2c, &i2c_pca9539, P0_OUT, &out, EFAB_BYTE );
02951         /* Disable port 1 outputs on IO expander */
02952         out = 0xff;
02953         (void) i2c->write ( i2c, &i2c_pca9539, P1_CONFIG, &out, EFAB_BYTE );
02954 fail6:
02955         /* Disable port 0 outputs */
02956         out = 0xff;
02957         (void) i2c->write ( i2c, &i2c_pca9539, P1_CONFIG, &out, EFAB_BYTE );
02958 fail5:
02959 fail4:
02960 fail3:
02961 fail2:
02962 fail1:
02963         EFAB_ERR ( "Failed initialising SFE4001 board\n" );
02964         return rc;
02965 }

static void sfe4001_fini ( struct efab_nic efab  )  [static]

Definition at line 2968 of file etherfabric.c.

References cfg, EFAB_BYTE, EFAB_ERR, i2c_bit_basher::i2c, efab_nic::i2c_bb, P0_CONFIG, P0_OUT, P1_CONFIG, i2c_interface::read, RSL, and i2c_interface::write.

02969 {
02970         struct i2c_interface *i2c = &efab->i2c_bb.i2c;
02971         uint8_t in, cfg, out;
02972 
02973         EFAB_ERR ( "Turning off SFE4001\n" );
02974 
02975         /* Turn off all power rails */
02976         out = 0xff;
02977         (void) i2c->write ( i2c, &i2c_pca9539, P0_OUT, &out, EFAB_BYTE );
02978 
02979         /* Disable port 1 outputs on IO expander */
02980         cfg = 0xff;
02981         (void) i2c->write ( i2c, &i2c_pca9539, P1_CONFIG, &cfg, EFAB_BYTE );
02982 
02983         /* Disable port 0 outputs on IO expander */
02984         cfg = 0xff;
02985         (void) i2c->write ( i2c, &i2c_pca9539, P0_CONFIG, &cfg, EFAB_BYTE );
02986 
02987         /* Clear any over-temperature alert */
02988         (void) i2c->read ( i2c, &i2c_max6647, RSL, &in, EFAB_BYTE );
02989 }

static int sfe4002_init ( struct efab_nic efab  )  [static]

Definition at line 2996 of file etherfabric.c.

02997 {
02998         return 0;
02999 }

static void sfe4002_fini ( struct efab_nic efab  )  [static]

Definition at line 3000 of file etherfabric.c.

03001 {
03002 }

static int sfe4003_init ( struct efab_nic efab  )  [static]

Definition at line 3009 of file etherfabric.c.

03010 {
03011         return 0;
03012 }

static void sfe4003_fini ( struct efab_nic efab  )  [static]

Definition at line 3013 of file etherfabric.c.

03014 {
03015 }

static void falcon_free_special_buffer ( void *  p  )  [static]

Definition at line 3031 of file etherfabric.c.

References EFAB_BUF_ALIGN, and free_dma().

Referenced by efab_alloc_resources(), and efab_free_resources().

03032 {
03033         /* We don't bother cleaning up the buffer table entries -
03034          * we're hardly limited */
03035         free_dma ( p, EFAB_BUF_ALIGN );
03036 }

static void* falcon_alloc_special_buffer ( struct efab_nic efab,
int  bytes,
struct efab_special_buffer entry 
) [static]

Definition at line 3039 of file etherfabric.c.

References assert, efab_nic::buffer_head, efab_special_buffer::dma_addr, EFAB_BUF_ALIGN, EFAB_POPULATE_QWORD_3, EFAB_TRACE, falcon_write_sram(), FCN_IP_DAT_BUF_SIZE_4K, efab_special_buffer::id, malloc_dma(), NULL, and virt_to_bus().

Referenced by efab_alloc_resources().

03041 {
03042         void* buffer;
03043         int remaining;
03044         efab_qword_t buf_desc;
03045         unsigned long dma_addr;
03046 
03047         /* Allocate the buffer, aligned on a buffer address boundary */
03048         buffer = malloc_dma ( bytes, EFAB_BUF_ALIGN );
03049         if ( ! buffer )
03050                 return NULL;
03051 
03052         /* Push buffer table entries to back the buffer */
03053         entry->id = efab->buffer_head;
03054         entry->dma_addr = dma_addr = virt_to_bus ( buffer );
03055         assert ( ( dma_addr & ( EFAB_BUF_ALIGN - 1 ) ) == 0 );
03056 
03057         remaining = bytes;
03058         while ( remaining > 0 ) {
03059                 EFAB_POPULATE_QWORD_3 ( buf_desc,
03060                                         FCN_IP_DAT_BUF_SIZE, FCN_IP_DAT_BUF_SIZE_4K,
03061                                         FCN_BUF_ADR_FBUF, ( dma_addr >> 12 ),
03062                                         FCN_BUF_OWNER_ID_FBUF, 0 );
03063 
03064                 falcon_write_sram ( efab, &buf_desc, efab->buffer_head );
03065 
03066                 ++efab->buffer_head;
03067                 dma_addr += EFAB_BUF_ALIGN;
03068                 remaining -= EFAB_BUF_ALIGN;
03069         }
03070 
03071         EFAB_TRACE ( "Allocated 0x%x bytes at %p backed by buffer table "
03072                      "entries 0x%x..0x%x\n", bytes, buffer, entry->id,
03073                      efab->buffer_head - 1 );
03074 
03075         return buffer;
03076 }

static void clear_b0_fpga_memories ( struct efab_nic efab  )  [static]

Definition at line 3079 of file etherfabric.c.

References _falcon_writel, EFAB_POPULATE_OWORD_4, EFAB_TRACE, EFAB_ZERO_DWORD, EFAB_ZERO_OWORD, falcon_write(), FCN_ADR_REGION_REG_KER, FCN_RX_FILTER_TBL0, FCN_RX_RSS_INDIR_TBL_B0, offset, and wmb.

Referenced by falcon_reset().

03080 {
03081         efab_oword_t blanko, temp;
03082         efab_dword_t blankd;
03083         int offset; 
03084 
03085         EFAB_ZERO_OWORD ( blanko );
03086         EFAB_ZERO_DWORD ( blankd );
03087 
03088         /* Clear the address region register */
03089         EFAB_POPULATE_OWORD_4 ( temp,
03090                                 FCN_ADR_REGION0, 0,
03091                                 FCN_ADR_REGION1, ( 1 << 16 ),
03092                                 FCN_ADR_REGION2, ( 2 << 16 ),
03093                                 FCN_ADR_REGION3, ( 3 << 16 ) );
03094         falcon_write ( efab, &temp, FCN_ADR_REGION_REG_KER );
03095         
03096         EFAB_TRACE ( "Clearing filter and RSS tables\n" );
03097 
03098         for ( offset = FCN_RX_FILTER_TBL0 ;
03099               offset < FCN_RX_RSS_INDIR_TBL_B0+0x800 ;
03100               offset += 0x10 ) {
03101                 falcon_write ( efab, &blanko, offset );
03102         }
03103 
03104         EFAB_TRACE ( "Wiping buffer tables\n" );
03105 
03106         /* Notice the 8 byte access mode */
03107         for ( offset = 0x2800000 ;
03108               offset < 0x3000000 ;
03109               offset += 0x8) {
03110                 _falcon_writel ( efab, 0, offset );
03111                 _falcon_writel ( efab, 0, offset + 4 );
03112                 wmb();
03113         }
03114 }

static int falcon_reset ( struct efab_nic efab  )  [static]

Definition at line 3117 of file etherfabric.c.

References clear_b0_fpga_memories(), EFAB_ERR, EFAB_OWORD_FIELD, EFAB_POPULATE_OWORD_6, ETIMEDOUT, EXCLUDE_FROM_RESET, falcon_read(), FALCON_REV_B0, falcon_write(), FCN_GLB_CTL_REG_KER, efab_nic::is_asic, mdelay(), and efab_nic::pci_revision.

Referenced by efab_close(), efab_open(), and efab_remove().

03118 {
03119         efab_oword_t glb_ctl_reg_ker;
03120 
03121         /* Initiate software reset */
03122         EFAB_POPULATE_OWORD_6 ( glb_ctl_reg_ker,
03123                                 FCN_PCIE_CORE_RST_CTL, EXCLUDE_FROM_RESET,
03124                                 FCN_PCIE_NSTCK_RST_CTL, EXCLUDE_FROM_RESET,
03125                                 FCN_PCIE_SD_RST_CTL, EXCLUDE_FROM_RESET,
03126                                 FCN_EE_RST_CTL, EXCLUDE_FROM_RESET,
03127                                 FCN_EXT_PHY_RST_DUR, 0x7, /* 10ms */
03128                                 FCN_SWRST, 1 );
03129 
03130         falcon_write ( efab, &glb_ctl_reg_ker, FCN_GLB_CTL_REG_KER );
03131 
03132         /* Allow 50ms for reset */
03133         mdelay ( 50 );
03134 
03135         /* Check for device reset complete */
03136         falcon_read ( efab, &glb_ctl_reg_ker, FCN_GLB_CTL_REG_KER );
03137         if ( EFAB_OWORD_FIELD ( glb_ctl_reg_ker, FCN_SWRST ) != 0 ) {
03138                 EFAB_ERR ( "Reset failed\n" );
03139                 return -ETIMEDOUT;
03140         }
03141 
03142         if ( ( efab->pci_revision == FALCON_REV_B0 ) && !efab->is_asic ) {
03143                 clear_b0_fpga_memories ( efab );
03144         }
03145 
03146         return 0;
03147 }

static void falcon_probe_nic_variant ( struct efab_nic efab,
struct pci_device pci 
) [static]

Definition at line 3181 of file etherfabric.c.

References EFAB_OWORD_FIELD, falcon_read(), FALCON_REV_B0, FCN_ALTERA_BUILD_REG_KER, FCN_NIC_STAT_REG, efab_nic::is_asic, PCI_CLASS_REVISION, pci_read_config_byte(), efab_nic::pci_revision, and efab_nic::phy_10g.

Referenced by efab_probe().

03182 {
03183         efab_oword_t altera_build, nic_stat;
03184         int is_pcie, fpga_version;
03185         uint8_t revision;
03186 
03187         /* PCI revision */
03188         pci_read_config_byte ( pci, PCI_CLASS_REVISION, &revision );
03189         efab->pci_revision = revision;
03190 
03191         /* Asic vs FPGA */
03192         falcon_read ( efab, &altera_build, FCN_ALTERA_BUILD_REG_KER );
03193         fpga_version = EFAB_OWORD_FIELD ( altera_build, FCN_VER_ALL );
03194         efab->is_asic = (fpga_version == 0);
03195 
03196         /* MAC and PCI type */
03197         falcon_read ( efab, &nic_stat, FCN_NIC_STAT_REG );
03198         if ( efab->pci_revision == FALCON_REV_B0 ) {
03199                 is_pcie = 1;
03200                 efab->phy_10g = EFAB_OWORD_FIELD ( nic_stat, FCN_STRAP_10G );
03201         }
03202         else if ( efab->is_asic ) {
03203                 is_pcie = EFAB_OWORD_FIELD ( nic_stat, FCN_STRAP_PCIE );
03204                 efab->phy_10g = EFAB_OWORD_FIELD ( nic_stat, FCN_STRAP_10G );
03205         }
03206         else {
03207                 int minor = EFAB_OWORD_FIELD ( altera_build,  FCN_VER_MINOR );
03208                 is_pcie = 0;
03209                 efab->phy_10g = ( minor == 0x14 );
03210         }
03211 }

static void falcon_init_spi_device ( struct efab_nic efab,
struct spi_device spi 
) [static]

Definition at line 3214 of file etherfabric.c.

References nvs_device::block_size, spi_device::bus, FALCON_SPI_MAX_LEN, spi_device::nvs, efab_nic::spi, and efab_nic::spi_bus.

Referenced by falcon_probe_spi().

03215 {
03216         /* Falcon's SPI interface only supports reads/writes of up to 16 bytes.
03217          * Reduce the nvs block size down to satisfy this - which means callers
03218          * should use the nvs_* functions rather than spi_*. */
03219         if ( spi->nvs.block_size > FALCON_SPI_MAX_LEN )
03220                 spi->nvs.block_size = FALCON_SPI_MAX_LEN;
03221 
03222         spi->bus = &efab->spi_bus;
03223         efab->spi = spi;
03224 }

static int falcon_probe_spi ( struct efab_nic efab  )  [static]

Definition at line 3227 of file etherfabric.c.

References EFAB_ERR, EFAB_LOG, EFAB_OWORD_FIELD, EIO, falcon_init_spi_device(), falcon_read(), FALCON_REV_B0, falcon_spi_rw(), FCN_EE_VPD_CFG_REG, FCN_GPIO_CTL_REG_KER, FCN_NIC_STAT_REG, efab_nic::i2c_bb, init_i2c_bit_basher(), efab_nic::is_asic, efab_nic::netdev, efab_nic::nvo, nvo_init(), spi_device::nvs, efab_nic::pci_revision, net_device::refcnt, spi_bus::rw, efab_nic::spi, efab_nic::spi_bus, efab_nic::spi_eeprom, and efab_nic::spi_flash.

Referenced by efab_probe().

03228 {
03229         efab_oword_t nic_stat, gpio_ctl, ee_vpd_cfg;
03230         int has_flash, has_eeprom, ad9bit;
03231 
03232         falcon_read ( efab, &nic_stat, FCN_NIC_STAT_REG );
03233         falcon_read ( efab, &gpio_ctl, FCN_GPIO_CTL_REG_KER );
03234         falcon_read ( efab, &ee_vpd_cfg, FCN_EE_VPD_CFG_REG );
03235 
03236         /* determine if FLASH / EEPROM is present */
03237         if ( ( efab->pci_revision >= FALCON_REV_B0 ) || efab->is_asic ) {
03238                 has_flash = EFAB_OWORD_FIELD ( nic_stat, FCN_SF_PRST );
03239                 has_eeprom = EFAB_OWORD_FIELD ( nic_stat, FCN_EE_PRST );
03240         } else {
03241                 has_flash = EFAB_OWORD_FIELD ( gpio_ctl, FCN_FLASH_PRESENT );
03242                 has_eeprom = EFAB_OWORD_FIELD ( gpio_ctl, FCN_EEPROM_PRESENT );
03243         }
03244         ad9bit = EFAB_OWORD_FIELD ( ee_vpd_cfg, FCN_EE_VPD_EN_AD9_MODE );
03245 
03246         /* Configure the SPI and I2C bus */
03247         efab->spi_bus.rw = falcon_spi_rw;
03248         init_i2c_bit_basher ( &efab->i2c_bb, &falcon_i2c_bit_ops );
03249 
03250         /* Configure the EEPROM SPI device. Generally, an Atmel 25040
03251          * (or similar) is used, but this is only possible if there is also
03252          * a flash device present to store the boot-time chip configuration.
03253          */
03254         if ( has_eeprom ) {
03255                 if ( has_flash && ad9bit )
03256                         init_at25040 ( &efab->spi_eeprom );
03257                 else
03258                         init_mc25xx640 ( &efab->spi_eeprom );
03259                 falcon_init_spi_device ( efab, &efab->spi_eeprom );
03260         }
03261 
03262         /* Configure the FLASH SPI device */
03263         if ( has_flash ) {
03264                 init_at25f1024 ( &efab->spi_flash );
03265                 falcon_init_spi_device ( efab, &efab->spi_flash );
03266         }
03267 
03268         EFAB_LOG ( "flash is %s, EEPROM is %s%s\n",
03269                    ( has_flash ? "present" : "absent" ),
03270                    ( has_eeprom ? "present " : "absent" ),
03271                    ( has_eeprom ? (ad9bit ? "(9bit)" : "(16bit)") : "") );
03272 
03273         /* The device MUST have flash or eeprom */
03274         if ( ! efab->spi ) {
03275                 EFAB_ERR ( "Device appears to have no flash or eeprom\n" );
03276                 return -EIO;
03277         }
03278 
03279         /* If the device has EEPROM attached, then advertise NVO space */
03280         if ( has_eeprom )
03281                 nvo_init ( &efab->nvo, &efab->spi_eeprom.nvs, falcon_nvo_fragments,
03282                            &efab->netdev->refcnt );
03283 
03284         return 0;
03285 }

static int falcon_probe_nvram ( struct efab_nic efab  )  [static]

Definition at line 3288 of file etherfabric.c.

References efab_nic::board_op, falcon_nv_config_ver2::board_revision, BOARD_TYPE, efab_nic::board_type, EFAB_BOARD_SFE4001, EFAB_BOARD_SFE4002, EFAB_BOARD_SFE4003, EFAB_ERR, EFAB_TRACE, EINVAL, ETH_ALEN, FALCON_MAC_ADDRESS_OFFSET, FCN_NV_MAGIC_NUMBER, le16_to_cpu, efab_nic::mac_addr, efab_nic::mac_op, falcon_nv_extra::magicnumber, spi_device::nvs, nvs_read(), efab_nic::phy_10g, efab_nic::phy_addr, efab_nic::phy_op, efab_nic::phy_type, PHY_TYPE_10XPRESS, PHY_TYPE_1GIG_ALASKA, PHY_TYPE_CX4, PHY_TYPE_CX4_RTMR, PHY_TYPE_PM8358, PHY_TYPE_XFP, falcon_nv_config_ver2::port0_phy_addr, falcon_nv_config_ver2::port0_phy_type, SF_NV_CONFIG_BASE, SF_NV_CONFIG_EXTRA, efab_nic::spi, falcon_nv_extra::structure_version, falcon_nv_extra::ver2, and falcon_nv_extra::ver_specific.

Referenced by efab_probe().

03289 {
03290         struct nvs_device *nvs = &efab->spi->nvs;
03291         struct falcon_nv_extra nv;
03292         int rc, board_revision;
03293 
03294         /* Read the MAC address */
03295         rc = nvs_read ( nvs, FALCON_MAC_ADDRESS_OFFSET,
03296                         efab->mac_addr, ETH_ALEN );
03297         if ( rc )
03298                 return rc;
03299 
03300         /* Poke through the NVRAM structure for the PHY type. */
03301         rc = nvs_read ( nvs, SF_NV_CONFIG_BASE + SF_NV_CONFIG_EXTRA,
03302                         &nv, sizeof ( nv ) );
03303         if ( rc )
03304                 return rc;
03305 
03306         /* Handle each supported NVRAM version */
03307         if ( ( le16_to_cpu ( nv.magicnumber ) == FCN_NV_MAGIC_NUMBER ) &&
03308              ( le16_to_cpu ( nv.structure_version ) >= 2 ) ) {
03309                 struct falcon_nv_config_ver2* ver2 = &nv.ver_specific.ver2;
03310                 
03311                 /* Get the PHY type */
03312                 efab->phy_addr = le16_to_cpu ( ver2->port0_phy_addr );
03313                 efab->phy_type = le16_to_cpu ( ver2->port0_phy_type );
03314                 board_revision = le16_to_cpu ( ver2->board_revision );
03315         }
03316         else {
03317                 EFAB_ERR ( "NVram is not recognised\n" );
03318                 return -EINVAL;
03319         }
03320 
03321         efab->board_type = BOARD_TYPE ( board_revision );
03322         
03323         EFAB_TRACE ( "Falcon board %d phy %d @ addr %d\n",
03324                      efab->board_type, efab->phy_type, efab->phy_addr );
03325 
03326         /* Patch in the board operations */
03327         switch ( efab->board_type ) {
03328         case EFAB_BOARD_SFE4001:
03329                 efab->board_op = &sfe4001_ops;
03330                 break;
03331         case EFAB_BOARD_SFE4002:
03332                 efab->board_op = &sfe4002_ops;
03333                 break;
03334         case EFAB_BOARD_SFE4003:
03335                 efab->board_op = &sfe4003_ops;
03336                 break;
03337         default:
03338                 EFAB_ERR ( "Unrecognised board type\n" );
03339                 return -EINVAL;
03340         }
03341 
03342         /* Patch in MAC operations */
03343         if ( efab->phy_10g )
03344                 efab->mac_op = &falcon_xmac_operations;
03345         else
03346                 efab->mac_op = &falcon_gmac_operations;
03347 
03348         /* Hook in the PHY ops */
03349         switch ( efab->phy_type ) {
03350         case PHY_TYPE_10XPRESS:
03351                 efab->phy_op = &falcon_tenxpress_phy_ops;
03352                 break;
03353         case PHY_TYPE_CX4:
03354                 efab->phy_op = &falcon_xaui_phy_ops;
03355                 break;
03356         case PHY_TYPE_XFP:
03357                 efab->phy_op = &falcon_xfp_phy_ops;
03358                 break;
03359         case PHY_TYPE_CX4_RTMR:
03360                 efab->phy_op = &falcon_txc_phy_ops;
03361                 break;
03362         case PHY_TYPE_PM8358:
03363                 efab->phy_op = &falcon_pm8358_phy_ops;
03364                 break;
03365         case PHY_TYPE_1GIG_ALASKA:
03366                 efab->phy_op = &falcon_alaska_phy_ops;
03367                 break;
03368         default:
03369                 EFAB_ERR ( "Unknown PHY type: %d\n", efab->phy_type );
03370                 return -EINVAL;
03371         }
03372 
03373         return 0;
03374 }

static int falcon_init_sram ( struct efab_nic efab  )  [static]

Definition at line 3377 of file etherfabric.c.

References EFAB_ERR, EFAB_OWORD_FIELD, EFAB_POPULATE_OWORD_2, EFAB_SET_OWORD_FIELD, ETIMEDOUT, falcon_read(), falcon_write(), FCN_GPIO_CTL_REG_KER, FCN_NIC_STAT_REG, FCN_SRM_CFG_REG_KER, and mdelay().

Referenced by efab_open().

03378 {
03379         efab_oword_t reg;
03380         int count;
03381 
03382         /* use card in internal SRAM mode */
03383         falcon_read ( efab, &reg, FCN_NIC_STAT_REG );
03384         EFAB_SET_OWORD_FIELD ( reg, FCN_ONCHIP_SRAM, 1 );
03385         falcon_write ( efab, &reg, FCN_NIC_STAT_REG );
03386 
03387         /* Deactivate any external SRAM that might be present */
03388         EFAB_POPULATE_OWORD_2 ( reg, 
03389                                 FCN_GPIO1_OEN, 1,
03390                                 FCN_GPIO1_OUT, 1 );
03391         falcon_write ( efab, &reg, FCN_GPIO_CTL_REG_KER );
03392 
03393         /* Initiate SRAM reset */
03394         EFAB_POPULATE_OWORD_2 ( reg,
03395                                 FCN_SRAM_OOB_BT_INIT_EN, 1,
03396                                 FCN_SRM_NUM_BANKS_AND_BANK_SIZE, 0 );
03397         falcon_write ( efab, &reg, FCN_SRM_CFG_REG_KER );
03398 
03399         /* Wait for SRAM reset to complete */
03400         count = 0;
03401         do {
03402                 /* SRAM reset is slow; expect around 16ms */
03403                 mdelay ( 20 );
03404 
03405                 /* Check for reset complete */
03406                 falcon_read ( efab, &reg, FCN_SRM_CFG_REG_KER );
03407                 if ( !EFAB_OWORD_FIELD ( reg, FCN_SRAM_OOB_BT_INIT_EN ) )
03408                         return 0;
03409         } while (++count < 20); /* wait upto 0.4 sec */
03410 
03411         EFAB_ERR ( "timed out waiting for SRAM reset\n");
03412         return -ETIMEDOUT;
03413 }

static void falcon_setup_nic ( struct efab_nic efab  )  [static]

Definition at line 3416 of file etherfabric.c.

References EFAB_POPULATE_DWORD_2, EFAB_POPULATE_OWORD_1, EFAB_POPULATE_OWORD_5, EFAB_SET_OWORD_FIELD, EFAB_SET_OWORD_FIELD_VER, falcon_read(), FALCON_REV_B0, falcon_write(), falcon_writel(), FCN_RX_CFG_REG_KER, FCN_RX_DC_CFG_REG_KER, FCN_RX_FILTER_CTL_REG_KER, FCN_RX_SELF_RST_REG_KER, FCN_SPARE_REG_KER, FCN_SRM_RX_DC_CFG_REG_KER, FCN_SRM_TX_DC_CFG_REG_KER, FCN_TIMER_CMD_REG_KER, FCN_TIMER_MODE_DIS, FCN_TX_CFG2_REG_KER, FCN_TX_DC_CFG_REG_KER, efab_nic::pci_revision, efab_nic::phy_10g, and udelay().

Referenced by efab_open().

03417 {
03418         efab_dword_t timer_cmd;
03419         efab_oword_t reg;
03420         int tx_fc, xoff_thresh, xon_thresh;
03421 
03422         /* bug5129: Clear the parity enables on the TX data fifos as 
03423          * they produce false parity errors because of timing issues 
03424          */
03425         falcon_read ( efab, &reg, FCN_SPARE_REG_KER );
03426         EFAB_SET_OWORD_FIELD ( reg, FCN_MEM_PERR_EN_TX_DATA, 0 );
03427         falcon_write ( efab, &reg, FCN_SPARE_REG_KER );
03428         
03429         /* Set up TX and RX descriptor caches in SRAM */
03430         EFAB_POPULATE_OWORD_1 ( reg, FCN_SRM_TX_DC_BASE_ADR, 0x130000 );
03431         falcon_write ( efab, &reg, FCN_SRM_TX_DC_CFG_REG_KER );
03432         EFAB_POPULATE_OWORD_1 ( reg, FCN_TX_DC_SIZE, 1 /* 16 descriptors */ );
03433         falcon_write ( efab, &reg, FCN_TX_DC_CFG_REG_KER );
03434         EFAB_POPULATE_OWORD_1 ( reg, FCN_SRM_RX_DC_BASE_ADR, 0x100000 );
03435         falcon_write ( efab, &reg, FCN_SRM_RX_DC_CFG_REG_KER );
03436         EFAB_POPULATE_OWORD_1 ( reg, FCN_RX_DC_SIZE, 2 /* 32 descriptors */ );
03437         falcon_write ( efab, &reg, FCN_RX_DC_CFG_REG_KER );
03438         
03439         /* Set number of RSS CPUs
03440          * bug7244: Increase filter depth to reduce RX_RESET likelyhood
03441          */
03442         EFAB_POPULATE_OWORD_5 ( reg,
03443                                 FCN_NUM_KER, 0,
03444                                 FCN_UDP_FULL_SRCH_LIMIT, 8,
03445                                 FCN_UDP_WILD_SRCH_LIMIT, 8,
03446                                 FCN_TCP_WILD_SRCH_LIMIT, 8,
03447                                 FCN_TCP_FULL_SRCH_LIMIT, 8);
03448         falcon_write ( efab, &reg, FCN_RX_FILTER_CTL_REG_KER );
03449         udelay ( 1000 );
03450 
03451         /* Setup RX.  Wait for descriptor is broken and must
03452          * be disabled.  RXDP recovery shouldn't be needed, but is.
03453          * disable ISCSI parsing because we don't need it
03454          */
03455         falcon_read ( efab, &reg, FCN_RX_SELF_RST_REG_KER );
03456         EFAB_SET_OWORD_FIELD ( reg, FCN_RX_NODESC_WAIT_DIS, 1 );
03457         EFAB_SET_OWORD_FIELD ( reg, FCN_RX_RECOVERY_EN, 1 );
03458         EFAB_SET_OWORD_FIELD ( reg, FCN_RX_ISCSI_DIS, 1 );
03459         falcon_write ( efab, &reg, FCN_RX_SELF_RST_REG_KER );
03460         
03461         /* Determine recommended flow control settings. *
03462          * Flow control is qualified on B0 and A1/1G, not on A1/10G */
03463         if ( efab->pci_revision == FALCON_REV_B0 ) {
03464                 tx_fc = 1;
03465                 xoff_thresh = 54272;  /* ~80Kb - 3*max MTU */
03466                 xon_thresh = 27648; /* ~3*max MTU */
03467         }
03468         else if ( !efab->phy_10g ) {
03469                 tx_fc = 1;
03470                 xoff_thresh = 2048;
03471                 xon_thresh = 512;
03472         }
03473         else {
03474                 tx_fc = xoff_thresh = xon_thresh = 0;
03475         }
03476 
03477         /* Setup TX and RX */
03478         falcon_read ( efab, &reg, FCN_TX_CFG2_REG_KER );
03479         EFAB_SET_OWORD_FIELD ( reg, FCN_TX_DIS_NON_IP_EV, 1 );
03480         falcon_write ( efab, &reg, FCN_TX_CFG2_REG_KER );
03481 
03482         falcon_read ( efab, &reg, FCN_RX_CFG_REG_KER );
03483         EFAB_SET_OWORD_FIELD_VER ( efab, reg, FCN_RX_USR_BUF_SIZE,
03484                                    (3*4096) / 32 );
03485         if ( efab->pci_revision == FALCON_REV_B0)
03486                 EFAB_SET_OWORD_FIELD ( reg, FCN_RX_INGR_EN_B0, 1 );
03487         EFAB_SET_OWORD_FIELD_VER ( efab, reg, FCN_RX_XON_MAC_TH,
03488                                    xon_thresh / 256);
03489         EFAB_SET_OWORD_FIELD_VER ( efab, reg, FCN_RX_XOFF_MAC_TH,
03490                                    xoff_thresh / 256);
03491         EFAB_SET_OWORD_FIELD_VER ( efab, reg, FCN_RX_XOFF_MAC_EN, tx_fc);
03492         falcon_write ( efab, &reg, FCN_RX_CFG_REG_KER );
03493 
03494         /* Set timer register */
03495         EFAB_POPULATE_DWORD_2 ( timer_cmd,
03496                                 FCN_TIMER_MODE, FCN_TIMER_MODE_DIS,
03497                                 FCN_TIMER_VAL, 0 );
03498         falcon_writel ( efab, &timer_cmd, FCN_TIMER_CMD_REG_KER );
03499 }

static void falcon_init_resources ( struct efab_nic efab  )  [static]

Definition at line 3502 of file etherfabric.c.

References EFAB_EVQ_SIZE, EFAB_POPULATE_OWORD_1, EFAB_POPULATE_OWORD_3, EFAB_POPULATE_OWORD_8, EFAB_RXD_SIZE, EFAB_TXD_SIZE, efab_rx_queue::entry, efab_tx_queue::entry, efab_ev_queue::entry, efab_nic::ev_queue, falcon_eventq_read_ack(), FALCON_REV_B0, falcon_write(), FCN_INT_ADR_REG_KER, FCN_REVISION_REG, FQS, efab_special_buffer::id, efab_nic::int_ker, efab_nic::pci_revision, efab_ev_queue::read_ptr, efab_rx_queue::read_ptr, efab_tx_queue::read_ptr, efab_nic::rx_queue, efab_nic::tx_queue, virt_to_bus(), efab_rx_queue::write_ptr, and efab_tx_queue::write_ptr.

Referenced by efab_open().

03503 {
03504         struct efab_ev_queue *ev_queue = &efab->ev_queue;
03505         struct efab_rx_queue *rx_queue = &efab->rx_queue;
03506         struct efab_tx_queue *tx_queue = &efab->tx_queue;
03507 
03508         efab_oword_t reg;
03509         int jumbo;
03510 
03511         /* Initialise the ptrs */
03512         tx_queue->read_ptr = tx_queue->write_ptr = 0;
03513         rx_queue->read_ptr = rx_queue->write_ptr = 0;
03514         ev_queue->read_ptr = 0;
03515 
03516         /* Push the event queue to the hardware */
03517         EFAB_POPULATE_OWORD_3 ( reg,
03518                                 FCN_EVQ_EN, 1,
03519                                 FCN_EVQ_SIZE, FQS(FCN_EVQ, EFAB_EVQ_SIZE),
03520                                 FCN_EVQ_BUF_BASE_ID, ev_queue->entry.id );
03521         falcon_write ( efab, &reg, 
03522                        FCN_REVISION_REG ( efab, FCN_EVQ_PTR_TBL_KER ) );
03523         
03524         /* Push the tx queue to the hardware */
03525         EFAB_POPULATE_OWORD_8 ( reg,
03526                                 FCN_TX_DESCQ_EN, 1,
03527                                 FCN_TX_ISCSI_DDIG_EN, 0,
03528                                 FCN_TX_ISCSI_DDIG_EN, 0,
03529                                 FCN_TX_DESCQ_BUF_BASE_ID, tx_queue->entry.id,
03530                                 FCN_TX_DESCQ_EVQ_ID, 0,
03531                                 FCN_TX_DESCQ_SIZE, FQS(FCN_TX_DESCQ, EFAB_TXD_SIZE),
03532                                 FCN_TX_DESCQ_TYPE, 0 /* kernel queue */,
03533                                 FCN_TX_NON_IP_DROP_DIS_B0, 1 );
03534         falcon_write ( efab, &reg, 
03535                        FCN_REVISION_REG ( efab, FCN_TX_DESC_PTR_TBL_KER ) );
03536         
03537         /* Push the rx queue to the hardware */
03538         jumbo = ( efab->pci_revision == FALCON_REV_B0 ) ? 0 : 1;
03539         EFAB_POPULATE_OWORD_8 ( reg,
03540                                 FCN_RX_ISCSI_DDIG_EN, 0,
03541                                 FCN_RX_ISCSI_HDIG_EN, 0,
03542                                 FCN_RX_DESCQ_BUF_BASE_ID, rx_queue->entry.id,
03543                                 FCN_RX_DESCQ_EVQ_ID, 0,
03544                                 FCN_RX_DESCQ_SIZE, FQS(FCN_RX_DESCQ, EFAB_RXD_SIZE),
03545                                 FCN_RX_DESCQ_TYPE, 0 /* kernel queue */,
03546                                 FCN_RX_DESCQ_JUMBO, jumbo,
03547                                 FCN_RX_DESCQ_EN, 1 );
03548         falcon_write ( efab, &reg,
03549                        FCN_REVISION_REG ( efab, FCN_RX_DESC_PTR_TBL_KER ) );
03550 
03551         /* Program INT_ADR_REG_KER */
03552         EFAB_POPULATE_OWORD_1 ( reg,
03553                                 FCN_INT_ADR_KER, virt_to_bus ( &efab->int_ker ) );
03554         falcon_write ( efab, &reg, FCN_INT_ADR_REG_KER );
03555 
03556         /* Ack the event queue */
03557         falcon_eventq_read_ack ( efab, ev_queue );
03558 }

static void falcon_fini_resources ( struct efab_nic efab  )  [static]

Definition at line 3561 of file etherfabric.c.

References EFAB_POPULATE_OWORD_2, EFAB_ZERO_OWORD, falcon_interrupts(), falcon_write(), FCN_REVISION_REG, and mdelay().

Referenced by efab_close().

03562 {
03563         efab_oword_t cmd;
03564         
03565         /* Disable interrupts */
03566         falcon_interrupts ( efab, 0, 0 );
03567 
03568         /* Flush the dma queues */
03569         EFAB_POPULATE_OWORD_2 ( cmd,
03570                                 FCN_TX_FLUSH_DESCQ_CMD, 1,
03571                                 FCN_TX_FLUSH_DESCQ, 0 );
03572         falcon_write ( efab, &cmd, 
03573                        FCN_REVISION_REG ( efab, FCN_TX_DESC_PTR_TBL_KER ) );
03574 
03575         EFAB_POPULATE_OWORD_2 ( cmd,
03576                                 FCN_RX_FLUSH_DESCQ_CMD, 1,
03577                                 FCN_RX_FLUSH_DESCQ, 0 );
03578         falcon_write ( efab, &cmd,
03579                        FCN_REVISION_REG ( efab, FCN_RX_DESC_PTR_TBL_KER ) );
03580 
03581         mdelay ( 100 );
03582 
03583         /* Remove descriptor rings from card */
03584         EFAB_ZERO_OWORD ( cmd );
03585         falcon_write ( efab, &cmd, 
03586                        FCN_REVISION_REG ( efab, FCN_TX_DESC_PTR_TBL_KER ) );
03587         falcon_write ( efab, &cmd, 
03588                        FCN_REVISION_REG ( efab, FCN_RX_DESC_PTR_TBL_KER ) );
03589         falcon_write ( efab, &cmd, 
03590                        FCN_REVISION_REG ( efab, FCN_EVQ_PTR_TBL_KER ) );
03591 }

static void falcon_build_rx_desc ( falcon_rx_desc_t rxd,
struct io_buffer iob 
) [static]

Definition at line 3602 of file etherfabric.c.

References io_buffer::data, EFAB_POPULATE_QWORD_2, EFAB_RX_BUF_SIZE, and virt_to_bus().

Referenced by efab_fill_rx_queue().

03603 {
03604         EFAB_POPULATE_QWORD_2 ( *rxd,
03605                                 FCN_RX_KER_BUF_SIZE, EFAB_RX_BUF_SIZE,
03606                                 FCN_RX_KER_BUF_ADR, virt_to_bus ( iob->data ) );
03607 }

static void falcon_notify_rx_desc ( struct efab_nic efab,
struct efab_rx_queue rx_queue 
) [static]

Definition at line 3610 of file etherfabric.c.

References EFAB_POPULATE_DWORD_1, EFAB_RXD_SIZE, falcon_writel(), FCN_RX_DESC_UPD_REG_KER_DWORD, and efab_rx_queue::write_ptr.

Referenced by efab_fill_rx_queue().

03611 {
03612         efab_dword_t reg;
03613         int ptr = rx_queue->write_ptr % EFAB_RXD_SIZE;
03614 
03615         EFAB_POPULATE_DWORD_1 ( reg, FCN_RX_DESC_WPTR_DWORD, ptr );
03616         falcon_writel ( efab, &reg, FCN_RX_DESC_UPD_REG_KER_DWORD );
03617 }

static void falcon_build_tx_desc ( falcon_tx_desc_t txd,
struct io_buffer iob 
) [static]

Definition at line 3629 of file etherfabric.c.

References io_buffer::data, EFAB_POPULATE_QWORD_2, iob_len(), and virt_to_bus().

Referenced by efab_transmit().

03630 {
03631         EFAB_POPULATE_QWORD_2 ( *txd,
03632                                 FCN_TX_KER_BYTE_CNT, iob_len ( iob ),
03633                                 FCN_TX_KER_BUF_ADR, virt_to_bus ( iob->data ) );
03634 }

static void falcon_notify_tx_desc ( struct efab_nic efab,
struct efab_tx_queue tx_queue 
) [static]

Definition at line 3637 of file etherfabric.c.

References EFAB_POPULATE_DWORD_1, EFAB_TXD_SIZE, falcon_writel(), FCN_TX_DESC_UPD_REG_KER_DWORD, and efab_tx_queue::write_ptr.

Referenced by efab_transmit().

03639 {
03640         efab_dword_t reg;
03641         int ptr = tx_queue->write_ptr % EFAB_TXD_SIZE;
03642 
03643         EFAB_POPULATE_DWORD_1 ( reg, FCN_TX_DESC_WPTR_DWORD, ptr );
03644         falcon_writel ( efab, &reg, FCN_TX_DESC_UPD_REG_KER_DWORD );
03645 }

static int efab_fill_rx_queue ( struct efab_nic efab,
struct efab_rx_queue rx_queue 
) [static]

Definition at line 3657 of file etherfabric.c.

References alloc_iob(), assert, efab_rx_queue::buf, io_buffer::data, EFAB_NUM_RX_DESC, EFAB_RX_BUF_SIZE, EFAB_RXD_SIZE, EFAB_TRACE, ENOMEM, falcon_build_rx_desc(), falcon_notify_rx_desc(), NULL, efab_rx_queue::read_ptr, efab_rx_queue::ring, rxd, and efab_rx_queue::write_ptr.

Referenced by efab_open(), and efab_poll().

03659 {
03660         int fill_level = rx_queue->write_ptr - rx_queue->read_ptr;
03661         int space = EFAB_NUM_RX_DESC - fill_level - 1;
03662         int pushed = 0;
03663 
03664         while ( space ) {
03665                 int buf_id = rx_queue->write_ptr % EFAB_NUM_RX_DESC;
03666                 int desc_id = rx_queue->write_ptr % EFAB_RXD_SIZE;
03667                 struct io_buffer *iob;
03668                 falcon_rx_desc_t *rxd;
03669 
03670                 assert ( rx_queue->buf[buf_id] == NULL );
03671                 iob = alloc_iob ( EFAB_RX_BUF_SIZE );
03672                 if ( !iob )
03673                         break;
03674 
03675                 EFAB_TRACE ( "pushing rx_buf[%d] iob %p data %p\n",
03676                              buf_id, iob, iob->data );
03677 
03678                 rx_queue->buf[buf_id] = iob;
03679                 rxd = rx_queue->ring + desc_id;
03680                 falcon_build_rx_desc ( rxd, iob );
03681                 ++rx_queue->write_ptr;
03682                 ++pushed;
03683                 --space;
03684         }
03685 
03686         if ( pushed ) {
03687                 /* Push the ptr to hardware */
03688                 falcon_notify_rx_desc ( efab, rx_queue );
03689 
03690                 fill_level = rx_queue->write_ptr - rx_queue->read_ptr;
03691                 EFAB_TRACE ( "pushed %d rx buffers to fill level %d\n",
03692                              pushed, fill_level );
03693         }
03694 
03695         if ( fill_level == 0 )
03696                 return -ENOMEM;
03697         return 0;
03698 }

static void efab_receive ( struct efab_nic efab,
unsigned int  id,
int  len,
int  drop 
) [static]

Definition at line 3701 of file etherfabric.c.

References assert, efab_rx_queue::buf, io_buffer::data, EFAB_NUM_RX_DESC, EFAB_RXD_SIZE, EFAB_TRACE, free_iob(), iob_put, efab_nic::netdev, netdev_rx(), NULL, efab_rx_queue::read_ptr, and efab_nic::rx_queue.

Referenced by falcon_handle_event().

03702 {
03703         struct efab_rx_queue *rx_queue = &efab->rx_queue;
03704         struct io_buffer *iob;
03705         unsigned int read_ptr = rx_queue->read_ptr % EFAB_RXD_SIZE;
03706         unsigned int buf_ptr = rx_queue->read_ptr % EFAB_NUM_RX_DESC;
03707 
03708         assert ( id == read_ptr );
03709         
03710         /* Pop this rx buffer out of the software ring */
03711         iob = rx_queue->buf[buf_ptr];
03712         rx_queue->buf[buf_ptr] = NULL;
03713 
03714         EFAB_TRACE ( "popping rx_buf[%d] iob %p data %p with %d bytes %s\n",
03715                      id, iob, iob->data, len, drop ? "bad" : "ok" );
03716 
03717         /* Pass the packet up if required */
03718         if ( drop )
03719                 free_iob ( iob );
03720         else {
03721                 iob_put ( iob, len );
03722                 netdev_rx ( efab->netdev, iob );
03723         }
03724 
03725         ++rx_queue->read_ptr;
03726 }

static int efab_transmit ( struct net_device netdev,
struct io_buffer iob 
) [static]

Definition at line 3737 of file etherfabric.c.

References assert, efab_tx_queue::buf, io_buffer::data, EFAB_TRACE, EFAB_TXD_SIZE, ENOBUFS, falcon_build_tx_desc(), falcon_notify_tx_desc(), iob_len(), netdev_priv(), NULL, efab_tx_queue::read_ptr, efab_tx_queue::ring, efab_nic::tx_queue, txd, and efab_tx_queue::write_ptr.

03738 {
03739         struct efab_nic *efab = netdev_priv ( netdev );
03740         struct efab_tx_queue *tx_queue = &efab->tx_queue;
03741         int fill_level, space;
03742         falcon_tx_desc_t *txd;
03743         int buf_id;
03744 
03745         fill_level = tx_queue->write_ptr - tx_queue->read_ptr;
03746         space = EFAB_TXD_SIZE - fill_level - 1;
03747         if ( space < 1 )
03748                 return -ENOBUFS;
03749 
03750         /* Save the iobuffer for later completion */
03751         buf_id = tx_queue->write_ptr % EFAB_TXD_SIZE;
03752         assert ( tx_queue->buf[buf_id] == NULL );
03753         tx_queue->buf[buf_id] = iob;
03754 
03755         EFAB_TRACE ( "tx_buf[%d] for iob %p data %p len %zd\n",
03756                      buf_id, iob, iob->data, iob_len ( iob ) );
03757 
03758         /* Form the descriptor, and push it to hardware */
03759         txd = tx_queue->ring + buf_id;
03760         falcon_build_tx_desc ( txd, iob );
03761         ++tx_queue->write_ptr;
03762         falcon_notify_tx_desc ( efab, tx_queue );
03763 
03764         return 0;
03765 }

static int efab_transmit_done ( struct efab_nic efab,
int  id 
) [static]

Definition at line 3768 of file etherfabric.c.

References assert, efab_tx_queue::buf, EFAB_TXD_SIZE, efab_nic::netdev, netdev_tx_complete(), NULL, efab_tx_queue::read_ptr, and efab_nic::tx_queue.

Referenced by falcon_handle_event().

03769 {
03770         struct efab_tx_queue *tx_queue = &efab->tx_queue;
03771         unsigned int read_ptr, stop;
03772 
03773         /* Complete all buffers from read_ptr up to and including id */
03774         read_ptr = tx_queue->read_ptr % EFAB_TXD_SIZE;
03775         stop = ( id + 1 ) % EFAB_TXD_SIZE;
03776 
03777         while ( read_ptr != stop ) {
03778                 struct io_buffer *iob = tx_queue->buf[read_ptr];
03779                 assert ( iob );
03780 
03781                 /* Complete the tx buffer */
03782                 if ( iob )
03783                         netdev_tx_complete ( efab->netdev, iob );
03784                 tx_queue->buf[read_ptr] = NULL;
03785                 
03786                 ++tx_queue->read_ptr;
03787                 read_ptr = tx_queue->read_ptr % EFAB_TXD_SIZE;
03788         }
03789 
03790         return 0;
03791 }

static void falcon_clear_interrupts ( struct efab_nic efab  )  [static]

Definition at line 3802 of file etherfabric.c.

References falcon_readl(), FALCON_REV_B0, falcon_writel(), FCN_INT_ACK_KER_REG_A1, INT_ISR0_B0, mb(), efab_nic::pci_revision, and WORK_AROUND_BROKEN_PCI_READS_REG_KER_A1.

Referenced by efab_poll().

03803 {
03804         efab_dword_t reg;
03805 
03806         if ( efab->pci_revision == FALCON_REV_B0 ) {
03807                 /* read the ISR */
03808                 falcon_readl( efab, &reg, INT_ISR0_B0 );
03809         }
03810         else {
03811                 /* write to the INT_ACK register */
03812                 falcon_writel ( efab, 0, FCN_INT_ACK_KER_REG_A1 );
03813                 mb();
03814                 falcon_readl ( efab, &reg,
03815                                WORK_AROUND_BROKEN_PCI_READS_REG_KER_A1 );
03816         }
03817 }

static void falcon_handle_event ( struct efab_nic efab,
falcon_event_t evt 
) [static]

Definition at line 3820 of file etherfabric.c.

References EFAB_QWORD_FIELD, efab_receive(), EFAB_TRACE, efab_transmit_done(), FCN_RX_IP_EV_DECODE, and FCN_TX_IP_EV_DECODE.

Referenced by efab_poll().

03821 {
03822         int ev_code, desc_ptr, len, drop;
03823 
03824         /* Decode event */
03825         ev_code = EFAB_QWORD_FIELD ( *evt, FCN_EV_CODE );
03826         switch ( ev_code ) {
03827         case FCN_TX_IP_EV_DECODE:
03828                 desc_ptr = EFAB_QWORD_FIELD ( *evt, FCN_TX_EV_DESC_PTR );
03829                 efab_transmit_done ( efab, desc_ptr );
03830                 break;
03831         
03832         case FCN_RX_IP_EV_DECODE:
03833                 desc_ptr = EFAB_QWORD_FIELD ( *evt, FCN_RX_EV_DESC_PTR );
03834                 len = EFAB_QWORD_FIELD ( *evt, FCN_RX_EV_BYTE_CNT );
03835                 drop = !EFAB_QWORD_FIELD ( *evt, FCN_RX_EV_PKT_OK );
03836 
03837                 efab_receive ( efab, desc_ptr, len, drop );
03838                 break;
03839 
03840         default:
03841                 EFAB_TRACE ( "Unknown event type %d\n", ev_code );
03842                 break;
03843         }
03844 }

static void efab_poll ( struct net_device netdev  )  [static]

Definition at line 3855 of file etherfabric.c.

References EFAB_EVQ_SIZE, efab_fill_rx_queue(), EFAB_QWORD_FMT, EFAB_QWORD_VAL, EFAB_SET_QWORD, EFAB_TRACE, efab_nic::ev_queue, falcon_clear_interrupts(), falcon_event_present(), falcon_eventq_read_ack(), falcon_handle_event(), netdev_priv(), efab_ev_queue::read_ptr, efab_ev_queue::ring, and efab_nic::rx_queue.

03856 {
03857         struct efab_nic *efab = netdev_priv ( netdev );
03858         struct efab_ev_queue *ev_queue = &efab->ev_queue;
03859         struct efab_rx_queue *rx_queue = &efab->rx_queue;
03860         falcon_event_t *evt;
03861 
03862         /* Read the event queue by directly looking for events
03863          * (we don't even bother to read the eventq write ptr) */
03864         evt = ev_queue->ring + ev_queue->read_ptr;
03865         while ( falcon_event_present ( evt ) ) {
03866                 
03867                 EFAB_TRACE ( "Event at index 0x%x address %p is "
03868                              EFAB_QWORD_FMT "\n", ev_queue->read_ptr,
03869                              evt, EFAB_QWORD_VAL ( *evt ) );
03870                 
03871                 falcon_handle_event ( efab, evt );
03872                 
03873                 /* Clear the event */
03874                 EFAB_SET_QWORD ( *evt );
03875         
03876                 /* Move to the next event. We don't ack the event
03877                  * queue until the end */
03878                 ev_queue->read_ptr = ( ( ev_queue->read_ptr + 1 ) %
03879                                        EFAB_EVQ_SIZE );
03880                 evt = ev_queue->ring + ev_queue->read_ptr;
03881         }
03882 
03883         /* Push more buffers if needed */
03884         (void) efab_fill_rx_queue ( efab, rx_queue );
03885 
03886         /* Clear any pending interrupts */
03887         falcon_clear_interrupts ( efab );
03888 
03889         /* Ack the event queue */
03890         falcon_eventq_read_ack ( efab, ev_queue );
03891 }

static void efab_irq ( struct net_device netdev,
int  enable 
) [static]

Definition at line 3894 of file etherfabric.c.

References efab_nic::ev_queue, falcon_eventq_read_ack(), falcon_interrupts(), and netdev_priv().

03895 {
03896         struct efab_nic *efab = netdev_priv ( netdev );
03897         struct efab_ev_queue *ev_queue = &efab->ev_queue;
03898 
03899         switch ( enable ) {
03900         case 0:
03901                 falcon_interrupts ( efab, 0, 0 );
03902                 break;
03903         case 1:
03904                 falcon_interrupts ( efab, 1, 0 );
03905                 falcon_eventq_read_ack ( efab, ev_queue );
03906                 break;
03907         case 2:
03908                 falcon_interrupts ( efab, 1, 1 );
03909                 break;
03910         }
03911 }

static void efab_free_resources ( struct efab_nic efab  )  [static]

Definition at line 3922 of file etherfabric.c.

References efab_tx_queue::buf, efab_rx_queue::buf, efab_nic::buffer_head, EFAB_NUM_RX_DESC, EFAB_TXD_SIZE, efab_nic::ev_queue, falcon_free_special_buffer(), free_iob(), memset(), efab_nic::netdev, netdev_tx_complete(), efab_ev_queue::ring, efab_tx_queue::ring, efab_rx_queue::ring, efab_nic::rx_queue, and efab_nic::tx_queue.

Referenced by efab_close(), and efab_open().

03923 {
03924         struct efab_ev_queue *ev_queue = &efab->ev_queue;
03925         struct efab_rx_queue *rx_queue = &efab->rx_queue;
03926         struct efab_tx_queue *tx_queue = &efab->tx_queue;
03927         int i;
03928 
03929         for ( i = 0; i < EFAB_NUM_RX_DESC; i++ ) {
03930                 if ( rx_queue->buf[i] )
03931                         free_iob ( rx_queue->buf[i] );
03932         }
03933 
03934         for ( i = 0; i < EFAB_TXD_SIZE; i++ ) {
03935                 if ( tx_queue->buf[i] )
03936                         netdev_tx_complete ( efab->netdev,  tx_queue->buf[i] );
03937         }
03938 
03939         if ( rx_queue->ring )
03940                 falcon_free_special_buffer ( rx_queue->ring );
03941 
03942         if ( tx_queue->ring )
03943                 falcon_free_special_buffer ( tx_queue->ring );
03944 
03945         if ( ev_queue->ring )
03946                 falcon_free_special_buffer ( ev_queue->ring );
03947 
03948         memset ( rx_queue, 0, sizeof ( *rx_queue ) );
03949         memset ( tx_queue, 0, sizeof ( *tx_queue ) );
03950         memset ( ev_queue, 0, sizeof ( *ev_queue ) );
03951 
03952         /* Ensure subsequent buffer allocations start at id 0 */
03953         efab->buffer_head = 0;
03954 }

static int efab_alloc_resources ( struct efab_nic efab  )  [static]

Definition at line 3957 of file etherfabric.c.

References EFAB_RXD_SIZE, EFAB_TXD_SIZE, ENOMEM, efab_rx_queue::entry, efab_tx_queue::entry, efab_ev_queue::entry, efab_nic::ev_queue, falcon_alloc_special_buffer(), falcon_free_special_buffer(), memset(), NULL, efab_rx_queue::ring, efab_tx_queue::ring, efab_ev_queue::ring, efab_nic::rx_queue, and efab_nic::tx_queue.

Referenced by efab_open().

03958 {
03959         struct efab_ev_queue *ev_queue = &efab->ev_queue;
03960         struct efab_rx_queue *rx_queue = &efab->rx_queue;
03961         struct efab_tx_queue *tx_queue = &efab->tx_queue;
03962         size_t bytes;
03963 
03964         /* Allocate the hardware event queue */
03965         bytes = sizeof ( falcon_event_t ) * EFAB_TXD_SIZE;
03966         ev_queue->ring = falcon_alloc_special_buffer ( efab, bytes,
03967                                                        &ev_queue->entry );
03968         if ( !ev_queue->ring )
03969                 goto fail1;
03970 
03971         /* Initialise the hardware event queue */
03972         memset ( ev_queue->ring, 0xff, bytes );
03973 
03974         /* Allocate the hardware tx queue */
03975         bytes = sizeof ( falcon_tx_desc_t ) * EFAB_TXD_SIZE;
03976         tx_queue->ring = falcon_alloc_special_buffer ( efab, bytes,
03977                                                        &tx_queue->entry );
03978         if ( ! tx_queue->ring )
03979                 goto fail2;
03980 
03981         /* Allocate the hardware rx queue */
03982         bytes = sizeof ( falcon_rx_desc_t ) * EFAB_RXD_SIZE;
03983         rx_queue->ring = falcon_alloc_special_buffer ( efab, bytes,
03984                                                        &rx_queue->entry );
03985         if ( ! rx_queue->ring )
03986                 goto fail3;
03987 
03988         return 0;
03989 
03990 fail3:
03991         falcon_free_special_buffer ( tx_queue->ring );
03992         tx_queue->ring = NULL;
03993 fail2:
03994         falcon_free_special_buffer ( ev_queue->ring );
03995         ev_queue->ring = NULL;
03996 fail1:
03997         return -ENOMEM;
03998 }

static int efab_init_mac ( struct efab_nic efab  )  [static]

Definition at line 4001 of file etherfabric.c.

References EFAB_ERR, EFAB_LOG, ETIMEDOUT, efab_mac_operations::init, efab_nic::link_options, efab_nic::link_up, LPA_100, LPA_EF_1000, LPA_EF_10000, LPA_EF_DUPLEX, efab_nic::mac_op, efab_nic::netdev, netdev_link_up(), sleep(), and strerror().

Referenced by efab_open().

04002 {
04003         int count, rc;
04004 
04005         /* This can take several seconds */
04006         EFAB_LOG ( "Waiting for link..\n" );
04007         for ( count=0; count<5; count++ ) {
04008                 rc = efab->mac_op->init ( efab );
04009                 if ( rc ) {
04010                         EFAB_ERR ( "Failed reinitialising MAC, error %s\n",
04011                                 strerror ( rc ));
04012                         return rc;
04013                 }
04014 
04015                 /* Sleep for 2s to wait for the link to settle, either
04016                  * because we want to use it, or because we're about
04017                  * to reset the mac anyway
04018                  */
04019                 sleep ( 2 );
04020 
04021                 if ( ! efab->link_up ) {
04022                         EFAB_ERR ( "!\n" );
04023                         continue;
04024                 }
04025 
04026                 EFAB_LOG ( "\n%dMbps %s-duplex\n",
04027                            ( efab->link_options & LPA_EF_10000 ? 10000 :
04028                              ( efab->link_options & LPA_EF_1000 ? 1000 :
04029                                ( efab->link_options & LPA_100 ? 100 : 10 ) ) ),
04030                            ( efab->link_options & LPA_EF_DUPLEX ?
04031                              "full" : "half" ) );
04032 
04033                 /* TODO: Move link state handling to the poll() routine */
04034                 netdev_link_up ( efab->netdev );
04035                 return 0;
04036         }
04037 
04038         EFAB_ERR ( "timed initialising MAC\n" );
04039         return -ETIMEDOUT;
04040 }

static void efab_close ( struct net_device netdev  )  [static]

Definition at line 4043 of file etherfabric.c.

References efab_nic::board_op, efab_free_resources(), falcon_fini_resources(), falcon_reset(), efab_board_operations::fini, and netdev_priv().

04044 {
04045         struct efab_nic *efab = netdev_priv ( netdev );
04046 
04047         falcon_fini_resources ( efab );
04048         efab_free_resources ( efab );
04049         efab->board_op->fini ( efab );
04050         falcon_reset ( efab );
04051 }

static int efab_open ( struct net_device netdev  )  [static]

Definition at line 4054 of file etherfabric.c.

References efab_nic::board_op, efab_alloc_resources(), efab_fill_rx_queue(), efab_free_resources(), efab_init_mac(), falcon_init_resources(), falcon_init_sram(), falcon_reset(), falcon_setup_nic(), efab_board_operations::fini, efab_board_operations::init, netdev_priv(), and efab_nic::rx_queue.

04055 {
04056         struct efab_nic *efab = netdev_priv ( netdev );
04057         struct efab_rx_queue *rx_queue = &efab->rx_queue;
04058         int rc;
04059 
04060         rc = falcon_reset ( efab );
04061         if ( rc )
04062                 goto fail1;
04063 
04064         rc = efab->board_op->init ( efab );
04065         if ( rc )
04066                 goto fail2;
04067         
04068         rc = falcon_init_sram ( efab );
04069         if ( rc )
04070                 goto fail3;
04071 
04072         /* Configure descriptor caches before pushing hardware queues */
04073         falcon_setup_nic ( efab );
04074 
04075         rc = efab_alloc_resources ( efab );
04076         if ( rc )
04077                 goto fail4;
04078         
04079         falcon_init_resources ( efab );
04080 
04081         /* Push rx buffers */
04082         rc = efab_fill_rx_queue ( efab, rx_queue );
04083         if ( rc )
04084                 goto fail5;
04085 
04086         /* Try and bring the interface up */
04087         rc = efab_init_mac ( efab );
04088         if ( rc )
04089                 goto fail6;
04090 
04091         return 0;
04092 
04093 fail6:
04094 fail5:
04095         efab_free_resources ( efab );
04096 fail4:
04097 fail3:
04098         efab->board_op->fini ( efab );
04099 fail2:
04100         falcon_reset ( efab );
04101 fail1:
04102         return rc;
04103 }

static void efab_remove ( struct pci_device pci  )  [static]

Definition at line 4114 of file etherfabric.c.

References falcon_reset(), iounmap(), efab_nic::membase, netdev, netdev_nullify(), netdev_priv(), netdev_put(), NULL, efab_nic::nvo, nvo_block::nvs, pci_get_drvdata(), unregister_netdev(), and unregister_nvo().

04115 {
04116         struct net_device *netdev = pci_get_drvdata ( pci );
04117         struct efab_nic *efab = netdev_priv ( netdev );
04118 
04119         if ( efab->membase ) {
04120                 falcon_reset ( efab );
04121 
04122                 iounmap ( efab->membase );
04123                 efab->membase = NULL;
04124         }
04125 
04126         if ( efab->nvo.nvs ) {
04127                 unregister_nvo ( &efab->nvo );
04128                 efab->nvo.nvs = NULL;
04129         }
04130 
04131         unregister_netdev ( netdev );
04132         netdev_nullify ( netdev );
04133         netdev_put ( netdev );
04134 }

static int efab_probe ( struct pci_device pci,
const struct pci_device_id id 
) [static]

Definition at line 4137 of file etherfabric.c.

References adjust_pci_device(), alloc_etherdev(), pci_device::dev, net_device::dev, EFAB_LOG, EFAB_TRACE, ENOMEM, ETH_ALEN, falcon_probe_nic_variant(), falcon_probe_nvram(), falcon_probe_spi(), net_device::hw_addr, pci_device::ioaddr, efab_nic::iobase, ioremap(), iounmap(), efab_nic::is_asic, efab_nic::mac_addr, efab_nic::membase, memcpy, memset(), pci_device_id::name, efab_nic::netdev, netdev, netdev_init(), netdev_link_up(), netdev_priv(), netdev_put(), netdev_settings(), NULL, efab_nic::nvo, nvo_block::nvs, pci_bar_size(), pci_bar_start(), PCI_BASE_ADDRESS_2, efab_nic::pci_revision, pci_set_drvdata(), efab_nic::phy_10g, register_netdev(), register_nvo(), and unregister_netdev().

04139 {
04140         struct net_device *netdev;
04141         struct efab_nic *efab;
04142         unsigned long mmio_start, mmio_len;
04143         int rc;
04144 
04145         /* Create the network adapter */
04146         netdev = alloc_etherdev ( sizeof ( struct efab_nic ) );
04147         if ( ! netdev ) {
04148                 rc = -ENOMEM;
04149                 goto fail1;
04150         }
04151 
04152         /* Initialise the network adapter, and initialise private storage */
04153         netdev_init ( netdev, &efab_operations );
04154         pci_set_drvdata ( pci, netdev );
04155         netdev->dev = &pci->dev;
04156 
04157         efab = netdev_priv ( netdev );
04158         memset ( efab, 0, sizeof ( *efab ) );
04159         efab->netdev = netdev;
04160 
04161         /* Get iobase/membase */
04162         mmio_start = pci_bar_start ( pci, PCI_BASE_ADDRESS_2 );
04163         mmio_len = pci_bar_size ( pci, PCI_BASE_ADDRESS_2 );
04164         efab->membase = ioremap ( mmio_start, mmio_len );
04165         EFAB_TRACE ( "BAR of %lx bytes at phys %lx mapped at %p\n",
04166                      mmio_len, mmio_start, efab->membase );
04167 
04168         /* Enable the PCI device */
04169         adjust_pci_device ( pci );
04170         efab->iobase = pci->ioaddr & ~3;
04171 
04172         /* Determine the NIC variant */
04173         falcon_probe_nic_variant ( efab, pci );
04174 
04175         /* Read the SPI interface and determine the MAC address,
04176          * and the board and phy variant. Hook in the op tables */
04177         rc = falcon_probe_spi ( efab );
04178         if ( rc )
04179                 goto fail2;
04180         rc = falcon_probe_nvram ( efab );
04181         if ( rc )
04182                 goto fail3;
04183 
04184         memcpy ( netdev->hw_addr, efab->mac_addr, ETH_ALEN );
04185 
04186         netdev_link_up ( netdev );
04187         rc = register_netdev ( netdev );
04188         if ( rc )
04189                 goto fail4;
04190 
04191         /* Advertise non-volatile storage */
04192         if ( efab->nvo.nvs ) {
04193                 rc = register_nvo ( &efab->nvo, netdev_settings ( netdev ) );
04194                 if ( rc )
04195                         goto fail5;
04196         }
04197 
04198         EFAB_LOG ( "Found %s EtherFabric %s %s revision %d\n", id->name,
04199                    efab->is_asic ? "ASIC" : "FPGA",
04200                    efab->phy_10g ? "10G" : "1G",
04201                    efab->pci_revision );
04202 
04203         return 0;
04204 
04205 fail5:
04206         unregister_netdev ( netdev );
04207 fail4:
04208 fail3:
04209 fail2:
04210         iounmap ( efab->membase );
04211         efab->membase = NULL;
04212         netdev_put ( netdev );
04213 fail1:
04214         return rc;
04215 }


Variable Documentation

Initial value:

 {
        { 0x100, 0xf0 },
        { 0, 0 }
}
Portion of EEPROM available for non-volatile options.

Definition at line 1496 of file etherfabric.c.

Initial value:

 {
        .read           = falcon_i2c_bit_read,
        .write          = falcon_i2c_bit_write,
}

Definition at line 1556 of file etherfabric.c.

Initial value:

 {
        .init                   = falcon_init_gmac,
}

Definition at line 2053 of file etherfabric.c.

Initial value:

 {
        .init                   = falcon_init_xmac,
}

Definition at line 2387 of file etherfabric.c.

Initial value:

 {
        .init                   = falcon_xaui_phy_init,
        .mmds                   = 0,
}

Definition at line 2409 of file etherfabric.c.

Initial value:

 {
        .init           = alaska_init,
}

Definition at line 2446 of file etherfabric.c.

Initial value:

 {
        .init                   = falcon_xfp_phy_init,
        .mmds                   = XFP_REQUIRED_DEVS,
}

Definition at line 2478 of file etherfabric.c.

Initial value:

 {
        .init                   = falcon_txc_phy_init,
        .mmds                   = TXC_REQUIRED_DEVS,
}

Definition at line 2607 of file etherfabric.c.

Initial value:

Definition at line 2703 of file etherfabric.c.

Initial value:

Definition at line 2781 of file etherfabric.c.

struct i2c_device i2c_pca9539 [static]

Initial value:

 {
        .dev_addr = PCA9539,
        .dev_addr_len = 1,
        .word_addr_len = 1,
}

Definition at line 2833 of file etherfabric.c.

struct i2c_device i2c_max6647 [static]

Initial value:

 {
        .dev_addr = MAX6647,
        .dev_addr_len = 1,
        .word_addr_len = 1,
}

Definition at line 2840 of file etherfabric.c.

Initial value:

 {
        .init           = sfe4001_init,
        .fini           = sfe4001_fini,
}

Definition at line 2991 of file etherfabric.c.

Initial value:

 {
        .init           = sfe4002_init,
        .fini           = sfe4002_fini,
}

Definition at line 3004 of file etherfabric.c.

Initial value:

 {
        .init           = sfe4003_init,
        .fini           = sfe4003_fini,
}

Definition at line 3017 of file etherfabric.c.

Initial value:

 {
        .open           = efab_open,
        .close          = efab_close,
        .transmit       = efab_transmit,
        .poll           = efab_poll,
        .irq            = efab_irq,
}

Definition at line 4105 of file etherfabric.c.

struct pci_device_id efab_nics[] [static]

Initial value:

 {
        PCI_ROM(0x1924, 0x0703, "falcon", "EtherFabric Falcon", 0),
        PCI_ROM(0x1924, 0x0710, "falconb0", "EtherFabric FalconB0", 0),
}

Definition at line 4218 of file etherfabric.c.

struct pci_driver etherfabric_driver __pci_driver

Initial value:

 {
        .ids = efab_nics,
        .id_count = sizeof ( efab_nics ) / sizeof ( efab_nics[0] ),
        .probe = efab_probe,
        .remove = efab_remove,
}

Definition at line 4223 of file etherfabric.c.


Generated on Tue Apr 6 20:01:32 2010 for gPXE by  doxygen 1.5.7.1