Annotation of qemu/roms/openbios/arch/amd64/sys_info.c, revision 1.1.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: #define printf printk
                      7: #ifdef CONFIG_DEBUG_BOOT
                      8: #define debug printk
                      9: #else
                     10: #define debug(x...)
                     11: #endif
                     12: 
                     13: void collect_multiboot_info(struct sys_info *);
                     14: void collect_sys_info(struct sys_info *info);
                     15: 
                     16: void collect_sys_info(struct sys_info *info)
                     17: {
                     18:     int i;
                     19:     unsigned long long total = 0;
                     20:     struct memrange *mmap;
                     21: 
                     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);
                     29: 
                     30:     collect_elfboot_info(info);
                     31: #ifdef CONFIG_LINUXBIOS
                     32:     collect_linuxbios_info(info);
                     33: #endif
                     34: #ifdef CONFIG_IMAGE_ELF_MULTIBOOT
                     35:     collect_multiboot_info(info);
                     36: #endif
                     37: 
                     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;
                     48:     }
                     49: 
                     50:     debug("\n");
                     51:     mmap=info->memrange;
                     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;
                     56:     }
                     57:     debug("RAM %Ld MB\n", (total + 512*1024) >> 20);
                     58: }

unix.superglobalmegacorp.com

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