Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / scsi / sym53c8xx_2 / sym_hipd.h
index a95cbe4..79ab6a1 100644 (file)
@@ -37,6 +37,8 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+#include <linux/gfp.h>
+
 #ifndef SYM_HIPD_H
 #define SYM_HIPD_H
 
  *  They may be defined in platform specific headers, if they 
  *  are useful.
  *
- *    SYM_OPT_HANDLE_DIR_UNKNOWN
- *        When this option is set, the SCRIPTS used by the driver 
- *        are able to handle SCSI transfers with direction not 
- *        supplied by user.
- *        (set for Linux-2.0.X)
- *
  *    SYM_OPT_HANDLE_DEVICE_QUEUEING
  *        When this option is set, the driver will use a queue per 
  *        device and handle QUEUE FULL status requeuing internally.
@@ -62,7 +58,6 @@
  *        (set for Linux)
  */
 #if 0
-#define SYM_OPT_HANDLE_DIR_UNKNOWN
 #define SYM_OPT_HANDLE_DEVICE_QUEUEING
 #define SYM_OPT_LIMIT_COMMAND_REORDERING
 #endif
  */
 #define        SYM_CONF_MIN_ASYNC (40)
 
+
+/*
+ * MEMORY ALLOCATOR.
+ */
+
+#define SYM_MEM_WARN   1       /* Warn on failed operations */
+
+#define SYM_MEM_PAGE_ORDER 0   /* 1 PAGE  maximum */
+#define SYM_MEM_CLUSTER_SHIFT  (PAGE_SHIFT+SYM_MEM_PAGE_ORDER)
+#define SYM_MEM_FREE_UNUSED    /* Free unused pages immediately */
 /*
  *  Shortest memory chunk is (1<<SYM_MEM_SHIFT), currently 16.
  *  Actual allocations happen as SYM_MEM_CLUSTER_SIZE sized.
@@ -404,19 +409,6 @@ struct sym_tcb {
        struct sym_lcb **lunmp;         /* Other LCBs [1..MAX_LUN]      */
 #endif
 
-       /*
-        *  Bitmap that tells about LUNs that succeeded at least 
-        *  1 IO and therefore assumed to be a real device.
-        *  Avoid useless allocation of the LCB structure.
-        */
-       u32     lun_map[(SYM_CONF_MAX_LUN+31)/32];
-
-       /*
-        *  Bitmap that tells about LUNs that haven't yet an LCB 
-        *  allocated (not discovered or LCB allocation failed).
-        */
-       u32     busy0_map[(SYM_CONF_MAX_LUN+31)/32];
-
 #ifdef SYM_HAVE_STCB
        /*
         *  O/S specific data structure.
@@ -442,9 +434,11 @@ struct sym_tcb {
         *  Other user settable limits and options.
         *  These limits are read from the NVRAM if present.
         */
-       u_char  usrflags;
-       u_short usrtags;
-       struct scsi_device *sdev;
+       unsigned char   usrflags;
+       unsigned char   usr_period;
+       unsigned char   usr_width;
+       unsigned short  usrtags;
+       struct scsi_target *starget;
 };
 
 /*
@@ -660,9 +654,6 @@ struct sym_ccbh {
         */
        u32     savep;          /* Jump address to saved data pointer   */
        u32     lastp;          /* SCRIPTS address at end of data       */
-#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
-       u32     wlastp;
-#endif
 
        /*
         *  Status fields.
@@ -754,10 +745,8 @@ struct sym_ccb {
        int     segments;       /* Number of SG segments        */
 
        u8      order;          /* Tag type (if tagged command) */
+       unsigned char odd_byte_adjustment;      /* odd-sized req on wide bus */
 
-       /*
-        *  Miscellaneous status'.
-        */
        u_char  nego_status;    /* Negotiation status           */
        u_char  xerr_status;    /* Extended error flags         */
        u32     extra_bytes;    /* Extraneous bytes transferred */
