/include/linux/vcm_mm.h

https://github.com/airy09/android_kernel_sony_apq8064 · C Header · 105 lines · 11 code · 10 blank · 84 comment · 0 complexity · e8e4be7640b3fae2459f8354f7faa374 MD5 · raw file

  1. /* Copyright (c) 2010, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. */
  13. /* Architecture-specific VCM functions */
  14. /* Device attributes */
  15. /*
  16. * Sharing attributes. Pick only one.
  17. */
  18. #define VCM_DEV_ATTR_NON_SH (0x00)
  19. #define VCM_DEV_ATTR_SH (0x04)
  20. /*
  21. * Caching attributes. Pick only one.
  22. */
  23. #define VCM_DEV_ATTR_NONCACHED (0x00)
  24. #define VCM_DEV_ATTR_CACHED_WB_WA (0x01)
  25. #define VCM_DEV_ATTR_CACHED_WB_NWA (0x02)
  26. #define VCM_DEV_ATTR_CACHED_WT (0x03)
  27. /*
  28. * A "good" default set of attributes: shareable and non-cacheable.
  29. */
  30. #define VCM_DEV_DEFAULT_ATTR (VCM_DEV_ATTR_SH | VCM_DEV_ATTR_NONCACHED)
  31. /**
  32. * set_arm7_pte_attr() - Set ARMv7 page table attributes
  33. * pt_base Virtual address of the first-level page table
  34. * @va Virtual address whose attributes are to be set
  35. * @len Page size used to map the given virtual address
  36. * @attr Attributes to set for this mapping.
  37. *
  38. * Modify a mapping attribute. The base address of the page table must
  39. * be a virtual address containing a valid ARMv7 page table. The
  40. * virtual address must refer to an existing mapping and must be
  41. * aligned to the length with which it was mapped. The mapping length
  42. * must similarly be the same as was specified when the mapping was
  43. * made (one of 4KB, 64KB, 1MB, or 16MB). The attribute must be one of
  44. * the shareability attributes above ORed with one of the cacheability
  45. * attributes. Any previous attributes are completely replaced by the
  46. * most recent call to this function. This function only sets the
  47. * cacheability and shareability attributes. This is accomplished by
  48. * modifying the TEX class and the S bit in the PTE. It is an error to
  49. * call this function without having called vcm_setup_tex_classes at
  50. * least once.
  51. *
  52. * The return value is zero on success and non-zero on failure.
  53. */
  54. int set_arm7_pte_attr(unsigned long pt_base, unsigned long va,
  55. unsigned long len, unsigned int attr);
  56. /**
  57. * cpu_set_attr() - Set page table attributes on the CPU's page tables
  58. * @va Virtual address whose attributes are to be set
  59. * @len Page size used to map the given virtual address
  60. * @attr Attributes to set for this mapping.
  61. *
  62. * Modify a mapping attribute within the ARM page tables. The va must
  63. * refer to an existing mapping and must be aligned to the length with
  64. * which it was mapped. The mapping length must similarly be the same
  65. * as was specified when the mapping was made (one of 4KB, 64KB, 1MB,
  66. * or 16MB). The attribute must be one of the shareability attributes
  67. * above ORed with one of the cacheability attributes. Any previous
  68. * attributes are completely replaced by the most recent call to this
  69. * function. This function only sets the cacheability and shareability
  70. * attributes. This is accomplished by modifying the TEX class and the
  71. * S bit in the PTE. It is an error to call this function without
  72. * having called vcm_setup_tex_classes at least once. It is an error
  73. * to call this function on any system using a memory configuration
  74. * that is anything OTHER than ARMv7 with TEX remap enabled. Only the
  75. * HW page tables are modified; the Linux page tables are left
  76. * untouched.
  77. *
  78. * The return value is zero on success and non-zero on failure.
  79. */
  80. int cpu_set_attr(unsigned long va, unsigned long len, unsigned int attr);
  81. /**
  82. * vcm_setup_tex_classes() - Prepare TEX class table for use
  83. *
  84. * Initialize the attribute mapping table by examining the TEX classes
  85. * used by the CPU and finding the classes that match the device
  86. * attributes (VCM_DEV_xx) defined above. This function is only
  87. * relevant if TEX remap is enabled. The results will be unpredictable
  88. * and irrelevant if TEX remap is not in use. It is an error to call
  89. * this function in any system using a memory configuration of
  90. * anything OTHER than ARMv7 with TEX remap enabled.
  91. *
  92. * The return value is zero on success or non-zero on failure. In the
  93. * present version, a failure will result in a panic.
  94. */
  95. int vcm_setup_tex_classes(void);