mmu_decl.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * Declarations of procedures and variables shared between files
  3. * in arch/ppc/mm/.
  4. *
  5. * Derived from arch/ppc/mm/init.c:
  6. * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
  7. *
  8. * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
  9. * and Cort Dougan (PReP) (cort@cs.nmt.edu)
  10. * Copyright (C) 1996 Paul Mackerras
  11. *
  12. * Derived from "arch/i386/mm/init.c"
  13. * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License
  17. * as published by the Free Software Foundation; either version
  18. * 2 of the License, or (at your option) any later version.
  19. *
  20. */
  21. #include <linux/mm.h>
  22. #include <asm/tlbflush.h>
  23. #include <asm/mmu.h>
  24. #ifdef CONFIG_PPC_MMU_NOHASH
  25. /*
  26. * On 40x and 8xx, we directly inline tlbia and tlbivax
  27. */
  28. #if defined(CONFIG_40x) || defined(CONFIG_8xx)
  29. static inline void _tlbil_all(void)
  30. {
  31. asm volatile ("sync; tlbia; isync" : : : "memory");
  32. }
  33. static inline void _tlbil_pid(unsigned int pid)
  34. {
  35. asm volatile ("sync; tlbia; isync" : : : "memory");
  36. }
  37. #else /* CONFIG_40x || CONFIG_8xx */
  38. extern void _tlbil_all(void);
  39. extern void _tlbil_pid(unsigned int pid);
  40. #endif /* !(CONFIG_40x || CONFIG_8xx) */
  41. /*
  42. * On 8xx, we directly inline tlbie, on others, it's extern
  43. */
  44. #ifdef CONFIG_8xx
  45. static inline void _tlbil_va(unsigned long address, unsigned int pid)
  46. {
  47. asm volatile ("tlbie %0; sync" : : "r" (address) : "memory");
  48. }
  49. #else /* CONFIG_8xx */
  50. extern void _tlbil_va(unsigned long address, unsigned int pid);
  51. #endif /* CONIFG_8xx */
  52. /*
  53. * As of today, we don't support tlbivax broadcast on any
  54. * implementation. When that becomes the case, this will be
  55. * an extern.
  56. */
  57. static inline void _tlbivax_bcast(unsigned long address, unsigned int pid)
  58. {
  59. BUG();
  60. }
  61. #else /* CONFIG_PPC_MMU_NOHASH */
  62. extern void hash_preload(struct mm_struct *mm, unsigned long ea,
  63. unsigned long access, unsigned long trap);
  64. extern void _tlbie(unsigned long address);
  65. extern void _tlbia(void);
  66. #endif /* CONFIG_PPC_MMU_NOHASH */
  67. #ifdef CONFIG_PPC32
  68. struct tlbcam {
  69. u32 MAS0;
  70. u32 MAS1;
  71. u32 MAS2;
  72. u32 MAS3;
  73. u32 MAS7;
  74. };
  75. extern void mapin_ram(void);
  76. extern int map_page(unsigned long va, phys_addr_t pa, int flags);
  77. extern void setbat(int index, unsigned long virt, phys_addr_t phys,
  78. unsigned int size, int flags);
  79. extern void settlbcam(int index, unsigned long virt, phys_addr_t phys,
  80. unsigned int size, int flags, unsigned int pid);
  81. extern void invalidate_tlbcam_entry(int index);
  82. extern int __map_without_bats;
  83. extern unsigned long ioremap_base;
  84. extern unsigned int rtas_data, rtas_size;
  85. struct hash_pte;
  86. extern struct hash_pte *Hash, *Hash_end;
  87. extern unsigned long Hash_size, Hash_mask;
  88. #endif
  89. extern unsigned long ioremap_bot;
  90. extern unsigned long __max_low_memory;
  91. extern phys_addr_t __initial_memory_limit_addr;
  92. extern phys_addr_t total_memory;
  93. extern phys_addr_t total_lowmem;
  94. extern phys_addr_t memstart_addr;
  95. extern phys_addr_t lowmem_end_addr;
  96. /* ...and now those things that may be slightly different between processor
  97. * architectures. -- Dan
  98. */
  99. #if defined(CONFIG_8xx)
  100. #define MMU_init_hw() do { } while(0)
  101. #define mmu_mapin_ram() (0UL)
  102. #elif defined(CONFIG_4xx)
  103. extern void MMU_init_hw(void);
  104. extern unsigned long mmu_mapin_ram(void);
  105. #elif defined(CONFIG_FSL_BOOKE)
  106. extern void MMU_init_hw(void);
  107. extern unsigned long mmu_mapin_ram(void);
  108. extern void adjust_total_lowmem(void);
  109. #elif defined(CONFIG_PPC32)
  110. /* anything 32-bit except 4xx or 8xx */
  111. extern void MMU_init_hw(void);
  112. extern unsigned long mmu_mapin_ram(void);
  113. #endif