Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mbox_defs.h
Go to the documentation of this file.
1 /*
2  *
3  * Linux MegaRAID Unified device driver
4  *
5  * Copyright (c) 2003-2004 LSI Logic Corporation.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version
10  * 2 of the License, or (at your option) any later version.
11  *
12  * FILE : mbox_defs.h
13  *
14  */
15 #ifndef _MRAID_MBOX_DEFS_H_
16 #define _MRAID_MBOX_DEFS_H_
17 
18 #include <linux/types.h>
19 
20 /*
21  * Commands and states for mailbox based controllers
22  */
23 
24 #define MBOXCMD_LREAD 0x01
25 #define MBOXCMD_LWRITE 0x02
26 #define MBOXCMD_PASSTHRU 0x03
27 #define MBOXCMD_ADPEXTINQ 0x04
28 #define MBOXCMD_ADAPTERINQ 0x05
29 #define MBOXCMD_LREAD64 0xA7
30 #define MBOXCMD_LWRITE64 0xA8
31 #define MBOXCMD_PASSTHRU64 0xC3
32 #define MBOXCMD_EXTPTHRU 0xE3
33 
34 #define MAIN_MISC_OPCODE 0xA4
35 #define GET_MAX_SG_SUPPORT 0x01
36 #define SUPPORT_EXT_CDB 0x16
37 
38 #define FC_NEW_CONFIG 0xA1
39 #define NC_SUBOP_PRODUCT_INFO 0x0E
40 #define NC_SUBOP_ENQUIRY3 0x0F
41 #define ENQ3_GET_SOLICITED_FULL 0x02
42 #define OP_DCMD_READ_CONFIG 0x04
43 #define NEW_READ_CONFIG_8LD 0x67
44 #define READ_CONFIG_8LD 0x07
45 #define FLUSH_ADAPTER 0x0A
46 #define FLUSH_SYSTEM 0xFE
47 
48 /*
49  * Command for random deletion of logical drives
50  */
51 #define FC_DEL_LOGDRV 0xA4
52 #define OP_SUP_DEL_LOGDRV 0x2A
53 #define OP_GET_LDID_MAP 0x18
54 #define OP_DEL_LOGDRV 0x1C
55 
56 /*
57  * BIOS commands
58  */
59 #define IS_BIOS_ENABLED 0x62
60 #define GET_BIOS 0x01
61 #define CHNL_CLASS 0xA9
62 #define GET_CHNL_CLASS 0x00
63 #define SET_CHNL_CLASS 0x01
64 #define CH_RAID 0x01
65 #define CH_SCSI 0x00
66 #define BIOS_PVT_DATA 0x40
67 #define GET_BIOS_PVT_DATA 0x00
68 
69 
70 /*
71  * Commands to support clustering
72  */
73 #define GET_TARGET_ID 0x7D
74 #define CLUSTER_OP 0x70
75 #define GET_CLUSTER_MODE 0x02
76 #define CLUSTER_CMD 0x6E
77 #define RESERVE_LD 0x01
78 #define RELEASE_LD 0x02
79 #define RESET_RESERVATIONS 0x03
80 #define RESERVATION_STATUS 0x04
81 #define RESERVE_PD 0x05
82 #define RELEASE_PD 0x06
83 
84 
85 /*
86  * Module battery status
87  */
88 #define BATTERY_MODULE_MISSING 0x01
89 #define BATTERY_LOW_VOLTAGE 0x02
90 #define BATTERY_TEMP_HIGH 0x04
91 #define BATTERY_PACK_MISSING 0x08
92 #define BATTERY_CHARGE_MASK 0x30
93 #define BATTERY_CHARGE_DONE 0x00
94 #define BATTERY_CHARGE_INPROG 0x10
95 #define BATTERY_CHARGE_FAIL 0x20
96 #define BATTERY_CYCLES_EXCEEDED 0x40
97 
98 /*
99  * Physical drive states.
100  */
101 #define PDRV_UNCNF 0
102 #define PDRV_ONLINE 3
103 #define PDRV_FAILED 4
104 #define PDRV_RBLD 5
105 #define PDRV_HOTSPARE 6
106 
107 
108 /*
109  * Raid logical drive states.
110  */
111 #define RDRV_OFFLINE 0
112 #define RDRV_DEGRADED 1
113 #define RDRV_OPTIMAL 2
114 #define RDRV_DELETED 3
115 
116 /*
117  * Read, write and cache policies
118  */
119 #define NO_READ_AHEAD 0
120 #define READ_AHEAD 1
121 #define ADAP_READ_AHEAD 2
122 #define WRMODE_WRITE_THRU 0
123 #define WRMODE_WRITE_BACK 1
124 #define CACHED_IO 0
125 #define DIRECT_IO 1
126 
127 #define MAX_LOGICAL_DRIVES_8LD 8
128 #define MAX_LOGICAL_DRIVES_40LD 40
129 #define FC_MAX_PHYSICAL_DEVICES 256
130 #define MAX_MBOX_CHANNELS 5
131 #define MAX_MBOX_TARGET 15
132 #define MBOX_MAX_PHYSICAL_DRIVES MAX_MBOX_CHANNELS*MAX_MBOX_TARGET
133 #define MAX_ROW_SIZE_40LD 32
134 #define MAX_ROW_SIZE_8LD 8
135 #define SPAN_DEPTH_8_SPANS 8
136 #define SPAN_DEPTH_4_SPANS 4
137 #define MAX_REQ_SENSE_LEN 0x20
138 
139 
140 
161 #define MBOX_MAX_FIRMWARE_STATUS 46
162 typedef struct {
177 } __attribute__ ((packed)) mbox_t;
178 
179 
190 typedef struct {
193  mbox_t mbox32;
194 } __attribute__ ((packed)) mbox64_t;
195 
196 /*
197  * mailbox structure used for internal commands
198  */
199 typedef struct {
200  u8 cmd;
207  u8 rsvd[3];
210 } __attribute__ ((packed)) int_mbox_t;
211 
231 typedef struct {
233  uint8_t ars :1;
235  uint8_t islogical :1;
236  uint8_t logdrv;
244  uint8_t reqsensearea[MAX_REQ_SENSE_LEN];
245  uint8_t numsge;
249 } __attribute__ ((packed)) mraid_passthru_t;
250 
251 typedef struct {
252 
255  mraid_passthru_t pthru32;
256 
257 } __attribute__ ((packed)) mega_passthru64_t;
258 
283 typedef struct {
284  uint8_t timeout :3;
285  uint8_t ars :1;
287  uint8_t cd_rom :1;
289  uint8_t islogical :1;
290  uint8_t logdrv;
292  uint8_t target;
293  uint8_t queuetag;
294  uint8_t queueaction;
295  uint8_t cdblen;
297  uint8_t cdb[16];
298  uint8_t numsge;
299  uint8_t status;
300  uint8_t reqsenselen;
301  uint8_t reqsensearea[MAX_REQ_SENSE_LEN];
303  uint32_t dataxferaddr;
304  uint32_t dataxferlen;
305 } __attribute__ ((packed)) mraid_epassthru_t;
306 
307 
334 typedef struct {
338  uint8_t bios_version[16];
339  uint8_t product_name[80];
349  uint8_t pad1k[889];
350 } __attribute__ ((packed)) mraid_pinfo_t;
351 
352 
390 typedef struct {
425 } __attribute__ ((packed)) mraid_notify_t;
426 
427 
450 #define MAX_NOTIFY_SIZE 0x80
451 #define CUR_NOTIFY_SIZE sizeof(mraid_notify_t)
452 
453 typedef struct {
455 
456  mraid_notify_t notify;
457 
459 
464 
468  uint16_t ldrv_op_status[MAX_LOGICAL_DRIVES_40LD / 8];
469 
475 
476  uint8_t targ_xfer[80];
477  uint8_t pad1k[263];
478 } __attribute__ ((packed)) mraid_inquiry3_t;
479 
480 
511 typedef struct {
512  uint8_t max_commands;
513  uint8_t rebuild_rate;
515  uint8_t nchannels;
516  uint8_t fw_version[4];
521  uint8_t bios_version[4];
523  uint8_t sense_alert;
525  uint8_t battery_status;
527 } __attribute__ ((packed)) mraid_adapinfo_t;
528 
529 
538 typedef struct {
544 } __attribute__ ((packed)) mraid_ldrv_info_t;
545 
546 
551 typedef struct {
552  uint8_t pdrv_state[MBOX_MAX_PHYSICAL_DRIVES];
553  uint8_t rsvd;
554 } __attribute__ ((packed)) mraid_pdrv_info_t;
555 
556 
563 typedef struct {
564  mraid_adapinfo_t adapter_info;
565  mraid_ldrv_info_t logdrv_info;
566  mraid_pdrv_info_t pdrv_info;
567 } __attribute__ ((packed)) mraid_inquiry_t;
568 
569 
579 typedef struct {
580  mraid_inquiry_t raid_inq;
581  uint16_t phys_drv_format[MAX_MBOX_CHANNELS];
584  uint8_t rsvd[2];
585 } __attribute__ ((packed)) mraid_extinq_t;
586 
587 
593 typedef struct {
595  uint8_t target;
596 }__attribute__ ((packed)) adap_device_t;
597 
598 
604 typedef struct {
607  adap_device_t device[MAX_ROW_SIZE_40LD];
608 }__attribute__ ((packed)) adap_span_40ld_t;
609 
610 
616 typedef struct {
617  uint32_t start_blk;
618  uint32_t num_blks;
619  adap_device_t device[MAX_ROW_SIZE_8LD];
620 }__attribute__ ((packed)) adap_span_8ld_t;
621 
622 
635 typedef struct {
640  uint8_t status;
644 } __attribute__ ((packed)) logdrv_param_t;
645 
646 
652 typedef struct {
653  logdrv_param_t lparam;
654  adap_span_40ld_t span[SPAN_DEPTH_8_SPANS];
655 }__attribute__ ((packed)) logdrv_40ld_t;
656 
657 
665 typedef struct {
666  logdrv_param_t lparam;
667  adap_span_8ld_t span[SPAN_DEPTH_8_SPANS];
668 }__attribute__ ((packed)) logdrv_8ld_span8_t;
669 
670 
678 typedef struct {
679  logdrv_param_t lparam;
680  adap_span_8ld_t span[SPAN_DEPTH_4_SPANS];
681 }__attribute__ ((packed)) logdrv_8ld_span4_t;
682 
683 
692 typedef struct {
697  uint32_t size;
698 }__attribute__ ((packed)) phys_drive_t;
699 
700 
708 typedef struct {
710  uint8_t resvd[3];
711  logdrv_40ld_t ldrv[MAX_LOGICAL_DRIVES_40LD];
712  phys_drive_t pdrv[MBOX_MAX_PHYSICAL_DRIVES];
713 }__attribute__ ((packed)) disk_array_40ld_t;
714 
715 
725 typedef struct {
727  uint8_t resvd[3];
728  logdrv_8ld_span8_t ldrv[MAX_LOGICAL_DRIVES_8LD];
729  phys_drive_t pdrv[MBOX_MAX_PHYSICAL_DRIVES];
730 }__attribute__ ((packed)) disk_array_8ld_span8_t;
731 
732 
742 typedef struct {
744  uint8_t resvd[3];
745  logdrv_8ld_span4_t ldrv[MAX_LOGICAL_DRIVES_8LD];
746  phys_drive_t pdrv[MBOX_MAX_PHYSICAL_DRIVES];
747 }__attribute__ ((packed)) disk_array_8ld_span4_t;
748 
749 
765 } __attribute__ ((packed));
773 typedef struct {
776 } __attribute__ ((packed)) mbox_sgl64;
777 
783 typedef struct {
786 } __attribute__ ((packed)) mbox_sgl32;
787 
788 #endif // _MRAID_MBOX_DEFS_H_
789 
790 /* vim: set ts=8 sw=8 tw=78: */