1 | #ifndef _SRBOS2_H_
|
---|
2 | #define _SRBOS2_H_
|
---|
3 |
|
---|
4 | #pragma pack(1)
|
---|
5 |
|
---|
6 | /* SRB command */
|
---|
7 | #define SRB_Inquiry 0x00
|
---|
8 | #define SRB_Device 0x01
|
---|
9 | #define SRB_Command 0x02
|
---|
10 | #define SRBOS2_Abort 0x03
|
---|
11 | #define SRB_Reset 0x04
|
---|
12 | #define SRB_Param 0x05
|
---|
13 |
|
---|
14 | /* SRB status */
|
---|
15 | #define SRB_Busy 0x00 /* SCSI request in progress */
|
---|
16 | #define SRB_Done 0x01 /* SCSI request completed without error */
|
---|
17 | #define SRB_Aborted 0x02 /* SCSI aborted by host */
|
---|
18 | #define SRB_BadAbort 0x03 /* Unable to abort SCSI request */
|
---|
19 | #define SRB_Error 0x04 /* SCSI request completed with error */
|
---|
20 | #define SRB_BusyPost 0x10 /* SCSI request in progress with POST - Nokia */
|
---|
21 | #define SRB_InvalidCmd 0x80 /* Invalid SCSI request */
|
---|
22 | #define SRB_InvalidHA 0x81 /* Invalid Hhost adapter number */
|
---|
23 | #define SRB_BadDevice 0x82 /* SCSI device not installed */
|
---|
24 |
|
---|
25 | /* SRB flags */
|
---|
26 | #define SRB_Post 0x01 /* Post vector valid */
|
---|
27 | #define SRB_Link 0x02 /* Link vector valid */
|
---|
28 | #define SRB_SG 0x04 /* Nokia: scatter/gather */
|
---|
29 | /* S/G: n * (4 bytes length, 4 bytes addr) */
|
---|
30 | /* No of s/g items not limited by HA spec. */
|
---|
31 | #define SRB_NoCheck 0x00 /* determined by command, not checked */
|
---|
32 | #define SRB_Read 0x08 /* target to host, length checked */
|
---|
33 | #define SRB_Write 0x10 /* host to target, length checked */
|
---|
34 | #define SRB_NoTransfer 0x18 /* no data transfer */
|
---|
35 | #define SRB_DirMask 0x18 /* bit mask */
|
---|
36 |
|
---|
37 | /* SRB host adapter status */
|
---|
38 | #define SRB_NoError 0x00 /* No host adapter detected error */
|
---|
39 | #define SRBOS2_Timeout 0x11 /* Selection timeout */
|
---|
40 | #define SRB_DataLength 0x12 /* Data over/underrun */
|
---|
41 | #define SRB_BusFree 0x13 /* Unexpected bus free */
|
---|
42 | #define SRB_BusSequence 0x14 /* Target bus sequence failure */
|
---|
43 |
|
---|
44 | /* SRB target status field */
|
---|
45 | #define SRB_NoStatus 0x00 /* No target status */
|
---|
46 | #define SRB_CheckStatus 0x02 /* Check status (sense data valid) */
|
---|
47 | #define SRB_LUN_Busy 0x08 /* Specified LUN is busy */
|
---|
48 | #define SRB_Reserved 0x18 /* Reservation conflict */
|
---|
49 |
|
---|
50 | #define MaxCDBStatus 64 /* max size of CDB + status */
|
---|
51 |
|
---|
52 | typedef struct SRBOS2 SRBOS2;
|
---|
53 | typedef struct SRBOS2 {
|
---|
54 | unsigned char cmd, /* 00 */
|
---|
55 | status, /* 01 */
|
---|
56 | ha_num, /* 02 */
|
---|
57 | flags; /* 03 */
|
---|
58 | unsigned long res_04_07; /* 04..07 */
|
---|
59 | union { /* 08 */
|
---|
60 |
|
---|
61 | /* SRB_Inquiry */
|
---|
62 | struct {
|
---|
63 | unsigned char num_ha, /* 08 */
|
---|
64 | ha_target, /* 09 */
|
---|
65 | aspimgr_id[16], /* 0A..19 */
|
---|
66 | host_id[16], /* 1A..29 */
|
---|
67 | unique_id[16]; /* 2A..39 */
|
---|
68 | } inq;
|
---|
69 |
|
---|
70 | /* SRB_Device */
|
---|
71 | struct {
|
---|
72 | unsigned char target, /* 08 */
|
---|
73 | lun, /* 09 */
|
---|
74 | devtype; /* 0A */
|
---|
75 | } dev;
|
---|
76 |
|
---|
77 | /* SRB_Command */
|
---|
78 | struct {
|
---|
79 | unsigned char target, /* 08 */
|
---|
80 | lun; /* 09 */
|
---|
81 | unsigned long data_len; /* 0A..0D */
|
---|
82 | unsigned char sense_len; /* 0E */
|
---|
83 | void * _Seg16 data_ptr; /* 0F..12 */
|
---|
84 | void * _Seg16 link_ptr; /* 13..16 */
|
---|
85 | unsigned char cdb_len, /* 17 */
|
---|
86 | ha_status, /* 18 */
|
---|
87 | target_status; /* 19 */
|
---|
88 | void (* _Seg16 post) (SRBOS2 *); /* 1A..1D */
|
---|
89 | unsigned char res_1E_29[12]; /* 1E..29 */
|
---|
90 | unsigned char res_2A_3F[22]; /* 2A..3F */
|
---|
91 | unsigned char cdb_st[64]; /* 40..7F CDB+status */
|
---|
92 | unsigned char res_80_BF[64]; /* 80..BF */
|
---|
93 | } cmd;
|
---|
94 |
|
---|
95 | /* SRB_Abort */
|
---|
96 | struct {
|
---|
97 | void * _Seg16 srb; /* 08..0B */
|
---|
98 | } abt;
|
---|
99 |
|
---|
100 | /* SRB_Reset */
|
---|
101 | struct {
|
---|
102 | unsigned char target, /* 08 */
|
---|
103 | lun, /* 09 */
|
---|
104 | res_0A_17[14], /* 0A..17 */
|
---|
105 | ha_status, /* 18 */
|
---|
106 | target_status; /* 19 */
|
---|
107 | } res;
|
---|
108 |
|
---|
109 | /* SRB_Param - unused by ASPI4OS2 */
|
---|
110 | struct {
|
---|
111 | unsigned char unique[16]; /* 08..17 */
|
---|
112 | } par;
|
---|
113 |
|
---|
114 | } u;
|
---|
115 | } SRBOS2;
|
---|
116 |
|
---|
117 |
|
---|
118 | // SCSI sense codes
|
---|
119 | // Note! This list may not be complete. I did this compilation for use with tape drives.
|
---|
120 |
|
---|
121 | #define Sense_Current 0x70; // Current Error
|
---|
122 | #define Sense_Deferred 0x71; // Deferred Error
|
---|
123 | #define Sense_Filemark 0x80; // Filemark detected
|
---|
124 | #define Sense_EOM 0x40; // End of medium detected
|
---|
125 | #define Sense_ILI 0x20; // Incorrect length indicator
|
---|
126 |
|
---|
127 | // Sense Keys
|
---|
128 |
|
---|
129 | #define SK_NoSense 0x00; // No Sense
|
---|
130 | #define SK_RcvrdErr 0x01; // Recovered Error
|
---|
131 | #define SK_NotReady 0x02; // Not ready
|
---|
132 | #define SK_MedErr 0x03; // Medium Error
|
---|
133 | #define SK_HWErr 0x04; // Hardware Error
|
---|
134 | #define SK_IllReq 0x05; // Illegal Request
|
---|
135 | #define SK_UnitAtt 0x06; // Unit attention
|
---|
136 | #define SK_DataProt 0x07: // Data Protect
|
---|
137 | #define SK_BlankChk 0x08: // Blank Check
|
---|
138 | #define SK_VndSpec 0x09; // Vendor Specific
|
---|
139 | #define SK_CopyAbort 0x0A; // Copy Aborted
|
---|
140 | #define SK_AbtdCmd 0x0B; // Aborted Command
|
---|
141 | #define SK_Equal 0x0C; // Equal
|
---|
142 | #define SK_VolOvfl 0x0D; // Volume Overflow
|
---|
143 | #define SK_MisComp 0x0E; // Miscompare
|
---|
144 | #define SK_Reserved 0x0F; // Reserved
|
---|
145 |
|
---|
146 | #pragma pack()
|
---|
147 | #endif // _SRBOS2_H_
|
---|