int lib_get_sysinfo(void) { int ret; /* Get the CPU speed (for delays). */ lib_sysinfo.cpu_khz = get_cpu_speed(); #if IS_ENABLED(CONFIG_LP_MULTIBOOT) /* Get the information from the multiboot tables, * if they exist */ get_multiboot_info(&lib_sysinfo); #endif /* Get information from the coreboot tables, * if they exist */ ret = get_coreboot_info(&lib_sysinfo); if (!lib_sysinfo.n_memranges) { /* If we can't get a good memory range, use the default. */ lib_sysinfo.n_memranges = 2; lib_sysinfo.memrange[0].base = 0; lib_sysinfo.memrange[0].size = 640 * 1024; lib_sysinfo.memrange[0].type = CB_MEM_RAM; lib_sysinfo.memrange[1].base = 1024 * 1024; lib_sysinfo.memrange[1].size = 31 * 1024 * 1024; lib_sysinfo.memrange[1].type = CB_MEM_RAM; } return ret; }
int arch_cpu_init(void) { int ret = get_coreboot_info(&lib_sysinfo); if (ret != 0) { printf("Failed to parse coreboot tables.\n"); return ret; } timestamp_init(); return x86_cpu_init_f(); }
int lib_get_sysinfo(void) { int ret; /* Get the CPU speed (for delays). */ lib_sysinfo.cpu_khz = get_cpu_speed(); /* Get information from the coreboot tables, * if they exist */ ret = get_coreboot_info(&lib_sysinfo); /* If we can't get a good memory range, use the default. */ if (!lib_sysinfo.n_memranges) { lib_sysinfo.n_memranges = 1; lib_sysinfo.memrange[0].base = 0; lib_sysinfo.memrange[0].size = 1024 * 1024; lib_sysinfo.memrange[0].type = CB_MEM_RAM; } return ret; }
void kernel_init(multiboot_info_t *mboot_info) { extern char __start_bss[], __stop_bss[]; memset(__start_bss, 0, __stop_bss - __start_bss); /* mboot_info is a physical address. while some arches currently have the * lower memory mapped, everyone should have it mapped at kernbase by now. * also, it might be in 'free' memory, so once we start dynamically using * memory, we may clobber it. */ multiboot_kaddr = (struct multiboot_info*)((physaddr_t)mboot_info + KERNBASE); extract_multiboot_cmdline(multiboot_kaddr); cons_init(); print_cpuinfo(); printk("Boot Command Line: '%s'\n", boot_cmdline); exception_table_init(); cache_init(); // Determine systems's cache properties pmem_init(multiboot_kaddr); kmem_cache_init(); // Sets up slab allocator kmalloc_init(); hashtable_init(); radix_init(); cache_color_alloc_init(); // Inits data structs colored_page_alloc_init(); // Allocates colors for agnostic processes acpiinit(); topology_init(); kthread_init(); /* might need to tweak when this happens */ vmr_init(); file_init(); page_check(); idt_init(); kernel_msg_init(); timer_init(); vfs_init(); devfs_init(); train_timing(); kb_buf_init(&cons_buf); arch_init(); block_init(); enable_irq(); run_linker_funcs(); /* reset/init devtab after linker funcs 3 and 4. these run NIC and medium * pre-inits, which need to happen before devether. */ devtabreset(); devtabinit(); #ifdef CONFIG_EXT2FS mount_fs(&ext2_fs_type, "/dev/ramdisk", "/mnt", 0); #endif /* CONFIG_EXT2FS */ #ifdef CONFIG_ETH_AUDIO eth_audio_init(); #endif /* CONFIG_ETH_AUDIO */ get_coreboot_info(&sysinfo); booting = 0; #ifdef CONFIG_RUN_INIT_SCRIPT if (run_init_script()) { printk("Configured to run init script, but no script specified!\n"); manager(); } #else manager(); #endif }
static void corebootinit(void) { get_coreboot_info(&cbinfo); }