Mylex lne390 patch (without alignment change)

Carsten Jacobi (carsten@jakes.kawo1.rwth-aachen.de)
Sun, 09 Aug 1998 11:54:14 +0200 (MET DST)


This message is in MIME format
--_=XFMail.1.3.p0.Linux:980809115414:1056=_
Content-Type: text/plain; charset=us-ascii

It works, finally!

I have dropped the idea with the alignment of an ethernet packet and want to
introduce a new call to "io.c" for jensen-boards:

memcpy_toio_g32a(.....)

The call is the same as memcpy_toio, but it combines to 16-bit words and makes
one 32-bit access. The attached patch activates this call only if the variable
"CONFIG_ALPHA_JENSEN" is set.
By the way I must send my congratulations to Paul Gortmaker!

> You can try <http://www.mylex.com> if you want more info, as I´ve
> never seen one of these cards. :)

Unbelievable! I have this cards and my patch changes only five lines in your
source to make the driver run! I wonder how you have come so far without
testing.

There are still two other patches attached. I had problems to boot the kernel
files because the elf-header is longer than 1K. It sounds strange, but aboot
won´t boot a kernel with such a long header. This is why I would like to link
the kernel with the "-N" option for Jensen boards.

The last patch is just a hint, it is not a serious patch! I had problems to
compile mm/page_alloc.c with egcs on my alpha. The compiler crashes with
unresolved insns. What means "__builtin_return(0)" in that source? I have
replaced the call with a simple "0", but this is not the programmers intention
I guess.

Allright, then I have still problem with the bridging with hacker kernels on my
alpha, but I will try to find out more about the problem by myself ...

Carsten

----------------------------------
E-Mail: Carsten Jacobi <carsten@jakes.kawo1.rwth-aachen.de>
Date: 09-Aug-98
Time: 09-Aug-9

This message was sent by XFMail
----------------------------------

--_=XFMail.1.3.p0.Linux:980809115414:1056=_
Content-Disposition: attachment; filename="lne390-patch"
Content-Transfer-Encoding: 7bit
Content-Description: lne390-patch
Content-Type: text/plain; charset=us-ascii; name=lne390-patch; SizeOnDisk=3813

diff -urN linux-2.1.115.orig/arch/alpha/kernel/alpha_ksyms.c linux-2.1.115/arch/
alpha/kernel/alpha_ksyms.c
--- linux-2.1.115.orig/arch/alpha/kernel/alpha_ksyms.c Sun Aug 9 00:01:31 1998
+++ linux-2.1.115/arch/alpha/kernel/alpha_ksyms.c Sun Aug 9 10:50:49 1998
@@ -64,6 +64,9 @@
EXPORT_SYMBOL(_writel);
EXPORT_SYMBOL(_memcpy_fromio);
EXPORT_SYMBOL(_memcpy_toio);
+#ifdef CONFIG_ALPHA_JENSEN
+EXPORT_SYMBOL (_memcpy_toio_g32a);
+#endif
EXPORT_SYMBOL(_memset_c_io);
EXPORT_SYMBOL(insb);
EXPORT_SYMBOL(insw);
diff -urN linux-2.1.115.orig/arch/alpha/lib/io.c linux-2.1.115/arch/alpha/lib/io
.c
--- linux-2.1.115.orig/arch/alpha/lib/io.c Sun Aug 9 00:01:31 1998
+++ linux-2.1.115/arch/alpha/lib/io.c Sun Aug 9 10:58:39 1998
@@ -468,6 +468,30 @@
}
}

+#ifdef CONFIG_ALPHA_JENSEN
+/* Special memcopy for EISA-Cards that permit only
+ * 32-bit accesses. Two 16-bit words are combined and
+ * written as one 32-bit word to the IO space.
+ */
+
+void _memcpy_toio_g32(unsigned long to, void * from, long count)
+{
+ if ((((long)from&1)!=0)&&((to&3)!=0)&&((count&3)!=0))
+ {
+ printk ("memcpy_toio_g32: Unaligned Data!\n");
+ return;
+ }
+
+ count-=4;
+ do {
+ __writelua(*(u16 *)from, *(u16 *)(from+2), to);
+ count -= 4;
+ to += 4;
+ from += 4;
+ } while (count >= 0);
+}
+#endif
+
/*
* "memset" on IO memory space.
* This needs to be optimized.
diff -urN linux-2.1.115.orig/drivers/net/lne390.c linux-2.1.115/drivers/net/lne3
90.c
--- linux-2.1.115.orig/drivers/net/lne390.c Sun Aug 9 00:00:56 1998
+++ linux-2.1.115/drivers/net/lne390.c Sun Aug 9 11:03:36 1998
@@ -194,7 +194,7 @@
}
printk(" IRQ %d,", dev->irq);

- if (request_irq(dev->irq, ei_interrupt, 0, "lne390", NULL)) {
+ if (request_irq(dev->irq, ei_interrupt, 0, "lne390", dev)) {
printk (" unable to get IRQ %d.\n", dev->irq);
kfree(dev->priv);
dev->priv = NULL;
@@ -348,6 +348,14 @@
unsigned long shmem = dev->mem_start + ((start_page - LNE390_START_PG)<<8);

count = (count + 3) & ~3; /* Round up to doubleword */
+
+#ifdef CONFIG_ALPHA_JENSEN
+ if (((long)buf&3)!=0) {
+ memcpy_toio_g32a(shmem, buf, count);
+ return;
+ }
+#endif
+
memcpy_toio(shmem, buf, count);
}

