[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>
This commit is contained in:
parent
ef72582e7a
commit
8f23d47558
|
@ -238,21 +238,23 @@ struct NCR_700_Host_Parameters {
|
||||||
#ifdef CONFIG_53C700_LE_ON_BE
|
#ifdef CONFIG_53C700_LE_ON_BE
|
||||||
#define bE (hostdata->force_le_on_be ? 0 : 3)
|
#define bE (hostdata->force_le_on_be ? 0 : 3)
|
||||||
#define bSWAP (hostdata->force_le_on_be)
|
#define bSWAP (hostdata->force_le_on_be)
|
||||||
/* This is terrible, but there's no raw version of ioread32. That means
|
#define bEBus (!hostdata->force_le_on_be)
|
||||||
* that on a be board we swap twice (once in ioread32 and once again to
|
|
||||||
* get the value correct) */
|
|
||||||
#define bS_to_io(x) ((hostdata->force_le_on_be) ? (x) : cpu_to_le32(x))
|
|
||||||
#elif defined(__BIG_ENDIAN)
|
#elif defined(__BIG_ENDIAN)
|
||||||
#define bE 3
|
#define bE 3
|
||||||
#define bSWAP 0
|
#define bSWAP 0
|
||||||
#define bS_to_io(x) (x)
|
|
||||||
#elif defined(__LITTLE_ENDIAN)
|
#elif defined(__LITTLE_ENDIAN)
|
||||||
#define bE 0
|
#define bE 0
|
||||||
#define bSWAP 0
|
#define bSWAP 0
|
||||||
#define bS_to_io(x) (x)
|
|
||||||
#else
|
#else
|
||||||
#error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined, did you include byteorder.h?"
|
#error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined, did you include byteorder.h?"
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef bEBus
|
||||||
|
#ifdef CONFIG_53C700_BE_BUS
|
||||||
|
#define bEBus 1
|
||||||
|
#else
|
||||||
|
#define bEBus 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#define bS_to_cpu(x) (bSWAP ? le32_to_cpu(x) : (x))
|
#define bS_to_cpu(x) (bSWAP ? le32_to_cpu(x) : (x))
|
||||||
#define bS_to_host(x) (bSWAP ? cpu_to_le32(x) : (x))
|
#define bS_to_host(x) (bSWAP ? cpu_to_le32(x) : (x))
|
||||||
|
|
||||||
|
@ -466,14 +468,15 @@ NCR_700_readl(struct Scsi_Host *host, __u32 reg)
|
||||||
{
|
{
|
||||||
const struct NCR_700_Host_Parameters *hostdata
|
const struct NCR_700_Host_Parameters *hostdata
|
||||||
= (struct NCR_700_Host_Parameters *)host->hostdata[0];
|
= (struct NCR_700_Host_Parameters *)host->hostdata[0];
|
||||||
__u32 value = ioread32(hostdata->base + reg);
|
__u32 value = bEBus ? ioread32be(hostdata->base + reg) :
|
||||||
|
ioread32(hostdata->base + reg);
|
||||||
#if 1
|
#if 1
|
||||||
/* sanity check the register */
|
/* sanity check the register */
|
||||||
if((reg & 0x3) != 0)
|
if((reg & 0x3) != 0)
|
||||||
BUG();
|
BUG();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return bS_to_io(value);
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -497,7 +500,8 @@ NCR_700_writel(__u32 value, struct Scsi_Host *host, __u32 reg)
|
||||||
BUG();
|
BUG();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
iowrite32(bS_to_io(value), hostdata->base + reg);
|
bEBus ? iowrite32be(value, hostdata->base + reg):
|
||||||
|
iowrite32(value, hostdata->base + reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue