1 | /*
|
---|
2 | * Copyright (C) the Wine project
|
---|
3 | *
|
---|
4 | * This library is free software; you can redistribute it and/or
|
---|
5 | * modify it under the terms of the GNU Lesser General Public
|
---|
6 | * License as published by the Free Software Foundation; either
|
---|
7 | * version 2.1 of the License, or (at your option) any later version.
|
---|
8 | *
|
---|
9 | * This library is distributed in the hope that it will be useful,
|
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
12 | * Lesser General Public License for more details.
|
---|
13 | *
|
---|
14 | * You should have received a copy of the GNU Lesser General Public
|
---|
15 | * License along with this library; if not, write to the Free Software
|
---|
16 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
17 | */
|
---|
18 |
|
---|
19 | /*
|
---|
20 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
21 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
22 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
23 | * a choice of LGPL license versions is made available with the language indicating
|
---|
24 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
25 | * of the LGPL is applied is otherwise unspecified.
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef __WNASPI32_H__
|
---|
29 | #define __WNASPI32_H__
|
---|
30 |
|
---|
31 | /* This file should be 100% source compatible according to MSes docs and
|
---|
32 | * Adaptecs docs */
|
---|
33 |
|
---|
34 | #ifdef __cplusplus
|
---|
35 | extern "C" {
|
---|
36 | #endif /* #ifdef __cplusplus */
|
---|
37 |
|
---|
38 | /* SCSI Miscellaneous Stuff */
|
---|
39 | #define SENSE_LEN 14
|
---|
40 | #define SRB_DIR_SCSI 0x00
|
---|
41 | #define SRB_POSTING 0x01
|
---|
42 | #define SRB_ENABLE_RESIDUAL_COUNT 0x04
|
---|
43 | #define SRB_DIR_IN 0x08
|
---|
44 | #define SRB_DIR_OUT 0x10
|
---|
45 |
|
---|
46 | /* ASPI Command Definitions */
|
---|
47 | #define SC_HA_INQUIRY 0x00
|
---|
48 | #define SC_GET_DEV_TYPE 0x01
|
---|
49 | #define SC_EXEC_SCSI_CMD 0x02
|
---|
50 | #define SC_ABORT_SRB 0x03
|
---|
51 | #define SC_RESET_DEV 0x04
|
---|
52 | #define SC_SET_HA_PARMS 0x05
|
---|
53 | #define SC_GET_DISK_INFO 0x06
|
---|
54 |
|
---|
55 | /* SRB status codes */
|
---|
56 | #define SS_PENDING 0x00
|
---|
57 | #define SS_COMP 0x01
|
---|
58 | #define SS_ABORTED 0x02
|
---|
59 | #define SS_ABORT_FAIL 0x03
|
---|
60 | #define SS_ERR 0x04
|
---|
61 |
|
---|
62 | #define SS_INVALID_CMD 0x80
|
---|
63 | #define SS_INVALID_HA 0x81
|
---|
64 | #define SS_NO_DEVICE 0x82
|
---|
65 |
|
---|
66 | #define SS_INVALID_SRB 0xE0
|
---|
67 | #define SS_OLD_MANAGER 0xE1
|
---|
68 | #define SS_BUFFER_ALIGN 0xE1 /* Win32 */
|
---|
69 | #define SS_ILLEGAL_MODE 0xE2
|
---|
70 | #define SS_NO_ASPI 0xE3
|
---|
71 | #define SS_FAILED_INIT 0xE4
|
---|
72 | #define SS_ASPI_IS_BUSY 0xE5
|
---|
73 | #define SS_BUFFER_TO_BIG 0xE6
|
---|
74 | #define SS_MISMATCHED_COMPONENTS 0xE7 /* DLLs/EXE version mismatch */
|
---|
75 | #define SS_NO_ADAPTERS 0xE8
|
---|
76 | #define SS_INSUFFICIENT_RESOURCES 0xE9
|
---|
77 | #define SS_ASPI_IS_SHUTDOWN 0xEA
|
---|
78 | #define SS_BAD_INSTALL 0xEB
|
---|
79 |
|
---|
80 |
|
---|
81 | /* Host status codes */
|
---|
82 | #define HASTAT_OK 0x00
|
---|
83 | #define HASTAT_SEL_TO 0x11
|
---|
84 | #define HASTAT_DO_DU 0x12
|
---|
85 | #define HASTAT_BUS_FREE 0x13
|
---|
86 | #define HASTAT_PHASE_ERR 0x14
|
---|
87 |
|
---|
88 | #define HASTAT_TIMEOUT 0x09
|
---|
89 | #define HASTAT_COMMAND_TIMEOUT 0x0B
|
---|
90 | #define HASTAT_MESSAGE_REJECT 0x0D
|
---|
91 | #define HASTAT_BUS_RESET 0x0E
|
---|
92 | #define HASTAT_PARITY_ERROR 0x0F
|
---|
93 | #define HASTAT_REQUEST_SENSE_FAILED 0x10
|
---|
94 |
|
---|
95 |
|
---|
96 | /* Additional definitions */
|
---|
97 | /* SCSI Miscellaneous Stuff */
|
---|
98 | #define SRB_EVENT_NOTIFY 0x40
|
---|
99 | #define RESIDUAL_COUNT_SUPPORTED 0x02
|
---|
100 | #define MAX_SRB_TIMEOUT 1080001u
|
---|
101 | #define DEFAULT_SRB_TIMEOUT 1080001u
|
---|
102 |
|
---|
103 | /* These are defined by MS but not adaptec */
|
---|
104 | #define SRB_DATA_SG_LIST 0x02
|
---|
105 | #define WM_ASPIPOST 0x4D42
|
---|
106 |
|
---|
107 |
|
---|
108 | /* ASPI Command Definitions */
|
---|
109 | #define SC_RESCAN_SCSI_BUS 0x07
|
---|
110 | #define SC_GETSET_TIMEOUTS 0x08
|
---|
111 |
|
---|
112 | /* SRB Status.. MS defined */
|
---|
113 | #define SS_SECURITY_VIOLATION 0xE2 /* Replaces SS_INVALID_MODE */
|
---|
114 | /*** END DEFS */
|
---|
115 |
|
---|
116 | #include <pshpack1.h>
|
---|
117 |
|
---|
118 | /* SRB - HOST ADAPTER INQUIRY - SC_HA_INQUIRY */
|
---|
119 | typedef struct tagSRB32_HaInquiry {
|
---|
120 | BYTE SRB_Cmd; /* 00 ASPI command code = SC_HA_INQUIRY */
|
---|
121 | BYTE SRB_Status; /* 01 ASPI command status byte */
|
---|
122 | BYTE SRB_HaId; /* 02 ASPI host adapter number */
|
---|
123 | BYTE SRB_Flags; /* 03 ASPI request flags */
|
---|
124 | DWORD SRB_Hdr_Rsvd; /* 04 Reserved, MUST = 0 */
|
---|
125 | BYTE HA_Count; /* 08 Number of host adapters present */
|
---|
126 | BYTE HA_SCSI_ID; /* 09 SCSI ID of host adapter */
|
---|
127 | BYTE HA_ManagerId[16]; /* 0A String describing the manager */
|
---|
128 | BYTE HA_Identifier[16]; /* 1A String describing the host adapter */
|
---|
129 | BYTE HA_Unique[16]; /* 2A Host Adapter Unique parameters */
|
---|
130 | WORD HA_Rsvd1;
|
---|
131 | } SRB_HaInquiry, *PSRB_HaInquiry;
|
---|
132 |
|
---|
133 | /* SRB - GET DEVICE TYPE - SC_GET_DEV_TYPE */
|
---|
134 | typedef struct tagSRB32_GDEVBlock {
|
---|
135 | BYTE SRB_Cmd; /* 00 ASPI command code = SC_GET_DEV_TYPE */
|
---|
136 | BYTE SRB_Status; /* 01 ASPI command status byte */
|
---|
137 | BYTE SRB_HaId; /* 02 ASPI host adapter number */
|
---|
138 | BYTE SRB_Flags; /* 03 Reserved */
|
---|
139 | DWORD SRB_Hdr_Rsvd; /* 04 Reserved */
|
---|
140 | BYTE SRB_Target; /* 08 Target's SCSI ID */
|
---|
141 | BYTE SRB_Lun; /* 09 Target's LUN number */
|
---|
142 | BYTE SRB_DeviceType; /* 0A Target's peripheral device type */
|
---|
143 | BYTE SRB_Rsvd1;
|
---|
144 | } SRB_GDEVBlock, *PSRB_GDEVBlock;
|
---|
145 |
|
---|
146 | /* SRB - EXECUTE SCSI COMMAND - SC_EXEC_SCSI_CMD */
|
---|
147 | typedef struct tagSRB32_ExecSCSICmd {
|
---|
148 | BYTE SRB_Cmd; /* 00 ASPI command code = SC_EXEC_SCSI_CMD */
|
---|
149 | BYTE SRB_Status; /* 01 ASPI command status byte */
|
---|
150 | BYTE SRB_HaId; /* 02 ASPI host adapter number */
|
---|
151 | BYTE SRB_Flags; /* 03 ASPI request flags */
|
---|
152 | DWORD SRB_Hdr_Rsvd; /* 04 Reserved */
|
---|
153 | BYTE SRB_Target; /* 08 Target's SCSI ID */
|
---|
154 | BYTE SRB_Lun; /* 09 Target's LUN number */
|
---|
155 | WORD SRB_Rsvd1; /* 0A Reserved for Alignment */
|
---|
156 | DWORD SRB_BufLen; /* 0C Data Allocation Length */
|
---|
157 | BYTE *SRB_BufPointer; /* 10 Data Buffer Point */
|
---|
158 | BYTE SRB_SenseLen; /* 14 Sense Allocation Length */
|
---|
159 | BYTE SRB_CDBLen; /* 15 CDB Length */
|
---|
160 | BYTE SRB_HaStat; /* 16 Host Adapter Status */
|
---|
161 | BYTE SRB_TargStat; /* 17 Target Status */
|
---|
162 | void (*SRB_PostProc)(); /* 18 Post routine */
|
---|
163 | void *SRB_Rsvd2; /* 1C Reserved */
|
---|
164 | BYTE SRB_Rsvd3[16]; /* 20 Reserved for expansion */
|
---|
165 | BYTE CDBByte[16]; /* 30 SCSI CDB */
|
---|
166 | BYTE SenseArea[SENSE_LEN+2]; /* 40 Request sense buffer - var length */
|
---|
167 | } SRB_ExecSCSICmd, *PSRB_ExecSCSICmd;
|
---|
168 |
|
---|
169 | /* SRB - ABORT AN ARB - SC_ABORT_SRB */
|
---|
170 | typedef struct tagSRB32_Abort {
|
---|
171 | BYTE SRB_Cmd; /* 00 ASPI command code = SC_ABORT_SRB */
|
---|
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, MUST = 0 */
|
---|
176 | VOID *SRB_ToAbort; /* 08 Pointer to SRB to abort */
|
---|
177 | } SRB_Abort, *PSRB_Abort;
|
---|
178 |
|
---|
179 | /* SRB - BUS DEVICE RESET - SC_RESET_DEV */
|
---|
180 | typedef struct tagSRB32_BusDeviceReset {
|
---|
181 | BYTE SRB_Cmd; /* 00 ASPI cmd code = SC_RESET_DEV */
|
---|
182 | BYTE SRB_Status; /* 01 ASPI command status byte */
|
---|
183 | BYTE SRB_HaId; /* 02 ASPI host adapter number */
|
---|
184 | BYTE SRB_Flags; /* 03 Reserved */
|
---|
185 | DWORD SRB_Hdr_Rsvd; /* 04 Reserved */
|
---|
186 | BYTE SRB_Target; /* 08 Target's SCSI ID */
|
---|
187 | BYTE SRB_Lun; /* 09 Target's LUN number */
|
---|
188 | BYTE SRB_Rsvd1[12]; /* 0A Reserved for Alignment */
|
---|
189 | BYTE SRB_HaStat; /* 16 Host Adapter Status */
|
---|
190 | BYTE SRB_TargStat; /* 17 Target Status */
|
---|
191 | void (*SRB_PostProc)(); /* 18 Post routine */
|
---|
192 | void *SRB_Rsvd2; /* 1c Reserved */
|
---|
193 | BYTE SRB_Rsvd3[32]; /* 20 Reserved */
|
---|
194 | } SRB_BusDeviceReset, *PSRB_BusDeviceReset;
|
---|
195 |
|
---|
196 | /* SRB - GET DISK INFORMATION - SC_GET_DISK_INFO */
|
---|
197 | typedef struct tagSRB32_GetDiskInfo {
|
---|
198 | BYTE SRB_Cmd; /* 00 ASPI cmd code = SC_RESET_DEV */
|
---|
199 | BYTE SRB_Status; /* 01 ASPI command status byte */
|
---|
200 | BYTE SRB_HaId; /* 02 ASPI host adapter number */
|
---|
201 | BYTE SRB_Flags; /* 03 Reserved */
|
---|
202 | DWORD SRB_Hdr_Rsvd; /* 04 Reserved */
|
---|
203 | BYTE SRB_Target; /* 08 Target's SCSI ID */
|
---|
204 | BYTE SRB_Lun; /* 09 Target's LUN number */
|
---|
205 | BYTE SRB_DriveFlags; /* 0A Driver flags */
|
---|
206 | BYTE SRB_Int13HDriveInfo; /* 0B Host Adapter Status */
|
---|
207 | BYTE SRB_Heads; /* 0C Preferred number of heads trans */
|
---|
208 | BYTE SRB_Sectors; /* 0D Preferred number of sectors trans */
|
---|
209 | BYTE SRB_Rsvd1[10]; /* 0E Reserved */
|
---|
210 | } SRB_GetDiskInfo, *PSRB_GetDiskInfo;
|
---|
211 |
|
---|
212 | /* SRB header */
|
---|
213 | typedef struct tagSRB32_Header {
|
---|
214 | BYTE SRB_Cmd; /* 00 ASPI cmd code = SC_RESET_DEV */
|
---|
215 | BYTE SRB_Status; /* 01 ASPI command status byte */
|
---|
216 | BYTE SRB_HaId; /* 02 ASPI host adapter number */
|
---|
217 | BYTE SRB_Flags; /* 03 Reserved */
|
---|
218 | DWORD SRB_Hdr_Rsvd; /* 04 Reserved */
|
---|
219 | } SRB_Header, *PSRB_Header;
|
---|
220 |
|
---|
221 | typedef union tagSRB32 {
|
---|
222 | SRB_Header common;
|
---|
223 | SRB_HaInquiry inquiry;
|
---|
224 | SRB_ExecSCSICmd cmd;
|
---|
225 | SRB_Abort abort;
|
---|
226 | SRB_BusDeviceReset reset;
|
---|
227 | SRB_GDEVBlock devtype;
|
---|
228 | SRB_GetDiskInfo diskinfo;
|
---|
229 | } SRB, *PSRB, *LPSRB;
|
---|
230 |
|
---|
231 | typedef struct tagASPI32BUFF {
|
---|
232 | LPBYTE AB_BufPointer; /* pointer to buffer */
|
---|
233 | DWORD AB_BufLen; /* length of buffer */
|
---|
234 | DWORD AB_ZeroFill; /* set to 1 if zeroing */
|
---|
235 | DWORD AB_Reserved; /* 0 */
|
---|
236 | } ASPI32BUFF, *PASPI32BUFF;
|
---|
237 |
|
---|
238 | #include <poppack.h>
|
---|
239 |
|
---|
240 | /* Prototypes */
|
---|
241 | extern DWORD __cdecl SendASPI32Command (PSRB);
|
---|
242 | extern DWORD __cdecl GetASPI32SupportInfo (void);
|
---|
243 | extern DWORD __cdecl GetASPI32DLLVersion(void);
|
---|
244 | extern BOOL __cdecl GetASPI32Buffer(PASPI32BUFF pab);
|
---|
245 |
|
---|
246 | #ifdef __cplusplus
|
---|
247 | }
|
---|
248 | #endif /* #ifdef __cplusplus */
|
---|
249 |
|
---|
250 | #endif /* __WNASPI32_H__ */
|
---|