blob: 15a05b615ba7f60e293928723215c73e392362e8 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __MMU_H
2#define __MMU_H
3
Paul Mundt0c7b1df2006-09-27 15:08:07 +09004/*
5 * Privileged Space Mapping Buffer (PMB) definitions
6 */
7#define PMB_PASCR 0xff000070
8#define PMB_IRMCR 0xff000078
9
Matt Fleming1f69b6a2009-10-06 21:22:25 +000010#define PASCR_SE 0x80000000
11
Paul Mundt0c7b1df2006-09-27 15:08:07 +090012#define PMB_ADDR 0xf6100000
13#define PMB_DATA 0xf7100000
Paul Mundt51becfd2010-02-17 15:33:30 +090014
15#define NR_PMB_ENTRIES 16
16
Paul Mundt0c7b1df2006-09-27 15:08:07 +090017#define PMB_E_MASK 0x0000000f
18#define PMB_E_SHIFT 8
19
Matt Fleming20b50142009-10-06 21:22:33 +000020#define PMB_PFN_MASK 0xff000000
21
Paul Mundt0c7b1df2006-09-27 15:08:07 +090022#define PMB_SZ_16M 0x00000000
23#define PMB_SZ_64M 0x00000010
24#define PMB_SZ_128M 0x00000080
25#define PMB_SZ_512M 0x00000090
26#define PMB_SZ_MASK PMB_SZ_512M
27#define PMB_C 0x00000008
28#define PMB_WT 0x00000001
29#define PMB_UB 0x00000200
Paul Mundtefd54ea2010-02-16 18:39:30 +090030#define PMB_CACHE_MASK (PMB_C | PMB_WT | PMB_UB)
Paul Mundt0c7b1df2006-09-27 15:08:07 +090031#define PMB_V 0x00000100
32
33#define PMB_NO_ENTRY (-1)
34
Francesco VIRLINZI3b4df712009-03-24 13:30:01 +000035#ifndef __ASSEMBLY__
Matt Fleming46c4e5d2010-01-15 08:00:45 +090036#include <linux/errno.h>
Paul Mundt2efa53b2010-01-20 16:40:48 +090037#include <linux/threads.h>
Paul Mundt7bdda622010-02-17 13:23:00 +090038#include <asm/page.h>
Francesco VIRLINZI3b4df712009-03-24 13:30:01 +000039
40/* Default "unsigned long" context */
41typedef unsigned long mm_context_id_t[NR_CPUS];
42
43typedef struct {
44#ifdef CONFIG_MMU
45 mm_context_id_t id;
46 void *vdso;
47#else
48 unsigned long end_brk;
49#endif
50#ifdef CONFIG_BINFMT_ELF_FDPIC
51 unsigned long exec_fdpic_loadmap;
52 unsigned long interp_fdpic_loadmap;
53#endif
54} mm_context_t;
55
Paul Mundta0ab3662010-01-13 18:31:48 +090056#ifdef CONFIG_PMB
Paul Mundt0c7b1df2006-09-27 15:08:07 +090057/* arch/sh/mm/pmb.c */
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090058long pmb_remap(unsigned long virt, unsigned long phys,
Paul Mundt7bdda622010-02-17 13:23:00 +090059 unsigned long size, pgprot_t prot);
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090060void pmb_unmap(unsigned long addr);
Paul Mundtd01447b2010-02-18 18:13:51 +090061void pmb_init(void);
Paul Mundt2efa53b2010-01-20 16:40:48 +090062bool __in_29bit_mode(void);
Paul Mundta0ab3662010-01-13 18:31:48 +090063#else
64static inline long pmb_remap(unsigned long virt, unsigned long phys,
Paul Mundt7bdda622010-02-17 13:23:00 +090065 unsigned long size, pgprot_t prot)
Paul Mundta0ab3662010-01-13 18:31:48 +090066{
Matt Fleming46c4e5d2010-01-15 08:00:45 +090067 return -EINVAL;
Paul Mundta0ab3662010-01-13 18:31:48 +090068}
69
Paul Mundtd01447b2010-02-18 18:13:51 +090070#define pmb_unmap(addr) do { } while (0)
71#define pmb_init(addr) do { } while (0)
Paul Mundta0ab3662010-01-13 18:31:48 +090072
Paul Mundt2efa53b2010-01-20 16:40:48 +090073#ifdef CONFIG_29BIT
74#define __in_29bit_mode() (1)
75#else
76#define __in_29bit_mode() (0)
77#endif
78
79#endif /* CONFIG_PMB */
Francesco VIRLINZI3b4df712009-03-24 13:30:01 +000080#endif /* __ASSEMBLY__ */
Paul Mundt0c7b1df2006-09-27 15:08:07 +090081
82#endif /* __MMU_H */