47 #define IDT_CMD_READ 0
48 #define IDT_CMD_WRITE 1
49 #define IDT_CMD_SEARCH 2
50 #define IDT_CMD_LEARN 3
53 #define IDT_LAR_ADR0 0x180006
54 #define IDT_LAR_MODE144 0xffff0000
57 #define IDT_SCR_ADR0 0x180000
58 #define IDT_SSR0_ADR0 0x180002
59 #define IDT_SSR1_ADR0 0x180004
62 #define IDT_GMR_BASE_ADR0 0x180020
65 #define IDT_DATARY_BASE_ADR0 0
66 #define IDT_MSKARY_BASE_ADR0 0x80000
69 #define IDT4_CMD_SEARCH144 3
70 #define IDT4_CMD_WRITE 4
71 #define IDT4_CMD_READ 5
74 #define IDT4_SCR_ADR0 0x3
77 #define IDT4_GMR_BASE0 0x10
78 #define IDT4_GMR_BASE1 0x20
79 #define IDT4_GMR_BASE2 0x30
82 #define IDT4_DATARY_BASE_ADR0 0x1000000
83 #define IDT4_MSKARY_BASE_ADR0 0x2000000
85 #define MAX_WRITE_ATTEMPTS 5
87 #define MAX_ROUTES 2048
132 if (mc5_cmd_write(adapter, cmd) == 0)
134 CH_ERR(adapter,
"MC5 timeout writing to TCAM address 0x%x\n",
139 static int init_mask_data_array(
struct mc5 *
mc5,
u32 mask_array_base,
140 u32 data_array_base,
u32 write_cmd,
144 struct adapter *adap = mc5->
adapter;
159 dbgi_wr_data3(adap, 0, 0, 0);
160 for (i = 0; i < size72; i++)
161 if (mc5_write(adap, data_array_base + (i << addr_shift),
166 dbgi_wr_data3(adap, 0xffffffff, 0xffffffff, 0xff);
167 for (i = 0; i < size72; i++) {
168 if (i == server_base)
171 0xfffffff9 : 0xfffffffd);
172 if (mc5_write(adap, mask_array_base + (i << addr_shift),
179 static int init_idt52100(
struct mc5 *mc5)
182 struct adapter *adap = mc5->
adapter;
214 dbgi_wr_data3(adap, 0xffffffff, 0xffffffff, 0);
220 for (i = 0; i < 32; ++
i) {
221 if (i >= 12 && i < 15)
222 dbgi_wr_data3(adap, 0xfffffff9, 0xffffffff, 0xff);
224 dbgi_wr_data3(adap, 0xfffffff9, 0xffff8007, 0xff);
226 dbgi_wr_data3(adap, 0xffffffff, 0xffffffff, 0xff);
233 dbgi_wr_data3(adap, 1, 0, 0);
243 static int init_idt43102(
struct mc5 *mc5)
246 struct adapter *adap = mc5->
adapter;
273 dbgi_wr_data3(adap, 0xffffffff, 0xffffffff, 0xff);
274 for (i = 0; i < 7; ++
i)
278 for (i = 0; i < 4; ++
i)
282 dbgi_wr_data3(adap, 0xfffffff9, 0xffffffff, 0xff);
288 dbgi_wr_data3(adap, 0xfffffff9, 0xffff8007, 0xff);
293 dbgi_wr_data3(adap, 0xf0000000, 0, 0);
304 static inline void mc5_dbgi_mode_enable(
const struct mc5 *mc5)
311 static void mc5_dbgi_mode_disable(
const struct mc5 *mc5)
323 int t3_mc5_init(
struct mc5 *mc5,
unsigned int nservers,
unsigned int nfilters,
324 unsigned int nroutes)
329 struct adapter *adap = mc5->
adapter;
334 if (nroutes >
MAX_ROUTES || nroutes + nservers + nfilters > tcam_size)
342 CH_ERR(adap,
"TCAM reset timed out\n");
348 tcam_size - nroutes - nfilters);
350 tcam_size - nroutes - nfilters - nservers);
358 mc5_dbgi_mode_enable(mc5);
362 err = init_idt52100(mc5);
365 err = init_idt43102(mc5);
373 mc5_dbgi_mode_disable(mc5);
378 #define MC5_INT_FATAL (F_PARITYERR | F_REQQPARERR | F_DISPQPARERR)
385 struct adapter *adap = mc5->
adapter;
389 CH_ALERT(adap,
"MC5 parity error\n");
390 mc5->
stats.parity_err++;
394 CH_ALERT(adap,
"MC5 request queue parity error\n");
395 mc5->
stats.reqq_parity_err++;
399 CH_ALERT(adap,
"MC5 dispatch queue parity error\n");
400 mc5->
stats.dispq_parity_err++;
404 mc5->
stats.active_rgn_full++;
406 mc5->
stats.nfa_srch_err++;
408 mc5->
stats.unknown_cmd++;
410 mc5->
stats.del_act_empty++;
421 static unsigned int tcam_part_size[] = {
422 64
K, 128
K, 256 K, 32 K