ia64/xen-unstable

view xen/arch/ia64/pal_emul.c @ 6552:a9873d384da4

Merge.
author adsharma@los-vmm.sc.intel.com
date Thu Aug 25 12:24:48 2005 -0700 (2005-08-25)
parents 112d44270733 fa0754a9f64f
children dfaf788ab18c
line source
1 /*
2 * PAL/SAL call delegation
3 *
4 * Copyright (c) 2004 Li Susie <susie.li@intel.com>
5 * Copyright (c) 2005 Yu Ke <ke.yu@intel.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18 * Place - Suite 330, Boston, MA 02111-1307 USA.
19 */
21 #include <asm/vmx_vcpu.h>
23 static void
24 get_pal_parameters (VCPU *vcpu, UINT64 *gr29,
25 UINT64 *gr30, UINT64 *gr31) {
27 vmx_vcpu_get_gr(vcpu,29,gr29);
28 vmx_vcpu_get_gr(vcpu,30,gr30);
29 vmx_vcpu_get_gr(vcpu,31,gr31);
30 }
32 static void
33 set_pal_result (VCPU *vcpu,struct ia64_pal_retval result) {
35 vmx_vcpu_set_gr(vcpu,8, result.status,0);
36 vmx_vcpu_set_gr(vcpu,9, result.v0,0);
37 vmx_vcpu_set_gr(vcpu,10, result.v1,0);
38 vmx_vcpu_set_gr(vcpu,11, result.v2,0);
39 }
42 static struct ia64_pal_retval
43 pal_cache_flush (VCPU *vcpu) {
44 UINT64 gr28,gr29, gr30, gr31;
45 struct ia64_pal_retval result;
47 get_pal_parameters (vcpu, &gr29, &gr30, &gr31);
48 vmx_vcpu_get_gr(vcpu,28,&gr28);
50 /* Always call Host Pal in int=1 */
51 gr30 = gr30 &(~(0x2UL));
53 /* call Host PAL cache flush */
54 result=ia64_pal_call_static(gr28 ,gr29, gr30,gr31,1); // Clear psr.ic when call PAL_CACHE_FLUSH
56 /* If host PAL call is interrupted, then loop to complete it */
57 // while (result.status == 1) {
58 // ia64_pal_call_static(gr28 ,gr29, gr30,
59 // result.v1,1LL);
60 // }
61 while (result.status != 0) {
62 panic("PAL_CACHE_FLUSH ERROR, status %d", result.status);
63 }
65 return result;
66 }
68 static struct ia64_pal_retval
69 pal_vm_tr_read (VCPU *vcpu ) {
70 #warning pal_vm_tr_read: to be implemented
71 struct ia64_pal_retval result;
73 result.status= -1; //unimplemented
75 return result;
76 }
79 static struct ia64_pal_retval
80 pal_prefetch_visibility (VCPU *vcpu) {
81 /* Due to current MM virtualization algorithm,
82 * We do not allow guest to change mapping attribute.
83 * Thus we will not support PAL_PREFETCH_VISIBILITY
84 */
85 struct ia64_pal_retval result;
87 result.status= -1; //unimplemented
89 return result;
90 }
92 static struct ia64_pal_retval
93 pal_platform_addr(VCPU *vcpu) {
94 struct ia64_pal_retval result;
96 result.status= 0; //success
98 return result;
99 }
101 static struct ia64_pal_retval
102 pal_halt (VCPU *vcpu) {
103 #warning pal_halt: to be implemented
104 //bugbug: to be implement.
105 struct ia64_pal_retval result;
107 result.status= -1; //unimplemented
109 return result;
110 }
113 static struct ia64_pal_retval
114 pal_halt_light (VCPU *vcpu) {
115 struct ia64_pal_retval result;
117 result.status= -1; //unimplemented
119 return result;
120 }
122 static struct ia64_pal_retval
123 pal_cache_read (VCPU *vcpu) {
124 struct ia64_pal_retval result;
126 result.status= -1; //unimplemented
128 return result;
129 }
131 static struct ia64_pal_retval
132 pal_cache_write (VCPU *vcpu) {
133 struct ia64_pal_retval result;
135 result.status= -1; //unimplemented
137 return result;
138 }
140 static struct ia64_pal_retval
141 pal_bus_get_features(VCPU *vcpu){
143 }
145 static struct ia64_pal_retval
146 pal_cache_summary(VCPU *vcpu){
148 }
150 static struct ia64_pal_retval
151 pal_cache_init(VCPU *vcpu){
152 struct ia64_pal_retval result;
153 result.status=0;
154 return result;
155 }
157 static struct ia64_pal_retval
158 pal_cache_info(VCPU *vcpu){
159 }
161 static struct ia64_pal_retval
162 pal_cache_prot_info(VCPU *vcpu){
163 }
165 static struct ia64_pal_retval
166 pal_cache_shared_info(VCPU *vcpu){
167 }
169 static struct ia64_pal_retval
170 pal_mem_attrib(VCPU *vcpu){
171 }
173 static struct ia64_pal_retval
174 pal_debug_info(VCPU *vcpu){
175 }
177 static struct ia64_pal_retval
178 pal_fixed_addr(VCPU *vcpu){
179 }
181 static struct ia64_pal_retval
182 pal_freq_base(VCPU *vcpu){
183 }
185 static struct ia64_pal_retval
186 pal_freq_ratios(VCPU *vcpu){
187 }
189 static struct ia64_pal_retval
190 pal_halt_info(VCPU *vcpu){
191 }
193 static struct ia64_pal_retval
194 pal_logical_to_physica(VCPU *vcpu){
195 }
197 static struct ia64_pal_retval
198 pal_perf_mon_info(VCPU *vcpu){
199 }
201 static struct ia64_pal_retval
202 pal_proc_get_features(VCPU *vcpu){
203 }
205 static struct ia64_pal_retval
206 pal_ptce_info(VCPU *vcpu){
207 }
209 static struct ia64_pal_retval
210 pal_register_info(VCPU *vcpu){
211 }
213 static struct ia64_pal_retval
214 pal_rse_info(VCPU *vcpu){
215 }
217 static struct ia64_pal_retval
218 pal_test_info(VCPU *vcpu){
219 }
221 static struct ia64_pal_retval
222 pal_vm_summary(VCPU *vcpu){
223 }
225 static struct ia64_pal_retval
226 pal_vm_info(VCPU *vcpu){
227 }
229 static struct ia64_pal_retval
230 pal_vm_page_size(VCPU *vcpu){
231 }
233 void
234 pal_emul( VCPU *vcpu) {
235 UINT64 gr28;
236 struct ia64_pal_retval result;
239 vmx_vcpu_get_gr(vcpu,28,&gr28); //bank1
241 switch (gr28) {
242 case PAL_CACHE_FLUSH:
243 result = pal_cache_flush (vcpu);
244 break;
246 case PAL_PREFETCH_VISIBILITY:
247 result = pal_prefetch_visibility (vcpu);
248 break;
250 case PAL_VM_TR_READ:
251 result = pal_vm_tr_read (vcpu);
252 break;
254 case PAL_HALT:
255 result = pal_halt (vcpu);
256 break;
258 case PAL_HALT_LIGHT:
259 result = pal_halt_light (vcpu);
260 break;
262 case PAL_CACHE_READ:
263 result = pal_cache_read (vcpu);
264 break;
266 case PAL_CACHE_WRITE:
267 result = pal_cache_write (vcpu);
268 break;
270 case PAL_PLATFORM_ADDR:
271 result = pal_platform_addr (vcpu);
272 break;
274 default:
275 panic("pal_emul(): guest call unsupported pal" );
276 }
277 set_pal_result (vcpu, result);
278 }