Annotation of qemu/roms/openbios/arch/x86/sys_info.c, revision 1.1

1.1     ! root        1: #include "config.h"
        !             2: #include "kernel/kernel.h"
        !             3: #include "libopenbios/sys_info.h"
        !             4: #include "context.h"
        !             5: 
        !             6: #ifdef CONFIG_DEBUG_BOOT
        !             7: #define debug printk
        !             8: #else
        !             9: #define debug(x...)
        !            10: #endif
        !            11: 
        !            12: void collect_multiboot_info(struct sys_info *);
        !            13: void collect_sys_info(struct sys_info *info);
        !            14: 
        !            15: void collect_sys_info(struct sys_info *info)
        !            16: {
        !            17:     int i;
        !            18:     unsigned long long total = 0;
        !            19:     struct memrange *mmap;
        !            20: 
        !            21:     /* Pick up paramters given by bootloader to us */
        !            22:     info->boot_type = boot_ctx->eax;
        !            23:     info->boot_data = boot_ctx->ebx;
        !            24:     info->boot_arg = boot_ctx->param[0];
        !            25:     debug("boot eax = %#lx\n", info->boot_type);
        !            26:     debug("boot ebx = %#lx\n", info->boot_data);
        !            27:     debug("boot arg = %#lx\n", info->boot_arg);
        !            28: 
        !            29:     collect_elfboot_info(info);
        !            30: #ifdef CONFIG_LINUXBIOS
        !            31:     collect_linuxbios_info(info);
        !            32: #endif
        !            33: #ifdef CONFIG_IMAGE_ELF_MULTIBOOT
        !            34:     collect_multiboot_info(info);
        !            35: #endif
        !            36: 
        !            37:     if (!info->memrange) {
        !            38:        printk("Can't get memory map from firmware. "
        !            39:                "Using hardcoded default.\n");
        !            40:        info->n_memranges = 2;
        !            41:        info->memrange = malloc(2 * sizeof(struct memrange));
        !            42:        info->memrange[0].base = 0;
        !            43:        info->memrange[0].size = 640*1024;
        !            44:        info->memrange[1].base = 1024*1024;
        !            45:        info->memrange[1].size = 32*1024*1024
        !            46:            - info->memrange[1].base;
        !            47:     }
        !            48: 
        !            49:     debug("\n");
        !            50:     mmap=info->memrange;
        !            51:     for (i = 0; i < info->n_memranges; i++) {
        !            52:        debug("%016Lx-", mmap[i].base);
        !            53:        debug("%016Lx\n", mmap[i].base+mmap[i].size);
        !            54:        total += mmap[i].size;
        !            55:     }
        !            56:     debug("RAM %Ld MB\n", (total + 512*1024) >> 20);
        !            57: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.