static void __init arch_mem_init(char **cmdline_p) { extern void plat_mem_setup(void); /* call board setup routine */ plat_mem_setup(); pr_info("Determined physical RAM map:\n"); print_memory_map(); strlcpy(command_line, arcs_cmdline, sizeof(command_line)); strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; parse_early_param(); if (usermem) { pr_info("User-defined physical RAM map:\n"); print_memory_map(); } bootmem_init(); #ifndef CONFIG_NLM_16G_MEM_SUPPORT #ifndef CONFIG_NUMA setup_mapped_kernel_tlbs(FALSE, TRUE); #endif #endif sparse_init(); paging_init(); }
static void __init arch_mem_init(char **cmdline_p) { extern void plat_mem_setup(void); /* call board setup routine */ plat_mem_setup(); pr_info("Determined physical RAM map:\n"); print_memory_map(); strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; parse_early_param(); if (usermem) { pr_info("User-defined physical RAM map:\n"); print_memory_map(); } bootmem_init(); device_tree_init(); sparse_init(); plat_swiotlb_setup(); paging_init(); }
static void __init arch_mem_init(char **cmdline_p) { extern void plat_mem_setup(void); /* call board setup routine */ plat_mem_setup(); printk("Determined physical RAM map:\n"); print_memory_map(); strlcpy(command_line, arcs_cmdline, sizeof(command_line)); strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; parse_early_param(); if (usermem) { printk("User-defined physical RAM map:\n"); print_memory_map(); } bootmem_init(); #ifdef CONFIG_SPARSEMEM sparse_memory_present_with_active_regions(MAX_NUMNODES); #endif sparse_init(); paging_init(); }
static inline void parse_cmdline_early(void) { char c = ' ', *to = command_line, *from = saved_command_line; unsigned long start_at, mem_size; int len = 0; int usermem = 0; printk("Determined physical RAM map:\n"); print_memory_map(); for (;;) { /* * "mem=XXX[kKmM]" defines a memory region from * 0 to <XXX>, overriding the determined size. * "mem=XXX[KkmM]@YYY[KkmM]" defines a memory region from * <YYY> to <YYY>+<XXX>, overriding the determined size. */ if (c == ' ' && !memcmp(from, "mem=", 4)) { if (to != command_line) to--; /* * If a user specifies memory size, we * blow away any automatically generated * size. */ if (usermem == 0) { boot_mem_map.nr_map = 0; usermem = 1; } mem_size = memparse(from + 4, &from); if (*from == '@') start_at = memparse(from + 1, &from); else start_at = 0; add_memory_region(start_at, mem_size, BOOT_MEM_RAM); } c = *(from++); if (!c) break; if (CL_SIZE <= ++len) break; *(to++) = c; } *to = '\0'; if (usermem) { printk("User-defined physical RAM map:\n"); print_memory_map(); } }
static void __init arch_mem_init(char **cmdline_p) { extern void plat_mem_setup(void); phys_t init_mem, init_end, init_size; /* call board setup routine */ plat_mem_setup(); init_mem = PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT; init_end = PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT; init_size = init_end - init_mem; if (init_size) { /* Make sure it is in the boot_mem_map */ int i, found; found = 0; for (i = 0; i < boot_mem_map.nr_map; i++) { if (init_mem >= boot_mem_map.map[i].addr && init_mem < (boot_mem_map.map[i].addr + boot_mem_map.map[i].size)) { found = 1; break; } } if (!found) add_memory_region(init_mem, init_size, BOOT_MEM_INIT_RAM); } printk("Determined physical RAM map:\n"); print_memory_map(); strlcpy(command_line, arcs_cmdline, sizeof(command_line)); strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; parse_early_param(); if (usermem) { printk("User-defined physical RAM map:\n"); print_memory_map(); } bootmem_init(); sparse_init(); paging_init(); }
static void __init arch_mem_init(char **cmdline_p) { extern void plat_mem_setup(void); /* call board setup routine */ plat_mem_setup(); pr_info("Determined physical RAM map:\n"); print_memory_map(); #ifdef CONFIG_CMDLINE_BOOL #ifdef CONFIG_CMDLINE_OVERRIDE strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); #else if (builtin_cmdline[0]) { strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE); strlcat(arcs_cmdline, builtin_cmdline, COMMAND_LINE_SIZE); } strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); #endif #else strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); #endif strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; parse_early_param(); if (usermem) { pr_info("User-defined physical RAM map:\n"); print_memory_map(); } bootmem_init(); #if defined (CONFIG_RALINK_MT7621) && defined (CONFIG_RT2880_DRAM_512M) reserve_bootmem(0x1C000000, 64*1024*1024, BOOTMEM_DEFAULT); #endif device_tree_init(); sparse_init(); plat_swiotlb_setup(); paging_init(); }
EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) { InitializeLib(image, systab); print_memory_map(); return EFI_SUCCESS; }
static void __init arch_mem_init(char **cmdline_p) { extern void plat_mem_setup(void); /* call board setup routine */ plat_mem_setup(); pr_info("Determined physical RAM map:\n"); print_memory_map(); #ifdef CONFIG_CMDLINE_BOOL #ifdef CONFIG_CMDLINE_OVERRIDE strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); #else if (builtin_cmdline[0]) { strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE); strlcat(arcs_cmdline, builtin_cmdline, COMMAND_LINE_SIZE); } strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); #endif #else strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); #endif strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; parse_early_param(); if (usermem) { pr_info("User-defined physical RAM map:\n"); print_memory_map(); } bootmem_init(); sparse_init(); paging_init(); #ifdef CONFIG_DUMP_PREV_OOPS_MSG reserve_bootmem(CPHYSADDR(CONFIG_DUMP_PREV_OOPS_MSG_BUF_ADDR), CONFIG_DUMP_PREV_OOPS_MSG_BUF_LEN, BOOTMEM_DEFAULT); #endif }
static void __init arch_mem_init(char **cmdline_p) { extern void plat_mem_setup(void); /* call board setup routine */ plat_mem_setup(); pr_info("Determined physical RAM map:\n"); print_memory_map(); #ifdef CONFIG_CMDLINE_BOOL #ifdef CONFIG_CMDLINE_OVERRIDE strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); #else if (builtin_cmdline[0]) { strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE); strlcat(arcs_cmdline, builtin_cmdline, COMMAND_LINE_SIZE); } strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); #endif #else strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); #endif strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; parse_early_param(); if (usermem) { pr_info("User-defined physical RAM map:\n"); print_memory_map(); } bootmem_init(); device_tree_init(); sparse_init(); paging_init(); }
static EFI_STATUS parse_args(CHAR16 *options, UINT32 size, CHAR16 **name, char **cmdline) { CHAR16 *n, *o, *filename = NULL; EFI_STATUS err; int i = 0; *cmdline = NULL; *name = NULL; /* Skip whitespace */ for (i = 0; i < size && isspace(options[i]); i++) ; /* No arguments */ if (i == size) goto usage; n = &options[i]; while (n <= &options[size]) { if (*n == '-') { switch (*++n) { case 'h': goto usage; case 'f': n++; /* Skip 'f' */ /* Skip whitespace */ while (isspace(*n)) n++; filename = n; i = 0; while (*n && !isspace(*n)) { i++; n++; } *n++ = '\0'; o = malloc(sizeof(*o) * (i + 1)); if (!o) { Print(L"Unable to alloc filename memory\n"); err = EFI_OUT_OF_RESOURCES; goto out; } o[i--] = '\0'; StrCpy(o, filename); *name = o; break; case 'l': list_boot_devices(); goto fail; case 'm': print_memory_map(); n++; goto fail; default: Print(L"Unknown command-line switch\n"); goto usage; } } else { char *s1; CHAR16 *s2; int j; j = StrLen(n); *cmdline = malloc(j + 1); if (!*cmdline) { Print(L"Unable to alloc cmdline memory\n"); err = EFI_OUT_OF_RESOURCES; goto free_name; } s1 = *cmdline; s2 = n; while (j--) *s1++ = *s2++; *s1 = '\0'; /* Consume the rest of the args */ n = &options[size] + 1; } } if (filename) return EFI_SUCCESS; usage: Print(L"usage: efilinux [-hlm] -f <filename> <args>\n\n"); Print(L"\t-h: display this help menu\n"); Print(L"\t-l: list boot devices\n"); Print(L"\t-m: print memory map\n"); Print(L"\t-f <filename>: image to load\n"); fail: err = EFI_INVALID_PARAMETER; if (*cmdline) free(*cmdline); free_name: if (*name) free(*name); out: return err; }
static void __init arch_mem_init(char **cmdline_p) { phys_t init_mem, init_end, init_size; extern void plat_mem_setup(void); /* call board setup routine */ plat_mem_setup(); init_mem = PFN_UP(__pa_symbol(&__init_begin)) << PAGE_SHIFT; init_end = PFN_DOWN(__pa_symbol(&__init_end)) << PAGE_SHIFT; init_size = init_end - init_mem; if (init_size) { /* Make sure it is in the boot_mem_map */ int i, found; found = 0; for (i = 0; i < boot_mem_map.nr_map; i++) { if (init_mem >= boot_mem_map.map[i].addr && init_mem < (boot_mem_map.map[i].addr + boot_mem_map.map[i].size)) { found = 1; break; } } if (!found) add_memory_region(init_mem, init_size, BOOT_MEM_INIT_RAM); } pr_info("Determined physical RAM map:\n"); print_memory_map(); #ifdef CONFIG_CMDLINE_BOOL #ifdef CONFIG_CMDLINE_OVERRIDE strlcpy(boot_command_line, builtin_cmdline, COMMAND_LINE_SIZE); #else if (builtin_cmdline[0]) { strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE); strlcat(arcs_cmdline, builtin_cmdline, COMMAND_LINE_SIZE); } strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); #endif #else strlcpy(boot_command_line, arcs_cmdline, COMMAND_LINE_SIZE); #endif strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); *cmdline_p = command_line; parse_early_param(); if (usermem) { pr_info("User-defined physical RAM map:\n"); print_memory_map(); } bootmem_init(); device_tree_init(); sparse_init(); plat_swiotlb_setup(); paging_init(); }
static inline void parse_cmdline_early(void) { char c = ' ', *to = command_line, *from = saved_command_line; unsigned long start_at, mem_size; int len = 0; int usermem = 0; #ifdef CONFIG_TANGOX extern unsigned long em8xxx_kmem_start; extern unsigned long em8xxx_kmem_size; #ifdef CONFIG_TANGO3 extern unsigned long max_remap_size; #endif #endif printk("Determined physical RAM map:\n"); print_memory_map(); for (;;) { /* * "mem=XXX[kKmM]" defines a memory region from * 0 to <XXX>, overriding the determined size. * "mem=XXX[KkmM]@YYY[KkmM]" defines a memory region from * <YYY> to <YYY>+<XXX>, overriding the determined size. */ if (c == ' ' && !memcmp(from, "mem=", 4)) { if (to != command_line) to--; /* * If a user specifies memory size, we * blow away any automatically generated * size. */ if (usermem == 0) { boot_mem_map.nr_map = 0; usermem = 1; } mem_size = memparse(from + 4, &from); if (*from == '@') start_at = memparse(from + 1, &from); else { #ifdef CONFIG_TANGOX start_at = CPHYSADDR(em8xxx_kmem_start); #else start_at = 0; #endif } #ifdef CONFIG_TANGOX if (start_at == CPHYSADDR(em8xxx_kmem_start)) { unsigned long em8xxx_kmem_end; #ifdef CONFIG_TANGO3 em8xxx_kmem_size = ((mem_size + em8xxx_kmem_start) & 0xfff00000) - em8xxx_kmem_start; if (em8xxx_kmem_size > max_remap_size) em8xxx_kmem_size = max_remap_size; add_memory_region(start_at, em8xxx_kmem_size, BOOT_MEM_RAM); em8xxx_kmem_end = KSEG1ADDR(em8xxx_kmem_start + em8xxx_kmem_size) - KSEG1ADDR(CPU_REMAP_SPACE); /* Update information into LR_XENV2_RW */ xenv_set((void *)KSEG1ADDR(REG_BASE_cpu_block + LR_XENV2_RW), MAX_LR_XENV2_RW, XENV_LRRW_KERNEL_END, &em8xxx_kmem_end, 0, sizeof(em8xxx_kmem_end)); #else memcfg_t *m = (memcfg_t *)KSEG1ADDR(MEM_BASE_dram_controller_0_alias + FM_MEMCFG); em8xxx_kmem_size = ((mem_size + em8xxx_kmem_start) & 0xfff00000) - em8xxx_kmem_start; add_memory_region(start_at, em8xxx_kmem_size, BOOT_MEM_RAM); em8xxx_kmem_end = KSEG1ADDR(em8xxx_kmem_start + em8xxx_kmem_size) - KSEG1ADDR(MEM_BASE_dram_controller_0_alias); m->kernel_end = em8xxx_kmem_end; gen_memcfg_checksum(m); #endif } else { /* We just add this blindly as the alignment can be wrong, use it as own risk */ add_memory_region(start_at, mem_size, BOOT_MEM_RAM); } #else add_memory_region(start_at, mem_size, BOOT_MEM_RAM); #endif } c = *(from++); if (!c) break; if (CL_SIZE <= ++len) break; *(to++) = c; } *to = '\0'; if (usermem) { printk("User-defined physical RAM map:\n"); print_memory_map(); } }
static EFI_STATUS parse_args(CHAR16 *options, UINT32 size, CHAR16 *type, CHAR16 **name, CHAR8 **cmdline) { CHAR16 *n; EFI_STATUS err; int i = 0; *cmdline = NULL; *name = NULL; /* Skip whitespace */ for (i = 0; i < size && isspace(options[i]); i++) ; /* No arguments */ if (i == size) { debug(L"No args\n"); return EFI_SUCCESS; } n = &options[i]; while (n <= &options[size]) { if (*n == '-') { switch (*++n) { case 'h': goto usage; #ifdef RUNTIME_SETTINGS case 'l': blk_init(); list_blk_devices(); blk_exit(); goto fail; case 'm': print_memory_map(); n++; goto fail; case 'f': case 'p': case 't': case 'c': #endif /* RUNTIME_SETTINGS */ case 'a': *type = *n; n++; n = get_argument(n, name); if (!*name) goto fail; break; #ifdef RUNTIME_SETTINGS case 'e': { CHAR16 *em_policy; EFI_STATUS status; n++; n = get_argument(n, &em_policy); if (!*em_policy) goto usage; status = em_set_policy(em_policy); if (EFI_ERROR(status)) goto usage; break; } case 'n': { saved_hook_before_jump = loader_ops.hook_before_jump; loader_ops.hook_before_jump = hook_before_jump_forever_loop; warning(L"-n option set : OSloader will not jump to kernel\n"); break; } case 'A': list_acpi_tables(); goto fail; #endif /* RUNTIME_SETTINGS */ default: error(L"Unknown command-line switch\n"); goto usage; } } else { CHAR8 *s1; CHAR16 *s2; int j; j = StrLen(n); *cmdline = malloc(j + 1); if (!*cmdline) { error(L"Unable to alloc cmdline memory\n"); err = EFI_OUT_OF_RESOURCES; goto free_name; } s1 = *cmdline; s2 = n; while (j--) *s1++ = *s2++; *s1 = '\0'; /* Consume the rest of the args */ n = &options[size] + 1; } } return EFI_SUCCESS; usage: #ifdef RUNTIME_SETTINGS Print(L"usage: efilinux [OPTIONS] <kernel-command-line-args>\n\n"); Print(L"\t-h: display this help menu\n"); Print(L"\t-l: list boot devices\n"); Print(L"\t-m: print memory map\n"); #else Print(L"usage: efilinux [OPTIONS]\n\n"); #endif /* RUNTIME_SETTINGS */ Print(L"\t-a <address>: boot an already in memory image\n"); #ifdef RUNTIME_SETTINGS Print(L"\t-A: List ACPI tables\n"); Print(L"\t-e <policy>: Set the energy management policy ('uefi', 'fake')\n"); Print(L"\t-f <filename>: image to load\n"); Print(L"\t-p <partname>: partition to load\n"); Print(L"\t-t <target>: target to boot\n"); Print(L"\t-n: do as usual but wait indefinitely instead of jumping to the loaded image (for test purpose only)\n"); Print(L"\t-c <command>: debug commands (dump_infos, print_pidv, print_rsci,\n"); Print(L"\t dump_acpi_tables, print_esrt or load_dsdt)\n"); #endif /* RUNTIME_SETTINGS */ fail: err = EFI_INVALID_PARAMETER; if (*cmdline) free(*cmdline); free_name: if (*name) free(*name); return err; }