[PATCH] pcmcia: conf.ConfigBase and conf.Present consolidation
[pandora-kernel.git] / drivers / scsi / ipr.h
index 1ad24df..6d03528 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <linux/types.h>
 #include <linux/completion.h>
+#include <linux/libata.h>
 #include <linux/list.h>
 #include <linux/kref.h>
 #include <scsi/scsi.h>
@@ -36,8 +37,8 @@
 /*
  * Literals
  */
-#define IPR_DRIVER_VERSION "2.1.3"
-#define IPR_DRIVER_DATE "(March 29, 2006)"
+#define IPR_DRIVER_VERSION "2.2.0"
+#define IPR_DRIVER_DATE "(September 25, 2006)"
 
 /*
  * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding
@@ -45,6 +46,7 @@
  *     This can be adjusted at runtime through sysfs device attributes.
  */
 #define IPR_MAX_CMD_PER_LUN                            6
+#define IPR_MAX_CMD_PER_ATA_LUN                        1
 
 /*
  * IPR_NUM_BASE_CMD_BLKS: This defines the maximum number of
 #define IPR_IOA_BUS                                            0xff
 #define IPR_IOA_TARGET                                 0xff
 #define IPR_IOA_LUN                                            0xff
-#define IPR_MAX_NUM_BUSES                              8
+#define IPR_MAX_NUM_BUSES                              16
 #define IPR_MAX_BUS_TO_SCAN                            IPR_MAX_NUM_BUSES
 
 #define IPR_NUM_RESET_RELOAD_RETRIES           3
 #define        IPR_LUN_RESET                                   0x40
 #define        IPR_TARGET_RESET                                        0x20
 #define        IPR_BUS_RESET                                   0x10
+#define        IPR_ATA_PHY_RESET                                       0x80
 #define IPR_ID_HOST_RR_Q                               0xC4
 #define IPR_QUERY_IOA_CONFIG                           0xC5
 #define IPR_CANCEL_ALL_REQUESTS                        0xCE
@@ -295,7 +298,11 @@ struct ipr_std_inq_data {
 }__attribute__ ((packed));
 
 struct ipr_config_table_entry {
-       u8 service_level;
+       u8 proto;
+#define IPR_PROTO_SATA                 0x02
+#define IPR_PROTO_SATA_ATAPI           0x03
+#define IPR_PROTO_SAS_STP              0x06
+#define IPR_PROTO_SAS_STP_ATAPI        0x07
        u8 array_id;
        u8 flags;
 #define IPR_IS_IOA_RESOURCE    0x80
@@ -307,6 +314,7 @@ struct ipr_config_table_entry {
 #define IPR_SUBTYPE_AF_DASD                    0
 #define IPR_SUBTYPE_GENERIC_SCSI       1
 #define IPR_SUBTYPE_VOLUME_SET         2
+#define IPR_SUBTYPE_GENERIC_ATA        4
 
 #define IPR_QUEUEING_MODEL(res)        ((((res)->cfgte.flags) & 0x70) >> 4)
 #define IPR_QUEUE_FROZEN_MODEL 0
@@ -350,6 +358,7 @@ struct ipr_cmd_pkt {
 #define IPR_RQTYPE_SCSICDB             0x00
 #define IPR_RQTYPE_IOACMD              0x01
 #define IPR_RQTYPE_HCAM                        0x02
+#define IPR_RQTYPE_ATA_PASSTHRU        0x04
 
        u8 luntar_luntrn;
 
@@ -373,6 +382,37 @@ struct ipr_cmd_pkt {
        __be16 timeout;
 }__attribute__ ((packed, aligned(4)));
 
+struct ipr_ioarcb_ata_regs {
+       u8 flags;
+#define IPR_ATA_FLAG_PACKET_CMD                        0x80
+#define IPR_ATA_FLAG_XFER_TYPE_DMA                     0x40
+#define IPR_ATA_FLAG_STATUS_ON_GOOD_COMPLETION 0x20
+       u8 reserved[3];
+
+       __be16 data;
+       u8 feature;
+       u8 nsect;
+       u8 lbal;
+       u8 lbam;
+       u8 lbah;
+       u8 device;
+       u8 command;
+       u8 reserved2[3];
+       u8 hob_feature;
+       u8 hob_nsect;
+       u8 hob_lbal;
+       u8 hob_lbam;
+       u8 hob_lbah;
+       u8 ctl;
+}__attribute__ ((packed, aligned(4)));
+
+struct ipr_ioarcb_add_data {
+       union {
+               struct ipr_ioarcb_ata_regs regs;
+               __be32 add_cmd_parms[10];
+       }u;
+}__attribute__ ((packed, aligned(4)));
+
 /* IOA Request Control Block    128 bytes  */
 struct ipr_ioarcb {
        __be32 ioarcb_host_pci_addr;
@@ -397,7 +437,7 @@ struct ipr_ioarcb {
        struct ipr_cmd_pkt cmd_pkt;
 
        __be32 add_cmd_parms_len;
-       __be32 add_cmd_parms[10];
+       struct ipr_ioarcb_add_data add_data;
 }__attribute__((packed, aligned (4)));
 
 struct ipr_ioadl_desc {
@@ -433,6 +473,21 @@ struct ipr_ioasa_gpdd {
        __be32 ioa_data[2];
 }__attribute__((packed, aligned (4)));
 
+struct ipr_ioasa_gata {
+       u8 error;
+       u8 nsect;               /* Interrupt reason */
+       u8 lbal;
+       u8 lbam;
+       u8 lbah;
+       u8 device;
+       u8 status;
+       u8 alt_status;  /* ATA CTL */
+       u8 hob_nsect;
+       u8 hob_lbal;
+       u8 hob_lbam;
+       u8 hob_lbah;
+}__attribute__((packed, aligned (4)));
+
 struct ipr_auto_sense {
        __be16 auto_sense_len;
        __be16 ioa_data_len;
@@ -466,6 +521,7 @@ struct ipr_ioasa {
        __be32 ioasc_specific;  /* status code specific field */
 #define IPR_ADDITIONAL_STATUS_FMT              0x80000000
 #define IPR_AUTOSENSE_VALID                    0x40000000
+#define IPR_ATA_DEVICE_WAS_RESET               0x20000000
 #define IPR_IOASC_SPECIFIC_MASK                0x00ffffff
 #define IPR_FIELD_POINTER_VALID                (0x80000000 >> 8)
 #define IPR_FIELD_POINTER_MASK         0x0000ffff
@@ -474,6 +530,7 @@ struct ipr_ioasa {
                struct ipr_ioasa_vset vset;
                struct ipr_ioasa_af_dasd dasd;
                struct ipr_ioasa_gpdd gpdd;
+               struct ipr_ioasa_gata gata;
        } u;
 
        struct ipr_auto_sense auto_sense;
@@ -793,6 +850,13 @@ struct ipr_bus_attributes {
        u32 max_xfer_rate;
 };
 
+struct ipr_sata_port {
+       struct ipr_ioa_cfg *ioa_cfg;
+       struct ata_port *ap;
+       struct ipr_resource_entry *res;
+       struct ipr_ioasa_gata ioasa;
+};
+
 struct ipr_resource_entry {
        struct ipr_config_table_entry cfgte;
        u8 needs_sync_complete:1;
@@ -802,6 +866,7 @@ struct ipr_resource_entry {
        u8 resetting_device:1;
 
        struct scsi_device *sdev;
+       struct ipr_sata_port *sata_port;
        struct list_head queue;
 };
 
@@ -872,10 +937,11 @@ struct ipr_trace_entry {
        u32 time;
 
        u8 op_code;
+       u8 ata_op_code;
        u8 type;
 #define IPR_TRACE_START                        0x00
 #define IPR_TRACE_FINISH               0xff
-       u16 cmd_index;
+       u8 cmd_index;
 
        __be32 res_handle;
        union {
@@ -1017,6 +1083,7 @@ struct ipr_ioa_cfg {
 
        struct ipr_cmnd *reset_cmd;
 
+       struct ata_host ata_host;
        char ipr_cmd_label[8];
 #define IPR_CMD_LABEL          "ipr_cmnd"
        struct ipr_cmnd *ipr_cmnd_list[IPR_NUM_CMD_BLKS];
@@ -1029,6 +1096,7 @@ struct ipr_cmnd {
        struct ipr_ioadl_desc ioadl[IPR_NUM_IOADL_ENTRIES];
        struct list_head queue;
        struct scsi_cmnd *scsi_cmd;
+       struct ata_queued_cmd *qc;
        struct completion completion;
        struct timer_list timer;
        void (*done) (struct ipr_cmnd *);
@@ -1307,6 +1375,22 @@ static inline int ipr_is_scsi_disk(struct ipr_resource_entry *res)
                return 0;
 }
 
+/**
+ * ipr_is_gata - Determine if a resource is a generic ATA resource
+ * @res:       resource entry struct
+ *
+ * Return value:
+ *     1 if GATA / 0 if not GATA
+ **/
+static inline int ipr_is_gata(struct ipr_resource_entry *res)
+{
+       if (!ipr_is_ioa_resource(res) &&
+           IPR_RES_SUBTYPE(res) == IPR_SUBTYPE_GENERIC_ATA)
+               return 1;
+       else
+               return 0;
+}
+
 /**
  * ipr_is_naca_model - Determine if a resource is using NACA queueing model
  * @res:       resource entry struct