1
#ifndef __ASPI_WIN32_H_
2
#define __ASPI_WIN32_H_
6
/***************************************************************************
7
** SCSI MISCELLANEOUS EQUATES
8
***************************************************************************/
9
#define SENSE_LEN 14 /* Default sense buffer length */
10
#define SRB_DIR_SCSI 0x00 /* Direction determined by SCSI */
11
#define SRB_POSTING 0x01 /* Enable ASPI posting */
12
#define SRB_ENABLE_RESIDUAL_COUNT 0x04 /* Enable residual byte count */
14
#define SRB_DIR_IN 0x08 /* Transfer from SCSI target to */
16
#define SRB_DIR_OUT 0x10 /* Transfer from host to SCSI */
18
#define SRB_EVENT_NOTIFY 0x40 /* Enable ASPI event notification */
19
#define RESIDUAL_COUNT_SUPPORTED 0x02 /* Extended buffer flag */
20
#define MAX_SRB_TIMEOUT 1080001u /* 30 hour maximum timeout in sec */
21
#define DEFAULT_SRB_TIMEOUT 1080001u /* use max.timeout by default */
23
/***************************************************************************
24
** ASPI command definitions
25
***************************************************************************/
26
#define SC_HA_INQUIRY 0x00 /* Host adapter inquiry */
27
#define SC_GET_DEV_TYPE 0x01 /* Get device type */
28
#define SC_EXEC_SCSI_CMD 0x02 /* Execute SCSI command */
29
#define SC_ABORT_SRB 0x03 /* Abort an SRB */
30
#define SC_RESET_DEV 0x04 /* SCSI bus device reset */
31
#define SC_SET_HA_PARMS 0x05 /* Set HA parameters */
32
#define SC_GET_DISK_INFO 0x06 /* Get Disk */
33
#define SC_RESCAN_SCSI_BUS 0x07 /* Rebuild SCSI device map */
34
#define SC_GETSET_TIMEOUTS 0x08 /* Get/Set target timeouts */
37
/***************************************************************************
39
***************************************************************************/
40
#define SS_PENDING 0x00 /* SRB being processed */
41
#define SS_COMP 0x01 /* SRB completed without error */
42
#define SS_ABORTED 0x02 /* SRB aborted */
43
#define SS_ABORT_FAIL 0x03 /* Unable to abort SRB */
44
#define SS_ERR 0x04 /* SRB completed with error */
45
#define SS_INVALID_CMD 0x80 /* Invalid ASPI command */
46
#define SS_INVALID_HA 0x81 /* Invalid host adapter number */
47
#define SS_NO_DEVICE 0x82 /* SCSI device not installed */
48
#define SS_INVALID_SRB 0xE0 /* Invalid parameter set in SRB */
49
#define SS_OLD_MANAGER 0xE1 /* ASPI manager doesn't support */
51
#define SS_BUFFER_ALIGN 0xE1 /* Buffer not aligned (replaces */
52
/* SS_OLD_MANAGER in Win32) */
53
#define SS_ILLEGAL_MODE 0xE2 /* Unsupported Windows mode */
54
#define SS_NO_ASPI 0xE3 /* No ASPI managers */
55
#define SS_FAILED_INIT 0xE4 /* ASPI for windows failed init */
56
#define SS_ASPI_IS_BUSY 0xE5 /* No resources available to */
58
#define SS_BUFFER_TO_BIG 0xE6 /* Buffer size too big to handle */
59
#define SS_BUFFER_TOO_BIG 0xE6 /* Correct spelling of 'too' */
60
#define SS_MISMATCHED_COMPONENTS 0xE7 /* The DLLs/EXEs of ASPI don't */
62
#define SS_NO_ADAPTERS 0xE8 /* No host adapters to manager */
63
#define SS_INSUFFICIENT_RESOURCES 0xE9 /* Couldn't allocate resources */
65
#define SS_ASPI_IS_SHUTDOWN 0xEA /* Call came to ASPI after */
67
#define SS_BAD_INSTALL 0xEB /* The DLL or other components */
68
/* are installed wrong */
70
/***************************************************************************
71
** Host Adapter Status
72
***************************************************************************/
73
#define HASTAT_OK 0x00 /* No error detected by HA */
74
#define HASTAT_SEL_TO 0x11 /* Selection Timeout */
75
#define HASTAT_DO_DU 0x12 /* Data overrun/data underrun */
76
#define HASTAT_BUS_FREE 0x13 /* Unexpected bus free */
77
#define HASTAT_PHASE_ERR 0x14 /* Target bus phase sequence */
78
#define HASTAT_TIMEOUT 0x09 /* Timed out while SRB was */
79
/* waiting to be processed */
80
#define HASTAT_COMMAND_TIMEOUT 0x0B /* Adapter timed out while */
82
#define HASTAT_MESSAGE_REJECT 0x0D /* While processing the SRB, the */
83
/* adapter received a MESSAGE */
84
#define HASTAT_BUS_RESET 0x0E /* A bus reset was detected */
85
#define HASTAT_PARITY_ERROR 0x0F /* A parity error was detected */
86
#define HASTAT_REQUEST_SENSE_FAILED 0x10 /* The adapter failed in issuing */
89
/***************************************************************************
90
** SRB - HOST ADAPTER INQUIRIY - SC_HA_INQUIRY (0)
91
***************************************************************************/
93
BYTE SRB_Cmd; /* 00/000 ASPI command code == SC_HA_INQUIRY */
94
BYTE SRB_Status; /* 01/001 ASPI command status byte */
95
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
96
BYTE SRB_Flags; /* 03/003 ASPI request flags */
97
DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
98
BYTE HA_Count; /* 08/008 Number of host adapters present */
99
BYTE HA_SCSI_ID; /* 09/009 SCSI ID of host adapter */
100
BYTE HA_ManagerId[16]; /* 0a/010 String describing the manager */
101
BYTE HA_Identifier[16]; /* 1a/026 String describing the host adapter */
102
BYTE HA_Unique[16]; /* 2a/042 Host Adapter Unique parameters */
103
WORD HA_Rsvd1; /* 3a/058 Reserved, must = 0 */
104
} PACKED SRB_HAInquiry, *PSRB_HAInquiry, FAR *LPSRB_HAInquiry;
107
/***************************************************************************
108
** SRB - GET DEVICE TYPE - SC_GET_DEV_TYPE (1)
109
***************************************************************************/
112
BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_GET_DEV_TYPE */
113
BYTE SRB_Status; /* 01/001 ASPI command status byte */
114
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
115
BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */
116
DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
117
BYTE SRB_Target; /* 08/008 Target's SCSI ID */
118
BYTE SRB_Lun; /* 09/009 Target's LUN number */
119
BYTE SRB_DeviceType; /* 0a/010 Target's peripheral device type */
120
BYTE SRB_Rsvd1; /* 0b/011 Reserved, must = 0 */
121
} PACKED SRB_GDEVBlock, *PSRB_GDEVBlock, FAR *LPSRB_GDEVBlock;
124
/***************************************************************************
125
** SRB - EXECUTE SCSI COMMAND - SC_EXEC_SCSI_CMD (2)
126
***************************************************************************/
129
BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_EXEC_SCSI_CMD */
130
BYTE SRB_Status; /* 01/001 ASPI command status byte */
131
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
132
BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */
133
DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
134
BYTE SRB_Target; /* 08/008 Target's SCSI ID */
135
BYTE SRB_Lun; /* 09/009 Target's LUN */
136
WORD SRB_Rsvd1; /* 0a/010 Reserved for alignment */
137
DWORD SRB_BufLen; /* 0c/012 Data Allocation Length */
138
BYTE FAR *SRB_BufPointer; /* 10/016 Data Buffer Pointer */
139
BYTE SRB_SenseLen; /* 14/020 Sense Allocation Length */
140
BYTE SRB_CDBLen; /* 15/021 CDB Length */
141
BYTE SRB_HaStat; /* 16/022 Host Adapter Status */
142
BYTE SRB_TargStat; /* 17/023 Target Status */
143
VOID FAR *SRB_PostProc; /* 18/024 Post routine */
144
BYTE SRB_Rsvd2[20]; /* 1c/028 Reserved, must = 0 */
145
BYTE CDBByte[16]; /* 30/048 SCSI CDB */
146
BYTE SenseArea[SENSE_LEN+2]; /* 40/064 Request Sense buffer */
147
} PACKED SRB_ExecSCSICmd, *PSRB_ExecSCSICmd, FAR *LPSRB_ExecSCSICmd;
152
BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_ABORT_SRB */
153
BYTE SRB_Status; /* 01/001 ASPI command status byte */
154
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
155
BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */
156
DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */
157
void *SRB_ToAbort; /* 08/008 Pointer to SRB to abort */
158
} PACKED SRB_Abort, *PSRB_Abort, FAR *LPSRB_Abort;
161
/***************************************************************************
162
** SRB - BUS DEVICE RESET - SC_RESET_DEV (4)
163
***************************************************************************/
166
BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_RESET_DEV */
167
BYTE SRB_Status; /* 01/001 ASPI command status byte */
168
BYTE SRB_HaId; /* 02/002 ASPI host adapter number */
169
DWORD SRB_Flags; /* 04/004 Reserved */
170
BYTE SRB_Target; /* 08/008 Target's SCSI ID */
171
BYTE SRB_Lun; /* 09/009 Target's LUN number */
172
BYTE SRB_Rsvd1[12]; /* 0A/010 Reserved for alignment */
173
BYTE SRB_HaStat; /* 16/022 Host Adapter Status */
174
BYTE SRB_TargStat; /* 17/023 Target Status */
175
VOID FAR *SRB_PostProc; /* 18/024 Post routine */
176
BYTE SRB_Rsvd2[36]; /* 1C/028 Reserved, must = 0 */
177
} SRB_BusDeviceReset, *PSRB_BusDeviceReset, FAR *LPSRB_BusDeviceReset;
179
typedef struct tag_ASPI32BUFF
185
} PACKED ASPI32BUFF, *PASPI32BUFF, FAR *LPASPI32BUFF;
194
} SRB, *PSRB, FAR *LPSRB;