All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: Kars de Jong <jongk@linux-m68k.org>
Cc: Christoph Hellwig <hch@infradead.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	linux-m68k@vger.kernel.org, linux-scsi@vger.kernel.org,
	Andi Kleen <ak@suse.de>, Matthew Wilcox <matthew@wil.cx>,
	Ingo Juergensmann <ij@2005.bluespice.org>,
	Richard Hirst <rhirst@levanta.com>
Subject: Re: Removing BROKEN scsi drivers
Date: Tue, 29 Nov 2005 16:24:52 -0600	[thread overview]
Message-ID: <1133303092.3492.58.camel@mulgrave> (raw)
In-Reply-To: <1133110038.3331.20.camel@mulgrave>

On Sun, 2005-11-27 at 11:47 -0500, James Bottomley wrote:
> I assume your problems is also that the 53c7x0 chip on the MAC is also
> on a BE bus, so I think what you want is another flag:
> 
> 53c700_BE_BUS
> 
> which causes all the io macros to be ioread/write<n>be.  Which will
> avoid the nasty double swap we do on PA.

How about the attached.  I've tested it out on parisc and it works
fine ... in fact I'm tempted to commit it simply because we now avoid
the double swap for every I/O operation.

James

diff --git a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h
--- a/drivers/scsi/53c700.h
+++ b/drivers/scsi/53c700.h
@@ -232,21 +232,23 @@ struct NCR_700_Host_Parameters {
 #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))
+#define bEBus	(!hostdata->force_le_on_be)
 #elif 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
+#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_host(x)	(bSWAP ? cpu_to_le32(x) : (x))
 
@@ -460,14 +462,15 @@ NCR_700_readl(struct Scsi_Host *host, __
 {
 	const struct NCR_700_Host_Parameters *hostdata
 		= (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
 	/* sanity check the register */
 	if((reg & 0x3) != 0)
 		BUG();
 #endif
 
-	return bS_to_io(value);
+	return value;
 }
 
 static inline void
@@ -491,7 +494,8 @@ NCR_700_writel(__u32 value, struct Scsi_
 		BUG();
 #endif
 
-	iowrite32(bS_to_io(value), hostdata->base + reg);
+	bEBus ? iowrite32be(value, hostdata->base + reg): 
+		iowrite32(value, hostdata->base + reg);
 }
 
 #endif



  reply	other threads:[~2005-11-29 22:25 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-05 11:14 Removing BROKEN scsi drivers Andi Kleen
2005-10-05 11:22 ` Arjan van de Ven
2005-10-05 11:31 ` Matthew Wilcox
2005-10-05 11:39   ` Christoph Hellwig
2005-10-05 12:32     ` Richard Hirst
2005-10-05 13:30       ` Kars de Jong
2005-10-05 14:00         ` Richard Hirst
2005-10-05 14:03         ` James Bottomley
2005-10-05 14:35           ` Rolf Eike Beer
2005-10-07  8:27         ` Geert Uytterhoeven
2005-10-07 13:42           ` Richard Hirst
2005-10-07 13:53             ` Kars de Jong
2005-11-15  9:51               ` Christoph Hellwig
2005-11-15 10:17                 ` Ingo Juergensmann
2005-11-15 10:30                   ` Christoph Hellwig
2005-11-15 11:32                     ` Richard Hirst
2005-11-15 12:08                       ` Roman Zippel
2005-11-15 12:11                       ` Kars de Jong
2005-11-15 13:05                         ` Matthew Wilcox
2005-11-22  8:36                         ` Christoph Hellwig
2005-11-22 21:43                           ` Kars de Jong
2005-11-22 22:20                             ` Matthew Wilcox
2005-11-27 16:47                             ` James Bottomley
2005-11-29 22:24                               ` James Bottomley [this message]
2005-11-30  8:31                                 ` Kars de Jong
2005-11-30  8:45                                   ` Ingo Juergensmann
2005-12-01 20:43                                 ` Kars de Jong
2005-12-01 20:47                                   ` James Bottomley
2005-12-01 23:29                                   ` Richard Hirst
2005-12-02 15:03                                   ` Ingo Juergensmann
2005-12-07 21:25                                   ` Ingo Juergensmann
2006-07-07 12:44                       ` Christoph Hellwig
2006-07-09 11:16                         ` Richard Hirst
2006-07-09 11:25                           ` Kars de Jong
2006-10-30 11:13                             ` Christoph Hellwig
2006-10-30 12:34                               ` Kars de Jong
2006-10-31 21:47                               ` [RFC PATCH] m68k: switch to 53c700 driver Kars de Jong
2006-11-02 21:34                                 ` Geert Uytterhoeven
2006-12-17 22:28                                 ` James Bottomley
2006-12-18  9:34                                   ` Geert Uytterhoeven
2006-12-19  3:09                                     ` Al Viro
2006-12-22 21:21                                       ` Kars de Jong
2007-04-29 21:43                                         ` Christoph Hellwig
2005-10-05 11:43 ` Removing BROKEN scsi drivers Christoph Hellwig
2005-10-05 22:36 ` Douglas Gilbert
2005-10-06 10:23   ` Andi Kleen

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=1133303092.3492.58.camel@mulgrave \
    --to=james.bottomley@steeleye.com \
    --cc=ak@suse.de \
    --cc=geert@linux-m68k.org \
    --cc=hch@infradead.org \
    --cc=ij@2005.bluespice.org \
    --cc=jongk@linux-m68k.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=rhirst@levanta.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.