File: /usr/src/linux/include/asm-arm/cpu-multi32.h

1     /*
2      *  linux/include/asm-arm/cpu-multi32.h
3      *
4      *  Copyright (C) 2000 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 __ASSEMBLY__
11     
12     #include <asm/page.h>
13     
14     /* forward-declare task_struct */
15     struct task_struct;
16     
17     /*
18      * Don't change this structure - ASM code
19      * 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     	 * check for any bugs
28     	 */
29     	void (*_check_bugs)(void);
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     	volatile void (*reset)(unsigned long addr);
42     	/*
43     	 * Idle the processor
44     	 */
45     	int (*_do_idle)(int mode);
46     	/*
47     	 * Processor architecture specific
48     	 */
49     	struct {	/* CACHE */
50     		/*
51     		 * flush all caches
52     		 */
53     		void (*clean_invalidate_all)(void);
54     		/*
55     		 * flush a specific page or pages
56     		 */
57     		void (*clean_invalidate_range)(unsigned long address, unsigned long end, int flags);
58     		/*
59     		 * flush a page to RAM
60     		 */
61     		void (*_flush_ram_page)(void *virt_page);
62     	} cache;
63     
64     	struct {	/* D-cache */
65     		/*
66     		 * invalidate the specified data range
67     		 */
68     		void (*invalidate_range)(unsigned long start, unsigned long end);
69     		/*
70     		 * clean specified data range
71     		 */
72     		void (*clean_range)(unsigned long start, unsigned long end);
73     		/*
74     		 * obsolete flush cache entry
75     		 */
76     		void (*clean_page)(void *virt_page);
77     		/*
78     		 * clean a virtual address range from the
79     		 * D-cache without flushing the cache.
80     		 */
81     		void (*clean_entry)(unsigned long start);
82     	} dcache;
83     
84     	struct {	/* I-cache */
85     		/*
86     		 * invalidate the I-cache for the specified range
87     		 */
88     		void (*invalidate_range)(unsigned long start, unsigned long end);
89     		/*
90     		 * invalidate the I-cache for the specified virtual page
91     		 */
92     		void (*invalidate_page)(void *virt_page);
93     	} icache;
94     
95     	struct {	/* TLB */
96     		/*
97     		 * flush all TLBs
98     		 */
99     		void (*invalidate_all)(void);
100     		/*
101     		 * flush a specific TLB
102     		 */
103     		void (*invalidate_range)(unsigned long address, unsigned long end);
104     		/*
105     		 * flush a specific TLB
106     		 */
107     		void (*invalidate_page)(unsigned long address, int flags);
108     	} tlb;
109     
110     	struct {	/* PageTable */
111     		/*
112     		 * Set the page table
113     		 */
114     		void (*set_pgd)(unsigned long pgd_phys);
115     		/*
116     		 * Set a PMD (handling IMP bit 4)
117     		 */
118     		void (*set_pmd)(pmd_t *pmdp, pmd_t pmd);
119     		/*
120     		 * Set a PTE
121     		 */
122     		void (*set_pte)(pte_t *ptep, pte_t pte);
123     	} pgtable;
124     } processor;
125     
126     extern const struct processor arm6_processor_functions;
127     extern const struct processor arm7_processor_functions;
128     extern const struct processor sa110_processor_functions;
129     
130     #define cpu_data_abort(pc)			processor._data_abort(pc)
131     #define cpu_check_bugs()			processor._check_bugs()
132     #define cpu_proc_init()				processor._proc_init()
133     #define cpu_proc_fin()				processor._proc_fin()
134     #define cpu_reset(addr)				processor.reset(addr)
135     #define cpu_do_idle(mode)			processor._do_idle(mode)
136     
137     #define cpu_cache_clean_invalidate_all()	processor.cache.clean_invalidate_all()
138     #define cpu_cache_clean_invalidate_range(s,e,f)	processor.cache.clean_invalidate_range(s,e,f)
139     #define cpu_flush_ram_page(vp)			processor.cache._flush_ram_page(vp)
140     
141     #define cpu_dcache_clean_page(vp)		processor.dcache.clean_page(vp)
142     #define cpu_dcache_clean_entry(addr)		processor.dcache.clean_entry(addr)
143     #define cpu_dcache_clean_range(s,e)		processor.dcache.clean_range(s,e)
144     #define cpu_dcache_invalidate_range(s,e)	processor.dcache.invalidate_range(s,e)
145     
146     #define cpu_icache_invalidate_range(s,e)	processor.icache.invalidate_range(s,e)
147     #define cpu_icache_invalidate_page(vp)		processor.icache.invalidate_page(vp)
148     
149     #define cpu_tlb_invalidate_all()		processor.tlb.invalidate_all()
150     #define cpu_tlb_invalidate_range(s,e)		processor.tlb.invalidate_range(s,e)
151     #define cpu_tlb_invalidate_page(vp,f)		processor.tlb.invalidate_page(vp,f)
152     
153     #define cpu_set_pgd(pgd)			processor.pgtable.set_pgd(pgd)
154     #define cpu_set_pmd(pmdp, pmd)			processor.pgtable.set_pmd(pmdp, pmd)
155     #define cpu_set_pte(ptep, pte)			processor.pgtable.set_pte(ptep, pte)
156     
157     #define cpu_switch_mm(pgd,tsk)			cpu_set_pgd(__virt_to_phys((unsigned long)(pgd)))
158     
159     #endif
160