version 1.1.1.1, 2012/02/21 16:32:16
|
version 1.1.1.2, 2013/07/22 01:17:35
|
Line 8 int megaraid_io_interface(int device, int target, stru
|
Line 8 int megaraid_io_interface(int device, int target, stru
|
#define u64 uint64_t |
#define u64 uint64_t |
|
|
/*====================================================== |
/*====================================================== |
* PERC2/3/4 Passthrough SCSI Command Interface | * PERC2/3/4 Passthrough SCSI Command Interface |
* | * |
* Contents from: | * Contents from: |
* drivers/scsi/megaraid/megaraid_ioctl.h | * drivers/scsi/megaraid/megaraid_ioctl.h |
* drivers/scsi/megaraid/mbox_defs.h | * drivers/scsi/megaraid/mbox_defs.h |
*======================================================*/ | *======================================================*/ |
#define MEGAIOC_MAGIC 'm' | #define MEGAIOC_MAGIC 'm' |
#define MEGAIOCCMD _IOWR(MEGAIOC_MAGIC, 0, struct uioctl_t) | #define MEGAIOCCMD _IOWR(MEGAIOC_MAGIC, 0, struct uioctl_t) |
|
|
/* Following subopcode work for opcode == 0x82 */ |
/* Following subopcode work for opcode == 0x82 */ |
#define MKADAP(adapno) (MEGAIOC_MAGIC << 8 | adapno) |
#define MKADAP(adapno) (MEGAIOC_MAGIC << 8 | adapno) |
Line 30 int megaraid_io_interface(int device, int target, stru
|
Line 30 int megaraid_io_interface(int device, int target, stru
|
|
|
typedef struct |
typedef struct |
{ |
{ |
uint8_t timeout : 3; | uint8_t timeout : 3; |
uint8_t ars : 1; | uint8_t ars : 1; |
uint8_t reserved : 3; | uint8_t reserved : 3; |
uint8_t islogical : 1; | uint8_t islogical : 1; |
uint8_t logdrv; | uint8_t logdrv; |
uint8_t channel; | uint8_t channel; |
uint8_t target; | uint8_t target; |
uint8_t queuetag; | uint8_t queuetag; |
uint8_t queueaction; | uint8_t queueaction; |
uint8_t cdb[MAX_CDB_LEN]; | uint8_t cdb[MAX_CDB_LEN]; |
uint8_t cdblen; | uint8_t cdblen; |
uint8_t reqsenselen; | uint8_t reqsenselen; |
uint8_t reqsensearea[MAX_REQ_SENSE_LEN]; | uint8_t reqsensearea[MAX_REQ_SENSE_LEN]; |
uint8_t numsgelements; | uint8_t numsgelements; |
uint8_t scsistatus; | uint8_t scsistatus; |
uint32_t dataxferaddr; | uint32_t dataxferaddr; |
uint32_t dataxferlen; | uint32_t dataxferlen; |
} __attribute__((packed)) mega_passthru; |
} __attribute__((packed)) mega_passthru; |
|
|
typedef struct |
typedef struct |
{ |
{ |
uint8_t cmd; | uint8_t cmd; |
uint8_t cmdid; | uint8_t cmdid; |
uint8_t opcode; | uint8_t opcode; |
uint8_t subopcode; | uint8_t subopcode; |
uint32_t lba; | uint32_t lba; |
uint32_t xferaddr; | uint32_t xferaddr; |
uint8_t logdrv; | uint8_t logdrv; |
uint8_t resvd[3]; | uint8_t resvd[3]; |
uint8_t numstatus; | uint8_t numstatus; |
uint8_t status; | uint8_t status; |
} __attribute__((packed)) megacmd_t; |
} __attribute__((packed)) megacmd_t; |
|
|
typedef union { |
typedef union { |
uint8_t *pointer; | uint8_t *pointer; |
uint8_t pad[8]; | uint8_t pad[8]; |
} ptr_t; |
} ptr_t; |
|
|
// The above definition assumes sizeof(void*) <= 8. |
// The above definition assumes sizeof(void*) <= 8. |
Line 79 typedef char assert_sizeof_ptr_t[sizeof(ptr_t) == 8 ?
|
Line 79 typedef char assert_sizeof_ptr_t[sizeof(ptr_t) == 8 ?
|
|
|
struct uioctl_t |
struct uioctl_t |
{ |
{ |
uint32_t inlen; | uint32_t inlen; |
uint32_t outlen; | uint32_t outlen; |
union { | union { |
uint8_t fca[16]; | uint8_t fca[16]; |
struct { | struct { |
uint8_t opcode; | uint8_t opcode; |
uint8_t subopcode; | uint8_t subopcode; |
uint16_t adapno; | uint16_t adapno; |
ptr_t buffer; | ptr_t buffer; |
uint32_t length; | uint32_t length; |
} __attribute__((packed)) fcs; | } __attribute__((packed)) fcs; |
} __attribute__((packed)) ui; | } __attribute__((packed)) ui; |
| |
megacmd_t mbox; | megacmd_t mbox; |
mega_passthru pthru; | mega_passthru pthru; |
ptr_t data; | ptr_t data; |
} __attribute__((packed)); |
} __attribute__((packed)); |
|
|
/*=================================================== |
/*=================================================== |
* PERC5/6 Passthrough SCSI Command Interface | * PERC5/6 Passthrough SCSI Command Interface |
* | * |
* Contents from: | * Contents from: |
* drivers/scsi/megaraid/megaraid_sas.h | * drivers/scsi/megaraid/megaraid_sas.h |
*===================================================*/ | *===================================================*/ |
#define MEGASAS_MAGIC 'M' |
#define MEGASAS_MAGIC 'M' |
#define MEGASAS_IOC_FIRMWARE _IOWR(MEGASAS_MAGIC, 1, struct megasas_iocpacket) |
#define MEGASAS_IOC_FIRMWARE _IOWR(MEGASAS_MAGIC, 1, struct megasas_iocpacket) |
|
|
#define MFI_CMD_PD_SCSI_IO 0x04 |
#define MFI_CMD_PD_SCSI_IO 0x04 |
|
#define MFI_CMD_DCMD 0x05 |
#define MFI_FRAME_SGL64 0x02 |
#define MFI_FRAME_SGL64 0x02 |
#define MFI_FRAME_DIR_READ 0x10 | #define MFI_STAT_OK 0x00 |
| #define MFI_DCMD_PD_GET_LIST 0x02010000 |
| /* |
| * Number of mailbox bytes in DCMD message frame |
| */ |
| #define MFI_MBOX_SIZE 12 |
| #define MAX_IOCTL_SGE 16 |
| #define MFI_FRAME_DIR_NONE 0x0000 |
| #define MFI_FRAME_DIR_WRITE 0x0008 |
| #define MFI_FRAME_DIR_READ 0x0010 |
| #define MFI_FRAME_DIR_BOTH 0x0018 |
|
|
#define MAX_IOCTL_SGE 16 | #define MAX_SYS_PDS 240 |
|
|
struct megasas_sge32 { |
struct megasas_sge32 { |
| |
u32 phys_addr; | u32 phys_addr; |
u32 length; | u32 length; |
| |
} __attribute__ ((packed)); |
} __attribute__ ((packed)); |
|
|
struct megasas_sge64 { |
struct megasas_sge64 { |
| |
u64 phys_addr; | u64 phys_addr; |
u32 length; | u32 length; |
| |
} __attribute__ ((packed)); |
} __attribute__ ((packed)); |
|
|
union megasas_sgl { |
union megasas_sgl { |
| |
struct megasas_sge32 sge32[1]; | struct megasas_sge32 sge32[1]; |
struct megasas_sge64 sge64[1]; | struct megasas_sge64 sge64[1]; |
| |
} __attribute__ ((packed)); |
} __attribute__ ((packed)); |
|
|
struct megasas_header { |
struct megasas_header { |
| |
u8 cmd; /*00h */ | u8 cmd; /*00h */ |
u8 sense_len; /*01h */ | u8 sense_len; /*01h */ |
u8 cmd_status; /*02h */ | u8 cmd_status; /*02h */ |
u8 scsi_status; /*03h */ | u8 scsi_status; /*03h */ |
| |
u8 target_id; /*04h */ | u8 target_id; /*04h */ |
u8 lun; /*05h */ | u8 lun; /*05h */ |
u8 cdb_len; /*06h */ | u8 cdb_len; /*06h */ |
u8 sge_count; /*07h */ | u8 sge_count; /*07h */ |
| |
u32 context; /*08h */ | u32 context; /*08h */ |
u32 pad_0; /*0Ch */ | u32 pad_0; /*0Ch */ |
| |
u16 flags; /*10h */ | u16 flags; /*10h */ |
u16 timeout; /*12h */ | u16 timeout; /*12h */ |
u32 data_xferlen; /*14h */ | u32 data_xferlen; /*14h */ |
| |
} __attribute__ ((packed)); |
} __attribute__ ((packed)); |
|
|
struct megasas_pthru_frame { |
struct megasas_pthru_frame { |
| |
u8 cmd; /*00h */ | u8 cmd; /*00h */ |
u8 sense_len; /*01h */ | u8 sense_len; /*01h */ |
u8 cmd_status; /*02h */ | u8 cmd_status; /*02h */ |
u8 scsi_status; /*03h */ | u8 scsi_status; /*03h */ |
| |
u8 target_id; /*04h */ | u8 target_id; /*04h */ |
u8 lun; /*05h */ | u8 lun; /*05h */ |
u8 cdb_len; /*06h */ | u8 cdb_len; /*06h */ |
u8 sge_count; /*07h */ | u8 sge_count; /*07h */ |
| |
u32 context; /*08h */ | u32 context; /*08h */ |
u32 pad_0; /*0Ch */ | u32 pad_0; /*0Ch */ |
| |
u16 flags; /*10h */ | u16 flags; /*10h */ |
u16 timeout; /*12h */ | u16 timeout; /*12h */ |
u32 data_xfer_len; /*14h */ | u32 data_xfer_len; /*14h */ |
| |
u32 sense_buf_phys_addr_lo; /*18h */ | u32 sense_buf_phys_addr_lo; /*18h */ |
u32 sense_buf_phys_addr_hi; /*1Ch */ | u32 sense_buf_phys_addr_hi; /*1Ch */ |
| |
u8 cdb[16]; /*20h */ | u8 cdb[16]; /*20h */ |
union megasas_sgl sgl; /*30h */ | union megasas_sgl sgl; /*30h */ |
| |
} __attribute__ ((packed)); |
} __attribute__ ((packed)); |
|
|
struct megasas_dcmd_frame { |
struct megasas_dcmd_frame { |
| |
u8 cmd; /*00h */ | u8 cmd; /*00h */ |
u8 reserved_0; /*01h */ | u8 reserved_0; /*01h */ |
u8 cmd_status; /*02h */ | u8 cmd_status; /*02h */ |
u8 reserved_1[4]; /*03h */ | u8 reserved_1[4]; /*03h */ |
u8 sge_count; /*07h */ | u8 sge_count; /*07h */ |
| |
u32 context; /*08h */ | u32 context; /*08h */ |
u32 pad_0; /*0Ch */ | u32 pad_0; /*0Ch */ |
| |
u16 flags; /*10h */ | u16 flags; /*10h */ |
u16 timeout; /*12h */ | u16 timeout; /*12h */ |
| |
u32 data_xfer_len; /*14h */ | u32 data_xfer_len; /*14h */ |
u32 opcode; /*18h */ | u32 opcode; /*18h */ |
| |
union { /*1Ch */ | union { /*1Ch */ |
u8 b[12]; | u8 b[12]; |
u16 s[6]; | u16 s[6]; |
u32 w[3]; | u32 w[3]; |
} mbox; | } mbox; |
| |
union megasas_sgl sgl; /*28h */ | union megasas_sgl sgl; /*28h */ |
| |
} __attribute__ ((packed)); |
} __attribute__ ((packed)); |
|
|
struct megasas_iocpacket { |
struct megasas_iocpacket { |
|
u16 host_no; |
|
u16 __pad1; |
|
u32 sgl_off; |
|
u32 sge_count; |
|
u32 sense_off; |
|
u32 sense_len; |
|
union { |
|
u8 raw[128]; |
|
struct megasas_header hdr; |
|
struct megasas_pthru_frame pthru; |
|
struct megasas_dcmd_frame dcmd; |
|
} frame; |
|
|
|
struct iovec sgl[MAX_IOCTL_SGE]; |
|
} __attribute__ ((packed)); |
|
|
u16 host_no; | struct megasas_pd_address { |
u16 __pad1; | u16 device_id; |
u32 sgl_off; | u16 encl_device_id; |
u32 sge_count; | u8 encl_index; |
u32 sense_off; | u8 slot_number; |
u32 sense_len; | u8 scsi_dev_type; /* 0 = disk */ |
union { | u8 connect_port_bitmap; |
u8 raw[128]; | u64 sas_addr[2]; |
struct megasas_header hdr; | } __attribute__ ((packed)); |
struct megasas_pthru_frame pthru; | |
} frame; | |
|
|
struct iovec sgl[MAX_IOCTL_SGE]; | struct megasas_pd_list { |
| u32 size; |
| u32 count; |
| struct megasas_pd_address addr[MAX_SYS_PDS]; |
} __attribute__ ((packed)); |
} __attribute__ ((packed)); |
|
|
#undef u8 |
#undef u8 |