login
Header Space

 
 

Re: [PATCH] lne390 and Jensen Alphas

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Al Viro <viro@...>
Cc: Florian Fainelli <florian.fainelli@...>, <netdev@...>
Date: Sunday, April 20, 2008 - 8:54 am

Hello,

first thanks for the feedback, I am still willing to deliver
a "decent" patch.

Al Viro wrote:
Tststs ... such strong words. But I see your point. As I look at it 
myself it doesn't appear to be clean style.
I admit this must be done using appropriate types. The patch was 
originally intended for kernel version 2.1.115 in 1998 and I just come 
back with it every 5 years because it haven't made it into the official 
source so far. Actually, I just took the memcpy_toio() function from 
arch/alpha/lib/io.c did some modifications to let it read from unaligned 
addresses and then just pasted it into the lne390.c source.
But for an official patch it should look better. Hmm, the 
get_unaligned(from) function seems indeed to be exactly what I need 
here. I guess that wasn't available 10 years before when I writed the 
original patch.
Only the lne390_block_output() routine has to be adjusted for all 
systems that have EISA slots and which use a memcpy_toio() function that 
copies 16bit aligned addresses with 16bit operations. I can't tell at 
once which other systems than CONFIG_ALPHA_JENSEN would match here. I 
guess HPPA and Silicon-Graphics (are there MIPS systems with EISA 
slots?) would be candidates.
The other #ifdef allows choosing arbitrary memory spaces for the shared 
mem buffer of the adapter. Also here I don't know how other non-x86 
architectures map the EISA memory space into their CPU address space.
Here is my next patch. I have removed the misleading casts. I have taken 
the memcpy_toio() function from arch/alpha/kernel/io.c (as I see the 
source file has moved from lib/ to kernel/) and did my little 
modification again:
--- lne390.c.orig       2008-04-20 14:25:32.000000000 +0200
+++ lne390.c    2008-04-20 14:49:21.000000000 +0200
@@ -242,6 +242,10 @@
        printk("%dkB memory at physical address %#lx\n",
                        LNE390_STOP_PG/4, dev->mem_start);

+#ifdef CONFIG_ALPHA_JENSEN
+       /* On the Jensen board EISA cards will see their own address
+        * space */
+#else
        /*
           BEWARE!! Some dain-bramaged EISA SCUs will allow you to put
           the card mem within the region covered by `normal' RAM  !!!
@@ -260,6 +264,7 @@
                        LNE390_STOP_PG/4, ei_status.mem);

        dev->mem_start = (unsigned long)ei_status.mem;
+#endif /* CONFIG_ALPHA_JENSEN */
        dev->mem_end = dev->mem_start + (LNE390_STOP_PG - 
LNE390_START_PG)*256;

        /* The 8390 offset is zero for the LNE390 */
@@ -372,7 +377,25 @@
        void __iomem *shmem = ei_status.mem + ((start_page - 
LNE390_START_PG)<<8);

        count = (count + 3) & ~3;     /* Round up to doubleword */
+#ifndef CONFIG_ALPHA_JENSEN
        memcpy_toio(shmem, buf, count);
+#else
+       /* The mylex lne390 adapter requires 32bit access (see above) 
for every
+        * operation to the shared mem buffer. Since the block buffer is 
hardly
+        * aligned to a 32bit boundary memcpy_toio() will use 16bit
+        * operations to access the buffer on alpha architectures (maybe 
also
+        * for others ... we must use something else here. */
+
+       const void *from = buf;
+       count -= 4;
+       do {
+               __raw_writel(*(const u32 *)get_unaligned(from), shmem);
+               count -= 4;
+               shmem += 4;
+               from += 4;
+       } while (count >= 0);
+#endif
+
 }

 static int lne390_open(struct net_device *dev)

Regards,

Carsten Jacobi
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] lne390 and Jensen Alphas, Carsten Jacobi, (Sat Mar 29, 10:48 am)
Re: [PATCH] lne390 and Jensen Alphas, Florian Fainelli, (Sat Mar 29, 2:32 pm)
Re: [PATCH] lne390 and Jensen Alphas, Carsten Jacobi, (Sun Apr 13, 5:06 pm)
Re: [PATCH] lne390 and Jensen Alphas, Al Viro, (Sun Apr 13, 6:11 pm)
Re: [PATCH] lne390 and Jensen Alphas, Carsten Jacobi, (Sun Apr 20, 8:54 am)
speck-geostationary