Skip to content
  • James Hogan's avatar
    metag: Memory handling · 373cd784
    James Hogan authored
    
    
    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: default avatarJames Hogan <james.hogan@imgtec.com>
    373cd784