Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
[pandora-kernel.git] / arch / ia64 / xen / xensetup.S
1 /*
2  * Support routines for Xen
3  *
4  * Copyright (C) 2005 Dan Magenheimer <dan.magenheimer@hp.com>
5  */
6
7 #include <asm/processor.h>
8 #include <asm/asmmacro.h>
9 #include <asm/pgtable.h>
10 #include <asm/system.h>
11 #include <asm/paravirt.h>
12 #include <asm/xen/privop.h>
13 #include <linux/elfnote.h>
14 #include <linux/init.h>
15 #include <xen/interface/elfnote.h>
16
17         .section .data..read_mostly
18         .align 8
19         .global xen_domain_type
20 xen_domain_type:
21         data4 XEN_NATIVE_ASM
22         .previous
23
24         __INIT
25 ENTRY(startup_xen)
26         // Calculate load offset.
27         // The constant, LOAD_OFFSET, can't be used because the boot
28         // loader doesn't always load to the LMA specified by the vmlinux.lds.
29         mov r9=ip       // must be the first instruction to make sure
30                         // that r9 = the physical address of startup_xen.
31                         // Usually r9 = startup_xen - LOAD_OFFSET
32         movl r8=startup_xen
33         ;;
34         sub r9=r9,r8    // Usually r9 = -LOAD_OFFSET.
35
36         mov r10=PARAVIRT_HYPERVISOR_TYPE_XEN
37         movl r11=_start
38         ;;
39         add r11=r11,r9
40         movl r8=hypervisor_type
41         ;;
42         add r8=r8,r9
43         mov b0=r11
44         ;;
45         st8 [r8]=r10
46         br.cond.sptk.many b0
47         ;;
48 END(startup_xen)
49
50         ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,      .asciz "linux")
51         ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION, .asciz "2.6")
52         ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION,   .asciz "xen-3.0")
53         ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,         data8.ua startup_xen - LOAD_OFFSET)
54
55 #define isBP    p3      // are we the Bootstrap Processor?
56
57 GLOBAL_ENTRY(xen_setup_hook)
58         mov r8=XEN_PV_DOMAIN_ASM
59 (isBP)  movl r9=xen_domain_type;;
60 (isBP)  st4 [r9]=r8
61         movl r10=xen_ivt;;
62
63         mov cr.iva=r10
64
65         /* Set xsi base.  */
66 #define FW_HYPERCALL_SET_SHARED_INFO_VA                 0x600
67 (isBP)  mov r2=FW_HYPERCALL_SET_SHARED_INFO_VA
68 (isBP)  movl r28=XSI_BASE;;
69 (isBP)  break 0x1000;;
70
71         /* setup pv_ops */
72 (isBP)  mov r4=rp
73         ;;
74 (isBP)  br.call.sptk.many rp=xen_setup_pv_ops
75         ;;
76 (isBP)  mov rp=r4
77         ;;
78
79         br.ret.sptk.many rp
80         ;;
81 END(xen_setup_hook)