[PATCH] chardev: GPIO for SCx200 & PC-8736x: add 'v' command to device-file
[safe/jmp/linux-2.6] / drivers / scsi / aacraid / aacraid.h
index ddbbb85..d0eecd4 100644 (file)
@@ -1,11 +1,19 @@
 #if (!defined(dprintk))
 # define dprintk(x)
 #endif
+/* eg: if (nblank(dprintk(x))) */
+#define _nblank(x) #x
+#define nblank(x) _nblank(x)[0]
+
 
 /*------------------------------------------------------------------------------
  *              D E F I N E S
  *----------------------------------------------------------------------------*/
 
+#ifndef AAC_DRIVER_BUILD
+# define AAC_DRIVER_BUILD 2409
+# define AAC_DRIVER_BRANCH "-mh2"
+#endif
 #define MAXIMUM_NUM_CONTAINERS 32
 
 #define AAC_NUM_MGT_FIB         8
 #define AAC_MAX_LUN            (8)
 
 #define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff)
-/*
- *  max_sectors is an unsigned short, otherwise limit is 0x100000000 / 512
- * Linux has starvation problems if we permit larger than 4MB I/O ...
- */
-#define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)8192)
+#define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)256)
 
 /*
  * These macros convert from physical channels to virtual channels
  */
 #define CONTAINER_CHANNEL              (0)
-#define ID_LUN_TO_CONTAINER(id, lun)   (id)
 #define CONTAINER_TO_CHANNEL(cont)     (CONTAINER_CHANNEL)
 #define CONTAINER_TO_ID(cont)          (cont)
 #define CONTAINER_TO_LUN(cont)         (0)
@@ -114,6 +117,22 @@ struct user_sgentry64 {
        u32     count;  /* Length. */
 };
 
+struct sgentryraw {
+       __le32          next;   /* reserved for F/W use */
+       __le32          prev;   /* reserved for F/W use */
+       __le32          addr[2];
+       __le32          count;
+       __le32          flags;  /* reserved for F/W use */
+};
+
+struct user_sgentryraw {
+       u32             next;   /* reserved for F/W use */
+       u32             prev;   /* reserved for F/W use */
+       u32             addr[2];
+       u32             count;
+       u32             flags;  /* reserved for F/W use */
+};
+
 /*
  *     SGMAP
  *
@@ -141,6 +160,16 @@ struct user_sgmap64 {
        struct user_sgentry64 sg[1];
 };
 
+struct sgmapraw {
+       __le32            count;
+       struct sgentryraw sg[1];
+};
+
+struct user_sgmapraw {
+       u32               count;
+       struct user_sgentryraw sg[1];
+};
+
 struct creation_info
 {
        u8              buildnum;               /* e.g., 588 */
