Merge git://git.kernel.org/pub/scm/linux/kernel/git/viro/bdev
[linux-2.6] / 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         .text
58
59 GLOBAL_ENTRY(xen_setup_hook)
60         mov r8=XEN_PV_DOMAIN_ASM
61 (isBP)  movl r9=xen_domain_type;;
62 (isBP)  st4 [r9]=r8
63         movl r10=xen_ivt;;
64
65         mov cr.iva=r10
66
67         /* Set xsi base.  */
68 #define FW_HYPERCALL_SET_SHARED_INFO_VA                 0x600
69 (isBP)  mov r2=FW_HYPERCALL_SET_SHARED_INFO_VA
70 (isBP)  movl r28=XSI_BASE;;
71 (isBP)  break 0x1000;;
72
73         /* setup pv_ops */
74 (isBP)  mov r4=rp
75         ;;
76 (isBP)  br.call.sptk.many rp=xen_setup_pv_ops
77         ;;
78 (isBP)  mov rp=r4
79         ;;
80
81         br.ret.sptk.many rp
82         ;;
83 END(xen_setup_hook)