1 /*-
   2  * Copyright 2007-2013 Solarflare Communications Inc.  All rights reserved.
   3  *
   4  * Redistribution and use in source and binary forms, with or without
   5  * modification, are permitted provided that the following conditions
   6  * are met:
   7  * 1. Redistributions of source code must retain the above copyright
   8  *    notice, this list of conditions and the following disclaimer.
   9  * 2. Redistributions in binary form must reproduce the above copyright
  10  *    notice, this list of conditions and the following disclaimer in the
  11  *    documentation and/or other materials provided with the distribution.
  12  *
  13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS AND
  14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  16  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23  * SUCH DAMAGE.
  24  */
  25 
  26 #ifndef _SYS_TXC43128_H
  27 #define _SYS_TXC43128_H
  28 
  29 #include "efx.h"
  30 
  31 #ifdef  __cplusplus
  32 extern "C" {
  33 #endif
  34 
  35 #if EFSYS_OPT_PHY_TXC43128
  36 
  37 #define TXC43128_LOOPBACK_MASK                                          \
  38             ((1 << EFX_LOOPBACK_PHY_XS) |                         \
  39             (1 << EFX_LOOPBACK_PCS) |                                     \
  40             (1 << EFX_LOOPBACK_PMA_PMD) |                         \
  41             FALCON_XMAC_LOOPBACK_MASK)
  42 
  43 #define TXC43128_LED_MASK                                               \
  44             ((1 << EFX_PHY_LED_OFF) |                                     \
  45             (1 << EFX_PHY_LED_ON))
  46 
  47 #define TXC43128_NPROPS         0
  48 
  49 #define TXC43128_ADV_CAP_MASK                                           \
  50             ((1 << EFX_PHY_CAP_10000FDX) |                                \
  51             (1 << EFX_PHY_CAP_PAUSE))
  52 
  53 #define TXC43128_ADV_CAP_PERM   0
  54 
  55 #define TXC43128_BIST_MASK      0
  56 
  57 extern  __checkReturn   int
  58 txc43128_reset(
  59         __in            efx_nic_t *enp);
  60 
  61 extern  __checkReturn   int
  62 txc43128_reconfigure(
  63         __in            efx_nic_t *enp);
  64 
  65 extern  __checkReturn   int
  66 txc43128_verify(
  67         __in            efx_nic_t *enp);
  68 
  69 extern  __checkReturn   int
  70 txc43128_uplink_check(
  71         __in            efx_nic_t *enp,
  72         __out           boolean_t *upp);
  73 
  74 extern  __checkReturn   int
  75 txc43128_downlink_check(
  76         __in            efx_nic_t *enp,
  77         __out           efx_link_mode_t *modep,
  78         __out           unsigned int *fcntlp,
  79         __out           uint32_t *lp_cap_maskp);
  80 
  81 extern  __checkReturn   int
  82 txc43128_oui_get(
  83         __in            efx_nic_t *enp,
  84         __out           uint32_t *ouip);
  85 
  86 #if EFSYS_OPT_PHY_STATS
  87 
  88 /* START MKCONFIG GENERATED Txc43128PhyHeaderStatsMask 0bd778c521babfec */
  89 #define TXC43128_STAT_MASK \
  90         (1ULL << EFX_PHY_STAT_OUI) | \
  91         (1ULL << EFX_PHY_STAT_PMA_PMD_LINK_UP) | \
  92         (1ULL << EFX_PHY_STAT_PMA_PMD_RX_FAULT) | \
  93         (1ULL << EFX_PHY_STAT_PMA_PMD_TX_FAULT) | \
  94         (1ULL << EFX_PHY_STAT_PMA_PMD_SIGNAL_A) | \
  95         (1ULL << EFX_PHY_STAT_PMA_PMD_SIGNAL_B) | \
  96         (1ULL << EFX_PHY_STAT_PMA_PMD_SIGNAL_C) | \
  97         (1ULL << EFX_PHY_STAT_PMA_PMD_SIGNAL_D) | \
  98         (1ULL << EFX_PHY_STAT_PCS_LINK_UP) | \
  99         (1ULL << EFX_PHY_STAT_PCS_RX_FAULT) | \
 100         (1ULL << EFX_PHY_STAT_PCS_TX_FAULT) | \
 101         (1ULL << EFX_PHY_STAT_PHY_XS_LINK_UP) | \
 102         (1ULL << EFX_PHY_STAT_PHY_XS_RX_FAULT) | \
 103         (1ULL << EFX_PHY_STAT_PHY_XS_TX_FAULT) | \
 104         (1ULL << EFX_PHY_STAT_PHY_XS_ALIGN) | \
 105         (1ULL << EFX_PHY_STAT_PHY_XS_SYNC_A) | \
 106         (1ULL << EFX_PHY_STAT_PHY_XS_SYNC_B) | \
 107         (1ULL << EFX_PHY_STAT_PHY_XS_SYNC_C) | \
 108         (1ULL << EFX_PHY_STAT_PHY_XS_SYNC_D)
 109 
 110 /* END MKCONFIG GENERATED Txc43128PhyHeaderStatsMask */
 111 
 112 extern  __checkReturn                   int
 113 txc43128_stats_update(
 114         __in                            efx_nic_t *enp,
 115         __in                            efsys_mem_t *esmp,
 116         __out_ecount(EFX_PHY_NSTATS)    uint32_t *stat);
 117 
 118 #endif  /* EFSYS_OPT_PHY_STATS */
 119 
 120 #if EFSYS_OPT_PHY_PROPS
 121 
 122 #if EFSYS_OPT_NAMES
 123 
 124 extern          const char __cs *
 125 txc43128_prop_name(
 126         __in    efx_nic_t *enp,
 127         __in    unsigned int id);
 128 
 129 #endif
 130 
 131 extern  __checkReturn   int
 132 txc43128_prop_get(
 133         __in            efx_nic_t *enp,
 134         __in            unsigned int id,
 135         __in            uint32_t flags,
 136         __out           uint32_t *valp);
 137 
 138 extern  __checkReturn   int
 139 txc43128_prop_set(
 140         __in            efx_nic_t *enp,
 141         __in            unsigned int id,
 142         __in            uint32_t val);
 143 
 144 #endif  /* EFSYS_OPT_PHY_PROPS */
 145 
 146 #endif  /* EFSYS_OPT_PHY_TXC43128 */
 147 
 148 #ifdef  __cplusplus
 149 }
 150 #endif
 151 
 152 #endif  /* _SYS_TXC43128_H */