Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __MMU_H |
| 2 | #define __MMU_H |
| 3 | |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 4 | /* |
| 5 | * Privileged Space Mapping Buffer (PMB) definitions |
| 6 | */ |
| 7 | #define PMB_PASCR 0xff000070 |
| 8 | #define PMB_IRMCR 0xff000078 |
| 9 | |
Matt Fleming | 1f69b6a | 2009-10-06 21:22:25 +0000 | [diff] [blame] | 10 | #define PASCR_SE 0x80000000 |
| 11 | |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 12 | #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 Fleming | 20b5014 | 2009-10-06 21:22:33 +0000 | [diff] [blame] | 18 | #define PMB_PFN_MASK 0xff000000 |
| 19 | |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 20 | #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 |
| 28 | #define PMB_V 0x00000100 |
| 29 | |
| 30 | #define PMB_NO_ENTRY (-1) |
| 31 | |
Francesco VIRLINZI | 3b4df71 | 2009-03-24 13:30:01 +0000 | [diff] [blame] | 32 | #ifndef __ASSEMBLY__ |
Matt Fleming | 46c4e5d | 2010-01-15 08:00:45 +0900 | [diff] [blame] | 33 | #include <linux/errno.h> |
Paul Mundt | 2efa53b | 2010-01-20 16:40:48 +0900 | [diff] [blame] | 34 | #include <linux/threads.h> |
Francesco VIRLINZI | 3b4df71 | 2009-03-24 13:30:01 +0000 | [diff] [blame] | 35 | |
| 36 | /* Default "unsigned long" context */ |
| 37 | typedef unsigned long mm_context_id_t[NR_CPUS]; |
| 38 | |
| 39 | typedef struct { |
| 40 | #ifdef CONFIG_MMU |
| 41 | mm_context_id_t id; |
| 42 | void *vdso; |
| 43 | #else |
| 44 | unsigned long end_brk; |
| 45 | #endif |
| 46 | #ifdef CONFIG_BINFMT_ELF_FDPIC |
| 47 | unsigned long exec_fdpic_loadmap; |
| 48 | unsigned long interp_fdpic_loadmap; |
| 49 | #endif |
| 50 | } mm_context_t; |
| 51 | |
Paul Mundt | d7cdc9e | 2006-09-27 15:16:42 +0900 | [diff] [blame] | 52 | struct pmb_entry; |
| 53 | |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 54 | struct pmb_entry { |
| 55 | unsigned long vpn; |
| 56 | unsigned long ppn; |
| 57 | unsigned long flags; |
| 58 | |
| 59 | /* |
| 60 | * 0 .. NR_PMB_ENTRIES for specific entry selection, or |
| 61 | * PMB_NO_ENTRY to search for a free one |
| 62 | */ |
| 63 | int entry; |
Paul Mundt | d7cdc9e | 2006-09-27 15:16:42 +0900 | [diff] [blame] | 64 | |
| 65 | struct pmb_entry *next; |
| 66 | /* Adjacent entry link for contiguous multi-entry mappings */ |
| 67 | struct pmb_entry *link; |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 68 | }; |
| 69 | |
Paul Mundt | a0ab366 | 2010-01-13 18:31:48 +0900 | [diff] [blame] | 70 | #ifdef CONFIG_PMB |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 71 | /* arch/sh/mm/pmb.c */ |
Paul Mundt | d7cdc9e | 2006-09-27 15:16:42 +0900 | [diff] [blame] | 72 | long pmb_remap(unsigned long virt, unsigned long phys, |
| 73 | unsigned long size, unsigned long flags); |
| 74 | void pmb_unmap(unsigned long addr); |
Matt Fleming | 8386aeb | 2009-10-06 21:22:28 +0000 | [diff] [blame] | 75 | int pmb_init(void); |
Paul Mundt | 2efa53b | 2010-01-20 16:40:48 +0900 | [diff] [blame] | 76 | bool __in_29bit_mode(void); |
Paul Mundt | a0ab366 | 2010-01-13 18:31:48 +0900 | [diff] [blame] | 77 | #else |
| 78 | static inline long pmb_remap(unsigned long virt, unsigned long phys, |
| 79 | unsigned long size, unsigned long flags) |
| 80 | { |
Matt Fleming | 46c4e5d | 2010-01-15 08:00:45 +0900 | [diff] [blame] | 81 | return -EINVAL; |
Paul Mundt | a0ab366 | 2010-01-13 18:31:48 +0900 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | static inline void pmb_unmap(unsigned long addr) |
| 85 | { |
| 86 | } |
| 87 | |
| 88 | static inline int pmb_init(void) |
| 89 | { |
| 90 | return -ENODEV; |
| 91 | } |
Paul Mundt | a0ab366 | 2010-01-13 18:31:48 +0900 | [diff] [blame] | 92 | |
Paul Mundt | 2efa53b | 2010-01-20 16:40:48 +0900 | [diff] [blame] | 93 | #ifdef CONFIG_29BIT |
| 94 | #define __in_29bit_mode() (1) |
| 95 | #else |
| 96 | #define __in_29bit_mode() (0) |
| 97 | #endif |
| 98 | |
| 99 | #endif /* CONFIG_PMB */ |
Francesco VIRLINZI | 3b4df71 | 2009-03-24 13:30:01 +0000 | [diff] [blame] | 100 | #endif /* __ASSEMBLY__ */ |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 101 | |
| 102 | #endif /* __MMU_H */ |