1
2
3
4
5
6
7
8
9
10 #ifndef _MRAID_MBOX_DEFS_H_
11 #define _MRAID_MBOX_DEFS_H_
12
13 #include <linux/types.h>
14
15
16
17
18
19 #define MBOXCMD_LREAD 0x01
20 #define MBOXCMD_LWRITE 0x02
21 #define MBOXCMD_PASSTHRU 0x03
22 #define MBOXCMD_ADPEXTINQ 0x04
23 #define MBOXCMD_ADAPTERINQ 0x05
24 #define MBOXCMD_LREAD64 0xA7
25 #define MBOXCMD_LWRITE64 0xA8
26 #define MBOXCMD_PASSTHRU64 0xC3
27 #define MBOXCMD_EXTPTHRU 0xE3
28
29 #define MAIN_MISC_OPCODE 0xA4
30 #define GET_MAX_SG_SUPPORT 0x01
31 #define SUPPORT_EXT_CDB 0x16
32
33 #define FC_NEW_CONFIG 0xA1
34 #define NC_SUBOP_PRODUCT_INFO 0x0E
35 #define NC_SUBOP_ENQUIRY3 0x0F
36 #define ENQ3_GET_SOLICITED_FULL 0x02
37 #define OP_DCMD_READ_CONFIG 0x04
38 #define NEW_READ_CONFIG_8LD 0x67
39 #define READ_CONFIG_8LD 0x07
40 #define FLUSH_ADAPTER 0x0A
41 #define FLUSH_SYSTEM 0xFE
42
43
44
45
46 #define FC_DEL_LOGDRV 0xA4
47 #define OP_SUP_DEL_LOGDRV 0x2A
48 #define OP_GET_LDID_MAP 0x18
49 #define OP_DEL_LOGDRV 0x1C
50
51
52
53
54 #define IS_BIOS_ENABLED 0x62
55 #define GET_BIOS 0x01
56 #define CHNL_CLASS 0xA9
57 #define GET_CHNL_CLASS 0x00
58 #define SET_CHNL_CLASS 0x01
59 #define CH_RAID 0x01
60 #define CH_SCSI 0x00
61 #define BIOS_PVT_DATA 0x40
62 #define GET_BIOS_PVT_DATA 0x00
63
64
65
66
67
68 #define GET_TARGET_ID 0x7D
69 #define CLUSTER_OP 0x70
70 #define GET_CLUSTER_MODE 0x02
71 #define CLUSTER_CMD 0x6E
72 #define RESERVE_LD 0x01
73 #define RELEASE_LD 0x02
74 #define RESET_RESERVATIONS 0x03
75 #define RESERVATION_STATUS 0x04
76 #define RESERVE_PD 0x05
77 #define RELEASE_PD 0x06
78
79
80
81
82
83 #define BATTERY_MODULE_MISSING 0x01
84 #define BATTERY_LOW_VOLTAGE 0x02
85 #define BATTERY_TEMP_HIGH 0x04
86 #define BATTERY_PACK_MISSING 0x08
87 #define BATTERY_CHARGE_MASK 0x30
88 #define BATTERY_CHARGE_DONE 0x00
89 #define BATTERY_CHARGE_INPROG 0x10
90 #define BATTERY_CHARGE_FAIL 0x20
91 #define BATTERY_CYCLES_EXCEEDED 0x40
92
93
94
95
96 #define PDRV_UNCNF 0
97 #define PDRV_ONLINE 3
98 #define PDRV_FAILED 4
99 #define PDRV_RBLD 5
100 #define PDRV_HOTSPARE 6
101
102
103
104
105
106 #define RDRV_OFFLINE 0
107 #define RDRV_DEGRADED 1
108 #define RDRV_OPTIMAL 2
109 #define RDRV_DELETED 3
110
111
112
113
114 #define NO_READ_AHEAD 0
115 #define READ_AHEAD 1
116 #define ADAP_READ_AHEAD 2
117 #define WRMODE_WRITE_THRU 0
118 #define WRMODE_WRITE_BACK 1
119 #define CACHED_IO 0
120 #define DIRECT_IO 1
121
122 #define MAX_LOGICAL_DRIVES_8LD 8
123 #define MAX_LOGICAL_DRIVES_40LD 40
124 #define FC_MAX_PHYSICAL_DEVICES 256
125 #define MAX_MBOX_CHANNELS 5
126 #define MAX_MBOX_TARGET 15
127 #define MBOX_MAX_PHYSICAL_DRIVES MAX_MBOX_CHANNELS*MAX_MBOX_TARGET
128 #define MAX_ROW_SIZE_40LD 32
129 #define MAX_ROW_SIZE_8LD 8
130 #define SPAN_DEPTH_8_SPANS 8
131 #define SPAN_DEPTH_4_SPANS 4
132 #define MAX_REQ_SENSE_LEN 0x20
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156 #define MBOX_MAX_FIRMWARE_STATUS 46
157 typedef struct {
158 uint8_t cmd;
159 uint8_t cmdid;
160 uint16_t numsectors;
161 uint32_t lba;
162 uint32_t xferaddr;
163 uint8_t logdrv;
164 uint8_t numsge;
165 uint8_t resvd;
166 uint8_t busy;
167 uint8_t numstatus;
168 uint8_t status;
169 uint8_t completed[MBOX_MAX_FIRMWARE_STATUS];
170 uint8_t poll;
171 uint8_t ack;
172 } __attribute__ ((packed)) mbox_t;
173
174
175
176
177
178
179
180
181
182
183
184
185 typedef struct {
186 uint32_t xferaddr_lo;
187 uint32_t xferaddr_hi;
188 mbox_t mbox32;
189 } __attribute__ ((packed)) mbox64_t;
190
191
192
193
194 typedef struct {
195 u8 cmd;
196 u8 cmdid;
197 u8 opcode;
198 u8 subopcode;
199 u32 lba;
200 u32 xferaddr;
201 u8 logdrv;
202 u8 rsvd[3];
203 u8 numstatus;
204 u8 status;
205 } __attribute__ ((packed)) int_mbox_t;
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226 typedef struct {
227 uint8_t timeout :3;
228 uint8_t ars :1;
229 uint8_t reserved :3;
230 uint8_t islogical :1;
231 uint8_t logdrv;
232 uint8_t channel;
233 uint8_t target;
234 uint8_t queuetag;
235 uint8_t queueaction;
236 uint8_t cdb[10];
237 uint8_t cdblen;
238 uint8_t reqsenselen;
239 uint8_t reqsensearea[MAX_REQ_SENSE_LEN];
240 uint8_t numsge;
241 uint8_t scsistatus;
242 uint32_t dataxferaddr;
243 uint32_t dataxferlen;
244 } __attribute__ ((packed)) mraid_passthru_t;
245
246 typedef struct {
247
248 uint32_t dataxferaddr_lo;
249 uint32_t dataxferaddr_hi;
250 mraid_passthru_t pthru32;
251
252 } __attribute__ ((packed)) mega_passthru64_t;
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278 typedef struct {
279 uint8_t timeout :3;
280 uint8_t ars :1;
281 uint8_t rsvd1 :1;
282 uint8_t cd_rom :1;
283 uint8_t rsvd2 :1;
284 uint8_t islogical :1;
285 uint8_t logdrv;
286 uint8_t channel;
287 uint8_t target;
288 uint8_t queuetag;
289 uint8_t queueaction;
290 uint8_t cdblen;
291 uint8_t rsvd3;
292 uint8_t cdb[16];
293 uint8_t numsge;
294 uint8_t status;
295 uint8_t reqsenselen;
296 uint8_t reqsensearea[MAX_REQ_SENSE_LEN];
297 uint8_t rsvd4;
298 uint32_t dataxferaddr;
299 uint32_t dataxferlen;
300 } __attribute__ ((packed)) mraid_epassthru_t;
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329 typedef struct {
330 uint32_t data_size;
331 uint32_t config_signature;
332 uint8_t fw_version[16];
333 uint8_t bios_version[16];
334 uint8_t product_name[80];
335 uint8_t max_commands;
336 uint8_t nchannels;
337 uint8_t fc_loop_present;
338 uint8_t mem_type;
339 uint32_t signature;
340 uint16_t dram_size;
341 uint16_t subsysid;
342 uint16_t subsysvid;
343 uint8_t notify_counters;
344 uint8_t pad1k[889];
345 } __attribute__ ((packed)) mraid_pinfo_t;
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385 typedef struct {
386 uint32_t global_counter;
387 uint8_t param_counter;
388 uint8_t param_id;
389 uint16_t param_val;
390 uint8_t write_config_counter;
391 uint8_t write_config_rsvd[3];
392 uint8_t ldrv_op_counter;
393 uint8_t ldrv_opid;
394 uint8_t ldrv_opcmd;
395 uint8_t ldrv_opstatus;
396 uint8_t ldrv_state_counter;
397 uint8_t ldrv_state_id;
398 uint8_t ldrv_state_new;
399 uint8_t ldrv_state_old;
400 uint8_t pdrv_state_counter;
401 uint8_t pdrv_state_id;
402 uint8_t pdrv_state_new;
403 uint8_t pdrv_state_old;
404 uint8_t pdrv_fmt_counter;
405 uint8_t pdrv_fmt_id;
406 uint8_t pdrv_fmt_val;
407 uint8_t pdrv_fmt_rsvd;
408 uint8_t targ_xfer_counter;
409 uint8_t targ_xfer_id;
410 uint8_t targ_xfer_val;
411 uint8_t targ_xfer_rsvd;
412 uint8_t fcloop_id_chg_counter;
413 uint8_t fcloopid_pdrvid;
414 uint8_t fcloop_id0;
415 uint8_t fcloop_id1;
416 uint8_t fcloop_state_counter;
417 uint8_t fcloop_state0;
418 uint8_t fcloop_state1;
419 uint8_t fcloop_state_rsvd;
420 } __attribute__ ((packed)) mraid_notify_t;
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445 #define MAX_NOTIFY_SIZE 0x80
446 #define CUR_NOTIFY_SIZE sizeof(mraid_notify_t)
447
448 typedef struct {
449 uint32_t data_size;
450
451 mraid_notify_t notify;
452
453 uint8_t notify_rsvd[MAX_NOTIFY_SIZE - CUR_NOTIFY_SIZE];
454
455 uint8_t rebuild_rate;
456 uint8_t cache_flush_int;
457 uint8_t sense_alert;
458 uint8_t drive_insert_count;
459
460 uint8_t battery_status;
461 uint8_t num_ldrv;
462 uint8_t recon_state[MAX_LOGICAL_DRIVES_40LD / 8];
463 uint16_t ldrv_op_status[MAX_LOGICAL_DRIVES_40LD / 8];
464
465 uint32_t ldrv_size[MAX_LOGICAL_DRIVES_40LD];
466 uint8_t ldrv_prop[MAX_LOGICAL_DRIVES_40LD];
467 uint8_t ldrv_state[MAX_LOGICAL_DRIVES_40LD];
468 uint8_t pdrv_state[FC_MAX_PHYSICAL_DEVICES];
469 uint16_t pdrv_format[FC_MAX_PHYSICAL_DEVICES / 16];
470
471 uint8_t targ_xfer[80];
472 uint8_t pad1k[263];
473 } __attribute__ ((packed)) mraid_inquiry3_t;
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506 typedef struct {
507 uint8_t max_commands;
508 uint8_t rebuild_rate;
509 uint8_t max_targ_per_chan;
510 uint8_t nchannels;
511 uint8_t fw_version[4];
512 uint16_t age_of_flash;
513 uint8_t chip_set_value;
514 uint8_t dram_size;
515 uint8_t cache_flush_interval;
516 uint8_t bios_version[4];
517 uint8_t board_type;
518 uint8_t sense_alert;
519 uint8_t write_config_count;
520 uint8_t battery_status;
521 uint8_t dec_fault_bus_info;
522 } __attribute__ ((packed)) mraid_adapinfo_t;
523
524
525
526
527
528
529
530
531
532
533 typedef struct {
534 uint8_t nldrv;
535 uint8_t rsvd[3];
536 uint32_t size[MAX_LOGICAL_DRIVES_8LD];
537 uint8_t prop[MAX_LOGICAL_DRIVES_8LD];
538 uint8_t state[MAX_LOGICAL_DRIVES_8LD];
539 } __attribute__ ((packed)) mraid_ldrv_info_t;
540
541
542
543
544
545
546 typedef struct {
547 uint8_t pdrv_state[MBOX_MAX_PHYSICAL_DRIVES];
548 uint8_t rsvd;
549 } __attribute__ ((packed)) mraid_pdrv_info_t;
550
551
552
553
554
555
556
557
558 typedef struct {
559 mraid_adapinfo_t adapter_info;
560 mraid_ldrv_info_t logdrv_info;
561 mraid_pdrv_info_t pdrv_info;
562 } __attribute__ ((packed)) mraid_inquiry_t;
563
564
565
566
567
568
569
570
571
572
573
574 typedef struct {
575 mraid_inquiry_t raid_inq;
576 uint16_t phys_drv_format[MAX_MBOX_CHANNELS];
577 uint8_t stack_attn;
578 uint8_t modem_status;
579 uint8_t rsvd[2];
580 } __attribute__ ((packed)) mraid_extinq_t;
581
582
583
584
585
586
587
588 typedef struct {
589 uint8_t channel;
590 uint8_t target;
591 }__attribute__ ((packed)) adap_device_t;
592
593
594
595
596
597
598
599 typedef struct {
600 uint32_t start_blk;
601 uint32_t num_blks;
602 adap_device_t device[MAX_ROW_SIZE_40LD];
603 }__attribute__ ((packed)) adap_span_40ld_t;
604
605
606
607
608
609
610
611 typedef struct {
612 uint32_t start_blk;
613 uint32_t num_blks;
614 adap_device_t device[MAX_ROW_SIZE_8LD];
615 }__attribute__ ((packed)) adap_span_8ld_t;
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630 typedef struct {
631 uint8_t span_depth;
632 uint8_t level;
633 uint8_t read_ahead;
634 uint8_t stripe_sz;
635 uint8_t status;
636 uint8_t write_mode;
637 uint8_t direct_io;
638 uint8_t row_size;
639 } __attribute__ ((packed)) logdrv_param_t;
640
641
642
643
644
645
646
647 typedef struct {
648 logdrv_param_t lparam;
649 adap_span_40ld_t span[SPAN_DEPTH_8_SPANS];
650 }__attribute__ ((packed)) logdrv_40ld_t;
651
652
653
654
655
656
657
658
659
660 typedef struct {
661 logdrv_param_t lparam;
662 adap_span_8ld_t span[SPAN_DEPTH_8_SPANS];
663 }__attribute__ ((packed)) logdrv_8ld_span8_t;
664
665
666
667
668
669
670
671
672
673 typedef struct {
674 logdrv_param_t lparam;
675 adap_span_8ld_t span[SPAN_DEPTH_4_SPANS];
676 }__attribute__ ((packed)) logdrv_8ld_span4_t;
677
678
679
680
681
682
683
684
685
686
687 typedef struct {
688 uint8_t type;
689 uint8_t cur_status;
690 uint8_t tag_depth;
691 uint8_t sync_neg;
692 uint32_t size;
693 }__attribute__ ((packed)) phys_drive_t;
694
695
696
697
698
699
700
701
702
703 typedef struct {
704 uint8_t numldrv;
705 uint8_t resvd[3];
706 logdrv_40ld_t ldrv[MAX_LOGICAL_DRIVES_40LD];
707 phys_drive_t pdrv[MBOX_MAX_PHYSICAL_DRIVES];
708 }__attribute__ ((packed)) disk_array_40ld_t;
709
710
711
712
713
714
715
716
717
718
719
720 typedef struct {
721 uint8_t numldrv;
722 uint8_t resvd[3];
723 logdrv_8ld_span8_t ldrv[MAX_LOGICAL_DRIVES_8LD];
724 phys_drive_t pdrv[MBOX_MAX_PHYSICAL_DRIVES];
725 }__attribute__ ((packed)) disk_array_8ld_span8_t;
726
727
728
729
730
731
732
733
734
735
736
737 typedef struct {
738 uint8_t numldrv;
739 uint8_t resvd[3];
740 logdrv_8ld_span4_t ldrv[MAX_LOGICAL_DRIVES_8LD];
741 phys_drive_t pdrv[MBOX_MAX_PHYSICAL_DRIVES];
742 }__attribute__ ((packed)) disk_array_8ld_span4_t;
743
744
745
746
747
748
749
750
751
752
753
754 struct private_bios_data {
755 uint8_t geometry :4;
756 uint8_t unused :4;
757 uint8_t boot_drv;
758 uint8_t rsvd[12];
759 uint16_t cksum;
760 } __attribute__ ((packed));
761
762
763
764
765
766
767
768 typedef struct {
769 uint64_t address;
770 uint32_t length;
771 } __attribute__ ((packed)) mbox_sgl64;
772
773
774
775
776
777
778 typedef struct {
779 uint32_t address;
780 uint32_t length;
781 } __attribute__ ((packed)) mbox_sgl32;
782
783 #endif
784
785