Back to home page

OSCL-LXR

 
 

    


0001 /**********************************************************************
0002  * Author: Cavium, Inc.
0003  *
0004  * Contact: support@cavium.com
0005  *          Please include "LiquidIO" in the subject.
0006  *
0007  * Copyright (c) 2003-2016 Cavium, Inc.
0008  *
0009  * This file is free software; you can redistribute it and/or modify
0010  * it under the terms of the GNU General Public License, Version 2, as
0011  * published by the Free Software Foundation.
0012  *
0013  * This file is distributed in the hope that it will be useful, but
0014  * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
0015  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
0016  * NONINFRINGEMENT.  See the GNU General Public License for more details.
0017  ***********************************************************************/
0018 /*! \file cn23xx_vf_regs.h
0019  * \brief Host Driver: Register Address and Register Mask values for
0020  * Octeon CN23XX vf functions.
0021  */
0022 
0023 #ifndef __CN23XX_VF_REGS_H__
0024 #define __CN23XX_VF_REGS_H__
0025 
0026 #define     CN23XX_CONFIG_XPANSION_BAR             0x38
0027 
0028 #define     CN23XX_CONFIG_PCIE_CAP                 0x70
0029 #define     CN23XX_CONFIG_PCIE_DEVCAP              0x74
0030 #define     CN23XX_CONFIG_PCIE_DEVCTL              0x78
0031 #define     CN23XX_CONFIG_PCIE_LINKCAP             0x7C
0032 #define     CN23XX_CONFIG_PCIE_LINKCTL             0x80
0033 #define     CN23XX_CONFIG_PCIE_SLOTCAP             0x84
0034 #define     CN23XX_CONFIG_PCIE_SLOTCTL             0x88
0035 
0036 #define     CN23XX_CONFIG_PCIE_FLTMSK              0x720
0037 
0038 /* The input jabber is used to determine the TSO max size.
0039  * Due to H/W limitation, this need to be reduced to 60000
0040  * in order to to H/W TSO and avoid the WQE malfarmation
0041  * PKO_BUG_24989_WQE_LEN
0042  */
0043 #define    CN23XX_DEFAULT_INPUT_JABBER             0xEA60 /*60000*/
0044 
0045 /* ##############  BAR0 Registers ################ */
0046 
0047 /* Each Input Queue register is at a 16-byte Offset in BAR0 */
0048 #define    CN23XX_VF_IQ_OFFSET                     0x20000
0049 
0050 /*###################### REQUEST QUEUE #########################*/
0051 
0052 /* 64 registers for Input Queue Instr Count - SLI_PKT_IN_DONE0_CNTS */
0053 #define    CN23XX_VF_SLI_IQ_INSTR_COUNT_START64     0x10040
0054 
0055 /* 64 registers for Input Queues Start Addr - SLI_PKT0_INSTR_BADDR */
0056 #define    CN23XX_VF_SLI_IQ_BASE_ADDR_START64       0x10010
0057 
0058 /* 64 registers for Input Doorbell - SLI_PKT0_INSTR_BAOFF_DBELL */
0059 #define    CN23XX_VF_SLI_IQ_DOORBELL_START          0x10020
0060 
0061 /* 64 registers for Input Queue size - SLI_PKT0_INSTR_FIFO_RSIZE */
0062 #define    CN23XX_VF_SLI_IQ_SIZE_START              0x10030
0063 
0064 /* 64 registers (64-bit) - ES, RO, NS, Arbitration for Input Queue Data &
0065  * gather list fetches. SLI_PKT(0..63)_INPUT_CONTROL.
0066  */
0067 #define    CN23XX_VF_SLI_IQ_PKT_CONTROL_START64     0x10000
0068 
0069 /*------- Request Queue Macros ---------*/
0070 #define CN23XX_VF_SLI_IQ_PKT_CONTROL64(iq)      \
0071     (CN23XX_VF_SLI_IQ_PKT_CONTROL_START64 + ((iq) * CN23XX_VF_IQ_OFFSET))
0072 
0073 #define CN23XX_VF_SLI_IQ_BASE_ADDR64(iq)        \
0074     (CN23XX_VF_SLI_IQ_BASE_ADDR_START64 + ((iq) * CN23XX_VF_IQ_OFFSET))
0075 
0076 #define CN23XX_VF_SLI_IQ_SIZE(iq)           \
0077     (CN23XX_VF_SLI_IQ_SIZE_START + ((iq) * CN23XX_VF_IQ_OFFSET))
0078 
0079 #define CN23XX_VF_SLI_IQ_DOORBELL(iq)           \
0080     (CN23XX_VF_SLI_IQ_DOORBELL_START + ((iq) * CN23XX_VF_IQ_OFFSET))
0081 
0082 #define CN23XX_VF_SLI_IQ_INSTR_COUNT64(iq)      \
0083     (CN23XX_VF_SLI_IQ_INSTR_COUNT_START64 + ((iq) * CN23XX_VF_IQ_OFFSET))
0084 
0085 /*------------------ Masks ----------------*/
0086 #define    CN23XX_PKT_INPUT_CTL_VF_NUM                  BIT_ULL(32)
0087 #define    CN23XX_PKT_INPUT_CTL_MAC_NUM                 BIT(29)
0088 /* Number of instructions to be read in one MAC read request.
0089  * setting to Max value(4)
0090  */
0091 #define    CN23XX_PKT_INPUT_CTL_RDSIZE                  (3 << 25)
0092 #define    CN23XX_PKT_INPUT_CTL_IS_64B                  BIT(24)
0093 #define    CN23XX_PKT_INPUT_CTL_RST                     BIT(23)
0094 #define    CN23XX_PKT_INPUT_CTL_QUIET                   BIT(28)
0095 #define    CN23XX_PKT_INPUT_CTL_RING_ENB                BIT(22)
0096 #define    CN23XX_PKT_INPUT_CTL_DATA_NS                 BIT(8)
0097 #define    CN23XX_PKT_INPUT_CTL_DATA_ES_64B_SWAP        BIT(6)
0098 #define    CN23XX_PKT_INPUT_CTL_DATA_RO                 BIT(5)
0099 #define    CN23XX_PKT_INPUT_CTL_USE_CSR                 BIT(4)
0100 #define    CN23XX_PKT_INPUT_CTL_GATHER_NS               BIT(3)
0101 #define    CN23XX_PKT_INPUT_CTL_GATHER_ES_64B_SWAP      (2)
0102 #define    CN23XX_PKT_INPUT_CTL_GATHER_RO               (1)
0103 
0104 /** Rings per Virtual Function [RO] **/
0105 #define    CN23XX_PKT_INPUT_CTL_RPVF_MASK               (0x3F)
0106 #define    CN23XX_PKT_INPUT_CTL_RPVF_POS                (48)
0107 /* These bits[47:44][RO] give the Physical function number info within the MAC*/
0108 #define    CN23XX_PKT_INPUT_CTL_PF_NUM_MASK             (0x7)
0109 #define    CN23XX_PKT_INPUT_CTL_PF_NUM_POS              (45)
0110 /** These bits[43:32][RO] give the virtual function number info within the PF*/
0111 #define    CN23XX_PKT_INPUT_CTL_VF_NUM_MASK             (0x1FFF)
0112 #define    CN23XX_PKT_INPUT_CTL_VF_NUM_POS              (32)
0113 #define    CN23XX_PKT_INPUT_CTL_MAC_NUM_MASK            (0x3)
0114 #define    CN23XX_PKT_INPUT_CTL_MAC_NUM_POS             (29)
0115 #define    CN23XX_PKT_IN_DONE_WMARK_MASK                (0xFFFFULL)
0116 #define    CN23XX_PKT_IN_DONE_WMARK_BIT_POS             (32)
0117 #define    CN23XX_PKT_IN_DONE_CNT_MASK                  (0x00000000FFFFFFFFULL)
0118 
0119 #ifdef __LITTLE_ENDIAN_BITFIELD
0120 #define CN23XX_PKT_INPUT_CTL_MASK           \
0121     (CN23XX_PKT_INPUT_CTL_RDSIZE            \
0122      | CN23XX_PKT_INPUT_CTL_DATA_ES_64B_SWAP    \
0123      | CN23XX_PKT_INPUT_CTL_USE_CSR)
0124 #else
0125 #define CN23XX_PKT_INPUT_CTL_MASK           \
0126     (CN23XX_PKT_INPUT_CTL_RDSIZE            \
0127      | CN23XX_PKT_INPUT_CTL_DATA_ES_64B_SWAP    \
0128      | CN23XX_PKT_INPUT_CTL_USE_CSR         \
0129      | CN23XX_PKT_INPUT_CTL_GATHER_ES_64B_SWAP)
0130 #endif
0131 
0132 /** Masks for SLI_PKT_IN_DONE(0..63)_CNTS Register */
0133 #define    CN23XX_IN_DONE_CNTS_PI_INT               BIT_ULL(62)
0134 #define    CN23XX_IN_DONE_CNTS_CINT_ENB             BIT_ULL(48)
0135 
0136 /*############################ OUTPUT QUEUE #########################*/
0137 
0138 /* 64 registers for Output queue control - SLI_PKT(0..63)_OUTPUT_CONTROL */
0139 #define    CN23XX_VF_SLI_OQ_PKT_CONTROL_START       0x10050
0140 
0141 /* 64 registers for Output queue buffer and info size - SLI_PKT0_OUT_SIZE */
0142 #define    CN23XX_VF_SLI_OQ0_BUFF_INFO_SIZE         0x10060
0143 
0144 /* 64 registers for Output Queue Start Addr - SLI_PKT0_SLIST_BADDR */
0145 #define    CN23XX_VF_SLI_OQ_BASE_ADDR_START64       0x10070
0146 
0147 /* 64 registers for Output Queue Packet Credits - SLI_PKT0_SLIST_BAOFF_DBELL */
0148 #define    CN23XX_VF_SLI_OQ_PKT_CREDITS_START       0x10080
0149 
0150 /* 64 registers for Output Queue size - SLI_PKT0_SLIST_FIFO_RSIZE */
0151 #define    CN23XX_VF_SLI_OQ_SIZE_START              0x10090
0152 
0153 /* 64 registers for Output Queue Packet Count - SLI_PKT0_CNTS */
0154 #define    CN23XX_VF_SLI_OQ_PKT_SENT_START          0x100B0
0155 
0156 /* 64 registers for Output Queue INT Levels - SLI_PKT0_INT_LEVELS */
0157 #define    CN23XX_VF_SLI_OQ_PKT_INT_LEVELS_START64  0x100A0
0158 
0159 /* Each Output Queue register is at a 16-byte Offset in BAR0 */
0160 #define    CN23XX_VF_OQ_OFFSET                      0x20000
0161 
0162 /*------- Output Queue Macros ---------*/
0163 
0164 #define CN23XX_VF_SLI_OQ_PKT_CONTROL(oq)        \
0165     (CN23XX_VF_SLI_OQ_PKT_CONTROL_START + ((oq) * CN23XX_VF_OQ_OFFSET))
0166 
0167 #define CN23XX_VF_SLI_OQ_BASE_ADDR64(oq)        \
0168     (CN23XX_VF_SLI_OQ_BASE_ADDR_START64 + ((oq) * CN23XX_VF_OQ_OFFSET))
0169 
0170 #define CN23XX_VF_SLI_OQ_SIZE(oq)           \
0171     (CN23XX_VF_SLI_OQ_SIZE_START + ((oq) * CN23XX_VF_OQ_OFFSET))
0172 
0173 #define CN23XX_VF_SLI_OQ_BUFF_INFO_SIZE(oq)     \
0174     (CN23XX_VF_SLI_OQ0_BUFF_INFO_SIZE + ((oq) * CN23XX_VF_OQ_OFFSET))
0175 
0176 #define CN23XX_VF_SLI_OQ_PKTS_SENT(oq)      \
0177     (CN23XX_VF_SLI_OQ_PKT_SENT_START + ((oq) * CN23XX_VF_OQ_OFFSET))
0178 
0179 #define CN23XX_VF_SLI_OQ_PKTS_CREDIT(oq)        \
0180     (CN23XX_VF_SLI_OQ_PKT_CREDITS_START + ((oq) * CN23XX_VF_OQ_OFFSET))
0181 
0182 #define CN23XX_VF_SLI_OQ_PKT_INT_LEVELS(oq)     \
0183     (CN23XX_VF_SLI_OQ_PKT_INT_LEVELS_START64 + ((oq) * CN23XX_VF_OQ_OFFSET))
0184 
0185 /* Macro's for accessing CNT and TIME separately from INT_LEVELS */
0186 #define CN23XX_VF_SLI_OQ_PKT_INT_LEVELS_CNT(oq) \
0187     (CN23XX_VF_SLI_OQ_PKT_INT_LEVELS_START64 + ((oq) * CN23XX_VF_OQ_OFFSET))
0188 
0189 #define CN23XX_VF_SLI_OQ_PKT_INT_LEVELS_TIME(oq)    \
0190     (CN23XX_VF_SLI_OQ_PKT_INT_LEVELS_START64 +  \
0191      ((oq) * CN23XX_VF_OQ_OFFSET) + 4)
0192 
0193 /*------------------ Masks ----------------*/
0194 #define    CN23XX_PKT_OUTPUT_CTL_TENB                  BIT(13)
0195 #define    CN23XX_PKT_OUTPUT_CTL_CENB                  BIT(12)
0196 #define    CN23XX_PKT_OUTPUT_CTL_IPTR                  BIT(11)
0197 #define    CN23XX_PKT_OUTPUT_CTL_ES                    BIT(9)
0198 #define    CN23XX_PKT_OUTPUT_CTL_NSR                   BIT(8)
0199 #define    CN23XX_PKT_OUTPUT_CTL_ROR                   BIT(7)
0200 #define    CN23XX_PKT_OUTPUT_CTL_DPTR                  BIT(6)
0201 #define    CN23XX_PKT_OUTPUT_CTL_BMODE                 BIT(5)
0202 #define    CN23XX_PKT_OUTPUT_CTL_ES_P                  BIT(3)
0203 #define    CN23XX_PKT_OUTPUT_CTL_NSR_P                 BIT(2)
0204 #define    CN23XX_PKT_OUTPUT_CTL_ROR_P                 BIT(1)
0205 #define    CN23XX_PKT_OUTPUT_CTL_RING_ENB              BIT(0)
0206 
0207 /*######################### Mailbox Reg Macros ########################*/
0208 #define    CN23XX_VF_SLI_PKT_MBOX_INT_START            0x10210
0209 #define    CN23XX_SLI_PKT_PF_VF_MBOX_SIG_START         0x10200
0210 
0211 #define    CN23XX_SLI_MBOX_OFFSET                      0x20000
0212 #define    CN23XX_SLI_MBOX_SIG_IDX_OFFSET              0x8
0213 
0214 #define CN23XX_VF_SLI_PKT_MBOX_INT(q)   \
0215     (CN23XX_VF_SLI_PKT_MBOX_INT_START + ((q) * CN23XX_SLI_MBOX_OFFSET))
0216 
0217 #define CN23XX_SLI_PKT_PF_VF_MBOX_SIG(q, idx)       \
0218     (CN23XX_SLI_PKT_PF_VF_MBOX_SIG_START +      \
0219      ((q) * CN23XX_SLI_MBOX_OFFSET +        \
0220       (idx) * CN23XX_SLI_MBOX_SIG_IDX_OFFSET))
0221 
0222 /*######################## INTERRUPTS #########################*/
0223 
0224 #define    CN23XX_VF_SLI_INT_SUM_START        0x100D0
0225 
0226 #define CN23XX_VF_SLI_INT_SUM(q)            \
0227     (CN23XX_VF_SLI_INT_SUM_START + ((q) * CN23XX_VF_IQ_OFFSET))
0228 
0229 /*------------------ Interrupt Masks ----------------*/
0230 
0231 #define    CN23XX_INTR_PO_INT                   BIT_ULL(63)
0232 #define    CN23XX_INTR_PI_INT                   BIT_ULL(62)
0233 #define    CN23XX_INTR_MBOX_INT                 BIT_ULL(61)
0234 #define    CN23XX_INTR_RESEND                   BIT_ULL(60)
0235 
0236 #define    CN23XX_INTR_CINT_ENB                 BIT_ULL(48)
0237 #define    CN23XX_INTR_MBOX_ENB                 BIT(0)
0238 
0239 /*############################ MIO #########################*/
0240 #define    CN23XX_MIO_PTP_CLOCK_CFG       0x0001070000000f00ULL
0241 #define    CN23XX_MIO_PTP_CLOCK_LO        0x0001070000000f08ULL
0242 #define    CN23XX_MIO_PTP_CLOCK_HI        0x0001070000000f10ULL
0243 #define    CN23XX_MIO_PTP_CLOCK_COMP      0x0001070000000f18ULL
0244 #define    CN23XX_MIO_PTP_TIMESTAMP       0x0001070000000f20ULL
0245 #define    CN23XX_MIO_PTP_EVT_CNT         0x0001070000000f28ULL
0246 #define    CN23XX_MIO_PTP_CKOUT_THRESH_LO 0x0001070000000f30ULL
0247 #define    CN23XX_MIO_PTP_CKOUT_THRESH_HI 0x0001070000000f38ULL
0248 #define    CN23XX_MIO_PTP_CKOUT_HI_INCR   0x0001070000000f40ULL
0249 #define    CN23XX_MIO_PTP_CKOUT_LO_INCR   0x0001070000000f48ULL
0250 #define    CN23XX_MIO_PTP_PPS_THRESH_LO   0x0001070000000f50ULL
0251 #define    CN23XX_MIO_PTP_PPS_THRESH_HI   0x0001070000000f58ULL
0252 #define    CN23XX_MIO_PTP_PPS_HI_INCR     0x0001070000000f60ULL
0253 #define    CN23XX_MIO_PTP_PPS_LO_INCR     0x0001070000000f68ULL
0254 
0255 /*############################ RST #########################*/
0256 #define    CN23XX_RST_BOOT                0x0001180006001600ULL
0257 
0258 /*######################## MSIX TABLE #########################*/
0259 
0260 #define    CN23XX_MSIX_TABLE_ADDR_START    0x0
0261 #define    CN23XX_MSIX_TABLE_DATA_START    0x8
0262 
0263 #define    CN23XX_MSIX_TABLE_SIZE          0x10
0264 #define    CN23XX_MSIX_TABLE_ENTRIES       0x41
0265 
0266 #define    CN23XX_MSIX_ENTRY_VECTOR_CTL    BIT_ULL(32)
0267 
0268 #define CN23XX_MSIX_TABLE_ADDR(idx)     \
0269     (CN23XX_MSIX_TABLE_ADDR_START + ((idx) * CN23XX_MSIX_TABLE_SIZE))
0270 
0271 #define CN23XX_MSIX_TABLE_DATA(idx)     \
0272     (CN23XX_MSIX_TABLE_DATA_START + ((idx) * CN23XX_MSIX_TABLE_SIZE))
0273 
0274 #endif