Blame view

drivers/block/cciss_cmd.h 7.29 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
  #ifndef CCISS_CMD_H
  #define CCISS_CMD_H
429c42c9d   dann frazier   cciss: Consolidat...
3
4
  
  #include <linux/cciss_defs.h>
b028461d6   dann frazier   cciss: remove C99...
5
  /* DEFINES */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
  #define CISS_VERSION "1.00"
b028461d6   dann frazier   cciss: remove C99...
7
  /* general boundary definitions */
5c07a311a   Don Brace   cciss: Add enhanc...
8
9
  #define MAXSGENTRIES            32
  #define CCISS_SG_CHAIN          0x80000000
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
10
  #define MAXREPLYQS              256
0a9279cc7   Mike Miller   cciss: kernel sca...
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  /* 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
b028461d6   dann frazier   cciss: remove C99...
33
  /* config space register offsets */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
34
35
36
37
  #define CFG_VENDORID            0x00
  #define CFG_DEVICEID            0x02
  #define CFG_I2OBAR              0x10
  #define CFG_MEM1BAR             0x14
b028461d6   dann frazier   cciss: remove C99...
38
  /* i2o space register offsets */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
39
40
41
42
43
44
  #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
f92e2f5f8   Mike Miller   [PATCH] cciss: di...
45
  #define I2O_DMA1_CFG		0x214
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
46

b028461d6   dann frazier   cciss: remove C99...
47
  /* Configuration Table */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
48
49
  #define CFGTBL_ChangeReq        0x00000001l
  #define CFGTBL_AccCmds          0x00000001l
a6528d017   Stephen M. Cameron   cciss: fix hard r...
50
  #define DOORBELL_CTLR_RESET     0x00000004l
bf2e2e6b8   Stephen M. Cameron   cciss: use new do...
51
  #define DOORBELL_CTLR_RESET2    0x00000020l
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
52
53
  
  #define CFGTBL_Trans_Simple     0x00000002l
5e216153c   Mike Miller   cciss: add perfor...
54
  #define CFGTBL_Trans_Performant 0x00000004l
0498cc2a9   Stephen M. Cameron   cciss: Inform con...
55
  #define CFGTBL_Trans_use_short_tags 0x20000000l
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
  
  #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;
b028461d6   dann frazier   cciss: remove C99...
72
  /* Type defs used in the following structs */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
73
  #define QWORD vals32 
b028461d6   dann frazier   cciss: remove C99...
74
  /* STRUCTURES */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75
  #define CISS_MAX_PHYS_LUN	1024
b028461d6   dann frazier   cciss: remove C99...
76
  /* SCSI-3 Cmmands */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
77
78
79
80
  
  #pragma pack(1)	
  
  #define CISS_INQUIRY 0x12
b028461d6   dann frazier   cciss: remove C99...
81
  /* Date returned */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
82
83
84
85
86
87
88
  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 */
b028461d6   dann frazier   cciss: remove C99...
89
  /* Data returned */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
90
91
92
93
94
95
96
97
98
99
  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
  {
b028461d6   dann frazier   cciss: remove C99...
100
101
    BYTE total_size[4];	/* Total size in blocks */
    BYTE block_size[4];	/* Size of blocks in bytes */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
102
  } ReadCapdata_struct;
00988a351   Mike Miller (OS Dev)   [PATCH] cciss: su...
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
  #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
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
131

b028461d6   dann frazier   cciss: remove C99...
132
  /* BMIC commands */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
133
134
135
  #define BMIC_READ 0x26
  #define BMIC_WRITE 0x27
  #define BMIC_CACHE_FLUSH 0xc2
b028461d6   dann frazier   cciss: remove C99...
136
  #define CCISS_CACHE_FLUSH 0x01	/* C2 was already being used by CCISS */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
137

8f71bb829   Stephen M. Cameron   cciss: get rid of...
138
139
140
141
142
143
144
  #define CCISS_ABORT_MSG 0x00
  #define CCISS_RESET_MSG 0x01
  #define CCISS_RESET_TYPE_CONTROLLER 0x00
  #define CCISS_RESET_TYPE_BUS 0x01
  #define CCISS_RESET_TYPE_TARGET 0x03
  #define CCISS_RESET_TYPE_LUN 0x04
  #define CCISS_NOOP_MSG 0x03
b028461d6   dann frazier   cciss: remove C99...
145
  /* Command List Structure */
b57695fe1   scameron@beardog.cca.cpqcorp.net   cciss: simplify i...
146
  #define CTLR_LUNID "\0\0\0\0\0\0\0\0"
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
147
148
149
150
151
152
153
  typedef struct _CommandListHeader_struct {
    BYTE              ReplyQueue;
    BYTE              SGList;
    HWORD             SGTotal;
    QWORD             Tag;
    LUNAddr_struct    LUN;
  } CommandListHeader_struct;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
