direct-io.hg

view xen/include/asm-powerpc/processor.h @ 11526:ce9c34c049c5

[POWERPC][XEN] Track the Hard CPUID as configured by the FW

This patch correctly implements and supports hard_smp_processor_id().

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 Mon Sep 18 09:23:51 2006 -0400 (2006-09-18)
parents 8ca32cdc9841
children 4da585fb62f9
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 cpu_scom_init(void);
42 extern void show_registers(struct cpu_user_regs *);
43 extern void show_execution_state(struct cpu_user_regs *);
44 extern void show_backtrace(ulong sp, ulong lr, ulong pc);
45 extern unsigned int cpu_extent_order(void);
46 extern unsigned int cpu_default_rma_order_pages(void);
47 extern int cpu_rma_valid(unsigned int log);
48 extern uint cpu_large_page_orders(uint *sizes, uint max);
49 extern void cpu_initialize(int cpuid);
50 extern void cpu_init_vcpu(struct vcpu *);
51 extern int cpu_io_mfn(ulong mfn);
52 extern void save_cpu_sprs(struct vcpu *);
53 extern void load_cpu_sprs(struct vcpu *);
54 extern void flush_segments(void);
55 extern void dump_segments(int valid);
57 /* XXX this could also land us in GDB */
58 #define dump_execution_state() BUG()
60 extern void __warn(char *file, int line);
61 #define WARN() __warn(__FILE__, __LINE__)
62 #define WARN_ON(_p) do { if (_p) WARN(); } while ( 0 )
64 #define ARCH_HAS_PREFETCH
65 static inline void prefetch(const void *x) {;}
67 static __inline__ void sync(void)
68 {
69 __asm__ __volatile__ ("sync");
70 }
72 static __inline__ void isync(void)
73 {
74 __asm__ __volatile__ ("isync");
75 }
77 static inline ulong mfmsr(void) {
78 ulong msr;
79 __asm__ __volatile__ ("mfmsr %0" : "=&r"(msr));
80 return msr;
81 }
83 static inline void nop(void) {
84 __asm__ __volatile__ ("nop");
85 }
86 #define cpu_relax() nop()
88 static inline unsigned int mfpir(void)
89 {
90 unsigned int pir;
91 __asm__ __volatile__ ("mfspr %0, %1" : "=r" (pir): "i"(SPRN_PIR));
92 return pir;
93 }
95 static inline unsigned int mftbu(void)
96 {
97 unsigned int tbu;
98 __asm__ __volatile__ ("mftbu %0" : "=r" (tbu));
99 return tbu;
100 }
102 static inline unsigned int mftbl(void)
103 {
104 unsigned int tbl;
105 __asm__ __volatile__ ("mftbl %0" : "=r" (tbl));
106 return tbl;
107 }
109 static inline unsigned int mfdec(void)
110 {
111 unsigned int tmp;
112 __asm__ __volatile__ ("mfdec %0" : "=r"(tmp));
113 return tmp;
114 }
115 static inline void mtdec(unsigned int ticks)
116 {
117 __asm__ __volatile__ ("mtdec %0" : : "r" (ticks));
118 }
120 static inline u32 mfpvr(void) {
121 u32 pvr;
122 asm volatile("mfpvr %0" : "=&r" (pvr));
123 return pvr;
124 }
126 static inline ulong mfr1(void)
127 {
128 ulong r1;
129 asm volatile("mr %0, 1" : "=&r" (r1));
130 return r1;
131 }
133 static inline void mtsprg0(ulong val)
134 {
135 __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_SPRG0), "r"(val));
136 }
137 static inline ulong mfsprg0(void)
138 {
139 ulong val;
140 __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_SPRG0));
141 return val;
142 }
144 static inline void mtsprg1(ulong val)
145 {
146 __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_SPRG1), "r"(val));
147 }
148 static inline ulong mfsprg1(void)
149 {
150 ulong val;
151 __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_SPRG1));
152 return val;
153 }
155 static inline void mtsprg2(ulong val)
156 {
157 __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_SPRG2), "r"(val));
158 }
159 static inline ulong mfsprg2(void)
160 {
161 ulong val;
162 __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_SPRG2));
163 return val;
164 }
166 static inline void mtsprg3(ulong val)
167 {
168 __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_SPRG3), "r"(val));
169 }
170 static inline ulong mfsprg3(void)
171 {
172 ulong val;
173 __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_SPRG3));
174 return val;
175 }
177 static inline void mtsdr1(ulong val)
178 {
179 __asm__ __volatile__ ("mtsdr1 %0" : : "r"(val));
180 }
181 static inline ulong mfsdr1(void)
182 {
183 ulong val;
184 __asm__ __volatile__ ("mfsdr1 %0" : "=r"(val));
185 return val;
186 }
188 static inline void mtdar(ulong val)
189 {
190 __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_DAR), "r"(val));
191 }
192 static inline ulong mfdar(void)
193 {
194 ulong val;
195 __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_DAR));
196 return val;
197 }
199 static inline void mtdsisr(ulong val)
200 {
201 __asm__ __volatile__ ("mtspr %0, %1" : : "i"(SPRN_DSISR), "r"(val));
202 }
203 static inline unsigned mfdsisr(void)
204 {
205 unsigned val;
206 __asm__ __volatile__ ("mfspr %0, %1" : "=r"(val) : "i"(SPRN_DSISR));
207 return val;
208 }
210 #ifdef CONFIG_MAMBO
211 static inline int on_mambo(void)
212 {
213 return !!(mfmsr() & MSR_MAMBO);
214 }
215 #else /* CONFIG_MAMBO */
216 static inline int on_mambo(void) { return 0; }
217 #endif
219 #endif /* __ASSEMBLY__ */
221 #include <asm/powerpc64/processor.h>
223 #endif