1 /* 2 * This file and its contents are supplied under the terms of the 3 * Common Development and Distribution License ("CDDL"), version 1.0. 4 * You may only use this file in accordance with the terms of version 5 * 1.0 of the CDDL. 6 * 7 * A full copy of the text of the CDDL should have accompanied this 8 * source. A copy of the CDDL is also available via the Internet at 9 * http://www.illumos.org/license/CDDL. 10 */ 11 12 /* 13 * This file is part of the Chelsio T4 Ethernet driver. 14 * 15 * Copyright (C) 2009-2013 Chelsio Communications. All rights reserved. 16 * 17 * This program is distributed in the hope that it will be useful, but WITHOUT 18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19 * FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file included in this 20 * release for licensing terms and conditions. 21 */ 22 23 #ifndef __CXGBE_T4_HW_H 24 #define __CXGBE_T4_HW_H 25 26 #include "osdep.h" 27 28 enum { 29 NCHAN = 4, /* # of HW channels */ 30 MAX_MTU = 9600, /* max MAC MTU, excluding header + FCS */ 31 EEPROMSIZE = 17408, /* Serial EEPROM physical size */ 32 EEPROMVSIZE = 32768, /* Serial EEPROM virtual address space size */ 33 EEPROMPFSIZE = 1024, /* EEPROM writable area size for PFn, n>0 */ 34 RSS_NENTRIES = 2048, /* # of entries in RSS mapping table */ 35 TCB_SIZE = 128, /* TCB size */ 36 NMTUS = 16, /* size of MTU table */ 37 NCCTRL_WIN = 32, /* # of congestion control windows */ 38 NTX_SCHED = 8, /* # of HW Tx scheduling queues */ 39 PM_NSTATS = 5, /* # of PM stats */ 40 MBOX_LEN = 64, /* mailbox size in bytes */ 41 TRACE_LEN = 112, /* length of trace data and mask */ 42 FILTER_OPT_LEN = 36, /* filter tuple width for optional */ 43 /* components */ 44 NWOL_PAT = 8, /* # of WoL patterns */ 45 WOL_PAT_LEN = 128, /* length of WoL patterns */ 46 }; 47 48 enum { 49 CIM_NUM_IBQ = 6, /* # of CIM IBQs */ 50 CIM_NUM_OBQ = 6, /* # of CIM OBQs */ 51 CIMLA_SIZE = 2048, /* # of 32-bit words in CIM LA */ 52 CIM_PIFLA_SIZE = 64, /* # of 192-bit words in CIM PIF LA */ 53 CIM_MALA_SIZE = 64, /* # of 160-bit words in CIM MA LA */ 54 CIM_IBQ_SIZE = 128, /* # of 128-bit words in a CIM IBQ */ 55 TPLA_SIZE = 128, /* # of 64-bit words in TP LA */ 56 ULPRX_LA_SIZE = 512, /* # of 256-bit words in ULP_RX LA */ 57 }; 58 59 enum { 60 SF_PAGE_SIZE = 256, /* serial flash page size */ 61 SF_SEC_SIZE = 64 * 1024, /* serial flash sector size */ 62 }; 63 64 /* SGE context types */ 65 enum ctxt_type { CTXT_EGRESS, CTXT_INGRESS, CTXT_FLM, CTXT_CNM }; 66 67 enum { RSP_TYPE_FLBUF, RSP_TYPE_CPL, RSP_TYPE_INTR }; /* response entry types */ 68 69 enum { MBOX_OWNER_NONE, MBOX_OWNER_FW, MBOX_OWNER_DRV }; /* mailbox owners */ 70 71 enum { 72 SGE_MAX_WR_LEN = 512, /* max WR size in bytes */ 73 SGE_CTXT_SIZE = 24, /* size of SGE context */ 74 SGE_NTIMERS = 6, /* # of interrupt holdoff timer values */ 75 SGE_NCOUNTERS = 4, /* # of interrupt packet counter values */ 76 }; 77 78 struct sge_qstat { /* data written to SGE queue status entries */ 79 volatile __be32 qid; 80 volatile __be16 cidx; 81 volatile __be16 pidx; 82 }; 83 84 #define S_QSTAT_PIDX 0 85 #define M_QSTAT_PIDX 0xffff 86 #define G_QSTAT_PIDX(x) (((x) >> S_QSTAT_PIDX) & M_QSTAT_PIDX) 87 88 #define S_QSTAT_CIDX 16 89 #define M_QSTAT_CIDX 0xffff 90 #define G_QSTAT_CIDX(x) (((x) >> S_QSTAT_CIDX) & M_QSTAT_CIDX) 91 92 /* 93 * Structure for last 128 bits of response descriptors 94 */ 95 struct rsp_ctrl { 96 __be32 hdrbuflen_pidx; 97 __be32 pldbuflen_qid; 98 union { 99 u8 type_gen; 100 __be64 last_flit; 101 } u; 102 }; 103 104 #define S_RSPD_NEWBUF 31 105 #define V_RSPD_NEWBUF(x) ((x) << S_RSPD_NEWBUF) 106 #define F_RSPD_NEWBUF V_RSPD_NEWBUF(1U) 107 108 #define S_RSPD_LEN 0 109 #define M_RSPD_LEN 0x7fffffff 110 #define V_RSPD_LEN(x) ((x) << S_RSPD_LEN) 111 #define G_RSPD_LEN(x) (((x) >> S_RSPD_LEN) & M_RSPD_LEN) 112 113 #define S_RSPD_QID S_RSPD_LEN 114 #define M_RSPD_QID M_RSPD_LEN 115 #define V_RSPD_QID(x) V_RSPD_LEN(x) 116 #define G_RSPD_QID(x) G_RSPD_LEN(x) 117 118 #define S_RSPD_GEN 7 119 #define V_RSPD_GEN(x) ((x) << S_RSPD_GEN) 120 #define F_RSPD_GEN V_RSPD_GEN(1U) 121 122 #define S_RSPD_QOVFL 6 123 #define V_RSPD_QOVFL(x) ((x) << S_RSPD_QOVFL) 124 #define F_RSPD_QOVFL V_RSPD_QOVFL(1U) 125 126 #define S_RSPD_TYPE 4 127 #define M_RSPD_TYPE 0x3 128 #define V_RSPD_TYPE(x) ((x) << S_RSPD_TYPE) 129 #define G_RSPD_TYPE(x) (((x) >> S_RSPD_TYPE) & M_RSPD_TYPE) 130 131 /* Rx queue interrupt deferral fields: counter enable and timer index */ 132 #define S_QINTR_CNT_EN 0 133 #define V_QINTR_CNT_EN(x) ((x) << S_QINTR_CNT_EN) 134 #define F_QINTR_CNT_EN V_QINTR_CNT_EN(1U) 135 136 #define S_QINTR_TIMER_IDX 1 137 #define M_QINTR_TIMER_IDX 0x7 138 #define V_QINTR_TIMER_IDX(x) ((x) << S_QINTR_TIMER_IDX) 139 #define G_QINTR_TIMER_IDX(x) (((x) >> S_QINTR_TIMER_IDX) & M_QINTR_TIMER_IDX) 140 141 /* # of pages a pagepod can hold without needing another pagepod */ 142 #define PPOD_PAGES 4U 143 144 struct pagepod { 145 __be64 vld_tid_pgsz_tag_color; 146 __be64 len_offset; 147 __be64 rsvd; 148 __be64 addr[PPOD_PAGES + 1]; 149 }; 150 151 #define S_PPOD_COLOR 0 152 #define M_PPOD_COLOR 0x3F 153 #define V_PPOD_COLOR(x) ((x) << S_PPOD_COLOR) 154 155 #define S_PPOD_TAG 6 156 #define M_PPOD_TAG 0xFFFFFF 157 #define V_PPOD_TAG(x) ((x) << S_PPOD_TAG) 158 159 #define S_PPOD_PGSZ 30 160 #define M_PPOD_PGSZ 0x3 161 #define V_PPOD_PGSZ(x) ((x) << S_PPOD_PGSZ) 162 163 #define S_PPOD_TID 32 164 #define M_PPOD_TID 0xFFFFFF 165 #define V_PPOD_TID(x) ((__u64)(x) << S_PPOD_TID) 166 167 #define S_PPOD_VALID 56 168 #define V_PPOD_VALID(x) ((__u64)(x) << S_PPOD_VALID) 169 #define F_PPOD_VALID V_PPOD_VALID(1ULL) 170 171 #define S_PPOD_LEN 32 172 #define M_PPOD_LEN 0xFFFFFFFF 173 #define V_PPOD_LEN(x) ((__u64)(x) << S_PPOD_LEN) 174 175 #define S_PPOD_OFST 0 176 #define M_PPOD_OFST 0xFFFFFFFF 177 #define V_PPOD_OFST(x) ((x) << S_PPOD_OFST) 178 179 /* 180 * Flash layout. 181 */ 182 #define FLASH_START(start) ((start) * SF_SEC_SIZE) 183 #define FLASH_MAX_SIZE(nsecs) ((nsecs) * SF_SEC_SIZE) 184 185 enum { 186 /* 187 * Various Expansion-ROM boot images, etc. 188 */ 189 FLASH_EXP_ROM_START_SEC = 0, 190 FLASH_EXP_ROM_NSECS = 6, 191 FLASH_EXP_ROM_START = FLASH_START(FLASH_EXP_ROM_START_SEC), 192 FLASH_EXP_ROM_MAX_SIZE = FLASH_MAX_SIZE(FLASH_EXP_ROM_NSECS), 193 194 /* 195 * iSCSI Boot Firmware Table (iBFT) and other driver-related 196 * parameters ... 197 */ 198 FLASH_IBFT_START_SEC = 6, 199 FLASH_IBFT_NSECS = 1, 200 FLASH_IBFT_START = FLASH_START(FLASH_IBFT_START_SEC), 201 FLASH_IBFT_MAX_SIZE = FLASH_MAX_SIZE(FLASH_IBFT_NSECS), 202 203 /* 204 * Boot configuration data. 205 */ 206 FLASH_BOOTCFG_START_SEC = 7, 207 FLASH_BOOTCFG_NSECS = 1, 208 FLASH_BOOTCFG_START = FLASH_START(FLASH_BOOTCFG_START_SEC), 209 FLASH_BOOTCFG_MAX_SIZE = FLASH_MAX_SIZE(FLASH_BOOTCFG_NSECS), 210 211 /* 212 * Location of firmware image in FLASH. 213 */ 214 FLASH_FW_START_SEC = 8, 215 FLASH_FW_NSECS = 8, 216 FLASH_FW_START = FLASH_START(FLASH_FW_START_SEC), 217 FLASH_FW_MAX_SIZE = FLASH_MAX_SIZE(FLASH_FW_NSECS), 218 219 /* 220 * iSCSI persistent/crash information. 221 */ 222 FLASH_ISCSI_CRASH_START_SEC = 29, 223 FLASH_ISCSI_CRASH_NSECS = 1, 224 FLASH_ISCSI_CRASH_START = FLASH_START(FLASH_ISCSI_CRASH_START_SEC), 225 FLASH_ISCSI_CRASH_MAX_SIZE = FLASH_MAX_SIZE(FLASH_ISCSI_CRASH_NSECS), 226 227 /* 228 * FCoE persistent/crash information. 229 */ 230 FLASH_FCOE_CRASH_START_SEC = 30, 231 FLASH_FCOE_CRASH_NSECS = 1, 232 FLASH_FCOE_CRASH_START = FLASH_START(FLASH_FCOE_CRASH_START_SEC), 233 FLASH_FCOE_CRASH_MAX_SIZE = FLASH_MAX_SIZE(FLASH_FCOE_CRASH_NSECS), 234 235 /* 236 * Location of Firmware Configuration File in FLASH. Since the FPGA 237 * "FLASH" is smaller we need to store the Configuration File in a 238 * different location -- which will overlap the end of the firmware 239 * image if firmware ever gets that large ... 240 */ 241 FLASH_CFG_START_SEC = 31, 242 FLASH_CFG_NSECS = 1, 243 FLASH_CFG_START = FLASH_START(FLASH_CFG_START_SEC), 244 FLASH_CFG_MAX_SIZE = FLASH_MAX_SIZE(FLASH_CFG_NSECS), 245 246 FLASH_FPGA_CFG_START_SEC = 15, 247 FLASH_FPGA_CFG_START = FLASH_START(FLASH_FPGA_CFG_START_SEC), 248 249 /* 250 * Sectors 32-63 are reserved for FLASH failover. 251 */ 252 }; 253 254 #undef FLASH_START 255 #undef FLASH_MAX_SIZE 256 257 #endif /* __CXGBE_T4_HW_H */ 258