proc-fns.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*
  2. * arch/arm/include/asm/proc-fns.h
  3. *
  4. * Copyright (C) 1997-1999 Russell King
  5. * Copyright (C) 2000 Deep Blue Solutions Ltd
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef __ASM_PROCFNS_H
  12. #define __ASM_PROCFNS_H
  13. #ifdef __KERNEL__
  14. #include <asm/glue-proc.h>
  15. #include <asm/page.h>
  16. #ifndef __ASSEMBLY__
  17. struct mm_struct;
  18. /*
  19. * Don't change this structure - ASM code relies on it.
  20. */
  21. extern struct processor {
  22. /* MISC
  23. * get data abort address/flags
  24. */
  25. void (*_data_abort)(unsigned long pc);
  26. /*
  27. * Retrieve prefetch fault address
  28. */
  29. unsigned long (*_prefetch_abort)(unsigned long lr);
  30. /*
  31. * Set up any processor specifics
  32. */
  33. void (*_proc_init)(void);
  34. /*
  35. * Disable any processor specifics
  36. */
  37. void (*_proc_fin)(void);
  38. /*
  39. * Special stuff for a reset
  40. */
  41. void (*reset)(unsigned long addr) __attribute__((noreturn));
  42. /*
  43. * Idle the processor
  44. */
  45. int (*_do_idle)(void);
  46. /*
  47. * Processor architecture specific
  48. */
  49. /*
  50. * clean a virtual address range from the
  51. * D-cache without flushing the cache.
  52. */
  53. void (*dcache_clean_area)(void *addr, int size);
  54. /*
  55. * Set the page table
  56. */
  57. void (*switch_mm)(unsigned long pgd_phys, struct mm_struct *mm);
  58. /*
  59. * Set a possibly extended PTE. Non-extended PTEs should
  60. * ignore 'ext'.
  61. */
  62. #ifdef CONFIG_ARM_LPAE
  63. void (*set_pte_ext)(pte_t *ptep, pte_t pte);
  64. #else
  65. void (*set_pte_ext)(pte_t *ptep, pte_t pte, unsigned int ext);
  66. # ifdef CONFIG_TIMA_RKP_L2_TABLES
  67. void (*tima_set_pte_ext)(pte_t *ptep, pte_t pte, unsigned int ext);
  68. # endif
  69. #endif
  70. /* Suspend/resume */
  71. unsigned int suspend_size;
  72. void (*do_suspend)(void *);
  73. void (*do_resume)(void *);
  74. } processor;
  75. #ifndef MULTI_CPU
  76. extern void cpu_proc_init(void);
  77. extern void cpu_proc_fin(void);
  78. extern int cpu_do_idle(void);
  79. extern void cpu_dcache_clean_area(void *, int);
  80. extern void cpu_do_switch_mm(unsigned long pgd_phys, struct mm_struct *mm);
  81. #ifdef CONFIG_ARM_LPAE
  82. extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte);
  83. #else
  84. # ifdef CONFIG_TIMA_RKP_L2_TABLES
  85. extern void cpu_tima_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext);
  86. # endif
  87. extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext);
  88. #endif
  89. extern void cpu_reset(unsigned long addr) __attribute__((noreturn));
  90. /* These three are private to arch/arm/kernel/suspend.c */
  91. extern void cpu_do_suspend(void *);
  92. extern void cpu_do_resume(void *);
  93. #else
  94. #define cpu_proc_init processor._proc_init
  95. #define cpu_proc_fin processor._proc_fin
  96. #define cpu_reset processor.reset
  97. #define cpu_do_idle processor._do_idle
  98. #define cpu_dcache_clean_area processor.dcache_clean_area
  99. #define cpu_set_pte_ext processor.set_pte_ext
  100. #define cpu_do_switch_mm processor.switch_mm
  101. /* These three are private to arch/arm/kernel/suspend.c */
  102. #define cpu_do_suspend processor.do_suspend
  103. #define cpu_do_resume processor.do_resume
  104. #endif
  105. extern void cpu_resume(void);
  106. #include <asm/memory.h>
  107. #ifdef CONFIG_MMU
  108. #define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm)
  109. #ifdef CONFIG_ARM_LPAE
  110. #define cpu_get_pgd() \
  111. ({ \
  112. unsigned long pg, pg2; \
  113. __asm__("mrrc p15, 0, %0, %1, c2" \
  114. : "=r" (pg), "=r" (pg2) \
  115. : \
  116. : "cc"); \
  117. pg &= ~(PTRS_PER_PGD*sizeof(pgd_t)-1); \
  118. (pgd_t *)phys_to_virt(pg); \
  119. })
  120. #else
  121. #define cpu_get_pgd() \
  122. ({ \
  123. unsigned long pg; \
  124. __asm__("mrc p15, 0, %0, c2, c0, 0" \
  125. : "=r" (pg) : : "cc"); \
  126. pg &= ~0x3fff; \
  127. (pgd_t *)phys_to_virt(pg); \
  128. })
  129. #endif
  130. #endif
  131. #endif /* __ASSEMBLY__ */
  132. #endif /* __KERNEL__ */
  133. #endif /* __ASM_PROCFNS_H */