This source file includes following definitions.
- blogic_busreset
- blogic_intreset
- blogic_softreset
- blogic_hardreset
- blogic_rdstatus
- blogic_setcmdparam
- blogic_rddatain
- blogic_rdint
- blogic_rdgeom
- blogic_execmbox
- blogic_delay
- virt_to_32bit_virt
- blogic_inc_count
- blogic_addcount
- blogic_incszbucket
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #ifndef _BUSLOGIC_H
22 #define _BUSLOGIC_H
23
24
25 #ifndef PACKED
26 #define PACKED __attribute__((packed))
27 #endif
28
29
30
31
32
33 #define BLOGIC_MAX_ADAPTERS 16
34
35
36
37
38
39
40 #define BLOGIC_MAXDEV 16
41
42
43
44
45
46
47
48
49 #define BLOGIC_SG_LIMIT 128
50
51
52
53
54
55
56
57
58 #define BLOGIC_MAX_TAG_DEPTH 64
59 #define BLOGIC_MAX_AUTO_TAG_DEPTH 28
60 #define BLOGIC_MIN_AUTO_TAG_DEPTH 7
61 #define BLOGIC_TAG_DEPTH_BB 3
62 #define BLOGIC_UNTAG_DEPTH 3
63 #define BLOGIC_UNTAG_DEPTH_BB 2
64
65
66
67
68
69
70
71
72
73 #define BLOGIC_BUS_SETTLE_TIME 2
74
75
76
77
78
79
80
81
82
83 #define BLOGIC_MAX_MAILBOX 211
84
85
86
87
88
89
90
91 #define BLOGIC_CCB_GRP_ALLOCSIZE 7
92
93
94
95
96
97
98 #define BLOGIC_LINEBUF_SIZE 100
99 #define BLOGIC_MSGBUF_SIZE 9700
100
101
102
103
104
105
106 enum blogic_msglevel {
107 BLOGIC_ANNOUNCE_LEVEL = 0,
108 BLOGIC_INFO_LEVEL = 1,
109 BLOGIC_NOTICE_LEVEL = 2,
110 BLOGIC_WARN_LEVEL = 3,
111 BLOGIC_ERR_LEVEL = 4
112 };
113
114 static char *blogic_msglevelmap[] = { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR };
115
116
117
118
119
120
121 #define blogic_announce(format, args...) \
122 blogic_msg(BLOGIC_ANNOUNCE_LEVEL, format, ##args)
123
124 #define blogic_info(format, args...) \
125 blogic_msg(BLOGIC_INFO_LEVEL, format, ##args)
126
127 #define blogic_notice(format, args...) \
128 blogic_msg(BLOGIC_NOTICE_LEVEL, format, ##args)
129
130 #define blogic_warn(format, args...) \
131 blogic_msg(BLOGIC_WARN_LEVEL, format, ##args)
132
133 #define blogic_err(format, args...) \
134 blogic_msg(BLOGIC_ERR_LEVEL, format, ##args)
135
136
137
138
139
140
141
142 enum blogic_adapter_type {
143 BLOGIC_MULTIMASTER = 1,
144 BLOGIC_FLASHPOINT = 2
145 } PACKED;
146
147 #define BLOGIC_MULTIMASTER_ADDR_COUNT 4
148 #define BLOGIC_FLASHPOINT_ADDR_COUNT 256
149
150 static int blogic_adapter_addr_count[3] = { 0, BLOGIC_MULTIMASTER_ADDR_COUNT, BLOGIC_FLASHPOINT_ADDR_COUNT };
151
152
153
154
155
156
157 #ifdef CONFIG_SCSI_FLASHPOINT
158
159 #define blogic_multimaster_type(adapter) \
160 (adapter->adapter_type == BLOGIC_MULTIMASTER)
161
162 #define blogic_flashpoint_type(adapter) \
163 (adapter->adapter_type == BLOGIC_FLASHPOINT)
164
165 #else
166
167 #define blogic_multimaster_type(adapter) (true)
168 #define blogic_flashpoint_type(adapter) (false)
169
170 #endif
171
172
173
174
175
176
177 enum blogic_adapter_bus_type {
178 BLOGIC_UNKNOWN_BUS = 0,
179 BLOGIC_ISA_BUS = 1,
180 BLOGIC_EISA_BUS = 2,
181 BLOGIC_PCI_BUS = 3,
182 BLOGIC_VESA_BUS = 4,
183 BLOGIC_MCA_BUS = 5
184 } PACKED;
185
186 static char *blogic_adapter_busnames[] = { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" };
187
188 static enum blogic_adapter_bus_type blogic_adater_bus_types[] = {
189 BLOGIC_VESA_BUS,
190 BLOGIC_ISA_BUS,
191 BLOGIC_MCA_BUS,
192 BLOGIC_EISA_BUS,
193 BLOGIC_UNKNOWN_BUS,
194 BLOGIC_PCI_BUS
195 };
196
197
198
199
200
201 enum blogic_bios_diskgeometry {
202 BLOGIC_BIOS_NODISK = 0,
203 BLOGIC_BIOS_DISK64x32 = 1,
204 BLOGIC_BIOS_DISK128x32 = 2,
205 BLOGIC_BIOS_DISK255x63 = 3
206 } PACKED;
207
208
209
210
211
212
213 struct blogic_byte_count {
214 unsigned int units;
215 unsigned int billions;
216 };
217
218
219
220
221
222
223 struct blogic_probeinfo {
224 enum blogic_adapter_type adapter_type;
225 enum blogic_adapter_bus_type adapter_bus_type;
226 unsigned long io_addr;
227 unsigned long pci_addr;
228 struct pci_dev *pci_device;
229 unsigned char bus;
230 unsigned char dev;
231 unsigned char irq_ch;
232 };
233
234
235
236
237
238 struct blogic_probe_options {
239 bool noprobe:1;
240 bool noprobe_isa:1;
241 bool noprobe_pci:1;
242 bool nosort_pci:1;
243 bool multimaster_first:1;
244 bool flashpoint_first:1;
245 bool limited_isa:1;
246 bool probe330:1;
247 bool probe334:1;
248 bool probe230:1;
249 bool probe234:1;
250 bool probe130:1;
251 bool probe134:1;
252 };
253
254
255
256
257
258 struct blogic_global_options {
259 bool trace_probe:1;
260 bool trace_hw_reset:1;
261 bool trace_config:1;
262 bool trace_err:1;
263 };
264
265
266
267
268
269 #define BLOGIC_CNTRL_REG 0
270 #define BLOGIC_STATUS_REG 0
271 #define BLOGIC_CMD_PARM_REG 1
272 #define BLOGIC_DATAIN_REG 1
273 #define BLOGIC_INT_REG 2
274 #define BLOGIC_GEOMETRY_REG 3
275
276
277
278
279
280 union blogic_cntrl_reg {
281 unsigned char all;
282 struct {
283 unsigned char:4;
284 bool bus_reset:1;
285 bool int_reset:1;
286 bool soft_reset:1;
287 bool hard_reset:1;
288 } cr;
289 };
290
291
292
293
294
295 union blogic_stat_reg {
296 unsigned char all;
297 struct {
298 bool cmd_invalid:1;
299 bool rsvd:1;
300 bool datain_ready:1;
301 bool cmd_param_busy:1;
302 bool adapter_ready:1;
303 bool init_reqd:1;
304 bool diag_failed:1;
305 bool diag_active:1;
306 } sr;
307 };
308
309
310
311
312
313 union blogic_int_reg {
314 unsigned char all;
315 struct {
316 bool mailin_loaded:1;
317 bool mailout_avail:1;
318 bool cmd_complete:1;
319 bool ext_busreset:1;
320 unsigned char rsvd:3;
321 bool int_valid:1;
322 } ir;
323 };
324
325
326
327
328
329 union blogic_geo_reg {
330 unsigned char all;
331 struct {
332 enum blogic_bios_diskgeometry d0_geo:2;
333 enum blogic_bios_diskgeometry d1_geo:2;
334 unsigned char:3;
335 bool ext_trans_enable:1;
336 } gr;
337 };
338
339
340
341
342
343 enum blogic_opcode {
344 BLOGIC_TEST_CMP_COMPLETE = 0x00,
345 BLOGIC_INIT_MBOX = 0x01,
346 BLOGIC_EXEC_MBOX_CMD = 0x02,
347 BLOGIC_EXEC_BIOS_CMD = 0x03,
348 BLOGIC_GET_BOARD_ID = 0x04,
349 BLOGIC_ENABLE_OUTBOX_AVAIL_INT = 0x05,
350 BLOGIC_SET_SELECT_TIMEOUT = 0x06,
351 BLOGIC_SET_PREEMPT_TIME = 0x07,
352 BLOGIC_SET_TIMEOFF_BUS = 0x08,
353 BLOGIC_SET_TXRATE = 0x09,
354 BLOGIC_INQ_DEV0TO7 = 0x0A,
355 BLOGIC_INQ_CONFIG = 0x0B,
356 BLOGIC_TGT_MODE = 0x0C,
357 BLOGIC_INQ_SETUPINFO = 0x0D,
358 BLOGIC_WRITE_LOCALRAM = 0x1A,
359 BLOGIC_READ_LOCALRAM = 0x1B,
360 BLOGIC_WRITE_BUSMASTER_FIFO = 0x1C,
361 BLOGIC_READ_BUSMASTER_FIFO = 0x1D,
362 BLOGIC_ECHO_CMDDATA = 0x1F,
363 BLOGIC_ADAPTER_DIAG = 0x20,
364 BLOGIC_SET_OPTIONS = 0x21,
365 BLOGIC_INQ_DEV8TO15 = 0x23,
366 BLOGIC_INQ_DEV = 0x24,
367 BLOGIC_DISABLE_INT = 0x25,
368 BLOGIC_INIT_EXT_MBOX = 0x81,
369 BLOGIC_EXEC_SCS_CMD = 0x83,
370 BLOGIC_INQ_FWVER_D3 = 0x84,
371 BLOGIC_INQ_FWVER_LETTER = 0x85,
372 BLOGIC_INQ_PCI_INFO = 0x86,
373 BLOGIC_INQ_MODELNO = 0x8B,
374 BLOGIC_INQ_SYNC_PERIOD = 0x8C,
375 BLOGIC_INQ_EXTSETUP = 0x8D,
376 BLOGIC_STRICT_RR = 0x8F,
377 BLOGIC_STORE_LOCALRAM = 0x90,
378 BLOGIC_FETCH_LOCALRAM = 0x91,
379 BLOGIC_STORE_TO_EEPROM = 0x92,
380 BLOGIC_LOAD_AUTOSCSICODE = 0x94,
381 BLOGIC_MOD_IOADDR = 0x95,
382 BLOGIC_SETCCB_FMT = 0x96,
383 BLOGIC_WRITE_INQBUF = 0x9A,
384 BLOGIC_READ_INQBUF = 0x9B,
385 BLOGIC_FLASH_LOAD = 0xA7,
386 BLOGIC_READ_SCAMDATA = 0xA8,
387 BLOGIC_WRITE_SCAMDATA = 0xA9
388 };
389
390
391
392
393
394 struct blogic_board_id {
395 unsigned char type;
396 unsigned char custom_features;
397 unsigned char fw_ver_digit1;
398 unsigned char fw_ver_digit2;
399 };
400
401
402
403
404
405 struct blogic_config {
406 unsigned char:5;
407 bool dma_ch5:1;
408 bool dma_ch6:1;
409 bool dma_ch7:1;
410 bool irq_ch9:1;
411 bool irq_ch10:1;
412 bool irq_ch11:1;
413 bool irq_ch12:1;
414 unsigned char:1;
415 bool irq_ch14:1;
416 bool irq_ch15:1;
417 unsigned char:1;
418 unsigned char id:4;
419 unsigned char:4;
420 };
421
422
423
424
425
426 struct blogic_syncval {
427 unsigned char offset:4;
428 unsigned char tx_period:3;
429 bool sync:1;
430 };
431
432 struct blogic_setup_info {
433 bool sync:1;
434 bool parity:1;
435 unsigned char:6;
436 unsigned char tx_rate;
437 unsigned char preempt_time;
438 unsigned char timeoff_bus;
439 unsigned char mbox_count;
440 unsigned char mbox_addr[3];
441 struct blogic_syncval sync0to7[8];
442 unsigned char disconnect_ok0to7;
443 unsigned char sig;
444 unsigned char char_d;
445 unsigned char bus_type;
446 unsigned char wide_tx_ok0to7;
447 unsigned char wide_tx_active0to7;
448 struct blogic_syncval sync8to15[8];
449 unsigned char disconnect_ok8to15;
450 unsigned char:8;
451 unsigned char wide_tx_ok8to15;
452 unsigned char wide_tx_active8to15;
453 };
454
455
456
457
458
459 struct blogic_extmbox_req {
460 unsigned char mbox_count;
461 u32 base_mbox_addr;
462 } PACKED;
463
464
465
466
467
468
469
470
471 enum blogic_isa_ioport {
472 BLOGIC_IO_330 = 0,
473 BLOGIC_IO_334 = 1,
474 BLOGIC_IO_230 = 2,
475 BLOGIC_IO_234 = 3,
476 BLOGIC_IO_130 = 4,
477 BLOGIC_IO_134 = 5,
478 BLOGIC_IO_DISABLE = 6,
479 BLOGIC_IO_DISABLE2 = 7
480 } PACKED;
481
482 struct blogic_adapter_info {
483 enum blogic_isa_ioport isa_port;
484 unsigned char irq_ch;
485 bool low_term:1;
486 bool high_term:1;
487 unsigned char:2;
488 bool JP1:1;
489 bool JP2:1;
490 bool JP3:1;
491 bool genericinfo_valid:1;
492 unsigned char:8;
493 };
494
495
496
497
498
499 struct blogic_ext_setup {
500 unsigned char bus_type;
501 unsigned char bios_addr;
502 unsigned short sg_limit;
503 unsigned char mbox_count;
504 u32 base_mbox_addr;
505 struct {
506 unsigned char:2;
507 bool fast_on_eisa:1;
508 unsigned char:3;
509 bool level_int:1;
510 unsigned char:1;
511 } misc;
512 unsigned char fw_rev[3];
513 bool wide:1;
514 bool differential:1;
515 bool scam:1;
516 bool ultra:1;
517 bool smart_term:1;
518 unsigned char:3;
519 } PACKED;
520
521
522
523
524
525 enum blogic_rr_req {
526 BLOGIC_AGGRESSIVE_RR = 0,
527 BLOGIC_STRICT_RR_MODE = 1
528 } PACKED;
529
530
531
532
533
534
535 #define BLOGIC_BIOS_BASE 0
536 #define BLOGIC_AUTOSCSI_BASE 64
537
538 struct blogic_fetch_localram {
539 unsigned char offset;
540 unsigned char count;
541 };
542
543
544
545
546
547 struct blogic_autoscsi {
548 unsigned char factory_sig[2];
549 unsigned char info_bytes;
550 unsigned char adapter_type[6];
551 unsigned char:8;
552 bool floppy:1;
553 bool floppy_sec:1;
554 bool level_int:1;
555 unsigned char:2;
556 unsigned char systemram_bios:3;
557 unsigned char dma_ch:7;
558 bool dma_autoconf:1;
559 unsigned char irq_ch:7;
560 bool irq_autoconf:1;
561 unsigned char dma_tx_rate;
562 unsigned char scsi_id;
563 bool low_term:1;
564 bool parity:1;
565 bool high_term:1;
566 bool noisy_cable:1;
567 bool fast_sync_neg:1;
568 bool reset_enabled:1;
569 bool:1;
570 bool active_negation:1;
571 unsigned char bus_on_delay;
572 unsigned char bus_off_delay;
573 bool bios_enabled:1;
574 bool int19_redir_enabled:1;
575 bool ext_trans_enable:1;
576 bool removable_as_fixed:1;
577 bool:1;
578 bool morethan2_drives:1;
579 bool bios_int:1;
580 bool floptical:1;
581 unsigned short dev_enabled;
582 unsigned short wide_ok;
583 unsigned short fast_ok;
584 unsigned short sync_ok;
585 unsigned short discon_ok;
586 unsigned short send_start_unit;
587 unsigned short ignore_bios_scan;
588 unsigned char pci_int_pin:2;
589 unsigned char adapter_ioport:2;
590 bool strict_rr_enabled:1;
591 bool vesabus_33mhzplus:1;
592 bool vesa_burst_write:1;
593 bool vesa_burst_read:1;
594 unsigned short ultra_ok;
595 unsigned int:32;
596 unsigned char:8;
597 unsigned char autoscsi_maxlun;
598 bool:1;
599 bool scam_dominant:1;
600 bool scam_enabled:1;
601 bool scam_lev2:1;
602 unsigned char:4;
603 bool int13_exten:1;
604 bool:1;
605 bool cd_boot:1;
606 unsigned char:5;
607 unsigned char boot_id:4;
608 unsigned char boot_ch:4;
609 unsigned char force_scan_order:1;
610 unsigned char:7;
611 unsigned short nontagged_to_alt_ok;
612 unsigned short reneg_sync_on_check;
613 unsigned char rsvd[10];
614 unsigned char manuf_diag[2];
615 unsigned short cksum;
616 } PACKED;
617
618
619
620
621
622 struct blogic_autoscsi_byte45 {
623 unsigned char force_scan_order:1;
624 unsigned char:7;
625 };
626
627
628
629
630
631 #define BLOGIC_BIOS_DRVMAP 17
632
633 struct blogic_bios_drvmap {
634 unsigned char tgt_idbit3:1;
635 unsigned char:2;
636 enum blogic_bios_diskgeometry diskgeom:2;
637 unsigned char tgt_id:3;
638 };
639
640
641
642
643
644
645 enum blogic_setccb_fmt {
646 BLOGIC_LEGACY_LUN_CCB = 0,
647 BLOGIC_EXT_LUN_CCB = 1
648 } PACKED;
649
650
651
652
653
654 enum blogic_action {
655 BLOGIC_OUTBOX_FREE = 0x00,
656 BLOGIC_MBOX_START = 0x01,
657 BLOGIC_MBOX_ABORT = 0x02
658 } PACKED;
659
660
661
662
663
664
665
666
667 enum blogic_cmplt_code {
668 BLOGIC_INBOX_FREE = 0x00,
669 BLOGIC_CMD_COMPLETE_GOOD = 0x01,
670 BLOGIC_CMD_ABORT_BY_HOST = 0x02,
671 BLOGIC_CMD_NOTFOUND = 0x03,
672 BLOGIC_CMD_COMPLETE_ERROR = 0x04,
673 BLOGIC_INVALID_CCB = 0x05
674 } PACKED;
675
676
677
678
679
680 enum blogic_ccb_opcode {
681 BLOGIC_INITIATOR_CCB = 0x00,
682 BLOGIC_TGT_CCB = 0x01,
683 BLOGIC_INITIATOR_CCB_SG = 0x02,
684 BLOGIC_INITIATOR_CCBB_RESIDUAL = 0x03,
685 BLOGIC_INITIATOR_CCB_SG_RESIDUAL = 0x04,
686 BLOGIC_BDR = 0x81
687 } PACKED;
688
689
690
691
692
693
694 enum blogic_datadir {
695 BLOGIC_UNCHECKED_TX = 0,
696 BLOGIC_DATAIN_CHECKED = 1,
697 BLOGIC_DATAOUT_CHECKED = 2,
698 BLOGIC_NOTX = 3
699 };
700
701
702
703
704
705
706
707 enum blogic_adapter_status {
708 BLOGIC_CMD_CMPLT_NORMAL = 0x00,
709 BLOGIC_LINK_CMD_CMPLT = 0x0A,
710 BLOGIC_LINK_CMD_CMPLT_FLAG = 0x0B,
711 BLOGIC_DATA_UNDERRUN = 0x0C,
712 BLOGIC_SELECT_TIMEOUT = 0x11,
713 BLOGIC_DATA_OVERRUN = 0x12,
714 BLOGIC_NOEXPECT_BUSFREE = 0x13,
715 BLOGIC_INVALID_BUSPHASE = 0x14,
716 BLOGIC_INVALID_OUTBOX_CODE = 0x15,
717 BLOGIC_INVALID_CMD_CODE = 0x16,
718 BLOGIC_LINKCCB_BADLUN = 0x17,
719 BLOGIC_BAD_CMD_PARAM = 0x1A,
720 BLOGIC_AUTOREQSENSE_FAIL = 0x1B,
721 BLOGIC_TAGQUEUE_REJECT = 0x1C,
722 BLOGIC_BAD_MSG_RCVD = 0x1D,
723 BLOGIC_HW_FAIL = 0x20,
724 BLOGIC_NORESPONSE_TO_ATN = 0x21,
725 BLOGIC_HW_RESET = 0x22,
726 BLOGIC_RST_FROM_OTHERDEV = 0x23,
727 BLOGIC_BAD_RECONNECT = 0x24,
728 BLOGIC_HW_BDR = 0x25,
729 BLOGIC_ABRT_QUEUE = 0x26,
730 BLOGIC_ADAPTER_SW_ERROR = 0x27,
731 BLOGIC_HW_TIMEOUT = 0x30,
732 BLOGIC_PARITY_ERR = 0x34
733 } PACKED;
734
735
736
737
738
739
740 enum blogic_tgt_status {
741 BLOGIC_OP_GOOD = 0x00,
742 BLOGIC_CHECKCONDITION = 0x02,
743 BLOGIC_DEVBUSY = 0x08
744 } PACKED;
745
746
747
748
749
750 enum blogic_queuetag {
751 BLOGIC_SIMPLETAG = 0,
752 BLOGIC_HEADTAG = 1,
753 BLOGIC_ORDEREDTAG = 2,
754 BLOGIC_RSVDTAG = 3
755 };
756
757
758
759
760
761 #define BLOGIC_CDB_MAXLEN 12
762
763
764
765
766
767
768
769 struct blogic_sg_seg {
770 u32 segbytes;
771 u32 segdata;
772 };
773
774
775
776
777
778 enum blogic_ccb_status {
779 BLOGIC_CCB_FREE = 0,
780 BLOGIC_CCB_ACTIVE = 1,
781 BLOGIC_CCB_COMPLETE = 2,
782 BLOGIC_CCB_RESET = 3
783 } PACKED;
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805 struct blogic_ccb {
806
807
808
809 enum blogic_ccb_opcode opcode;
810 unsigned char:3;
811 enum blogic_datadir datadir:2;
812 bool tag_enable:1;
813 enum blogic_queuetag queuetag:2;
814 unsigned char cdblen;
815 unsigned char sense_datalen;
816 u32 datalen;
817 void *data;
818 unsigned char:8;
819 unsigned char:8;
820 enum blogic_adapter_status adapter_status;
821 enum blogic_tgt_status tgt_status;
822 unsigned char tgt_id;
823 unsigned char lun:5;
824 bool legacytag_enable:1;
825 enum blogic_queuetag legacy_tag:2;
826 unsigned char cdb[BLOGIC_CDB_MAXLEN];
827 unsigned char:8;
828 unsigned char:8;
829 u32 rsvd_int;
830 u32 sensedata;
831
832
833
834 void (*callback) (struct blogic_ccb *);
835 u32 base_addr;
836 enum blogic_cmplt_code comp_code;
837 #ifdef CONFIG_SCSI_FLASHPOINT
838 unsigned char:8;
839 u16 os_flags;
840 unsigned char private[24];
841 void *rsvd1;
842 void *rsvd2;
843 unsigned char private2[16];
844 #endif
845
846
847
848 dma_addr_t allocgrp_head;
849 unsigned int allocgrp_size;
850 u32 dma_handle;
851 enum blogic_ccb_status status;
852 unsigned long serial;
853 struct scsi_cmnd *command;
854 struct blogic_adapter *adapter;
855 struct blogic_ccb *next;
856 struct blogic_ccb *next_all;
857 struct blogic_sg_seg sglist[BLOGIC_SG_LIMIT];
858 };
859
860
861
862
863
864 struct blogic_outbox {
865 u32 ccb;
866 u32:24;
867 enum blogic_action action;
868 };
869
870
871
872
873
874 struct blogic_inbox {
875 u32 ccb;
876 enum blogic_adapter_status adapter_status;
877 enum blogic_tgt_status tgt_status;
878 unsigned char:8;
879 enum blogic_cmplt_code comp_code;
880 };
881
882
883
884
885
886
887 struct blogic_drvr_options {
888 unsigned short tagq_ok;
889 unsigned short tagq_ok_mask;
890 unsigned short bus_settle_time;
891 unsigned short stop_tgt_inquiry;
892 unsigned char common_qdepth;
893 unsigned char qdepth[BLOGIC_MAXDEV];
894 };
895
896
897
898
899
900 struct blogic_tgt_flags {
901 bool tgt_exists:1;
902 bool tagq_ok:1;
903 bool wide_ok:1;
904 bool tagq_active:1;
905 bool wide_active:1;
906 bool cmd_good:1;
907 bool tgt_info_in:1;
908 };
909
910
911
912
913
914 #define BLOGIC_SZ_BUCKETS 10
915
916 struct blogic_tgt_stats {
917 unsigned int cmds_tried;
918 unsigned int cmds_complete;
919 unsigned int read_cmds;
920 unsigned int write_cmds;
921 struct blogic_byte_count bytesread;
922 struct blogic_byte_count byteswritten;
923 unsigned int read_sz_buckets[BLOGIC_SZ_BUCKETS];
924 unsigned int write_sz_buckets[BLOGIC_SZ_BUCKETS];
925 unsigned short aborts_request;
926 unsigned short aborts_tried;
927 unsigned short aborts_done;
928 unsigned short bdr_request;
929 unsigned short bdr_tried;
930 unsigned short bdr_done;
931 unsigned short adapter_reset_req;
932 unsigned short adapter_reset_attempt;
933 unsigned short adapter_reset_done;
934 };
935
936
937
938
939
940 #define FPOINT_BADCARD_HANDLE 0xFFFFFFFFL
941
942
943
944
945
946
947
948 struct fpoint_info {
949 u32 base_addr;
950 bool present;
951 unsigned char irq_ch;
952 unsigned char scsi_id;
953 unsigned char scsi_lun;
954 u16 fw_rev;
955 u16 sync_ok;
956 u16 fast_ok;
957 u16 ultra_ok;
958 u16 discon_ok;
959 u16 wide_ok;
960 bool parity:1;
961 bool wide:1;
962 bool softreset:1;
963 bool ext_trans_enable:1;
964 bool low_term:1;
965 bool high_term:1;
966 bool report_underrun:1;
967 bool scam_enabled:1;
968 bool scam_lev2:1;
969 unsigned char:7;
970 unsigned char family;
971 unsigned char bus_type;
972 unsigned char model[3];
973 unsigned char relative_cardnum;
974 unsigned char rsvd[4];
975 u32 os_rsvd;
976 unsigned char translation_info[4];
977 u32 rsvd2[5];
978 u32 sec_range;
979 };
980
981
982
983
984
985 struct blogic_adapter {
986 struct Scsi_Host *scsi_host;
987 struct pci_dev *pci_device;
988 enum blogic_adapter_type adapter_type;
989 enum blogic_adapter_bus_type adapter_bus_type;
990 unsigned long io_addr;
991 unsigned long pci_addr;
992 unsigned short addr_count;
993 unsigned char host_no;
994 unsigned char model[9];
995 unsigned char fw_ver[6];
996 unsigned char full_model[18];
997 unsigned char bus;
998 unsigned char dev;
999 unsigned char irq_ch;
1000 unsigned char dma_ch;
1001 unsigned char scsi_id;
1002 bool irq_acquired:1;
1003 bool dma_chan_acquired:1;
1004 bool ext_trans_enable:1;
1005 bool parity:1;
1006 bool reset_enabled:1;
1007 bool level_int:1;
1008 bool wide:1;
1009 bool differential:1;
1010 bool scam:1;
1011 bool ultra:1;
1012 bool ext_lun:1;
1013 bool terminfo_valid:1;
1014 bool low_term:1;
1015 bool high_term:1;
1016 bool need_bouncebuf:1;
1017 bool strict_rr:1;
1018 bool scam_enabled:1;
1019 bool scam_lev2:1;
1020 bool adapter_initd:1;
1021 bool adapter_extreset:1;
1022 bool adapter_intern_err:1;
1023 bool processing_ccbs;
1024 volatile bool adapter_cmd_complete;
1025 unsigned short adapter_sglimit;
1026 unsigned short drvr_sglimit;
1027 unsigned short maxdev;
1028 unsigned short maxlun;
1029 unsigned short mbox_count;
1030 unsigned short initccbs;
1031 unsigned short inc_ccbs;
1032 unsigned short alloc_ccbs;
1033 unsigned short drvr_qdepth;
1034 unsigned short adapter_qdepth;
1035 unsigned short untag_qdepth;
1036 unsigned short common_qdepth;
1037 unsigned short bus_settle_time;
1038 unsigned short sync_ok;
1039 unsigned short fast_ok;
1040 unsigned short ultra_ok;
1041 unsigned short wide_ok;
1042 unsigned short discon_ok;
1043 unsigned short tagq_ok;
1044 unsigned short ext_resets;
1045 unsigned short adapter_intern_errors;
1046 unsigned short tgt_count;
1047 unsigned short msgbuflen;
1048 u32 bios_addr;
1049 struct blogic_drvr_options *drvr_opts;
1050 struct fpoint_info fpinfo;
1051 void *cardhandle;
1052 struct list_head host_list;
1053 struct blogic_ccb *all_ccbs;
1054 struct blogic_ccb *free_ccbs;
1055 struct blogic_ccb *firstccb;
1056 struct blogic_ccb *lastccb;
1057 struct blogic_ccb *bdr_pend[BLOGIC_MAXDEV];
1058 struct blogic_tgt_flags tgt_flags[BLOGIC_MAXDEV];
1059 unsigned char qdepth[BLOGIC_MAXDEV];
1060 unsigned char sync_period[BLOGIC_MAXDEV];
1061 unsigned char sync_offset[BLOGIC_MAXDEV];
1062 unsigned char active_cmds[BLOGIC_MAXDEV];
1063 unsigned int cmds_since_rst[BLOGIC_MAXDEV];
1064 unsigned long last_seqpoint[BLOGIC_MAXDEV];
1065 unsigned long last_resettried[BLOGIC_MAXDEV];
1066 unsigned long last_resetdone[BLOGIC_MAXDEV];
1067 struct blogic_outbox *first_outbox;
1068 struct blogic_outbox *last_outbox;
1069 struct blogic_outbox *next_outbox;
1070 struct blogic_inbox *first_inbox;
1071 struct blogic_inbox *last_inbox;
1072 struct blogic_inbox *next_inbox;
1073 struct blogic_tgt_stats tgt_stats[BLOGIC_MAXDEV];
1074 unsigned char *mbox_space;
1075 dma_addr_t mbox_space_handle;
1076 unsigned int mbox_sz;
1077 unsigned long ccb_offset;
1078 char msgbuf[BLOGIC_MSGBUF_SIZE];
1079 };
1080
1081
1082
1083
1084
1085 struct bios_diskparam {
1086 int heads;
1087 int sectors;
1088 int cylinders;
1089 };
1090
1091
1092
1093
1094
1095 struct scsi_inquiry {
1096 unsigned char devtype:5;
1097 unsigned char dev_qual:3;
1098 unsigned char dev_modifier:7;
1099 bool rmb:1;
1100 unsigned char ansi_ver:3;
1101 unsigned char ecma_ver:3;
1102 unsigned char iso_ver:2;
1103 unsigned char resp_fmt:4;
1104 unsigned char:2;
1105 bool TrmIOP:1;
1106 bool AENC:1;
1107 unsigned char addl_len;
1108 unsigned char:8;
1109 unsigned char:8;
1110 bool SftRe:1;
1111 bool CmdQue:1;
1112 bool:1;
1113 bool linked:1;
1114 bool sync:1;
1115 bool WBus16:1;
1116 bool WBus32:1;
1117 bool RelAdr:1;
1118 unsigned char vendor[8];
1119 unsigned char product[16];
1120 unsigned char product_rev[4];
1121 };
1122
1123
1124
1125
1126
1127
1128
1129 static inline void blogic_busreset(struct blogic_adapter *adapter)
1130 {
1131 union blogic_cntrl_reg cr;
1132 cr.all = 0;
1133 cr.cr.bus_reset = true;
1134 outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
1135 }
1136
1137 static inline void blogic_intreset(struct blogic_adapter *adapter)
1138 {
1139 union blogic_cntrl_reg cr;
1140 cr.all = 0;
1141 cr.cr.int_reset = true;
1142 outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
1143 }
1144
1145 static inline void blogic_softreset(struct blogic_adapter *adapter)
1146 {
1147 union blogic_cntrl_reg cr;
1148 cr.all = 0;
1149 cr.cr.soft_reset = true;
1150 outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
1151 }
1152
1153 static inline void blogic_hardreset(struct blogic_adapter *adapter)
1154 {
1155 union blogic_cntrl_reg cr;
1156 cr.all = 0;
1157 cr.cr.hard_reset = true;
1158 outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
1159 }
1160
1161 static inline unsigned char blogic_rdstatus(struct blogic_adapter *adapter)
1162 {
1163 return inb(adapter->io_addr + BLOGIC_STATUS_REG);
1164 }
1165
1166 static inline void blogic_setcmdparam(struct blogic_adapter *adapter,
1167 unsigned char value)
1168 {
1169 outb(value, adapter->io_addr + BLOGIC_CMD_PARM_REG);
1170 }
1171
1172 static inline unsigned char blogic_rddatain(struct blogic_adapter *adapter)
1173 {
1174 return inb(adapter->io_addr + BLOGIC_DATAIN_REG);
1175 }
1176
1177 static inline unsigned char blogic_rdint(struct blogic_adapter *adapter)
1178 {
1179 return inb(adapter->io_addr + BLOGIC_INT_REG);
1180 }
1181
1182 static inline unsigned char blogic_rdgeom(struct blogic_adapter *adapter)
1183 {
1184 return inb(adapter->io_addr + BLOGIC_GEOMETRY_REG);
1185 }
1186
1187
1188
1189
1190
1191
1192
1193 static inline void blogic_execmbox(struct blogic_adapter *adapter)
1194 {
1195 blogic_setcmdparam(adapter, BLOGIC_EXEC_MBOX_CMD);
1196 }
1197
1198
1199
1200
1201
1202 static inline void blogic_delay(int seconds)
1203 {
1204 mdelay(1000 * seconds);
1205 }
1206
1207
1208
1209
1210
1211
1212
1213 static inline u32 virt_to_32bit_virt(void *virt_addr)
1214 {
1215 return (u32) (unsigned long) virt_addr;
1216 }
1217
1218
1219
1220
1221
1222
1223 static inline void blogic_inc_count(unsigned short *count)
1224 {
1225 if (*count < 65535)
1226 (*count)++;
1227 }
1228
1229
1230
1231
1232
1233 static inline void blogic_addcount(struct blogic_byte_count *bytecount,
1234 unsigned int amount)
1235 {
1236 bytecount->units += amount;
1237 if (bytecount->units > 999999999) {
1238 bytecount->units -= 1000000000;
1239 bytecount->billions++;
1240 }
1241 }
1242
1243
1244
1245
1246
1247 static inline void blogic_incszbucket(unsigned int *cmdsz_buckets,
1248 unsigned int amount)
1249 {
1250 int index = 0;
1251 if (amount < 8 * 1024) {
1252 if (amount < 2 * 1024)
1253 index = (amount < 1 * 1024 ? 0 : 1);
1254 else
1255 index = (amount < 4 * 1024 ? 2 : 3);
1256 } else if (amount < 128 * 1024) {
1257 if (amount < 32 * 1024)
1258 index = (amount < 16 * 1024 ? 4 : 5);
1259 else
1260 index = (amount < 64 * 1024 ? 6 : 7);
1261 } else
1262 index = (amount < 256 * 1024 ? 8 : 9);
1263 cmdsz_buckets[index]++;
1264 }
1265
1266
1267
1268
1269
1270 #define FLASHPOINT_FW_VER "5.02"
1271
1272
1273
1274
1275
1276 #define FPOINT_NORMAL_INT 0x00
1277 #define FPOINT_INTERN_ERR 0xFE
1278 #define FPOINT_EXT_RESET 0xFF
1279
1280
1281
1282
1283
1284
1285 static const char *blogic_drvr_info(struct Scsi_Host *);
1286 static int blogic_qcmd(struct Scsi_Host *h, struct scsi_cmnd *);
1287 static int blogic_diskparam(struct scsi_device *, struct block_device *, sector_t, int *);
1288 static int blogic_slaveconfig(struct scsi_device *);
1289 static void blogic_qcompleted_ccb(struct blogic_ccb *);
1290 static irqreturn_t blogic_inthandler(int, void *);
1291 static int blogic_resetadapter(struct blogic_adapter *, bool hard_reset);
1292 static void blogic_msg(enum blogic_msglevel, char *, struct blogic_adapter *, ...);
1293 static int __init blogic_setup(char *);
1294
1295 #endif