2 #include "kernel/kernel.h"
3 #include "libopenbios/sys_info.h"
7 #ifdef CONFIG_DEBUG_BOOT
13 void collect_multiboot_info(struct sys_info *);
14 void collect_sys_info(struct sys_info *info);
16 void collect_sys_info(struct sys_info *info)
19 unsigned long long total = 0;
20 struct memrange *mmap;
22 /* Pick up paramters given by bootloader to us */
23 info->boot_type = boot_ctx->eax;
24 info->boot_data = boot_ctx->ebx;
25 info->boot_arg = boot_ctx->param[0];
26 debug("boot eax = %#lx\n", info->boot_type);
27 debug("boot ebx = %#lx\n", info->boot_data);
28 debug("boot arg = %#lx\n", info->boot_arg);
30 collect_elfboot_info(info);
31 #ifdef CONFIG_LINUXBIOS
32 collect_linuxbios_info(info);
34 #ifdef CONFIG_IMAGE_ELF_MULTIBOOT
35 collect_multiboot_info(info);
38 if (!info->memrange) {
39 printf("Can't get memory map from firmware. "
40 "Using hardcoded default.\n");
41 info->n_memranges = 2;
42 info->memrange = malloc(2 * sizeof(struct memrange));
43 info->memrange[0].base = 0;
44 info->memrange[0].size = 640*1024;
45 info->memrange[1].base = 1024*1024;
46 info->memrange[1].size = 32*1024*1024
47 - info->memrange[1].base;
52 for (i = 0; i < info->n_memranges; i++) {
53 debug("%016Lx-", mmap[i].base);
54 debug("%016Lx\n", mmap[i].base+mmap[i].size);
55 total += mmap[i].size;
57 debug("RAM %Ld MB\n", (total + 512*1024) >> 20);