1
2
3
4
5
6
7
8
9
10
11 #ifndef _QLA1280_H
12 #define _QLA1280_H
13
14
15
16
17 #define BIT_0 0x1
18 #define BIT_1 0x2
19 #define BIT_2 0x4
20 #define BIT_3 0x8
21 #define BIT_4 0x10
22 #define BIT_5 0x20
23 #define BIT_6 0x40
24 #define BIT_7 0x80
25 #define BIT_8 0x100
26 #define BIT_9 0x200
27 #define BIT_10 0x400
28 #define BIT_11 0x800
29 #define BIT_12 0x1000
30 #define BIT_13 0x2000
31 #define BIT_14 0x4000
32 #define BIT_15 0x8000
33 #define BIT_16 0x10000
34 #define BIT_17 0x20000
35 #define BIT_18 0x40000
36 #define BIT_19 0x80000
37 #define BIT_20 0x100000
38 #define BIT_21 0x200000
39 #define BIT_22 0x400000
40 #define BIT_23 0x800000
41 #define BIT_24 0x1000000
42 #define BIT_25 0x2000000
43 #define BIT_26 0x4000000
44 #define BIT_27 0x8000000
45 #define BIT_28 0x10000000
46 #define BIT_29 0x20000000
47 #define BIT_30 0x40000000
48 #define BIT_31 0x80000000
49
50 #if MEMORY_MAPPED_IO
51 #define RD_REG_WORD(addr) readw_relaxed(addr)
52 #define RD_REG_WORD_dmasync(addr) readw(addr)
53 #define WRT_REG_WORD(addr, data) writew(data, addr)
54 #else
55 #define RD_REG_WORD(addr) inw((unsigned long)addr)
56 #define RD_REG_WORD_dmasync(addr) RD_REG_WORD(addr)
57 #define WRT_REG_WORD(addr, data) outw(data, (unsigned long)addr)
58 #endif
59
60
61
62
63 #define MAX_BUSES 2
64 #define MAX_B_BITS 1
65
66 #define MAX_TARGETS 16
67 #define MAX_T_BITS 4
68
69 #define MAX_LUNS 8
70 #define MAX_L_BITS 3
71
72
73
74
75 #define QLA1280_WDG_TIME_QUANTUM 5
76
77
78 #define COMMAND_RETRY_COUNT 255
79
80
81 #define MAX_OUTSTANDING_COMMANDS 512
82 #define COMPLETED_HANDLE ((unsigned char *) \
83 (MAX_OUTSTANDING_COMMANDS + 2))
84
85
86 #define REQUEST_ENTRY_CNT 255
87 #define RESPONSE_ENTRY_CNT 63
88
89
90
91
92
93 struct srb {
94 struct list_head list;
95 struct scsi_cmnd *cmd;
96
97
98 struct completion *wait;
99 dma_addr_t saved_dma_handle;
100 uint8_t flags;
101 uint8_t dir;
102 };
103
104
105
106
107 #define SRB_TIMEOUT (1 << 0)
108 #define SRB_SENT (1 << 1)
109 #define SRB_ABORT_PENDING (1 << 2)
110 #define SRB_ABORTED (1 << 3)
111
112
113
114
115 struct device_reg {
116 uint16_t id_l;
117 uint16_t id_h;
118 uint16_t cfg_0;
119 #define ISP_CFG0_HWMSK 0x000f
120 #define ISP_CFG0_1020 BIT_0
121 #define ISP_CFG0_1020A BIT_1
122 #define ISP_CFG0_1040 BIT_2
123 #define ISP_CFG0_1040A BIT_3
124 #define ISP_CFG0_1040B BIT_4
125 #define ISP_CFG0_1040C BIT_5
126 uint16_t cfg_1;
127 #define ISP_CFG1_F128 BIT_6
128 #define ISP_CFG1_F64 BIT_4|BIT_5
129 #define ISP_CFG1_F32 BIT_5
130 #define ISP_CFG1_F16 BIT_4
131 #define ISP_CFG1_BENAB BIT_2
132 #define ISP_CFG1_SXP BIT_0
133 uint16_t ictrl;
134 #define ISP_RESET BIT_0
135 #define ISP_EN_INT BIT_1
136 #define ISP_EN_RISC BIT_2
137 #define ISP_FLASH_ENABLE BIT_8
138 #define ISP_FLASH_UPPER BIT_9
139 uint16_t istatus;
140 #define PCI_64BIT_SLOT BIT_14
141 #define RISC_INT BIT_2
142 #define PCI_INT BIT_1
143 uint16_t semaphore;
144 uint16_t nvram;
145 #define NV_DESELECT 0
146 #define NV_CLOCK BIT_0
147 #define NV_SELECT BIT_1
148 #define NV_DATA_OUT BIT_2
149 #define NV_DATA_IN BIT_3
150 uint16_t flash_data;
151 uint16_t flash_address;
152
153 uint16_t unused_1[0x06];
154
155
156 uint16_t cdma_cfg;
157 #define CDMA_CONF_SENAB BIT_3
158 #define CDMA_CONF_RIRQ BIT_2
159 #define CDMA_CONF_BENAB BIT_1
160 #define CDMA_CONF_DIR BIT_0
161 uint16_t cdma_ctrl;
162 uint16_t cdma_status;
163 uint16_t cdma_fifo_status;
164 uint16_t cdma_count;
165 uint16_t cdma_reserved;
166 uint16_t cdma_address_count_0;
167 uint16_t cdma_address_count_1;
168 uint16_t cdma_address_count_2;
169 uint16_t cdma_address_count_3;
170
171 uint16_t unused_2[0x06];
172
173 uint16_t ddma_cfg;
174 #define DDMA_CONF_SENAB BIT_3
175 #define DDMA_CONF_RIRQ BIT_2
176 #define DDMA_CONF_BENAB BIT_1
177 #define DDMA_CONF_DIR BIT_0
178 uint16_t ddma_ctrl;
179 uint16_t ddma_status;
180 uint16_t ddma_fifo_status;
181 uint16_t ddma_xfer_count_low;
182 uint16_t ddma_xfer_count_high;
183 uint16_t ddma_addr_count_0;
184 uint16_t ddma_addr_count_1;
185 uint16_t ddma_addr_count_2;
186 uint16_t ddma_addr_count_3;
187
188 uint16_t unused_3[0x0e];
189
190 uint16_t mailbox0;
191 uint16_t mailbox1;
192 uint16_t mailbox2;
193 uint16_t mailbox3;
194 uint16_t mailbox4;
195 uint16_t mailbox5;
196 uint16_t mailbox6;
197 uint16_t mailbox7;
198
199 uint16_t unused_4[0x20];
200
201 uint16_t host_cmd;
202 #define HOST_INT BIT_7
203 #define BIOS_ENABLE BIT_0
204
205 uint16_t unused_5[0x5];
206
207 uint16_t gpio_data;
208 uint16_t gpio_enable;
209
210 uint16_t unused_6[0x11];
211 uint16_t scsiControlPins;
212 };
213
214 #define MAILBOX_REGISTER_COUNT 8
215
216
217
218
219 #define PROD_ID_1 0x4953
220 #define PROD_ID_2 0x0000
221 #define PROD_ID_2a 0x5020
222 #define PROD_ID_3 0x2020
223 #define PROD_ID_4 0x1
224
225
226
227
228 #define HC_RESET_RISC 0x1000
229 #define HC_PAUSE_RISC 0x2000
230 #define HC_RELEASE_RISC 0x3000
231 #define HC_SET_HOST_INT 0x5000
232 #define HC_CLR_HOST_INT 0x6000
233 #define HC_CLR_RISC_INT 0x7000
234 #define HC_DISABLE_BIOS 0x9000
235
236
237
238
239 #define MBS_FRM_ALIVE 0
240 #define MBS_CHKSUM_ERR 1
241 #define MBS_SHADOW_LD_ERR 2
242 #define MBS_BUSY 4
243
244
245
246
247 #define MBS_CMD_CMP 0x4000
248 #define MBS_INV_CMD 0x4001
249 #define MBS_HOST_INF_ERR 0x4002
250 #define MBS_TEST_FAILED 0x4003
251 #define MBS_CMD_ERR 0x4005
252 #define MBS_CMD_PARAM_ERR 0x4006
253
254
255
256
257 #define MBA_ASYNC_EVENT 0x8000
258 #define MBA_BUS_RESET 0x8001
259 #define MBA_SYSTEM_ERR 0x8002
260 #define MBA_REQ_TRANSFER_ERR 0x8003
261 #define MBA_RSP_TRANSFER_ERR 0x8004
262 #define MBA_WAKEUP_THRES 0x8005
263 #define MBA_TIMEOUT_RESET 0x8006
264 #define MBA_DEVICE_RESET 0x8007
265 #define MBA_BUS_MODE_CHANGE 0x800E
266 #define MBA_SCSI_COMPLETION 0x8020
267
268
269
270
271 #define MBC_NOP 0
272 #define MBC_LOAD_RAM 1
273 #define MBC_EXECUTE_FIRMWARE 2
274 #define MBC_DUMP_RAM 3
275 #define MBC_WRITE_RAM_WORD 4
276 #define MBC_READ_RAM_WORD 5
277 #define MBC_MAILBOX_REGISTER_TEST 6
278 #define MBC_VERIFY_CHECKSUM 7
279 #define MBC_ABOUT_FIRMWARE 8
280 #define MBC_INIT_REQUEST_QUEUE 0x10
281 #define MBC_INIT_RESPONSE_QUEUE 0x11
282 #define MBC_EXECUTE_IOCB 0x12
283 #define MBC_ABORT_COMMAND 0x15
284 #define MBC_ABORT_DEVICE 0x16
285 #define MBC_ABORT_TARGET 0x17
286 #define MBC_BUS_RESET 0x18
287 #define MBC_GET_RETRY_COUNT 0x22
288 #define MBC_GET_TARGET_PARAMETERS 0x28
289 #define MBC_SET_INITIATOR_ID 0x30
290 #define MBC_SET_SELECTION_TIMEOUT 0x31
291 #define MBC_SET_RETRY_COUNT 0x32
292 #define MBC_SET_TAG_AGE_LIMIT 0x33
293 #define MBC_SET_CLOCK_RATE 0x34
294 #define MBC_SET_ACTIVE_NEGATION 0x35
295 #define MBC_SET_ASYNC_DATA_SETUP 0x36
296 #define MBC_SET_PCI_CONTROL 0x37
297 #define MBC_SET_TARGET_PARAMETERS 0x38
298 #define MBC_SET_DEVICE_QUEUE 0x39
299 #define MBC_SET_RESET_DELAY_PARAMETERS 0x3A
300 #define MBC_SET_SYSTEM_PARAMETER 0x45
301 #define MBC_SET_FIRMWARE_FEATURES 0x4A
302 #define MBC_INIT_REQUEST_QUEUE_A64 0x52
303 #define MBC_INIT_RESPONSE_QUEUE_A64 0x53
304 #define MBC_ENABLE_TARGET_MODE 0x55
305 #define MBC_SET_DATA_OVERRUN_RECOVERY 0x5A
306
307
308
309
310 #define TP_PPR BIT_5
311 #define TP_RENEGOTIATE BIT_8
312 #define TP_STOP_QUEUE BIT_9
313 #define TP_AUTO_REQUEST_SENSE BIT_10
314 #define TP_TAGGED_QUEUE BIT_11
315 #define TP_SYNC BIT_12
316 #define TP_WIDE BIT_13
317 #define TP_PARITY BIT_14
318 #define TP_DISCONNECT BIT_15
319
320
321
322
323 #define NV_START_BIT BIT_2
324 #define NV_WRITE_OP (BIT_26 | BIT_24)
325 #define NV_READ_OP (BIT_26 | BIT_25)
326 #define NV_ERASE_OP (BIT_26 | BIT_25 | BIT_24)
327 #define NV_MASK_OP (BIT_26 | BIT_25 | BIT_24)
328 #define NV_DELAY_COUNT 10
329
330
331
332
333 struct nvram {
334 uint8_t id0;
335 uint8_t id1;
336 uint8_t id2;
337 uint8_t id3;
338 uint8_t version;
339
340 struct {
341 uint8_t bios_configuration_mode:2;
342 uint8_t bios_disable:1;
343 uint8_t selectable_scsi_boot_enable:1;
344 uint8_t cd_rom_boot_enable:1;
345 uint8_t disable_loading_risc_code:1;
346 uint8_t enable_64bit_addressing:1;
347 uint8_t unused_7:1;
348 } cntr_flags_1;
349
350 struct {
351 uint8_t boot_lun_number:5;
352 uint8_t scsi_bus_number:1;
353 uint8_t unused_6:1;
354 uint8_t unused_7:1;
355 } cntr_flags_2l;
356
357 struct {
358 uint8_t boot_target_number:4;
359 uint8_t unused_12:1;
360 uint8_t unused_13:1;
361 uint8_t unused_14:1;
362 uint8_t unused_15:1;
363 } cntr_flags_2h;
364
365 uint16_t unused_8;
366 uint16_t unused_10;
367 uint16_t unused_12;
368 uint16_t unused_14;
369
370 struct {
371 uint8_t reserved:2;
372 uint8_t burst_enable:1;
373 uint8_t reserved_1:1;
374 uint8_t fifo_threshold:4;
375 } isp_config;
376
377
378
379
380 struct {
381 uint8_t scsi_bus_1_control:2;
382 uint8_t scsi_bus_0_control:2;
383 uint8_t unused_0:1;
384 uint8_t unused_1:1;
385 uint8_t unused_2:1;
386 uint8_t auto_term_support:1;
387 } termination;
388
389 uint16_t isp_parameter;
390
391 union {
392 uint16_t w;
393 struct {
394 uint16_t enable_fast_posting:1;
395 uint16_t report_lvd_bus_transition:1;
396 uint16_t unused_2:1;
397 uint16_t unused_3:1;
398 uint16_t disable_iosbs_with_bus_reset_status:1;
399 uint16_t disable_synchronous_backoff:1;
400 uint16_t unused_6:1;
401 uint16_t synchronous_backoff_reporting:1;
402 uint16_t disable_reselection_fairness:1;
403 uint16_t unused_9:1;
404 uint16_t unused_10:1;
405 uint16_t unused_11:1;
406 uint16_t unused_12:1;
407 uint16_t unused_13:1;
408 uint16_t unused_14:1;
409 uint16_t unused_15:1;
410 } f;
411 } firmware_feature;
412
413 uint16_t unused_22;
414
415 struct {
416 struct {
417 uint8_t initiator_id:4;
418 uint8_t scsi_reset_disable:1;
419 uint8_t scsi_bus_size:1;
420 uint8_t scsi_bus_type:1;
421 uint8_t unused_7:1;
422 } config_1;
423
424 uint8_t bus_reset_delay;
425 uint8_t retry_count;
426 uint8_t retry_delay;
427
428 struct {
429 uint8_t async_data_setup_time:4;
430 uint8_t req_ack_active_negation:1;
431 uint8_t data_line_active_negation:1;
432 uint8_t unused_6:1;
433 uint8_t unused_7:1;
434 } config_2;
435
436 uint8_t unused_29;
437
438 uint16_t selection_timeout;
439 uint16_t max_queue_depth;
440
441 uint16_t unused_34;
442 uint16_t unused_36;
443 uint16_t unused_38;
444
445 struct {
446 struct {
447 uint8_t renegotiate_on_error:1;
448 uint8_t stop_queue_on_check:1;
449 uint8_t auto_request_sense:1;
450 uint8_t tag_queuing:1;
451 uint8_t enable_sync:1;
452 uint8_t enable_wide:1;
453 uint8_t parity_checking:1;
454 uint8_t disconnect_allowed:1;
455 } parameter;
456
457 uint8_t execution_throttle;
458 uint8_t sync_period;
459
460 union {
461 uint8_t flags_43;
462 struct {
463 uint8_t sync_offset:4;
464 uint8_t device_enable:1;
465 uint8_t lun_disable:1;
466 uint8_t unused_6:1;
467 uint8_t unused_7:1;
468 } flags1x80;
469 struct {
470 uint8_t sync_offset:5;
471 uint8_t device_enable:1;
472 uint8_t unused_6:1;
473 uint8_t unused_7:1;
474 } flags1x160;
475 } flags;
476 union {
477 uint8_t unused_44;
478 struct {
479 uint8_t ppr_options:4;
480 uint8_t ppr_bus_width:2;
481 uint8_t unused_8:1;
482 uint8_t enable_ppr:1;
483 } flags;
484 } ppr_1x160;
485 uint8_t unused_45;
486 } target[MAX_TARGETS];
487 } bus[MAX_BUSES];
488
489 uint16_t unused_248;
490
491 uint16_t subsystem_id[2];
492
493 union {
494 uint8_t unused_254;
495 uint8_t system_id_pointer;
496 } sysid_1x160;
497
498 uint8_t chksum;
499 };
500
501
502
503
504 #define MAX_CMDSZ 12
505 struct cmd_entry {
506 uint8_t entry_type;
507 #define COMMAND_TYPE 1
508 uint8_t entry_count;
509 uint8_t sys_define;
510 uint8_t entry_status;
511 __le32 handle;
512 uint8_t lun;
513 uint8_t target;
514 __le16 cdb_len;
515 __le16 control_flags;
516 __le16 reserved;
517 __le16 timeout;
518 __le16 dseg_count;
519 uint8_t scsi_cdb[MAX_CMDSZ];
520 __le32 dseg_0_address;
521 __le32 dseg_0_length;
522 __le32 dseg_1_address;
523 __le32 dseg_1_length;
524 __le32 dseg_2_address;
525 __le32 dseg_2_length;
526 __le32 dseg_3_address;
527 __le32 dseg_3_length;
528 };
529
530
531
532
533 struct cont_entry {
534 uint8_t entry_type;
535 #define CONTINUE_TYPE 2
536 uint8_t entry_count;
537 uint8_t sys_define;
538 uint8_t entry_status;
539 __le32 reserved;
540 __le32 dseg_0_address;
541 __le32 dseg_0_length;
542 __le32 dseg_1_address;
543 __le32 dseg_1_length;
544 __le32 dseg_2_address;
545 __le32 dseg_2_length;
546 __le32 dseg_3_address;
547 __le32 dseg_3_length;
548 __le32 dseg_4_address;
549 __le32 dseg_4_length;
550 __le32 dseg_5_address;
551 __le32 dseg_5_length;
552 __le32 dseg_6_address;
553 __le32 dseg_6_length;
554 };
555
556
557
558
559 struct response {
560 uint8_t entry_type;
561 #define STATUS_TYPE 3
562 uint8_t entry_count;
563 uint8_t sys_define;
564 uint8_t entry_status;
565 #define RF_CONT BIT_0
566 #define RF_FULL BIT_1
567 #define RF_BAD_HEADER BIT_2
568 #define RF_BAD_PAYLOAD BIT_3
569 __le32 handle;
570 __le16 scsi_status;
571 __le16 comp_status;
572 __le16 state_flags;
573 #define SF_TRANSFER_CMPL BIT_14
574 #define SF_GOT_SENSE BIT_13
575 #define SF_GOT_STATUS BIT_12
576 #define SF_TRANSFERRED_DATA BIT_11
577 #define SF_SENT_CDB BIT_10
578 #define SF_GOT_TARGET BIT_9
579 #define SF_GOT_BUS BIT_8
580 __le16 status_flags;
581 __le16 time;
582 __le16 req_sense_length;
583 __le32 residual_length;
584 __le16 reserved[4];
585 uint8_t req_sense_data[32];
586 };
587
588
589
590
591 struct mrk_entry {
592 uint8_t entry_type;
593 #define MARKER_TYPE 4
594 uint8_t entry_count;
595 uint8_t sys_define;
596 uint8_t entry_status;
597 __le32 reserved;
598 uint8_t lun;
599 uint8_t target;
600 uint8_t modifier;
601 #define MK_SYNC_ID_LUN 0
602 #define MK_SYNC_ID 1
603 #define MK_SYNC_ALL 2
604 uint8_t reserved_1[53];
605 };
606
607
608
609
610
611
612 struct ecmd_entry {
613 uint8_t entry_type;
614 #define EXTENDED_CMD_TYPE 5
615 uint8_t entry_count;
616 uint8_t sys_define;
617 uint8_t entry_status;
618 uint32_t handle;
619 uint8_t lun;
620 uint8_t target;
621 __le16 cdb_len;
622 __le16 control_flags;
623 __le16 reserved;
624 __le16 timeout;
625 __le16 dseg_count;
626 uint8_t scsi_cdb[88];
627 };
628
629
630
631
632 typedef struct {
633 uint8_t entry_type;
634 #define COMMAND_A64_TYPE 9
635 uint8_t entry_count;
636 uint8_t sys_define;
637 uint8_t entry_status;
638 __le32 handle;
639 uint8_t lun;
640 uint8_t target;
641 __le16 cdb_len;
642 __le16 control_flags;
643 __le16 reserved;
644 __le16 timeout;
645 __le16 dseg_count;
646 uint8_t scsi_cdb[MAX_CMDSZ];
647 __le32 reserved_1[2];
648 __le32 dseg_0_address[2];
649 __le32 dseg_0_length;
650 __le32 dseg_1_address[2];
651 __le32 dseg_1_length;
652 } cmd_a64_entry_t, request_t;
653
654
655
656
657 struct cont_a64_entry {
658 uint8_t entry_type;
659 #define CONTINUE_A64_TYPE 0xA
660 uint8_t entry_count;
661 uint8_t sys_define;
662 uint8_t entry_status;
663 __le32 dseg_0_address[2];
664 __le32 dseg_0_length;
665 __le32 dseg_1_address[2];
666 __le32 dseg_1_length;
667 __le32 dseg_2_address[2];
668 __le32 dseg_2_length;
669 __le32 dseg_3_address[2];
670 __le32 dseg_3_length;
671 __le32 dseg_4_address[2];
672 __le32 dseg_4_length;
673 };
674
675
676
677
678 struct elun_entry {
679 uint8_t entry_type;
680 #define ENABLE_LUN_TYPE 0xB
681 uint8_t entry_count;
682 uint8_t reserved_1;
683 uint8_t entry_status;
684 __le32 reserved_2;
685 __le16 lun;
686 __le16 reserved_4;
687 __le32 option_flags;
688 uint8_t status;
689 uint8_t reserved_5;
690 uint8_t command_count;
691 uint8_t immed_notify_count;
692
693 uint8_t group_6_length;
694
695 uint8_t group_7_length;
696
697 __le16 timeout;
698 __le16 reserved_6[20];
699 };
700
701
702
703
704
705
706 struct modify_lun_entry {
707 uint8_t entry_type;
708 #define MODIFY_LUN_TYPE 0xC
709 uint8_t entry_count;
710 uint8_t reserved_1;
711 uint8_t entry_status;
712 __le32 reserved_2;
713 uint8_t lun;
714 uint8_t reserved_3;
715 uint8_t operators;
716 uint8_t reserved_4;
717 __le32 option_flags;
718 uint8_t status;
719 uint8_t reserved_5;
720 uint8_t command_count;
721 uint8_t immed_notify_count;
722
723 __le16 reserved_6;
724 __le16 timeout;
725 __le16 reserved_7[20];
726 };
727
728
729
730
731 struct notify_entry {
732 uint8_t entry_type;
733 #define IMMED_NOTIFY_TYPE 0xD
734 uint8_t entry_count;
735 uint8_t reserved_1;
736 uint8_t entry_status;
737 __le32 reserved_2;
738 uint8_t lun;
739 uint8_t initiator_id;
740 uint8_t reserved_3;
741 uint8_t target_id;
742 __le32 option_flags;
743 uint8_t status;
744 uint8_t reserved_4;
745 uint8_t tag_value;
746 uint8_t tag_type;
747
748 __le16 seq_id;
749 uint8_t scsi_msg[8];
750 __le16 reserved_5[8];
751 uint8_t sense_data[18];
752 };
753
754
755
756
757 struct nack_entry {
758 uint8_t entry_type;
759 #define NOTIFY_ACK_TYPE 0xE
760 uint8_t entry_count;
761 uint8_t reserved_1;
762 uint8_t entry_status;
763 __le32 reserved_2;
764 uint8_t lun;
765 uint8_t initiator_id;
766 uint8_t reserved_3;
767 uint8_t target_id;
768 __le32 option_flags;
769 uint8_t status;
770 uint8_t event;
771 __le16 seq_id;
772 __le16 reserved_4[22];
773 };
774
775
776
777
778 struct atio_entry {
779 uint8_t entry_type;
780 #define ACCEPT_TGT_IO_TYPE 6
781 uint8_t entry_count;
782 uint8_t reserved_1;
783 uint8_t entry_status;
784 __le32 reserved_2;
785 uint8_t lun;
786 uint8_t initiator_id;
787 uint8_t cdb_len;
788 uint8_t target_id;
789 __le32 option_flags;
790 uint8_t status;
791 uint8_t scsi_status;
792 uint8_t tag_value;
793 uint8_t tag_type;
794 uint8_t cdb[26];
795 uint8_t sense_data[18];
796 };
797
798
799
800
801 struct ctio_entry {
802 uint8_t entry_type;
803 #define CONTINUE_TGT_IO_TYPE 7
804 uint8_t entry_count;
805 uint8_t reserved_1;
806 uint8_t entry_status;
807 __le32 reserved_2;
808 uint8_t lun;
809 uint8_t initiator_id;
810 uint8_t reserved_3;
811 uint8_t target_id;
812 __le32 option_flags;
813 uint8_t status;
814 uint8_t scsi_status;
815 uint8_t tag_value;
816 uint8_t tag_type;
817 __le32 transfer_length;
818 __le32 residual;
819 __le16 timeout;
820 __le16 dseg_count;
821 __le32 dseg_0_address;
822 __le32 dseg_0_length;
823 __le32 dseg_1_address;
824 __le32 dseg_1_length;
825 __le32 dseg_2_address;
826 __le32 dseg_2_length;
827 __le32 dseg_3_address;
828 __le32 dseg_3_length;
829 };
830
831
832
833
834 struct ctio_ret_entry {
835 uint8_t entry_type;
836 #define CTIO_RET_TYPE 7
837 uint8_t entry_count;
838 uint8_t reserved_1;
839 uint8_t entry_status;
840 __le32 reserved_2;
841 uint8_t lun;
842 uint8_t initiator_id;
843 uint8_t reserved_3;
844 uint8_t target_id;
845 __le32 option_flags;
846 uint8_t status;
847 uint8_t scsi_status;
848 uint8_t tag_value;
849 uint8_t tag_type;
850 __le32 transfer_length;
851 __le32 residual;
852 __le16 timeout;
853 __le16 dseg_count;
854 __le32 dseg_0_address;
855 __le32 dseg_0_length;
856 __le32 dseg_1_address;
857 __le16 dseg_1_length;
858 uint8_t sense_data[18];
859 };
860
861
862
863
864 struct ctio_a64_entry {
865 uint8_t entry_type;
866 #define CTIO_A64_TYPE 0xF
867 uint8_t entry_count;
868 uint8_t reserved_1;
869 uint8_t entry_status;
870 __le32 reserved_2;
871 uint8_t lun;
872 uint8_t initiator_id;
873 uint8_t reserved_3;
874 uint8_t target_id;
875 __le32 option_flags;
876 uint8_t status;
877 uint8_t scsi_status;
878 uint8_t tag_value;
879 uint8_t tag_type;
880 __le32 transfer_length;
881 __le32 residual;
882 __le16 timeout;
883 __le16 dseg_count;
884 __le32 reserved_4[2];
885 __le32 dseg_0_address[2];
886 __le32 dseg_0_length;
887 __le32 dseg_1_address[2];
888 __le32 dseg_1_length;
889 };
890
891
892
893
894 struct ctio_a64_ret_entry {
895 uint8_t entry_type;
896 #define CTIO_A64_RET_TYPE 0xF
897 uint8_t entry_count;
898 uint8_t reserved_1;
899 uint8_t entry_status;
900 __le32 reserved_2;
901 uint8_t lun;
902 uint8_t initiator_id;
903 uint8_t reserved_3;
904 uint8_t target_id;
905 __le32 option_flags;
906 uint8_t status;
907 uint8_t scsi_status;
908 uint8_t tag_value;
909 uint8_t tag_type;
910 __le32 transfer_length;
911 __le32 residual;
912 __le16 timeout;
913 __le16 dseg_count;
914 __le16 reserved_4[7];
915 uint8_t sense_data[18];
916 };
917
918
919
920
921 #define RESPONSE_ENTRY_SIZE (sizeof(struct response))
922 #define REQUEST_ENTRY_SIZE (sizeof(request_t))
923
924
925
926
927 #define CS_COMPLETE 0x0
928 #define CS_INCOMPLETE 0x1
929 #define CS_DMA 0x2
930 #define CS_TRANSPORT 0x3
931 #define CS_RESET 0x4
932 #define CS_ABORTED 0x5
933 #define CS_TIMEOUT 0x6
934 #define CS_DATA_OVERRUN 0x7
935 #define CS_COMMAND_OVERRUN 0x8
936 #define CS_STATUS_OVERRUN 0x9
937 #define CS_BAD_MSG 0xA
938 #define CS_NO_MSG_OUT 0xB
939 #define CS_EXTENDED_ID 0xC
940 #define CS_IDE_MSG 0xD
941 #define CS_ABORT_MSG 0xE
942 #define CS_REJECT_MSG 0xF
943 #define CS_NOP_MSG 0x10
944 #define CS_PARITY_MSG 0x11
945 #define CS_DEV_RESET_MSG 0x12
946 #define CS_ID_MSG 0x13
947 #define CS_FREE 0x14
948 #define CS_DATA_UNDERRUN 0x15
949 #define CS_TRANACTION_1 0x18
950 #define CS_TRANACTION_2 0x19
951 #define CS_TRANACTION_3 0x1a
952 #define CS_INV_ENTRY_TYPE 0x1b
953 #define CS_DEV_QUEUE_FULL 0x1c
954 #define CS_PHASED_SKIPPED 0x1d
955 #define CS_ARS_FAILED 0x1e
956 #define CS_LVD_BUS_ERROR 0x21
957 #define CS_BAD_PAYLOAD 0x80
958 #define CS_UNKNOWN 0x81
959 #define CS_RETRY 0x82
960
961
962
963
964 #define OF_ENABLE_TAG BIT_1
965 #define OF_DATA_IN BIT_6
966
967 #define OF_DATA_OUT BIT_7
968
969 #define OF_NO_DATA (BIT_7 | BIT_6)
970 #define OF_DISC_DISABLED BIT_15
971 #define OF_DISABLE_SDP BIT_24
972 #define OF_SEND_RDP BIT_26
973 #define OF_FORCE_DISC BIT_30
974 #define OF_SSTS BIT_31
975
976
977
978
979
980 struct bus_param {
981 uint8_t id;
982 uint8_t bus_reset_delay;
983 uint8_t failed_reset_count;
984 uint8_t unused;
985 uint16_t device_enables;
986 uint16_t lun_disables;
987 uint16_t qtag_enables;
988 uint16_t hiwat;
989 uint8_t reset_marker:1;
990 uint8_t disable_scsi_reset:1;
991 uint8_t scsi_bus_dead:1;
992 };
993
994
995 struct qla_driver_setup {
996 uint32_t no_sync:1;
997 uint32_t no_wide:1;
998 uint32_t no_ppr:1;
999 uint32_t no_nvram:1;
1000 uint16_t sync_mask;
1001 uint16_t wide_mask;
1002 uint16_t ppr_mask;
1003 };
1004
1005
1006
1007
1008
1009 struct scsi_qla_host {
1010
1011 struct Scsi_Host *host;
1012 struct scsi_qla_host *next;
1013 struct device_reg __iomem *iobase;
1014
1015 unsigned char __iomem *mmpbase;
1016 unsigned long host_no;
1017 struct pci_dev *pdev;
1018 uint8_t devnum;
1019 uint8_t revision;
1020 uint8_t ports;
1021
1022 unsigned long actthreads;
1023 unsigned long isr_count;
1024 unsigned long spurious_int;
1025
1026
1027 struct srb *outstanding_cmds[MAX_OUTSTANDING_COMMANDS];
1028
1029
1030 struct bus_param bus_settings[MAX_BUSES];
1031
1032
1033 volatile uint16_t mailbox_out[MAILBOX_REGISTER_COUNT];
1034
1035 dma_addr_t request_dma;
1036 request_t *request_ring;
1037 request_t *request_ring_ptr;
1038 uint16_t req_ring_index;
1039 uint16_t req_q_cnt;
1040
1041 dma_addr_t response_dma;
1042 struct response *response_ring;
1043 struct response *response_ring_ptr;
1044 uint16_t rsp_ring_index;
1045
1046 struct list_head done_q;
1047
1048 struct completion *mailbox_wait;
1049 struct timer_list mailbox_timer;
1050
1051 volatile struct {
1052 uint32_t online:1;
1053 uint32_t reset_marker:1;
1054 uint32_t disable_host_adapter:1;
1055 uint32_t reset_active:1;
1056 uint32_t abort_isp_active:1;
1057 uint32_t disable_risc_code_load:1;
1058 } flags;
1059
1060 struct nvram nvram;
1061 int nvram_valid;
1062
1063
1064 unsigned short fwstart;
1065 unsigned char fwver1;
1066 unsigned char fwver2;
1067 unsigned char fwver3;
1068 };
1069
1070 #endif