ia64/xen-unstable

view linux-2.6-xen-sparse/include/asm-i386/mach-xen/setup_arch_post.h @ 13341:3040ba0f2d3d

When booting via xm, only run the bootloader if it's in non-interactive mode:
otherwise we lose the user's named kernel and try to bootload the temporary
file pygrub returned.

Signed-off-by: John Levon <john.levon@sun.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Tue Jan 09 13:24:45 2007 +0000 (2007-01-09)
parents f6b7ae6ed504
children
line source
1 /**
2 * machine_specific_memory_setup - Hook for machine specific memory 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 **/
9 #include <xen/interface/callback.h>
10 #include <xen/interface/memory.h>
12 static char * __init machine_specific_memory_setup(void)
13 {
14 int rc;
15 struct xen_memory_map memmap;
16 /*
17 * This is rather large for a stack variable but this early in
18 * the boot process we know we have plenty slack space.
19 */
20 struct e820entry map[E820MAX];
22 memmap.nr_entries = E820MAX;
23 set_xen_guest_handle(memmap.buffer, map);
25 rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
26 if ( rc == -ENOSYS ) {
27 memmap.nr_entries = 1;
28 map[0].addr = 0ULL;
29 map[0].size = PFN_PHYS(xen_start_info->nr_pages);
30 /* 8MB slack (to balance backend allocations). */
31 map[0].size += 8ULL << 20;
32 map[0].type = E820_RAM;
33 rc = 0;
34 }
35 BUG_ON(rc);
37 sanitize_e820_map(map, (char *)&memmap.nr_entries);
39 BUG_ON(copy_e820_map(map, (char)memmap.nr_entries) < 0);
41 return "Xen";
42 }
44 extern void hypervisor_callback(void);
45 extern void failsafe_callback(void);
46 extern void nmi(void);
48 unsigned long *machine_to_phys_mapping;
49 EXPORT_SYMBOL(machine_to_phys_mapping);
50 unsigned int machine_to_phys_order;
51 EXPORT_SYMBOL(machine_to_phys_order);
53 static void __init machine_specific_arch_setup(void)
54 {
55 int ret;
56 struct xen_machphys_mapping mapping;
57 unsigned long machine_to_phys_nr_ents;
58 struct xen_platform_parameters pp;
59 static struct callback_register __initdata event = {
60 .type = CALLBACKTYPE_event,
61 .address = { __KERNEL_CS, (unsigned long)hypervisor_callback },
62 };
63 static struct callback_register __initdata failsafe = {
64 .type = CALLBACKTYPE_failsafe,
65 .address = { __KERNEL_CS, (unsigned long)failsafe_callback },
66 };
67 static struct callback_register __initdata nmi_cb = {
68 .type = CALLBACKTYPE_nmi,
69 .address = { __KERNEL_CS, (unsigned long)nmi },
70 };
72 ret = HYPERVISOR_callback_op(CALLBACKOP_register, &event);
73 if (ret == 0)
74 ret = HYPERVISOR_callback_op(CALLBACKOP_register, &failsafe);
75 #ifdef CONFIG_XEN_COMPAT_030002
76 if (ret == -ENOSYS)
77 ret = HYPERVISOR_set_callbacks(
78 event.address.cs, event.address.eip,
79 failsafe.address.cs, failsafe.address.eip);
80 #endif
81 BUG_ON(ret);
83 ret = HYPERVISOR_callback_op(CALLBACKOP_register, &nmi_cb);
84 #ifdef CONFIG_XEN_COMPAT_030002
85 if (ret == -ENOSYS) {
86 static struct xennmi_callback __initdata cb = {
87 .handler_address = (unsigned long)nmi
88 };
90 HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
91 }
92 #endif
94 if (HYPERVISOR_xen_version(XENVER_platform_parameters,
95 &pp) == 0) {
96 hypervisor_virt_start = pp.virt_start;
97 set_fixaddr_top();
98 }
100 machine_to_phys_mapping = (unsigned long *)MACH2PHYS_VIRT_START;
101 machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES;
102 if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) {
103 machine_to_phys_mapping = (unsigned long *)mapping.v_start;
104 machine_to_phys_nr_ents = mapping.max_mfn + 1;
105 }
106 while ((1UL << machine_to_phys_order) < machine_to_phys_nr_ents )
107 machine_to_phys_order++;
108 }