mmu.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #ifndef __MMU_H
  2. #define __MMU_H
  3. /*
  4. * Privileged Space Mapping Buffer (PMB) definitions
  5. */
  6. #define PMB_PASCR 0xff000070
  7. #define PMB_IRMCR 0xff000078
  8. #define PASCR_SE 0x80000000
  9. #define PMB_ADDR 0xf6100000
  10. #define PMB_DATA 0xf7100000
  11. #define NR_PMB_ENTRIES 16
  12. #define PMB_E_MASK 0x0000000f
  13. #define PMB_E_SHIFT 8
  14. #define PMB_PFN_MASK 0xff000000
  15. #define PMB_SZ_16M 0x00000000
  16. #define PMB_SZ_64M 0x00000010
  17. #define PMB_SZ_128M 0x00000080
  18. #define PMB_SZ_512M 0x00000090
  19. #define PMB_SZ_MASK PMB_SZ_512M
  20. #define PMB_C 0x00000008
  21. #define PMB_WT 0x00000001
  22. #define PMB_UB 0x00000200
  23. #define PMB_CACHE_MASK (PMB_C | PMB_WT | PMB_UB)
  24. #define PMB_V 0x00000100
  25. #define PMB_NO_ENTRY (-1)
  26. #ifndef __ASSEMBLY__
  27. #include <linux/errno.h>
  28. #include <linux/threads.h>
  29. #include <asm/page.h>
  30. /* Default "unsigned long" context */
  31. typedef unsigned long mm_context_id_t[NR_CPUS];
  32. typedef struct {
  33. #ifdef CONFIG_MMU
  34. mm_context_id_t id;
  35. void *vdso;
  36. #else
  37. unsigned long end_brk;
  38. #endif
  39. #ifdef CONFIG_BINFMT_ELF_FDPIC
  40. unsigned long exec_fdpic_loadmap;
  41. unsigned long interp_fdpic_loadmap;
  42. #endif
  43. } mm_context_t;
  44. #ifdef CONFIG_PMB
  45. /* arch/sh/mm/pmb.c */
  46. bool __in_29bit_mode(void);
  47. void pmb_init(void);
  48. int pmb_bolt_mapping(unsigned long virt, phys_addr_t phys,
  49. unsigned long size, pgprot_t prot);
  50. void __iomem *pmb_remap_caller(phys_addr_t phys, unsigned long size,
  51. pgprot_t prot, void *caller);
  52. int pmb_unmap(void __iomem *addr);
  53. #else
  54. static inline int
  55. pmb_bolt_mapping(unsigned long virt, phys_addr_t phys,
  56. unsigned long size, pgprot_t prot)
  57. {
  58. return -EINVAL;
  59. }
  60. static inline void __iomem *
  61. pmb_remap_caller(phys_addr_t phys, unsigned long size,
  62. pgprot_t prot, void *caller)
  63. {
  64. return NULL;
  65. }
  66. static inline int pmb_unmap(void __iomem *addr)
  67. {
  68. return -EINVAL;
  69. }
  70. #define pmb_init(addr) do { } while (0)
  71. #ifdef CONFIG_29BIT
  72. #define __in_29bit_mode() (1)
  73. #else
  74. #define __in_29bit_mode() (0)
  75. #endif
  76. #endif /* CONFIG_PMB */
  77. static inline void __iomem *
  78. pmb_remap(phys_addr_t phys, unsigned long size, pgprot_t prot)
  79. {
  80. return pmb_remap_caller(phys, size, prot, __builtin_return_address(0));
  81. }
  82. #endif /* __ASSEMBLY__ */
  83. #endif /* __MMU_H */