xref: /openbmc/linux/include/uapi/linux/cciss_defs.h (revision 607ca46e)
1607ca46eSDavid Howells #ifndef CCISS_DEFS_H
2607ca46eSDavid Howells #define CCISS_DEFS_H
3607ca46eSDavid Howells 
4607ca46eSDavid Howells #include <linux/types.h>
5607ca46eSDavid Howells 
6607ca46eSDavid Howells /* general boundary definitions */
7607ca46eSDavid Howells #define SENSEINFOBYTES          32 /* note that this value may vary
8607ca46eSDavid Howells 				      between host implementations */
9607ca46eSDavid Howells 
10607ca46eSDavid Howells /* Command Status value */
11607ca46eSDavid Howells #define CMD_SUCCESS             0x0000
12607ca46eSDavid Howells #define CMD_TARGET_STATUS       0x0001
13607ca46eSDavid Howells #define CMD_DATA_UNDERRUN       0x0002
14607ca46eSDavid Howells #define CMD_DATA_OVERRUN        0x0003
15607ca46eSDavid Howells #define CMD_INVALID             0x0004
16607ca46eSDavid Howells #define CMD_PROTOCOL_ERR        0x0005
17607ca46eSDavid Howells #define CMD_HARDWARE_ERR        0x0006
18607ca46eSDavid Howells #define CMD_CONNECTION_LOST     0x0007
19607ca46eSDavid Howells #define CMD_ABORTED             0x0008
20607ca46eSDavid Howells #define CMD_ABORT_FAILED        0x0009
21607ca46eSDavid Howells #define CMD_UNSOLICITED_ABORT   0x000A
22607ca46eSDavid Howells #define CMD_TIMEOUT             0x000B
23607ca46eSDavid Howells #define CMD_UNABORTABLE		0x000C
24607ca46eSDavid Howells 
25607ca46eSDavid Howells /* transfer direction */
26607ca46eSDavid Howells #define XFER_NONE               0x00
27607ca46eSDavid Howells #define XFER_WRITE              0x01
28607ca46eSDavid Howells #define XFER_READ               0x02
29607ca46eSDavid Howells #define XFER_RSVD               0x03
30607ca46eSDavid Howells 
31607ca46eSDavid Howells /* task attribute */
32607ca46eSDavid Howells #define ATTR_UNTAGGED           0x00
33607ca46eSDavid Howells #define ATTR_SIMPLE             0x04
34607ca46eSDavid Howells #define ATTR_HEADOFQUEUE        0x05
35607ca46eSDavid Howells #define ATTR_ORDERED            0x06
36607ca46eSDavid Howells #define ATTR_ACA                0x07
37607ca46eSDavid Howells 
38607ca46eSDavid Howells /* cdb type */
39607ca46eSDavid Howells #define TYPE_CMD				0x00
40607ca46eSDavid Howells #define TYPE_MSG				0x01
41607ca46eSDavid Howells 
42607ca46eSDavid Howells /* Type defs used in the following structs */
43607ca46eSDavid Howells #define BYTE __u8
44607ca46eSDavid Howells #define WORD __u16
45607ca46eSDavid Howells #define HWORD __u16
46607ca46eSDavid Howells #define DWORD __u32
47607ca46eSDavid Howells 
48607ca46eSDavid Howells #define CISS_MAX_LUN	1024
49607ca46eSDavid Howells 
50607ca46eSDavid Howells #define LEVEL2LUN   1 /* index into Target(x) structure, due to byte swapping */
51607ca46eSDavid Howells #define LEVEL3LUN   0
52607ca46eSDavid Howells 
53607ca46eSDavid Howells #pragma pack(1)
54607ca46eSDavid Howells 
55607ca46eSDavid Howells /* Command List Structure */
56607ca46eSDavid Howells typedef union _SCSI3Addr_struct {
57607ca46eSDavid Howells    struct {
58607ca46eSDavid Howells     BYTE Dev;
59607ca46eSDavid Howells     BYTE Bus:6;
60607ca46eSDavid Howells     BYTE Mode:2;        /* b00 */
61607ca46eSDavid Howells   } PeripDev;
62607ca46eSDavid Howells    struct {
63607ca46eSDavid Howells     BYTE DevLSB;
64607ca46eSDavid Howells     BYTE DevMSB:6;
65607ca46eSDavid Howells     BYTE Mode:2;        /* b01 */
66607ca46eSDavid Howells   } LogDev;
67607ca46eSDavid Howells    struct {
68607ca46eSDavid Howells     BYTE Dev:5;
69607ca46eSDavid Howells     BYTE Bus:3;
70607ca46eSDavid Howells     BYTE Targ:6;
71607ca46eSDavid Howells     BYTE Mode:2;        /* b10 */
72607ca46eSDavid Howells   } LogUnit;
73607ca46eSDavid Howells } SCSI3Addr_struct;
74607ca46eSDavid Howells 
75607ca46eSDavid Howells typedef struct _PhysDevAddr_struct {
76607ca46eSDavid Howells   DWORD             TargetId:24;
77607ca46eSDavid Howells   DWORD             Bus:6;
78607ca46eSDavid Howells   DWORD             Mode:2;
79607ca46eSDavid Howells   SCSI3Addr_struct  Target[2]; /* 2 level target device addr */
80607ca46eSDavid Howells } PhysDevAddr_struct;
81607ca46eSDavid Howells 
82607ca46eSDavid Howells typedef struct _LogDevAddr_struct {
83607ca46eSDavid Howells   DWORD            VolId:30;
84607ca46eSDavid Howells   DWORD            Mode:2;
85607ca46eSDavid Howells   BYTE             reserved[4];
86607ca46eSDavid Howells } LogDevAddr_struct;
87607ca46eSDavid Howells 
88607ca46eSDavid Howells typedef union _LUNAddr_struct {
89607ca46eSDavid Howells   BYTE               LunAddrBytes[8];
90607ca46eSDavid Howells   SCSI3Addr_struct   SCSI3Lun[4];
91607ca46eSDavid Howells   PhysDevAddr_struct PhysDev;
92607ca46eSDavid Howells   LogDevAddr_struct  LogDev;
93607ca46eSDavid Howells } LUNAddr_struct;
94607ca46eSDavid Howells 
95607ca46eSDavid Howells typedef struct _RequestBlock_struct {
96607ca46eSDavid Howells   BYTE   CDBLen;
97607ca46eSDavid Howells   struct {
98607ca46eSDavid Howells     BYTE Type:3;
99607ca46eSDavid Howells     BYTE Attribute:3;
100607ca46eSDavid Howells     BYTE Direction:2;
101607ca46eSDavid Howells   } Type;
102607ca46eSDavid Howells   HWORD  Timeout;
103607ca46eSDavid Howells   BYTE   CDB[16];
104607ca46eSDavid Howells } RequestBlock_struct;
105607ca46eSDavid Howells 
106607ca46eSDavid Howells typedef union _MoreErrInfo_struct{
107607ca46eSDavid Howells   struct {
108607ca46eSDavid Howells     BYTE  Reserved[3];
109607ca46eSDavid Howells     BYTE  Type;
110607ca46eSDavid Howells     DWORD ErrorInfo;
111607ca46eSDavid Howells   } Common_Info;
112607ca46eSDavid Howells   struct{
113607ca46eSDavid Howells     BYTE  Reserved[2];
114607ca46eSDavid Howells     BYTE  offense_size; /* size of offending entry */
115607ca46eSDavid Howells     BYTE  offense_num;  /* byte # of offense 0-base */
116607ca46eSDavid Howells     DWORD offense_value;
117607ca46eSDavid Howells   } Invalid_Cmd;
118607ca46eSDavid Howells } MoreErrInfo_struct;
119607ca46eSDavid Howells typedef struct _ErrorInfo_struct {
120607ca46eSDavid Howells   BYTE               ScsiStatus;
121607ca46eSDavid Howells   BYTE               SenseLen;
122607ca46eSDavid Howells   HWORD              CommandStatus;
123607ca46eSDavid Howells   DWORD              ResidualCnt;
124607ca46eSDavid Howells   MoreErrInfo_struct MoreErrInfo;
125607ca46eSDavid Howells   BYTE               SenseInfo[SENSEINFOBYTES];
126607ca46eSDavid Howells } ErrorInfo_struct;
127607ca46eSDavid Howells 
128607ca46eSDavid Howells #pragma pack()
129607ca46eSDavid Howells 
130607ca46eSDavid Howells #endif /* CCISS_DEFS_H */
131