patch-2.4.15 linux/drivers/scsi/3w-xxxx.h

Next file: linux/drivers/scsi/Config.in
Previous file: linux/drivers/scsi/3w-xxxx.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.14/linux/drivers/scsi/3w-xxxx.h linux/drivers/scsi/3w-xxxx.h
@@ -4,6 +4,7 @@
    Written By: Adam Radford <linux@3ware.com>
    Modifications By: Joel Jacobson <linux@3ware.com>
    		     Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+                     Brad Strand <linux@3ware.com>
 
    Copyright (C) 1999-2001 3ware Inc.
 
@@ -57,6 +58,43 @@
 #include <linux/types.h>
 #include <linux/kdev_t.h>
 
+/* AEN strings */
+static char *tw_aen_string[] = {
+	"AEN queue empty",                      // 0x000
+	"Soft reset occurred",                  // 0x001
+	"Mirorr degraded: Unit #",              // 0x002
+	"Controller error",                     // 0x003 
+	"Rebuild failed: Unit #",               // 0x004
+	"Rebuild complete: Unit #",             // 0x005
+	"Incomplete unit detected: Unit #",     // 0x006
+	"Initialization complete: Unit #",      // 0x007
+	"Unclean shutdown detected: Unit #",    // 0x008
+	"ATA port timeout: Port #",             // 0x009
+	"Drive error: Port #",                  // 0x00A
+	"Rebuild started: Unit #",              // 0x00B 
+	"Initialization started: Unit #",       // 0x00C
+	"Logical unit deleted: Unit #",         // 0x00D
+	NULL,                                   // 0x00E unused
+	"SMART threshold exceeded: Port #",     // 0x00F
+	NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL,                             // 0x010-0x020 unused
+	"ATA UDMA downgrade: Port #",           // 0x021
+	"ATA UDMA upgrade: Port #",             // 0x022
+	"Sector repair occurred: Port #",       // 0x023
+	"SBUF integrity check failure",         // 0x024
+	"Lost cached write: Port #",            // 0x025
+	"Drive ECC error detected: Port #",     // 0x026
+	"DCB checksum error: Port #",           // 0x027
+	"DCB unsupported version: Port #",      // 0x028
+	"Verify started: Unit #",               // 0x029
+	"Verify failed: Port #",                // 0x02A
+	"Verify complete: Unit #"               // 0x02B
+};
+
+#define TW_AEN_STRING_MAX                      0x02C
+
 /* Control register bit definitions */
 #define TW_CONTROL_CLEAR_HOST_INTERRUPT	       0x00080000
 #define TW_CONTROL_CLEAR_ATTENTION_INTERRUPT   0x00040000
@@ -114,6 +152,7 @@
 #define TW_OP_SECTOR_INFO     0x1a
 #define TW_OP_AEN_LISTEN      0x1c
 #define TW_CMD_PACKET         0x1d
+#define TW_ATA_PASSTHRU       0x1e
 
 /* Asynchronous Event Notification (AEN) Codes */
 #define TW_AEN_QUEUE_EMPTY       0x0000
@@ -137,7 +176,10 @@
 #define TW_INIT_COMMAND_PACKET_SIZE	      0x3
 #define TW_POLL_MAX_RETRIES        	      20000
 #define TW_MAX_SGL_LENGTH		      62
-#define TW_Q_LENGTH			      16
+#define TW_ATA_PASS_SGL_MAX                   60
+#define TW_MAX_PASSTHRU_BYTES                 4096
+#define TW_Q_LENGTH			      256
+#define TW_MAX_BOUNCEBUF                      16
 #define TW_Q_START			      0
 #define TW_MAX_SLOT			      32
 #define TW_MAX_PCI_BUSES		      255
@@ -225,6 +267,7 @@
 	unsigned short table_id;
 	unsigned char parameter_id;
 	unsigned char parameter_size_bytes;
+	unsigned char unit_index;
 	unsigned char data[1];
 } TW_Ioctl;
 
@@ -261,14 +304,42 @@
 	int position;
 } TW_Info;
 
-typedef enum TAG_TW_Cmd_State {
-	TW_S_INITIAL,		/* Initial state */
-	TW_S_STARTED,		/* Id in use */
-	TW_S_POSTED,		/* Posted to the controller */
-	TW_S_PENDING,		/* Waiting to be posted in isr */
-	TW_S_COMPLETED,		/* Completed by isr */
-	TW_S_FINISHED,		/* I/O completely done */
-} TW_Cmd_State;
+typedef int TW_Cmd_State;
+
+#define TW_S_INITIAL   0x1  /* Initial state */
+#define TW_S_STARTED   0x2  /* Id in use */
+#define TW_S_POSTED    0x4  /* Posted to the controller */
+#define TW_S_PENDING   0x8  /* Waiting to be posted in isr */
+#define TW_S_COMPLETED 0x10 /* Completed by isr */
+#define TW_S_FINISHED  0x20 /* I/O completely done */
+#define TW_START_MASK (TW_S_STARTED | TW_S_POSTED | TW_S_PENDING | TW_S_COMPLETED)
+
+/* Command header for ATA pass-thru */
+typedef struct TAG_TW_Passthru
+{
+	struct {
+		unsigned char opcode:5;
+		unsigned char sgloff:3;
+	} byte0;
+	unsigned char size;
+	unsigned char request_id;
+	struct {
+		unsigned char aport:4;
+		unsigned char host_id:4;
+	} byte3;
+	unsigned char status;
+	unsigned char flags;
+	unsigned short param;
+	unsigned short features;
+	unsigned short sector_count;
+	unsigned short sector_num;
+	unsigned short cylinder_lo;
+	unsigned short cylinder_hi;
+	unsigned char drive_head;
+	unsigned char command;
+	TW_SG_Entry sg_list[TW_ATA_PASS_SGL_MAX];
+	unsigned char padding[12];
+} TW_Passthru;
 
 typedef struct TAG_TW_Device_Extension {
 	TW_Registers		registers;
@@ -286,6 +357,7 @@
 	unsigned char		free_queue[TW_Q_LENGTH];
 	unsigned char		free_head;
 	unsigned char		free_tail;
+	unsigned char           free_wrap;
 	unsigned char		pending_queue[TW_Q_LENGTH];
 	unsigned char		pending_head;
 	unsigned char		pending_tail;
@@ -304,7 +376,7 @@
 	u32			aen_count;
 	struct Scsi_Host	*host;
 	spinlock_t		tw_lock;
-	unsigned char		ioctl_size[TW_Q_LENGTH];
+	int		        ioctl_size[TW_Q_LENGTH];
 	unsigned short		aen_queue[TW_Q_LENGTH];
 	unsigned char		aen_head;
 	unsigned char		aen_tail;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)