]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/sym53c8xx_2/sym_hipd.h
Merge git://git.infradead.org/~dedekind/ubi-2.6
[linux-2.6-omap-h63xx.git] / drivers / scsi / sym53c8xx_2 / sym_hipd.h
index 3a264a40821646c4db6cf9f965d7374944301afd..ad078805e62b19dcf9609ecf39cf986d2d61ebf5 100644 (file)
  *  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.
@@ -64,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
@@ -416,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.
@@ -454,8 +434,10 @@ struct sym_tcb {
         *  Other user settable limits and options.
         *  These limits are read from the NVRAM if present.
         */
-       u_char  usrflags;
-       u_short usrtags;
+       unsigned char   usrflags;
+       unsigned char   usr_period;
+       unsigned char   usr_width;
+       unsigned short  usrtags;
        struct scsi_target *starget;
 };
 
@@ -672,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.
@@ -804,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
@@ -821,12 +797,6 @@ struct sym_ccb {
 
 #define CCB_BA(cp,lbl) cpu_to_scr(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
-
 typedef struct device *m_pool_ident_t;
 
 /*
@@ -913,10 +883,7 @@ struct sym_hcb {
         *  Physical bus addresses of the chip.
         */
        u32             mmio_ba;        /* MMIO 32 bit BUS address      */
-       int             mmio_ws;        /* MMIO Window size             */
-
        u32             ram_ba;         /* RAM 32 bit BUS address       */
-       int             ram_ws;         /* RAM window size              */
 
        /*
         *  SCRIPTS virtual and physical bus addresses.
@@ -942,14 +909,12 @@ struct sym_hcb {
        struct sym_fwb_ba fwb_bas;      /* Useful SCRIPTB bus addresses */
        struct sym_fwz_ba fwz_bas;      /* Useful SCRIPTZ bus addresses */
        void            (*fw_setup)(struct sym_hcb *np, struct sym_fw *fw);
-       void            (*fw_patch)(struct sym_hcb *np);
+       void            (*fw_patch)(struct Scsi_Host *);
        char            *fw_name;
 
        /*
         *  General controller parameters and configuration.
         */
-       u_short device_id;      /* PCI device id                */
-       u_char  revision_id;    /* PCI device revision id       */
        u_int   features;       /* Chip features map            */
        u_char  myaddr;         /* SCSI id of the adapter       */
        u_char  maxburst;       /* log base 2 of dwords burst   */
@@ -1061,6 +1026,14 @@ struct sym_hcb {
 #endif
 };
 
+#if SYM_CONF_DMA_ADDRESSING_MODE == 0
+#define use_dac(np)    0
+#define set_dac(np)    do { } while (0)
+#else
+#define use_dac(np)    (np)->use_dac
+#define set_dac(np)    (np)->use_dac = 1
+#endif
+
 #define HCB_BA(np, lbl)        (np->hcb_ba + offsetof(struct sym_hcb, lbl))
 
 
@@ -1077,12 +1050,13 @@ 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);
+void sym_start_up(struct Scsi_Host *, int reason);
+irqreturn_t sym_interrupt(struct Scsi_Host *);
 int sym_clear_tasks(struct sym_hcb *np, int cam_status, int target, int lun, int task);
 struct sym_ccb *sym_get_ccb(struct sym_hcb *np, struct scsi_cmnd *cmd, u_char tag_order);
 void sym_free_ccb(struct sym_hcb *np, struct sym_ccb *cp);
@@ -1102,18 +1076,21 @@ int sym_hcb_attach(struct Scsi_Host *shost, struct sym_fw *fw, struct sym_nvram
  */
 
 #if   SYM_CONF_DMA_ADDRESSING_MODE == 0
+#define DMA_DAC_MASK   DMA_32BIT_MASK
 #define sym_build_sge(np, data, badd, len)     \
 do {                                           \
        (data)->addr = cpu_to_scr(badd);        \
        (data)->size = cpu_to_scr(len);         \
 } while (0)
 #elif SYM_CONF_DMA_ADDRESSING_MODE == 1
+#define DMA_DAC_MASK   DMA_40BIT_MASK
 #define sym_build_sge(np, data, badd, len)                             \
 do {                                                                   \
        (data)->addr = cpu_to_scr(badd);                                \
        (data)->size = cpu_to_scr((((badd) >> 8) & 0xff000000) + len);  \
 } while (0)
 #elif SYM_CONF_DMA_ADDRESSING_MODE == 2
+#define DMA_DAC_MASK   DMA_64BIT_MASK
 int sym_lookup_dmap(struct sym_hcb *np, u32 h, int s);
 static __inline void 
 sym_build_sge(struct sym_hcb *np, struct sym_tblmove *data, u64 badd, int len)
@@ -1135,71 +1112,6 @@ 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 = DMA_NONE;
-
-       /*
-        *  Set the data pointer.
-        */
-       switch(dir) {
-#ifdef SYM_OPT_HANDLE_DIR_UNKNOWN
-       case DMA_BIDIRECTIONAL:
-#endif
-       case DMA_TO_DEVICE:
-               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 != DMA_BIDIRECTIONAL)
-                       break;
-               cp->phys.head.wlastp = cpu_to_scr(lastp);
-               /* fall through */
-#else
-               break;
-#endif
-       case DMA_FROM_DEVICE:
-               cp->host_flags |= HF_DATA_IN;
-               goalp = SCRIPTA_BA(np, data_in2) + 8;
-               lastp = goalp - 8 - (cp->segments * (2*4));
-               break;
-       case DMA_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 == DMA_BIDIRECTIONAL)
-               cp->phys.head.savep = cpu_to_scr(SCRIPTB_BA(np, data_io));
-#endif
-}
-
 /*
  *  MEMORY ALLOCATOR.
  */