* IDE woos in BE mode 2.6 kernel
@ 2004-06-24 23:45 Jun Sun
2004-06-25 8:45 ` Geert Uytterhoeven
0 siblings, 1 reply; 6+ messages in thread
From: Jun Sun @ 2004-06-24 23:45 UTC (permalink / raw)
To: linux-mips; +Cc: jsun
Anybody has tried IDE disks in big endian mode with 2.6 kernel?
I seem to have troubles with Malta board.
Current malta board has CONFIG_SWAP_IO_SPACE defined and therefore
all inw, inl and their friends are byte-swapped in BE mode. As a
results all IDE IO ops (such as ide_inw, etc) do swapping too.
A quick experiement shows those IDE IO ops should not do swapping.
Anybody knows why?
Apparently fixing the above is not enough. I either encountered
failure to read partition table or having DMA error. Any clues
here?
I suppose this problem really should exist for other arches
with BE support. Anybody knows how other arches deal with this?
Thanks.
Jun
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: IDE woos in BE mode 2.6 kernel
2004-06-24 23:45 Jun Sun
@ 2004-06-25 8:45 ` Geert Uytterhoeven
0 siblings, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2004-06-25 8:45 UTC (permalink / raw)
To: Jun Sun; +Cc: Linux/MIPS Development
On Thu, 24 Jun 2004, Jun Sun wrote:
> I suppose this problem really should exist for other arches
> with BE support. Anybody knows how other arches deal with this?
My Amiga is happily running 2.6.7 and doesn't have problems with IDE, so m68k
is not affected.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 6+ messages in thread
* IDE woos in BE mode 2.6 kernel
@ 2004-09-17 19:18 Manish Lachwani
2004-09-18 14:19 ` Atsushi Nemoto
0 siblings, 1 reply; 6+ messages in thread
From: Manish Lachwani @ 2004-09-17 19:18 UTC (permalink / raw)
To: linux-mips
[-- Attachment #1: Type: text/plain, Size: 953 bytes --]
Hello !
In response to Jun Suns mail sent on 06/24/2004
Anybody has tried IDE disks in big endian mode with 2.6 kernel?
I seem to have troubles with Malta board.
Current malta board has CONFIG_SWAP_IO_SPACE defined and therefore
all inw, inl and their friends are byte-swapped in BE mode. As a
results all IDE IO ops (such as ide_inw, etc) do swapping too.
A quick experiement shows those IDE IO ops should not do swapping.
Anybody knows why?
Apparently fixing the above is not enough. I either encountered
failure to read partition table or having DMA error. Any clues
here?
I suppose this problem really should exist for other arches
with BE support. Anybody knows how other arches deal with this?
Thanks.
Jun
---
The following patch gets the Malta to work well. However, this patch introduces board specific changes in the IDE subsystem.
This is not a final patch but maybe there can be a better approach to this issue
Thanks
Manish
[-- Attachment #2: patch-26-ide-malta --]
[-- Type: text/plain, Size: 1937 bytes --]
--- drivers/ide/ide-iops.c.orig 2004-09-16 19:20:52.000000000 -0700
+++ drivers/ide/ide-iops.c 2004-09-16 18:55:37.000000000 -0700
@@ -95,13 +95,23 @@
hwif->OUTBSYNC = ide_outbsync;
hwif->OUTW = ide_outw;
hwif->OUTL = ide_outl;
+#if defined(CONFIG_MIPS_MALTA) && !defined(CONFIG_CPU_LITTLE_ENDIAN)
+ hwif->OUTSW = malta_ide_outsw;
+ hwif->OUTSL = malta_ide_outsl;
+#else
hwif->OUTSW = ide_outsw;
hwif->OUTSL = ide_outsl;
+#endif
hwif->INB = ide_inb;
hwif->INW = ide_inw;
hwif->INL = ide_inl;
+#if defined(CONFIG_MIPS_MALTA) && !defined(CONFIG_CPU_LITTLE_ENDIAN)
+ hwif->INSW = malta_ide_insw;
+ hwif->INSL = malta_ide_insl;
+#else
hwif->INSW = ide_insw;
hwif->INSL = ide_insl;
+#endif
}
EXPORT_SYMBOL(default_hwif_iops);
--- include/asm-mips/ide.h.orig 2004-09-16 15:41:00.000000000 -0700
+++ include/asm-mips/ide.h 2004-09-16 18:12:26.000000000 -0700
@@ -20,6 +20,42 @@
#define __ide_mm_outsw ide_outsw
#define __ide_mm_outsl ide_outsl
+#if defined(CONFIG_MIPS_MALTA) && !defined(CONFIG_CPU_LITTLE_ENDIAN)
+extern const unsigned long mips_io_port_base;
+
+static inline void malta_ide_insw(unsigned long port, void *addr, unsigned int count)
+{
+ while (count--) {
+ *(u16 *)addr = *(volatile u16 *)(mips_io_port_base + port);
+ addr += 2;
+ }
+}
+
+static inline void malta_ide_outsw(unsigned long port, void *addr, unsigned int count)
+{
+ while (count--) {
+ *(volatile u16 *)(mips_io_port_base + (port)) = *(u16 *)addr;
+ addr += 2;
+ }
+}
+
+static inline void malta_ide_insl(unsigned long port, void *addr, unsigned int count)
+{
+ while (count--) {
+ *(u32 *)addr = *(volatile u32 *)(mips_io_port_base + port);
+ addr += 4;
+ }
+}
+
+static inline void malta_ide_outsl(unsigned long port, void *addr, unsigned int count)
+{
+ while (count--) {
+ *(volatile u32 *)(mips_io_port_base + (port)) = *(u32 *)addr;
+ addr += 4;
+ }
+}
+#endif
+
#endif /* __KERNEL__ */
#endif /* __ASM_IDE_H */
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: IDE woos in BE mode 2.6 kernel
2004-09-17 19:18 IDE woos in BE mode 2.6 kernel Manish Lachwani
@ 2004-09-18 14:19 ` Atsushi Nemoto
2004-09-24 23:40 ` Manish Lachwani
0 siblings, 1 reply; 6+ messages in thread
From: Atsushi Nemoto @ 2004-09-18 14:19 UTC (permalink / raw)
To: mlachwani; +Cc: linux-mips
>>>>> On Fri, 17 Sep 2004 12:18:37 -0700, Manish Lachwani <mlachwani@mvista.com> said:
mlachwani> In response to Jun Suns mail sent on 06/24/2004
jsun> Anybody has tried IDE disks in big endian mode with 2.6
jsun> kernel? I seem to have troubles with Malta board.
...
mlachwani> The following patch gets the Malta to work well. However,
mlachwani> this patch introduces board specific changes in the IDE
mlachwani> subsystem. This is not a final patch but maybe there can
mlachwani> be a better approach to this issue
FYI, here is my approach. Not so beautiful but less intrusive...
1. copy include/asm-mips/mach-generic/ide.h to my mach-xxx directory.
2. add following lines to include/asm-mips/mach-xxx/ide.h
--- begin ---
/* get rid of defs from io.h - ide has its private and conflicting versions */
#ifdef insb
#undef insb
#endif
#ifdef outsb
#undef outsb
#endif
#ifdef insw
#undef insw
#endif
#ifdef outsw
#undef outsw
#endif
#ifdef insl
#undef insl
#endif
#ifdef outsl
#undef outsl
#endif
#define insb(port, addr, count) ___ide_insb(port, addr, count)
#define insw(port, addr, count) ___ide_insw(port, addr, count)
#define insl(port, addr, count) ___ide_insl(port, addr, count)
#define outsb(port, addr, count) ___ide_outsb(port, addr, count)
#define outsw(port, addr, count) ___ide_outsw(port, addr, count)
#define outsl(port, addr, count) ___ide_outsl(port, addr, count)
static inline void ___ide_insb(unsigned long port, void *addr, unsigned int count)
{
unsigned long start = (unsigned long)addr;
unsigned long size = (unsigned long)count;
while (count--) {
*(u16 *)addr = *(volatile u8 *)(mips_io_port_base + port);
addr++;
}
if (cpu_has_dc_aliases)
dma_cache_wback((unsigned long)start, size);
}
static inline void ___ide_outsb(unsigned long port, void *addr, unsigned int count)
{
while (count--) {
*(volatile u8 *)(mips_io_port_base + port) = *(u8 *)addr;
addr++;
}
}
static inline void ___ide_insw(unsigned long port, void *addr, unsigned int count)
{
unsigned long start = (unsigned long)addr;
unsigned long size = (unsigned long)count * 2;
while (count--) {
*(u16 *)addr = *(volatile u16 *)(mips_io_port_base + port);
addr += 2;
}
if (cpu_has_dc_aliases)
dma_cache_wback((unsigned long)start, size);
}
static inline void ___ide_outsw(unsigned long port, void *addr, unsigned int count)
{
while (count--) {
*(volatile u16 *)(mips_io_port_base + port) = *(u16 *)addr;
addr += 2;
}
}
static inline void ___ide_insl(unsigned long port, void *addr, unsigned int count)
{
unsigned long start = (unsigned long)addr;
unsigned long size = (unsigned long)count * 4;
while (count--) {
*(u32 *)addr = *(volatile u32 *)(mips_io_port_base + port);
addr += 4;
}
if (cpu_has_dc_aliases)
dma_cache_wback((unsigned long)start, size);
}
static inline void ___ide_outsl(unsigned long port, void *addr, unsigned int count)
{
while (count--) {
*(volatile u32 *)(mips_io_port_base + port) = *(u32 *)addr;
addr += 4;
}
}
--- end ---
Note that above codes include workarounds for PIO IDE cache problem
(dma_cache_wback) though I'm not sure this workaround still needed.
Please refer this ML thread for the workaround.
<http://www.linux-mips.org/archives/linux-mips/2004-03/msg00185.html>
And as I wrote before, I think this IDE endian problem still exists in
current 2.4 tree too. Please refer my 02/26 mail for this topic.
<http://www.linux-mips.org/archives/linux-mips/2004-02/msg00219.html>
Thank you.
---
Atsushi Nemoto
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: IDE woos in BE mode 2.6 kernel
2004-09-18 14:19 ` Atsushi Nemoto
@ 2004-09-24 23:40 ` Manish Lachwani
2004-09-25 14:41 ` Atsushi Nemoto
0 siblings, 1 reply; 6+ messages in thread
From: Manish Lachwani @ 2004-09-24 23:40 UTC (permalink / raw)
To: Atsushi Nemoto; +Cc: linux-mips
[-- Attachment #1: Type: text/plain, Size: 3960 bytes --]
Hello !
These changes below work and attached is the patch based on your
suggestion. However, I have made changes to include/asm-mips/ide.h since
I think there may be problems with other MIPS boards to in BE mode.
And, I have not included the (dma_cache_wback) in the patch.
Thanks
Manish
Atsushi Nemoto wrote:
>>>>>>On Fri, 17 Sep 2004 12:18:37 -0700, Manish Lachwani <mlachwani@mvista.com> said:
>>>>>>
>>>>>>
>
>mlachwani> In response to Jun Suns mail sent on 06/24/2004
>
>jsun> Anybody has tried IDE disks in big endian mode with 2.6
>jsun> kernel? I seem to have troubles with Malta board.
>...
>mlachwani> The following patch gets the Malta to work well. However,
>mlachwani> this patch introduces board specific changes in the IDE
>mlachwani> subsystem. This is not a final patch but maybe there can
>mlachwani> be a better approach to this issue
>
>FYI, here is my approach. Not so beautiful but less intrusive...
>
>1. copy include/asm-mips/mach-generic/ide.h to my mach-xxx directory.
>2. add following lines to include/asm-mips/mach-xxx/ide.h
>--- begin ---
>/* get rid of defs from io.h - ide has its private and conflicting versions */
>#ifdef insb
>#undef insb
>#endif
>#ifdef outsb
>#undef outsb
>#endif
>#ifdef insw
>#undef insw
>#endif
>#ifdef outsw
>#undef outsw
>#endif
>#ifdef insl
>#undef insl
>#endif
>#ifdef outsl
>#undef outsl
>#endif
>
>#define insb(port, addr, count) ___ide_insb(port, addr, count)
>#define insw(port, addr, count) ___ide_insw(port, addr, count)
>#define insl(port, addr, count) ___ide_insl(port, addr, count)
>#define outsb(port, addr, count) ___ide_outsb(port, addr, count)
>#define outsw(port, addr, count) ___ide_outsw(port, addr, count)
>#define outsl(port, addr, count) ___ide_outsl(port, addr, count)
>
>static inline void ___ide_insb(unsigned long port, void *addr, unsigned int count)
>{
> unsigned long start = (unsigned long)addr;
> unsigned long size = (unsigned long)count;
> while (count--) {
> *(u16 *)addr = *(volatile u8 *)(mips_io_port_base + port);
> addr++;
> }
> if (cpu_has_dc_aliases)
> dma_cache_wback((unsigned long)start, size);
>}
>
>static inline void ___ide_outsb(unsigned long port, void *addr, unsigned int count)
>{
> while (count--) {
> *(volatile u8 *)(mips_io_port_base + port) = *(u8 *)addr;
> addr++;
> }
>}
>
>static inline void ___ide_insw(unsigned long port, void *addr, unsigned int count)
>{
> unsigned long start = (unsigned long)addr;
> unsigned long size = (unsigned long)count * 2;
> while (count--) {
> *(u16 *)addr = *(volatile u16 *)(mips_io_port_base + port);
> addr += 2;
> }
> if (cpu_has_dc_aliases)
> dma_cache_wback((unsigned long)start, size);
>}
>
>static inline void ___ide_outsw(unsigned long port, void *addr, unsigned int count)
>{
> while (count--) {
> *(volatile u16 *)(mips_io_port_base + port) = *(u16 *)addr;
> addr += 2;
> }
>}
>
>static inline void ___ide_insl(unsigned long port, void *addr, unsigned int count)
>{
> unsigned long start = (unsigned long)addr;
> unsigned long size = (unsigned long)count * 4;
> while (count--) {
> *(u32 *)addr = *(volatile u32 *)(mips_io_port_base + port);
> addr += 4;
> }
> if (cpu_has_dc_aliases)
> dma_cache_wback((unsigned long)start, size);
>}
>
>static inline void ___ide_outsl(unsigned long port, void *addr, unsigned int count)
>{
> while (count--) {
> *(volatile u32 *)(mips_io_port_base + port) = *(u32 *)addr;
> addr += 4;
> }
>}
>--- end ---
>
>Note that above codes include workarounds for PIO IDE cache problem
>(dma_cache_wback) though I'm not sure this workaround still needed.
>Please refer this ML thread for the workaround.
><http://www.linux-mips.org/archives/linux-mips/2004-03/msg00185.html>
>
>
>And as I wrote before, I think this IDE endian problem still exists in
>current 2.4 tree too. Please refer my 02/26 mail for this topic.
><http://www.linux-mips.org/archives/linux-mips/2004-02/msg00219.html>
>
>Thank you.
>
>---
>Atsushi Nemoto
>
>
[-- Attachment #2: patch-26-ide-malta --]
[-- Type: text/plain, Size: 2398 bytes --]
--- include/asm-mips/ide.h.orig 2004-09-16 15:41:00.000000000 -0700
+++ include/asm-mips/ide.h 2004-09-20 09:45:14.000000000 -0700
@@ -20,6 +20,91 @@
#define __ide_mm_outsw ide_outsw
#define __ide_mm_outsl ide_outsl
+#ifndef CONFIG_CPU_LITTLE_ENDIAN
+/*
+ * Only for the Big Endian systems, do not do the swapping.
+ * We cannot turn off the CONFIG_SWAP_IO_SPACE since the
+ * other subsystems need it. Hence we need this approach for
+ * IDE only - Manish Lachwani (mlachwani@mvista.com)
+ */
+extern const unsigned long mips_io_port_base;
+
+#ifdef insb
+#undef insb
+#endif
+#ifdef outsb
+#undef outsb
+#endif
+#ifdef insw
+#undef insw
+#endif
+#ifdef outsw
+#undef outsw
+#endif
+#ifdef insl
+#undef insl
+#endif
+#ifdef outsl
+#undef outsl
+#endif
+
+#define insb(port, addr, count) ___ide_insb(port, addr, count)
+#define insw(port, addr, count) ___ide_insw(port, addr, count)
+#define insl(port, addr, count) ___ide_insl(port, addr, count)
+#define outsb(port, addr, count) ___ide_outsb(port, addr, count)
+#define outsw(port, addr, count) ___ide_outsw(port, addr, count)
+#define outsl(port, addr, count) ___ide_outsl(port, addr, count)
+
+static inline void ___ide_insb(unsigned long port, void *addr, unsigned int count)
+{
+ while (count--) {
+ *(u16 *)addr = *(volatile u8 *)(mips_io_port_base + port);
+ addr++;
+ }
+}
+
+static inline void ___ide_outsb(unsigned long port, void *addr, unsigned int count)
+{
+ while (count--) {
+ *(volatile u8 *)(mips_io_port_base + port) = *(u8 *)addr;
+ addr++;
+ }
+}
+
+static inline void ___ide_insw(unsigned long port, void *addr, unsigned int count)
+{
+ while (count--) {
+ *(u16 *)addr = *(volatile u16 *)(mips_io_port_base + port);
+ addr += 2;
+ }
+}
+
+static inline void ___ide_outsw(unsigned long port, void *addr, unsigned int count)
+{
+ while (count--) {
+ *(volatile u16 *)(mips_io_port_base + port) = *(u16 *)addr;
+ addr += 2;
+ }
+}
+
+static inline void ___ide_insl(unsigned long port, void *addr, unsigned int count)
+{
+ while (count--) {
+ *(u32 *)addr = *(volatile u32 *)(mips_io_port_base + port);
+ addr += 4;
+ }
+}
+
+static inline void ___ide_outsl(unsigned long port, void *addr, unsigned int count)
+{
+ while (count--) {
+ *(volatile u32 *)(mips_io_port_base + port) = *(u32 *)addr;
+ addr += 4;
+ }
+}
+
+#endif /* CONFIG_LITTLE_ENDIAN */
+
#endif /* __KERNEL__ */
#endif /* __ASM_IDE_H */
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: IDE woos in BE mode 2.6 kernel
2004-09-24 23:40 ` Manish Lachwani
@ 2004-09-25 14:41 ` Atsushi Nemoto
0 siblings, 0 replies; 6+ messages in thread
From: Atsushi Nemoto @ 2004-09-25 14:41 UTC (permalink / raw)
To: mlachwani; +Cc: linux-mips
>>>>> On Fri, 24 Sep 2004 16:40:25 -0700, Manish Lachwani <mlachwani@mvista.com> said:
mlachwani> These changes below work and attached is the patch based on
mlachwani> your suggestion. However, I have made changes to
mlachwani> include/asm-mips/ide.h since I think there may be problems
mlachwani> with other MIPS boards to in BE mode. And, I have not
mlachwani> included the (dma_cache_wback) in the patch.
Hmm, I think declaration of mips_io_port_base is not needed since
asm/io.h must be included before asm/ide.h. If asm/io.h was not
included first, ide.h can not override these functions anyway.
Also, moving the fixup block before "#include <ide.h>" will give a
chance to override these functions again in mach-dependent ide.h. (for
more weired hardware)
---
Atsushi Nemoto
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-09-25 14:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-17 19:18 IDE woos in BE mode 2.6 kernel Manish Lachwani
2004-09-18 14:19 ` Atsushi Nemoto
2004-09-24 23:40 ` Manish Lachwani
2004-09-25 14:41 ` Atsushi Nemoto
-- strict thread matches above, loose matches on Subject: below --
2004-06-24 23:45 Jun Sun
2004-06-25 8:45 ` Geert Uytterhoeven
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.