| 
									
										
										
										
											2005-04-16 15:20:36 -07:00
										 |  |  | #ifndef __MMU_H
 | 
					
						
							|  |  |  | #define __MMU_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:08:07 +09:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Privileged Space Mapping Buffer (PMB) definitions | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #define PMB_PASCR		0xff000070
 | 
					
						
							|  |  |  | #define PMB_IRMCR		0xff000078
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-06 21:22:25 +00:00
										 |  |  | #define PASCR_SE		0x80000000
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:08:07 +09:00
										 |  |  | #define PMB_ADDR		0xf6100000
 | 
					
						
							|  |  |  | #define PMB_DATA		0xf7100000
 | 
					
						
							| 
									
										
										
										
											2010-02-17 15:33:30 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define NR_PMB_ENTRIES		16
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:08:07 +09:00
										 |  |  | #define PMB_E_MASK		0x0000000f
 | 
					
						
							|  |  |  | #define PMB_E_SHIFT		8
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-06 21:22:33 +00:00
										 |  |  | #define PMB_PFN_MASK		0xff000000
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:08:07 +09:00
										 |  |  | #define PMB_SZ_16M		0x00000000
 | 
					
						
							|  |  |  | #define PMB_SZ_64M		0x00000010
 | 
					
						
							|  |  |  | #define PMB_SZ_128M		0x00000080
 | 
					
						
							|  |  |  | #define PMB_SZ_512M		0x00000090
 | 
					
						
							|  |  |  | #define PMB_SZ_MASK		PMB_SZ_512M
 | 
					
						
							|  |  |  | #define PMB_C			0x00000008
 | 
					
						
							|  |  |  | #define PMB_WT			0x00000001
 | 
					
						
							|  |  |  | #define PMB_UB			0x00000200
 | 
					
						
							| 
									
										
										
										
											2010-02-16 18:39:30 +09:00
										 |  |  | #define PMB_CACHE_MASK		(PMB_C | PMB_WT | PMB_UB)
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:08:07 +09:00
										 |  |  | #define PMB_V			0x00000100
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define PMB_NO_ENTRY		(-1)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-24 13:30:01 +00:00
										 |  |  | #ifndef __ASSEMBLY__
 | 
					
						
							| 
									
										
										
										
											2010-01-15 08:00:45 +09:00
										 |  |  | #include <linux/errno.h>
 | 
					
						
							| 
									
										
										
										
											2010-01-20 16:40:48 +09:00
										 |  |  | #include <linux/threads.h>
 | 
					
						
							| 
									
										
										
										
											2010-02-17 13:23:00 +09:00
										 |  |  | #include <asm/page.h>
 | 
					
						
							| 
									
										
										
										
											2009-03-24 13:30:01 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Default "unsigned long" context */ | 
					
						
							|  |  |  | typedef unsigned long mm_context_id_t[NR_CPUS]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct { | 
					
						
							|  |  |  | #ifdef CONFIG_MMU
 | 
					
						
							|  |  |  | 	mm_context_id_t		id; | 
					
						
							|  |  |  | 	void			*vdso; | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | 	unsigned long		end_brk; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifdef CONFIG_BINFMT_ELF_FDPIC
 | 
					
						
							|  |  |  | 	unsigned long		exec_fdpic_loadmap; | 
					
						
							|  |  |  | 	unsigned long		interp_fdpic_loadmap; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | } mm_context_t; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-13 18:31:48 +09:00
										 |  |  | #ifdef CONFIG_PMB
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:08:07 +09:00
										 |  |  | /* arch/sh/mm/pmb.c */ | 
					
						
							| 
									
										
										
										
											2010-01-20 16:40:48 +09:00
										 |  |  | bool __in_29bit_mode(void); | 
					
						
							| 
									
										
										
										
											2010-02-23 16:20:53 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | void pmb_init(void); | 
					
						
							|  |  |  | int pmb_bolt_mapping(unsigned long virt, phys_addr_t phys, | 
					
						
							|  |  |  | 		     unsigned long size, pgprot_t prot); | 
					
						
							|  |  |  | void __iomem *pmb_remap_caller(phys_addr_t phys, unsigned long size, | 
					
						
							|  |  |  | 			       pgprot_t prot, void *caller); | 
					
						
							|  |  |  | int pmb_unmap(void __iomem *addr); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-13 18:31:48 +09:00
										 |  |  | #else
 | 
					
						
							| 
									
										
										
										
											2010-02-23 16:20:53 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-03-10 16:29:48 +09:00
										 |  |  | static inline int | 
					
						
							|  |  |  | pmb_bolt_mapping(unsigned long virt, phys_addr_t phys, | 
					
						
							|  |  |  | 		 unsigned long size, pgprot_t prot) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return -EINVAL; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-23 16:20:53 +09:00
										 |  |  | static inline void __iomem * | 
					
						
							|  |  |  | pmb_remap_caller(phys_addr_t phys, unsigned long size, | 
					
						
							|  |  |  | 		 pgprot_t prot, void *caller) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return NULL; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline int pmb_unmap(void __iomem *addr) | 
					
						
							| 
									
										
										
										
											2010-01-13 18:31:48 +09:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-01-15 08:00:45 +09:00
										 |  |  | 	return -EINVAL; | 
					
						
							| 
									
										
										
										
											2010-01-13 18:31:48 +09:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-18 18:13:51 +09:00
										 |  |  | #define pmb_init(addr)		do { } while (0)
 | 
					
						
							| 
									
										
										
										
											2010-01-13 18:31:48 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-20 16:40:48 +09:00
										 |  |  | #ifdef CONFIG_29BIT
 | 
					
						
							|  |  |  | #define __in_29bit_mode()	(1)
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define __in_29bit_mode()	(0)
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* CONFIG_PMB */
 | 
					
						
							| 
									
										
										
										
											2010-02-23 16:20:53 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | static inline void __iomem * | 
					
						
							|  |  |  | pmb_remap(phys_addr_t phys, unsigned long size, pgprot_t prot) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return pmb_remap_caller(phys, size, prot, __builtin_return_address(0)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-24 13:30:01 +00:00
										 |  |  | #endif /* __ASSEMBLY__ */
 | 
					
						
							| 
									
										
										
										
											2006-09-27 15:08:07 +09:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif /* __MMU_H */
 |