2 * arch/arm/include/asm/proc-fns.h
4 * Copyright (C) 1997-1999 Russell King
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
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.
11 #ifndef __ASM_PROCFNS_H
12 #define __ASM_PROCFNS_H
16 #include <asm/glue-proc.h>
24 * Don't change this structure - ASM code relies on it.
26 extern struct processor {
28 * get data abort address/flags
30 void (*_data_abort)(unsigned long pc);
32 * Retrieve prefetch fault address
34 unsigned long (*_prefetch_abort)(unsigned long lr);
36 * Set up any processor specifics
38 void (*_proc_init)(void);
40 * Check for processor bugs
42 void (*check_bugs)(void);
44 * Disable any processor specifics
46 void (*_proc_fin)(void);
48 * Special stuff for a reset
50 void (*reset)(unsigned long addr, bool hvc) __attribute__((noreturn));
54 int (*_do_idle)(void);
56 * Processor architecture specific
59 * clean a virtual address range from the
60 * D-cache without flushing the cache.
62 void (*dcache_clean_area)(void *addr, int size);
67 void (*switch_mm)(phys_addr_t pgd_phys, struct mm_struct *mm);
69 * Set a possibly extended PTE. Non-extended PTEs should
72 #ifdef CONFIG_ARM_LPAE
73 void (*set_pte_ext)(pte_t *ptep, pte_t pte);
75 void (*set_pte_ext)(pte_t *ptep, pte_t pte, unsigned int ext);
79 unsigned int suspend_size;
80 void (*do_suspend)(void *);
81 void (*do_resume)(void *);
85 extern void cpu_proc_init(void);
86 extern void cpu_proc_fin(void);
87 extern int cpu_do_idle(void);
88 extern void cpu_dcache_clean_area(void *, int);
89 extern void cpu_do_switch_mm(phys_addr_t pgd_phys, struct mm_struct *mm);
90 #ifdef CONFIG_ARM_LPAE
91 extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte);
93 extern void cpu_set_pte_ext(pte_t *ptep, pte_t pte, unsigned int ext);
95 extern void cpu_reset(unsigned long addr, bool hvc) __attribute__((noreturn));
97 /* These three are private to arch/arm/kernel/suspend.c */
98 extern void cpu_do_suspend(void *);
99 extern void cpu_do_resume(void *);
101 #define cpu_proc_init processor._proc_init
102 #define cpu_proc_fin processor._proc_fin
103 #define cpu_reset processor.reset
104 #define cpu_do_idle processor._do_idle
105 #define cpu_dcache_clean_area processor.dcache_clean_area
106 #define cpu_set_pte_ext processor.set_pte_ext
107 #define cpu_do_switch_mm processor.switch_mm
109 /* These three are private to arch/arm/kernel/suspend.c */
110 #define cpu_do_suspend processor.do_suspend
111 #define cpu_do_resume processor.do_resume
114 extern void cpu_resume(void);
116 #include <asm/memory.h>
120 #define cpu_switch_mm(pgd,mm) cpu_do_switch_mm(virt_to_phys(pgd),mm)
122 #ifdef CONFIG_ARM_LPAE
124 #define cpu_get_ttbr(nr) \
127 __asm__("mrrc p15, " #nr ", %Q0, %R0, c2" \
132 #define cpu_get_pgd() \
134 u64 pg = cpu_get_ttbr(0); \
135 pg &= ~(PTRS_PER_PGD*sizeof(pgd_t)-1); \
136 (pgd_t *)phys_to_virt(pg); \
139 #define cpu_get_pgd() \
142 __asm__("mrc p15, 0, %0, c2, c0, 0" \
143 : "=r" (pg) : : "cc"); \
145 (pgd_t *)phys_to_virt(pg); \
149 #else /*!CONFIG_MMU */
151 #define cpu_switch_mm(pgd,mm) { }
155 #endif /* __ASSEMBLY__ */
156 #endif /* __KERNEL__ */
157 #endif /* __ASM_PROCFNS_H */