sysmmu.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* linux/arch/arm/plat-samsung/include/plat/sysmmu.h
  2. *
  3. * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com
  5. *
  6. * Samsung System MMU driver for S5P platform
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef __PLAT_SAMSUNG_SYSMMU_H
  13. #define __PLAT_SAMSUNG_SYSMMU_H __FILE__
  14. enum S5P_SYSMMU_INTERRUPT_TYPE {
  15. SYSMMU_PAGEFAULT,
  16. SYSMMU_AR_MULTIHIT,
  17. SYSMMU_AW_MULTIHIT,
  18. SYSMMU_BUSERROR,
  19. SYSMMU_AR_SECURITY,
  20. SYSMMU_AR_ACCESS,
  21. SYSMMU_AW_SECURITY,
  22. SYSMMU_AW_PROTECTION, /* 7 */
  23. SYSMMU_FAULTS_NUM
  24. };
  25. #ifdef CONFIG_S5P_SYSTEM_MMU
  26. #include <mach/sysmmu.h>
  27. /**
  28. * s5p_sysmmu_enable() - enable system mmu of ip
  29. * @ips: The ip connected system mmu.
  30. * #pgd: Base physical address of the 1st level page table
  31. *
  32. * This function enable system mmu to transfer address
  33. * from virtual address to physical address
  34. */
  35. void s5p_sysmmu_enable(sysmmu_ips ips, unsigned long pgd);
  36. /**
  37. * s5p_sysmmu_disable() - disable sysmmu mmu of ip
  38. * @ips: The ip connected system mmu.
  39. *
  40. * This function disable system mmu to transfer address
  41. * from virtual address to physical address
  42. */
  43. void s5p_sysmmu_disable(sysmmu_ips ips);
  44. /**
  45. * s5p_sysmmu_set_tablebase_pgd() - set page table base address to refer page table
  46. * @ips: The ip connected system mmu.
  47. * @pgd: The page table base address.
  48. *
  49. * This function set page table base address
  50. * When system mmu transfer address from virtaul address to physical address,
  51. * system mmu refer address information from page table
  52. */
  53. void s5p_sysmmu_set_tablebase_pgd(sysmmu_ips ips, unsigned long pgd);
  54. /**
  55. * s5p_sysmmu_tlb_invalidate() - flush all TLB entry in system mmu
  56. * @ips: The ip connected system mmu.
  57. *
  58. * This function flush all TLB entry in system mmu
  59. */
  60. void s5p_sysmmu_tlb_invalidate(sysmmu_ips ips);
  61. /** s5p_sysmmu_set_fault_handler() - Fault handler for System MMUs
  62. * @itype: type of fault.
  63. * @pgtable_base: the physical address of page table base. This is 0 if @ips is
  64. * SYSMMU_BUSERROR.
  65. * @fault_addr: the device (virtual) address that the System MMU tried to
  66. * translated. This is 0 if @ips is SYSMMU_BUSERROR.
  67. * Called when interrupt occurred by the System MMUs
  68. * The device drivers of peripheral devices that has a System MMU can implement
  69. * a fault handler to resolve address translation fault by System MMU.
  70. * The meanings of return value and parameters are described below.
  71. * return value: non-zero if the fault is correctly resolved.
  72. * zero if the fault is not handled.
  73. */
  74. void s5p_sysmmu_set_fault_handler(sysmmu_ips ips,
  75. int (*handler)(enum S5P_SYSMMU_INTERRUPT_TYPE itype,
  76. unsigned long pgtable_base,
  77. unsigned long fault_addr));
  78. #else
  79. #define s5p_sysmmu_enable(ips, pgd) do { } while (0)
  80. #define s5p_sysmmu_disable(ips) do { } while (0)
  81. #define s5p_sysmmu_set_tablebase_pgd(ips, pgd) do { } while (0)
  82. #define s5p_sysmmu_tlb_invalidate(ips) do { } while (0)
  83. #define s5p_sysmmu_set_fault_handler(ips, handler) do { } while (0)
  84. #endif
  85. #endif /* __ASM_PLAT_SYSMMU_H */