0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _MRAID_MBOX_DEFS_H_
0011 #define _MRAID_MBOX_DEFS_H_
0012
0013 #include <linux/types.h>
0014
0015
0016
0017
0018
0019 #define MBOXCMD_LREAD 0x01
0020 #define MBOXCMD_LWRITE 0x02
0021 #define MBOXCMD_PASSTHRU 0x03
0022 #define MBOXCMD_ADPEXTINQ 0x04
0023 #define MBOXCMD_ADAPTERINQ 0x05
0024 #define MBOXCMD_LREAD64 0xA7
0025 #define MBOXCMD_LWRITE64 0xA8
0026 #define MBOXCMD_PASSTHRU64 0xC3
0027 #define MBOXCMD_EXTPTHRU 0xE3
0028
0029 #define MAIN_MISC_OPCODE 0xA4
0030 #define GET_MAX_SG_SUPPORT 0x01
0031 #define SUPPORT_EXT_CDB 0x16
0032
0033 #define FC_NEW_CONFIG 0xA1
0034 #define NC_SUBOP_PRODUCT_INFO 0x0E
0035 #define NC_SUBOP_ENQUIRY3 0x0F
0036 #define ENQ3_GET_SOLICITED_FULL 0x02
0037 #define OP_DCMD_READ_CONFIG 0x04
0038 #define NEW_READ_CONFIG_8LD 0x67
0039 #define READ_CONFIG_8LD 0x07
0040 #define FLUSH_ADAPTER 0x0A
0041 #define FLUSH_SYSTEM 0xFE
0042
0043
0044
0045
0046 #define FC_DEL_LOGDRV 0xA4
0047 #define OP_SUP_DEL_LOGDRV 0x2A
0048 #define OP_GET_LDID_MAP 0x18
0049 #define OP_DEL_LOGDRV 0x1C
0050
0051
0052
0053
0054 #define IS_BIOS_ENABLED 0x62
0055 #define GET_BIOS 0x01
0056 #define CHNL_CLASS 0xA9
0057 #define GET_CHNL_CLASS 0x00
0058 #define SET_CHNL_CLASS 0x01
0059 #define CH_RAID 0x01
0060 #define CH_SCSI 0x00
0061 #define BIOS_PVT_DATA 0x40
0062 #define GET_BIOS_PVT_DATA 0x00
0063
0064
0065
0066
0067
0068 #define GET_TARGET_ID 0x7D
0069 #define CLUSTER_OP 0x70
0070 #define GET_CLUSTER_MODE 0x02
0071 #define CLUSTER_CMD 0x6E
0072 #define RESERVE_LD 0x01
0073 #define RELEASE_LD 0x02
0074 #define RESET_RESERVATIONS 0x03
0075 #define RESERVATION_STATUS 0x04
0076 #define RESERVE_PD 0x05
0077 #define RELEASE_PD 0x06
0078
0079
0080
0081
0082
0083 #define BATTERY_MODULE_MISSING 0x01
0084 #define BATTERY_LOW_VOLTAGE 0x02
0085 #define BATTERY_TEMP_HIGH 0x04
0086 #define BATTERY_PACK_MISSING 0x08
0087 #define BATTERY_CHARGE_MASK 0x30
0088 #define BATTERY_CHARGE_DONE 0x00
0089 #define BATTERY_CHARGE_INPROG 0x10
0090 #define BATTERY_CHARGE_FAIL 0x20
0091 #define BATTERY_CYCLES_EXCEEDED 0x40
0092
0093
0094
0095
0096 #define PDRV_UNCNF 0
0097 #define PDRV_ONLINE 3
0098 #define PDRV_FAILED 4
0099 #define PDRV_RBLD 5
0100 #define PDRV_HOTSPARE 6
0101
0102
0103
0104
0105
0106 #define RDRV_OFFLINE 0
0107 #define RDRV_DEGRADED 1
0108 #define RDRV_OPTIMAL 2
0109 #define RDRV_DELETED 3
0110
0111
0112
0113
0114 #define NO_READ_AHEAD 0
0115 #define READ_AHEAD 1
0116 #define ADAP_READ_AHEAD 2
0117 #define WRMODE_WRITE_THRU 0
0118 #define WRMODE_WRITE_BACK 1
0119 #define CACHED_IO 0
0120 #define DIRECT_IO 1
0121
0122 #define MAX_LOGICAL_DRIVES_8LD 8
0123 #define MAX_LOGICAL_DRIVES_40LD 40
0124 #define FC_MAX_PHYSICAL_DEVICES 256
0125 #define MAX_MBOX_CHANNELS 5
0126 #define MAX_MBOX_TARGET 15
0127 #define MBOX_MAX_PHYSICAL_DRIVES MAX_MBOX_CHANNELS*MAX_MBOX_TARGET
0128 #define MAX_ROW_SIZE_40LD 32
0129 #define MAX_ROW_SIZE_8LD 8
0130 #define SPAN_DEPTH_8_SPANS 8
0131 #define SPAN_DEPTH_4_SPANS 4
0132 #define MAX_REQ_SENSE_LEN 0x20
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156 #define MBOX_MAX_FIRMWARE_STATUS 46
0157 typedef struct {
0158 uint8_t cmd;
0159 uint8_t cmdid;
0160 uint16_t numsectors;
0161 uint32_t lba;
0162 uint32_t xferaddr;
0163 uint8_t logdrv;
0164 uint8_t numsge;
0165 uint8_t resvd;
0166 uint8_t busy;
0167 uint8_t numstatus;
0168 uint8_t status;
0169 uint8_t completed[MBOX_MAX_FIRMWARE_STATUS];
0170 uint8_t poll;
0171 uint8_t ack;
0172 } __attribute__ ((packed)) mbox_t;
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185 typedef struct {
0186 uint32_t xferaddr_lo;
0187 uint32_t xferaddr_hi;
0188 mbox_t mbox32;
0189 } __attribute__ ((packed)) mbox64_t;
0190
0191
0192
0193
0194 typedef struct {
0195 u8 cmd;
0196 u8 cmdid;
0197 u8 opcode;
0198 u8 subopcode;
0199 u32 lba;
0200 u32 xferaddr;
0201 u8 logdrv;
0202 u8 rsvd[3];
0203 u8 numstatus;
0204 u8 status;
0205 } __attribute__ ((packed)) int_mbox_t;
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222
0223
0224
0225
0226 typedef struct {
0227 uint8_t timeout :3;
0228 uint8_t ars :1;
0229 uint8_t reserved :3;
0230 uint8_t islogical :1;
0231 uint8_t logdrv;
0232 uint8_t channel;
0233 uint8_t target;
0234 uint8_t queuetag;
0235 uint8_t queueaction;
0236 uint8_t cdb[10];
0237 uint8_t cdblen;
0238 uint8_t reqsenselen;
0239 uint8_t reqsensearea[MAX_REQ_SENSE_LEN];
0240 uint8_t numsge;
0241 uint8_t scsistatus;
0242 uint32_t dataxferaddr;
0243 uint32_t dataxferlen;
0244 } __attribute__ ((packed)) mraid_passthru_t;
0245
0246 typedef struct {
0247
0248 uint32_t dataxferaddr_lo;
0249 uint32_t dataxferaddr_hi;
0250 mraid_passthru_t pthru32;
0251
0252 } __attribute__ ((packed)) mega_passthru64_t;
0253
0254
0255
0256
0257
0258
0259
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278 typedef struct {
0279 uint8_t timeout :3;
0280 uint8_t ars :1;
0281 uint8_t rsvd1 :1;
0282 uint8_t cd_rom :1;
0283 uint8_t rsvd2 :1;
0284 uint8_t islogical :1;
0285 uint8_t logdrv;
0286 uint8_t channel;
0287 uint8_t target;
0288 uint8_t queuetag;
0289 uint8_t queueaction;
0290 uint8_t cdblen;
0291 uint8_t rsvd3;
0292 uint8_t cdb[16];
0293 uint8_t numsge;
0294 uint8_t status;
0295 uint8_t reqsenselen;
0296 uint8_t reqsensearea[MAX_REQ_SENSE_LEN];
0297 uint8_t rsvd4;
0298 uint32_t dataxferaddr;
0299 uint32_t dataxferlen;
0300 } __attribute__ ((packed)) mraid_epassthru_t;
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329 typedef struct {
0330 uint32_t data_size;
0331 uint32_t config_signature;
0332 uint8_t fw_version[16];
0333 uint8_t bios_version[16];
0334 uint8_t product_name[80];
0335 uint8_t max_commands;
0336 uint8_t nchannels;
0337 uint8_t fc_loop_present;
0338 uint8_t mem_type;
0339 uint32_t signature;
0340 uint16_t dram_size;
0341 uint16_t subsysid;
0342 uint16_t subsysvid;
0343 uint8_t notify_counters;
0344 uint8_t pad1k[889];
0345 } __attribute__ ((packed)) mraid_pinfo_t;
0346
0347
0348
0349
0350
0351
0352
0353
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385 typedef struct {
0386 uint32_t global_counter;
0387 uint8_t param_counter;
0388 uint8_t param_id;
0389 uint16_t param_val;
0390 uint8_t write_config_counter;
0391 uint8_t write_config_rsvd[3];
0392 uint8_t ldrv_op_counter;
0393 uint8_t ldrv_opid;
0394 uint8_t ldrv_opcmd;
0395 uint8_t ldrv_opstatus;
0396 uint8_t ldrv_state_counter;
0397 uint8_t ldrv_state_id;
0398 uint8_t ldrv_state_new;
0399 uint8_t ldrv_state_old;
0400 uint8_t pdrv_state_counter;
0401 uint8_t pdrv_state_id;
0402 uint8_t pdrv_state_new;
0403 uint8_t pdrv_state_old;
0404 uint8_t pdrv_fmt_counter;
0405 uint8_t pdrv_fmt_id;
0406 uint8_t pdrv_fmt_val;
0407 uint8_t pdrv_fmt_rsvd;
0408 uint8_t targ_xfer_counter;
0409 uint8_t targ_xfer_id;
0410 uint8_t targ_xfer_val;
0411 uint8_t targ_xfer_rsvd;
0412 uint8_t fcloop_id_chg_counter;
0413 uint8_t fcloopid_pdrvid;
0414 uint8_t fcloop_id0;
0415 uint8_t fcloop_id1;
0416 uint8_t fcloop_state_counter;
0417 uint8_t fcloop_state0;
0418 uint8_t fcloop_state1;
0419 uint8_t fcloop_state_rsvd;
0420 } __attribute__ ((packed)) mraid_notify_t;
0421
0422
0423
0424
0425
0426
0427
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444
0445 #define MAX_NOTIFY_SIZE 0x80
0446 #define CUR_NOTIFY_SIZE sizeof(mraid_notify_t)
0447
0448 typedef struct {
0449 uint32_t data_size;
0450
0451 mraid_notify_t notify;
0452
0453 uint8_t notify_rsvd[MAX_NOTIFY_SIZE - CUR_NOTIFY_SIZE];
0454
0455 uint8_t rebuild_rate;
0456 uint8_t cache_flush_int;
0457 uint8_t sense_alert;
0458 uint8_t drive_insert_count;
0459
0460 uint8_t battery_status;
0461 uint8_t num_ldrv;
0462 uint8_t recon_state[MAX_LOGICAL_DRIVES_40LD / 8];
0463 uint16_t ldrv_op_status[MAX_LOGICAL_DRIVES_40LD / 8];
0464
0465 uint32_t ldrv_size[MAX_LOGICAL_DRIVES_40LD];
0466 uint8_t ldrv_prop[MAX_LOGICAL_DRIVES_40LD];
0467 uint8_t ldrv_state[MAX_LOGICAL_DRIVES_40LD];
0468 uint8_t pdrv_state[FC_MAX_PHYSICAL_DEVICES];
0469 uint16_t pdrv_format[FC_MAX_PHYSICAL_DEVICES / 16];
0470
0471 uint8_t targ_xfer[80];
0472 uint8_t pad1k[263];
0473 } __attribute__ ((packed)) mraid_inquiry3_t;
0474
0475
0476
0477
0478
0479
0480
0481
0482
0483
0484
0485
0486
0487
0488
0489
0490
0491
0492
0493
0494
0495
0496
0497
0498
0499
0500
0501
0502
0503
0504
0505
0506 typedef struct {
0507 uint8_t max_commands;
0508 uint8_t rebuild_rate;
0509 uint8_t max_targ_per_chan;
0510 uint8_t nchannels;
0511 uint8_t fw_version[4];
0512 uint16_t age_of_flash;
0513 uint8_t chip_set_value;
0514 uint8_t dram_size;
0515 uint8_t cache_flush_interval;
0516 uint8_t bios_version[4];
0517 uint8_t board_type;
0518 uint8_t sense_alert;
0519 uint8_t write_config_count;
0520 uint8_t battery_status;
0521 uint8_t dec_fault_bus_info;
0522 } __attribute__ ((packed)) mraid_adapinfo_t;
0523
0524
0525
0526
0527
0528
0529
0530
0531
0532
0533 typedef struct {
0534 uint8_t nldrv;
0535 uint8_t rsvd[3];
0536 uint32_t size[MAX_LOGICAL_DRIVES_8LD];
0537 uint8_t prop[MAX_LOGICAL_DRIVES_8LD];
0538 uint8_t state[MAX_LOGICAL_DRIVES_8LD];
0539 } __attribute__ ((packed)) mraid_ldrv_info_t;
0540
0541
0542
0543
0544
0545
0546 typedef struct {
0547 uint8_t pdrv_state[MBOX_MAX_PHYSICAL_DRIVES];
0548 uint8_t rsvd;
0549 } __attribute__ ((packed)) mraid_pdrv_info_t;
0550
0551
0552
0553
0554
0555
0556
0557
0558 typedef struct {
0559 mraid_adapinfo_t adapter_info;
0560 mraid_ldrv_info_t logdrv_info;
0561 mraid_pdrv_info_t pdrv_info;
0562 } __attribute__ ((packed)) mraid_inquiry_t;
0563
0564
0565
0566
0567
0568
0569
0570
0571
0572
0573
0574 typedef struct {
0575 mraid_inquiry_t raid_inq;
0576 uint16_t phys_drv_format[MAX_MBOX_CHANNELS];
0577 uint8_t stack_attn;
0578 uint8_t modem_status;
0579 uint8_t rsvd[2];
0580 } __attribute__ ((packed)) mraid_extinq_t;
0581
0582
0583
0584
0585
0586
0587
0588 typedef struct {
0589 uint8_t channel;
0590 uint8_t target;
0591 }__attribute__ ((packed)) adap_device_t;
0592
0593
0594
0595
0596
0597
0598
0599 typedef struct {
0600 uint32_t start_blk;
0601 uint32_t num_blks;
0602 adap_device_t device[MAX_ROW_SIZE_40LD];
0603 }__attribute__ ((packed)) adap_span_40ld_t;
0604
0605
0606
0607
0608
0609
0610
0611 typedef struct {
0612 uint32_t start_blk;
0613 uint32_t num_blks;
0614 adap_device_t device[MAX_ROW_SIZE_8LD];
0615 }__attribute__ ((packed)) adap_span_8ld_t;
0616
0617
0618
0619
0620
0621
0622
0623
0624
0625
0626
0627
0628
0629
0630 typedef struct {
0631 uint8_t span_depth;
0632 uint8_t level;
0633 uint8_t read_ahead;
0634 uint8_t stripe_sz;
0635 uint8_t status;
0636 uint8_t write_mode;
0637 uint8_t direct_io;
0638 uint8_t row_size;
0639 } __attribute__ ((packed)) logdrv_param_t;
0640
0641
0642
0643
0644
0645
0646
0647 typedef struct {
0648 logdrv_param_t lparam;
0649 adap_span_40ld_t span[SPAN_DEPTH_8_SPANS];
0650 }__attribute__ ((packed)) logdrv_40ld_t;
0651
0652
0653
0654
0655
0656
0657
0658
0659
0660 typedef struct {
0661 logdrv_param_t lparam;
0662 adap_span_8ld_t span[SPAN_DEPTH_8_SPANS];
0663 }__attribute__ ((packed)) logdrv_8ld_span8_t;
0664
0665
0666
0667
0668
0669
0670
0671
0672
0673 typedef struct {
0674 logdrv_param_t lparam;
0675 adap_span_8ld_t span[SPAN_DEPTH_4_SPANS];
0676 }__attribute__ ((packed)) logdrv_8ld_span4_t;
0677
0678
0679
0680
0681
0682
0683
0684
0685
0686
0687 typedef struct {
0688 uint8_t type;
0689 uint8_t cur_status;
0690 uint8_t tag_depth;
0691 uint8_t sync_neg;
0692 uint32_t size;
0693 }__attribute__ ((packed)) phys_drive_t;
0694
0695
0696
0697
0698
0699
0700
0701
0702
0703 typedef struct {
0704 uint8_t numldrv;
0705 uint8_t resvd[3];
0706 logdrv_40ld_t ldrv[MAX_LOGICAL_DRIVES_40LD];
0707 phys_drive_t pdrv[MBOX_MAX_PHYSICAL_DRIVES];
0708 }__attribute__ ((packed)) disk_array_40ld_t;
0709
0710
0711
0712
0713
0714
0715
0716
0717
0718
0719
0720 typedef struct {
0721 uint8_t numldrv;
0722 uint8_t resvd[3];
0723 logdrv_8ld_span8_t ldrv[MAX_LOGICAL_DRIVES_8LD];
0724 phys_drive_t pdrv[MBOX_MAX_PHYSICAL_DRIVES];
0725 }__attribute__ ((packed)) disk_array_8ld_span8_t;
0726
0727
0728
0729
0730
0731
0732
0733
0734
0735
0736
0737 typedef struct {
0738 uint8_t numldrv;
0739 uint8_t resvd[3];
0740 logdrv_8ld_span4_t ldrv[MAX_LOGICAL_DRIVES_8LD];
0741 phys_drive_t pdrv[MBOX_MAX_PHYSICAL_DRIVES];
0742 }__attribute__ ((packed)) disk_array_8ld_span4_t;
0743
0744
0745
0746
0747
0748
0749
0750
0751
0752
0753
0754 struct private_bios_data {
0755 uint8_t geometry :4;
0756 uint8_t unused :4;
0757 uint8_t boot_drv;
0758 uint8_t rsvd[12];
0759 uint16_t cksum;
0760 } __attribute__ ((packed));
0761
0762
0763
0764
0765
0766
0767
0768 typedef struct {
0769 uint64_t address;
0770 uint32_t length;
0771 } __attribute__ ((packed)) mbox_sgl64;
0772
0773
0774
0775
0776
0777
0778 typedef struct {
0779 uint32_t address;
0780 uint32_t length;
0781 } __attribute__ ((packed)) mbox_sgl32;
0782
0783 #endif