blob: 151bc922701bb47d5a8f5d97cb13357c303203cf [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
14#define PMB_ENTRY_MAX 16
15#define PMB_E_MASK 0x0000000f
16#define PMB_E_SHIFT 8
17
Matt Fleming20b50142009-10-06 21:22:33 +000018#define PMB_PFN_MASK 0xff000000
19
Paul Mundt0c7b1df2006-09-27 15:08:07 +090020#define PMB_SZ_16M 0x00000000
21#define PMB_SZ_64M 0x00000010
22#define PMB_SZ_128M 0x00000080
23#define PMB_SZ_512M 0x00000090
24#define PMB_SZ_MASK PMB_SZ_512M
25#define PMB_C 0x00000008
26#define PMB_WT 0x00000001
27#define PMB_UB 0x00000200
Paul Mundtefd54ea2010-02-16 18:39:30 +090028#define PMB_CACHE_MASK (PMB_C | PMB_WT | PMB_UB)
Paul Mundt0c7b1df2006-09-27 15:08:07 +090029#define PMB_V 0x00000100
30
31#define PMB_NO_ENTRY (-1)
32
Francesco VIRLINZI3b4df712009-03-24 13:30:01 +000033#ifndef __ASSEMBLY__
Matt Fleming46c4e5d2010-01-15 08:00:45 +090034#include <linux/errno.h>
Paul Mundt2efa53b2010-01-20 16:40:48 +090035#include <linux/threads.h>
Paul Mundt7bdda622010-02-17 13:23:00 +090036#include <asm/page.h>
Francesco VIRLINZI3b4df712009-03-24 13:30:01 +000037
38/* Default "unsigned long" context */
39typedef unsigned long mm_context_id_t[NR_CPUS];
40
41typedef struct {
42#ifdef CONFIG_MMU
43 mm_context_id_t id;
44 void *vdso;
45#else
46 unsigned long end_brk;
47#endif
48#ifdef CONFIG_BINFMT_ELF_FDPIC
49 unsigned long exec_fdpic_loadmap;
50 unsigned long interp_fdpic_loadmap;
51#endif
52} mm_context_t;
53
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090054struct pmb_entry;
55
Paul Mundt0c7b1df2006-09-27 15:08:07 +090056struct pmb_entry {
57 unsigned long vpn;
58 unsigned long ppn;
59 unsigned long flags;
60
61 /*
62 * 0 .. NR_PMB_ENTRIES for specific entry selection, or
63 * PMB_NO_ENTRY to search for a free one
64 */
65 int entry;
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090066
67 struct pmb_entry *next;
68 /* Adjacent entry link for contiguous multi-entry mappings */
69 struct pmb_entry *link;
Paul Mundt0c7b1df2006-09-27 15:08:07 +090070};
71
Paul Mundta0ab3662010-01-13 18:31:48 +090072#ifdef CONFIG_PMB
Paul Mundt0c7b1df2006-09-27 15:08:07 +090073/* arch/sh/mm/pmb.c */
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090074long pmb_remap(unsigned long virt, unsigned long phys,
Paul Mundt7bdda622010-02-17 13:23:00 +090075 unsigned long size, pgprot_t prot);
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090076void pmb_unmap(unsigned long addr);
Matt Fleming8386aeb2009-10-06 21:22:28 +000077int pmb_init(void);
Paul Mundt2efa53b2010-01-20 16:40:48 +090078bool __in_29bit_mode(void);
Paul Mundta0ab3662010-01-13 18:31:48 +090079#else
80static inline long pmb_remap(unsigned long virt, unsigned long phys,
Paul Mundt7bdda622010-02-17 13:23:00 +090081 unsigned long size, pgprot_t prot)
Paul Mundta0ab3662010-01-13 18:31:48 +090082{
Matt Fleming46c4e5d2010-01-15 08:00:45 +090083 return -EINVAL;
Paul Mundta0ab3662010-01-13 18:31:48 +090084}
85
86static inline void pmb_unmap(unsigned long addr)
87{
88}
89
90static inline int pmb_init(void)
91{
92 return -ENODEV;
93}
Paul Mundta0ab3662010-01-13 18:31:48 +090094
Paul Mundt2efa53b2010-01-20 16:40:48 +090095#ifdef CONFIG_29BIT
96#define __in_29bit_mode() (1)
97#else
98#define __in_29bit_mode() (0)
99#endif
100
101#endif /* CONFIG_PMB */
Francesco VIRLINZI3b4df712009-03-24 13:30:01 +0000102#endif /* __ASSEMBLY__ */
Paul Mundt0c7b1df2006-09-27 15:08:07 +0900103
104#endif /* __MMU_H */