@@ -794,9 +783,6 @@ struct sym_ccb {
        SYM_QUEHEAD link_ccbq;  /* Link to free/busy CCB queue  */
        u32     startp;         /* Initial data pointer         */
        u32     goalp;          /* Expected last data pointer   */
-#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
-       u32     wgoalp;
-#endif
        int     ext_sg;         /* Extreme data pointer, used   */
        int     ext_ofs;        /*  to calculate the residual.  */
 #ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING
@@ -809,13 +795,7 @@ struct sym_ccb {
 #endif
 };
 
-#define CCB_BA(cp,lbl) (cp->ccb_ba + offsetof(struct sym_ccb, lbl))
-
-#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
-#define        sym_goalp(cp) ((cp->host_flags & HF_DATA_IN) ? cp->goalp : cp->wgoalp)
-#else
-#define        sym_goalp(cp) (cp->goalp)
-#endif
+#define CCB_BA(cp,lbl) cpu_to_scr(cp->ccb_ba + offsetof(struct sym_ccb, lbl))
 
 typedef struct device *m_pool_ident_t;
 
@@ -1067,9 +1047,10 @@ char *sym_driver_name(void);
 void sym_print_xerr(struct scsi_cmnd *cmd, int x_status);
 int sym_reset_scsi_bus(struct sym_hcb *np, int enab_int);
 struct sym_chip *sym_lookup_chip_table(u_short device_id, u_char revision);
-void sym_put_start_queue(struct sym_hcb *np, struct sym_ccb *cp);
 #ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING
 void sym_start_next_ccbs(struct sym_hcb *np, struct sym_lcb *lp, int maxn);
+#else
+void sym_put_start_queue(struct sym_hcb *np, struct sym_ccb *cp);
 #endif
 void sym_start_up(struct sym_hcb *np, int reason);
 void sym_interrupt(struct sym_hcb *np);
@@ -1125,81 +1106,10 @@ bad:
 #error "Unsupported DMA addressing mode"
 #endif
 
-/*
- *  Set up data pointers used by SCRIPTS.
- *  Called from O/S specific code.
- */
-static inline void sym_setup_data_pointers(struct sym_hcb *np,
-               struct sym_ccb *cp, int dir)
-{
-       u32 lastp, goalp;
-
-       /*
-        *  No segments means no data.
-        */
-       if (!cp->segments)
-               dir = CAM_DIR_NONE;
-
-       /*
-        *  Set the data pointer.
-        */
-       switch(dir) {
-#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
-       case CAM_DIR_UNKNOWN:
-#endif
-       case CAM_DIR_OUT:
-               goalp = SCRIPTA_BA(np, data_out2) + 8;
-               lastp = goalp - 8 - (cp->segments * (2*4));
-#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
-               cp->wgoalp = cpu_to_scr(goalp);
-               if (dir != CAM_DIR_UNKNOWN)
-                       break;
-               cp->phys.head.wlastp = cpu_to_scr(lastp);
-               /* fall through */
-#else
-               break;
-#endif
-       case CAM_DIR_IN:
-               cp->host_flags |= HF_DATA_IN;
-               goalp = SCRIPTA_BA(np, data_in2) + 8;
-               lastp = goalp - 8 - (cp->segments * (2*4));
-               break;
-       case CAM_DIR_NONE:
-       default:
-#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
-               cp->host_flags |= HF_DATA_IN;
-#endif
-               lastp = goalp = SCRIPTB_BA(np, no_data);
-               break;
-       }
-
-       /*
-        *  Set all pointers values needed by SCRIPTS.
-        */
-       cp->phys.head.lastp = cpu_to_scr(lastp);
-       cp->phys.head.savep = cpu_to_scr(lastp);
-       cp->startp          = cp->phys.head.savep;
-       cp->goalp           = cpu_to_scr(goalp);
-
-#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
-       /*
-        *  If direction is unknown, start at data_io.
-        */
-       if (dir == CAM_DIR_UNKNOWN)
-               cp->phys.head.savep = cpu_to_scr(SCRIPTB_BA(np, data_io));
-#endif
-}
-
 /*
  *  MEMORY ALLOCATOR.
  */
 
-#define SYM_MEM_PAGE_ORDER 0   /* 1 PAGE  maximum */
-#define SYM_MEM_CLUSTER_SHIFT  (PAGE_SHIFT+SYM_MEM_PAGE_ORDER)
-#define SYM_MEM_FREE_UNUSED    /* Free unused pages immediately */
-
-#define SYM_MEM_WARN   1       /* Warn on failed operations */
-
 #define sym_get_mem_cluster()  \
        (void *) __get_free_pages(GFP_ATOMIC, SYM_MEM_PAGE_ORDER)
 #define sym_free_mem_cluster(p)        \