summaryrefslogtreecommitdiffstats
path: root/qemu/roms/openbios/arch/amd64/sys_info.c
diff options
context:
space:
mode:
authorYang Zhang <yang.z.zhang@intel.com>2015-08-28 09:58:54 +0800
committerYang Zhang <yang.z.zhang@intel.com>2015-09-01 12:44:00 +0800
commite44e3482bdb4d0ebde2d8b41830ac2cdb07948fb (patch)
tree66b09f592c55df2878107a468a91d21506104d3f /qemu/roms/openbios/arch/amd64/sys_info.c
parent9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (diff)
Add qemu 2.4.0
Change-Id: Ic99cbad4b61f8b127b7dc74d04576c0bcbaaf4f5 Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Diffstat (limited to 'qemu/roms/openbios/arch/amd64/sys_info.c')
-rw-r--r--qemu/roms/openbios/arch/amd64/sys_info.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/qemu/roms/openbios/arch/amd64/sys_info.c b/qemu/roms/openbios/arch/amd64/sys_info.c
new file mode 100644
index 000000000..d62070be0
--- /dev/null
+++ b/qemu/roms/openbios/arch/amd64/sys_info.c
@@ -0,0 +1,58 @@
+#include "config.h"
+#include "kernel/kernel.h"
+#include "libopenbios/sys_info.h"
+#include "context.h"
+
+#define printf printk
+#ifdef CONFIG_DEBUG_BOOT
+#define debug printk
+#else
+#define debug(x...)
+#endif
+
+void collect_multiboot_info(struct sys_info *);
+void collect_sys_info(struct sys_info *info);
+
+void collect_sys_info(struct sys_info *info)
+{
+ int i;
+ unsigned long long total = 0;
+ struct memrange *mmap;
+
+ /* Pick up paramters given by bootloader to us */
+ info->boot_type = boot_ctx->eax;
+ info->boot_data = boot_ctx->ebx;
+ info->boot_arg = boot_ctx->param[0];
+ debug("boot eax = %#lx\n", info->boot_type);
+ debug("boot ebx = %#lx\n", info->boot_data);
+ debug("boot arg = %#lx\n", info->boot_arg);
+
+ collect_elfboot_info(info);
+#ifdef CONFIG_LINUXBIOS
+ collect_linuxbios_info(info);
+#endif
+#ifdef CONFIG_IMAGE_ELF_MULTIBOOT
+ collect_multiboot_info(info);
+#endif
+
+ if (!info->memrange) {
+ printf("Can't get memory map from firmware. "
+ "Using hardcoded default.\n");
+ info->n_memranges = 2;
+ info->memrange = malloc(2 * sizeof(struct memrange));
+ info->memrange[0].base = 0;
+ info->memrange[0].size = 640*1024;
+ info->memrange[1].base = 1024*1024;
+ info->memrange[1].size = 32*1024*1024
+ - info->memrange[1].base;
+ }
+
+ debug("\n");
+ mmap=info->memrange;
+ for (i = 0; i < info->n_memranges; i++) {
+ debug("%016Lx-", mmap[i].base);
+ debug("%016Lx\n", mmap[i].base+mmap[i].size);
+ total += mmap[i].size;
+ }
+ debug("RAM %Ld MB\n", (total + 512*1024) >> 20);
+}