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
| Ingo Molnar | Re: [Announce] [patch] Modular Scheduler Core and Completely Fair Scheduler [CFS] |
| Greg Kroah-Hartman | [PATCH 014/196] kobject: remove incorrect comment in kobject_rename |
| Linus Torvalds | Linux 2.6.27-rc8 |
| Tony Lindgren | [PATCH 32/90] ARM: OMAP: Basic support for siemens sx1 |
git: | |
| Andy Parkins | svn:externals using git submodules |
| Peter Stahlir | Git as a filesystem |
| Jakub Narebski | Re: VCS comparison table |
| Linus Torvalds | Re: [kernel.org users] [RFD] On deprecating "git-foo" for builtins |
| GVG GVG | ssh_exchange_identification: Connection closed by remote host |
| Richard Stallman | Real men don't attack straw men |
| Alexey Suslikov | OT: OpenBSD on Asus eeePC |
| Marcos Laufer | dmesg IBM x3650 OpenBSD 4.3 |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Jozsef Kadlecsik | Re: TCP connection stalls under 2.6.24.7 |
| Jarek Poplawski | [PATCH take2][NET] ifb: set separate lockdep classes for queue locks |
| Stephen Hemminger | [RFC] TCP illinois max rtt aging |