@@ -280,7 +309,6 @@ enum aac_queue_types {
  */
 
 #define                FsaNormal       1
-#define                FsaHigh         2
 
 /*
  * Define the FIB. The FIB is the where all the requested data and
@@ -355,6 +383,7 @@ struct hw_fib {
  */
 #define                ContainerCommand                500
 #define                ContainerCommand64              501
+#define                ContainerRawIo                  502
 /*
  *     Cluster Commands
  */
@@ -455,13 +484,16 @@ enum aac_log_level {
 #define FSAFS_NTC_FIB_CONTEXT                  0x030c
 
 struct aac_dev;
+struct fib;
 
 struct adapter_ops
 {
        void (*adapter_interrupt)(struct aac_dev *dev);
        void (*adapter_notify)(struct aac_dev *dev, u32 event);
+       void (*adapter_disable_int)(struct aac_dev *dev);
        int  (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 *r4);
        int  (*adapter_check_health)(struct aac_dev *dev);
+       int  (*adapter_send)(struct fib * fib);
 };
 
 /*
@@ -503,6 +535,13 @@ struct aac_driver_ident
 #define AAC_QUIRK_MASTER 0x0008
 
 /*
+ * Some adapter firmware perform poorly when it must split up scatter gathers
+ * in order to deal with the limits of the underlying CHIM. This limit in this
+ * class of adapters is 17 scatter gather elements.
+ */
+#define AAC_QUIRK_17SG 0x0010
+
+/*
  *     The adapter interface specs all queues to be located in the same
  *     physically contigous block. The host structure that defines the
  *     commuication queues will assume they are each a separate physically
@@ -522,11 +561,8 @@ struct aac_queue {
                   /* This is only valid for adapter to host command queues. */ 
        spinlock_t              *lock;          /* Spinlock for this queue must take this lock before accessing the lock */
        spinlock_t              lockdata;       /* Actual lock (used only on one side of the lock) */
-       unsigned long           SavedIrql;      /* Previous IRQL when the spin lock is taken */
-       u32                     padding;        /* Padding - FIXME - can remove I believe */
        struct list_head        cmdq;           /* A queue of FIBs which need to be prcessed by the FS thread. This is */
                                                /* only valid for command queues which receive entries from the adapter. */
-       struct list_head        pendingq;       /* A queue of outstanding fib's to the adapter. */
        u32                     numpending;     /* Number of entries on outstanding queue. */
        struct aac_dev *        dev;            /* Back pointer to adapter structure */
 };
@@ -634,6 +670,10 @@ struct rx_mu_registers {
                                                Status Register */
        __le32  OIMR;       /*  1334h  | 34h | Outbound Interrupt 
                                                Mask Register */
+       __le32  reserved2;  /*  1338h  | 38h | Reserved */
+       __le32  reserved3;  /*  133Ch  | 3Ch | Reserved */
+       __le32  InboundQueue;/* 1340h  | 40h | Inbound Queue Port relative to firmware */
+       __le32  OutboundQueue;/*1344h  | 44h | Outbound Queue Port relative to firmware */
                            /* * Must access through ATU Inbound 
                                 Translation Window */
 };
@@ -668,8 +708,8 @@ struct rx_inbound {
 #define OutboundDoorbellReg    MUnit.ODR
 
 struct rx_registers {
-       struct rx_mu_registers          MUnit;          /* 1300h - 1334h */
-       __le32                          reserved1[6];   /* 1338h - 134ch */
+       struct rx_mu_registers          MUnit;          /* 1300h - 1344h */
+       __le32                          reserved1[2];   /* 1348h - 134ch */
        struct rx_inbound               IndexRegs;
 };
 
@@ -686,8 +726,8 @@ struct rx_registers {
 #define rkt_inbound rx_inbound
 
 struct rkt_registers {
-       struct rkt_mu_registers         MUnit;           /* 1300h - 1334h */
-       __le32                          reserved1[1010]; /* 1338h - 22fch */
+       struct rkt_mu_registers         MUnit;           /* 1300h - 1344h */
+       __le32                          reserved1[1006]; /* 1348h - 22fch */
        struct rkt_inbound              IndexRegs;       /* 2300h - */
 };
 
@@ -696,8 +736,6 @@ struct rkt_registers {
 #define rkt_writeb(AEP, CSR, value)    writeb(value, &((AEP)->regs.rkt->CSR))
 #define rkt_writel(AEP, CSR, value)    writel(value, &((AEP)->regs.rkt->CSR))
 
-struct fib;
-
 typedef void (*fib_callback)(void *ctxt, struct fib *fibctx);
 
 struct aac_fib_context {
@@ -752,7 +790,10 @@ struct fsa_dev_info {
        u64             last;
        u64             size;
        u32             type;
+       u32             config_waiting_on;
+       unsigned long   config_waiting_stamp;
        u16             queue_depth;
+       u8              config_needed;
        u8              valid;
        u8              ro;
        u8              locked;
@@ -781,11 +822,6 @@ struct fib {
        void                    *callback_data;
        u32                     flags; // u32 dmb was ulong
        /*
-        *      The following is used to put this fib context onto the 
-        *      Outstanding I/O queue.
-        */
-       struct list_head        queue;
-       /*
         *      And for the internal issue/reply queues (we may be able
         *      to merge these two)
         */
@@ -910,7 +946,6 @@ struct aac_dev
        const char              *name;
        int                     id;
 
-       u16                     irq_mask;
        /*
         *      negotiated FIB settings
         */
@@ -945,6 +980,7 @@ struct aac_dev
        struct adapter_ops      a_ops;
        unsigned long           fsrev;          /* Main driver's revision number */
        
+       unsigned                base_size;      /* Size of mapped in region */
        struct aac_init         *init;          /* Holds initialization info to communicate with adapter */
        dma_addr_t              init_pa;        /* Holds physical address of the init struct */
        
@@ -959,12 +995,15 @@ struct aac_dev
        int                     maximum_num_physicals;
        int                     maximum_num_channels;
        struct fsa_dev_info     *fsa_dev;
-       pid_t                   thread_pid;
+       struct task_struct      *thread;
        int                     cardtype;
        
        /*
         *      The following is the device specific extension.
         */
+#if (!defined(AAC_MIN_FOOTPRINT_SIZE))
+#      define AAC_MIN_FOOTPRINT_SIZE 8192
+#endif
        union
        {
                struct sa_registers __iomem *sa;
@@ -976,7 +1015,6 @@ struct aac_dev
         *      AIF thread states
         */
        u32                     aif_thread;
-       struct completion       aif_completion;
        struct aac_adapter_info adapter_info;
        struct aac_supplement_adapter_info supplement_adapter_info;
        /* These are in adapter info but they are in the io flow so
@@ -985,6 +1023,11 @@ struct aac_dev
        u8                      nondasd_support; 
        u8                      dac_support;
        u8                      raid_scsi_mode;
+       u8                      new_comm_interface;
+       /* macro side-effects BEWARE */
+#      define                  raw_io_interface \
+         init->InitStructRevision==cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION_4)
+       u8                      raw_io_64;
        u8                      printf_enabled;
 };
 
@@ -994,12 +1037,17 @@ struct aac_dev
 #define aac_adapter_notify(dev, event) \
        (dev)->a_ops.adapter_notify(dev, event)
 
+#define aac_adapter_disable_int(dev) \
+       (dev)->a_ops.adapter_disable_int(dev)
+
 #define aac_adapter_sync_cmd(dev, command, p1, p2, p3, p4, p5, p6, status, r1, r2, r3, r4) \
        (dev)->a_ops.adapter_sync_cmd(dev, command, p1, p2, p3, p4, p5, p6, status, r1, r2, r3, r4)
 
 #define aac_adapter_check_health(dev) \
        (dev)->a_ops.adapter_check_health(dev)
 
+#define aac_adapter_send(fib) \
+       ((fib)->dev)->a_ops.adapter_send(fib)
 
 #define FIB_CONTEXT_FLAG_TIMED_OUT             (0x00000001)
 
@@ -1160,6 +1208,17 @@ struct aac_write_reply
        __le32          committed;
 };
 
+struct aac_raw_io
+{
+       __le32          block[2];
+       __le32          count;
+       __le16          cid;
+       __le16          flags;          /* 00 W, 01 R */
+       __le16          bpTotal;        /* reserved for F/W use */
+       __le16          bpComplete;     /* reserved for F/W use */
+       struct sgmapraw sg;
+};
+
 #define CT_FLUSH_CACHE 129
 struct aac_synchronize {
        __le32          command;        /* VM_ContainerConfig */
@@ -1200,7 +1259,7 @@ struct aac_srb
 };
 
 /*
- * This and assocated data structs are used by the 
+ * This and associated data structs are used by the
  * ioctl caller and are in cpu order.
  */
 struct user_aac_srb
@@ -1321,8 +1380,10 @@ struct aac_srb_reply
 #define                VM_CtBlockVerify64      18
 #define                VM_CtHostRead64         19
 #define                VM_CtHostWrite64        20
+#define                VM_DrvErrTblLog         21
+#define                VM_NameServe64          22
 
-#define                MAX_VMCOMMAND_NUM       21      /* used for sizing stats array - leave last */
+#define                MAX_VMCOMMAND_NUM       23      /* used for sizing stats array - leave last */
 
 /*
  *     Descriptive information (eg, vital stats)
@@ -1431,6 +1492,7 @@ struct aac_mntent {
                                                   manager (eg, filesystem) */
        __le32                  altoid;         /* != oid <==> snapshot or 
                                                   broken mirror exists */
+       __le32                  capacityhigh;
 };
 
 #define FSCS_NOTCLEAN  0x0001  /* fsck is neccessary before mounting */
@@ -1512,7 +1574,7 @@ struct fib_ioctl
 
 struct revision
 {
-       __le32 compat;
+       u32 compat;
        __le32 version;
        __le32 build;
 };
@@ -1666,6 +1728,7 @@ extern struct aac_common aac_config;
 #define                AifCmdJobProgress       2       /* Progress report */
 #define                        AifJobCtrZero   101     /* Array Zero progress */
 #define                        AifJobStsSuccess 1      /* Job completes */
+#define                        AifJobStsRunning 102    /* Job running */
 #define                AifCmdAPIReport         3       /* Report from other user of API */
 #define                AifCmdDriverNotify      4       /* Notify host driver of event */
 #define                        AifDenMorphComplete 200 /* A morph operation completed */
@@ -1706,18 +1769,23 @@ static inline u32 cap_to_cyls(sector_t capacity, u32 divisor)
 }
 
 struct scsi_cmnd;
+/* SCp.phase values */
+#define AAC_OWNER_MIDLEVEL     0x101
+#define AAC_OWNER_LOWLEVEL     0x102
+#define AAC_OWNER_ERROR_HANDLER        0x103
+#define AAC_OWNER_FIRMWARE     0x106
 
 const char *aac_driverinfo(struct Scsi_Host *);
-struct fib *fib_alloc(struct aac_dev *dev);
-int fib_setup(struct aac_dev *dev);
-void fib_map_free(struct aac_dev *dev);
-void fib_free(struct fib * context);
-void fib_init(struct fib * context);
+struct fib *aac_fib_alloc(struct aac_dev *dev);
+int aac_fib_setup(struct aac_dev *dev);
+void aac_fib_map_free(struct aac_dev *dev);
+void aac_fib_free(struct fib * context);
+void aac_fib_init(struct fib * context);
 void aac_printf(struct aac_dev *dev, u32 val);
-int fib_send(u16 command, struct fib * context, unsigned long size, int priority, int wait, int reply, fib_callback callback, void *ctxt);
+int aac_fib_send(u16 command, struct fib * context, unsigned long size, int priority, int wait, int reply, fib_callback callback, void *ctxt);
 int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry);
 void aac_consumer_free(struct aac_dev * dev, struct aac_queue * q, u32 qnum);
-int fib_complete(struct fib * context);
+int aac_fib_complete(struct fib * context);
 #define fib_data(fibctx) ((void *)(fibctx)->hw_fib->data)
 struct aac_dev *aac_init_adapter(struct aac_dev *dev);
 int aac_get_config_status(struct aac_dev *dev);
@@ -1730,12 +1798,16 @@ int aac_rkt_init(struct aac_dev *dev);
 int aac_sa_init(struct aac_dev *dev);
 unsigned int aac_response_normal(struct aac_queue * q);
 unsigned int aac_command_normal(struct aac_queue * q);
-int aac_command_thread(struct aac_dev * dev);
+unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index);
+int aac_command_thread(void *data);
 int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context *fibctx);
-int fib_adapter_complete(struct fib * fibptr, unsigned short size);
+int aac_fib_adapter_complete(struct fib * fibptr, unsigned short size);
 struct aac_driver_ident* aac_get_driver_ident(int devtype);
 int aac_get_adapter_info(struct aac_dev* dev);
 int aac_send_shutdown(struct aac_dev *dev);
+int aac_probe_container(struct aac_dev *dev, int cid);
 extern int numacb;
 extern int acbsize;
 extern char aac_driver_version[];
+extern int startup_timeout;
+extern int aif_timeout;