From: James Bottomley <James.Bottomley@SteelEye.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: iomapping a big endian area
Date: Mon, 04 Apr 2005 16:17:45 -0500 [thread overview]
Message-ID: <1112649465.5813.106.camel@mulgrave> (raw)
In-Reply-To: <20050403013757.GB24234@parcelfarce.linux.theplanet.co.uk>
OK, I sent the patch off to Andrew. To complete the original problem,
the attached is the patch that uses it in the parisc lasi driver
(although, actually, it sets up 53c700 to work everywhere including BE
on a LE system).
I changed some of the flags around to reflect the fact that we now have
generic BE support in the driver (rather than the more limited
force_le_on_be flag).
James
===== drivers/scsi/53c700.h 1.25 vs edited =====
--- 1.25/drivers/scsi/53c700.h 2005-04-04 09:55:44 -05:00
+++ edited/drivers/scsi/53c700.h 2005-04-04 15:39:01 -05:00
@@ -177,10 +177,10 @@
struct device *dev;
__u32 dmode_extra; /* adjustable bus settings */
__u32 differential:1; /* if we are differential */
-#ifdef CONFIG_53C700_LE_ON_BE
+#ifdef CONFIG_53C700_BE
/* This option is for HP only. Set it if your chip is wired for
* little endian on this platform (which is big endian) */
- __u32 force_le_on_be:1;
+ __u32 chip_is_be:1;
#endif
__u32 chip710:1; /* set if really a 710 not 700 */
__u32 burst_disable:1; /* set to 1 to disable 710 bursting */
@@ -229,24 +229,29 @@
/*
* 53C700 Register Interface - the offset from the Selected base
* I/O address */
-#ifdef CONFIG_53C700_LE_ON_BE
-#define bE (hostdata->force_le_on_be ? 0 : 3)
-#define bSWAP (hostdata->force_le_on_be)
-/* This is terrible, but there's no raw version of ioread32. That means
- * 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)
+#ifdef CONFIG_53C700_BE
+#define bE (hostdata->chip_is_be ? 3: 0)
+#ifdef __BIG_ENDIAN
+#define bSWAP (!hostdata->chip_is_be)
+#else
+#define bSWAP (hostdata->chip_is_be);
+#endif
+#define NCR_ioread32(x) ((hostdata->chip_is_be) ? ioread32be(x) : ioread32(x))
+#define NCR_iowrite32(v, x) \
+ ((hostdata->chip_is_be) ? iowrite32be((v), (x)) : iowrite32((v), (x)))
+#else
+#define NCR_ioread32(x) ioread32(x)
+#define NCR_iowrite32(v, x) iowrite32((v), (x))
+#if defined(__BIG_ENDIAN)
#define bE 3
#define bSWAP 0
-#define bS_to_io(x) (x)
#elif defined(__LITTLE_ENDIAN)
#define bE 0
#define bSWAP 0
-#define bS_to_io(x) (x)
#else
#error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined, did you include byteorder.h?"
#endif
+#endif
#define bS_to_cpu(x) (bSWAP ? le32_to_cpu(x) : (x))
#define bS_to_host(x) (bSWAP ? cpu_to_le32(x) : (x))
@@ -460,14 +465,13 @@
{
const struct NCR_700_Host_Parameters *hostdata
= (struct NCR_700_Host_Parameters *)host->hostdata[0];
- __u32 value = ioread32(hostdata->base + reg);
+ __u32 value = NCR_ioread32(hostdata->base + reg);
#if 1
/* sanity check the register */
- if((reg & 0x3) != 0)
- BUG();
+ BUG_ON((reg & 0x3) != 0);
#endif
- return bS_to_io(value);
+ return value;
}
static inline void
@@ -487,11 +491,10 @@
#if 1
/* sanity check the register */
- if((reg & 0x3) != 0)
- BUG();
+ BUG_ON((reg & 0x3) != 0);
#endif
- iowrite32(bS_to_io(value), hostdata->base + reg);
+ NCR_iowrite32(value, hostdata->base + reg);
}
#endif
===== drivers/scsi/Kconfig 1.88 vs edited =====
--- 1.88/drivers/scsi/Kconfig 2005-04-04 09:55:45 -05:00
+++ edited/drivers/scsi/Kconfig 2005-04-04 15:34:40 -05:00
@@ -951,7 +951,7 @@
many PA-RISC workstations & servers. If you do not know whether you
have a Lasi chip, it is safe to say "Y" here.
-config 53C700_LE_ON_BE
+config 53C700_BE
bool
depends on SCSI_LASI700
default y
===== drivers/scsi/lasi700.c 1.27 vs edited =====
--- 1.27/drivers/scsi/lasi700.c 2005-04-04 09:55:45 -05:00
+++ edited/drivers/scsi/lasi700.c 2005-04-04 15:31:19 -05:00
@@ -117,15 +117,13 @@
if (dev->id.sversion == LASI_700_SVERSION) {
hostdata->clock = LASI700_CLOCK;
- hostdata->force_le_on_be = 1;
+ hostdata->chip_is_be = 0;
} else {
hostdata->clock = LASI710_CLOCK;
- hostdata->force_le_on_be = 0;
+ hostdata->chip_is_be = 1;
hostdata->chip710 = 1;
hostdata->dmode_extra = DMODE_FC2;
}
-
- NCR_700_set_mem_mapped(hostdata);
host = NCR_700_detect(&lasi700_template, hostdata, &dev->dev);
if (!host)
next prev parent reply other threads:[~2005-04-04 21:17 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-02 20:52 [PATCH] finally fix 53c700 to use the generic iomem infrastructure James Bottomley
2005-04-03 1:37 ` iomapping a big endian area Matthew Wilcox
2005-04-03 2:38 ` David S. Miller
2005-04-03 3:10 ` Matthew Wilcox
2005-04-03 3:40 ` James Bottomley
2005-04-03 4:08 ` David S. Miller
2005-04-03 4:27 ` James Bottomley
2005-04-04 7:50 ` Benjamin Herrenschmidt
2005-04-04 13:59 ` James Bottomley
2005-04-04 14:16 ` Christoph Hellwig
2005-04-04 14:25 ` James Bottomley
2005-04-07 23:57 ` Jesse Barnes
2005-04-04 14:22 ` Randy.Dunlap
2005-04-04 23:41 ` Benjamin Herrenschmidt
2005-04-04 23:43 ` Benjamin Herrenschmidt
2005-04-04 7:49 ` Benjamin Herrenschmidt
2005-04-05 7:42 ` Russell King
2005-04-05 14:05 ` James Bottomley
2005-04-05 18:55 ` Russell King
2005-04-05 20:02 ` Maciej W. Rozycki
2005-04-04 21:17 ` James Bottomley [this message]
2005-04-05 7:21 ` Christoph Hellwig
2005-04-05 14:05 ` James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1112649465.5813.106.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=matthew@wil.cx \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox