Hello Russel,
Russell King wrote:
> On Wed, Apr 11, 2001 at 01:12:28AM +0200, Klaus Borchers wrote:
> > Unless this changed from Kernel 2.2 to 2,4, I think the main problem is that
> > /dev/mem only maps physical *RAM* (0xc0000000 + xMb, possibly with holes in it
> > if you use several banks on an SA1110).
> No. You can map any physical address using /dev/mem. Pass the physical
> address as the offset in your mmap() call. In order for it not to be cached
> or buffered, open /dev/mem with the O_SYNC flag.
Sorry, I goofed that up.
I just followed the call-chain for read_mem rather than mmap-mem :
linux/drivers/char/mem.c:
static ssize_t read_mem(struct file * file, char * buf, size_t count, loff_t *ppos)
{ ....
if (copy_to_user(buf, __va(p), count))
return -EFAULT;
... }
the __va - macro is defined in include/asm-arm/page.h :
#define __va(x) ((void *)__phys_to_virt((unsigned long)(x)))
and then in include/asm-arm/arch-sa1100/memory.h :
define __phys_to_virt(x) (((x) & 0xe7ffffff) | ((x) & 0x18000000) >> 2)
/* This removes 96MB "holes" from 4 128MB-Banks of DRAM with 32MB each,
mapping c0/c8/d0/d8 to c0/c2/c4/c6
*/
However, virt_to_phys would convert IO-Adresses 0x9000???? to 0x8400????,
which is somewhere in user-space.
mmap, on the other hand, uses remap_page_range, which does not need to convert to
virtual adresses,
so it should work with any physical address.
Does this all mean that reading /dev/mem gets something else as mmapping /dev/mem,
or did I confuse something?
Best regards,
Klaus
--
Mobotix AG
Klaus Borchers
Wingertsweilerhof 6
D-67724 Hoeringen
Germany
Tel: +49 (6302) 9223-88
Fax: +49 (6302) 9223-70
E-Mail: [EMAIL PROTECTED]
_______________________________________________
http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
Please visit the above address for information on this list.