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 |
Paul Mundt | 51becfd | 2010-02-17 15:33:30 +0900 | [diff] [blame] | 14 | |
| 15 | #define NR_PMB_ENTRIES 16 |
| 16 | |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 17 | #define PMB_E_MASK 0x0000000f |
| 18 | #define PMB_E_SHIFT 8 |
| 19 | |
Matt Fleming | 20b5014 | 2009-10-06 21:22:33 +0000 | [diff] [blame] | 20 | #define PMB_PFN_MASK 0xff000000 |
| 21 | |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 22 | #define PMB_SZ_16M 0x00000000 |
| 23 | #define PMB_SZ_64M 0x00000010 |
| 24 | #define PMB_SZ_128M 0x00000080 |
| 25 | #define PMB_SZ_512M 0x00000090 |
| 26 | #define PMB_SZ_MASK PMB_SZ_512M |
| 27 | #define PMB_C 0x00000008 |
| 28 | #define PMB_WT 0x00000001 |
| 29 | #define PMB_UB 0x00000200 |
Paul Mundt | efd54ea | 2010-02-16 18:39:30 +0900 | [diff] [blame] | 30 | #define PMB_CACHE_MASK (PMB_C | PMB_WT | PMB_UB) |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 31 | #define PMB_V 0x00000100 |
| 32 | |
| 33 | #define PMB_NO_ENTRY (-1) |
| 34 | |
Francesco VIRLINZI | 3b4df71 | 2009-03-24 13:30:01 +0000 | [diff] [blame] | 35 | #ifndef __ASSEMBLY__ |
Matt Fleming | 46c4e5d | 2010-01-15 08:00:45 +0900 | [diff] [blame] | 36 | #include <linux/errno.h> |
Paul Mundt | 2efa53b | 2010-01-20 16:40:48 +0900 | [diff] [blame] | 37 | #include <linux/threads.h> |
Paul Mundt | 7bdda62 | 2010-02-17 13:23:00 +0900 | [diff] [blame] | 38 | #include <asm/page.h> |
Francesco VIRLINZI | 3b4df71 | 2009-03-24 13:30:01 +0000 | [diff] [blame] | 39 | |
| 40 | /* Default "unsigned long" context */ |
| 41 | typedef unsigned long mm_context_id_t[NR_CPUS]; |
| 42 | |
| 43 | typedef struct { |
| 44 | #ifdef CONFIG_MMU |
| 45 | mm_context_id_t id; |
| 46 | void *vdso; |
| 47 | #else |
| 48 | unsigned long end_brk; |
| 49 | #endif |
| 50 | #ifdef CONFIG_BINFMT_ELF_FDPIC |
| 51 | unsigned long exec_fdpic_loadmap; |
| 52 | unsigned long interp_fdpic_loadmap; |
| 53 | #endif |
| 54 | } mm_context_t; |
| 55 | |
Paul Mundt | a0ab366 | 2010-01-13 18:31:48 +0900 | [diff] [blame] | 56 | #ifdef CONFIG_PMB |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 57 | /* arch/sh/mm/pmb.c */ |
Paul Mundt | 2efa53b | 2010-01-20 16:40:48 +0900 | [diff] [blame] | 58 | bool __in_29bit_mode(void); |
Paul Mundt | 90e7d64 | 2010-02-23 16:20:53 +0900 | [diff] [blame] | 59 | |
| 60 | void pmb_init(void); |
| 61 | int pmb_bolt_mapping(unsigned long virt, phys_addr_t phys, |
| 62 | unsigned long size, pgprot_t prot); |
| 63 | void __iomem *pmb_remap_caller(phys_addr_t phys, unsigned long size, |
| 64 | pgprot_t prot, void *caller); |
| 65 | int pmb_unmap(void __iomem *addr); |
| 66 | |
Paul Mundt | a0ab366 | 2010-01-13 18:31:48 +0900 | [diff] [blame] | 67 | #else |
Paul Mundt | 90e7d64 | 2010-02-23 16:20:53 +0900 | [diff] [blame] | 68 | |
Paul Mundt | 089b43f | 2010-03-10 16:29:48 +0900 | [diff] [blame] | 69 | static inline int |
| 70 | pmb_bolt_mapping(unsigned long virt, phys_addr_t phys, |
| 71 | unsigned long size, pgprot_t prot) |
| 72 | { |
| 73 | return -EINVAL; |
| 74 | } |
| 75 | |
Paul Mundt | 90e7d64 | 2010-02-23 16:20:53 +0900 | [diff] [blame] | 76 | static inline void __iomem * |
| 77 | pmb_remap_caller(phys_addr_t phys, unsigned long size, |
| 78 | pgprot_t prot, void *caller) |
| 79 | { |
| 80 | return NULL; |
| 81 | } |
| 82 | |
| 83 | static inline int pmb_unmap(void __iomem *addr) |
Paul Mundt | a0ab366 | 2010-01-13 18:31:48 +0900 | [diff] [blame] | 84 | { |
Matt Fleming | 46c4e5d | 2010-01-15 08:00:45 +0900 | [diff] [blame] | 85 | return -EINVAL; |
Paul Mundt | a0ab366 | 2010-01-13 18:31:48 +0900 | [diff] [blame] | 86 | } |
| 87 | |
Paul Mundt | d01447b | 2010-02-18 18:13:51 +0900 | [diff] [blame] | 88 | #define pmb_init(addr) do { } while (0) |
Paul Mundt | a0ab366 | 2010-01-13 18:31:48 +0900 | [diff] [blame] | 89 | |
Paul Mundt | 2efa53b | 2010-01-20 16:40:48 +0900 | [diff] [blame] | 90 | #ifdef CONFIG_29BIT |
| 91 | #define __in_29bit_mode() (1) |
| 92 | #else |
| 93 | #define __in_29bit_mode() (0) |
| 94 | #endif |
| 95 | |
| 96 | #endif /* CONFIG_PMB */ |
Paul Mundt | 90e7d64 | 2010-02-23 16:20:53 +0900 | [diff] [blame] | 97 | |
| 98 | static inline void __iomem * |
| 99 | pmb_remap(phys_addr_t phys, unsigned long size, pgprot_t prot) |
| 100 | { |
| 101 | return pmb_remap_caller(phys, size, prot, __builtin_return_address(0)); |
| 102 | } |
| 103 | |
Francesco VIRLINZI | 3b4df71 | 2009-03-24 13:30:01 +0000 | [diff] [blame] | 104 | #endif /* __ASSEMBLY__ */ |
Paul Mundt | 0c7b1df | 2006-09-27 15:08:07 +0900 | [diff] [blame] | 105 | |
| 106 | #endif /* __MMU_H */ |