domain.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * linux/include/asm-arm/domain.h
  3. *
  4. * Copyright (C) 1999 Russell King.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #ifndef __ASM_PROC_DOMAIN_H
  11. #define __ASM_PROC_DOMAIN_H
  12. /*
  13. * Domain numbers
  14. *
  15. * DOMAIN_IO - domain 2 includes all IO only
  16. * DOMAIN_USER - domain 1 includes all user memory only
  17. * DOMAIN_KERNEL - domain 0 includes all kernel memory only
  18. *
  19. * The domain numbering depends on whether we support 36 physical
  20. * address for I/O or not. Addresses above the 32 bit boundary can
  21. * only be mapped using supersections and supersections can only
  22. * be set for domain 0. We could just default to DOMAIN_IO as zero,
  23. * but there may be systems with supersection support and no 36-bit
  24. * addressing. In such cases, we want to map system memory with
  25. * supersections to reduce TLB misses and footprint.
  26. *
  27. * 36-bit addressing and supersections are only available on
  28. * CPUs based on ARMv6+ or the Intel XSC3 core.
  29. */
  30. #ifndef CONFIG_IO_36
  31. #define DOMAIN_KERNEL 0
  32. #define DOMAIN_TABLE 0
  33. #define DOMAIN_USER 1
  34. #define DOMAIN_IO 2
  35. #else
  36. #define DOMAIN_KERNEL 2
  37. #define DOMAIN_TABLE 2
  38. #define DOMAIN_USER 1
  39. #define DOMAIN_IO 0
  40. #endif
  41. /*
  42. * Domain types
  43. */
  44. #define DOMAIN_NOACCESS 0
  45. #define DOMAIN_CLIENT 1
  46. #define DOMAIN_MANAGER 3
  47. #define domain_val(dom,type) ((type) << (2*(dom)))
  48. #ifndef __ASSEMBLY__
  49. #ifdef CONFIG_MMU
  50. #define set_domain(x) \
  51. do { \
  52. __asm__ __volatile__( \
  53. "mcr p15, 0, %0, c3, c0 @ set domain" \
  54. : : "r" (x)); \
  55. isb(); \
  56. } while (0)
  57. #define modify_domain(dom,type) \
  58. do { \
  59. struct thread_info *thread = current_thread_info(); \
  60. unsigned int domain = thread->cpu_domain; \
  61. domain &= ~domain_val(dom, DOMAIN_MANAGER); \
  62. thread->cpu_domain = domain | domain_val(dom, type); \
  63. set_domain(thread->cpu_domain); \
  64. } while (0)
  65. #else
  66. #define set_domain(x) do { } while (0)
  67. #define modify_domain(dom,type) do { } while (0)
  68. #endif
  69. #endif
  70. #endif /* !__ASSEMBLY__ */