Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / openbios / arch / sparc32 / sys_info.c
1 #include "config.h"
2 #include "kernel/kernel.h"
3 #include "arch/common/elf_boot.h"
4 #include "libopenbios/sys_info.h"
5 #include "context.h"
6 #include "boot.h"
7
8 #define printf printk
9 #ifdef CONFIG_DEBUG_BOOT
10 #define debug printk
11 #else
12 #define debug(x...)
13 #endif
14
15 unsigned int qemu_mem_size;
16
17 void collect_multiboot_info(struct sys_info *);
18
19 void collect_sys_info(struct sys_info *info)
20 {
21     int i;
22     unsigned long long total = 0;
23     struct memrange *mmap;
24
25     /* Pick up paramters given by bootloader to us */
26     //info->boot_type = boot_ctx->eax;
27     //info->boot_data = boot_ctx->ebx;
28     info->boot_arg = boot_ctx->param[0];
29     //debug("boot eax = %#lx\n", info->boot_type);
30     //debug("boot ebx = %#lx\n", info->boot_data);
31     info->boot_type = ELF_BHDR_MAGIC;
32     info->boot_data = virt_to_phys(&elf_image_notes);
33     debug("boot arg = %#lx\n", info->boot_arg);
34
35     collect_elfboot_info(info);
36 #ifdef CONFIG_LINUXBIOS
37     collect_linuxbios_info(info);
38 #endif
39 #ifdef CONFIG_IMAGE_ELF_MULTIBOOT
40     collect_multiboot_info(info);
41 #endif
42
43     if (!info->memrange) {
44         info->n_memranges = 1;
45         info->memrange = malloc(1 * sizeof(struct memrange));
46         info->memrange[0].base = 0;
47         info->memrange[0].size = qemu_mem_size;
48     }
49
50     debug("\n");
51     mmap=info->memrange;
52     for (i = 0; i < info->n_memranges; i++) {
53         debug("%08lx-", (long)mmap[i].base);
54         debug("%08lx\n", (long)mmap[i].base + (long)mmap[i].size);
55         total += mmap[i].size;
56     }
57     debug("RAM %ld MB\n", (long)total >> 20);
58 }