OSDN Git Service

metag: Memory handling
authorJames Hogan <james.hogan@imgtec.com>
Tue, 9 Oct 2012 09:54:17 +0000 (10:54 +0100)
committerJames Hogan <james.hogan@imgtec.com>
Sat, 2 Mar 2013 20:09:19 +0000 (20:09 +0000)
commit373cd784d0fc83f076c899ca7da50ecca7286e42
tree46165054cae3e5444a02ddd071e1979aa029fdf6
parentf5df8e268f749987c32c7eee001f7623fd7be69c
metag: Memory handling

Meta has instructions for accessing:
 - bytes        - GETB (1 byte)
 - words        - GETW (2 bytes)
 - doublewords  - GETD (4 bytes)
 - longwords    - GETL (8 bytes)

All accesses must be aligned. Unaligned accesses can be detected and
made to fault on Meta2, however it isn't possible to fix up unaligned
writes so we don't bother fixing up reads either.

This patch adds metag memory handling code including:
 - I/O memory (io.h, ioremap.c): Actually any virtual memory can be
   accessed with these helpers. A part of the non-MMUable address space
   is used for memory mapped I/O. The ioremap() function is implemented
   one to one for non-MMUable addresses.
 - User memory (uaccess.h, usercopy.c): User memory is directly
   accessible from privileged code.
 - Kernel memory (maccess.c): probe_kernel_write() needs to be
   overwridden to use the I/O functions when doing a simple aligned
   write to non-writecombined memory, otherwise the write may be split
   by the generic version.

Note that due to the fact that a portion of the virtual address space is
non-MMUable, and therefore always maps directly to the physical address
space, metag specific I/O functions are made available (metag_in32,
metag_out32 etc). These cast the address argument to a pointer so that
they can be used with raw physical addresses. These accessors are only
to be used for accessing fixed core Meta architecture registers in the
non-MMU region, and not for any SoC/peripheral registers.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
arch/metag/include/asm/io.h [new file with mode: 0644]
arch/metag/include/asm/uaccess.h [new file with mode: 0644]
arch/metag/lib/usercopy.c [new file with mode: 0644]
arch/metag/mm/ioremap.c [new file with mode: 0644]
arch/metag/mm/maccess.c [new file with mode: 0644]