This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / include / asm-x86_64 / mach-xen / setup_arch_post.h
1 /**
2  * machine_specific_* - Hooks for machine specific setup.
3  *
4  * Description:
5  *      This is included late in kernel/setup.c so that it can make
6  *      use of all of the static functions.
7  **/
8
9 #include <xen/interface/callback.h>
10
11 extern void hypervisor_callback(void);
12 extern void failsafe_callback(void);
13 extern void nmi(void);
14
15 static void __init machine_specific_arch_setup(void)
16 {
17         int ret;
18         struct callback_register event = {
19                 .type = CALLBACKTYPE_event,
20                 .address = (unsigned long) hypervisor_callback,
21         };
22         struct callback_register failsafe = {
23                 .type = CALLBACKTYPE_failsafe,
24                 .address = (unsigned long)failsafe_callback,
25         };
26         struct callback_register syscall = {
27                 .type = CALLBACKTYPE_syscall,
28                 .address = (unsigned long)system_call,
29         };
30 #ifdef CONFIG_X86_LOCAL_APIC
31         struct callback_register nmi_cb = {
32                 .type = CALLBACKTYPE_nmi,
33                 .address = (unsigned long)nmi,
34         };
35 #endif
36
37         ret = HYPERVISOR_callback_op(CALLBACKOP_register, &event);
38         if (ret == 0)
39                 ret = HYPERVISOR_callback_op(CALLBACKOP_register, &failsafe);
40         if (ret == 0)
41                 ret = HYPERVISOR_callback_op(CALLBACKOP_register, &syscall);
42         if (ret == -ENOSYS)
43                 ret = HYPERVISOR_set_callbacks(
44                         event.address,
45                         failsafe.address,
46                         syscall.address);
47         BUG_ON(ret);
48
49 #ifdef CONFIG_X86_LOCAL_APIC
50         ret = HYPERVISOR_callback_op(CALLBACKOP_register, &nmi_cb);
51         if (ret == -ENOSYS) {
52                 struct xennmi_callback cb;
53
54                 cb.handler_address = nmi_cb.address;
55                 HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
56         }
57 #endif
58 }