ia64/xen-unstable

view xen/arch/ia64/xen/xensetup.c @ 17886:cfbc535ebf6f

[IA64] efi: remove old efi code to copmile newer linux acpi code.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Wed Jun 11 16:57:42 2008 +0900 (2008-06-11)
parents 96b099ad0497
children 18a933a52874
line source
1 /******************************************************************************
2 * xensetup.c
3 * Copyright (c) 2004-2005 Hewlett-Packard Co
4 * Dan Magenheimer <dan.magenheimer@hp.com>
5 */
7 #include <xen/config.h>
8 #include <xen/lib.h>
9 #include <xen/errno.h>
10 #include <xen/multiboot.h>
11 #include <xen/sched.h>
12 #include <xen/mm.h>
13 #include <public/version.h>
14 #include <xen/gdbstub.h>
15 #include <xen/version.h>
16 #include <xen/console.h>
17 #include <xen/domain.h>
18 #include <xen/serial.h>
19 #include <xen/trace.h>
20 #include <xen/keyhandler.h>
21 #include <xen/vga.h>
22 #include <asm/meminit.h>
23 #include <asm/page.h>
24 #include <asm/setup.h>
25 #include <asm/vhpt.h>
26 #include <xen/string.h>
27 #include <asm/vmx.h>
28 #include <linux/efi.h>
29 #include <asm/iosapic.h>
30 #include <xen/softirq.h>
31 #include <xen/rcupdate.h>
32 #include <xsm/acm/acm_hooks.h>
33 #include <asm/sn/simulator.h>
34 #include <linux/asm/sal.h>
36 unsigned long xenheap_phys_end, total_pages;
38 char saved_command_line[COMMAND_LINE_SIZE];
39 char __initdata dom0_command_line[COMMAND_LINE_SIZE];
41 cpumask_t cpu_present_map;
43 extern unsigned long domain0_ready;
45 int find_max_pfn (unsigned long, unsigned long, void *);
47 /* FIXME: which header these declarations should be there ? */
48 extern void early_setup_arch(char **);
49 extern void late_setup_arch(char **);
50 extern void hpsim_serial_init(void);
51 extern void setup_per_cpu_areas(void);
52 extern void mem_init(void);
53 extern void init_IRQ(void);
54 extern void trap_init(void);
55 extern void xen_patch_kernel(void);
57 /* nosmp: ignore secondary processors */
58 static int __initdata opt_nosmp;
59 boolean_param("nosmp", opt_nosmp);
61 /* maxcpus: maximum number of CPUs to activate */
62 static unsigned int __initdata max_cpus = NR_CPUS;
63 integer_param("maxcpus", max_cpus);
65 /* xencons: toggle xenconsole input (and irq).
66 Note: you have to disable 8250 serials in domains (to avoid use of the
67 same resource). */
68 static int __initdata opt_xencons = 1;
69 integer_param("xencons", opt_xencons);
71 /* xencons_poll: toggle non-legacy xencons UARTs to run in polling mode */
72 static int __initdata opt_xencons_poll;
73 boolean_param("xencons_poll", opt_xencons_poll);
75 unsigned long xenheap_size = XENHEAP_DEFAULT_SIZE;
76 unsigned long xen_pstart;
77 void *xen_pickle_offset __read_mostly;
79 static void __init parse_xenheap_megabytes(char *s)
80 {
81 unsigned long megabytes = simple_strtoll(s, NULL, 0);
83 #define XENHEAP_MEGABYTES_MIN 16UL
84 if (megabytes < XENHEAP_MEGABYTES_MIN)
85 megabytes = XENHEAP_MEGABYTES_MIN;
87 #define XENHEAP_MEGABYTES_MAX 4096UL /* need more? If so,
88 __pickle()/__unpickle() must be
89 revised. */
90 if (megabytes > XENHEAP_MEGABYTES_MAX)
91 megabytes = XENHEAP_MEGABYTES_MAX;
93 xenheap_size = megabytes * 1024 * 1024;
94 }
95 custom_param("xenheap_megabytes", parse_xenheap_megabytes);
97 static int __init
98 xen_count_pages(u64 start, u64 end, void *arg)
99 {
100 unsigned long *count = arg;
102 /* FIXME: do we need consider difference between DMA-usable memory and
103 * normal memory? Seems that HV has no requirement to operate DMA which
104 * is owned by Dom0? */
105 *count += (end - start) >> PAGE_SHIFT;
106 return 0;
107 }
109 static void __init do_initcalls(void)
110 {
111 initcall_t *call;
112 for ( call = &__initcall_start; call < &__initcall_end; call++ )
113 (*call)();
114 }
116 /*
117 * IPF loader only supports one command line currently, for
118 * both xen and guest kernel. This function provides pre-parse
119 * to mixed command line, to split it into two parts.
120 *
121 * User should split the parameters by "--", with strings after
122 * spliter for guest kernel. Missing "--" means whole line belongs
123 * to guest. Example:
124 * "com2=57600,8n1 console=com2 -- console=ttyS1 console=tty
125 * root=/dev/sda3 ro"
126 */
127 static char null[4] = { 0 };
129 void __init early_cmdline_parse(char **cmdline_p)
130 {
131 char *guest_cmd;
132 static const char * const split = "--";
134 if (*cmdline_p == NULL) {
135 *cmdline_p = &null[0];
136 saved_command_line[0] = '\0';
137 dom0_command_line[0] = '\0';
138 return;
139 }
141 guest_cmd = strstr(*cmdline_p, split);
142 /* If no spliter, whole line is for guest */
143 if (guest_cmd == NULL) {
144 guest_cmd = *cmdline_p;
145 *cmdline_p = &null[0];
146 } else {
147 *guest_cmd = '\0'; /* Split boot parameters for xen and guest */
148 guest_cmd += strlen(split);
149 while (*guest_cmd == ' ') guest_cmd++;
150 }
152 strlcpy(saved_command_line, *cmdline_p, COMMAND_LINE_SIZE);
153 strlcpy(dom0_command_line, guest_cmd, COMMAND_LINE_SIZE);
154 return;
155 }
157 struct ns16550_defaults ns16550_com1 = {
158 .data_bits = 8,
159 .parity = 'n',
160 .stop_bits = 1
161 };
163 unsigned int ns16550_com1_gsi;
164 unsigned int ns16550_com1_polarity;
165 unsigned int ns16550_com1_trigger;
167 struct ns16550_defaults ns16550_com2 = {
168 .data_bits = 8,
169 .parity = 'n',
170 .stop_bits = 1
171 };
173 /* efi_print: print efi table at boot */
174 static int __initdata opt_efi_print;
175 boolean_param("efi_print", opt_efi_print);
177 /* print EFI memory map: */
178 static void __init
179 efi_print(void)
180 {
181 void *efi_map_start, *efi_map_end;
182 u64 efi_desc_size;
184 efi_memory_desc_t *md;
185 void *p;
186 int i;
188 if (!opt_efi_print)
189 return;
191 efi_map_start = __va(ia64_boot_param->efi_memmap);
192 efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
193 efi_desc_size = ia64_boot_param->efi_memdesc_size;
195 for (i = 0, p = efi_map_start; p < efi_map_end; ++i, p += efi_desc_size) {
196 md = p;
197 printk("mem%02u: type=%2u, attr=0x%016lx, range=[0x%016lx-0x%016lx) "
198 "(%luMB)\n", i, md->type, md->attribute, md->phys_addr,
199 md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT),
200 md->num_pages >> (20 - EFI_PAGE_SHIFT));
201 }
202 }
204 /*
205 * These functions are utility functions for getting and
206 * testing memory descriptors for allocating the xenheap area.
207 */
208 static efi_memory_desc_t * __init
209 efi_get_md (unsigned long phys_addr)
210 {
211 void *efi_map_start, *efi_map_end, *p;
212 efi_memory_desc_t *md;
213 u64 efi_desc_size;
215 efi_map_start = __va(ia64_boot_param->efi_memmap);
216 efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
217 efi_desc_size = ia64_boot_param->efi_memdesc_size;
219 for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
220 md = p;
221 if (phys_addr - md->phys_addr < (md->num_pages << EFI_PAGE_SHIFT))
222 return md;
223 }
224 return 0;
225 }
227 static int __init
228 is_xenheap_usable_memory(efi_memory_desc_t *md)
229 {
230 if (!(md->attribute & EFI_MEMORY_WB))
231 return 0;
233 switch (md->type) {
234 case EFI_LOADER_CODE:
235 case EFI_LOADER_DATA:
236 case EFI_BOOT_SERVICES_CODE:
237 case EFI_BOOT_SERVICES_DATA:
238 case EFI_CONVENTIONAL_MEMORY:
239 return 1;
240 }
241 return 0;
242 }
244 static inline int __init
245 md_overlaps(const efi_memory_desc_t *md, unsigned long phys_addr)
246 {
247 return (phys_addr - md->phys_addr < (md->num_pages << EFI_PAGE_SHIFT));
248 }
250 static inline int __init
251 md_overlap_with_boot_param(const efi_memory_desc_t *md)
252 {
253 return md_overlaps(md, __pa(ia64_boot_param)) ||
254 md_overlaps(md, ia64_boot_param->efi_memmap) ||
255 md_overlaps(md, ia64_boot_param->command_line);
256 }
258 #define MD_SIZE(md) (md->num_pages << EFI_PAGE_SHIFT)
259 #define MD_END(md) ((md)->phys_addr + MD_SIZE(md))
261 static unsigned long __init
262 efi_get_max_addr (void)
263 {
264 void *efi_map_start, *efi_map_end, *p;
265 efi_memory_desc_t *md;
266 u64 efi_desc_size;
267 unsigned long max_addr = 0;
269 efi_map_start = __va(ia64_boot_param->efi_memmap);
270 efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
271 efi_desc_size = ia64_boot_param->efi_memdesc_size;
273 for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
274 md = p;
275 if (is_xenheap_usable_memory(md) && MD_END(md) > max_addr)
276 max_addr = MD_END(md);
277 }
278 return max_addr;
279 }
281 extern char __init_begin[], __init_end[];
282 static void noinline init_done(void)
283 {
284 memset(__init_begin, 0, __init_end - __init_begin);
285 flush_icache_range((unsigned long)__init_begin, (unsigned long)__init_end);
286 init_xenheap_pages(__pa(__init_begin), __pa(__init_end));
287 printk("Freed %ldkB init memory.\n",
288 (long)(__init_end-__init_begin)>>10);
290 startup_cpu_idle_loop();
291 }
293 struct xen_heap_desc {
294 void* xen_heap_start;
295 unsigned long xenheap_phys_end;
296 efi_memory_desc_t* kern_md;
297 };
299 static int __init
300 init_xenheap_mds(unsigned long start, unsigned long end, void *arg)
301 {
302 struct xen_heap_desc *desc = (struct xen_heap_desc*)arg;
303 unsigned long md_end = __pa(desc->xen_heap_start);
304 efi_memory_desc_t* md;
306 start = __pa(start);
307 end = __pa(end);
309 for (md = efi_get_md(md_end);
310 md != NULL && md->phys_addr < desc->xenheap_phys_end;
311 md = efi_get_md(md_end)) {
312 md_end = MD_END(md);
314 if (md == desc->kern_md ||
315 (md->type == EFI_LOADER_DATA && !md_overlap_with_boot_param(md)) ||
316 ((md->attribute & EFI_MEMORY_WB) &&
317 is_xenheap_usable_memory(md))) {
318 unsigned long s = max(start, max(__pa(desc->xen_heap_start),
319 md->phys_addr));
320 unsigned long e = min(end, min(md_end, desc->xenheap_phys_end));
321 init_xenheap_pages(s, e);
322 }
323 }
325 return 0;
326 }
328 int running_on_sim;
330 static int __init
331 is_platform_hp_ski(void)
332 {
333 int i;
334 long cpuid[6];
336 for (i = 0; i < 5; ++i)
337 cpuid[i] = ia64_get_cpuid(i);
339 if ((cpuid[0] & 0xff) != 'H')
340 return 0;
341 if ((cpuid[3] & 0xff) != 0x4)
342 return 0;
343 if (((cpuid[3] >> 8) & 0xff) != 0x0)
344 return 0;
345 if (((cpuid[3] >> 16) & 0xff) != 0x0)
346 return 0;
347 if (((cpuid[3] >> 24) & 0x7) != 0x7)
348 return 0;
350 return 1;
351 }
353 #ifdef CONFIG_XEN_IA64_PERVCPU_VHPT
354 static int __initdata dom0_vhpt_size_log2;
355 integer_param("dom0_vhpt_size_log2", dom0_vhpt_size_log2);
356 #endif
358 void __init start_kernel(void)
359 {
360 char *cmdline;
361 unsigned long nr_pages;
362 unsigned long dom0_memory_start, dom0_memory_size;
363 unsigned long dom0_initrd_start, dom0_initrd_size;
364 unsigned long md_end, relo_start, relo_end, relo_size = 0;
365 struct domain *idle_domain;
366 struct vcpu *dom0_vcpu0;
367 efi_memory_desc_t *kern_md, *last_md, *md;
368 void *xen_heap_start;
369 struct xen_heap_desc heap_desc;
370 #ifdef CONFIG_SMP
371 int i;
372 #endif
374 /* Be sure the struct shared_info size is <= XSI_SIZE. */
375 BUILD_BUG_ON(sizeof(struct shared_info) > XSI_SIZE);
377 /* Kernel may be relocated by EFI loader */
378 xen_pstart = ia64_tpa(KERNEL_START);
380 running_on_sim = is_platform_hp_ski();
382 early_setup_arch(&cmdline);
384 /* We initialise the serial devices very early so we can get debugging. */
385 if (running_on_sim)
386 hpsim_serial_init();
387 else {
388 ns16550_init(0, &ns16550_com1);
389 ns16550_init(1, &ns16550_com2);
390 }
391 serial_init_preirq();
393 #ifdef CONFIG_VGA
394 /* Plug in a default VGA mode */
395 vga_console_info.video_type = XEN_VGATYPE_TEXT_MODE_3;
396 vga_console_info.u.text_mode_3.font_height = 16; /* generic VGA? */
397 vga_console_info.u.text_mode_3.cursor_x =
398 ia64_boot_param->console_info.orig_x;
399 vga_console_info.u.text_mode_3.cursor_y =
400 ia64_boot_param->console_info.orig_y;
401 vga_console_info.u.text_mode_3.rows =
402 ia64_boot_param->console_info.num_rows;
403 vga_console_info.u.text_mode_3.columns =
404 ia64_boot_param->console_info.num_cols;
405 #endif
407 init_console();
409 if (running_on_sim || ia64_boot_param->domain_start == 0 ||
410 ia64_boot_param->domain_size == 0) {
411 /* This is possible only with the old elilo, which does not support
412 a vmm. Fix now, and continue without initrd. */
413 printk ("Your elilo is not Xen-aware. Bootparams fixed\n");
414 ia64_boot_param->domain_start = ia64_boot_param->initrd_start;
415 ia64_boot_param->domain_size = ia64_boot_param->initrd_size;
416 ia64_boot_param->initrd_start = 0;
417 ia64_boot_param->initrd_size = 0;
418 }
420 printk("Xen command line: %s\n", saved_command_line);
422 /*
423 * Test if the boot allocator bitmap will overflow xenheap_size. If
424 * so, continue to bump it up until we have at least a minimum space
425 * for the actual xenheap.
426 */
427 max_page = efi_get_max_addr() >> PAGE_SHIFT;
428 while ((max_page >> 3) > xenheap_size - (XENHEAP_MEGABYTES_MIN << 20))
429 xenheap_size <<= 1;
431 BUG_ON(xenheap_size > (XENHEAP_MEGABYTES_MAX << 20));
433 xenheap_phys_end = xen_pstart + xenheap_size;
434 printk("xen image pstart: 0x%lx, xenheap pend: 0x%lx\n",
435 xen_pstart, xenheap_phys_end);
437 xen_patch_kernel();
439 kern_md = md = efi_get_md(xen_pstart);
440 md_end = __pa(ia64_imva(&_end));
441 relo_start = xenheap_phys_end;
443 /*
444 * Scan through the memory descriptors after the kernel
445 * image to make sure we have enough room for the xenheap
446 * area, pushing out whatever may already be there.
447 */
448 while (relo_start + relo_size >= md_end) {
449 md = efi_get_md(md_end);
451 if (md == NULL) {
452 printk("no room to move loader data. skip moving loader data\n");
453 goto skip_move;
454 }
456 md_end = MD_END(md);
457 if (relo_start < md->phys_addr)
458 relo_start = md->phys_addr;
460 if (!is_xenheap_usable_memory(md)) {
461 /* Skip this area */
462 if (md_end > relo_start)
463 relo_start = md_end;
464 continue;
465 }
467 /*
468 * The dom0 kernel or initrd could overlap, reserve space
469 * at the end to relocate them later.
470 */
471 if (md->type == EFI_LOADER_DATA) {
472 /* Test for ranges we're not prepared to move */
473 if (!md_overlap_with_boot_param(md))
474 relo_size += MD_SIZE(md);
476 /* If range overlaps the end, push out the relocation start */
477 if (md_end > relo_start)
478 relo_start = md_end;
479 }
480 }
481 last_md = md;
482 relo_start = md_end - relo_size;
483 relo_end = relo_start + relo_size;
485 md_end = __pa(ia64_imva(&_end));
487 /*
488 * Move any relocated data out into the previously found relocation
489 * area. Any extra memory descriptrs are moved out to the end
490 * and set to zero pages.
491 */
492 for (md = efi_get_md(md_end) ;; md = efi_get_md(md_end)) {
493 md_end = MD_END(md);
495 if (md->type == EFI_LOADER_DATA && !md_overlap_with_boot_param(md)) {
496 unsigned long relo_offset;
498 if (md_overlaps(md, ia64_boot_param->domain_start)) {
499 relo_offset = ia64_boot_param->domain_start - md->phys_addr;
500 printk("Moving Dom0 kernel image: 0x%lx -> 0x%lx (%ld KiB)\n",
501 ia64_boot_param->domain_start, relo_start + relo_offset,
502 ia64_boot_param->domain_size >> 10);
503 ia64_boot_param->domain_start = relo_start + relo_offset;
504 }
505 if (ia64_boot_param->initrd_size &&
506 md_overlaps(md, ia64_boot_param->initrd_start)) {
507 relo_offset = ia64_boot_param->initrd_start - md->phys_addr;
508 printk("Moving Dom0 initrd image: 0x%lx -> 0x%lx (%ld KiB)\n",
509 ia64_boot_param->initrd_start, relo_start + relo_offset,
510 ia64_boot_param->initrd_size >> 10);
511 ia64_boot_param->initrd_start = relo_start + relo_offset;
512 }
513 memcpy(__va(relo_start), __va(md->phys_addr), MD_SIZE(md));
514 relo_start += MD_SIZE(md);
515 }
517 if (md == last_md)
518 break;
519 }
521 /* Trim the last entry */
522 md->num_pages -= (relo_size >> EFI_PAGE_SHIFT);
524 skip_move:
525 reserve_memory();
527 /* first find highest page frame number */
528 max_page = 0;
529 efi_memmap_walk(find_max_pfn, &max_page);
530 printk("find_memory: efi_memmap_walk returns max_page=%lx\n",max_page);
531 efi_print();
533 /*
534 * later [__init_begin, __init_end) will be freed up as xen heap
535 * so that struct domain might be allocated from the init area
536 * which is < xen_heap_start. so we can't simply set
537 * xen_pickle_offset = xen_heap_start.
538 */
539 xen_pickle_offset = ia64_imva(__init_begin);
541 xen_heap_start = memguard_init(ia64_imva(&_end));
542 printk("Before xen_heap_start: %p\n", xen_heap_start);
543 xen_heap_start = __va(init_boot_allocator(__pa(xen_heap_start)));
544 printk("After xen_heap_start: %p\n", xen_heap_start);
546 efi_memmap_walk(filter_rsvd_memory, init_boot_pages);
547 efi_memmap_walk(xen_count_pages, &nr_pages);
549 printk("System RAM: %luMB (%lukB)\n",
550 nr_pages >> (20 - PAGE_SHIFT),
551 nr_pages << (PAGE_SHIFT - 10));
552 total_pages = nr_pages;
554 init_frametable();
556 trap_init();
558 /* process SAL system table */
559 /* must be before any pal/sal call */
560 BUG_ON(efi.sal_systab == EFI_INVALID_TABLE_ADDR);
561 ia64_sal_init(__va(efi.sal_systab));
563 /* early_setup_arch() maps PAL code. */
564 identify_vmx_feature();
565 /* If vmx feature is on, do necessary initialization for vmx */
566 if (vmx_enabled)
567 xen_heap_start = vmx_init_env(xen_heap_start, xenheap_phys_end);
569 heap_desc.xen_heap_start = xen_heap_start;
570 heap_desc.xenheap_phys_end = xenheap_phys_end;
571 heap_desc.kern_md = kern_md;
572 efi_memmap_walk(&init_xenheap_mds, &heap_desc);
574 printk("Xen heap: %luMB (%lukB)\n",
575 (xenheap_phys_end-__pa(xen_heap_start)) >> 20,
576 (xenheap_phys_end-__pa(xen_heap_start)) >> 10);
578 end_boot_allocator();
580 softirq_init();
582 late_setup_arch(&cmdline);
584 scheduler_init();
585 idle_vcpu[0] = (struct vcpu*) ia64_r13;
586 idle_domain = domain_create(IDLE_DOMAIN_ID, 0, 0);
587 if ( (idle_domain == NULL) || (alloc_vcpu(idle_domain, 0, 0) == NULL) )
588 BUG();
590 alloc_dom_xen_and_dom_io();
591 setup_per_cpu_areas();
592 mem_init();
594 local_irq_disable();
595 init_IRQ ();
596 init_xen_time(); /* initialise the time */
597 timer_init();
599 rcu_init();
601 #ifdef CONFIG_XEN_IA64_TLBFLUSH_CLOCK
602 open_softirq(NEW_TLBFLUSH_CLOCK_PERIOD_SOFTIRQ, new_tlbflush_clock_period);
603 #endif
605 #ifdef CONFIG_SMP
606 if ( opt_nosmp )
607 {
608 max_cpus = 0;
609 smp_num_siblings = 1;
610 //boot_cpu_data.x86_num_cores = 1;
611 }
613 /* A vcpu is created for the idle domain on every physical cpu.
614 Limit the number of cpus to the maximum number of vcpus. */
615 if (max_cpus > MAX_VIRT_CPUS)
616 max_cpus = MAX_VIRT_CPUS;
618 smp_prepare_cpus(max_cpus);
620 /* We aren't hotplug-capable yet. */
621 for_each_cpu ( i )
622 cpu_set(i, cpu_present_map);
624 /* Enable IRQ to receive IPI (needed for ITC sync). */
625 local_irq_enable();
627 printk("num_online_cpus=%d, max_cpus=%d\n",num_online_cpus(),max_cpus);
628 for_each_present_cpu ( i )
629 {
630 if ( num_online_cpus() >= max_cpus )
631 break;
632 if ( !cpu_online(i) ) {
633 rcu_online_cpu(i);
634 __cpu_up(i);
635 }
636 }
638 local_irq_disable();
640 printk("Brought up %ld CPUs\n", (long)num_online_cpus());
641 smp_cpus_done(max_cpus);
642 #endif
644 initialise_gdb(); /* could be moved earlier */
646 do_initcalls();
647 sort_main_extable();
649 init_rid_allocator ();
651 local_irq_enable();
653 if (opt_xencons) {
654 initialize_keytable();
655 if (ns16550_com1_gsi) {
656 if (opt_xencons_poll ||
657 iosapic_register_intr(ns16550_com1_gsi,
658 ns16550_com1_polarity,
659 ns16550_com1_trigger) < 0) {
660 ns16550_com1.irq = 0;
661 ns16550_init(0, &ns16550_com1);
662 }
663 }
664 serial_init_postirq();
665 }
667 expose_p2m_init();
669 /* Create initial domain 0. */
670 dom0 = domain_create(0, 0, DOM0_SSIDREF);
671 if (dom0 == NULL)
672 panic("Error creating domain 0\n");
673 domain_set_vhpt_size(dom0, dom0_vhpt_size_log2);
674 dom0_vcpu0 = alloc_vcpu(dom0, 0, 0);
675 if (dom0_vcpu0 == NULL || vcpu_late_initialise(dom0_vcpu0) != 0)
676 panic("Cannot allocate dom0 vcpu 0\n");
678 dom0->is_privileged = 1;
679 dom0->target = NULL;
681 /*
682 * We're going to setup domain0 using the module(s) that we stashed safely
683 * above our heap. The second module, if present, is an initrd ramdisk.
684 */
685 dom0_memory_start = (unsigned long) __va(ia64_boot_param->domain_start);
686 dom0_memory_size = ia64_boot_param->domain_size;
687 dom0_initrd_start = (unsigned long) __va(ia64_boot_param->initrd_start);
688 dom0_initrd_size = ia64_boot_param->initrd_size;
690 if ( construct_dom0(dom0, dom0_memory_start, dom0_memory_size,
691 dom0_initrd_start,dom0_initrd_size,
692 0) != 0)
693 panic("Could not set up DOM0 guest OS\n");
695 if (!running_on_sim && !IS_MEDUSA()) // slow on ski and pages are pre-initialized to zero
696 scrub_heap_pages();
698 init_trace_bufs();
700 if (opt_xencons) {
701 console_endboot();
702 serial_endboot();
703 }
705 domain0_ready = 1;
707 domain_unpause_by_systemcontroller(dom0);
709 init_done();
710 }
712 void arch_get_xen_caps(xen_capabilities_info_t *info)
713 {
714 /* Interface name is always xen-3.0-* for Xen-3.x. */
715 int major = 3, minor = 0;
716 char s[32];
718 (*info)[0] = '\0';
720 snprintf(s, sizeof(s), "xen-%d.%d-ia64 ", major, minor);
721 safe_strcat(*info, s);
723 snprintf(s, sizeof(s), "xen-%d.%d-ia64be ", major, minor);
724 safe_strcat(*info, s);
726 if (vmx_enabled)
727 {
728 snprintf(s, sizeof(s), "hvm-%d.%d-ia64 ", major, minor);
729 safe_strcat(*info, s);
731 snprintf(s, sizeof(s), "hvm-%d.%d-ia64-sioemu ", major, minor);
732 safe_strcat(*info, s);
733 }
734 }