blob: eb0358c097d01a3c236b83400e03aa2ac5b757b7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __MMU_H
2#define __MMU_H
3
Paul Mundtaec5e0e2006-12-25 09:51:47 +09004/* Default "unsigned long" context */
5typedef unsigned long mm_context_id_t[NR_CPUS];
Linus Torvalds1da177e2005-04-16 15:20:36 -07006
Linus Torvalds1da177e2005-04-16 15:20:36 -07007typedef struct {
Paul Mundtaec5e0e2006-12-25 09:51:47 +09008#ifdef CONFIG_MMU
9 mm_context_id_t id;
10 void *vdso;
11#else
Yoshinori Satoe96636c2006-09-27 17:21:02 +090012 struct vm_list_struct *vmlist;
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 unsigned long end_brk;
Paul Mundtaec5e0e2006-12-25 09:51:47 +090014#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070015} mm_context_t;
16
Paul Mundt0c7b1df2006-09-27 15:08:07 +090017/*
18 * Privileged Space Mapping Buffer (PMB) definitions
19 */
20#define PMB_PASCR 0xff000070
21#define PMB_IRMCR 0xff000078
22
23#define PMB_ADDR 0xf6100000
24#define PMB_DATA 0xf7100000
25#define PMB_ENTRY_MAX 16
26#define PMB_E_MASK 0x0000000f
27#define PMB_E_SHIFT 8
28
29#define PMB_SZ_16M 0x00000000
30#define PMB_SZ_64M 0x00000010
31#define PMB_SZ_128M 0x00000080
32#define PMB_SZ_512M 0x00000090
33#define PMB_SZ_MASK PMB_SZ_512M
34#define PMB_C 0x00000008
35#define PMB_WT 0x00000001
36#define PMB_UB 0x00000200
37#define PMB_V 0x00000100
38
39#define PMB_NO_ENTRY (-1)
40
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090041struct pmb_entry;
42
Paul Mundt0c7b1df2006-09-27 15:08:07 +090043struct pmb_entry {
44 unsigned long vpn;
45 unsigned long ppn;
46 unsigned long flags;
47
48 /*
49 * 0 .. NR_PMB_ENTRIES for specific entry selection, or
50 * PMB_NO_ENTRY to search for a free one
51 */
52 int entry;
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090053
54 struct pmb_entry *next;
55 /* Adjacent entry link for contiguous multi-entry mappings */
56 struct pmb_entry *link;
Paul Mundt0c7b1df2006-09-27 15:08:07 +090057};
58
59/* arch/sh/mm/pmb.c */
60int __set_pmb_entry(unsigned long vpn, unsigned long ppn,
61 unsigned long flags, int *entry);
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090062int set_pmb_entry(struct pmb_entry *pmbe);
Paul Mundt0c7b1df2006-09-27 15:08:07 +090063void clear_pmb_entry(struct pmb_entry *pmbe);
64struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
65 unsigned long flags);
66void pmb_free(struct pmb_entry *pmbe);
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090067long pmb_remap(unsigned long virt, unsigned long phys,
68 unsigned long size, unsigned long flags);
69void pmb_unmap(unsigned long addr);
Paul Mundt0c7b1df2006-09-27 15:08:07 +090070
71#endif /* __MMU_H */
Linus Torvalds1da177e2005-04-16 15:20:36 -070072