diff -urN linux-2.1.115.orig/include/asm-alpha/io.h linux-2.1.115/include/asm-al
pha/io.h
--- linux-2.1.115.orig/include/asm-alpha/io.h Sun Aug 9 00:00:28 1998
+++ linux-2.1.115/include/asm-alpha/io.h Sun Aug 9 10:58:44 1998
@@ -231,12 +231,19 @@
*/
extern void _memcpy_fromio(void *, unsigned long, long);
extern void _memcpy_toio(unsigned long, void *, long);
+#ifdef CONFIG_ALPHA_JENSEN
+extern void _memcpy_toio_g32a(unsigned long, void *, long);
+#endif
extern void _memset_c_io(unsigned long, unsigned long, long);

#define memcpy_fromio(to,from,len) \
_memcpy_fromio((to),(unsigned long)(from),(len))
#define memcpy_toio(to,from,len) \
_memcpy_toio((unsigned long)(to),(from),(len))
+#ifdef CONFIG_ALPHA_JENSEN
+#define memcpy_toio_g32a(to,from,len) \
+ _memcpy_toio_g32a((unsigned long)(to),(from),(len))
+#endif
#define memset_io(addr,c,len) \
_memset_c_io((unsigned long)(addr),0x0101010101010101UL*(u8)(c),(len))

diff -urN linux-2.1.115.orig/include/asm-alpha/jensen.h linux-2.1.115/include/as
m-alpha/jensen.h
--- linux-2.1.115.orig/include/asm-alpha/jensen.h Sun Aug 9 00:00:28 1998
+++ linux-2.1.115/include/asm-alpha/jensen.h Sun Aug 9 10:50:46 1998
@@ -262,6 +262,13 @@
*(volatile unsigned int *) ((addr << 7) + EISA_MEM + 0x60) = b;
}

+extern inline void __writelua(unsigned short b_a, unsigned short b_b, unsigned
long addr)
+{
+ __set_hae(addr);
+ addr &= __HAE_MASK;
+ *(volatile unsigned int *) ((addr << 7) + EISA_MEM + 0x60) = (b_a&0xffff) | (b
_b << 16);
+}
+
extern inline void __writeq(unsigned long b, unsigned long addr)
{
__set_hae(addr);

--_=XFMail.1.3.p0.Linux:980809115414:1056=_
Content-Disposition: attachment; filename="jensen_link-patch"
Content-Transfer-Encoding: 7bit
Content-Description: jensen_link-patch
Content-Type: text/plain;
charset=us-ascii; name=jensen_link-patch; SizeOnDisk=614

diff -urN linux-2.1.115.orig/arch/alpha/Makefile linux-2.1.115/arch/alpha/Makefi
le
--- linux-2.1.115.orig/arch/alpha/Makefile Sun Aug 9 00:01:31 1998
+++ linux-2.1.115/arch/alpha/Makefile Sun Aug 9 00:11:44 1998
@@ -16,7 +16,11 @@
else
elf=$(shell if $(LD) --help | grep elf64alpha >/dev/null; then echo yes; fi)
ifeq ($(elf),yes)
- LINKFLAGS = -static -T arch/alpha/vmlinux.lds
+ ifdef CONFIG_ALPHA_JENSEN
+ LINKFLAGS = -static -T arch/alpha/vmlinux.lds -N
+ else
+ LINKFLAGS = -static -T arch/alpha/vmlinux.lds
+ endif
else
LINKFLAGS = -static -T arch/alpha/vmlinux.lds -N
endif

--_=XFMail.1.3.p0.Linux:980809115414:1056=_
Content-Disposition: attachment; filename="maybe_patch"
Content-Transfer-Encoding: 7bit
Content-Description: A hint! Just take a look at it ...
Content-Type: text/plain; charset=us-ascii; name=maybe_patch; SizeOnDisk=1086

diff -urN linux-2.1.115.orig/mm/page_alloc.c linux-2.1.115/mm/page_alloc.c
--- linux-2.1.115.orig/mm/page_alloc.c Sun Aug 9 00:00:19 1998
+++ linux-2.1.115/mm/page_alloc.c Sun Aug 9 00:11:45 1998
@@ -164,9 +164,15 @@
free_pages_ok(page->map_nr, 0);
return;
}
+#ifdef CONFIG_ALPHA_EV4
+ if (PageSwapCache(page) && atomic_read(&page->count) == 1)
+ printk(KERN_WARNING "VM: Releasing swap cache page at %p",
+ 0);
+#else
if (PageSwapCache(page) && atomic_read(&page->count) == 1)
printk(KERN_WARNING "VM: Releasing swap cache page at %p",
__builtin_return_address(0));
+#endif
}

void free_pages(unsigned long addr, unsigned long order)
@@ -183,10 +189,17 @@
free_pages_ok(map_nr, order);
return;
}
+#ifdef CONFIG_ALPHA_EV4
+ if (PageSwapCache(map) && atomic_read(&map->count) == 1)
+ printk(KERN_WARNING
+ "VM: Releasing swap cache pages at %p",
+ 0);
+#else
if (PageSwapCache(map) && atomic_read(&map->count) == 1)
printk(KERN_WARNING
"VM: Releasing swap cache pages at %p",
__builtin_return_address(0));
+#endif
}
}

--_=XFMail.1.3.p0.Linux:980809115414:1056=_--
End of MIME message

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html