patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / drivers / scsi / aacraid / aacraid.h
index 8736443..e4164c3 100644 (file)
@@ -1,18 +1,20 @@
-//#define dprintk(x) printk x
-#define dprintk(x)
+#if (!defined(dprintk))
+# define dprintk(x)
+#endif
 
 /*------------------------------------------------------------------------------
  *              D E F I N E S
  *----------------------------------------------------------------------------*/
+
 #define MAXIMUM_NUM_CONTAINERS 31
 #define MAXIMUM_NUM_ADAPTERS   8
 
-#define AAC_NUM_FIB    578
+#define AAC_NUM_FIB            578
 //#define AAC_NUM_IO_FIB       512
-#define AAC_NUM_IO_FIB 100
+#define AAC_NUM_IO_FIB         100
 
-#define AAC_MAX_TARGET (MAXIMUM_NUM_CONTAINERS+1)
-#define AAC_MAX_LUN    (8)
+#define AAC_MAX_TARGET                 (MAXIMUM_NUM_CONTAINERS+1)
+#define AAC_MAX_LUN            (8)
 
 #define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff)
 
@@ -240,92 +242,6 @@ enum aac_queue_types {
         AdapHighRespQueue      /* Host to adapter high priority response traffic */
 };
 
-/*
- * Implement our own version of these so we have 64 bit compatability
- * The adapter uses these and can only handle 32 bit addresses
- */
-
-struct aac_list_head {
-       u32 next;
-       u32 prev;
-};
-
-#define AAC_INIT_LIST_HEAD(ptr) do { \
-       (ptr)->next = (u32)(ulong)(ptr); \
-       (ptr)->prev = (u32)(ulong)(ptr); \
-} while (0)
-/**
- * aac_list_empty - tests whether a list is empty
- * @head: the list to test.
- */
-static __inline__ int aac_list_empty(struct aac_list_head *head)
-{
-       return head->next == ((u32)(ulong)head);
-}
-
-/*
- * Insert a new entry between two known consecutive entries. 
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static __inline__ void aac_list_add(struct aac_list_head * n,
-       struct aac_list_head * prev,
-       struct aac_list_head * next)
-{
-       next->prev = (u32)(ulong)n;
-       n->next = (u32)(ulong)next;
-       n->prev = (u32)(ulong)prev;
-       prev->next = (u32)(ulong)n;
-}
-
-/**
- * list_add_tail - add a new entry
- * @new: new entry to be added
- * @head: list head to add it before
- *
- * Insert a new entry before the specified head.
- * This is useful for implementing queues.
- */
-static __inline__ void aac_list_add_tail(struct aac_list_head *n, struct aac_list_head *head)
-{
-       aac_list_add(n, (struct aac_list_head*)(ulong)(head->prev), head);
-}
-
-/*
- * Delete a list entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static __inline__ void __aac_list_del(struct aac_list_head * p,
-                                 struct aac_list_head * n)
-{
-       n->prev = (u32)(ulong)p;
-       p->next = (u32)(ulong)n;
-}
-
-/**
- * aac_list_del - deletes entry from list.
- * @entry: the element to delete from the list.
- * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
- */
-static __inline__ void aac_list_del(struct aac_list_head *entry)
-{
-       __aac_list_del((struct aac_list_head*)(ulong)entry->prev,(struct aac_list_head*)(ulong) entry->next);
-       entry->next = entry->prev = 0;
-}
-
-/**
- * aac_list_entry - get the struct for this entry
- * @ptr:       the &struct list_head pointer.
- * @type:      the type of the struct this is embedded in.
- * @member:    the name of the list_struct within the struct.
- */
-#define aac_list_entry(ptr, type, member) \
-       ((type *)((char *)(ptr)-(ulong)(&((type *)0)->member)))
-
 /*
  *     Assign type values to the FSA communication data structures
  */
@@ -339,11 +255,11 @@ static __inline__ void aac_list_del(struct aac_list_head *entry)
 #define                FsaNormal       1
 #define                FsaHigh         2
 
-
 /*
  * Define the FIB. The FIB is the where all the requested data and
  * command information are put to the application on the FSA adapter.
  */
+
 struct aac_fibhdr {
        u32 XferState;                  // Current transfer state for this CCB
        u16 Command;                    // Routing information for the destination
@@ -359,13 +275,9 @@ struct aac_fibhdr {
                    u32 _ReceiverTimeStart;     // Timestamp for receipt of fib
                    u32 _ReceiverTimeDone;      // Timestamp for completion of fib
                } _s;
-               struct aac_list_head _FibLinks; // Used to link Adapter Initiated Fibs on the host
-//             struct list_head _FibLinks;     // Used to link Adapter Initiated Fibs on the host
        } _u;
 };
 
-#define FibLinks                       _u._FibLinks
-
 #define FIB_DATA_SIZE_IN_BYTES (512 - sizeof(struct aac_fibhdr))
 
 
