direct-io.hg

view xen/include/asm-powerpc/processor.h @ 11498:464acece0dad

[POWERPC][XEN] Clear SLB entries on boot and other cleanups

This patch clears and SLB entries that might have been left behind by
Firmware and also cleans up the Save and Restore of the segments.

Signed-off-by: Jimi Xenidis <jimix@watson.ibm.com>
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author Jimi Xenidis <jimix@watson.ibm.com>
date Thu Sep 07 02:21:17 2006 -0400 (2006-09-07)
parents 22e01a4864b0
children 2ebf55e419c9
line source
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
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 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15 *
16 * Copyright (C) IBM Corp. 2005, 2006
17 *
18 * Authors: Hollis Blanchard <hollisb@us.ibm.com>
19 */
21 #ifndef _ASM_PROCESSOR_H_
22 #define _ASM_PROCESSOR_H_
24 #include <xen/config.h>
25 #include <asm/reg_defs.h>
26 #include <asm/msr.h>
28 #define IOBMP_BYTES 8192
29 #define IOBMP_INVALID_OFFSET 0x8000
31 /* most assembler do not know this instruction */
32 #define HRFID .long 0x4c000224
34 #ifndef __ASSEMBLY__
35 #include <xen/types.h>
37 struct domain;
38 struct vcpu;
39 struct cpu_user_regs;
40 extern int cpu_machinecheck(struct cpu_user_regs *);
41 extern void show_registers(struct cpu_user_regs *);
42 extern void show_execution_state(struct cpu_user_regs *);
43 extern void show_backtrace(ulong sp, ulong lr, ulong pc);
44 extern unsigned int cpu_extent_order(void);
45 extern unsigned int cpu_default_rma_order_pages(void);
46 extern int cpu_rma_valid(unsigned int log);
47 extern uint cpu_large_page_orders(uint *sizes, uint max);
48 extern void cpu_initialize(int cpuid);
49 extern void cpu_init_vcpu(struct vcpu *);
50 extern int cpu_io_mfn(ulong mfn);
51 extern void save_cpu_sprs(struct vcpu *);
52 extern void load_cpu_sprs(struct vcpu *);
53 extern void flush_segments(void);
54 extern void dump_segments(int valid);
56 /* XXX this could also land us in GDB */
57 #define dump_execution_state() BUG()
59 extern void __warn(char *file, int line);
60 #define WARN() __warn(__FILE__, __LINE__)
61 #define WARN_ON(_p) do { if (_p) WARN(); } while ( 0 )
63 #define ARCH_HAS_PREFETCH
64 static inline void prefetch(const void *x) {;}
66 static __inline__ void sync(void)
67 {
68 __asm__ __volatile__ ("sync");
69 }
71 static __inline__ void isync(void)
72 {
73 __asm__ __volatile__ ("isync");
74 }
76 static inline ulong mfmsr(void) {
77 ulong msr;
78 __asm__ __volatile__ ("mfmsr %0" : "=&r"(msr));
79 return msr;
80 }
82 static inline void nop(void) {
83 __asm__ __volatile__ ("nop");
84 }
85 #define cpu_relax() nop()
87 static inline unsigned int mftbu(void)
88 {
89 unsigned int tbu;
90 __asm__ __volatile__ ("mftbu %0" : "=r" (tbu));
91 return tbu;
92 }
94 static inline unsigned int mftbl(void)
95 {
96 unsigned int tbl;
97 __asm__ __volatile__ ("mftbl %0" : "=r" (tbl));
98 return tbl;
99 }
101 static inline unsigned int mfdec(void)
102 {
103 unsigned int tmp;
104 __asm__ __volatile__ ("mfdec %0" : "=r"(tmp));
105 return tmp;
106 }
107 static inline void mtdec(unsigned int ticks)
108 {
109 __asm__ __volatile__ ("mtdec %0" : : "r" (ticks));
110 }
112 static inline u32 mfpvr(void) {
113 u32 pvr;
114 asm volatile("mfpvr %0" : "=&r" (pvr));
115 return pvr;
116 }
118 static inline ulong mfr1(void)
119 {
120 ulong r1;
121 asm volatile("mr %0, 1" : "=&r" (r1));
122 return r1;
123 }
125 static inline void mtsprg0(ulong val)
126 {
127 __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_SPRG0), "r"(val));
128 }
129 static inline ulong mfsprg0(void)
130 {
131 ulong val;
132 __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_SPRG0));
133 return val;
134 }
136 static inline void mtsprg1(ulong val)
137 {
138 __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_SPRG1), "r"(val));
139 }
140 static inline ulong mfsprg1(void)
141 {
142 ulong val;
143 __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_SPRG1));
144 return val;
145 }
147 static inline void mtsprg2(ulong val)
148 {
149 __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_SPRG2), "r"(val));
150 }
151 static inline ulong mfsprg2(void)
152 {
153 ulong val;
154 __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_SPRG2));
155 return val;
156 }
158 static inline void mtsprg3(ulong val)
159 {
160 __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_SPRG3), "r"(val));
161 }
162 static inline ulong mfsprg3(void)
163 {
164 ulong val;
165 __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_SPRG3));
166 return val;
167 }
169 static inline void mtsdr1(ulong val)
170 {
171 __asm__ __volatile__ ("mtsdr1 %0" : : "r"(val));
172 }
173 static inline ulong mfsdr1(void)
174 {
175 ulong val;
176 __asm__ __volatile__ ("mfsdr1 %0" : "=r"(val));
177 return val;
178 }
180 static inline void mtdar(ulong val)
181 {
182 __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_DAR), "r"(val));
183 }
184 static inline ulong mfdar(void)
185 {
186 ulong val;
187 __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_DAR));
188 return val;
189 }
191 static inline void mtdsisr(ulong val)
192 {
193 __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_DSISR), "r"(val));
194 }
195 static inline unsigned mfdsisr(void)
196 {
197 unsigned val;
198 __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_DSISR));
199 return val;
200 }
202 #ifdef CONFIG_MAMBO
203 static inline int on_mambo(void)
204 {
205 return !!(mfmsr() & MSR_MAMBO);
206 }
207 #else /* CONFIG_MAMBO */
208 static inline int on_mambo(void) { return 0; }
209 #endif
211 #endif /* __ASSEMBLY__ */
213 #include <asm/powerpc64/processor.h>
215 #endif