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