ia64/xen-unstable

view xen/arch/ia64/xenmisc.c @ 4703:d061c29af8d7

bitkeeper revision 1.1327.1.11 (42716283nLvDhTYM3QOqDMa-wZuJHQ)

More code cleanup
author djm@kirby.fc.hp.com
date Thu Apr 28 22:24:03 2005 +0000 (2005-04-28)
parents 065f8708a9e2
children 593703cf4935
line source
1 /*
2 * Xen misc
3 *
4 * Functions/decls that are/may be needed to link with Xen because
5 * of x86 dependencies
6 *
7 * Copyright (C) 2004 Hewlett-Packard Co.
8 * Dan Magenheimer (dan.magenheimer@hp.com)
9 *
10 */
12 #include <linux/config.h>
13 #include <xen/sched.h>
14 #include <linux/efi.h>
15 #include <asm/processor.h>
16 #include <xen/serial.h>
17 #include <asm/io.h>
18 #include <xen/softirq.h>
20 efi_memory_desc_t ia64_efi_io_md;
21 EXPORT_SYMBOL(ia64_efi_io_md);
22 unsigned long wait_init_idle;
23 int phys_proc_id[NR_CPUS];
24 unsigned long loops_per_jiffy = (1<<12); // from linux/init/main.c
26 unsigned int watchdog_on = 0; // from arch/x86/nmi.c ?!?
28 void unw_init(void) { printf("unw_init() skipped (NEED FOR KERNEL UNWIND)\n"); }
29 void ia64_mca_init(void) { printf("ia64_mca_init() skipped (Machine check abort handling)\n"); }
30 void hpsim_setup(char **x) { printf("hpsim_setup() skipped (MAY NEED FOR CONSOLE INPUT!!!)\n"); }
32 long
33 is_platform_hp_ski(void)
34 {
35 int i;
36 long cpuid[6];
38 for (i = 0; i < 5; ++i)
39 cpuid[i] = ia64_get_cpuid(i);
40 if ((cpuid[0] & 0xff) != 'H') return 0;
41 if ((cpuid[3] & 0xff) != 0x4) return 0;
42 if (((cpuid[3] >> 8) & 0xff) != 0x0) return 0;
43 if (((cpuid[3] >> 16) & 0xff) != 0x0) return 0;
44 if (((cpuid[3] >> 24) & 0x7) != 0x7) return 0;
45 return 1;
46 }
48 long
49 platform_is_hp_ski(void)
50 {
51 extern long running_on_sim;
52 return running_on_sim;
53 }
55 /* calls in xen/common code that are unused on ia64 */
57 void sync_lazy_execstate_cpuset(unsigned long cpuset) {}
58 void sync_lazy_execstate_all(void) {}
60 int grant_table_create(struct domain *d) { return 0; }
61 void grant_table_destroy(struct domain *d)
62 {
63 printf("grant_table_destroy: domain_destruct not tested!!!\n");
64 printf("grant_table_destroy: ensure atomic_* calls work in domain_destruct!!\n");
65 dummy();
66 return;
67 }
69 struct pt_regs *get_execution_context(void) { return ia64_task_regs(current); }
71 void raise_actimer_softirq(void)
72 {
73 raise_softirq(AC_TIMER_SOFTIRQ);
74 }
76 ///////////////////////////////
77 // from arch/x86/apic.c
78 ///////////////////////////////
80 int reprogram_ac_timer(s_time_t timeout)
81 {
82 struct exec_domain *ed = current;
84 local_cpu_data->itm_next = timeout;
85 if (is_idle_task(ed->domain)) vcpu_safe_set_itm(timeout);
86 else vcpu_set_next_timer(current);
87 return 1;
88 }
90 ///////////////////////////////
91 // from arch/ia64/page_alloc.c
92 ///////////////////////////////
93 DEFINE_PER_CPU(struct page_state, page_states) = {0};
94 unsigned long totalram_pages;
96 void __mod_page_state(unsigned offset, unsigned long delta)
97 {
98 unsigned long flags;
99 void* ptr;
101 local_irq_save(flags);
102 ptr = &__get_cpu_var(page_states);
103 *(unsigned long*)(ptr + offset) += delta;
104 local_irq_restore(flags);
105 }
107 ///////////////////////////////
108 // from arch/x86/flushtlb.c
109 ///////////////////////////////
111 u32 tlbflush_clock;
112 u32 tlbflush_time[NR_CPUS];
114 ///////////////////////////////
115 // from arch/x86/memory.c
116 ///////////////////////////////
118 void init_percpu_info(void)
119 {
120 dummy();
121 //memset(percpu_info, 0, sizeof(percpu_info));
122 }
124 void free_page_type(struct pfn_info *page, unsigned int type)
125 {
126 dummy();
127 }
129 ///////////////////////////////
130 // from arch/x86/pci.c
131 ///////////////////////////////
133 int
134 pcibios_prep_mwi (struct pci_dev *dev)
135 {
136 dummy();
137 }
139 ///////////////////////////////
140 // from arch/x86/pci-irq.c
141 ///////////////////////////////
143 void pcibios_enable_irq(struct pci_dev *dev)
144 {
145 dummy();
146 }
148 ///////////////////////////////
149 // from arch/ia64/pci-pc.c
150 ///////////////////////////////
152 #include <xen/pci.h>
154 int pcibios_enable_device(struct pci_dev *dev, int mask)
155 {
156 dummy();
157 return 0;
158 }
160 int (*pci_config_read)(int seg, int bus, int dev, int fn, int reg, int len, u32 *value) = NULL;
161 int (*pci_config_write)(int seg, int bus, int dev, int fn, int reg, int len, u32 value) = NULL;
163 //struct pci_fixup pcibios_fixups[] = { { 0 } };
164 struct pci_fixup pcibios_fixups[] = { { 0 } };
166 void
167 pcibios_align_resource(void *data, struct resource *res,
168 unsigned long size, unsigned long align)
169 {
170 dummy();
171 }
173 void
174 pcibios_update_resource(struct pci_dev *dev, struct resource *root,
175 struct resource *res, int resource)
176 {
177 dummy();
178 }
180 void __devinit pcibios_fixup_bus(struct pci_bus *b)
181 {
182 dummy();
183 }
185 void __init pcibios_init(void)
186 {
187 dummy();
188 }
190 char * __devinit pcibios_setup(char *str)
191 {
192 dummy();
193 return 0;
194 }
196 ///////////////////////////////
197 // from arch/ia64/traps.c
198 ///////////////////////////////
200 void show_registers(struct pt_regs *regs)
201 {
202 printf("*** ADD REGISTER DUMP HERE FOR DEBUGGING\n");
203 }
205 ///////////////////////////////
206 // from common/keyhandler.c
207 ///////////////////////////////
208 void dump_pageframe_info(struct domain *d)
209 {
210 printk("dump_pageframe_info not implemented\n");
211 }
213 ///////////////////////////////
214 // from common/physdev.c
215 ///////////////////////////////
216 void
217 physdev_init_dom0(struct domain *d)
218 {
219 }
221 int
222 physdev_pci_access_modify(domid_t id, int bus, int dev, int func, int enable)
223 {
224 return -EINVAL;
225 }
227 void physdev_modify_ioport_access_range(struct domain *d, int enable,
228 int port, int num)
229 {
230 printk("physdev_modify_ioport_access_range not implemented\n");
231 dummy();
232 }
234 void physdev_destroy_state(struct domain *d)
235 {
236 printk("physdev_destroy_state not implemented\n");
237 dummy();
238 }
240 ///////////////////////////////
241 // called from arch/ia64/head.S
242 ///////////////////////////////
244 void console_print(char *msg)
245 {
246 printk("console_print called, how did start_kernel return???\n");
247 }
249 void kernel_thread_helper(void)
250 {
251 printk("kernel_thread_helper not implemented\n");
252 dummy();
253 }
255 void sys_exit(void)
256 {
257 printk("sys_exit not implemented\n");
258 dummy();
259 }
261 ////////////////////////////////////
262 // called from unaligned.c
263 ////////////////////////////////////
265 void die_if_kernel(char *str, struct pt_regs *regs, long err) /* __attribute__ ((noreturn)) */
266 {
267 printk("die_if_kernel: called, not implemented\n");
268 }
270 long
271 ia64_peek (struct task_struct *child, struct switch_stack *child_stack,
272 unsigned long user_rbs_end, unsigned long addr, long *val)
273 {
274 printk("ia64_peek: called, not implemented\n");
275 }
277 long
278 ia64_poke (struct task_struct *child, struct switch_stack *child_stack,
279 unsigned long user_rbs_end, unsigned long addr, long val)
280 {
281 printk("ia64_poke: called, not implemented\n");
282 }
284 void
285 ia64_sync_fph (struct task_struct *task)
286 {
287 printk("ia64_sync_fph: called, not implemented\n");
288 }
290 void
291 ia64_flush_fph (struct task_struct *task)
292 {
293 printk("ia64_flush_fph: called, not implemented\n");
294 }
296 ////////////////////////////////////
297 // called from irq_ia64.c:init_IRQ()
298 // (because CONFIG_IA64_HP_SIM is specified)
299 ////////////////////////////////////
300 void hpsim_irq_init(void) { }
303 // accomodate linux extable.c
304 //const struct exception_table_entry *
305 void *search_module_extables(unsigned long addr) { return NULL; }
306 void *__module_text_address(unsigned long addr) { return NULL; }
307 void *module_text_address(unsigned long addr) { return NULL; }
309 void cs10foo(void) {}
310 void cs01foo(void) {}
312 // context_switch
313 void context_switch(struct exec_domain *prev, struct exec_domain *next)
314 {
315 //printk("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
316 //printk("@@@@@@ context switch from domain %d (%x) to domain %d (%x)\n",
317 //prev->domain->id,(long)prev&0xffffff,next->domain->id,(long)next&0xffffff);
318 //if (prev->domain->id == 1 && next->domain->id == 0) cs10foo();
319 //if (prev->domain->id == 0 && next->domain->id == 1) cs01foo();
320 //printk("@@sw %d->%d\n",prev->domain->id,next->domain->id);
321 switch_to(prev,next,prev);
322 // leave this debug for now: it acts as a heartbeat when more than
323 // one domain is active
324 {
325 static long cnt[16] = { 50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50};
326 static int i = 100;
327 int id = ((struct exec_domain *)current)->domain->id & 0xf;
328 if (!cnt[id]--) { printk("%x",id); cnt[id] = 50; }
329 if (!i--) { printk("+",id); cnt[id] = 100; }
330 }
331 clear_bit(EDF_RUNNING, &prev->ed_flags);
332 //if (!is_idle_task(next->domain) )
333 //send_guest_virq(next, VIRQ_TIMER);
334 load_region_regs(current);
335 if (vcpu_timer_expired(current)) vcpu_pend_timer(current);
336 }
338 void panic_domain(struct pt_regs *regs, const char *fmt, ...)
339 {
340 va_list args;
341 char buf[128];
342 struct exec_domain *ed = current;
343 static volatile int test = 1; // so can continue easily in debug
344 extern spinlock_t console_lock;
345 unsigned long flags;
347 loop:
348 printf("$$$$$ PANIC in domain %d (k6=%p): ",
349 ed->domain->id, ia64_get_kr(IA64_KR_CURRENT));
350 va_start(args, fmt);
351 (void)vsnprintf(buf, sizeof(buf), fmt, args);
352 va_end(args);
353 printf(buf);
354 if (regs) show_registers(regs);
355 domain_pause_by_systemcontroller(current->domain);
356 set_bit(DF_CRASHED, ed->domain->d_flags);
357 if (ed->domain->id == 0) {
358 int i = 1000000000L;
359 // if domain0 crashes, just periodically print out panic
360 // message to make post-mortem easier
361 while(i--);
362 goto loop;
363 }
364 }