tlb.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * include/asm-sh64/tlb.h
  3. *
  4. * Copyright (C) 2003 Paul Mundt
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. *
  10. */
  11. #ifndef __ASM_SH64_TLB_H
  12. #define __ASM_SH64_TLB_H
  13. /*
  14. * Note! These are mostly unused, we just need the xTLB_LAST_VAR_UNRESTRICTED
  15. * for head.S! Once this limitation is gone, we can clean the rest of this up.
  16. */
  17. /* ITLB defines */
  18. #define ITLB_FIXED 0x00000000 /* First fixed ITLB, see head.S */
  19. #define ITLB_LAST_VAR_UNRESTRICTED 0x000003F0 /* Last ITLB */
  20. /* DTLB defines */
  21. #define DTLB_FIXED 0x00800000 /* First fixed DTLB, see head.S */
  22. #define DTLB_LAST_VAR_UNRESTRICTED 0x008003F0 /* Last DTLB */
  23. #ifndef __ASSEMBLY__
  24. /**
  25. * for_each_dtlb_entry
  26. *
  27. * @tlb: TLB entry
  28. *
  29. * Iterate over free (non-wired) DTLB entries
  30. */
  31. #define for_each_dtlb_entry(tlb) \
  32. for (tlb = cpu_data->dtlb.first; \
  33. tlb <= cpu_data->dtlb.last; \
  34. tlb += cpu_data->dtlb.step)
  35. /**
  36. * for_each_itlb_entry
  37. *
  38. * @tlb: TLB entry
  39. *
  40. * Iterate over free (non-wired) ITLB entries
  41. */
  42. #define for_each_itlb_entry(tlb) \
  43. for (tlb = cpu_data->itlb.first; \
  44. tlb <= cpu_data->itlb.last; \
  45. tlb += cpu_data->itlb.step)
  46. /**
  47. * __flush_tlb_slot
  48. *
  49. * @slot: Address of TLB slot.
  50. *
  51. * Flushes TLB slot @slot.
  52. */
  53. static inline void __flush_tlb_slot(unsigned long long slot)
  54. {
  55. __asm__ __volatile__ ("putcfg %0, 0, r63\n" : : "r" (slot));
  56. }
  57. /* arch/sh64/mm/tlb.c */
  58. extern int sh64_tlb_init(void);
  59. extern unsigned long long sh64_next_free_dtlb_entry(void);
  60. extern unsigned long long sh64_get_wired_dtlb_entry(void);
  61. extern int sh64_put_wired_dtlb_entry(unsigned long long entry);
  62. extern void sh64_setup_tlb_slot(unsigned long long config_addr, unsigned long eaddr, unsigned long asid, unsigned long paddr);
  63. extern void sh64_teardown_tlb_slot(unsigned long long config_addr);
  64. #define tlb_start_vma(tlb, vma) \
  65. flush_cache_range(vma, vma->vm_start, vma->vm_end)
  66. #define tlb_end_vma(tlb, vma) \
  67. flush_tlb_range(vma, vma->vm_start, vma->vm_end)
  68. #define __tlb_remove_tlb_entry(tlb, pte, address) do { } while (0)
  69. /*
  70. * Flush whole TLBs for MM
  71. */
  72. #define tlb_flush(tlb) flush_tlb_mm((tlb)->mm)
  73. #include <asm-generic/tlb.h>
  74. #endif /* __ASSEMBLY__ */
  75. #endif /* __ASM_SH64_TLB_H */