1
2
3
4
5
6
7
8
9
10
11
12
13 #ifndef MYRB_H
14 #define MYRB_H
15
16 #define MYRB_MAX_LDEVS 32
17 #define MYRB_MAX_CHANNELS 3
18 #define MYRB_MAX_TARGETS 16
19 #define MYRB_MAX_PHYSICAL_DEVICES 45
20 #define MYRB_SCATTER_GATHER_LIMIT 32
21 #define MYRB_CMD_MBOX_COUNT 256
22 #define MYRB_STAT_MBOX_COUNT 1024
23
24 #define MYRB_BLKSIZE_BITS 9
25 #define MYRB_MAILBOX_TIMEOUT 1000000
26
27 #define MYRB_DCMD_TAG 1
28 #define MYRB_MCMD_TAG 2
29
30 #define MYRB_PRIMARY_MONITOR_INTERVAL (10 * HZ)
31 #define MYRB_SECONDARY_MONITOR_INTERVAL (60 * HZ)
32
33
34
35
36 enum myrb_cmd_opcode {
37
38 MYRB_CMD_READ_EXTENDED = 0x33,
39 MYRB_CMD_WRITE_EXTENDED = 0x34,
40 MYRB_CMD_READAHEAD_EXTENDED = 0x35,
41 MYRB_CMD_READ_EXTENDED_SG = 0xB3,
42 MYRB_CMD_WRITE_EXTENDED_SG = 0xB4,
43 MYRB_CMD_READ = 0x36,
44 MYRB_CMD_READ_SG = 0xB6,
45 MYRB_CMD_WRITE = 0x37,
46 MYRB_CMD_WRITE_SG = 0xB7,
47 MYRB_CMD_DCDB = 0x04,
48 MYRB_CMD_DCDB_SG = 0x84,
49 MYRB_CMD_FLUSH = 0x0A,
50
51 MYRB_CMD_ENQUIRY = 0x53,
52 MYRB_CMD_ENQUIRY2 = 0x1C,
53 MYRB_CMD_GET_LDRV_ELEMENT = 0x55,
54 MYRB_CMD_GET_LDEV_INFO = 0x19,
55 MYRB_CMD_IOPORTREAD = 0x39,
56 MYRB_CMD_IOPORTWRITE = 0x3A,
57 MYRB_CMD_GET_SD_STATS = 0x3E,
58 MYRB_CMD_GET_PD_STATS = 0x3F,
59 MYRB_CMD_EVENT_LOG_OPERATION = 0x72,
60
61 MYRB_CMD_START_DEVICE = 0x10,
62 MYRB_CMD_GET_DEVICE_STATE = 0x50,
63 MYRB_CMD_STOP_CHANNEL = 0x13,
64 MYRB_CMD_START_CHANNEL = 0x12,
65 MYRB_CMD_RESET_CHANNEL = 0x1A,
66
67 MYRB_CMD_REBUILD = 0x09,
68 MYRB_CMD_REBUILD_ASYNC = 0x16,
69 MYRB_CMD_CHECK_CONSISTENCY = 0x0F,
70 MYRB_CMD_CHECK_CONSISTENCY_ASYNC = 0x1E,
71 MYRB_CMD_REBUILD_STAT = 0x0C,
72 MYRB_CMD_GET_REBUILD_PROGRESS = 0x27,
73 MYRB_CMD_REBUILD_CONTROL = 0x1F,
74 MYRB_CMD_READ_BADBLOCK_TABLE = 0x0B,
75 MYRB_CMD_READ_BADDATA_TABLE = 0x25,
76 MYRB_CMD_CLEAR_BADDATA_TABLE = 0x26,
77 MYRB_CMD_GET_ERROR_TABLE = 0x17,
78 MYRB_CMD_ADD_CAPACITY_ASYNC = 0x2A,
79 MYRB_CMD_BGI_CONTROL = 0x2B,
80
81 MYRB_CMD_READ_CONFIG2 = 0x3D,
82 MYRB_CMD_WRITE_CONFIG2 = 0x3C,
83 MYRB_CMD_READ_CONFIG_ONDISK = 0x4A,
84 MYRB_CMD_WRITE_CONFIG_ONDISK = 0x4B,
85 MYRB_CMD_READ_CONFIG = 0x4E,
86 MYRB_CMD_READ_BACKUP_CONFIG = 0x4D,
87 MYRB_CMD_WRITE_CONFIG = 0x4F,
88 MYRB_CMD_ADD_CONFIG = 0x4C,
89 MYRB_CMD_READ_CONFIG_LABEL = 0x48,
90 MYRB_CMD_WRITE_CONFIG_LABEL = 0x49,
91
92 MYRB_CMD_LOAD_IMAGE = 0x20,
93 MYRB_CMD_STORE_IMAGE = 0x21,
94 MYRB_CMD_PROGRAM_IMAGE = 0x22,
95
96 MYRB_CMD_SET_DIAGNOSTIC_MODE = 0x31,
97 MYRB_CMD_RUN_DIAGNOSTIC = 0x32,
98
99 MYRB_CMD_GET_SUBSYS_DATA = 0x70,
100 MYRB_CMD_SET_SUBSYS_PARAM = 0x71,
101
102 MYRB_CMD_ENQUIRY_OLD = 0x05,
103 MYRB_CMD_GET_DEVICE_STATE_OLD = 0x14,
104 MYRB_CMD_READ_OLD = 0x02,
105 MYRB_CMD_WRITE_OLD = 0x03,
106 MYRB_CMD_READ_SG_OLD = 0x82,
107 MYRB_CMD_WRITE_SG_OLD = 0x83
108 } __packed;
109
110
111
112
113 #define MYRB_STATUS_SUCCESS 0x0000
114 #define MYRB_STATUS_CHECK_CONDITION 0x0002
115 #define MYRB_STATUS_NO_DEVICE 0x0102
116 #define MYRB_STATUS_INVALID_ADDRESS 0x0105
117 #define MYRB_STATUS_INVALID_PARAM 0x0105
118 #define MYRB_STATUS_IRRECOVERABLE_DATA_ERROR 0x0001
119 #define MYRB_STATUS_LDRV_NONEXISTENT_OR_OFFLINE 0x0002
120 #define MYRB_STATUS_ACCESS_BEYOND_END_OF_LDRV 0x0105
121 #define MYRB_STATUS_BAD_DATA 0x010C
122 #define MYRB_STATUS_DEVICE_BUSY 0x0008
123 #define MYRB_STATUS_DEVICE_NONRESPONSIVE 0x000E
124 #define MYRB_STATUS_COMMAND_TERMINATED 0x000F
125 #define MYRB_STATUS_START_DEVICE_FAILED 0x0002
126 #define MYRB_STATUS_INVALID_CHANNEL_OR_TARGET 0x0105
127 #define MYRB_STATUS_CHANNEL_BUSY 0x0106
128 #define MYRB_STATUS_OUT_OF_MEMORY 0x0107
129 #define MYRB_STATUS_CHANNEL_NOT_STOPPED 0x0002
130 #define MYRB_STATUS_ATTEMPT_TO_RBLD_ONLINE_DRIVE 0x0002
131 #define MYRB_STATUS_RBLD_BADBLOCKS 0x0003
132 #define MYRB_STATUS_RBLD_NEW_DISK_FAILED 0x0004
133 #define MYRB_STATUS_RBLD_OR_CHECK_INPROGRESS 0x0106
134 #define MYRB_STATUS_DEPENDENT_DISK_DEAD 0x0002
135 #define MYRB_STATUS_INCONSISTENT_BLOCKS 0x0003
136 #define MYRB_STATUS_INVALID_OR_NONREDUNDANT_LDRV 0x0105
137 #define MYRB_STATUS_NO_RBLD_OR_CHECK_INPROGRESS 0x0105
138 #define MYRB_STATUS_RBLD_IN_PROGRESS_DATA_VALID 0x0000
139 #define MYRB_STATUS_RBLD_FAILED_LDEV_FAILURE 0x0002
140 #define MYRB_STATUS_RBLD_FAILED_BADBLOCKS 0x0003
141 #define MYRB_STATUS_RBLD_FAILED_NEW_DRIVE_FAILED 0x0004
142 #define MYRB_STATUS_RBLD_SUCCESS 0x0100
143 #define MYRB_STATUS_RBLD_SUCCESS_TERMINATED 0x0107
144 #define MYRB_STATUS_RBLD_NOT_CHECKED 0x0108
145 #define MYRB_STATUS_BGI_SUCCESS 0x0100
146 #define MYRB_STATUS_BGI_ABORTED 0x0005
147 #define MYRB_STATUS_NO_BGI_INPROGRESS 0x0105
148 #define MYRB_STATUS_ADD_CAPACITY_INPROGRESS 0x0004
149 #define MYRB_STATUS_ADD_CAPACITY_FAILED_OR_SUSPENDED 0x00F4
150 #define MYRB_STATUS_CONFIG2_CSUM_ERROR 0x0002
151 #define MYRB_STATUS_CONFIGURATION_SUSPENDED 0x0106
152 #define MYRB_STATUS_FAILED_TO_CONFIGURE_NVRAM 0x0105
153 #define MYRB_STATUS_CONFIGURATION_NOT_SAVED 0x0106
154 #define MYRB_STATUS_SUBSYS_NOTINSTALLED 0x0001
155 #define MYRB_STATUS_SUBSYS_FAILED 0x0002
156 #define MYRB_STATUS_SUBSYS_BUSY 0x0106
157 #define MYRB_STATUS_SUBSYS_TIMEOUT 0x0108
158
159
160
161
162 struct myrb_enquiry {
163 unsigned char ldev_count;
164 unsigned int rsvd1:24;
165 unsigned int ldev_sizes[32];
166 unsigned short flash_age;
167 struct {
168 unsigned char deferred:1;
169 unsigned char low_bat:1;
170 unsigned char rsvd2:6;
171 } status;
172 unsigned char rsvd3:8;
173 unsigned char fw_minor_version;
174 unsigned char fw_major_version;
175 enum {
176 MYRB_NO_STDBY_RBLD_OR_CHECK_IN_PROGRESS = 0x00,
177 MYRB_STDBY_RBLD_IN_PROGRESS = 0x01,
178 MYRB_BG_RBLD_IN_PROGRESS = 0x02,
179 MYRB_BG_CHECK_IN_PROGRESS = 0x03,
180 MYRB_STDBY_RBLD_COMPLETED_WITH_ERROR = 0xFF,
181 MYRB_BG_RBLD_OR_CHECK_FAILED_DRIVE_FAILED = 0xF0,
182 MYRB_BG_RBLD_OR_CHECK_FAILED_LDEV_FAILED = 0xF1,
183 MYRB_BG_RBLD_OR_CHECK_FAILED_OTHER = 0xF2,
184 MYRB_BG_RBLD_OR_CHECK_SUCCESS_TERMINATED = 0xF3
185 } __packed rbld;
186 unsigned char max_tcq;
187 unsigned char ldev_offline;
188 unsigned char rsvd4:8;
189 unsigned short ev_seq;
190 unsigned char ldev_critical;
191 unsigned int rsvd5:24;
192 unsigned char pdev_dead;
193 unsigned char rsvd6:8;
194 unsigned char rbld_count;
195 struct {
196 unsigned char rsvd7:3;
197 unsigned char bbu_present:1;
198 unsigned char rsvd8:4;
199 } misc;
200 struct {
201 unsigned char target;
202 unsigned char channel;
203 } dead_drives[21];
204 unsigned char rsvd9[62];
205 } __packed;
206
207
208
209
210 struct myrb_enquiry2 {
211 struct {
212 enum {
213 DAC960_V1_P_PD_PU = 0x01,
214 DAC960_V1_PL = 0x02,
215 DAC960_V1_PG = 0x10,
216 DAC960_V1_PJ = 0x11,
217 DAC960_V1_PR = 0x12,
218 DAC960_V1_PT = 0x13,
219 DAC960_V1_PTL0 = 0x14,
220 DAC960_V1_PRL = 0x15,
221 DAC960_V1_PTL1 = 0x16,
222 DAC960_V1_1164P = 0x20
223 } __packed sub_model;
224 unsigned char actual_channels;
225 enum {
226 MYRB_5_CHANNEL_BOARD = 0x01,
227 MYRB_3_CHANNEL_BOARD = 0x02,
228 MYRB_2_CHANNEL_BOARD = 0x03,
229 MYRB_3_CHANNEL_ASIC_DAC = 0x04
230 } __packed model;
231 enum {
232 MYRB_EISA_CONTROLLER = 0x01,
233 MYRB_MCA_CONTROLLER = 0x02,
234 MYRB_PCI_CONTROLLER = 0x03,
235 MYRB_SCSI_TO_SCSI = 0x08
236 } __packed controller;
237 } hw;
238
239 struct {
240 unsigned char major_version;
241 unsigned char minor_version;
242 unsigned char turn_id;
243 char firmware_type;
244 } fw;
245 unsigned int rsvd1;
246 unsigned char cfg_chan;
247 unsigned char cur_chan;
248 unsigned char max_targets;
249 unsigned char max_tcq;
250 unsigned char max_ldev;
251 unsigned char max_arms;
252 unsigned char max_spans;
253 unsigned char rsvd2;
254 unsigned int rsvd3;
255 unsigned int mem_size;
256 unsigned int cache_size;
257 unsigned int flash_size;
258 unsigned int nvram_size;
259 struct {
260 enum {
261 MYRB_RAM_TYPE_DRAM = 0x0,
262 MYRB_RAM_TYPE_EDO = 0x1,
263 MYRB_RAM_TYPE_SDRAM = 0x2,
264 MYRB_RAM_TYPE_Last = 0x7
265 } __packed ram:3;
266 enum {
267 MYRB_ERR_CORR_None = 0x0,
268 MYRB_ERR_CORR_Parity = 0x1,
269 MYRB_ERR_CORR_ECC = 0x2,
270 MYRB_ERR_CORR_Last = 0x7
271 } __packed ec:3;
272 unsigned char fast_page:1;
273 unsigned char low_power:1;
274 unsigned char rsvd4;
275 } mem_type;
276 unsigned short clock_speed;
277 unsigned short mem_speed;
278 unsigned short hw_speed;
279 unsigned char rsvd5[12];
280 unsigned short max_cmds;
281 unsigned short max_sge;
282 unsigned short max_drv_cmds;
283 unsigned short max_io_desc;
284 unsigned short max_sectors;
285 unsigned char latency;
286 unsigned char rsvd6;
287 unsigned char scsi_tmo;
288 unsigned char rsvd7;
289 unsigned short min_freelines;
290 unsigned char rsvd8[8];
291 unsigned char rbld_rate_const;
292 unsigned char rsvd9[11];
293 unsigned short pdrv_block_size;
294 unsigned short ldev_block_size;
295 unsigned short max_blocks_per_cmd;
296 unsigned short block_factor;
297 unsigned short cacheline_size;
298 struct {
299 enum {
300 MYRB_WIDTH_NARROW_8BIT = 0x0,
301 MYRB_WIDTH_WIDE_16BIT = 0x1,
302 MYRB_WIDTH_WIDE_32BIT = 0x2
303 } __packed bus_width:2;
304 enum {
305 MYRB_SCSI_SPEED_FAST = 0x0,
306 MYRB_SCSI_SPEED_ULTRA = 0x1,
307 MYRB_SCSI_SPEED_ULTRA2 = 0x2
308 } __packed bus_speed:2;
309 unsigned char differential:1;
310 unsigned char rsvd10:3;
311 } scsi_cap;
312 unsigned char rsvd11[5];
313 unsigned short fw_build;
314 enum {
315 MYRB_FAULT_AEMI = 0x01,
316 MYRB_FAULT_OEM1 = 0x02,
317 MYRB_FAULT_OEM2 = 0x04,
318 MYRB_FAULT_OEM3 = 0x08,
319 MYRB_FAULT_CONNER = 0x10,
320 MYRB_FAULT_SAFTE = 0x20
321 } __packed fault_mgmt;
322 unsigned char rsvd12;
323 struct {
324 unsigned int clustering:1;
325 unsigned int online_RAID_expansion:1;
326 unsigned int readahead:1;
327 unsigned int bgi:1;
328 unsigned int rsvd13:28;
329 } fw_features;
330 unsigned char rsvd14[8];
331 } __packed;
332
333
334
335
336 enum myrb_devstate {
337 MYRB_DEVICE_DEAD = 0x00,
338 MYRB_DEVICE_WO = 0x02,
339 MYRB_DEVICE_ONLINE = 0x03,
340 MYRB_DEVICE_CRITICAL = 0x04,
341 MYRB_DEVICE_STANDBY = 0x10,
342 MYRB_DEVICE_OFFLINE = 0xFF
343 } __packed;
344
345
346
347
348 enum myrb_raidlevel {
349 MYRB_RAID_LEVEL0 = 0x0,
350 MYRB_RAID_LEVEL1 = 0x1,
351 MYRB_RAID_LEVEL3 = 0x3,
352 MYRB_RAID_LEVEL5 = 0x5,
353 MYRB_RAID_LEVEL6 = 0x6,
354 MYRB_RAID_JBOD = 0x7,
355 } __packed;
356
357
358
359
360 struct myrb_ldev_info {
361 unsigned int size;
362 enum myrb_devstate state;
363 unsigned int raid_level:7;
364 unsigned int wb_enabled:1;
365 unsigned int rsvd:16;
366 };
367
368
369
370
371 #define DAC960_V1_GetEventLogEntry 0x00
372
373
374
375
376 struct myrb_log_entry {
377 unsigned char msg_type;
378 unsigned char msg_len;
379 unsigned char target:5;
380 unsigned char channel:3;
381 unsigned char lun:6;
382 unsigned char rsvd1:2;
383 unsigned short seq_num;
384 unsigned char sense[26];
385 };
386
387
388
389
390
391
392 struct myrb_pdev_state {
393 unsigned int present:1;
394 unsigned int :7;
395 enum {
396 MYRB_TYPE_OTHER = 0x0,
397 MYRB_TYPE_DISK = 0x1,
398 MYRB_TYPE_TAPE = 0x2,
399 MYRB_TYPE_CDROM_OR_WORM = 0x3
400 } __packed devtype:2;
401 unsigned int rsvd1:1;
402 unsigned int fast20:1;
403 unsigned int sync:1;
404 unsigned int fast:1;
405 unsigned int wide:1;
406 unsigned int tcq_supported:1;
407 enum myrb_devstate state;
408 unsigned int rsvd2:8;
409 unsigned int sync_multiplier;
410 unsigned int sync_offset:5;
411 unsigned int rsvd3:3;
412 unsigned int size;
413 unsigned int rsvd4:16;
414 } __packed;
415
416
417
418
419 struct myrb_rbld_progress {
420 unsigned int ldev_num;
421 unsigned int ldev_size;
422 unsigned int blocks_left;
423 };
424
425
426
427
428 struct myrb_bgi_status {
429 unsigned int ldev_size;
430 unsigned int blocks_done;
431 unsigned char rsvd1[12];
432 unsigned int ldev_num;
433 unsigned char raid_level;
434 enum {
435 MYRB_BGI_INVALID = 0x00,
436 MYRB_BGI_STARTED = 0x02,
437 MYRB_BGI_INPROGRESS = 0x04,
438 MYRB_BGI_SUSPENDED = 0x05,
439 MYRB_BGI_CANCELLED = 0x06
440 } __packed status;
441 unsigned char rsvd2[6];
442 };
443
444
445
446
447 struct myrb_error_entry {
448 unsigned char parity_err;
449 unsigned char soft_err;
450 unsigned char hard_err;
451 unsigned char misc_err;
452 };
453
454
455
456
457 struct myrb_config2 {
458 unsigned rsvd1:1;
459 unsigned active_negation:1;
460 unsigned rsvd2:5;
461 unsigned no_rescan_on_reset_during_scan:1;
462 unsigned StorageWorks_support:1;
463 unsigned HewlettPackard_support:1;
464 unsigned no_disconnect_on_first_command:1;
465 unsigned rsvd3:2;
466 unsigned AEMI_ARM:1;
467 unsigned AEMI_OFM:1;
468 unsigned rsvd4:1;
469 enum {
470 MYRB_OEMID_MYLEX = 0x00,
471 MYRB_OEMID_IBM = 0x08,
472 MYRB_OEMID_HP = 0x0A,
473 MYRB_OEMID_DEC = 0x0C,
474 MYRB_OEMID_SIEMENS = 0x10,
475 MYRB_OEMID_INTEL = 0x12
476 } __packed OEMID;
477 unsigned char oem_model_number;
478 unsigned char physical_sector;
479 unsigned char logical_sector;
480 unsigned char block_factor;
481 unsigned readahead_enabled:1;
482 unsigned low_BIOS_delay:1;
483 unsigned rsvd5:2;
484 unsigned restrict_reassign_to_one_sector:1;
485 unsigned rsvd6:1;
486 unsigned FUA_during_write_recovery:1;
487 unsigned enable_LeftSymmetricRAID5Algorithm:1;
488 unsigned char default_rebuild_rate;
489 unsigned char rsvd7;
490 unsigned char blocks_per_cacheline;
491 unsigned char blocks_per_stripe;
492 struct {
493 enum {
494 MYRB_SPEED_ASYNC = 0x0,
495 MYRB_SPEED_SYNC_8MHz = 0x1,
496 MYRB_SPEED_SYNC_5MHz = 0x2,
497 MYRB_SPEED_SYNC_10_OR_20MHz = 0x3
498 } __packed speed:2;
499 unsigned force_8bit:1;
500 unsigned disable_fast20:1;
501 unsigned rsvd8:3;
502 unsigned enable_tcq:1;
503 } __packed channelparam[6];
504 unsigned char SCSIInitiatorID;
505 unsigned char rsvd9;
506 enum {
507 MYRB_STARTUP_CONTROLLER_SPINUP = 0x00,
508 MYRB_STARTUP_POWERON_SPINUP = 0x01
509 } __packed startup;
510 unsigned char simultaneous_device_spinup_count;
511 unsigned char seconds_delay_between_spinups;
512 unsigned char rsvd10[29];
513 unsigned BIOS_disabled:1;
514 unsigned CDROM_boot_enabled:1;
515 unsigned rsvd11:3;
516 enum {
517 MYRB_GEOM_128_32 = 0x0,
518 MYRB_GEOM_255_63 = 0x1,
519 MYRB_GEOM_RESERVED1 = 0x2,
520 MYRB_GEOM_RESERVED2 = 0x3
521 } __packed drive_geometry:2;
522 unsigned rsvd12:1;
523 unsigned char rsvd13[9];
524 unsigned short csum;
525 };
526
527
528
529
530 struct myrb_dcdb {
531 unsigned target:4;
532 unsigned channel:4;
533 enum {
534 MYRB_DCDB_XFER_NONE = 0,
535 MYRB_DCDB_XFER_DEVICE_TO_SYSTEM = 1,
536 MYRB_DCDB_XFER_SYSTEM_TO_DEVICE = 2,
537 MYRB_DCDB_XFER_ILLEGAL = 3
538 } __packed data_xfer:2;
539 unsigned early_status:1;
540 unsigned rsvd1:1;
541 enum {
542 MYRB_DCDB_TMO_24_HRS = 0,
543 MYRB_DCDB_TMO_10_SECS = 1,
544 MYRB_DCDB_TMO_60_SECS = 2,
545 MYRB_DCDB_TMO_10_MINS = 3
546 } __packed timeout:2;
547 unsigned no_autosense:1;
548 unsigned allow_disconnect:1;
549 unsigned short xfer_len_lo;
550 u32 dma_addr;
551 unsigned char cdb_len:4;
552 unsigned char xfer_len_hi4:4;
553 unsigned char sense_len;
554 unsigned char cdb[12];
555 unsigned char sense[64];
556 unsigned char status;
557 unsigned char rsvd2;
558 };
559
560
561
562
563
564 struct myrb_sge {
565 u32 sge_addr;
566 u32 sge_count;
567 };
568
569
570
571
572
573
574 union myrb_cmd_mbox {
575 unsigned int words[4];
576 unsigned char bytes[16];
577 struct {
578 enum myrb_cmd_opcode opcode;
579 unsigned char id;
580 unsigned char rsvd[14];
581 } __packed common;
582 struct {
583 enum myrb_cmd_opcode opcode;
584 unsigned char id;
585 unsigned char rsvd1[6];
586 u32 addr;
587 unsigned char rsvd2[4];
588 } __packed type3;
589 struct {
590 enum myrb_cmd_opcode opcode;
591 unsigned char id;
592 unsigned char optype;
593 unsigned char rsvd1[5];
594 u32 addr;
595 unsigned char rsvd2[4];
596 } __packed type3B;
597 struct {
598 enum myrb_cmd_opcode opcode;
599 unsigned char id;
600 unsigned char rsvd1[5];
601 unsigned char ldev_num:6;
602 unsigned char auto_restore:1;
603 unsigned char rsvd2[8];
604 } __packed type3C;
605 struct {
606 enum myrb_cmd_opcode opcode;
607 unsigned char id;
608 unsigned char channel;
609 unsigned char target;
610 enum myrb_devstate state;
611 unsigned char rsvd1[3];
612 u32 addr;
613 unsigned char rsvd2[4];
614 } __packed type3D;
615 struct {
616 enum myrb_cmd_opcode opcode;
617 unsigned char id;
618 unsigned char optype;
619 unsigned char opqual;
620 unsigned short ev_seq;
621 unsigned char rsvd1[2];
622 u32 addr;
623 unsigned char rsvd2[4];
624 } __packed type3E;
625 struct {
626 enum myrb_cmd_opcode opcode;
627 unsigned char id;
628 unsigned char rsvd1[2];
629 unsigned char rbld_rate;
630 unsigned char rsvd2[3];
631 u32 addr;
632 unsigned char rsvd3[4];
633 } __packed type3R;
634 struct {
635 enum myrb_cmd_opcode opcode;
636 unsigned char id;
637 unsigned short xfer_len;
638 unsigned int lba;
639 u32 addr;
640 unsigned char ldev_num;
641 unsigned char rsvd[3];
642 } __packed type4;
643 struct {
644 enum myrb_cmd_opcode opcode;
645 unsigned char id;
646 struct {
647 unsigned short xfer_len:11;
648 unsigned char ldev_num:5;
649 } __packed ld;
650 unsigned int lba;
651 u32 addr;
652 unsigned char sg_count:6;
653 enum {
654 MYRB_SGL_ADDR32_COUNT32 = 0x0,
655 MYRB_SGL_ADDR32_COUNT16 = 0x1,
656 MYRB_SGL_COUNT32_ADDR32 = 0x2,
657 MYRB_SGL_COUNT16_ADDR32 = 0x3
658 } __packed sg_type:2;
659 unsigned char rsvd[3];
660 } __packed type5;
661 struct {
662 enum myrb_cmd_opcode opcode;
663 unsigned char id;
664 unsigned char opcode2;
665 unsigned char rsvd1:8;
666 u32 cmd_mbox_addr;
667 u32 stat_mbox_addr;
668 unsigned char rsvd2[4];
669 } __packed typeX;
670 };
671
672
673
674
675 struct myrb_stat_mbox {
676 unsigned char id;
677 unsigned char rsvd:7;
678 unsigned char valid:1;
679 unsigned short status;
680 };
681
682 struct myrb_cmdblk {
683 union myrb_cmd_mbox mbox;
684 unsigned short status;
685 struct completion *completion;
686 struct myrb_dcdb *dcdb;
687 dma_addr_t dcdb_addr;
688 struct myrb_sge *sgl;
689 dma_addr_t sgl_addr;
690 };
691
692 struct myrb_hba {
693 unsigned int ldev_block_size;
694 unsigned char ldev_geom_heads;
695 unsigned char ldev_geom_sectors;
696 unsigned char bus_width;
697 unsigned short stripe_size;
698 unsigned short segment_size;
699 unsigned short new_ev_seq;
700 unsigned short old_ev_seq;
701 bool dual_mode_interface;
702 bool bgi_status_supported;
703 bool safte_enabled;
704 bool need_ldev_info;
705 bool need_err_info;
706 bool need_rbld;
707 bool need_cc_status;
708 bool need_bgi_status;
709 bool rbld_first;
710
711 struct pci_dev *pdev;
712 struct Scsi_Host *host;
713
714 struct workqueue_struct *work_q;
715 char work_q_name[20];
716 struct delayed_work monitor_work;
717 unsigned long primary_monitor_time;
718 unsigned long secondary_monitor_time;
719
720 struct dma_pool *sg_pool;
721 struct dma_pool *dcdb_pool;
722
723 spinlock_t queue_lock;
724
725 void (*qcmd)(struct myrb_hba *cs, struct myrb_cmdblk *cmd_blk);
726 void (*write_cmd_mbox)(union myrb_cmd_mbox *next_mbox,
727 union myrb_cmd_mbox *cmd_mbox);
728 void (*get_cmd_mbox)(void __iomem *base);
729 void (*disable_intr)(void __iomem *base);
730 void (*reset)(void __iomem *base);
731
732 unsigned int ctlr_num;
733 unsigned char model_name[20];
734 unsigned char fw_version[12];
735
736 unsigned int irq;
737 phys_addr_t io_addr;
738 phys_addr_t pci_addr;
739 void __iomem *io_base;
740 void __iomem *mmio_base;
741
742 size_t cmd_mbox_size;
743 dma_addr_t cmd_mbox_addr;
744 union myrb_cmd_mbox *first_cmd_mbox;
745 union myrb_cmd_mbox *last_cmd_mbox;
746 union myrb_cmd_mbox *next_cmd_mbox;
747 union myrb_cmd_mbox *prev_cmd_mbox1;
748 union myrb_cmd_mbox *prev_cmd_mbox2;
749
750 size_t stat_mbox_size;
751 dma_addr_t stat_mbox_addr;
752 struct myrb_stat_mbox *first_stat_mbox;
753 struct myrb_stat_mbox *last_stat_mbox;
754 struct myrb_stat_mbox *next_stat_mbox;
755
756 struct myrb_cmdblk dcmd_blk;
757 struct myrb_cmdblk mcmd_blk;
758 struct mutex dcmd_mutex;
759
760 struct myrb_enquiry *enquiry;
761 dma_addr_t enquiry_addr;
762
763 struct myrb_error_entry *err_table;
764 dma_addr_t err_table_addr;
765
766 unsigned short last_rbld_status;
767
768 struct myrb_ldev_info *ldev_info_buf;
769 dma_addr_t ldev_info_addr;
770
771 struct myrb_bgi_status bgi_status;
772
773 struct mutex dma_mutex;
774 };
775
776
777
778
779 #define DAC960_LA_mmio_size 0x80
780
781 enum DAC960_LA_reg_offset {
782 DAC960_LA_IRQMASK_OFFSET = 0x34,
783 DAC960_LA_CMDOP_OFFSET = 0x50,
784 DAC960_LA_CMDID_OFFSET = 0x51,
785 DAC960_LA_MBOX2_OFFSET = 0x52,
786 DAC960_LA_MBOX3_OFFSET = 0x53,
787 DAC960_LA_MBOX4_OFFSET = 0x54,
788 DAC960_LA_MBOX5_OFFSET = 0x55,
789 DAC960_LA_MBOX6_OFFSET = 0x56,
790 DAC960_LA_MBOX7_OFFSET = 0x57,
791 DAC960_LA_MBOX8_OFFSET = 0x58,
792 DAC960_LA_MBOX9_OFFSET = 0x59,
793 DAC960_LA_MBOX10_OFFSET = 0x5A,
794 DAC960_LA_MBOX11_OFFSET = 0x5B,
795 DAC960_LA_MBOX12_OFFSET = 0x5C,
796 DAC960_LA_STSID_OFFSET = 0x5D,
797 DAC960_LA_STS_OFFSET = 0x5E,
798 DAC960_LA_IDB_OFFSET = 0x60,
799 DAC960_LA_ODB_OFFSET = 0x61,
800 DAC960_LA_ERRSTS_OFFSET = 0x63,
801 };
802
803
804
805
806 #define DAC960_LA_IDB_HWMBOX_NEW_CMD 0x01
807 #define DAC960_LA_IDB_HWMBOX_ACK_STS 0x02
808 #define DAC960_LA_IDB_GEN_IRQ 0x04
809 #define DAC960_LA_IDB_CTRL_RESET 0x08
810 #define DAC960_LA_IDB_MMBOX_NEW_CMD 0x10
811
812 #define DAC960_LA_IDB_HWMBOX_EMPTY 0x01
813 #define DAC960_LA_IDB_INIT_DONE 0x02
814
815
816
817
818 #define DAC960_LA_ODB_HWMBOX_ACK_IRQ 0x01
819 #define DAC960_LA_ODB_MMBOX_ACK_IRQ 0x02
820 #define DAC960_LA_ODB_HWMBOX_STS_AVAIL 0x01
821 #define DAC960_LA_ODB_MMBOX_STS_AVAIL 0x02
822
823
824
825
826 #define DAC960_LA_IRQMASK_DISABLE_IRQ 0x04
827
828
829
830
831 #define DAC960_LA_ERRSTS_PENDING 0x02
832
833
834
835
836 #define DAC960_PG_mmio_size 0x2000
837
838 enum DAC960_PG_reg_offset {
839 DAC960_PG_IDB_OFFSET = 0x0020,
840 DAC960_PG_ODB_OFFSET = 0x002C,
841 DAC960_PG_IRQMASK_OFFSET = 0x0034,
842 DAC960_PG_CMDOP_OFFSET = 0x1000,
843 DAC960_PG_CMDID_OFFSET = 0x1001,
844 DAC960_PG_MBOX2_OFFSET = 0x1002,
845 DAC960_PG_MBOX3_OFFSET = 0x1003,
846 DAC960_PG_MBOX4_OFFSET = 0x1004,
847 DAC960_PG_MBOX5_OFFSET = 0x1005,
848 DAC960_PG_MBOX6_OFFSET = 0x1006,
849 DAC960_PG_MBOX7_OFFSET = 0x1007,
850 DAC960_PG_MBOX8_OFFSET = 0x1008,
851 DAC960_PG_MBOX9_OFFSET = 0x1009,
852 DAC960_PG_MBOX10_OFFSET = 0x100A,
853 DAC960_PG_MBOX11_OFFSET = 0x100B,
854 DAC960_PG_MBOX12_OFFSET = 0x100C,
855 DAC960_PG_STSID_OFFSET = 0x1018,
856 DAC960_PG_STS_OFFSET = 0x101A,
857 DAC960_PG_ERRSTS_OFFSET = 0x103F,
858 };
859
860
861
862
863 #define DAC960_PG_IDB_HWMBOX_NEW_CMD 0x01
864 #define DAC960_PG_IDB_HWMBOX_ACK_STS 0x02
865 #define DAC960_PG_IDB_GEN_IRQ 0x04
866 #define DAC960_PG_IDB_CTRL_RESET 0x08
867 #define DAC960_PG_IDB_MMBOX_NEW_CMD 0x10
868
869 #define DAC960_PG_IDB_HWMBOX_FULL 0x01
870 #define DAC960_PG_IDB_INIT_IN_PROGRESS 0x02
871
872
873
874
875 #define DAC960_PG_ODB_HWMBOX_ACK_IRQ 0x01
876 #define DAC960_PG_ODB_MMBOX_ACK_IRQ 0x02
877 #define DAC960_PG_ODB_HWMBOX_STS_AVAIL 0x01
878 #define DAC960_PG_ODB_MMBOX_STS_AVAIL 0x02
879
880
881
882
883 #define DAC960_PG_IRQMASK_MSI_MASK1 0x03
884 #define DAC960_PG_IRQMASK_DISABLE_IRQ 0x04
885 #define DAC960_PG_IRQMASK_MSI_MASK2 0xF8
886
887
888
889
890 #define DAC960_PG_ERRSTS_PENDING 0x04
891
892
893
894
895 #define DAC960_PD_mmio_size 0x80
896
897 enum DAC960_PD_reg_offset {
898 DAC960_PD_CMDOP_OFFSET = 0x00,
899 DAC960_PD_CMDID_OFFSET = 0x01,
900 DAC960_PD_MBOX2_OFFSET = 0x02,
901 DAC960_PD_MBOX3_OFFSET = 0x03,
902 DAC960_PD_MBOX4_OFFSET = 0x04,
903 DAC960_PD_MBOX5_OFFSET = 0x05,
904 DAC960_PD_MBOX6_OFFSET = 0x06,
905 DAC960_PD_MBOX7_OFFSET = 0x07,
906 DAC960_PD_MBOX8_OFFSET = 0x08,
907 DAC960_PD_MBOX9_OFFSET = 0x09,
908 DAC960_PD_MBOX10_OFFSET = 0x0A,
909 DAC960_PD_MBOX11_OFFSET = 0x0B,
910 DAC960_PD_MBOX12_OFFSET = 0x0C,
911 DAC960_PD_STSID_OFFSET = 0x0D,
912 DAC960_PD_STS_OFFSET = 0x0E,
913 DAC960_PD_ERRSTS_OFFSET = 0x3F,
914 DAC960_PD_IDB_OFFSET = 0x40,
915 DAC960_PD_ODB_OFFSET = 0x41,
916 DAC960_PD_IRQEN_OFFSET = 0x43,
917 };
918
919
920
921
922 #define DAC960_PD_IDB_HWMBOX_NEW_CMD 0x01
923 #define DAC960_PD_IDB_HWMBOX_ACK_STS 0x02
924 #define DAC960_PD_IDB_GEN_IRQ 0x04
925 #define DAC960_PD_IDB_CTRL_RESET 0x08
926
927 #define DAC960_PD_IDB_HWMBOX_FULL 0x01
928 #define DAC960_PD_IDB_INIT_IN_PROGRESS 0x02
929
930
931
932
933 #define DAC960_PD_ODB_HWMBOX_ACK_IRQ 0x01
934 #define DAC960_PD_ODB_HWMBOX_STS_AVAIL 0x01
935
936
937
938
939 #define DAC960_PD_IRQMASK_ENABLE_IRQ 0x01
940
941
942
943
944 #define DAC960_PD_ERRSTS_PENDING 0x04
945
946 typedef int (*myrb_hw_init_t)(struct pci_dev *pdev,
947 struct myrb_hba *cb, void __iomem *base);
948 typedef unsigned short (*mbox_mmio_init_t)(struct pci_dev *pdev,
949 void __iomem *base,
950 union myrb_cmd_mbox *mbox);
951
952 struct myrb_privdata {
953 myrb_hw_init_t hw_init;
954 irq_handler_t irq_handler;
955 unsigned int mmio_size;
956 };
957
958 #endif