1 int megaraid_io_interface(int device
, int target
, struct scsi_cmnd_io
*, int);
10 /*======================================================
11 * PERC2/3/4 Passthrough SCSI Command Interface
14 * drivers/scsi/megaraid/megaraid_ioctl.h
15 * drivers/scsi/megaraid/mbox_defs.h
16 *======================================================*/
17 #define MEGAIOC_MAGIC 'm'
18 #define MEGAIOCCMD _IOWR(MEGAIOC_MAGIC, 0, struct uioctl_t)
20 /* Following subopcode work for opcode == 0x82 */
21 #define MKADAP(adapno) (MEGAIOC_MAGIC << 8 | adapno)
22 #define MEGAIOC_QNADAP 'm'
23 #define MEGAIOC_QDRVRVER 'e'
24 #define MEGAIOC_QADAPINFO 'g'
26 #define MEGA_MBOXCMD_PASSTHRU 0x03
28 #define MAX_REQ_SENSE_LEN 0x20
29 #define MAX_CDB_LEN 10
36 uint8_t islogical
: 1;
42 uint8_t cdb
[MAX_CDB_LEN
];
45 uint8_t reqsensearea
[MAX_REQ_SENSE_LEN
];
46 uint8_t numsgelements
;
48 uint32_t dataxferaddr
;
50 } __attribute__((packed
)) mega_passthru
;
64 } __attribute__((packed
)) megacmd_t
;
71 // The above definition assumes sizeof(void*) <= 8.
72 // This assumption also exists in the linux megaraid device driver.
73 // So define a macro to check expected size of ptr_t at compile time using
74 // a dummy typedef. On size mismatch, compiler reports a negative array
75 // size. If you see an error message of this form, it means that
76 // you have an unexpected pointer size on your platform and can not
77 // use megaraid support in smartmontools.
78 typedef char assert_sizeof_ptr_t
[sizeof(ptr_t
) == 8 ? 1 : -1];
92 } __attribute__((packed
)) fcs
;
93 } __attribute__((packed
)) ui
;
98 } __attribute__((packed
));
100 /*===================================================
101 * PERC5/6 Passthrough SCSI Command Interface
104 * drivers/scsi/megaraid/megaraid_sas.h
105 *===================================================*/
106 #define MEGASAS_MAGIC 'M'
107 #define MEGASAS_IOC_FIRMWARE _IOWR(MEGASAS_MAGIC, 1, struct megasas_iocpacket)
109 #define MFI_CMD_PD_SCSI_IO 0x04
110 #define MFI_FRAME_SGL64 0x02
111 #define MFI_FRAME_DIR_READ 0x10
113 #define MAX_IOCTL_SGE 16
115 struct megasas_sge32
{
120 } __attribute__ ((packed
));
122 struct megasas_sge64
{
127 } __attribute__ ((packed
));
131 struct megasas_sge32 sge32
[1];
132 struct megasas_sge64 sge64
[1];
134 } __attribute__ ((packed
));
136 struct megasas_header
{
139 u8 sense_len
; /*01h */
140 u8 cmd_status
; /*02h */
141 u8 scsi_status
; /*03h */
143 u8 target_id
; /*04h */
146 u8 sge_count
; /*07h */
148 u32 context
; /*08h */
152 u16 timeout
; /*12h */
153 u32 data_xferlen
; /*14h */
155 } __attribute__ ((packed
));
157 struct megasas_pthru_frame
{
160 u8 sense_len
; /*01h */
161 u8 cmd_status
; /*02h */
162 u8 scsi_status
; /*03h */
164 u8 target_id
; /*04h */
167 u8 sge_count
; /*07h */
169 u32 context
; /*08h */
173 u16 timeout
; /*12h */
174 u32 data_xfer_len
; /*14h */
176 u32 sense_buf_phys_addr_lo
; /*18h */
177 u32 sense_buf_phys_addr_hi
; /*1Ch */
180 union megasas_sgl sgl
; /*30h */
182 } __attribute__ ((packed
));
184 struct megasas_dcmd_frame
{
187 u8 reserved_0
; /*01h */
188 u8 cmd_status
; /*02h */
189 u8 reserved_1
[4]; /*03h */
190 u8 sge_count
; /*07h */
192 u32 context
; /*08h */
196 u16 timeout
; /*12h */
198 u32 data_xfer_len
; /*14h */
207 union megasas_sgl sgl
; /*28h */
209 } __attribute__ ((packed
));
211 struct megasas_iocpacket
{
221 struct megasas_header hdr
;
222 struct megasas_pthru_frame pthru
;
225 struct iovec sgl
[MAX_IOCTL_SGE
];
227 } __attribute__ ((packed
));