@@ -558,12 +470,11 @@ struct aac_queue {
        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 aac_list_head    cmdq;           /* A queue of FIBs which need to be prcessed by the FS thread. This is */
-//     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 */
+       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 */
 };
 
 /*
@@ -744,7 +655,7 @@ struct aac_fib_context {
        struct semaphore        wait_sem;       // this is used to wait for the next fib to arrive.
        int                     wait;           // Set to true when thread is in WaitForSingleObject
        unsigned long           count;          // total number of FIBs on FibList
-       struct aac_list_head    hw_fib_list;    // this holds hw_fibs which should be 32 bit addresses
+       struct list_head        fib_list;       // this holds fibs and their attachd hw_fibs
 };
 
 struct fsa_scsi_hba {
@@ -781,7 +692,11 @@ struct fib {
         *      Outstanding I/O queue.
         */
        struct list_head        queue;
-
+       /*
+        *      And for the internal issue/reply queues (we may be able
+        *      to merge these two)
+        */
+       struct list_head        fiblink;
        void                    *data;
        struct hw_fib           *hw_fib;                /* Actual shared object */
        dma_addr_t              hw_fib_pa;              /* physical address of hw_fib*/
@@ -836,19 +751,19 @@ struct aac_adapter_info
 /*
  * Supported Options
  */
-#define AAC_OPT_SNAPSHOT       cpu_to_le32(1)
-#define AAC_OPT_CLUSTERS       cpu_to_le32(1<<1)
-#define AAC_OPT_WRITE_CACHE    cpu_to_le32(1<<2)
-#define AAC_OPT_64BIT_DATA     cpu_to_le32(1<<3)
-#define AAC_OPT_HOST_TIME_FIB  cpu_to_le32(1<<4)
-#define AAC_OPT_RAID50         cpu_to_le32(1<<5)
-#define AAC_OPT_4GB_WINDOW     cpu_to_le32(1<<6)
-#define AAC_OPT_SCSI_UPGRADEABLE cpu_to_le32(1<<7)
-#define AAC_OPT_SOFT_ERR_REPORT        cpu_to_le32(1<<8)
-#define AAC_OPT_SUPPORTED_RECONDITION cpu_to_le32(1<<9)
-#define AAC_OPT_SGMAP_HOST64   cpu_to_le32(1<<10)
-#define AAC_OPT_ALARM          cpu_to_le32(1<<11)
-#define AAC_OPT_NONDASD                cpu_to_le32(1<<12)
+#define AAC_OPT_SNAPSHOT               cpu_to_le32(1)
+#define AAC_OPT_CLUSTERS               cpu_to_le32(1<<1)
+#define AAC_OPT_WRITE_CACHE            cpu_to_le32(1<<2)
+#define AAC_OPT_64BIT_DATA             cpu_to_le32(1<<3)
+#define AAC_OPT_HOST_TIME_FIB          cpu_to_le32(1<<4)
+#define AAC_OPT_RAID50                 cpu_to_le32(1<<5)
+#define AAC_OPT_4GB_WINDOW             cpu_to_le32(1<<6)
+#define AAC_OPT_SCSI_UPGRADEABLE       cpu_to_le32(1<<7)
+#define AAC_OPT_SOFT_ERR_REPORT                cpu_to_le32(1<<8)
+#define AAC_OPT_SUPPORTED_RECONDITION  cpu_to_le32(1<<9)
+#define AAC_OPT_SGMAP_HOST64           cpu_to_le32(1<<10)
+#define AAC_OPT_ALARM                  cpu_to_le32(1<<11)
+#define AAC_OPT_NONDASD                        cpu_to_le32(1<<12)
 
 struct aac_dev
 {
@@ -862,11 +777,10 @@ struct aac_dev
         */     
        dma_addr_t              hw_fib_pa;
        struct hw_fib           *hw_fib_va;
-       ulong                   fib_base_va;
+       struct hw_fib           *aif_base_va;
        /*
         *      Fib Headers
         */
-// dmb struct fib              fibs[AAC_NUM_FIB]; /* Doing it here takes up too much from the scsi pool*/
        struct fib              *fibs;
 
        struct fib              *free_fib;
@@ -887,7 +801,6 @@ struct aac_dev
        unsigned long           fsrev;          /* Main driver's revision number */
        
        struct aac_init         *init;          /* Holds initialization info to communicate with adapter */
-//     void *                  init_pa;        /* Holds physical address of the init struct */
        dma_addr_t              init_pa;        /* Holds physical address of the init struct */
        
        struct pci_dev          *pdev;          /* Our PCI interface */
@@ -898,7 +811,7 @@ struct aac_dev
 
        struct Scsi_Host        *scsi_host_ptr;
        struct fsa_scsi_hba     fsa_dev;
-       int                     thread_pid;
+       pid_t                   thread_pid;
        int                     cardtype;
        
        /*