2005-04-17 00:20:36 +02:00
|
|
|
#ifndef CCISS_CMD_H
|
|
|
|
#define CCISS_CMD_H
|
2010-02-18 00:55:11 +01:00
|
|
|
|
|
|
|
#include <linux/cciss_defs.h>
|
|
|
|
|
2010-02-18 00:53:31 +01:00
|
|
|
/* DEFINES */
|
2005-04-17 00:20:36 +02:00
|
|
|
#define CISS_VERSION "1.00"
|
|
|
|
|
2010-02-18 00:53:31 +01:00
|
|
|
/* general boundary definitions */
|
2009-11-12 19:50:01 +01:00
|
|
|
#define MAXSGENTRIES 32
|
|
|
|
#define CCISS_SG_CHAIN 0x80000000
|
2005-04-17 00:20:36 +02:00
|
|
|
#define MAXREPLYQS 256
|
|
|
|
|
2009-04-02 21:50:55 +02:00
|
|
|
/* Unit Attentions ASC's as defined for the MSA2012sa */
|
|
|
|
#define POWER_OR_RESET 0x29
|
|
|
|
#define STATE_CHANGED 0x2a
|
|
|
|
#define UNIT_ATTENTION_CLEARED 0x2f
|
|
|
|
#define LUN_FAILED 0x3e
|
|
|
|
#define REPORT_LUNS_CHANGED 0x3f
|
|
|
|
|
|
|
|
/* Unit Attentions ASCQ's as defined for the MSA2012sa */
|
|
|
|
|
|
|
|
/* These ASCQ's defined for ASC = POWER_OR_RESET */
|
|
|
|
#define POWER_ON_RESET 0x00
|
|
|
|
#define POWER_ON_REBOOT 0x01
|
|
|
|
#define SCSI_BUS_RESET 0x02
|
|
|
|
#define MSA_TARGET_RESET 0x03
|
|
|
|
#define CONTROLLER_FAILOVER 0x04
|
|
|
|
#define TRANSCEIVER_SE 0x05
|
|
|
|
#define TRANSCEIVER_LVD 0x06
|
|
|
|
|
|
|
|
/* These ASCQ's defined for ASC = STATE_CHANGED */
|
|
|
|
#define RESERVATION_PREEMPTED 0x03
|
|
|
|
#define ASYM_ACCESS_CHANGED 0x06
|
|
|
|
#define LUN_CAPACITY_CHANGED 0x09
|
|
|
|
|
2010-02-18 00:53:31 +01:00
|
|
|
/* config space register offsets */
|
2005-04-17 00:20:36 +02:00
|
|
|
#define CFG_VENDORID 0x00
|
|
|
|
#define CFG_DEVICEID 0x02
|
|
|
|
#define CFG_I2OBAR 0x10
|
|
|
|
#define CFG_MEM1BAR 0x14
|
|
|
|
|
2010-02-18 00:53:31 +01:00
|
|
|
/* i2o space register offsets */
|
2005-04-17 00:20:36 +02:00
|
|
|
#define I2O_IBDB_SET 0x20
|
|
|
|
#define I2O_IBDB_CLEAR 0x70
|
|
|
|
#define I2O_INT_STATUS 0x30
|
|
|
|
#define I2O_INT_MASK 0x34
|
|
|
|
#define I2O_IBPOST_Q 0x40
|
|
|
|
#define I2O_OBPOST_Q 0x44
|
2006-12-07 05:35:04 +01:00
|
|
|
#define I2O_DMA1_CFG 0x214
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2010-02-18 00:53:31 +01:00
|
|
|
/* Configuration Table */
|
2005-04-17 00:20:36 +02:00
|
|
|
#define CFGTBL_ChangeReq 0x00000001l
|
|
|
|
#define CFGTBL_AccCmds 0x00000001l
|
2010-07-19 20:46:22 +02:00
|
|
|
#define DOORBELL_CTLR_RESET 0x00000004l
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
#define CFGTBL_Trans_Simple 0x00000002l
|
2010-06-02 21:58:06 +02:00
|
|
|
#define CFGTBL_Trans_Performant 0x00000004l
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
#define CFGTBL_BusType_Ultra2 0x00000001l
|
|
|
|
#define CFGTBL_BusType_Ultra3 0x00000002l
|
|
|
|
#define CFGTBL_BusType_Fibre1G 0x00000100l
|
|
|
|
#define CFGTBL_BusType_Fibre2G 0x00000200l
|
|
|
|
typedef struct _vals32
|
|
|
|
{
|
|
|
|
__u32 lower;
|
|
|
|
__u32 upper;
|
|
|
|
} vals32;
|
|
|
|
|
|
|
|
typedef union _u64bit
|
|
|
|
{
|
|
|
|
vals32 val32;
|
|
|
|
__u64 val;
|
|
|
|
} u64bit;
|
|
|
|
|
2010-02-18 00:53:31 +01:00
|
|
|
/* Type defs used in the following structs */
|
2005-04-17 00:20:36 +02:00
|
|
|
#define QWORD vals32
|
|
|
|
|
2010-02-18 00:53:31 +01:00
|
|
|
/* STRUCTURES */
|
2005-04-17 00:20:36 +02:00
|
|
|
#define CISS_MAX_PHYS_LUN 1024
|
2010-02-18 00:53:31 +01:00
|
|
|
/* SCSI-3 Cmmands */
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
#define CISS_INQUIRY 0x12
|
2010-02-18 00:53:31 +01:00
|
|
|
/* Date returned */
|
2005-04-17 00:20:36 +02:00
|
|
|
typedef struct _InquiryData_struct
|
|
|
|
{
|
|
|
|
BYTE data_byte[36];
|
|
|
|
} InquiryData_struct;
|
|
|
|
|
|
|
|
#define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */
|
|
|
|
#define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */
|
2010-02-18 00:53:31 +01:00
|
|
|
/* Data returned */
|
2005-04-17 00:20:36 +02:00
|
|
|
typedef struct _ReportLUNdata_struct
|
|
|
|
{
|
|
|
|
BYTE LUNListLength[4];
|
|
|
|
DWORD reserved;
|
|
|
|
BYTE LUN[CISS_MAX_LUN][8];
|
|
|
|
} ReportLunData_struct;
|
|
|
|
|
|
|
|
#define CCISS_READ_CAPACITY 0x25 /* Read Capacity */
|
|
|
|
typedef struct _ReadCapdata_struct
|
|
|
|
{
|
2010-02-18 00:53:31 +01:00
|
|
|
BYTE total_size[4]; /* Total size in blocks */
|
|
|
|
BYTE block_size[4]; /* Size of blocks in bytes */
|
2005-04-17 00:20:36 +02:00
|
|
|
} ReadCapdata_struct;
|
|
|
|
|
2006-10-01 08:27:23 +02:00
|
|
|
#define CCISS_READ_CAPACITY_16 0x9e /* Read Capacity 16 */
|
|
|
|
|
|
|
|
/* service action to differentiate a 16 byte read capacity from
|
|
|
|
other commands that use the 0x9e SCSI op code */
|
|
|
|
|
|
|
|
#define CCISS_READ_CAPACITY_16_SERVICE_ACT 0x10
|
|
|
|
|
|
|
|
typedef struct _ReadCapdata_struct_16
|
|
|
|
{
|
|
|
|
BYTE total_size[8]; /* Total size in blocks */
|
|
|
|
BYTE block_size[4]; /* Size of blocks in bytes */
|
|
|
|
BYTE prot_en:1; /* protection enable bit */
|
|
|
|
BYTE rto_en:1; /* reference tag own enable bit */
|
|
|
|
BYTE reserved:6; /* reserved bits */
|
|
|
|
BYTE reserved2[18]; /* reserved bytes per spec */
|
|
|
|
} ReadCapdata_struct_16;
|
|
|
|
|
|
|
|
/* Define the supported read/write commands for cciss based controllers */
|
|
|
|
|
|
|
|
#define CCISS_READ_10 0x28 /* Read(10) */
|
|
|
|
#define CCISS_WRITE_10 0x2a /* Write(10) */
|
|
|
|
#define CCISS_READ_16 0x88 /* Read(16) */
|
|
|
|
#define CCISS_WRITE_16 0x8a /* Write(16) */
|
|
|
|
|
|
|
|
/* Define the CDB lengths supported by cciss based controllers */
|
|
|
|
|
|
|
|
#define CDB_LEN10 10
|
|
|
|
#define CDB_LEN16 16
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2010-02-18 00:53:31 +01:00
|
|
|
/* BMIC commands */
|
2005-04-17 00:20:36 +02:00
|
|
|
#define BMIC_READ 0x26
|
|
|
|
#define BMIC_WRITE 0x27
|
|
|
|
#define BMIC_CACHE_FLUSH 0xc2
|
2010-02-18 00:53:31 +01:00
|
|
|
#define CCISS_CACHE_FLUSH 0x01 /* C2 was already being used by CCISS */
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2010-02-18 00:53:31 +01:00
|
|
|
/* Command List Structure */
|
2009-06-08 23:02:17 +02:00
|
|
|
#define CTLR_LUNID "\0\0\0\0\0\0\0\0"
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
typedef struct _CommandListHeader_struct {
|
|
|
|
BYTE ReplyQueue;
|
|
|
|
BYTE SGList;
|
|
|
|
HWORD SGTotal;
|
|
|
|
QWORD Tag;
|
|
|
|
LUNAddr_struct LUN;
|
|
|
|
} CommandListHeader_struct;
|
|
|
|
typedef struct _ErrDescriptor_struct {
|
|
|
|
QWORD Addr;
|
|
|
|
DWORD Len;
|
|
|
|
} ErrDescriptor_struct;
|
|
|
|
typedef struct _SGDescriptor_struct {
|
|
|
|
QWORD Addr;
|
|
|
|
DWORD Len;
|
|
|
|
DWORD Ext;
|
|
|
|
} SGDescriptor_struct;
|
|
|
|
|
|
|
|
/* Command types */
|
|
|
|
#define CMD_RWREQ 0x00
|
|
|
|
#define CMD_IOCTL_PEND 0x01
|
|
|
|
#define CMD_SCSI 0x03
|
|
|
|
#define CMD_MSG_DONE 0x04
|
|
|
|
#define CMD_MSG_TIMEOUT 0x05
|
2009-07-02 22:02:06 +02:00
|
|
|
#define CMD_MSG_STALE 0xff
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2010-02-26 23:01:17 +01:00
|
|
|
/* This structure needs to be divisible by COMMANDLIST_ALIGNMENT
|
|
|
|
* because low bits of the address are used to to indicate that
|
|
|
|
* whether the tag contains an index or an address. PAD_32 and
|
|
|
|
* PAD_64 can be adjusted independently as needed for 32-bit
|
|
|
|
* and 64-bits systems.
|
2005-09-13 10:25:22 +02:00
|
|
|
*/
|
2010-06-02 21:58:06 +02:00
|
|
|
#define COMMANDLIST_ALIGNMENT (32)
|
2010-02-26 23:01:12 +01:00
|
|
|
#define IS_64_BIT ((sizeof(long) - 4)/4)
|
|
|
|
#define IS_32_BIT (!IS_64_BIT)
|
2010-06-11 13:13:36 +02:00
|
|
|
#define PAD_32 (0)
|
2010-02-26 23:01:12 +01:00
|
|
|
#define PAD_64 (4)
|
|
|
|
#define PADSIZE (IS_32_BIT * PAD_32 + IS_64_BIT * PAD_64)
|
2010-06-02 21:58:06 +02:00
|
|
|
#define DIRECT_LOOKUP_BIT 0x10
|
|
|
|
#define DIRECT_LOOKUP_SHIFT 5
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
typedef struct _CommandList_struct {
|
|
|
|
CommandListHeader_struct Header;
|
|
|
|
RequestBlock_struct Request;
|
|
|
|
ErrDescriptor_struct ErrDesc;
|
|
|
|
SGDescriptor_struct SG[MAXSGENTRIES];
|
|
|
|
/* information associated with the command */
|
|
|
|
__u32 busaddr; /* physical address of this record */
|
|
|
|
ErrorInfo_struct * err_info; /* pointer to the allocated mem */
|
|
|
|
int ctlr;
|
|
|
|
int cmd_type;
|
2005-09-13 10:25:22 +02:00
|
|
|
long cmdindex;
|
2011-01-10 21:50:33 +01:00
|
|
|
struct list_head list;
|
2005-04-17 00:20:36 +02:00
|
|
|
struct request * rq;
|
|
|
|
struct completion *waiting;
|
|
|
|
int retry_count;
|
|
|
|
void * scsi_cmd;
|
2010-06-02 21:58:06 +02:00
|
|
|
char pad[PADSIZE];
|
2005-04-17 00:20:36 +02:00
|
|
|
} CommandList_struct;
|
|
|
|
|
2010-02-18 00:53:31 +01:00
|
|
|
/* Configuration Table Structure */
|
2005-04-17 00:20:36 +02:00
|
|
|
typedef struct _HostWrite_struct {
|
|
|
|
DWORD TransportRequest;
|
|
|
|
DWORD Reserved;
|
|
|
|
DWORD CoalIntDelay;
|
|
|
|
DWORD CoalIntCount;
|
|
|
|
} HostWrite_struct;
|
|
|
|
|
|
|
|
typedef struct _CfgTable_struct {
|
|
|
|
BYTE Signature[4];
|
|
|
|
DWORD SpecValence;
|
2010-06-02 21:58:06 +02:00
|
|
|
#define SIMPLE_MODE 0x02
|
|
|
|
#define PERFORMANT_MODE 0x04
|
|
|
|
#define MEMQ_MODE 0x08
|
2005-04-17 00:20:36 +02:00
|
|
|
DWORD TransportSupport;
|
|
|
|
DWORD TransportActive;
|
|
|
|
HostWrite_struct HostWrite;
|
|
|
|
DWORD CmdsOutMax;
|
|
|
|
DWORD BusTypes;
|
2010-06-02 21:58:06 +02:00
|
|
|
DWORD TransMethodOffset;
|
2005-04-17 00:20:36 +02:00
|
|
|
BYTE ServerName[16];
|
|
|
|
DWORD HeartBeat;
|
|
|
|
DWORD SCSI_Prefetch;
|
2009-11-12 19:50:01 +01:00
|
|
|
DWORD MaxSGElements;
|
|
|
|
DWORD MaxLogicalUnits;
|
|
|
|
DWORD MaxPhysicalDrives;
|
|
|
|
DWORD MaxPhysicalDrivesPerLogicalUnit;
|
2010-06-02 21:58:06 +02:00
|
|
|
DWORD MaxPerformantModeCommands;
|
2010-07-19 20:46:22 +02:00
|
|
|
u8 reserved[0x78 - 0x58];
|
|
|
|
u32 misc_fw_support; /* offset 0x78 */
|
|
|
|
#define MISC_FW_DOORBELL_RESET (0x02)
|
2005-04-17 00:20:36 +02:00
|
|
|
} CfgTable_struct;
|
2010-06-02 21:58:06 +02:00
|
|
|
|
|
|
|
struct TransTable_struct {
|
|
|
|
u32 BlockFetch0;
|
|
|
|
u32 BlockFetch1;
|
|
|
|
u32 BlockFetch2;
|
|
|
|
u32 BlockFetch3;
|
|
|
|
u32 BlockFetch4;
|
|
|
|
u32 BlockFetch5;
|
|
|
|
u32 BlockFetch6;
|
|
|
|
u32 BlockFetch7;
|
|
|
|
u32 RepQSize;
|
|
|
|
u32 RepQCount;
|
|
|
|
u32 RepQCtrAddrLow32;
|
|
|
|
u32 RepQCtrAddrHigh32;
|
|
|
|
u32 RepQAddr0Low32;
|
|
|
|
u32 RepQAddr0High32;
|
|
|
|
};
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
#pragma pack()
|
2010-02-18 00:53:31 +01:00
|
|
|
#endif /* CCISS_CMD_H */
|