Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /* Copyright (c)  2018 Intel Corporation */
0003 
0004 #ifndef _IGC_DEFINES_H_
0005 #define _IGC_DEFINES_H_
0006 
0007 /* Number of Transmit and Receive Descriptors must be a multiple of 8 */
0008 #define REQ_TX_DESCRIPTOR_MULTIPLE  8
0009 #define REQ_RX_DESCRIPTOR_MULTIPLE  8
0010 
0011 #define IGC_CTRL_EXT_SDP2_DIR   0x00000400 /* SDP2 Data direction */
0012 #define IGC_CTRL_EXT_SDP3_DIR   0x00000800 /* SDP3 Data direction */
0013 #define IGC_CTRL_EXT_DRV_LOAD   0x10000000 /* Drv loaded bit for FW */
0014 
0015 /* Definitions for power management and wakeup registers */
0016 /* Wake Up Control */
0017 #define IGC_WUC_PME_EN  0x00000002 /* PME Enable */
0018 
0019 /* Wake Up Filter Control */
0020 #define IGC_WUFC_LNKC       0x00000001 /* Link Status Change Wakeup Enable */
0021 #define IGC_WUFC_MAG        0x00000002 /* Magic Packet Wakeup Enable */
0022 #define IGC_WUFC_EX     0x00000004 /* Directed Exact Wakeup Enable */
0023 #define IGC_WUFC_MC     0x00000008 /* Directed Multicast Wakeup Enable */
0024 #define IGC_WUFC_BC     0x00000010 /* Broadcast Wakeup Enable */
0025 #define IGC_WUFC_FLEX_HQ    BIT(14)    /* Flex Filters Host Queuing */
0026 #define IGC_WUFC_FLX0       BIT(16)    /* Flexible Filter 0 Enable */
0027 #define IGC_WUFC_FLX1       BIT(17)    /* Flexible Filter 1 Enable */
0028 #define IGC_WUFC_FLX2       BIT(18)    /* Flexible Filter 2 Enable */
0029 #define IGC_WUFC_FLX3       BIT(19)    /* Flexible Filter 3 Enable */
0030 #define IGC_WUFC_FLX4       BIT(20)    /* Flexible Filter 4 Enable */
0031 #define IGC_WUFC_FLX5       BIT(21)    /* Flexible Filter 5 Enable */
0032 #define IGC_WUFC_FLX6       BIT(22)    /* Flexible Filter 6 Enable */
0033 #define IGC_WUFC_FLX7       BIT(23)    /* Flexible Filter 7 Enable */
0034 
0035 #define IGC_WUFC_FILTER_MASK GENMASK(23, 14)
0036 
0037 #define IGC_CTRL_ADVD3WUC   0x00100000  /* D3 WUC */
0038 
0039 /* Wake Up Status */
0040 #define IGC_WUS_EX  0x00000004 /* Directed Exact */
0041 #define IGC_WUS_ARPD    0x00000020 /* Directed ARP Request */
0042 #define IGC_WUS_IPV4    0x00000040 /* Directed IPv4 */
0043 #define IGC_WUS_IPV6    0x00000080 /* Directed IPv6 */
0044 #define IGC_WUS_NSD 0x00000400 /* Directed IPv6 Neighbor Solicitation */
0045 
0046 /* Packet types that are enabled for wake packet delivery */
0047 #define WAKE_PKT_WUS ( \
0048     IGC_WUS_EX   | \
0049     IGC_WUS_ARPD | \
0050     IGC_WUS_IPV4 | \
0051     IGC_WUS_IPV6 | \
0052     IGC_WUS_NSD)
0053 
0054 /* Wake Up Packet Length */
0055 #define IGC_WUPL_MASK   0x00000FFF
0056 
0057 /* Wake Up Packet Memory stores the first 128 bytes of the wake up packet */
0058 #define IGC_WUPM_BYTES  128
0059 
0060 /* Wakeup Filter Control Extended */
0061 #define IGC_WUFC_EXT_FLX8   BIT(8)  /* Flexible Filter 8 Enable */
0062 #define IGC_WUFC_EXT_FLX9   BIT(9)  /* Flexible Filter 9 Enable */
0063 #define IGC_WUFC_EXT_FLX10  BIT(10) /* Flexible Filter 10 Enable */
0064 #define IGC_WUFC_EXT_FLX11  BIT(11) /* Flexible Filter 11 Enable */
0065 #define IGC_WUFC_EXT_FLX12  BIT(12) /* Flexible Filter 12 Enable */
0066 #define IGC_WUFC_EXT_FLX13  BIT(13) /* Flexible Filter 13 Enable */
0067 #define IGC_WUFC_EXT_FLX14  BIT(14) /* Flexible Filter 14 Enable */
0068 #define IGC_WUFC_EXT_FLX15  BIT(15) /* Flexible Filter 15 Enable */
0069 #define IGC_WUFC_EXT_FLX16  BIT(16) /* Flexible Filter 16 Enable */
0070 #define IGC_WUFC_EXT_FLX17  BIT(17) /* Flexible Filter 17 Enable */
0071 #define IGC_WUFC_EXT_FLX18  BIT(18) /* Flexible Filter 18 Enable */
0072 #define IGC_WUFC_EXT_FLX19  BIT(19) /* Flexible Filter 19 Enable */
0073 #define IGC_WUFC_EXT_FLX20  BIT(20) /* Flexible Filter 20 Enable */
0074 #define IGC_WUFC_EXT_FLX21  BIT(21) /* Flexible Filter 21 Enable */
0075 #define IGC_WUFC_EXT_FLX22  BIT(22) /* Flexible Filter 22 Enable */
0076 #define IGC_WUFC_EXT_FLX23  BIT(23) /* Flexible Filter 23 Enable */
0077 #define IGC_WUFC_EXT_FLX24  BIT(24) /* Flexible Filter 24 Enable */
0078 #define IGC_WUFC_EXT_FLX25  BIT(25) /* Flexible Filter 25 Enable */
0079 #define IGC_WUFC_EXT_FLX26  BIT(26) /* Flexible Filter 26 Enable */
0080 #define IGC_WUFC_EXT_FLX27  BIT(27) /* Flexible Filter 27 Enable */
0081 #define IGC_WUFC_EXT_FLX28  BIT(28) /* Flexible Filter 28 Enable */
0082 #define IGC_WUFC_EXT_FLX29  BIT(29) /* Flexible Filter 29 Enable */
0083 #define IGC_WUFC_EXT_FLX30  BIT(30) /* Flexible Filter 30 Enable */
0084 #define IGC_WUFC_EXT_FLX31  BIT(31) /* Flexible Filter 31 Enable */
0085 
0086 #define IGC_WUFC_EXT_FILTER_MASK GENMASK(31, 8)
0087 
0088 /* Loop limit on how long we wait for auto-negotiation to complete */
0089 #define COPPER_LINK_UP_LIMIT        10
0090 #define PHY_AUTO_NEG_LIMIT      45
0091 
0092 /* Number of 100 microseconds we wait for PCI Express master disable */
0093 #define MASTER_DISABLE_TIMEOUT      800
0094 /*Blocks new Master requests */
0095 #define IGC_CTRL_GIO_MASTER_DISABLE 0x00000004
0096 /* Status of Master requests. */
0097 #define IGC_STATUS_GIO_MASTER_ENABLE    0x00080000
0098 
0099 /* Receive Address
0100  * Number of high/low register pairs in the RAR. The RAR (Receive Address
0101  * Registers) holds the directed and multicast addresses that we monitor.
0102  * Technically, we have 16 spots.  However, we reserve one of these spots
0103  * (RAR[15]) for our directed address used by controllers with
0104  * manageability enabled, allowing us room for 15 multicast addresses.
0105  */
0106 #define IGC_RAH_RAH_MASK    0x0000FFFF
0107 #define IGC_RAH_ASEL_MASK   0x00030000
0108 #define IGC_RAH_ASEL_SRC_ADDR   BIT(16)
0109 #define IGC_RAH_QSEL_MASK   0x000C0000
0110 #define IGC_RAH_QSEL_SHIFT  18
0111 #define IGC_RAH_QSEL_ENABLE BIT(28)
0112 #define IGC_RAH_AV      0x80000000 /* Receive descriptor valid */
0113 
0114 #define IGC_RAL_MAC_ADDR_LEN    4
0115 #define IGC_RAH_MAC_ADDR_LEN    2
0116 
0117 /* Error Codes */
0118 #define IGC_SUCCESS         0
0119 #define IGC_ERR_NVM         1
0120 #define IGC_ERR_PHY         2
0121 #define IGC_ERR_CONFIG          3
0122 #define IGC_ERR_PARAM           4
0123 #define IGC_ERR_MAC_INIT        5
0124 #define IGC_ERR_RESET           9
0125 #define IGC_ERR_MASTER_REQUESTS_PENDING 10
0126 #define IGC_ERR_BLK_PHY_RESET       12
0127 #define IGC_ERR_SWFW_SYNC       13
0128 
0129 /* Device Control */
0130 #define IGC_CTRL_RST        0x04000000  /* Global reset */
0131 
0132 #define IGC_CTRL_PHY_RST    0x80000000  /* PHY Reset */
0133 #define IGC_CTRL_SLU        0x00000040  /* Set link up (Force Link) */
0134 #define IGC_CTRL_FRCSPD     0x00000800  /* Force Speed */
0135 #define IGC_CTRL_FRCDPX     0x00001000  /* Force Duplex */
0136 #define IGC_CTRL_VME        0x40000000  /* IEEE VLAN mode enable */
0137 
0138 #define IGC_CTRL_RFCE       0x08000000  /* Receive Flow Control enable */
0139 #define IGC_CTRL_TFCE       0x10000000  /* Transmit flow control enable */
0140 
0141 #define IGC_CTRL_SDP0_DIR   0x00400000  /* SDP0 Data direction */
0142 #define IGC_CTRL_SDP1_DIR   0x00800000  /* SDP1 Data direction */
0143 
0144 /* As per the EAS the maximum supported size is 9.5KB (9728 bytes) */
0145 #define MAX_JUMBO_FRAME_SIZE    0x2600
0146 
0147 /* PBA constants */
0148 #define IGC_PBA_34K     0x0022
0149 
0150 /* SW Semaphore Register */
0151 #define IGC_SWSM_SMBI       0x00000001 /* Driver Semaphore bit */
0152 #define IGC_SWSM_SWESMBI    0x00000002 /* FW Semaphore bit */
0153 
0154 /* SWFW_SYNC Definitions */
0155 #define IGC_SWFW_EEP_SM     0x1
0156 #define IGC_SWFW_PHY0_SM    0x2
0157 
0158 /* Autoneg Advertisement Register */
0159 #define NWAY_AR_10T_HD_CAPS 0x0020   /* 10T   Half Duplex Capable */
0160 #define NWAY_AR_10T_FD_CAPS 0x0040   /* 10T   Full Duplex Capable */
0161 #define NWAY_AR_100TX_HD_CAPS   0x0080   /* 100TX Half Duplex Capable */
0162 #define NWAY_AR_100TX_FD_CAPS   0x0100   /* 100TX Full Duplex Capable */
0163 #define NWAY_AR_PAUSE       0x0400   /* Pause operation desired */
0164 #define NWAY_AR_ASM_DIR     0x0800   /* Asymmetric Pause Direction bit */
0165 
0166 /* Link Partner Ability Register (Base Page) */
0167 #define NWAY_LPAR_PAUSE     0x0400 /* LP Pause operation desired */
0168 #define NWAY_LPAR_ASM_DIR   0x0800 /* LP Asymmetric Pause Direction bit */
0169 
0170 /* 1000BASE-T Control Register */
0171 #define CR_1000T_HD_CAPS    0x0100 /* Advertise 1000T HD capability */
0172 #define CR_1000T_FD_CAPS    0x0200 /* Advertise 1000T FD capability  */
0173 
0174 /* 1000BASE-T Status Register */
0175 #define SR_1000T_REMOTE_RX_STATUS   0x1000 /* Remote receiver OK */
0176 
0177 /* PHY GPY 211 registers */
0178 #define STANDARD_AN_REG_MASK    0x0007 /* MMD */
0179 #define ANEG_MULTIGBT_AN_CTRL   0x0020 /* MULTI GBT AN Control Register */
0180 #define MMD_DEVADDR_SHIFT   16     /* Shift MMD to higher bits */
0181 #define CR_2500T_FD_CAPS    0x0080 /* Advertise 2500T FD capability */
0182 
0183 /* NVM Control */
0184 /* Number of milliseconds for NVM auto read done after MAC reset. */
0185 #define AUTO_READ_DONE_TIMEOUT      10
0186 #define IGC_EECD_AUTO_RD        0x00000200  /* NVM Auto Read done */
0187 #define IGC_EECD_REQ        0x00000040 /* NVM Access Request */
0188 #define IGC_EECD_GNT        0x00000080 /* NVM Access Grant */
0189 /* NVM Addressing bits based on type 0=small, 1=large */
0190 #define IGC_EECD_ADDR_BITS      0x00000400
0191 #define IGC_NVM_GRANT_ATTEMPTS      1000 /* NVM # attempts to gain grant */
0192 #define IGC_EECD_SIZE_EX_MASK       0x00007800  /* NVM Size */
0193 #define IGC_EECD_SIZE_EX_SHIFT      11
0194 #define IGC_EECD_FLUPD_I225     0x00800000 /* Update FLASH */
0195 #define IGC_EECD_FLUDONE_I225       0x04000000 /* Update FLASH done*/
0196 #define IGC_EECD_FLASH_DETECTED_I225    0x00080000 /* FLASH detected */
0197 #define IGC_FLUDONE_ATTEMPTS        20000
0198 #define IGC_EERD_EEWR_MAX_COUNT     512 /* buffered EEPROM words rw */
0199 
0200 /* Offset to data in NVM read/write registers */
0201 #define IGC_NVM_RW_REG_DATA 16
0202 #define IGC_NVM_RW_REG_DONE 2    /* Offset to READ/WRITE done bit */
0203 #define IGC_NVM_RW_REG_START    1    /* Start operation */
0204 #define IGC_NVM_RW_ADDR_SHIFT   2    /* Shift to the address bits */
0205 #define IGC_NVM_POLL_READ   0    /* Flag for polling for read complete */
0206 #define IGC_NVM_DEV_STARTER 5    /* Dev_starter Version */
0207 
0208 /* NVM Word Offsets */
0209 #define NVM_CHECKSUM_REG        0x003F
0210 
0211 /* For checksumming, the sum of all words in the NVM should equal 0xBABA. */
0212 #define NVM_SUM             0xBABA
0213 #define NVM_WORD_SIZE_BASE_SHIFT    6
0214 
0215 /* Collision related configuration parameters */
0216 #define IGC_COLLISION_THRESHOLD     15
0217 #define IGC_CT_SHIFT            4
0218 #define IGC_COLLISION_DISTANCE      63
0219 #define IGC_COLD_SHIFT          12
0220 
0221 /* Device Status */
0222 #define IGC_STATUS_FD       0x00000001      /* Full duplex.0=half,1=full */
0223 #define IGC_STATUS_LU       0x00000002      /* Link up.0=no,1=link */
0224 #define IGC_STATUS_FUNC_MASK    0x0000000C      /* PCI Function Mask */
0225 #define IGC_STATUS_FUNC_SHIFT   2
0226 #define IGC_STATUS_TXOFF    0x00000010      /* transmission paused */
0227 #define IGC_STATUS_SPEED_100    0x00000040      /* Speed 100Mb/s */
0228 #define IGC_STATUS_SPEED_1000   0x00000080      /* Speed 1000Mb/s */
0229 #define IGC_STATUS_SPEED_2500   0x00400000  /* Speed 2.5Gb/s */
0230 
0231 #define SPEED_10        10
0232 #define SPEED_100       100
0233 #define SPEED_1000      1000
0234 #define SPEED_2500      2500
0235 #define HALF_DUPLEX     1
0236 #define FULL_DUPLEX     2
0237 
0238 /* 1Gbps and 2.5Gbps half duplex is not supported, nor spec-compliant. */
0239 #define ADVERTISE_10_HALF       0x0001
0240 #define ADVERTISE_10_FULL       0x0002
0241 #define ADVERTISE_100_HALF      0x0004
0242 #define ADVERTISE_100_FULL      0x0008
0243 #define ADVERTISE_1000_HALF     0x0010 /* Not used, just FYI */
0244 #define ADVERTISE_1000_FULL     0x0020
0245 #define ADVERTISE_2500_HALF     0x0040 /* Not used, just FYI */
0246 #define ADVERTISE_2500_FULL     0x0080
0247 
0248 #define IGC_ALL_SPEED_DUPLEX_2500 ( \
0249     ADVERTISE_10_HALF | ADVERTISE_10_FULL | ADVERTISE_100_HALF | \
0250     ADVERTISE_100_FULL | ADVERTISE_1000_FULL | ADVERTISE_2500_FULL)
0251 
0252 #define AUTONEG_ADVERTISE_SPEED_DEFAULT_2500    IGC_ALL_SPEED_DUPLEX_2500
0253 
0254 /* Interrupt Cause Read */
0255 #define IGC_ICR_TXDW        BIT(0)  /* Transmit desc written back */
0256 #define IGC_ICR_TXQE        BIT(1)  /* Transmit Queue empty */
0257 #define IGC_ICR_LSC     BIT(2)  /* Link Status Change */
0258 #define IGC_ICR_RXSEQ       BIT(3)  /* Rx sequence error */
0259 #define IGC_ICR_RXDMT0      BIT(4)  /* Rx desc min. threshold (0) */
0260 #define IGC_ICR_RXO     BIT(6)  /* Rx overrun */
0261 #define IGC_ICR_RXT0        BIT(7)  /* Rx timer intr (ring 0) */
0262 #define IGC_ICR_TS      BIT(19) /* Time Sync Interrupt */
0263 #define IGC_ICR_DRSTA       BIT(30) /* Device Reset Asserted */
0264 
0265 /* If this bit asserted, the driver should claim the interrupt */
0266 #define IGC_ICR_INT_ASSERTED    BIT(31)
0267 
0268 #define IGC_ICS_RXT0        IGC_ICR_RXT0 /* Rx timer intr */
0269 
0270 #define IMS_ENABLE_MASK ( \
0271     IGC_IMS_RXT0   |    \
0272     IGC_IMS_TXDW   |    \
0273     IGC_IMS_RXDMT0 |    \
0274     IGC_IMS_RXSEQ  |    \
0275     IGC_IMS_LSC)
0276 
0277 /* Interrupt Mask Set */
0278 #define IGC_IMS_TXDW        IGC_ICR_TXDW    /* Tx desc written back */
0279 #define IGC_IMS_RXSEQ       IGC_ICR_RXSEQ   /* Rx sequence error */
0280 #define IGC_IMS_LSC     IGC_ICR_LSC /* Link Status Change */
0281 #define IGC_IMS_DOUTSYNC    IGC_ICR_DOUTSYNC /* NIC DMA out of sync */
0282 #define IGC_IMS_DRSTA       IGC_ICR_DRSTA   /* Device Reset Asserted */
0283 #define IGC_IMS_RXT0        IGC_ICR_RXT0    /* Rx timer intr */
0284 #define IGC_IMS_RXDMT0      IGC_ICR_RXDMT0  /* Rx desc min. threshold */
0285 #define IGC_IMS_TS      IGC_ICR_TS  /* Time Sync Interrupt */
0286 
0287 #define IGC_QVECTOR_MASK    0x7FFC      /* Q-vector mask */
0288 #define IGC_ITR_VAL_MASK    0x04        /* ITR value mask */
0289 
0290 /* Interrupt Cause Set */
0291 #define IGC_ICS_LSC     IGC_ICR_LSC       /* Link Status Change */
0292 #define IGC_ICS_RXDMT0      IGC_ICR_RXDMT0    /* rx desc min. threshold */
0293 
0294 #define IGC_ICR_DOUTSYNC    0x10000000 /* NIC DMA out of sync */
0295 #define IGC_EITR_CNT_IGNR   0x80000000 /* Don't reset counters on write */
0296 #define IGC_IVAR_VALID      0x80
0297 #define IGC_GPIE_NSICR      0x00000001
0298 #define IGC_GPIE_MSIX_MODE  0x00000010
0299 #define IGC_GPIE_EIAME      0x40000000
0300 #define IGC_GPIE_PBA        0x80000000
0301 
0302 /* Receive Descriptor bit definitions */
0303 #define IGC_RXD_STAT_DD     0x01    /* Descriptor Done */
0304 
0305 /* Transmit Descriptor bit definitions */
0306 #define IGC_TXD_DTYP_D      0x00100000 /* Data Descriptor */
0307 #define IGC_TXD_DTYP_C      0x00000000 /* Context Descriptor */
0308 #define IGC_TXD_POPTS_IXSM  0x01       /* Insert IP checksum */
0309 #define IGC_TXD_POPTS_TXSM  0x02       /* Insert TCP/UDP checksum */
0310 #define IGC_TXD_CMD_EOP     0x01000000 /* End of Packet */
0311 #define IGC_TXD_CMD_IC      0x04000000 /* Insert Checksum */
0312 #define IGC_TXD_CMD_DEXT    0x20000000 /* Desc extension (0 = legacy) */
0313 #define IGC_TXD_CMD_VLE     0x40000000 /* Add VLAN tag */
0314 #define IGC_TXD_STAT_DD     0x00000001 /* Descriptor Done */
0315 #define IGC_TXD_CMD_TCP     0x01000000 /* TCP packet */
0316 #define IGC_TXD_CMD_IP      0x02000000 /* IP packet */
0317 #define IGC_TXD_CMD_TSE     0x04000000 /* TCP Seg enable */
0318 #define IGC_TXD_EXTCMD_TSTAMP   0x00000010 /* IEEE1588 Timestamp packet */
0319 
0320 /* IPSec Encrypt Enable */
0321 #define IGC_ADVTXD_L4LEN_SHIFT  8  /* Adv ctxt L4LEN shift */
0322 #define IGC_ADVTXD_MSS_SHIFT    16 /* Adv ctxt MSS shift */
0323 
0324 /* Transmit Control */
0325 #define IGC_TCTL_EN     0x00000002 /* enable Tx */
0326 #define IGC_TCTL_PSP        0x00000008 /* pad short packets */
0327 #define IGC_TCTL_CT     0x00000ff0 /* collision threshold */
0328 #define IGC_TCTL_COLD       0x003ff000 /* collision distance */
0329 #define IGC_TCTL_RTLC       0x01000000 /* Re-transmit on late collision */
0330 
0331 /* Flow Control Constants */
0332 #define FLOW_CONTROL_ADDRESS_LOW    0x00C28001
0333 #define FLOW_CONTROL_ADDRESS_HIGH   0x00000100
0334 #define FLOW_CONTROL_TYPE       0x8808
0335 /* Enable XON frame transmission */
0336 #define IGC_FCRTL_XONE          0x80000000
0337 
0338 /* Management Control */
0339 #define IGC_MANC_RCV_TCO_EN 0x00020000 /* Receive TCO Packets Enabled */
0340 #define IGC_MANC_BLK_PHY_RST_ON_IDE 0x00040000 /* Block phy resets */
0341 
0342 /* Receive Control */
0343 #define IGC_RCTL_RST        0x00000001 /* Software reset */
0344 #define IGC_RCTL_EN     0x00000002 /* enable */
0345 #define IGC_RCTL_SBP        0x00000004 /* store bad packet */
0346 #define IGC_RCTL_UPE        0x00000008 /* unicast promisc enable */
0347 #define IGC_RCTL_MPE        0x00000010 /* multicast promisc enable */
0348 #define IGC_RCTL_LPE        0x00000020 /* long packet enable */
0349 #define IGC_RCTL_LBM_MAC    0x00000040 /* MAC loopback mode */
0350 #define IGC_RCTL_LBM_TCVR   0x000000C0 /* tcvr loopback mode */
0351 
0352 #define IGC_RCTL_RDMTS_HALF 0x00000000 /* Rx desc min thresh size */
0353 #define IGC_RCTL_BAM        0x00008000 /* broadcast enable */
0354 
0355 /* Split Replication Receive Control */
0356 #define IGC_SRRCTL_TIMESTAMP        0x40000000
0357 #define IGC_SRRCTL_TIMER1SEL(timer) (((timer) & 0x3) << 14)
0358 #define IGC_SRRCTL_TIMER0SEL(timer) (((timer) & 0x3) << 17)
0359 
0360 /* Receive Descriptor bit definitions */
0361 #define IGC_RXD_STAT_EOP    0x02    /* End of Packet */
0362 #define IGC_RXD_STAT_IXSM   0x04    /* Ignore checksum */
0363 #define IGC_RXD_STAT_UDPCS  0x10    /* UDP xsum calculated */
0364 #define IGC_RXD_STAT_TCPCS  0x20    /* TCP xsum calculated */
0365 #define IGC_RXD_STAT_VP     0x08    /* IEEE VLAN Packet */
0366 
0367 #define IGC_RXDEXT_STATERR_LB   0x00040000
0368 
0369 /* Advanced Receive Descriptor bit definitions */
0370 #define IGC_RXDADV_STAT_TSIP    0x08000 /* timestamp in packet */
0371 
0372 #define IGC_RXDEXT_STATERR_L4E      0x20000000
0373 #define IGC_RXDEXT_STATERR_IPE      0x40000000
0374 #define IGC_RXDEXT_STATERR_RXE      0x80000000
0375 
0376 #define IGC_MRQC_RSS_FIELD_IPV4_TCP 0x00010000
0377 #define IGC_MRQC_RSS_FIELD_IPV4     0x00020000
0378 #define IGC_MRQC_RSS_FIELD_IPV6_TCP_EX  0x00040000
0379 #define IGC_MRQC_RSS_FIELD_IPV6     0x00100000
0380 #define IGC_MRQC_RSS_FIELD_IPV6_TCP 0x00200000
0381 
0382 /* Header split receive */
0383 #define IGC_RFCTL_IPV6_EX_DIS   0x00010000
0384 #define IGC_RFCTL_LEF       0x00040000
0385 
0386 #define IGC_RCTL_SZ_256     0x00030000 /* Rx buffer size 256 */
0387 
0388 #define IGC_RCTL_MO_SHIFT   12 /* multicast offset shift */
0389 #define IGC_RCTL_CFIEN      0x00080000 /* canonical form enable */
0390 #define IGC_RCTL_DPF        0x00400000 /* discard pause frames */
0391 #define IGC_RCTL_PMCF       0x00800000 /* pass MAC control frames */
0392 #define IGC_RCTL_SECRC      0x04000000 /* Strip Ethernet CRC */
0393 
0394 #define I225_RXPBSIZE_DEFAULT   0x000000A2 /* RXPBSIZE default */
0395 #define I225_TXPBSIZE_DEFAULT   0x04000014 /* TXPBSIZE default */
0396 #define IGC_RXPBS_CFG_TS_EN 0x80000000 /* Timestamp in Rx buffer */
0397 
0398 #define IGC_TXPBSIZE_TSN    0x04145145 /* 5k bytes buffer for each queue */
0399 
0400 #define IGC_DTXMXPKTSZ_TSN  0x19 /* 1600 bytes of max TX DMA packet size */
0401 #define IGC_DTXMXPKTSZ_DEFAULT  0x98 /* 9728-byte Jumbo frames */
0402 
0403 /* Time Sync Interrupt Causes */
0404 #define IGC_TSICR_SYS_WRAP  BIT(0) /* SYSTIM Wrap around. */
0405 #define IGC_TSICR_TXTS      BIT(1) /* Transmit Timestamp. */
0406 #define IGC_TSICR_TT0       BIT(3) /* Target Time 0 Trigger. */
0407 #define IGC_TSICR_TT1       BIT(4) /* Target Time 1 Trigger. */
0408 #define IGC_TSICR_AUTT0     BIT(5) /* Auxiliary Timestamp 0 Taken. */
0409 #define IGC_TSICR_AUTT1     BIT(6) /* Auxiliary Timestamp 1 Taken. */
0410 
0411 #define IGC_TSICR_INTERRUPTS    IGC_TSICR_TXTS
0412 
0413 #define IGC_FTQF_VF_BP      0x00008000
0414 #define IGC_FTQF_1588_TIME_STAMP    0x08000000
0415 #define IGC_FTQF_MASK           0xF0000000
0416 #define IGC_FTQF_MASK_PROTO_BP  0x10000000
0417 
0418 /* Time Sync Receive Control bit definitions */
0419 #define IGC_TSYNCRXCTL_TYPE_MASK    0x0000000E  /* Rx type mask */
0420 #define IGC_TSYNCRXCTL_TYPE_L2_V2   0x00
0421 #define IGC_TSYNCRXCTL_TYPE_L4_V1   0x02
0422 #define IGC_TSYNCRXCTL_TYPE_L2_L4_V2    0x04
0423 #define IGC_TSYNCRXCTL_TYPE_ALL     0x08
0424 #define IGC_TSYNCRXCTL_TYPE_EVENT_V2    0x0A
0425 #define IGC_TSYNCRXCTL_ENABLED      0x00000010  /* enable Rx timestamping */
0426 #define IGC_TSYNCRXCTL_SYSCFI       0x00000020  /* Sys clock frequency */
0427 #define IGC_TSYNCRXCTL_RXSYNSIG     0x00000400  /* Sample RX tstamp in PHY sop */
0428 
0429 /* Time Sync Receive Configuration */
0430 #define IGC_TSYNCRXCFG_PTP_V1_CTRLT_MASK    0x000000FF
0431 #define IGC_TSYNCRXCFG_PTP_V1_SYNC_MESSAGE  0x00
0432 #define IGC_TSYNCRXCFG_PTP_V1_DELAY_REQ_MESSAGE 0x01
0433 
0434 /* Immediate Interrupt Receive */
0435 #define IGC_IMIR_CLEAR_MASK 0xF001FFFF /* IMIR Reg Clear Mask */
0436 #define IGC_IMIR_PORT_BYPASS    0x20000 /* IMIR Port Bypass Bit */
0437 #define IGC_IMIR_PRIORITY_SHIFT 29 /* IMIR Priority Shift */
0438 #define IGC_IMIREXT_CLEAR_MASK  0x7FFFF /* IMIREXT Reg Clear Mask */
0439 
0440 /* Immediate Interrupt Receive Extended */
0441 #define IGC_IMIREXT_CTRL_BP 0x00080000  /* Bypass check of ctrl bits */
0442 #define IGC_IMIREXT_SIZE_BP 0x00001000  /* Packet size bypass */
0443 
0444 /* Time Sync Transmit Control bit definitions */
0445 #define IGC_TSYNCTXCTL_TXTT_0           0x00000001  /* Tx timestamp reg 0 valid */
0446 #define IGC_TSYNCTXCTL_ENABLED          0x00000010  /* enable Tx timestamping */
0447 #define IGC_TSYNCTXCTL_MAX_ALLOWED_DLY_MASK 0x0000F000  /* max delay */
0448 #define IGC_TSYNCTXCTL_SYNC_COMP_ERR        0x20000000  /* sync err */
0449 #define IGC_TSYNCTXCTL_SYNC_COMP        0x40000000  /* sync complete */
0450 #define IGC_TSYNCTXCTL_START_SYNC       0x80000000  /* initiate sync */
0451 #define IGC_TSYNCTXCTL_TXSYNSIG         0x00000020  /* Sample TX tstamp in PHY sop */
0452 
0453 /* Timer selection bits */
0454 #define IGC_AUX_IO_TIMER_SEL_SYSTIM0    (0u << 30) /* Select SYSTIM0 for auxiliary time stamp */
0455 #define IGC_AUX_IO_TIMER_SEL_SYSTIM1    (1u << 30) /* Select SYSTIM1 for auxiliary time stamp */
0456 #define IGC_AUX_IO_TIMER_SEL_SYSTIM2    (2u << 30) /* Select SYSTIM2 for auxiliary time stamp */
0457 #define IGC_AUX_IO_TIMER_SEL_SYSTIM3    (3u << 30) /* Select SYSTIM3 for auxiliary time stamp */
0458 #define IGC_TT_IO_TIMER_SEL_SYSTIM0 (0u << 30) /* Select SYSTIM0 for target time stamp */
0459 #define IGC_TT_IO_TIMER_SEL_SYSTIM1 (1u << 30) /* Select SYSTIM1 for target time stamp */
0460 #define IGC_TT_IO_TIMER_SEL_SYSTIM2 (2u << 30) /* Select SYSTIM2 for target time stamp */
0461 #define IGC_TT_IO_TIMER_SEL_SYSTIM3 (3u << 30) /* Select SYSTIM3 for target time stamp */
0462 
0463 /* TSAUXC Configuration Bits */
0464 #define IGC_TSAUXC_EN_TT0   BIT(0)  /* Enable target time 0. */
0465 #define IGC_TSAUXC_EN_TT1   BIT(1)  /* Enable target time 1. */
0466 #define IGC_TSAUXC_EN_CLK0  BIT(2)  /* Enable Configurable Frequency Clock 0. */
0467 #define IGC_TSAUXC_EN_CLK1  BIT(5)  /* Enable Configurable Frequency Clock 1. */
0468 #define IGC_TSAUXC_EN_TS0   BIT(8)  /* Enable hardware timestamp 0. */
0469 #define IGC_TSAUXC_AUTT0    BIT(9)  /* Auxiliary Timestamp Taken. */
0470 #define IGC_TSAUXC_EN_TS1   BIT(10) /* Enable hardware timestamp 0. */
0471 #define IGC_TSAUXC_AUTT1    BIT(11) /* Auxiliary Timestamp Taken. */
0472 #define IGC_TSAUXC_PLSG     BIT(17) /* Generate a pulse. */
0473 #define IGC_TSAUXC_DISABLE1 BIT(27) /* Disable SYSTIM0 Count Operation. */
0474 #define IGC_TSAUXC_DISABLE2 BIT(28) /* Disable SYSTIM1 Count Operation. */
0475 #define IGC_TSAUXC_DISABLE3 BIT(29) /* Disable SYSTIM2 Count Operation. */
0476 #define IGC_TSAUXC_DIS_TS_CLEAR BIT(30) /* Disable EN_TT0/1 auto clear. */
0477 #define IGC_TSAUXC_DISABLE0 BIT(31) /* Disable SYSTIM0 Count Operation. */
0478 
0479 /* SDP Configuration Bits */
0480 #define IGC_AUX0_SEL_SDP0   (0u << 0)  /* Assign SDP0 to auxiliary time stamp 0. */
0481 #define IGC_AUX0_SEL_SDP1   (1u << 0)  /* Assign SDP1 to auxiliary time stamp 0. */
0482 #define IGC_AUX0_SEL_SDP2   (2u << 0)  /* Assign SDP2 to auxiliary time stamp 0. */
0483 #define IGC_AUX0_SEL_SDP3   (3u << 0)  /* Assign SDP3 to auxiliary time stamp 0. */
0484 #define IGC_AUX0_TS_SDP_EN  (1u << 2)  /* Enable auxiliary time stamp trigger 0. */
0485 #define IGC_AUX1_SEL_SDP0   (0u << 3)  /* Assign SDP0 to auxiliary time stamp 1. */
0486 #define IGC_AUX1_SEL_SDP1   (1u << 3)  /* Assign SDP1 to auxiliary time stamp 1. */
0487 #define IGC_AUX1_SEL_SDP2   (2u << 3)  /* Assign SDP2 to auxiliary time stamp 1. */
0488 #define IGC_AUX1_SEL_SDP3   (3u << 3)  /* Assign SDP3 to auxiliary time stamp 1. */
0489 #define IGC_AUX1_TS_SDP_EN  (1u << 5)  /* Enable auxiliary time stamp trigger 1. */
0490 #define IGC_TS_SDP0_SEL_TT0 (0u << 6)  /* Target time 0 is output on SDP0. */
0491 #define IGC_TS_SDP0_SEL_TT1 (1u << 6)  /* Target time 1 is output on SDP0. */
0492 #define IGC_TS_SDP0_SEL_FC0 (2u << 6)  /* Freq clock  0 is output on SDP0. */
0493 #define IGC_TS_SDP0_SEL_FC1 (3u << 6)  /* Freq clock  1 is output on SDP0. */
0494 #define IGC_TS_SDP0_EN      (1u << 8)  /* SDP0 is assigned to Tsync. */
0495 #define IGC_TS_SDP1_SEL_TT0 (0u << 9)  /* Target time 0 is output on SDP1. */
0496 #define IGC_TS_SDP1_SEL_TT1 (1u << 9)  /* Target time 1 is output on SDP1. */
0497 #define IGC_TS_SDP1_SEL_FC0 (2u << 9)  /* Freq clock  0 is output on SDP1. */
0498 #define IGC_TS_SDP1_SEL_FC1 (3u << 9)  /* Freq clock  1 is output on SDP1. */
0499 #define IGC_TS_SDP1_EN      (1u << 11) /* SDP1 is assigned to Tsync. */
0500 #define IGC_TS_SDP2_SEL_TT0 (0u << 12) /* Target time 0 is output on SDP2. */
0501 #define IGC_TS_SDP2_SEL_TT1 (1u << 12) /* Target time 1 is output on SDP2. */
0502 #define IGC_TS_SDP2_SEL_FC0 (2u << 12) /* Freq clock  0 is output on SDP2. */
0503 #define IGC_TS_SDP2_SEL_FC1 (3u << 12) /* Freq clock  1 is output on SDP2. */
0504 #define IGC_TS_SDP2_EN      (1u << 14) /* SDP2 is assigned to Tsync. */
0505 #define IGC_TS_SDP3_SEL_TT0 (0u << 15) /* Target time 0 is output on SDP3. */
0506 #define IGC_TS_SDP3_SEL_TT1 (1u << 15) /* Target time 1 is output on SDP3. */
0507 #define IGC_TS_SDP3_SEL_FC0 (2u << 15) /* Freq clock  0 is output on SDP3. */
0508 #define IGC_TS_SDP3_SEL_FC1 (3u << 15) /* Freq clock  1 is output on SDP3. */
0509 #define IGC_TS_SDP3_EN      (1u << 17) /* SDP3 is assigned to Tsync. */
0510 
0511 /* Transmit Scheduling */
0512 #define IGC_TQAVCTRL_TRANSMIT_MODE_TSN  0x00000001
0513 #define IGC_TQAVCTRL_ENHANCED_QAV   0x00000008
0514 
0515 #define IGC_TXQCTL_QUEUE_MODE_LAUNCHT   0x00000001
0516 #define IGC_TXQCTL_STRICT_CYCLE     0x00000002
0517 #define IGC_TXQCTL_STRICT_END       0x00000004
0518 #define IGC_TXQCTL_QAV_SEL_MASK     0x000000C0
0519 #define IGC_TXQCTL_QAV_SEL_CBS0     0x00000080
0520 #define IGC_TXQCTL_QAV_SEL_CBS1     0x000000C0
0521 
0522 #define IGC_TQAVCC_IDLESLOPE_MASK   0xFFFF
0523 #define IGC_TQAVCC_KEEP_CREDITS     BIT(30)
0524 
0525 #define IGC_MAX_SR_QUEUES       2
0526 
0527 /* Receive Checksum Control */
0528 #define IGC_RXCSUM_CRCOFL   0x00000800   /* CRC32 offload enable */
0529 #define IGC_RXCSUM_PCSD     0x00002000   /* packet checksum disabled */
0530 
0531 /* PCIe PTM Control */
0532 #define IGC_PTM_CTRL_START_NOW  BIT(29) /* Start PTM Now */
0533 #define IGC_PTM_CTRL_EN     BIT(30) /* Enable PTM */
0534 #define IGC_PTM_CTRL_TRIG   BIT(31) /* PTM Cycle trigger */
0535 #define IGC_PTM_CTRL_SHRT_CYC(usec) (((usec) & 0x2f) << 2)
0536 #define IGC_PTM_CTRL_PTM_TO(usec)   (((usec) & 0xff) << 8)
0537 
0538 #define IGC_PTM_SHORT_CYC_DEFAULT   10  /* Default Short/interrupted cycle interval */
0539 #define IGC_PTM_CYC_TIME_DEFAULT    5   /* Default PTM cycle time */
0540 #define IGC_PTM_TIMEOUT_DEFAULT     255 /* Default timeout for PTM errors */
0541 
0542 /* PCIe Digital Delay */
0543 #define IGC_PCIE_DIG_DELAY_DEFAULT  0x01440000
0544 
0545 /* PCIe PHY Delay */
0546 #define IGC_PCIE_PHY_DELAY_DEFAULT  0x40900000
0547 
0548 #define IGC_TIMADJ_ADJUST_METH      0x40000000
0549 
0550 /* PCIe PTM Status */
0551 #define IGC_PTM_STAT_VALID      BIT(0) /* PTM Status */
0552 #define IGC_PTM_STAT_RET_ERR        BIT(1) /* Root port timeout */
0553 #define IGC_PTM_STAT_BAD_PTM_RES    BIT(2) /* PTM Response msg instead of PTM Response Data */
0554 #define IGC_PTM_STAT_T4M1_OVFL      BIT(3) /* T4 minus T1 overflow */
0555 #define IGC_PTM_STAT_ADJUST_1ST     BIT(4) /* 1588 timer adjusted during 1st PTM cycle */
0556 #define IGC_PTM_STAT_ADJUST_CYC     BIT(5) /* 1588 timer adjusted during non-1st PTM cycle */
0557 
0558 /* PCIe PTM Cycle Control */
0559 #define IGC_PTM_CYCLE_CTRL_CYC_TIME(msec)   ((msec) & 0x3ff) /* PTM Cycle Time (msec) */
0560 #define IGC_PTM_CYCLE_CTRL_AUTO_CYC_EN      BIT(31) /* PTM Cycle Control */
0561 
0562 /* GPY211 - I225 defines */
0563 #define GPY_MMD_MASK        0xFFFF0000
0564 #define GPY_MMD_SHIFT       16
0565 #define GPY_REG_MASK        0x0000FFFF
0566 
0567 #define IGC_MMDAC_FUNC_DATA 0x4000 /* Data, no post increment */
0568 
0569 /* MAC definitions */
0570 #define IGC_FACTPS_MNGCG    0x20000000
0571 #define IGC_FWSM_MODE_MASK  0xE
0572 #define IGC_FWSM_MODE_SHIFT 1
0573 
0574 /* Management Control */
0575 #define IGC_MANC_SMBUS_EN   0x00000001 /* SMBus Enabled - RO */
0576 #define IGC_MANC_ASF_EN     0x00000002 /* ASF Enabled - RO */
0577 
0578 /* PHY */
0579 #define PHY_REVISION_MASK   0xFFFFFFF0
0580 #define MAX_PHY_REG_ADDRESS 0x1F  /* 5 bit address bus (0-0x1F) */
0581 #define IGC_GEN_POLL_TIMEOUT    1920
0582 
0583 /* PHY Control Register */
0584 #define MII_CR_RESTART_AUTO_NEG 0x0200  /* Restart auto negotiation */
0585 #define MII_CR_POWER_DOWN   0x0800  /* Power down */
0586 #define MII_CR_AUTO_NEG_EN  0x1000  /* Auto Neg Enable */
0587 
0588 /* PHY Status Register */
0589 #define MII_SR_LINK_STATUS  0x0004 /* Link Status 1 = link */
0590 #define MII_SR_AUTONEG_COMPLETE 0x0020 /* Auto Neg Complete */
0591 #define IGC_PHY_RST_COMP    0x0100 /* Internal PHY reset completion */
0592 
0593 /* PHY 1000 MII Register/Bit Definitions */
0594 /* PHY Registers defined by IEEE */
0595 #define PHY_CONTROL     0x00 /* Control Register */
0596 #define PHY_STATUS      0x01 /* Status Register */
0597 #define PHY_ID1         0x02 /* Phy Id Reg (word 1) */
0598 #define PHY_ID2         0x03 /* Phy Id Reg (word 2) */
0599 #define PHY_AUTONEG_ADV     0x04 /* Autoneg Advertisement */
0600 #define PHY_LP_ABILITY      0x05 /* Link Partner Ability (Base Page) */
0601 #define PHY_1000T_CTRL      0x09 /* 1000Base-T Control Reg */
0602 #define PHY_1000T_STATUS    0x0A /* 1000Base-T Status Reg */
0603 
0604 /* MDI Control */
0605 #define IGC_MDIC_DATA_MASK  0x0000FFFF
0606 #define IGC_MDIC_REG_MASK   0x001F0000
0607 #define IGC_MDIC_REG_SHIFT  16
0608 #define IGC_MDIC_PHY_MASK   0x03E00000
0609 #define IGC_MDIC_PHY_SHIFT  21
0610 #define IGC_MDIC_OP_WRITE   0x04000000
0611 #define IGC_MDIC_OP_READ    0x08000000
0612 #define IGC_MDIC_READY      0x10000000
0613 #define IGC_MDIC_INT_EN     0x20000000
0614 #define IGC_MDIC_ERROR      0x40000000
0615 
0616 #define IGC_N0_QUEUE        -1
0617 
0618 #define IGC_MAX_MAC_HDR_LEN 127
0619 #define IGC_MAX_NETWORK_HDR_LEN 511
0620 
0621 #define IGC_VLANPQF_QSEL(_n, q_idx) ((q_idx) << ((_n) * 4))
0622 #define IGC_VLANPQF_VALID(_n)   (0x1 << (3 + (_n) * 4))
0623 #define IGC_VLANPQF_QUEUE_MASK  0x03
0624 
0625 #define IGC_ADVTXD_MACLEN_SHIFT     9  /* Adv ctxt desc mac len shift */
0626 #define IGC_ADVTXD_TUCMD_IPV4       0x00000400  /* IP Packet Type:1=IPv4 */
0627 #define IGC_ADVTXD_TUCMD_L4T_TCP    0x00000800  /* L4 Packet Type of TCP */
0628 #define IGC_ADVTXD_TUCMD_L4T_SCTP   0x00001000 /* L4 packet TYPE of SCTP */
0629 
0630 /* Maximum size of the MTA register table in all supported adapters */
0631 #define MAX_MTA_REG         128
0632 
0633 /* EEE defines */
0634 #define IGC_IPCNFG_EEE_2_5G_AN      0x00000010 /* IPCNFG EEE Ena 2.5G AN */
0635 #define IGC_IPCNFG_EEE_1G_AN        0x00000008 /* IPCNFG EEE Ena 1G AN */
0636 #define IGC_IPCNFG_EEE_100M_AN      0x00000004 /* IPCNFG EEE Ena 100M AN */
0637 #define IGC_EEER_EEE_NEG        0x20000000 /* EEE capability nego */
0638 #define IGC_EEER_TX_LPI_EN      0x00010000 /* EEER Tx LPI Enable */
0639 #define IGC_EEER_RX_LPI_EN      0x00020000 /* EEER Rx LPI Enable */
0640 #define IGC_EEER_LPI_FC         0x00040000 /* EEER Ena on Flow Cntrl */
0641 #define IGC_EEE_SU_LPI_CLK_STP      0x00800000 /* EEE LPI Clock Stop */
0642 
0643 /* LTR defines */
0644 #define IGC_LTRC_EEEMS_EN       0x00000020 /* Enable EEE LTR max send */
0645 #define IGC_RXPBS_SIZE_I225_MASK    0x0000003F /* Rx packet buffer size */
0646 #define IGC_TW_SYSTEM_1000_MASK     0x000000FF
0647 /* Minimum time for 100BASE-T where no data will be transmit following move out
0648  * of EEE LPI Tx state
0649  */
0650 #define IGC_TW_SYSTEM_100_MASK      0x0000FF00
0651 #define IGC_TW_SYSTEM_100_SHIFT     8
0652 #define IGC_DMACR_DMAC_EN       0x80000000 /* Enable DMA Coalescing */
0653 #define IGC_DMACR_DMACTHR_MASK      0x00FF0000
0654 #define IGC_DMACR_DMACTHR_SHIFT     16
0655 /* Reg val to set scale to 1024 nsec */
0656 #define IGC_LTRMINV_SCALE_1024      2
0657 /* Reg val to set scale to 32768 nsec */
0658 #define IGC_LTRMINV_SCALE_32768     3
0659 /* Reg val to set scale to 1024 nsec */
0660 #define IGC_LTRMAXV_SCALE_1024      2
0661 /* Reg val to set scale to 32768 nsec */
0662 #define IGC_LTRMAXV_SCALE_32768     3
0663 #define IGC_LTRMINV_LTRV_MASK       0x000003FF /* LTR minimum value */
0664 #define IGC_LTRMAXV_LTRV_MASK       0x000003FF /* LTR maximum value */
0665 #define IGC_LTRMINV_LSNP_REQ        0x00008000 /* LTR Snoop Requirement */
0666 #define IGC_LTRMINV_SCALE_SHIFT     10
0667 #define IGC_LTRMAXV_LSNP_REQ        0x00008000 /* LTR Snoop Requirement */
0668 #define IGC_LTRMAXV_SCALE_SHIFT     10
0669 
0670 #endif /* _IGC_DEFINES_H_ */