summaryrefslogtreecommitdiff
path: root/drivers/scsi/sym53c8xx_2/sym_hipd.h
diff options
context:
space:
mode:
authorMatthew Wilcox <matthew@wil.cx>2007-10-05 23:55:09 +0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-10-23 23:12:36 +0400
commit4d85b471593d03e141f9160a58574b9204363267 (patch)
tree322457b73d4b5872ddb5c0651d8820933f0a68c4 /drivers/scsi/sym53c8xx_2/sym_hipd.h
parenta44131b35ec1a46ed75014d818cb9d5706117b49 (diff)
downloadlinux-4d85b471593d03e141f9160a58574b9204363267.tar.xz
[SCSI] sym53c8xx: Simplify DAC DMA handling
By introducing the use_dac(), set_dac() and DMA_DAC_MASK macros, we can eliminate a lot of ifdefs from the code. We now rely on the compiler to optimise away a few things that we'd formerly relied on the preprocessor to do. This makes sym_setup_bus_dma_mask() small enough to inline into its only caller. Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/sym53c8xx_2/sym_hipd.h')
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h
index f76b27f0aa2c..4354571a63ef 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.h
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h
@@ -1026,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))
@@ -1068,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)