xref: /illumos-gate/usr/src/uts/common/io/chxge/com/mc5.h (revision e3ae4b35c024af1196582063ecee3ab79367227d)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright (C) 2003-2005 Chelsio Communications.  All rights reserved.
24  */
25 
26 #ifndef CHELSIO_MC5_H
27 #define CHELSIO_MC5_H
28 
29 #include "common.h"
30 
31 struct pemc5;
32 
33 struct pemc5_intr_counts {
34 	unsigned int hit_out_active_region_err;
35 	unsigned int hit_in_active_region_err;
36 	unsigned int hit_in_routing_region_err;
37 	unsigned int miss_err;
38 	unsigned int lip_equal_zero_err;
39 	unsigned int lip_miss_err;
40 	unsigned int parity_err;
41 	unsigned int active_region_full_err;
42 	unsigned int next_free_addr_srch_err;
43 	unsigned int syn_cookie;
44 	unsigned int syn_cookie_bad_message;
45 	unsigned int syn_cookie_off_message;
46 	unsigned int receive_unknown_cmd;
47 	unsigned int parity_in_request_q_err;
48 	unsigned int parity_in_dispatch_q_err;
49 	unsigned int del_and_act_is_empty;
50 };
51 
52 #define MC5_LIP_NUM_OF_ENTRIES  64
53 
54 /* These must be non-0 */
55 #define MC5_MODE_144_BIT     1
56 #define MC5_MODE_72_BIT      2
57 
58 struct pemc5 *t1_mc5_create(adapter_t *adapter, int mode);
59 int t1_mc5_init(struct pemc5 *mc5, unsigned int nservers,
60 		unsigned int nroutes, int parity, int syn);
61 void t1_mc5_destroy(struct pemc5 *mc5);
62 
63 int t1_read_mc5_range(struct pemc5 *mc5, unsigned int start,
64 		unsigned int n, u32 *buf);
65 const struct pemc5_intr_counts *t1_mc5_get_intr_counts(struct pemc5 *mc5);
66 
67 void t1_mc5_intr_enable(struct pemc5 *mc5);
68 void t1_mc5_intr_disable(struct pemc5 *mc5);
69 void t1_mc5_intr_clear(struct pemc5 *mc5);
70 void t1_mc5_intr_handler(struct pemc5 *mc5);
71 
72 void t1_mc5_lip_write_entries(struct pemc5 *mc5);
73 int t1_mc5_lip_add_entry(struct pemc5 *mc5, u32 lip);
74 void t1_mc5_lip_clear_entries(struct pemc5 *mc5);
75 
76 unsigned int t1_mc5_get_tcam_size(struct pemc5 *mc5);
77 unsigned int t1_mc5_get_tcam_rtbl_base(struct pemc5 *mc5);
78 unsigned int t1_mc5_get_tcam_rtbl_size(struct pemc5 *mc5);
79 unsigned int t1_mc5_get_tcam_server_base(struct pemc5 *mc5);
80 unsigned int t1_mc5_get_tcam_server_size(struct pemc5 *mc5);
81 
82 #endif
83