aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@steeleye.com>2005-11-29 17:24:52 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2005-12-16 12:51:01 -0500
commit8f23d475581adac949315e3339421e12554932c9 (patch)
tree30e68e2f1f48b39e0dd0da382d1297d321f817f9 /drivers/scsi
parentef72582e7a02e1069c6e6bf5eecf6f388b1467c6 (diff)
[SCSI] 53c700: update endian processing macros
This update now allows this driver to be used on big endian bus machines that aren't parisc. To do that, the driver must set a CONFIG_53C700_BE_BUS in Kconfig to compile the right macro versions. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/53c700.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h
index 362d78483d09..a8c83bb03630 100644
--- a/drivers/scsi/53c700.h
+++ b/drivers/scsi/53c700.h
@@ -238,21 +238,23 @@ struct NCR_700_Host_Parameters {
238#ifdef CONFIG_53C700_LE_ON_BE 238#ifdef CONFIG_53C700_LE_ON_BE
239#define bE (hostdata->force_le_on_be ? 0 : 3) 239#define bE (hostdata->force_le_on_be ? 0 : 3)
240#define bSWAP (hostdata->force_le_on_be) 240#define bSWAP (hostdata->force_le_on_be)
241/* This is terrible, but there's no raw version of ioread32. That means 241#define bEBus (!hostdata->force_le_on_be)
242 * that on a be board we swap twice (once in ioread32 and once again to
243 * get the value correct) */
244#define bS_to_io(x) ((hostdata->force_le_on_be) ? (x) : cpu_to_le32(x))
245#elif defined(__BIG_ENDIAN) 242#elif defined(__BIG_ENDIAN)
246#define bE 3 243#define bE 3
247#define bSWAP 0 244#define bSWAP 0
248#define bS_to_io(x) (x)
249#elif defined(__LITTLE_ENDIAN) 245#elif defined(__LITTLE_ENDIAN)
250#define bE 0 246#define bE 0
251#define bSWAP 0 247#define bSWAP 0
252#define bS_to_io(x) (x)
253#else 248#else
254#error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined, did you include byteorder.h?" 249#error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined, did you include byteorder.h?"
255#endif 250#endif
251#ifndef bEBus
252#ifdef CONFIG_53C700_BE_BUS
253#define bEBus 1
254#else
255#define bEBus 0
256#endif
257#endif
256#define bS_to_cpu(x) (bSWAP ? le32_to_cpu(x) : (x)) 258#define bS_to_cpu(x) (bSWAP ? le32_to_cpu(x) : (x))
257#define bS_to_host(x) (bSWAP ? cpu_to_le32(x) : (x)) 259#define bS_to_host(x) (bSWAP ? cpu_to_le32(x) : (x))
258 260
@@ -466,14 +468,15 @@ NCR_700_readl(struct Scsi_Host *host, __u32 reg)
466{ 468{
467 const struct NCR_700_Host_Parameters *hostdata 469 const struct NCR_700_Host_Parameters *hostdata
468 = (struct NCR_700_Host_Parameters *)host->hostdata[0]; 470 = (struct NCR_700_Host_Parameters *)host->hostdata[0];
469 __u32 value = ioread32(hostdata->base + reg); 471 __u32 value = bEBus ? ioread32be(hostdata->base + reg) :
472 ioread32(hostdata->base + reg);
470#if 1 473#if 1
471 /* sanity check the register */ 474 /* sanity check the register */
472 if((reg & 0x3) != 0) 475 if((reg & 0x3) != 0)
473 BUG(); 476 BUG();
474#endif 477#endif
475 478
476 return bS_to_io(value); 479 return value;
477} 480}
478 481
479static inline void 482static inline void
@@ -497,7 +500,8 @@ NCR_700_writel(__u32 value, struct Scsi_Host *host, __u32 reg)
497 BUG(); 500 BUG();
498#endif 501#endif
499 502
500 iowrite32(bS_to_io(value), hostdata->base + reg); 503 bEBus ? iowrite32be(value, hostdata->base + reg):
504 iowrite32(value, hostdata->base + reg);
501} 505}
502 506
503#endif 507#endif