blob: cf47df79bb9415c43a310c16c3c93737ebc2c1d2 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __MMU_H
2#define __MMU_H
3
4#if !defined(CONFIG_MMU)
5
Linus Torvalds1da177e2005-04-16 15:20:36 -07006typedef struct {
Yoshinori Satoe96636c2006-09-27 17:21:02 +09007 struct vm_list_struct *vmlist;
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 unsigned long end_brk;
9} mm_context_t;
10
11#else
12
13/* Default "unsigned long" context */
Paul Mundt19f9a342006-09-27 18:33:49 +090014typedef unsigned long mm_context_id_t;
15
16typedef struct {
17 mm_context_id_t id;
18 void *vdso;
19} mm_context_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
21#endif /* CONFIG_MMU */
Paul Mundt0c7b1df2006-09-27 15:08:07 +090022
23/*
24 * Privileged Space Mapping Buffer (PMB) definitions
25 */
26#define PMB_PASCR 0xff000070
27#define PMB_IRMCR 0xff000078
28
29#define PMB_ADDR 0xf6100000
30#define PMB_DATA 0xf7100000
31#define PMB_ENTRY_MAX 16
32#define PMB_E_MASK 0x0000000f
33#define PMB_E_SHIFT 8
34
35#define PMB_SZ_16M 0x00000000
36#define PMB_SZ_64M 0x00000010
37#define PMB_SZ_128M 0x00000080
38#define PMB_SZ_512M 0x00000090
39#define PMB_SZ_MASK PMB_SZ_512M
40#define PMB_C 0x00000008
41#define PMB_WT 0x00000001
42#define PMB_UB 0x00000200
43#define PMB_V 0x00000100
44
45#define PMB_NO_ENTRY (-1)
46
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090047struct pmb_entry;
48
Paul Mundt0c7b1df2006-09-27 15:08:07 +090049struct pmb_entry {
50 unsigned long vpn;
51 unsigned long ppn;
52 unsigned long flags;
53
54 /*
55 * 0 .. NR_PMB_ENTRIES for specific entry selection, or
56 * PMB_NO_ENTRY to search for a free one
57 */
58 int entry;
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090059
60 struct pmb_entry *next;
61 /* Adjacent entry link for contiguous multi-entry mappings */
62 struct pmb_entry *link;
Paul Mundt0c7b1df2006-09-27 15:08:07 +090063};
64
65/* arch/sh/mm/pmb.c */
66int __set_pmb_entry(unsigned long vpn, unsigned long ppn,
67 unsigned long flags, int *entry);
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090068int set_pmb_entry(struct pmb_entry *pmbe);
Paul Mundt0c7b1df2006-09-27 15:08:07 +090069void clear_pmb_entry(struct pmb_entry *pmbe);
70struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
71 unsigned long flags);
72void pmb_free(struct pmb_entry *pmbe);
Paul Mundtd7cdc9e2006-09-27 15:16:42 +090073long pmb_remap(unsigned long virt, unsigned long phys,
74 unsigned long size, unsigned long flags);
75void pmb_unmap(unsigned long addr);
Paul Mundt0c7b1df2006-09-27 15:08:07 +090076
77#endif /* __MMU_H */
Linus Torvalds1da177e2005-04-16 15:20:36 -070078