Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


cciss_defs.h
001: #ifndef CCISS_DEFS_H
002: #define CCISS_DEFS_H
003: 
004: #include <linux/types.h>
005: 
006: /* general boundary definitions */
007: #define SENSEINFOBYTES          32 /* note that this value may vary
008:                                       between host implementations */
009: 
010: /* Command Status value */
011: #define CMD_SUCCESS             0x0000
012: #define CMD_TARGET_STATUS       0x0001
013: #define CMD_DATA_UNDERRUN       0x0002
014: #define CMD_DATA_OVERRUN        0x0003
015: #define CMD_INVALID             0x0004
016: #define CMD_PROTOCOL_ERR        0x0005
017: #define CMD_HARDWARE_ERR        0x0006
018: #define CMD_CONNECTION_LOST     0x0007
019: #define CMD_ABORTED             0x0008
020: #define CMD_ABORT_FAILED        0x0009
021: #define CMD_UNSOLICITED_ABORT   0x000A
022: #define CMD_TIMEOUT             0x000B
023: #define CMD_UNABORTABLE         0x000C
024: 
025: /* transfer direction */
026: #define XFER_NONE               0x00
027: #define XFER_WRITE              0x01
028: #define XFER_READ               0x02
029: #define XFER_RSVD               0x03
030: 
031: /* task attribute */
032: #define ATTR_UNTAGGED           0x00
033: #define ATTR_SIMPLE             0x04
034: #define ATTR_HEADOFQUEUE        0x05
035: #define ATTR_ORDERED            0x06
036: #define ATTR_ACA                0x07
037: 
038: /* cdb type */
039: #define TYPE_CMD                                0x00
040: #define TYPE_MSG                                0x01
041: 
042: /* Type defs used in the following structs */
043: #define BYTE __u8
044: #define WORD __u16
045: #define HWORD __u16
046: #define DWORD __u32
047: 
048: #define CISS_MAX_LUN    1024
049: 
050: #define LEVEL2LUN   1 /* index into Target(x) structure, due to byte swapping */
051: #define LEVEL3LUN   0
052: 
053: #pragma pack(1)
054: 
055: /* Command List Structure */
056: typedef union _SCSI3Addr_struct {
057:    struct {
058:     BYTE Dev;
059:     BYTE Bus:6;
060:     BYTE Mode:2;        /* b00 */
061:   } PeripDev;
062:    struct {
063:     BYTE DevLSB;
064:     BYTE DevMSB:6;
065:     BYTE Mode:2;        /* b01 */
066:   } LogDev;
067:    struct {
068:     BYTE Dev:5;
069:     BYTE Bus:3;
070:     BYTE Targ:6;
071:     BYTE Mode:2;        /* b10 */
072:   } LogUnit;
073: } SCSI3Addr_struct;
074: 
075: typedef struct _PhysDevAddr_struct {
076:   DWORD             TargetId:24;
077:   DWORD             Bus:6;
078:   DWORD             Mode:2;
079:   SCSI3Addr_struct  Target[2]; /* 2 level target device addr */
080: } PhysDevAddr_struct;
081: 
082: typedef struct _LogDevAddr_struct {
083:   DWORD            VolId:30;
084:   DWORD            Mode:2;
085:   BYTE             reserved[4];
086: } LogDevAddr_struct;
087: 
088: typedef union _LUNAddr_struct {
089:   BYTE               LunAddrBytes[8];
090:   SCSI3Addr_struct   SCSI3Lun[4];
091:   PhysDevAddr_struct PhysDev;
092:   LogDevAddr_struct  LogDev;
093: } LUNAddr_struct;
094: 
095: typedef struct _RequestBlock_struct {
096:   BYTE   CDBLen;
097:   struct {
098:     BYTE Type:3;
099:     BYTE Attribute:3;
100:     BYTE Direction:2;
101:   } Type;
102:   HWORD  Timeout;
103:   BYTE   CDB[16];
104: } RequestBlock_struct;
105: 
106: typedef union _MoreErrInfo_struct{
107:   struct {
108:     BYTE  Reserved[3];
109:     BYTE  Type;
110:     DWORD ErrorInfo;
111:   } Common_Info;
112:   struct{
113:     BYTE  Reserved[2];
114:     BYTE  offense_size; /* size of offending entry */
115:     BYTE  offense_num;  /* byte # of offense 0-base */
116:     DWORD offense_value;
117:   } Invalid_Cmd;
118: } MoreErrInfo_struct;
119: typedef struct _ErrorInfo_struct {
120:   BYTE               ScsiStatus;
121:   BYTE               SenseLen;
122:   HWORD              CommandStatus;
123:   DWORD              ResidualCnt;
124:   MoreErrInfo_struct MoreErrInfo;
125:   BYTE               SenseInfo[SENSEINFOBYTES];
126: } ErrorInfo_struct;
127: 
128: #pragma pack()
129: 
130: #endif /* CCISS_DEFS_H */
131: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/