Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 1 | /************************************************************************** |
| 2 | * |
| 3 | * Copyright (c) 2000-2002 Alacritech, Inc. All rights reserved. |
| 4 | * |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions |
| 8 | * are met: |
| 9 | * |
| 10 | * 1. Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * 2. Redistributions in binary form must reproduce the above |
| 13 | * copyright notice, this list of conditions and the following |
| 14 | * disclaimer in the documentation and/or other materials provided |
| 15 | * with the distribution. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY ALACRITECH, INC. ``AS IS'' AND ANY |
| 18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 20 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ALACRITECH, INC. OR |
| 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 23 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
| 24 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 27 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 28 | * SUCH DAMAGE. |
| 29 | * |
| 30 | * The views and conclusions contained in the software and documentation |
| 31 | * are those of the authors and should not be interpreted as representing |
| 32 | * official policies, either expressed or implied, of Alacritech, Inc. |
| 33 | * |
| 34 | **************************************************************************/ |
| 35 | |
| 36 | /* |
| 37 | * FILENAME: slic.h |
| 38 | * |
| 39 | * This is the base set of header definitions for the SLICOSS driver. |
| 40 | */ |
| 41 | #ifndef __SLIC_DRIVER_H__ |
| 42 | #define __SLIC_DRIVER_H__ |
| 43 | |
| 44 | |
| 45 | struct slic_spinlock { |
| 46 | spinlock_t lock; |
| 47 | unsigned long flags; |
| 48 | }; |
| 49 | |
| 50 | #define SLIC_RSPQ_PAGES_GB 10 |
| 51 | #define SLIC_RSPQ_BUFSINPAGE (PAGE_SIZE / SLIC_RSPBUF_SIZE) |
| 52 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 53 | struct slic_rspqueue { |
| 54 | u32 offset; |
| 55 | u32 pageindex; |
| 56 | u32 num_pages; |
| 57 | struct slic_rspbuf *rspbuf; |
| 58 | u32 *vaddr[SLIC_RSPQ_PAGES_GB]; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 59 | dma_addr_t paddr[SLIC_RSPQ_PAGES_GB]; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 60 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 61 | |
| 62 | #define SLIC_RCVQ_EXPANSION 1 |
| 63 | #define SLIC_RCVQ_ENTRIES (256 * SLIC_RCVQ_EXPANSION) |
| 64 | #define SLIC_RCVQ_MINENTRIES (SLIC_RCVQ_ENTRIES / 2) |
| 65 | #define SLIC_RCVQ_MAX_PROCESS_ISR ((SLIC_RCVQ_ENTRIES * 4)) |
| 66 | #define SLIC_RCVQ_RCVBUFSIZE 2048 |
| 67 | #define SLIC_RCVQ_FILLENTRIES (16 * SLIC_RCVQ_EXPANSION) |
| 68 | #define SLIC_RCVQ_FILLTHRESH (SLIC_RCVQ_ENTRIES - SLIC_RCVQ_FILLENTRIES) |
| 69 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 70 | struct slic_rcvqueue { |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 71 | struct sk_buff *head; |
| 72 | struct sk_buff *tail; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 73 | u32 count; |
| 74 | u32 size; |
| 75 | u32 errors; |
| 76 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 77 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 78 | struct slic_rcvbuf_info { |
| 79 | u32 id; |
| 80 | u32 starttime; |
| 81 | u32 stoptime; |
| 82 | u32 slicworld; |
| 83 | u32 lasttime; |
| 84 | u32 lastid; |
| 85 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 86 | /* |
| 87 | SLIC Handle structure. Used to restrict handle values to |
| 88 | 32 bits by using an index rather than an address. |
| 89 | Simplifies ucode in 64-bit systems |
| 90 | */ |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 91 | struct slic_handle_word { |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 92 | union { |
| 93 | struct { |
| 94 | ushort index; |
| 95 | ushort bottombits; /* to denote num bufs to card */ |
| 96 | } parts; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 97 | u32 whole; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 98 | } handle; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 99 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 100 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 101 | struct slic_handle { |
| 102 | struct slic_handle_word token; /* token passed between host and card*/ |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 103 | ushort type; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 104 | void *address; /* actual address of the object*/ |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 105 | ushort offset; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 106 | struct slic_handle *other_handle; |
| 107 | struct slic_handle *next; |
| 108 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 109 | |
| 110 | #define SLIC_HANDLE_FREE 0x0000 |
| 111 | #define SLIC_HANDLE_DATA 0x0001 |
| 112 | #define SLIC_HANDLE_CMD 0x0002 |
| 113 | #define SLIC_HANDLE_CONTEXT 0x0003 |
| 114 | #define SLIC_HANDLE_TEAM 0x0004 |
| 115 | |
| 116 | #define handle_index handle.parts.index |
| 117 | #define handle_bottom handle.parts.bottombits |
| 118 | #define handle_token handle.whole |
| 119 | |
| 120 | #define SLIC_HOSTCMD_SIZE 512 |
| 121 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 122 | struct slic_hostcmd { |
| 123 | struct slic_host64_cmd cmd64; |
| 124 | u32 type; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 125 | struct sk_buff *skb; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 126 | u32 paddrl; |
| 127 | u32 paddrh; |
| 128 | u32 busy; |
| 129 | u32 cmdsize; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 130 | ushort numbufs; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 131 | struct slic_handle *pslic_handle;/* handle associated with command */ |
| 132 | struct slic_hostcmd *next; |
| 133 | struct slic_hostcmd *next_all; |
| 134 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 135 | |
| 136 | #define SLIC_CMDQ_CMDSINPAGE (PAGE_SIZE / SLIC_HOSTCMD_SIZE) |
| 137 | #define SLIC_CMD_DUMB 3 |
| 138 | #define SLIC_CMDQ_INITCMDS 256 |
| 139 | #define SLIC_CMDQ_MAXCMDS 256 |
| 140 | #define SLIC_CMDQ_MAXOUTSTAND SLIC_CMDQ_MAXCMDS |
| 141 | #define SLIC_CMDQ_MAXPAGES (SLIC_CMDQ_MAXCMDS / SLIC_CMDQ_CMDSINPAGE) |
| 142 | #define SLIC_CMDQ_INITPAGES (SLIC_CMDQ_INITCMDS / SLIC_CMDQ_CMDSINPAGE) |
| 143 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 144 | struct slic_cmdqmem { |
| 145 | int pagecnt; |
| 146 | u32 *pages[SLIC_CMDQ_MAXPAGES]; |
| 147 | dma_addr_t dma_pages[SLIC_CMDQ_MAXPAGES]; |
| 148 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 149 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 150 | struct slic_cmdqueue { |
| 151 | struct slic_hostcmd *head; |
| 152 | struct slic_hostcmd *tail; |
| 153 | int count; |
| 154 | struct slic_spinlock lock; |
| 155 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 156 | |
| 157 | #ifdef STATUS_SUCCESS |
| 158 | #undef STATUS_SUCCESS |
| 159 | #endif |
| 160 | |
| 161 | #define STATUS_SUCCESS 0 |
| 162 | #define STATUS_PENDING 0 |
| 163 | #define STATUS_FAILURE -1 |
| 164 | #define STATUS_ERROR -2 |
| 165 | #define STATUS_NOT_SUPPORTED -3 |
| 166 | #define STATUS_BUFFER_TOO_SHORT -4 |
| 167 | |
| 168 | #define SLIC_MAX_CARDS 32 |
| 169 | #define SLIC_MAX_PORTS 4 /* Max # of ports per card */ |
| 170 | #if SLIC_DUMP_ENABLED |
| 171 | /* |
| 172 | Dump buffer size |
| 173 | |
| 174 | This cannot be bigger than the max DMA size the card supports, |
| 175 | given the current code structure in the host and ucode. |
| 176 | Mojave supports 16K, Oasis supports 16K-1, so |
| 177 | just set this at 15K, shouldnt make that much of a diff. |
| 178 | */ |
| 179 | #define DUMP_BUF_SIZE 0x3C00 |
| 180 | #endif |
| 181 | |
| 182 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 183 | struct mcast_address { |
| 184 | unsigned char address[6]; |
| 185 | struct mcast_address *next; |
| 186 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 187 | |
| 188 | #define CARD_DOWN 0x00000000 |
| 189 | #define CARD_UP 0x00000001 |
| 190 | #define CARD_FAIL 0x00000002 |
| 191 | #define CARD_DIAG 0x00000003 |
| 192 | #define CARD_SLEEP 0x00000004 |
| 193 | |
| 194 | #define ADAPT_DOWN 0x00 |
| 195 | #define ADAPT_UP 0x01 |
| 196 | #define ADAPT_FAIL 0x02 |
| 197 | #define ADAPT_RESET 0x03 |
| 198 | #define ADAPT_SLEEP 0x04 |
| 199 | |
| 200 | #define ADAPT_FLAGS_BOOTTIME 0x0001 |
| 201 | #define ADAPT_FLAGS_IS64BIT 0x0002 |
| 202 | #define ADAPT_FLAGS_PENDINGLINKDOWN 0x0004 |
| 203 | #define ADAPT_FLAGS_FIBERMEDIA 0x0008 |
| 204 | #define ADAPT_FLAGS_LOCKS_ALLOCED 0x0010 |
| 205 | #define ADAPT_FLAGS_INT_REGISTERED 0x0020 |
| 206 | #define ADAPT_FLAGS_LOAD_TIMER_SET 0x0040 |
| 207 | #define ADAPT_FLAGS_STATS_TIMER_SET 0x0080 |
| 208 | #define ADAPT_FLAGS_RESET_TIMER_SET 0x0100 |
| 209 | |
| 210 | #define LINK_DOWN 0x00 |
| 211 | #define LINK_CONFIG 0x01 |
| 212 | #define LINK_UP 0x02 |
| 213 | |
| 214 | #define LINK_10MB 0x00 |
| 215 | #define LINK_100MB 0x01 |
| 216 | #define LINK_AUTOSPEED 0x02 |
| 217 | #define LINK_1000MB 0x03 |
| 218 | #define LINK_10000MB 0x04 |
| 219 | |
| 220 | #define LINK_HALFD 0x00 |
| 221 | #define LINK_FULLD 0x01 |
| 222 | #define LINK_AUTOD 0x02 |
| 223 | |
| 224 | #define MAC_DIRECTED 0x00000001 |
| 225 | #define MAC_BCAST 0x00000002 |
| 226 | #define MAC_MCAST 0x00000004 |
| 227 | #define MAC_PROMISC 0x00000008 |
| 228 | #define MAC_LOOPBACK 0x00000010 |
| 229 | #define MAC_ALLMCAST 0x00000020 |
| 230 | |
| 231 | #define SLIC_DUPLEX(x) ((x == LINK_FULLD) ? "FDX" : "HDX") |
| 232 | #define SLIC_SPEED(x) ((x == LINK_100MB) ? "100Mb" : ((x == LINK_1000MB) ?\ |
| 233 | "1000Mb" : " 10Mb")) |
| 234 | #define SLIC_LINKSTATE(x) ((x == LINK_DOWN) ? "Down" : "Up ") |
| 235 | #define SLIC_ADAPTER_STATE(x) ((x == ADAPT_UP) ? "UP" : "Down") |
| 236 | #define SLIC_CARD_STATE(x) ((x == CARD_UP) ? "UP" : "Down") |
| 237 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 238 | struct slic_iface_stats { |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 239 | /* |
| 240 | * Stats |
| 241 | */ |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 242 | u64 xmt_bytes; |
| 243 | u64 xmt_ucast; |
| 244 | u64 xmt_mcast; |
| 245 | u64 xmt_bcast; |
| 246 | u64 xmt_errors; |
| 247 | u64 xmt_discards; |
| 248 | u64 xmit_collisions; |
| 249 | u64 xmit_excess_xmit_collisions; |
| 250 | u64 rcv_bytes; |
| 251 | u64 rcv_ucast; |
| 252 | u64 rcv_mcast; |
| 253 | u64 rcv_bcast; |
| 254 | u64 rcv_errors; |
| 255 | u64 rcv_discards; |
| 256 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 257 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 258 | struct sliccp_stats { |
| 259 | u64 xmit_tcp_segs; |
| 260 | u64 xmit_tcp_bytes; |
| 261 | u64 rcv_tcp_segs; |
| 262 | u64 rcv_tcp_bytes; |
| 263 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 264 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 265 | struct slicnet_stats { |
| 266 | struct sliccp_stats tcp; |
| 267 | struct slic_iface_stats iface; |
| 268 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 269 | |
| 270 | #define SLIC_LOADTIMER_PERIOD 1 |
| 271 | #define SLIC_INTAGG_DEFAULT 200 |
| 272 | #define SLIC_LOAD_0 0 |
| 273 | #define SLIC_INTAGG_0 0 |
| 274 | #define SLIC_LOAD_1 8000 |
| 275 | #define SLIC_LOAD_2 10000 |
| 276 | #define SLIC_LOAD_3 12000 |
| 277 | #define SLIC_LOAD_4 14000 |
| 278 | #define SLIC_LOAD_5 16000 |
| 279 | #define SLIC_INTAGG_1 50 |
| 280 | #define SLIC_INTAGG_2 100 |
| 281 | #define SLIC_INTAGG_3 150 |
| 282 | #define SLIC_INTAGG_4 200 |
| 283 | #define SLIC_INTAGG_5 250 |
| 284 | #define SLIC_LOAD_1GB 3000 |
| 285 | #define SLIC_LOAD_2GB 6000 |
| 286 | #define SLIC_LOAD_3GB 12000 |
| 287 | #define SLIC_LOAD_4GB 24000 |
| 288 | #define SLIC_LOAD_5GB 48000 |
| 289 | #define SLIC_INTAGG_1GB 50 |
| 290 | #define SLIC_INTAGG_2GB 75 |
| 291 | #define SLIC_INTAGG_3GB 100 |
| 292 | #define SLIC_INTAGG_4GB 100 |
| 293 | #define SLIC_INTAGG_5GB 100 |
| 294 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 295 | struct ether_header { |
| 296 | unsigned char ether_dhost[6]; |
| 297 | unsigned char ether_shost[6]; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 298 | ushort ether_type; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 299 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 300 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 301 | struct sliccard { |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 302 | uint busnumber; |
| 303 | uint slotnumber; |
| 304 | uint state; |
| 305 | uint cardnum; |
| 306 | uint card_size; |
| 307 | uint adapters_activated; |
| 308 | uint adapters_allocated; |
| 309 | uint adapters_sleeping; |
| 310 | uint gennumber; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 311 | u32 events; |
| 312 | u32 loadlevel_current; |
| 313 | u32 load; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 314 | uint reset_in_progress; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 315 | u32 pingstatus; |
| 316 | u32 bad_pingstatus; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 317 | struct timer_list loadtimer; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 318 | u32 loadtimerset; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 319 | uint config_set; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 320 | struct slic_config config; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 321 | struct dentry *debugfs_dir; |
| 322 | struct dentry *debugfs_cardinfo; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 323 | struct adapter *master; |
| 324 | struct adapter *adapter[SLIC_MAX_PORTS]; |
| 325 | struct sliccard *next; |
| 326 | u32 error_interrupts; |
| 327 | u32 error_rmiss_interrupts; |
| 328 | u32 rcv_interrupts; |
| 329 | u32 xmit_interrupts; |
| 330 | u32 num_isrs; |
| 331 | u32 false_interrupts; |
| 332 | u32 max_isr_rcvs; |
| 333 | u32 max_isr_xmits; |
| 334 | u32 rcv_interrupt_yields; |
| 335 | u32 tx_packets; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 336 | #if SLIC_DUMP_ENABLED |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 337 | u32 dumpstatus; /* Result of dump UPR */ |
| 338 | void *cmdbuffer; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 339 | |
| 340 | ulong cmdbuffer_phys; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 341 | u32 cmdbuffer_physl; |
| 342 | u32 cmdbuffer_physh; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 343 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 344 | u32 dump_count; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 345 | struct task_struct *dump_task_id; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 346 | u32 dump_wait_count; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 347 | uint dumpthread_running; /* has a dump thread been init'd */ |
| 348 | uint dump_requested; /* 0 no, 1 = reqstd 2=curr 3=done */ |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 349 | u32 dumptime_start; |
| 350 | u32 dumptime_complete; |
| 351 | u32 dumptime_delta; |
| 352 | void *dumpbuffer; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 353 | ulong dumpbuffer_phys; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 354 | u32 dumpbuffer_physl; |
| 355 | u32 dumpbuffer_physh; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 356 | wait_queue_head_t dump_wq; |
| 357 | struct file *dumphandle; |
| 358 | mm_segment_t dumpfile_fs; |
| 359 | #endif |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 360 | u32 debug_ix; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 361 | ushort reg_type[32]; |
| 362 | ushort reg_offset[32]; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 363 | u32 reg_value[32]; |
| 364 | u32 reg_valueh[32]; |
| 365 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 366 | |
| 367 | #define NUM_CFG_SPACES 2 |
| 368 | #define NUM_CFG_REGS 64 |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 369 | #define NUM_CFG_REG_ULONGS (NUM_CFG_REGS / sizeof(u32)) |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 370 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 371 | struct physcard { |
| 372 | struct adapter *adapter[SLIC_MAX_PORTS]; |
| 373 | struct physcard *next; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 374 | uint adapters_allocd; |
| 375 | |
| 376 | /* the following is not currently needed |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 377 | u32 bridge_busnum; |
| 378 | u32 bridge_cfg[NUM_CFG_SPACES][NUM_CFG_REG_ULONGS]; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 379 | */ |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 380 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 381 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 382 | struct base_driver { |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 383 | struct slic_spinlock driver_lock; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 384 | u32 num_slic_cards; |
| 385 | u32 num_slic_ports; |
| 386 | u32 num_slic_ports_active; |
| 387 | u32 dynamic_intagg; |
| 388 | struct sliccard *slic_card; |
| 389 | struct physcard *phys_card; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 390 | uint cardnuminuse[SLIC_MAX_CARDS]; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 391 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 392 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 393 | struct slic_shmem { |
| 394 | volatile u32 isr; |
| 395 | volatile u32 linkstatus; |
| 396 | volatile struct slic_stats inicstats; |
| 397 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 398 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 399 | struct slic_reg_params { |
| 400 | u32 linkspeed; |
| 401 | u32 linkduplex; |
| 402 | u32 fail_on_bad_eeprom; |
| 403 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 404 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 405 | struct slic_upr { |
| 406 | uint adapter; |
| 407 | u32 upr_request; |
| 408 | u32 upr_data; |
| 409 | u32 upr_data_h; |
| 410 | u32 upr_buffer; |
| 411 | u32 upr_buffer_h; |
| 412 | struct slic_upr *next; |
| 413 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 414 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 415 | struct slic_ifevents { |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 416 | uint oflow802; |
| 417 | uint uflow802; |
| 418 | uint Tprtoflow; |
| 419 | uint rcvearly; |
| 420 | uint Bufov; |
| 421 | uint Carre; |
| 422 | uint Longe; |
| 423 | uint Invp; |
| 424 | uint Crc; |
| 425 | uint Drbl; |
| 426 | uint Code; |
| 427 | uint IpHlen; |
| 428 | uint IpLen; |
| 429 | uint IpCsum; |
| 430 | uint TpCsum; |
| 431 | uint TpHlen; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 432 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 433 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 434 | struct adapter { |
| 435 | void *ifp; |
| 436 | struct sliccard *card; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 437 | uint port; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 438 | struct physcard *physcard; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 439 | uint physport; |
| 440 | uint cardindex; |
| 441 | uint card_size; |
| 442 | uint chipid; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 443 | struct net_device *netdev; |
| 444 | struct net_device *next_netdevice; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 445 | struct slic_spinlock adapter_lock; |
| 446 | struct slic_spinlock reset_lock; |
| 447 | struct pci_dev *pcidev; |
| 448 | uint busnumber; |
| 449 | uint slotnumber; |
| 450 | uint functionnumber; |
| 451 | ushort vendid; |
| 452 | ushort devid; |
| 453 | ushort subsysid; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 454 | u32 irq; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 455 | void __iomem *memorybase; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 456 | u32 memorylength; |
| 457 | u32 drambase; |
| 458 | u32 dramlength; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 459 | uint queues_initialized; |
| 460 | uint allocated; |
| 461 | uint activated; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 462 | u32 intrregistered; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 463 | uint isp_initialized; |
| 464 | uint gennumber; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 465 | u32 curaddrupper; |
| 466 | struct slic_shmem *pshmem; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 467 | dma_addr_t phys_shmem; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 468 | u32 isrcopy; |
| 469 | __iomem struct slic_regs *slic_regs; |
| 470 | unsigned char state; |
| 471 | unsigned char linkstate; |
| 472 | unsigned char linkspeed; |
| 473 | unsigned char linkduplex; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 474 | uint flags; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 475 | unsigned char macaddr[6]; |
| 476 | unsigned char currmacaddr[6]; |
| 477 | u32 macopts; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 478 | ushort devflags_prev; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 479 | u64 mcastmask; |
| 480 | struct mcast_address *mcastaddrs; |
| 481 | struct slic_upr *upr_list; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 482 | uint upr_busy; |
| 483 | struct timer_list pingtimer; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 484 | u32 pingtimerset; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 485 | struct timer_list statstimer; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 486 | u32 statstimerset; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 487 | struct timer_list loadtimer; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 488 | u32 loadtimerset; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 489 | struct dentry *debugfs_entry; |
| 490 | struct slic_spinlock upr_lock; |
| 491 | struct slic_spinlock bit64reglock; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 492 | struct slic_rspqueue rspqueue; |
| 493 | struct slic_rcvqueue rcvqueue; |
| 494 | struct slic_cmdqueue cmdq_free; |
| 495 | struct slic_cmdqueue cmdq_done; |
| 496 | struct slic_cmdqueue cmdq_all; |
| 497 | struct slic_cmdqmem cmdqmem; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 498 | /* |
| 499 | * SLIC Handles |
| 500 | */ |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 501 | struct slic_handle slic_handles[SLIC_CMDQ_MAXCMDS+1]; /* Object handles*/ |
| 502 | struct slic_handle *pfree_slic_handles; /* Free object handles*/ |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 503 | struct slic_spinlock handle_lock; /* Object handle list lock*/ |
| 504 | ushort slic_handle_ix; |
| 505 | |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 506 | u32 xmitq_full; |
| 507 | u32 all_reg_writes; |
| 508 | u32 icr_reg_writes; |
| 509 | u32 isr_reg_writes; |
| 510 | u32 error_interrupts; |
| 511 | u32 error_rmiss_interrupts; |
| 512 | u32 rx_errors; |
| 513 | u32 rcv_drops; |
| 514 | u32 rcv_interrupts; |
| 515 | u32 xmit_interrupts; |
| 516 | u32 linkevent_interrupts; |
| 517 | u32 upr_interrupts; |
| 518 | u32 num_isrs; |
| 519 | u32 false_interrupts; |
| 520 | u32 tx_packets; |
| 521 | u32 xmit_completes; |
| 522 | u32 tx_drops; |
| 523 | u32 rcv_broadcasts; |
| 524 | u32 rcv_multicasts; |
| 525 | u32 rcv_unicasts; |
| 526 | u32 max_isr_rcvs; |
| 527 | u32 max_isr_xmits; |
| 528 | u32 rcv_interrupt_yields; |
| 529 | u32 intagg_period; |
| 530 | struct inicpm_state *inicpm_info; |
| 531 | void *pinicpm_info; |
| 532 | struct slic_reg_params reg_params; |
| 533 | struct slic_ifevents if_events; |
| 534 | struct slic_stats inicstats_prev; |
| 535 | struct slicnet_stats slic_stats; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 536 | struct net_device_stats stats; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 537 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 538 | |
| 539 | #if SLIC_DUMP_ENABLED |
| 540 | #define SLIC_DUMP_REQUESTED 1 |
| 541 | #define SLIC_DUMP_IN_PROGRESS 2 |
| 542 | #define SLIC_DUMP_DONE 3 |
| 543 | |
| 544 | /**************************************************************************** |
| 545 | * |
| 546 | * Microcode crash information structure. This |
| 547 | * structure is written out to the card's SRAM when the microcode panic's. |
| 548 | * |
| 549 | ****************************************************************************/ |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 550 | struct slic_crash_info { |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 551 | ushort cpu_id; |
| 552 | ushort crash_pc; |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 553 | }; |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 554 | |
| 555 | #define CRASH_INFO_OFFSET 0x155C |
| 556 | |
| 557 | #endif |
| 558 | |
| 559 | #define UPDATE_STATS(largestat, newstat, oldstat) \ |
| 560 | { \ |
| 561 | if ((newstat) < (oldstat)) \ |
| 562 | (largestat) += ((newstat) + (0xFFFFFFFF - oldstat + 1)); \ |
| 563 | else \ |
| 564 | (largestat) += ((newstat) - (oldstat)); \ |
| 565 | } |
| 566 | |
| 567 | #define UPDATE_STATS_GB(largestat, newstat, oldstat) \ |
| 568 | { \ |
| 569 | (largestat) += ((newstat) - (oldstat)); \ |
| 570 | } |
| 571 | |
| 572 | #define ETHER_EQ_ADDR(_AddrA, _AddrB, _Result) \ |
| 573 | { \ |
| 574 | _Result = TRUE; \ |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 575 | if (*(u32 *)(_AddrA) != *(u32 *)(_AddrB)) \ |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 576 | _Result = FALSE; \ |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 577 | if (*(u16 *)(&((_AddrA)[4])) != *(u16 *)(&((_AddrB)[4]))) \ |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 578 | _Result = FALSE; \ |
| 579 | } |
| 580 | |
| 581 | #if defined(CONFIG_X86_64) || defined(CONFIG_IA64) |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 582 | #define SLIC_GET_ADDR_LOW(_addr) (u32)((u64)(_addr) & \ |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 583 | 0x00000000FFFFFFFF) |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 584 | #define SLIC_GET_ADDR_HIGH(_addr) (u32)(((u64)(_addr) >> 32) & \ |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 585 | 0x00000000FFFFFFFF) |
| 586 | #else |
Lior Dotan | e9eff9d | 2008-10-04 07:10:28 +0300 | [diff] [blame^] | 587 | #define SLIC_GET_ADDR_LOW(_addr) (u32)_addr |
| 588 | #define SLIC_GET_ADDR_HIGH(_addr) (u32)0 |
Greg Kroah-Hartman | 4d6f6af | 2008-03-19 14:27:25 -0700 | [diff] [blame] | 589 | #endif |
| 590 | |
| 591 | #define FLUSH TRUE |
| 592 | #define DONT_FLUSH FALSE |
| 593 | |
| 594 | #define SIOCSLICDUMPCARD (SIOCDEVPRIVATE+9) |
| 595 | #define SIOCSLICSETINTAGG (SIOCDEVPRIVATE+10) |
| 596 | #define SIOCSLICTRACEDUMP (SIOCDEVPRIVATE+11) |
| 597 | |
| 598 | #endif /* __SLIC_DRIVER_H__ */ |