ispvar.h (161269) | ispvar.h (163899) |
---|---|
1/* $FreeBSD: head/sys/dev/isp/ispvar.h 161269 2006-08-14 05:35:41Z mjacob $ */ | 1/* $FreeBSD: head/sys/dev/isp/ispvar.h 163899 2006-11-02 03:21:32Z mjacob $ */ |
2/*- 3 * Soft Definitions for for Qlogic ISP SCSI adapters. 4 * 5 * Copyright (c) 1997-2006 by Matthew Jacob 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 16 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#ifndef _ISPVAR_H 31#define _ISPVAR_H 32 33#if defined(__NetBSD__) || defined(__OpenBSD__) | 2/*- 3 * Soft Definitions for for Qlogic ISP SCSI adapters. 4 * 5 * Copyright (c) 1997-2006 by Matthew Jacob 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions --- 16 unchanged lines hidden (view full) --- 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#ifndef _ISPVAR_H 31#define _ISPVAR_H 32 33#if defined(__NetBSD__) || defined(__OpenBSD__) |
34#include <dev/ic/isp_stds.h> |
|
34#include <dev/ic/ispmbox.h> 35#endif 36#ifdef __FreeBSD__ | 35#include <dev/ic/ispmbox.h> 36#endif 37#ifdef __FreeBSD__ |
38#include <dev/isp/isp_stds.h> |
|
37#include <dev/isp/ispmbox.h> 38#endif 39#ifdef __linux__ | 39#include <dev/isp/ispmbox.h> 40#endif 41#ifdef __linux__ |
42#include "isp_stds.h" |
|
40#include "ispmbox.h" 41#endif 42#ifdef __svr4__ | 43#include "ispmbox.h" 44#endif 45#ifdef __svr4__ |
46#include "isp_stds.h" |
|
43#include "ispmbox.h" 44#endif 45 | 47#include "ispmbox.h" 48#endif 49 |
46#define ISP_CORE_VERSION_MAJOR 2 47#define ISP_CORE_VERSION_MINOR 11 | 50#define ISP_CORE_VERSION_MAJOR 3 51#define ISP_CORE_VERSION_MINOR 0 |
48 49/* 50 * Vector for bus specific code to provide specific services. 51 */ 52typedef struct ispsoftc ispsoftc_t; 53struct ispmdvec { 54 int (*dv_rd_isr) | 52 53/* 54 * Vector for bus specific code to provide specific services. 55 */ 56typedef struct ispsoftc ispsoftc_t; 57struct ispmdvec { 58 int (*dv_rd_isr) |
55 (ispsoftc_t *, uint16_t *, uint16_t *, uint16_t *); 56 uint16_t (*dv_rd_reg) (ispsoftc_t *, int); 57 void (*dv_wr_reg) (ispsoftc_t *, int, uint16_t); | 59 (ispsoftc_t *, uint32_t *, uint16_t *, uint16_t *); 60 uint32_t (*dv_rd_reg) (ispsoftc_t *, int); 61 void (*dv_wr_reg) (ispsoftc_t *, int, uint32_t); |
58 int (*dv_mbxdma) (ispsoftc_t *); 59 int (*dv_dmaset) | 62 int (*dv_mbxdma) (ispsoftc_t *); 63 int (*dv_dmaset) |
60 (ispsoftc_t *, XS_T *, ispreq_t *, uint16_t *, uint16_t); 61 void (*dv_dmaclr) (ispsoftc_t *, XS_T *, uint16_t); | 64 (ispsoftc_t *, XS_T *, ispreq_t *, uint32_t *, uint32_t); 65 void (*dv_dmaclr) (ispsoftc_t *, XS_T *, uint32_t); |
62 void (*dv_reset0) (ispsoftc_t *); 63 void (*dv_reset1) (ispsoftc_t *); 64 void (*dv_dregs) (ispsoftc_t *, const char *); | 66 void (*dv_reset0) (ispsoftc_t *); 67 void (*dv_reset1) (ispsoftc_t *); 68 void (*dv_dregs) (ispsoftc_t *, const char *); |
65 uint16_t *dv_ispfw; /* ptr to f/w */ | 69 void * dv_ispfw; /* ptr to f/w */ |
66 uint16_t dv_conf1; 67 uint16_t dv_clock; /* clock frequency */ 68}; 69 70/* 71 * Overall parameters 72 */ 73#define MAX_TARGETS 16 --- 43 unchanged lines hidden (view full) --- 117 * 118 * Defined Memory Barrier Synchronization Types 119 */ 120#define SYNC_REQUEST 0 /* request queue synchronization */ 121#define SYNC_RESULT 1 /* result queue synchronization */ 122#define SYNC_SFORDEV 2 /* scratch, sync for ISP */ 123#define SYNC_SFORCPU 3 /* scratch, sync for CPU */ 124#define SYNC_REG 4 /* for registers */ | 70 uint16_t dv_conf1; 71 uint16_t dv_clock; /* clock frequency */ 72}; 73 74/* 75 * Overall parameters 76 */ 77#define MAX_TARGETS 16 --- 43 unchanged lines hidden (view full) --- 121 * 122 * Defined Memory Barrier Synchronization Types 123 */ 124#define SYNC_REQUEST 0 /* request queue synchronization */ 125#define SYNC_RESULT 1 /* result queue synchronization */ 126#define SYNC_SFORDEV 2 /* scratch, sync for ISP */ 127#define SYNC_SFORCPU 3 /* scratch, sync for CPU */ 128#define SYNC_REG 4 /* for registers */ |
129#define SYNC_ATIOQ 5 /* atio result queue (24xx) */ |
|
125 126/* 127 * Request/Response Queue defines and macros. 128 * The maximum is defined per platform (and can be based on board type). 129 */ 130/* This is the size of a queue entry (request and response) */ 131#define QENTRY_LEN 64 132/* Both request and result queue length must be a power of two */ --- 10 unchanged lines hidden (view full) --- 143#define ISP_QFREE(in, out, qlen) \ 144 ((in == out)? (qlen - 1) : ((in > out)? \ 145 ((qlen - 1) - (in - out)) : (out - in - 1))) 146#define ISP_QAVAIL(isp) \ 147 ISP_QFREE(isp->isp_reqidx, isp->isp_reqodx, RQUEST_QUEUE_LEN(isp)) 148 149#define ISP_ADD_REQUEST(isp, nxti) \ 150 MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN); \ | 130 131/* 132 * Request/Response Queue defines and macros. 133 * The maximum is defined per platform (and can be based on board type). 134 */ 135/* This is the size of a queue entry (request and response) */ 136#define QENTRY_LEN 64 137/* Both request and result queue length must be a power of two */ --- 10 unchanged lines hidden (view full) --- 148#define ISP_QFREE(in, out, qlen) \ 149 ((in == out)? (qlen - 1) : ((in > out)? \ 150 ((qlen - 1) - (in - out)) : (out - in - 1))) 151#define ISP_QAVAIL(isp) \ 152 ISP_QFREE(isp->isp_reqidx, isp->isp_reqodx, RQUEST_QUEUE_LEN(isp)) 153 154#define ISP_ADD_REQUEST(isp, nxti) \ 155 MEMORYBARRIER(isp, SYNC_REQUEST, isp->isp_reqidx, QENTRY_LEN); \ |
151 WRITE_REQUEST_QUEUE_IN_POINTER(isp, nxti); \ | 156 ISP_WRITE(isp, isp->isp_rqstinrp, nxti); \ |
152 isp->isp_reqidx = nxti 153 154/* 155 * SCSI Specific Host Adapter Parameters- per bus, per target 156 */ 157typedef struct { 158 uint32_t isp_gotdparms : 1, 159 isp_req_ack_active_neg : 1, 160 isp_data_line_active_neg: 1, 161 isp_cmd_dma_burst_enable: 1, 162 isp_data_dma_burst_enabl: 1, 163 isp_fifo_threshold : 3, | 157 isp->isp_reqidx = nxti 158 159/* 160 * SCSI Specific Host Adapter Parameters- per bus, per target 161 */ 162typedef struct { 163 uint32_t isp_gotdparms : 1, 164 isp_req_ack_active_neg : 1, 165 isp_data_line_active_neg: 1, 166 isp_cmd_dma_burst_enable: 1, 167 isp_data_dma_burst_enabl: 1, 168 isp_fifo_threshold : 3, |
169 isp_ptisp : 1, |
|
164 isp_ultramode : 1, 165 isp_diffmode : 1, 166 isp_lvdmode : 1, 167 isp_fast_mttr : 1, /* fast sram */ 168 isp_initiator_id : 4, 169 isp_async_data_setup : 4; 170 uint16_t isp_selection_timeout; 171 uint16_t isp_max_queue_depth; --- 45 unchanged lines hidden (view full) --- 217#define ISP_10M_SYNCPARMS 0x0c19 218#define ISP_08M_SYNCPARMS 0x0c25 219#define ISP_05M_SYNCPARMS 0x0c32 220#define ISP_04M_SYNCPARMS 0x0c41 221 222/* 223 * Fibre Channel Specifics 224 */ | 170 isp_ultramode : 1, 171 isp_diffmode : 1, 172 isp_lvdmode : 1, 173 isp_fast_mttr : 1, /* fast sram */ 174 isp_initiator_id : 4, 175 isp_async_data_setup : 4; 176 uint16_t isp_selection_timeout; 177 uint16_t isp_max_queue_depth; --- 45 unchanged lines hidden (view full) --- 223#define ISP_10M_SYNCPARMS 0x0c19 224#define ISP_08M_SYNCPARMS 0x0c25 225#define ISP_05M_SYNCPARMS 0x0c32 226#define ISP_04M_SYNCPARMS 0x0c41 227 228/* 229 * Fibre Channel Specifics 230 */ |
225#define FL_PORT_ID 0x7e /* FL_Port Special ID */ 226#define FC_PORT_ID 0x7f /* Fabric Controller Special ID */ 227#define FC_SNS_ID 0x80 /* SNS Server Special ID */ | 231/* These are for 2100/2200/2300 cards */ 232#define FL_ID 0x7e /* FL_Port Special ID */ 233#define SNS_ID 0x80 /* SNS Server Special ID */ 234#define NPH_MAX 0xfe |
228 | 235 |
229/* #define ISP_USE_GA_NXT 1 */ /* Use GA_NXT with switches */ 230#ifndef GA_NXT_MAX 231#define GA_NXT_MAX 256 232#endif | 236/* These are for 24XX cards */ 237#define NPH_RESERVED 0x7F0 /* begin of reserved N-port handles */ 238#define NPH_MGT_ID 0x7FA /* Management Server Special ID */ 239#define NPH_SNS_ID 0x7FC /* SNS Server Special ID */ 240#define NPH_FL_ID 0x7FE /* FL Port Special ID */ 241#define NPH_MAX_24XX 0x800 |
233 | 242 |
243/* 244 * Limit for devices on an arbitrated loop. 245 */ 246#define LOCAL_LOOP_LIM 126 247 248/* 249 * Special Port IDs 250 */ 251#define MANAGEMENT_PORT_ID 0xFFFFFA 252#define SNS_PORT_ID 0xFFFFFC 253#define FABRIC_PORT_ID 0xFFFFFE 254 255 256/* 257 * FC Port Database entry. 258 * 259 * It has a handle that the f/w uses to address commands to a device. 260 * This handle's value may be assigned by the firmware (e.g., for local loop 261 * devices) or by the driver (e.g., for fabric devices). 262 * 263 * It has a state. If the state if VALID, that means that we've logged into 264 * the device. We also *may* have a initiator map index entry. This is a value 265 * from 0..MAX_FC_TARG that is used to index into the isp_ini_map array. If 266 * the value therein is non-zero, then that value minus one is used to index 267 * into the Port Database to find the handle for forming commands. There is 268 * back-index minus one value within to Port Database entry that tells us 269 * which entry in isp_ini_map points to us (to avoid searching). 270 * 271 * Local loop devices the firmware automatically performs PLOGI on for us 272 * (which is why that handle is imposed upon us). Fabric devices we assign 273 * a handle to and perform the PLOGI on. 274 * 275 * When a PORT DATABASE CHANGED asynchronous event occurs, we mark all VALID 276 * entries as PROBATIONAL. This allows us, if policy says to, just keep track 277 * of devices whose handles change but are otherwise the same device (and 278 * thus keep 'target' constant). 279 * 280 * In any case, we search all possible local loop handles. For each one that 281 * has a port database entity returned, we search for any PROBATIONAL entry 282 * that matches it and update as appropriate. Otherwise, as a new entry, we 283 * find room for it in the Port Database. We *try* and use the handle as the 284 * index to put it into the Database, but that's just an optimization. We mark 285 * the entry VALID and make sure that the target index is updated and correct. 286 * 287 * When we get done searching the local loop, we then search similarily for 288 * a list of devices we've gotten from the fabric name controller (if we're 289 * on a fabric). VALID marking is also done similarily. 290 * 291 * When all of this is done, we can march through the database and clean up 292 * any entry that is still PROBATIONAL (these represent devices which have 293 * departed). Then we're done and can resume normal operations. 294 * 295 * Negative invariants that we try and test for are: 296 * 297 * + There can never be two non-NIL entries with the same { Port, Node } WWN 298 * duples. 299 * 300 * + There can never be two non-NIL entries with the same handle. 301 * 302 * + There can never be two non-NIL entries which have the same ini_map_idx 303 * value. 304 */ |
|
234typedef struct { | 305typedef struct { |
235 uint32_t : 13, | 306 uint16_t handle; 307 uint16_t ini_map_idx : 12, 308 autologin : 1, /* F/W does PLOGI/PLOGO */ 309 state : 3; 310 uint32_t : 6, 311 roles : 2, 312 portid : 24; 313 uint32_t : 6, 314 new_roles : 2, 315 new_portid : 24; 316 uint64_t node_wwn; 317 uint64_t port_wwn; 318} fcportdb_t; 319 320#define FC_PORTDB_STATE_NIL 0 321#define FC_PORTDB_STATE_PROBATIONAL 1 322#define FC_PORTDB_STATE_DEAD 2 323#define FC_PORTDB_STATE_CHANGED 3 324#define FC_PORTDB_STATE_NEW 4 325#define FC_PORTDB_STATE_PENDING_VALID 5 326#define FC_PORTDB_STATE_VALID 7 327 328/* 329 * FC card specific information 330 */ 331typedef struct { 332 uint32_t : 10, 333 isp_tmode : 1, 334 isp_2klogin : 1, 335 isp_sccfw : 1, |
236 isp_gbspeed : 3, 237 : 1, | 336 isp_gbspeed : 3, 337 : 1, |
238 isp_iid_set : 1, 239 loop_seen_once : 1, | 338 : 1, 339 : 1, |
240 isp_loopstate : 4, /* Current Loop State */ 241 isp_fwstate : 4, /* ISP F/W state */ 242 isp_gotdparms : 1, 243 isp_topo : 3, | 340 isp_loopstate : 4, /* Current Loop State */ 341 isp_fwstate : 4, /* ISP F/W state */ 342 isp_gotdparms : 1, 343 isp_topo : 3, |
244 isp_onfabric : 1; | 344 loop_seen_once : 1; |
245 uint32_t : 8, 246 isp_portid : 24; /* S_ID */ 247 uint16_t isp_fwoptions; 248 uint16_t isp_xfwoptions; 249 uint16_t isp_zfwoptions; | 345 uint32_t : 8, 346 isp_portid : 24; /* S_ID */ 347 uint16_t isp_fwoptions; 348 uint16_t isp_xfwoptions; 349 uint16_t isp_zfwoptions; |
250 uint16_t isp_iid; /* 'initiator' id */ | |
251 uint16_t isp_loopid; /* hard loop id */ 252 uint16_t isp_fwattr; /* firmware attributes */ 253 uint16_t isp_execthrottle; 254 uint8_t isp_retry_delay; 255 uint8_t isp_retry_count; 256 uint8_t isp_reserved; 257 uint16_t isp_maxalloc; 258 uint16_t isp_maxfrmlen; 259 uint64_t isp_nodewwn; 260 uint64_t isp_portwwn; | 350 uint16_t isp_loopid; /* hard loop id */ 351 uint16_t isp_fwattr; /* firmware attributes */ 352 uint16_t isp_execthrottle; 353 uint8_t isp_retry_delay; 354 uint8_t isp_retry_count; 355 uint8_t isp_reserved; 356 uint16_t isp_maxalloc; 357 uint16_t isp_maxfrmlen; 358 uint64_t isp_nodewwn; 359 uint64_t isp_portwwn; |
360 fcportdb_t portdb[MAX_FC_TARG]; 361 uint16_t isp_ini_map[MAX_FC_TARG]; |
|
261 /* | 362 /* |
262 * Port Data Base. This is indexed by 'target', which is invariate. 263 * However, elements within can move around due to loop changes, 264 * so the actual loop ID passed to the F/W is in this structure. 265 * The first time the loop is seen up, loopid will match the index 266 * (except for fabric nodes which are above mapped above FC_SNS_ID 267 * and are completely virtual), but subsequent LIPs can cause things 268 * to move around. 269 */ 270 struct lportdb { 271 uint32_t loopid : 16, 272 : 2, 273 fc4_type : 4, 274 last_fabric_dev : 1, 275 relogin : 1, 276 force_logout : 1, 277 was_fabric_dev : 1, 278 fabric_dev : 1, 279 loggedin : 1, 280 roles : 2, 281 tvalid : 1, 282 valid : 1; 283 uint32_t port_type : 8, 284 portid : 24; 285 uint64_t node_wwn; 286 uint64_t port_wwn; 287 } portdb[MAX_FC_TARG], tport[FC_PORT_ID]; 288 289 /* | |
290 * Scratch DMA mapped in area to fetch Port Database stuff, etc. 291 */ 292 void * isp_scratch; 293 XS_DMA_ADDR_T isp_scdma; 294#ifdef ISP_FW_CRASH_DUMP 295 uint16_t * isp_dump_data; 296#endif 297} fcparam; --- 5 unchanged lines hidden (view full) --- 303#define FW_LOSS_OF_SYNC 4 304#define FW_ERROR 5 305#define FW_REINIT 6 306#define FW_NON_PART 7 307 308#define LOOP_NIL 0 309#define LOOP_LIP_RCVD 1 310#define LOOP_PDB_RCVD 2 | 363 * Scratch DMA mapped in area to fetch Port Database stuff, etc. 364 */ 365 void * isp_scratch; 366 XS_DMA_ADDR_T isp_scdma; 367#ifdef ISP_FW_CRASH_DUMP 368 uint16_t * isp_dump_data; 369#endif 370} fcparam; --- 5 unchanged lines hidden (view full) --- 376#define FW_LOSS_OF_SYNC 4 377#define FW_ERROR 5 378#define FW_REINIT 6 379#define FW_NON_PART 7 380 381#define LOOP_NIL 0 382#define LOOP_LIP_RCVD 1 383#define LOOP_PDB_RCVD 2 |
311#define LOOP_SCANNING_FABRIC 3 312#define LOOP_FSCAN_DONE 4 313#define LOOP_SCANNING_LOOP 5 314#define LOOP_LSCAN_DONE 6 | 384#define LOOP_SCANNING_LOOP 3 385#define LOOP_LSCAN_DONE 4 386#define LOOP_SCANNING_FABRIC 5 387#define LOOP_FSCAN_DONE 6 |
315#define LOOP_SYNCING_PDB 7 316#define LOOP_READY 8 317 318#define TOPO_NL_PORT 0 319#define TOPO_FL_PORT 1 320#define TOPO_N_PORT 2 321#define TOPO_F_PORT 3 322#define TOPO_PTP_STUB 4 --- 22 unchanged lines hidden (view full) --- 345 uint16_t isp_romfw_rev[3]; /* PROM F/W revision */ 346 uint16_t isp_maxcmds; /* max possible I/O cmds */ 347 uint8_t isp_type; /* HBA Chip Type */ 348 uint8_t isp_revision; /* HBA Chip H/W Revision */ 349 uint32_t isp_maxluns; /* maximum luns supported */ 350 351 uint32_t isp_clock : 8, /* input clock */ 352 : 4, | 388#define LOOP_SYNCING_PDB 7 389#define LOOP_READY 8 390 391#define TOPO_NL_PORT 0 392#define TOPO_FL_PORT 1 393#define TOPO_N_PORT 2 394#define TOPO_F_PORT 3 395#define TOPO_PTP_STUB 4 --- 22 unchanged lines hidden (view full) --- 418 uint16_t isp_romfw_rev[3]; /* PROM F/W revision */ 419 uint16_t isp_maxcmds; /* max possible I/O cmds */ 420 uint8_t isp_type; /* HBA Chip Type */ 421 uint8_t isp_revision; /* HBA Chip H/W Revision */ 422 uint32_t isp_maxluns; /* maximum luns supported */ 423 424 uint32_t isp_clock : 8, /* input clock */ 425 : 4, |
353 isp_port : 1, /* 23XX only */ | 426 isp_port : 1, /* 23XX/24XX only */ |
354 isp_failed : 1, /* board failed */ 355 isp_open : 1, /* opened (ioctl) */ 356 isp_touched : 1, /* board ever seen? */ 357 isp_bustype : 1, /* SBus or PCI */ 358 isp_loaded_fw : 1, /* loaded firmware */ 359 isp_role : 2, /* roles supported */ 360 isp_dblev : 12; /* debug log mask */ 361 362 uint32_t isp_confopts; /* config options */ 363 | 427 isp_failed : 1, /* board failed */ 428 isp_open : 1, /* opened (ioctl) */ 429 isp_touched : 1, /* board ever seen? */ 430 isp_bustype : 1, /* SBus or PCI */ 431 isp_loaded_fw : 1, /* loaded firmware */ 432 isp_role : 2, /* roles supported */ 433 isp_dblev : 12; /* debug log mask */ 434 435 uint32_t isp_confopts; /* config options */ 436 |
364 uint16_t isp_rqstinrp; /* register for REQINP */ 365 uint16_t isp_rqstoutrp; /* register for REQOUTP */ 366 uint16_t isp_respinrp; /* register for RESINP */ 367 uint16_t isp_respoutrp; /* register for RESOUTP */ | 437 uint32_t isp_rqstinrp; /* register for REQINP */ 438 uint32_t isp_rqstoutrp; /* register for REQOUTP */ 439 uint32_t isp_respinrp; /* register for RESINP */ 440 uint32_t isp_respoutrp; /* register for RESOUTP */ 441 uint32_t isp_atioinrp; /* register for ATIOINP */ 442 uint32_t isp_atiooutrp; /* register for ATIOOUTP */ |
368 369 /* 370 * Instrumentation 371 */ 372 uint64_t isp_intcnt; /* total int count */ 373 uint64_t isp_intbogus; /* spurious int count */ 374 uint64_t isp_intmboxc; /* mbox completions */ 375 uint64_t isp_intoasync; /* other async */ --- 7 unchanged lines hidden (view full) --- 383 */ 384 385 volatile uint32_t : 8, 386 isp_mboxbsy : 1, /* mailbox command active */ 387 isp_state : 3, 388 isp_sendmarker : 2, /* send a marker entry */ 389 isp_update : 2, /* update parameters */ 390 isp_nactive : 16; /* how many commands active */ | 443 444 /* 445 * Instrumentation 446 */ 447 uint64_t isp_intcnt; /* total int count */ 448 uint64_t isp_intbogus; /* spurious int count */ 449 uint64_t isp_intmboxc; /* mbox completions */ 450 uint64_t isp_intoasync; /* other async */ --- 7 unchanged lines hidden (view full) --- 458 */ 459 460 volatile uint32_t : 8, 461 isp_mboxbsy : 1, /* mailbox command active */ 462 isp_state : 3, 463 isp_sendmarker : 2, /* send a marker entry */ 464 isp_update : 2, /* update parameters */ 465 isp_nactive : 16; /* how many commands active */ |
391 volatile uint16_t isp_reqodx; /* index of last ISP pickup */ 392 volatile uint16_t isp_reqidx; /* index of next request */ 393 volatile uint16_t isp_residx; /* index of next result */ 394 volatile uint16_t isp_resodx; /* index of next result */ 395 volatile uint16_t isp_rspbsy; 396 volatile uint16_t isp_lasthdls; /* last handle seed */ 397 volatile uint16_t isp_obits; /* mailbox command output */ | 466 volatile uint32_t isp_reqodx; /* index of last ISP pickup */ 467 volatile uint32_t isp_reqidx; /* index of next request */ 468 volatile uint32_t isp_residx; /* index of next result */ 469 volatile uint32_t isp_resodx; /* index of next result */ 470 volatile uint32_t isp_rspbsy; 471 volatile uint32_t isp_lasthdls; /* last handle seed */ 472 volatile uint32_t isp_obits; /* mailbox command output */ |
398 volatile uint16_t isp_mboxtmp[MAILBOX_STORAGE]; 399 volatile uint16_t isp_lastmbxcmd; /* last mbox command sent */ 400 volatile uint16_t isp_mbxwrk0; 401 volatile uint16_t isp_mbxwrk1; 402 volatile uint16_t isp_mbxwrk2; 403 volatile uint16_t isp_mbxwrk8; 404 void * isp_mbxworkp; 405 --- 11 unchanged lines hidden (view full) --- 417 418 /* 419 * request/result queue pointers and DMA handles for them. 420 */ 421 void * isp_rquest; 422 void * isp_result; 423 XS_DMA_ADDR_T isp_rquest_dma; 424 XS_DMA_ADDR_T isp_result_dma; | 473 volatile uint16_t isp_mboxtmp[MAILBOX_STORAGE]; 474 volatile uint16_t isp_lastmbxcmd; /* last mbox command sent */ 475 volatile uint16_t isp_mbxwrk0; 476 volatile uint16_t isp_mbxwrk1; 477 volatile uint16_t isp_mbxwrk2; 478 volatile uint16_t isp_mbxwrk8; 479 void * isp_mbxworkp; 480 --- 11 unchanged lines hidden (view full) --- 492 493 /* 494 * request/result queue pointers and DMA handles for them. 495 */ 496 void * isp_rquest; 497 void * isp_result; 498 XS_DMA_ADDR_T isp_rquest_dma; 499 XS_DMA_ADDR_T isp_result_dma; |
500#ifdef ISP_TARGET_MODE 501 /* for 24XX only */ 502 void * isp_atioq; 503 XS_DMA_ADDR_T isp_atioq_dma; 504#endif |
|
425}; 426 427#define SDPARAM(isp) ((sdparam *) (isp)->isp_param) 428#define FCPARAM(isp) ((fcparam *) (isp)->isp_param) 429 430/* 431 * ISP Driver Run States 432 */ --- 16 unchanged lines hidden (view full) --- 449#define ISP_CFG_NPORT 0x04 /* prefer {N/F}-Port connection */ 450#define ISP_CFG_NPORT_ONLY 0x08 /* insist on {N/F}-Port connection */ 451#define ISP_CFG_LPORT_ONLY 0x0C /* insist on {N/F}L-Port connection */ 452#define ISP_CFG_OWNWWPN 0x100 /* override NVRAM wwpn */ 453#define ISP_CFG_OWNWWNN 0x200 /* override NVRAM wwnn */ 454#define ISP_CFG_OWNFSZ 0x400 /* override NVRAM frame size */ 455#define ISP_CFG_OWNLOOPID 0x800 /* override NVRAM loopid */ 456#define ISP_CFG_OWNEXCTHROTTLE 0x1000 /* override NVRAM execution throttle */ | 505}; 506 507#define SDPARAM(isp) ((sdparam *) (isp)->isp_param) 508#define FCPARAM(isp) ((fcparam *) (isp)->isp_param) 509 510/* 511 * ISP Driver Run States 512 */ --- 16 unchanged lines hidden (view full) --- 529#define ISP_CFG_NPORT 0x04 /* prefer {N/F}-Port connection */ 530#define ISP_CFG_NPORT_ONLY 0x08 /* insist on {N/F}-Port connection */ 531#define ISP_CFG_LPORT_ONLY 0x0C /* insist on {N/F}L-Port connection */ 532#define ISP_CFG_OWNWWPN 0x100 /* override NVRAM wwpn */ 533#define ISP_CFG_OWNWWNN 0x200 /* override NVRAM wwnn */ 534#define ISP_CFG_OWNFSZ 0x400 /* override NVRAM frame size */ 535#define ISP_CFG_OWNLOOPID 0x800 /* override NVRAM loopid */ 536#define ISP_CFG_OWNEXCTHROTTLE 0x1000 /* override NVRAM execution throttle */ |
537#define ISP_CFG_FOURGB 0x2000 /* force 4GB connection (24XX only) */ |
|
457 458/* 459 * Prior to calling isp_reset for the first time, the outer layer 460 * should set isp_role to one of NONE, INITIATOR, TARGET, BOTH. 461 * 462 * If you set ISP_ROLE_NONE, the cards will be reset, new firmware loaded, 463 * NVRAM read, and defaults set, but any further initialization (e.g. 464 * INITIALIZE CONTROL BLOCK commands for 2X00 cards) won't be done. --- 21 unchanged lines hidden (view full) --- 486#endif 487 488 489/* 490 * Firmware related defines 491 */ 492#define ISP_CODE_ORG 0x1000 /* default f/w code start */ 493#define ISP_CODE_ORG_2300 0x0800 /* ..except for 2300s */ | 538 539/* 540 * Prior to calling isp_reset for the first time, the outer layer 541 * should set isp_role to one of NONE, INITIATOR, TARGET, BOTH. 542 * 543 * If you set ISP_ROLE_NONE, the cards will be reset, new firmware loaded, 544 * NVRAM read, and defaults set, but any further initialization (e.g. 545 * INITIALIZE CONTROL BLOCK commands for 2X00 cards) won't be done. --- 21 unchanged lines hidden (view full) --- 567#endif 568 569 570/* 571 * Firmware related defines 572 */ 573#define ISP_CODE_ORG 0x1000 /* default f/w code start */ 574#define ISP_CODE_ORG_2300 0x0800 /* ..except for 2300s */ |
575#define ISP_CODE_ORG_2400 0x100000 /* ..and 2400s */ |
|
494#define ISP_FW_REV(maj, min, mic) ((maj << 24) | (min << 16) | mic) 495#define ISP_FW_MAJOR(code) ((code >> 24) & 0xff) 496#define ISP_FW_MINOR(code) ((code >> 16) & 0xff) 497#define ISP_FW_MICRO(code) ((code >> 8) & 0xff) 498#define ISP_FW_REVX(xp) ((xp[0]<<24) | (xp[1] << 16) | xp[2]) 499#define ISP_FW_MAJORX(xp) (xp[0]) 500#define ISP_FW_MINORX(xp) (xp[1]) 501#define ISP_FW_MICROX(xp) (xp[2]) 502#define ISP_FW_NEWER_THAN(i, major, minor, micro) \ 503 (ISP_FW_REVX((i)->isp_fwrev) > ISP_FW_REV(major, minor, micro)) | 576#define ISP_FW_REV(maj, min, mic) ((maj << 24) | (min << 16) | mic) 577#define ISP_FW_MAJOR(code) ((code >> 24) & 0xff) 578#define ISP_FW_MINOR(code) ((code >> 16) & 0xff) 579#define ISP_FW_MICRO(code) ((code >> 8) & 0xff) 580#define ISP_FW_REVX(xp) ((xp[0]<<24) | (xp[1] << 16) | xp[2]) 581#define ISP_FW_MAJORX(xp) (xp[0]) 582#define ISP_FW_MINORX(xp) (xp[1]) 583#define ISP_FW_MICROX(xp) (xp[2]) 584#define ISP_FW_NEWER_THAN(i, major, minor, micro) \ 585 (ISP_FW_REVX((i)->isp_fwrev) > ISP_FW_REV(major, minor, micro)) |
586#define ISP_FW_OLDER_THAN(i, major, minor, micro) \ 587 (ISP_FW_REVX((i)->isp_fwrev) < ISP_FW_REV(major, minor, micro)) |
|
504 505/* 506 * Bus (implementation) types 507 */ 508#define ISP_BT_PCI 0 /* PCI Implementations */ 509#define ISP_BT_SBUS 1 /* SBus Implementations */ 510 511/* --- 22 unchanged lines hidden (view full) --- 534#define ISP_HA_SCSI_12160 0xc 535#define ISP_HA_FC 0xf0 536#define ISP_HA_FC_2100 0x10 537#define ISP_HA_FC_2200 0x20 538#define ISP_HA_FC_2300 0x30 539#define ISP_HA_FC_2312 0x40 540#define ISP_HA_FC_2322 0x50 541#define ISP_HA_FC_2400 0x60 | 588 589/* 590 * Bus (implementation) types 591 */ 592#define ISP_BT_PCI 0 /* PCI Implementations */ 593#define ISP_BT_SBUS 1 /* SBus Implementations */ 594 595/* --- 22 unchanged lines hidden (view full) --- 618#define ISP_HA_SCSI_12160 0xc 619#define ISP_HA_FC 0xf0 620#define ISP_HA_FC_2100 0x10 621#define ISP_HA_FC_2200 0x20 622#define ISP_HA_FC_2300 0x30 623#define ISP_HA_FC_2312 0x40 624#define ISP_HA_FC_2322 0x50 625#define ISP_HA_FC_2400 0x60 |
542#define ISP_HA_FC_2422 0x61 | |
543 544#define IS_SCSI(isp) (isp->isp_type & ISP_HA_SCSI) 545#define IS_1240(isp) (isp->isp_type == ISP_HA_SCSI_1240) 546#define IS_1080(isp) (isp->isp_type == ISP_HA_SCSI_1080) 547#define IS_1280(isp) (isp->isp_type == ISP_HA_SCSI_1280) 548#define IS_10160(isp) (isp->isp_type == ISP_HA_SCSI_10160) 549#define IS_12160(isp) (isp->isp_type == ISP_HA_SCSI_12160) 550 551#define IS_12X0(isp) (IS_1240(isp) || IS_1280(isp)) 552#define IS_1X160(isp) (IS_10160(isp) || IS_12160(isp)) 553#define IS_DUALBUS(isp) (IS_12X0(isp) || IS_12160(isp)) 554#define IS_ULTRA2(isp) (IS_1080(isp) || IS_1280(isp) || IS_1X160(isp)) 555#define IS_ULTRA3(isp) (IS_1X160(isp)) 556 557#define IS_FC(isp) ((isp)->isp_type & ISP_HA_FC) 558#define IS_2100(isp) ((isp)->isp_type == ISP_HA_FC_2100) 559#define IS_2200(isp) ((isp)->isp_type == ISP_HA_FC_2200) | 626 627#define IS_SCSI(isp) (isp->isp_type & ISP_HA_SCSI) 628#define IS_1240(isp) (isp->isp_type == ISP_HA_SCSI_1240) 629#define IS_1080(isp) (isp->isp_type == ISP_HA_SCSI_1080) 630#define IS_1280(isp) (isp->isp_type == ISP_HA_SCSI_1280) 631#define IS_10160(isp) (isp->isp_type == ISP_HA_SCSI_10160) 632#define IS_12160(isp) (isp->isp_type == ISP_HA_SCSI_12160) 633 634#define IS_12X0(isp) (IS_1240(isp) || IS_1280(isp)) 635#define IS_1X160(isp) (IS_10160(isp) || IS_12160(isp)) 636#define IS_DUALBUS(isp) (IS_12X0(isp) || IS_12160(isp)) 637#define IS_ULTRA2(isp) (IS_1080(isp) || IS_1280(isp) || IS_1X160(isp)) 638#define IS_ULTRA3(isp) (IS_1X160(isp)) 639 640#define IS_FC(isp) ((isp)->isp_type & ISP_HA_FC) 641#define IS_2100(isp) ((isp)->isp_type == ISP_HA_FC_2100) 642#define IS_2200(isp) ((isp)->isp_type == ISP_HA_FC_2200) |
560#define IS_23XX(isp) \ 561 ((isp)->isp_type >= ISP_HA_FC_2300 && (isp)->isp_type < ISP_HA_FC_2400) | 643#define IS_23XX(isp) ((isp)->isp_type >= ISP_HA_FC_2300 && \ 644 (isp)->isp_type < ISP_HA_FC_2400) |
562#define IS_2300(isp) ((isp)->isp_type == ISP_HA_FC_2300) 563#define IS_2312(isp) ((isp)->isp_type == ISP_HA_FC_2312) 564#define IS_2322(isp) ((isp)->isp_type == ISP_HA_FC_2322) 565#define IS_24XX(isp) ((isp)->isp_type >= ISP_HA_FC_2400) 566 567/* 568 * DMA related macros 569 */ | 645#define IS_2300(isp) ((isp)->isp_type == ISP_HA_FC_2300) 646#define IS_2312(isp) ((isp)->isp_type == ISP_HA_FC_2312) 647#define IS_2322(isp) ((isp)->isp_type == ISP_HA_FC_2322) 648#define IS_24XX(isp) ((isp)->isp_type >= ISP_HA_FC_2400) 649 650/* 651 * DMA related macros 652 */ |
570#define DMA_WD3(x) ((((uint64_t)x) >> 48) & 0xffff) 571#define DMA_WD2(x) ((((uint64_t)x) >> 32) & 0xffff) 572#define DMA_WD1(x) (((x) >> 16) & 0xffff) 573#define DMA_WD0(x) (((x) & 0xffff)) | 653#define DMA_WD3(x) (((uint16_t)(((uint64_t)x) >> 48)) & 0xffff) 654#define DMA_WD2(x) (((uint16_t)(((uint64_t)x) >> 32)) & 0xffff) 655#define DMA_WD1(x) ((uint16_t)((x) >> 16) & 0xffff) 656#define DMA_WD0(x) ((uint16_t)((x) & 0xffff)) |
574 575#define DMA_LO32(x) ((uint32_t) (x)) 576#define DMA_HI32(x) ((uint32_t)(((uint64_t)x) >> 32)) 577 578/* 579 * Core System Function Prototypes 580 */ 581 --- 22 unchanged lines hidden (view full) --- 604 605/* 606 * Internal Interrupt Service Routine 607 * 608 * The outer layers do the spade work to get the appropriate status register, 609 * semaphore register and first mailbox register (if appropriate). This also 610 * means that most spurious/bogus interrupts not for us can be filtered first. 611 */ | 657 658#define DMA_LO32(x) ((uint32_t) (x)) 659#define DMA_HI32(x) ((uint32_t)(((uint64_t)x) >> 32)) 660 661/* 662 * Core System Function Prototypes 663 */ 664 --- 22 unchanged lines hidden (view full) --- 687 688/* 689 * Internal Interrupt Service Routine 690 * 691 * The outer layers do the spade work to get the appropriate status register, 692 * semaphore register and first mailbox register (if appropriate). This also 693 * means that most spurious/bogus interrupts not for us can be filtered first. 694 */ |
612void isp_intr(ispsoftc_t *, uint16_t, uint16_t, uint16_t); | 695void isp_intr(ispsoftc_t *, uint32_t, uint16_t, uint16_t); |
613 614 615/* 616 * Command Entry Point- Platform Dependent layers call into this 617 */ 618int isp_start(XS_T *); 619 620/* these values are what isp_start returns */ --- 46 unchanged lines hidden (view full) --- 667 ISPCTL_RESET_DEV, /* Reset Device */ 668 ISPCTL_ABORT_CMD, /* Abort Command */ 669 ISPCTL_UPDATE_PARAMS, /* Update Operating Parameters (SCSI) */ 670 ISPCTL_FCLINK_TEST, /* Test FC Link Status */ 671 ISPCTL_SCAN_FABRIC, /* (Re)scan Fabric Name Server */ 672 ISPCTL_SCAN_LOOP, /* (Re)scan Local Loop */ 673 ISPCTL_PDB_SYNC, /* Synchronize Port Database */ 674 ISPCTL_SEND_LIP, /* Send a LIP */ | 696 697 698/* 699 * Command Entry Point- Platform Dependent layers call into this 700 */ 701int isp_start(XS_T *); 702 703/* these values are what isp_start returns */ --- 46 unchanged lines hidden (view full) --- 750 ISPCTL_RESET_DEV, /* Reset Device */ 751 ISPCTL_ABORT_CMD, /* Abort Command */ 752 ISPCTL_UPDATE_PARAMS, /* Update Operating Parameters (SCSI) */ 753 ISPCTL_FCLINK_TEST, /* Test FC Link Status */ 754 ISPCTL_SCAN_FABRIC, /* (Re)scan Fabric Name Server */ 755 ISPCTL_SCAN_LOOP, /* (Re)scan Local Loop */ 756 ISPCTL_PDB_SYNC, /* Synchronize Port Database */ 757 ISPCTL_SEND_LIP, /* Send a LIP */ |
675 ISPCTL_GET_POSMAP, /* Get FC-AL position map */ | 758 ISPCTL_GET_PORTNAME, /* get portname from an N-port handle */ |
676 ISPCTL_RUN_MBOXCMD, /* run a mailbox command */ 677 ISPCTL_TOGGLE_TMODE, /* toggle target mode */ 678 ISPCTL_GET_PDB /* get a single port database entry */ 679} ispctl_t; 680int isp_control(ispsoftc_t *, ispctl_t, void *); 681 682 683/* --- 39 unchanged lines hidden (view full) --- 723typedef enum { 724 ISPASYNC_NEW_TGT_PARAMS, /* New Target Parameters Negotiated */ 725 ISPASYNC_BUS_RESET, /* Bus Was Reset */ 726 ISPASYNC_LOOP_DOWN, /* FC Loop Down */ 727 ISPASYNC_LOOP_UP, /* FC Loop Up */ 728 ISPASYNC_LIP, /* LIP Received */ 729 ISPASYNC_LOOP_RESET, /* Loop Reset Received */ 730 ISPASYNC_CHANGE_NOTIFY, /* FC Change Notification */ | 759 ISPCTL_RUN_MBOXCMD, /* run a mailbox command */ 760 ISPCTL_TOGGLE_TMODE, /* toggle target mode */ 761 ISPCTL_GET_PDB /* get a single port database entry */ 762} ispctl_t; 763int isp_control(ispsoftc_t *, ispctl_t, void *); 764 765 766/* --- 39 unchanged lines hidden (view full) --- 806typedef enum { 807 ISPASYNC_NEW_TGT_PARAMS, /* New Target Parameters Negotiated */ 808 ISPASYNC_BUS_RESET, /* Bus Was Reset */ 809 ISPASYNC_LOOP_DOWN, /* FC Loop Down */ 810 ISPASYNC_LOOP_UP, /* FC Loop Up */ 811 ISPASYNC_LIP, /* LIP Received */ 812 ISPASYNC_LOOP_RESET, /* Loop Reset Received */ 813 ISPASYNC_CHANGE_NOTIFY, /* FC Change Notification */ |
731 ISPASYNC_FABRIC_DEV, /* FC Fabric Device Arrival */ 732 ISPASYNC_PROMENADE, /* FC Objects coming && going */ | 814 ISPASYNC_DEV_ARRIVED, /* FC Device Arrival */ 815 ISPASYNC_DEV_CHANGED, /* FC Device Change */ 816 ISPASYNC_DEV_STAYED, /* FC Device Stayed the Same */ 817 ISPASYNC_DEV_GONE, /* FC Device Depart */ |
733 ISPASYNC_TARGET_NOTIFY, /* target asynchronous notification event */ 734 ISPASYNC_TARGET_ACTION, /* target action requested */ 735 ISPASYNC_CONF_CHANGE, /* Platform Configuration Change */ 736 ISPASYNC_UNHANDLED_RESPONSE, /* Unhandled Response Entry */ 737 ISPASYNC_FW_CRASH, /* Firmware has crashed */ 738 ISPASYNC_FW_DUMPED, /* Firmware crashdump taken */ 739 ISPASYNC_FW_RESTARTED /* Firmware has been restarted */ 740} ispasync_t; --- 58 unchanged lines hidden (view full) --- 799 * 800 * MEMORYBARRIER(ispsoftc_t *, barrier_type, offset, size) 801 * 802 * Function/Macro the provides memory synchronization on 803 * various objects so that the ISP's and the system's view 804 * of the same object is consistent. 805 * 806 * MBOX_ACQUIRE(ispsoftc_t *) acquire lock on mailbox regs | 818 ISPASYNC_TARGET_NOTIFY, /* target asynchronous notification event */ 819 ISPASYNC_TARGET_ACTION, /* target action requested */ 820 ISPASYNC_CONF_CHANGE, /* Platform Configuration Change */ 821 ISPASYNC_UNHANDLED_RESPONSE, /* Unhandled Response Entry */ 822 ISPASYNC_FW_CRASH, /* Firmware has crashed */ 823 ISPASYNC_FW_DUMPED, /* Firmware crashdump taken */ 824 ISPASYNC_FW_RESTARTED /* Firmware has been restarted */ 825} ispasync_t; --- 58 unchanged lines hidden (view full) --- 884 * 885 * MEMORYBARRIER(ispsoftc_t *, barrier_type, offset, size) 886 * 887 * Function/Macro the provides memory synchronization on 888 * various objects so that the ISP's and the system's view 889 * of the same object is consistent. 890 * 891 * MBOX_ACQUIRE(ispsoftc_t *) acquire lock on mailbox regs |
807 * MBOX_WAIT_COMPLETE(ispsoftc_t *) wait for mailbox cmd to be done | 892 * MBOX_WAIT_COMPLETE(ispsoftc_t *, mbreg_t *) wait for cmd to be done |
808 * MBOX_NOTIFY_COMPLETE(ispsoftc_t *) notification of mbox cmd donee 809 * MBOX_RELEASE(ispsoftc_t *) release lock on mailbox regs 810 * 811 * FC_SCRATCH_ACQUIRE(ispsoftc_t *) acquire lock on FC scratch area 812 * FC_SCRATCH_RELEASE(ispsoftc_t *) acquire lock on FC scratch area 813 * 814 * SCSI_GOOD SCSI 'Good' Status 815 * SCSI_CHECK SCSI 'Check Condition' Status --- 77 unchanged lines hidden --- | 893 * MBOX_NOTIFY_COMPLETE(ispsoftc_t *) notification of mbox cmd donee 894 * MBOX_RELEASE(ispsoftc_t *) release lock on mailbox regs 895 * 896 * FC_SCRATCH_ACQUIRE(ispsoftc_t *) acquire lock on FC scratch area 897 * FC_SCRATCH_RELEASE(ispsoftc_t *) acquire lock on FC scratch area 898 * 899 * SCSI_GOOD SCSI 'Good' Status 900 * SCSI_CHECK SCSI 'Check Condition' Status --- 77 unchanged lines hidden --- |