154
155
156
157
158
159
160
161
162
  typedef struct _ErrDescriptor_struct {
    QWORD  Addr;
    DWORD  Len;
  } ErrDescriptor_struct;
  typedef struct _SGDescriptor_struct {
    QWORD  Addr;
    DWORD  Len;
    DWORD  Ext;
  } SGDescriptor_struct;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
163
164
165
166
167
168
  /* 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
b59e64d0d   Hannes Reinecke   cciss: Ignore sta...
169
  #define CMD_MSG_STALE	0xff
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
170

1b7d0d28a   Stephen M. Cameron   cciss: detect bad...
171
172
173
174
175
  /* 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.
33079b219   Mike Miller   [PATCH] cciss: di...
176
   */
5e216153c   Mike Miller   cciss: add perfor...
177
  #define COMMANDLIST_ALIGNMENT (32)
58daa9ce9   Stephen M. Cameron   cciss: clarify co...
178
179
  #define IS_64_BIT ((sizeof(long) - 4)/4)
  #define IS_32_BIT (!IS_64_BIT)
f3bcb1433   Mike Miller   cciss: change pad...
180
  #define PAD_32 (0)
58daa9ce9   Stephen M. Cameron   cciss: clarify co...
181
182
  #define PAD_64 (4)
  #define PADSIZE (IS_32_BIT * PAD_32 + IS_64_BIT * PAD_64)
5e216153c   Mike Miller   cciss: add perfor...
183
184
  #define DIRECT_LOOKUP_BIT 0x10
  #define DIRECT_LOOKUP_SHIFT 5
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
185
186
187
188
189
190
191
192
193
194
  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; 
33079b219   Mike Miller   [PATCH] cciss: di...
195
    long			   cmdindex;
e6e1ee936   Jens Axboe   cciss: reinstate ...
196
    struct list_head list;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
197
198
199
    struct request *	   rq;
    struct completion *waiting;
    int	 retry_count;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
200
    void * scsi_cmd;
5e216153c   Mike Miller   cciss: add perfor...
201
    char pad[PADSIZE];
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
202
  } CommandList_struct;
b028461d6   dann frazier   cciss: remove C99...
203
  /* Configuration Table Structure */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
204
205
206
207
208
209
210
211
212
213
  typedef struct _HostWrite_struct {
    DWORD TransportRequest;
    DWORD Reserved;
    DWORD CoalIntDelay;
    DWORD CoalIntCount;
  } HostWrite_struct;
  
  typedef struct _CfgTable_struct {
    BYTE             Signature[4];
    DWORD            SpecValence;
5e216153c   Mike Miller   cciss: add perfor...
214
215
216
  #define SIMPLE_MODE	0x02
  #define PERFORMANT_MODE	0x04
  #define MEMQ_MODE	0x08
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
217
218
219
220
221
    DWORD            TransportSupport;
    DWORD            TransportActive;
    HostWrite_struct HostWrite;
    DWORD            CmdsOutMax;
    DWORD            BusTypes;
5e216153c   Mike Miller   cciss: add perfor...
222
    DWORD            TransMethodOffset;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
223
224
225
    BYTE             ServerName[16];
    DWORD            HeartBeat;
    DWORD            SCSI_Prefetch;
5c07a311a   Don Brace   cciss: Add enhanc...
226
227
228
229
    DWORD            MaxSGElements;
    DWORD            MaxLogicalUnits;
    DWORD            MaxPhysicalDrives;
    DWORD            MaxPhysicalDrivesPerLogicalUnit;
5e216153c   Mike Miller   cciss: add perfor...
230
    DWORD            MaxPerformantModeCommands;
a6528d017   Stephen M. Cameron   cciss: fix hard r...
231
232
233
    u8		   reserved[0x78 - 0x58];
    u32		   misc_fw_support; /* offset 0x78 */
  #define MISC_FW_DOORBELL_RESET (0x02)
bf2e2e6b8   Stephen M. Cameron   cciss: use new do...
234
  #define MISC_FW_DOORBELL_RESET2 (0x10)
62710ae1c   Stephen M. Cameron   cciss: do a bette...
235
  	u8	   driver_version[32];
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
236
  } CfgTable_struct;
5e216153c   Mike Miller   cciss: add perfor...
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
  
  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;
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
254
  #pragma pack()	 
b028461d6   dann frazier   cciss: remove C99...
255
  #endif /* CCISS_CMD_H */