1 /*-
   2  * Copyright 2008-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_QT2025C_H
  27 #define _SYS_QT2025C_H
  28 
  29 #include "efx.h"
  30 
  31 #ifdef  __cplusplus
  32 extern "C" {
  33 #endif
  34 
  35 #if EFSYS_OPT_PHY_QT2025C
  36 
  37 #define QT2025C_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 QT2025C_LED_MASK                                                \
  44             ((1 << EFX_PHY_LED_OFF) |                                     \
  45             (1 << EFX_PHY_LED_ON))
  46 
  47 #define QT2025C_NPROPS          0
  48 
  49 #define QT2025C_ADV_CAP_MASK                                            \
  50             ((1 << EFX_PHY_CAP_10000FDX) |                                \
  51             (1 << EFX_PHY_CAP_PAUSE))
  52 
  53 #define QT2025C_ADV_CAP_PERM    0
  54 
  55 #define QT2025C_BIST_MASK       0
  56 
  57 extern  __checkReturn   int
  58 qt2025c_reset(
  59         __in            efx_nic_t *enp);
  60 
  61 extern  __checkReturn   int
  62 qt2025c_reconfigure(
  63         __in            efx_nic_t *enp);
  64 
  65 extern  __checkReturn   int
  66 qt2025c_verify(
  67         __in            efx_nic_t *enp);
  68 
  69 extern  __checkReturn   int
  70 qt2025c_uplink_check(
  71         __in            efx_nic_t *enp,
  72         __out           boolean_t *upp);
  73 
  74 extern  __checkReturn   int
  75 qt2025c_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                  void
  82 qt2025c_downlink_reset(
  83         __in            efx_nic_t *enp);
  84 
  85 extern  __checkReturn   int
  86 qt2025c_oui_get(
  87         __in            efx_nic_t *enp,
  88         __out           uint32_t *ouip);
  89 
  90 #if EFSYS_OPT_PHY_STATS
  91 
  92 /* START MKCONFIG GENERATED Qt2025cPhyHeaderStatsMask 2eb4a092d85bd5ac */
  93 #define QT2025C_STAT_MASK \
  94         (1ULL << EFX_PHY_STAT_OUI) | \
  95         (1ULL << EFX_PHY_STAT_PMA_PMD_LINK_UP) | \
  96         (1ULL << EFX_PHY_STAT_PMA_PMD_RX_FAULT) | \
  97         (1ULL << EFX_PHY_STAT_PMA_PMD_TX_FAULT) | \
  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_PCS_BER) | \
 102         (1ULL << EFX_PHY_STAT_PCS_BLOCK_ERRORS) | \
 103         (1ULL << EFX_PHY_STAT_PCS_FW_VERSION_0) | \
 104         (1ULL << EFX_PHY_STAT_PCS_FW_VERSION_1) | \
 105         (1ULL << EFX_PHY_STAT_PCS_FW_VERSION_2) | \
 106         (1ULL << EFX_PHY_STAT_PCS_FW_VERSION_3) | \
 107         (1ULL << EFX_PHY_STAT_PCS_FW_BUILD_YY) | \
 108         (1ULL << EFX_PHY_STAT_PCS_FW_BUILD_MM) | \
 109         (1ULL << EFX_PHY_STAT_PCS_FW_BUILD_DD) | \
 110         (1ULL << EFX_PHY_STAT_PCS_OP_MODE) | \
 111         (1ULL << EFX_PHY_STAT_PHY_XS_LINK_UP) | \
 112         (1ULL << EFX_PHY_STAT_PHY_XS_RX_FAULT) | \
 113         (1ULL << EFX_PHY_STAT_PHY_XS_TX_FAULT) | \
 114         (1ULL << EFX_PHY_STAT_PHY_XS_ALIGN) | \
 115         (1ULL << EFX_PHY_STAT_PHY_XS_SYNC_A) | \
 116         (1ULL << EFX_PHY_STAT_PHY_XS_SYNC_B) | \
 117         (1ULL << EFX_PHY_STAT_PHY_XS_SYNC_C) | \
 118         (1ULL << EFX_PHY_STAT_PHY_XS_SYNC_D)
 119 
 120 /* END MKCONFIG GENERATED Qt2025cPhyHeaderStatsMask */
 121 
 122 extern  __checkReturn                   int
 123 qt2025c_stats_update(
 124         __in                            efx_nic_t *enp,
 125         __in                            efsys_mem_t *esmp,
 126         __out_ecount(EFX_PHY_NSTATS)    uint32_t *stat);
 127 
 128 #endif  /* EFSYS_OPT_PHY_STATS */
 129 
 130 #if EFSYS_OPT_PHY_PROPS
 131 
 132 #if EFSYS_OPT_NAMES
 133 
 134 extern          const char __cs *
 135 qt2025c_prop_name(
 136         __in    efx_nic_t *enp,
 137         __in    unsigned int id);
 138 
 139 #endif
 140 
 141 extern  __checkReturn   int
 142 qt2025c_prop_get(
 143         __in            efx_nic_t *enp,
 144         __in            unsigned int id,
 145         __in            uint32_t flags,
 146         __out           uint32_t *valp);
 147 
 148 extern  __checkReturn   int
 149 qt2025c_prop_set(
 150         __in            efx_nic_t *enp,
 151         __in            unsigned int id,
 152         __in            uint32_t val);
 153 
 154 #endif  /* EFSYS_OPT_PHY_PROPS */
 155 
 156 #endif  /* EFSYS_OPT_PHY_QT2025C */
 157 
 158 #ifdef  __cplusplus
 159 }
 160 #endif
 161 
 162 #endif  /* _SYS_QT2025C_H */