Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __MMU_H |
| 2 | #define __MMU_H |
| 3 | |
Paul Mundt | aec5e0e | 2006-12-25 09:51:47 +0900 | [diff] [blame] | 4 | /* Default "unsigned long" context */ |
| 5 | typedef unsigned long mm_context_id_t[NR_CPUS]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | typedef struct { |
Paul Mundt | aec5e0e | 2006-12-25 09:51:47 +0900 | [diff] [blame] | 8 | #ifdef CONFIG_MMU |
| 9 | mm_context_id_t id; |
| 10 | void *vdso; |
| 11 | #else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | unsigned long end_brk; |
Paul Mundt | aec5e0e | 2006-12-25 09:51:47 +0900 | [diff] [blame] | 13 | #endif |
Paul Mundt | 3bc24a1 | 2008-05-19 13:40:12 +0900 | [diff] [blame] | 14 | #ifdef CONFIG_BINFMT_ELF_FDPIC |
| 15 | unsigned long exec_fdpic_loadmap; |
| 16 | unsigned long interp_fdpic_loadmap; |
| 17 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | } mm_context_t; |
| 19 | |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 20 | /* |
| 21 | * Privileged Space Mapping Buffer (PMB) definitions |
| 22 | */ |
| 23 | #define PMB_PASCR 0xff000070 |
| 24 | #define PMB_IRMCR 0xff000078 |
| 25 | |
| 26 | #define PMB_ADDR 0xf6100000 |
| 27 | #define PMB_DATA 0xf7100000 |
| 28 | #define PMB_ENTRY_MAX 16 |
| 29 | #define PMB_E_MASK 0x0000000f |
| 30 | #define PMB_E_SHIFT 8 |
| 31 | |
| 32 | #define PMB_SZ_16M 0x00000000 |
| 33 | #define PMB_SZ_64M 0x00000010 |
| 34 | #define PMB_SZ_128M 0x00000080 |
| 35 | #define PMB_SZ_512M 0x00000090 |
| 36 | #define PMB_SZ_MASK PMB_SZ_512M |
| 37 | #define PMB_C 0x00000008 |
| 38 | #define PMB_WT 0x00000001 |
| 39 | #define PMB_UB 0x00000200 |
| 40 | #define PMB_V 0x00000100 |
| 41 | |
| 42 | #define PMB_NO_ENTRY (-1) |
| 43 | |
Paul Mundt | d7cdc9e | 2006-09-27 15:16:42 +0900 | [diff] [blame] | 44 | struct pmb_entry; |
| 45 | |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 46 | struct pmb_entry { |
| 47 | unsigned long vpn; |
| 48 | unsigned long ppn; |
| 49 | unsigned long flags; |
| 50 | |
| 51 | /* |
| 52 | * 0 .. NR_PMB_ENTRIES for specific entry selection, or |
| 53 | * PMB_NO_ENTRY to search for a free one |
| 54 | */ |
| 55 | int entry; |
Paul Mundt | d7cdc9e | 2006-09-27 15:16:42 +0900 | [diff] [blame] | 56 | |
| 57 | struct pmb_entry *next; |
| 58 | /* Adjacent entry link for contiguous multi-entry mappings */ |
| 59 | struct pmb_entry *link; |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | /* arch/sh/mm/pmb.c */ |
| 63 | int __set_pmb_entry(unsigned long vpn, unsigned long ppn, |
| 64 | unsigned long flags, int *entry); |
Paul Mundt | d7cdc9e | 2006-09-27 15:16:42 +0900 | [diff] [blame] | 65 | int set_pmb_entry(struct pmb_entry *pmbe); |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 66 | void clear_pmb_entry(struct pmb_entry *pmbe); |
| 67 | struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn, |
| 68 | unsigned long flags); |
| 69 | void pmb_free(struct pmb_entry *pmbe); |
Paul Mundt | d7cdc9e | 2006-09-27 15:16:42 +0900 | [diff] [blame] | 70 | long pmb_remap(unsigned long virt, unsigned long phys, |
| 71 | unsigned long size, unsigned long flags); |
| 72 | void pmb_unmap(unsigned long addr); |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 73 | |
| 74 | #endif /* __MMU_H */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | |