- Slightly reworked include files (less messy, more straightforward).
- Moved DOS ASPI functionality to msdos/dosaspi.c.
- Got rid using PROFILE to get SCSI info from wine.conf.
- Read scsi info from /proc/scsi/scsi.
- Added setting of a reasonable timeout when opening a SCSI device (5
minutes, defined in winescsi.h).
- ExecScsiCommand now ALWAYS posts, even on error (which is the correct
behavior).
diff --git a/include/aspi.h b/include/aspi.h
index 8a005e8..2e7cd22 100644
--- a/include/aspi.h
+++ b/include/aspi.h
@@ -1,4 +1,4 @@
-/* ASPI definitions used for both WNASPI16 and WNASPI32 */
+/* ASPI definitions used for both WINASPI and WNASPI32 */
#ifndef __WINE_ASPI_H
#define __WINE_ASPI_H
@@ -6,33 +6,75 @@
#include "windef.h"
#include "pshpack1.h"
-
-#define SS_PENDING 0x00
-#define SS_COMP 0x01
-#define SS_ABORTED 0x02
-#define SS_ERR 0x04
-#define SS_INVALID_HA 0x81
-#define SS_INVALID_SRB 0xe0
-#define SS_OLD_MANAGE 0xe1
-#define SS_ILLEGAL_MODE 0xe2
-#define SS_NO_ASPI 0xe3
-#define SS_FAILED_INIT 0xe4
-#define SS_ASPI_IS_BUSY 0xe5
-#define SS_BUFFER_TO_BIG 0xe6
-
-#define SC_HA_INQUIRY 0x00
-#define SC_GET_DEV_TYPE 0x01
-#define SC_EXEC_SCSI_CMD 0x02
-#define SC_ABORT_SRB 0x03
-#define SC_RESET_DEV 0x04
+#ifdef __cplusplus
+extern "C" {
+#endif /* #ifdef __cplusplus */
-/* Host adapter status codes */
-#define HASTAT_OK 0x00
-#define HASTAT_SEL_TO 0x11
-#define HASTAT_DO_DU 0x12
-#define HASTAT_BUS_FREE 0x13
-#define HASTAT_PHASE_ERR 0x14
+/* Stuff in BOTH spec */
+
+/* SCSI Miscellaneous Stuff */
+#define SENSE_LEN 14
+#define SRB_DIR_SCSI 0x00
+#define SRB_POSTING 0x01
+#define SRB_ENABLE_RESIDUAL_COUNT 0x04
+#define SRB_DIR_IN 0x08
+#define SRB_DIR_OUT 0x10
+
+/* ASPI Command Definitions */
+#define SC_HA_INQUIRY 0x00
+#define SC_GET_DEV_TYPE 0x01
+#define SC_EXEC_SCSI_CMD 0x02
+#define SC_ABORT_SRB 0x03
+#define SC_RESET_DEV 0x04
+#define SC_SET_HA_PARMS 0x05
+#define SC_GET_DISK_INFO 0x06
+
+/* SRB status codes */
+#define SS_PENDING 0x00
+#define SS_COMP 0x01
+#define SS_ABORTED 0x02
+#define SS_ABORT_FAIL 0x03
+#define SS_ERR 0x04
+
+#define SS_INVALID_CMD 0x80
+#define SS_INVALID_HA 0x81
+#define SS_NO_DEVICE 0x82
+
+#define SS_INVALID_SRB 0xE0
+#define SS_OLD_MANAGER 0xE1
+#define SS_BUFFER_ALIGN 0xE1 // Win32
+#define SS_ILLEGAL_MODE 0xE2
+#define SS_NO_ASPI 0xE3
+#define SS_FAILED_INIT 0xE4
+#define SS_ASPI_IS_BUSY 0xE5
+#define SS_BUFFER_TO_BIG 0xE6
+#define SS_MISMATCHED_COMPONENTS 0xE7 // DLLs/EXE version mismatch
+#define SS_NO_ADAPTERS 0xE8
+#define SS_INSUFFICIENT_RESOURCES 0xE9
+#define SS_ASPI_IS_SHUTDOWN 0xEA
+#define SS_BAD_INSTALL 0xEB
+
+
+/* Host status codes */
+#define HASTAT_OK 0x00
+#define HASTAT_SEL_TO 0x11
+#define HASTAT_DO_DU 0x12
+#define HASTAT_BUS_FREE 0x13
+#define HASTAT_PHASE_ERR 0x14
+
+#define HASTAT_TIMEOUT 0x09
+#define HASTAT_COMMAND_TIMEOUT 0x0B
+#define HASTAT_MESSAGE_REJECT 0x0D
+#define HASTAT_BUS_RESET 0x0E
+#define HASTAT_PARITY_ERROR 0x0F
+#define HASTAT_REQUEST_SENSE_FAILED 0x10
+
+
+
+
+
+/*********** OLD ****************/
/* Target status codes */
#define STATUS_GOOD 0x00
@@ -40,42 +82,13 @@
#define STATUS_BUSY 0x08
#define STATUS_RESCONF 0x18
-#ifdef linux
-
-/* This is a duplicate of the sg_header from /usr/src/linux/include/scsi/sg.h
- * kernel 2.0.30
- * This will probably break at some point, but for those who don't have
- * kernels installed, I think this should still work.
- *
- */
-
-struct sg_header
- {
- int pack_len; /* length of incoming packet <4096 (including header) */
- int reply_len; /* maximum length <4096 of expected reply */
- int pack_id; /* id number of packet */
- int result; /* 0==ok, otherwise refer to errno codes */
- unsigned int twelve_byte:1; /* Force 12 byte command length for group 6 & 7
-commands */
- unsigned int target_status:5; /* [o] scsi status from target */
- unsigned int host_status:8; /* [o] host status (see "DID" codes) */
- unsigned int driver_status:8; /* [o] driver status+suggestion */
- unsigned int other_flags:10; /* unused */
- unsigned char sense_buffer[16]; /* used only by reads */
- /* command follows then data for command */
- };
-
-#define SCSI_OFF sizeof(struct sg_header)
-#endif
-
#define ASPI_POSTING(prb) (prb->SRB_Flags & 0x1)
+/* WNASPI32/WINASPI defs */
#define HOST_TO_TARGET(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x2)
#define TARGET_TO_HOST(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x1)
#define NO_DATA_TRANSFERED(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x3)
-#define SRB_ENABLE_RESIDUAL_COUNT 0x4
-#define SRB_EVENT_NOTIFY 0x40 /* Enable ASPI event notification */
#define INQUIRY_VENDOR 8
@@ -107,18 +120,9 @@
#define SENSE_BUFFER(prb) (&prb->CDBByte[prb->SRB_CDBLen])
-
-/* Just a container for seeing what devices are open */
-struct ASPI_DEVICE_INFO {
- struct ASPI_DEVICE_INFO * next;
- int fd;
- int hostId;
- int target;
- int lun;
-};
-
-typedef struct ASPI_DEVICE_INFO ASPI_DEVICE_INFO;
-
+#ifdef __cplusplus
+}
+#endif /* #ifdef __cplusplus */
#include "poppack.h"
#endif