4 /* This file should be 100% source compatible according to MSes docs and
9 #endif /* #ifdef __cplusplus */
11 /* SCSI Miscellaneous Stuff */
13 #define SRB_DIR_SCSI 0x00
14 #define SRB_POSTING 0x01
15 #define SRB_ENABLE_RESIDUAL_COUNT 0x04
16 #define SRB_DIR_IN 0x08
17 #define SRB_DIR_OUT 0x10
19 /* ASPI Command Definitions */
20 #define SC_HA_INQUIRY 0x00
21 #define SC_GET_DEV_TYPE 0x01
22 #define SC_EXEC_SCSI_CMD 0x02
23 #define SC_ABORT_SRB 0x03
24 #define SC_RESET_DEV 0x04
25 #define SC_SET_HA_PARMS 0x05
26 #define SC_GET_DISK_INFO 0x06
28 /* SRB status codes */
29 #define SS_PENDING 0x00
31 #define SS_ABORTED 0x02
32 #define SS_ABORT_FAIL 0x03
35 #define SS_INVALID_CMD 0x80
36 #define SS_INVALID_HA 0x81
37 #define SS_NO_DEVICE 0x82
39 #define SS_INVALID_SRB 0xE0
40 #define SS_OLD_MANAGER 0xE1
41 #define SS_BUFFER_ALIGN 0xE1 // Win32
42 #define SS_ILLEGAL_MODE 0xE2
43 #define SS_NO_ASPI 0xE3
44 #define SS_FAILED_INIT 0xE4
45 #define SS_ASPI_IS_BUSY 0xE5
46 #define SS_BUFFER_TO_BIG 0xE6
47 #define SS_MISMATCHED_COMPONENTS 0xE7 // DLLs/EXE version mismatch
48 #define SS_NO_ADAPTERS 0xE8
49 #define SS_INSUFFICIENT_RESOURCES 0xE9
50 #define SS_ASPI_IS_SHUTDOWN 0xEA
51 #define SS_BAD_INSTALL 0xEB
54 /* Host status codes */
55 #define HASTAT_OK 0x00
56 #define HASTAT_SEL_TO 0x11
57 #define HASTAT_DO_DU 0x12
58 #define HASTAT_BUS_FREE 0x13
59 #define HASTAT_PHASE_ERR 0x14
61 #define HASTAT_TIMEOUT 0x09
62 #define HASTAT_COMMAND_TIMEOUT 0x0B
63 #define HASTAT_MESSAGE_REJECT 0x0D
64 #define HASTAT_BUS_RESET 0x0E
65 #define HASTAT_PARITY_ERROR 0x0F
66 #define HASTAT_REQUEST_SENSE_FAILED 0x10
69 /* Additional definitions */
70 /* SCSI Miscellaneous Stuff */
71 #define SRB_EVENT_NOTIFY 0x40
72 #define RESIDUAL_COUNT_SUPPORTED 0x02
73 #define MAX_SRB_TIMEOUT 1080001u
74 #define DEFAULT_SRB_TIMEOUT 1080001u
76 /* These are defined by MS but not adaptec */
77 #define SRB_DATA_SG_LIST 0x02
78 #define WM_ASPIPOST 0x4D42
81 /* ASPI Command Definitions */
82 #define SC_RESCAN_SCSI_BUS 0x07
83 #define SC_GETSET_TIMEOUTS 0x08
85 /* SRB Status.. MS defined */
86 #define SS_SECURITY_VIOLATION 0xE2 // Replaces SS_INVALID_MODE
91 /* SRB - HOST ADAPTER INQUIRY - SC_HA_INQUIRY */
92 typedef struct tagSRB32_HaInquiry {
93 BYTE SRB_Cmd; /* 00 ASPI command code = SC_HA_INQUIRY */
94 BYTE SRB_Status; /* 01 ASPI command status byte */
95 BYTE SRB_HaId; /* 02 ASPI host adapter number */
96 BYTE SRB_Flags; /* 03 ASPI request flags */
97 DWORD SRB_Hdr_Rsvd; /* 04 Reserved, MUST = 0 */
98 BYTE HA_Count; /* 08 Number of host adapters present */
99 BYTE HA_SCSI_ID; /* 09 SCSI ID of host adapter */
100 BYTE HA_ManagerId[16]; /* 0A String describing the manager */
101 BYTE HA_Identifier[16]; /* 1A String describing the host adapter */
102 BYTE HA_Unique[16]; /* 2A Host Adapter Unique parameters */
104 } SRB_HaInquiry, *PSRB_HaInquiry;
106 /* SRB - GET DEVICE TYPE - SC_GET_DEV_TYPE */
107 typedef struct tagSRB32_GDEVBlock {
108 BYTE SRB_Cmd; /* 00 ASPI command code = SC_GET_DEV_TYPE */
109 BYTE SRB_Status; /* 01 ASPI command status byte */
110 BYTE SRB_HaId; /* 02 ASPI host adapter number */
111 BYTE SRB_Flags; /* 03 Reserved */
112 DWORD SRB_Hdr_Rsvd; /* 04 Reserved */
113 BYTE SRB_Target; /* 08 Target's SCSI ID */
114 BYTE SRB_Lun; /* 09 Target's LUN number */
115 BYTE SRB_DeviceType; /* 0A Target's peripheral device type */
117 } SRB_GDEVBlock, *PSRB_GDEVBlock;
119 /* SRB - EXECUTE SCSI COMMAND - SC_EXEC_SCSI_CMD */
120 typedef struct tagSRB32_ExecSCSICmd {
121 BYTE SRB_Cmd; /* 00 ASPI command code = SC_EXEC_SCSI_CMD */
122 BYTE SRB_Status; /* 01 ASPI command status byte */
123 BYTE SRB_HaId; /* 02 ASPI host adapter number */
124 BYTE SRB_Flags; /* 03 ASPI request flags */
125 DWORD SRB_Hdr_Rsvd; /* 04 Reserved */
126 BYTE SRB_Target; /* 08 Target's SCSI ID */
127 BYTE SRB_Lun; /* 09 Target's LUN number */
128 WORD SRB_Rsvd1; /* 0A Reserved for Alignment */
129 DWORD SRB_BufLen; /* 0C Data Allocation Length */
130 BYTE *SRB_BufPointer; /* 10 Data Buffer Point */
131 BYTE SRB_SenseLen; /* 14 Sense Allocation Length */
132 BYTE SRB_CDBLen; /* 15 CDB Length */
133 BYTE SRB_HaStat; /* 16 Host Adapter Status */
134 BYTE SRB_TargStat; /* 17 Target Status */
135 void (*SRB_PostProc)(); /* 18 Post routine */
136 void *SRB_Rsvd2; /* 1C Reserved */
137 BYTE SRB_Rsvd3[16]; /* 20 Reserved for expansion */
138 BYTE CDBByte[16]; /* 30 SCSI CDB */
139 BYTE SenseArea[SENSE_LEN+2]; /* 40 Request sense buffer - var length */
140 } SRB_ExecSCSICmd, *PSRB_ExecSCSICmd;
142 /* SRB - ABORT AN ARB - SC_ABORT_SRB */
143 typedef struct tagSRB32_Abort {
144 BYTE SRB_Cmd; /* 00 ASPI command code = SC_ABORT_SRB */
145 BYTE SRB_Status; /* 01 ASPI command status byte */
146 BYTE SRB_HaId; /* 02 ASPI host adapter number */
147 BYTE SRB_Flags; /* 03 Reserved */
148 DWORD SRB_Hdr_Rsvd; /* 04 Reserved, MUST = 0 */
149 VOID *SRB_ToAbort; /* 08 Pointer to SRB to abort */
150 } SRB_Abort, *PSRB_Abort;
152 /* SRB - BUS DEVICE RESET - SC_RESET_DEV */
153 typedef struct tagSRB32_BusDeviceReset {
154 BYTE SRB_Cmd; /* 00 ASPI cmd code = SC_RESET_DEV */
155 BYTE SRB_Status; /* 01 ASPI command status byte */
156 BYTE SRB_HaId; /* 02 ASPI host adapter number */
157 BYTE SRB_Flags; /* 03 Reserved */
158 DWORD SRB_Hdr_Rsvd; /* 04 Reserved */
159 BYTE SRB_Target; /* 08 Target's SCSI ID */
160 BYTE SRB_Lun; /* 09 Target's LUN number */
161 BYTE SRB_Rsvd1[12]; /* 0A Reserved for Alignment */
162 BYTE SRB_HaStat; /* 16 Host Adapter Status */
163 BYTE SRB_TargStat; /* 17 Target Status */
164 void (*SRB_PostProc)(); /* 18 Post routine */
165 void *SRB_Rsvd2; /* 1c Reserved */
166 BYTE SRB_Rsvd3[32]; /* 20 Reserved */
167 } SRB_BusDeviceReset, *PSRB_BusDeviceReset;
169 /* SRB - GET DISK INFORMATION - SC_GET_DISK_INFO */
170 typedef struct tagSRB32_GetDiskInfo {
171 BYTE SRB_Cmd; /* 00 ASPI cmd code = SC_RESET_DEV */
172 BYTE SRB_Status; /* 01 ASPI command status byte */
173 BYTE SRB_HaId; /* 02 ASPI host adapter number */
174 BYTE SRB_Flags; /* 03 Reserved */
175 DWORD SRB_Hdr_Rsvd; /* 04 Reserved */
176 BYTE SRB_Target; /* 08 Target's SCSI ID */
177 BYTE SRB_Lun; /* 09 Target's LUN number */
178 BYTE SRB_DriveFlags; /* 0A Driver flags */
179 BYTE SRB_Int13HDriveInfo; /* 0B Host Adapter Status */
180 BYTE SRB_Heads; /* 0C Preferred number of heads trans */
181 BYTE SRB_Sectors; /* 0D Preferred number of sectors trans */
182 BYTE SRB_Rsvd1[10]; /* 0E Reserved */
183 } SRB_GetDiskInfo, *PSRB_GetDiskInfo;
186 typedef struct tagSRB32_Header {
187 BYTE SRB_Cmd; /* 00 ASPI cmd code = SC_RESET_DEV */
188 BYTE SRB_Status; /* 01 ASPI command status byte */
189 BYTE SRB_HaId; /* 02 ASPI host adapter number */
190 BYTE SRB_Flags; /* 03 Reserved */
191 DWORD SRB_Hdr_Rsvd; /* 04 Reserved */
192 } SRB_Header, *PSRB_Header;
194 typedef union tagSRB32 {
196 SRB_HaInquiry inquiry;
199 SRB_BusDeviceReset reset;
200 SRB_GDEVBlock devtype;
201 } SRB, *PSRB, *LPSRB;
206 extern DWORD __cdecl SendASPI32Command (PSRB);
207 extern DWORD __cdecl GetASPI32SupportInfo (void);
208 extern DWORD __cdecl GetASPI32DLLVersion(void);
212 #endif /* #ifdef __cplusplus */
214 #endif /* __WNASPI32_H__ */