static __init void parse_cmdline_early (char ** cmdline_p) { char c = ' ', *to = command_line, *from = COMMAND_LINE; int len = 0; for (;;) { if (c != ' ') goto next_char; else if (!memcmp(from, "avoid_smi", 9)) avoid_smi = 1; #ifdef CONFIG_SMP /* * If the BIOS enumerates physical processors before logical, * maxcpus=N at enumeration-time can be used to disable HT. */ else if (!memcmp(from, "maxcpus=", 8)) { extern unsigned int maxcpus; maxcpus = simple_strtoul(from + 8, NULL, 0); } #endif #ifdef CONFIG_ACPI /* "acpi=off" disables both ACPI table parsing and interpreter init */ if (fullarg(from,"acpi=off")) disable_acpi(); if (fullarg(from, "acpi=force")) { /* add later when we do DMI horrors: */ acpi_force = 1; acpi_disabled = 0; } /* acpi=ht just means: do ACPI MADT parsing at bootup, but don't enable the full ACPI interpreter */ if (fullarg(from, "acpi=ht")) { if (!acpi_force) disable_acpi(); acpi_ht = 1; } else if (fullarg(from, "pci=noacpi")) acpi_disable_pci(); else if (fullarg(from, "acpi=noirq")) acpi_noirq_set(); else if (fullarg(from, "acpi_sci=edge")) acpi_sci_flags.trigger = 1; else if (fullarg(from, "acpi_sci=level")) acpi_sci_flags.trigger = 3; else if (fullarg(from, "acpi_sci=high")) acpi_sci_flags.polarity = 1; else if (fullarg(from, "acpi_sci=low")) acpi_sci_flags.polarity = 3; /* acpi=strict disables out-of-spec workarounds */ else if (fullarg(from, "acpi=strict")) { acpi_strict = 1; } #ifdef CONFIG_X86_IO_APIC else if (fullarg(from, "acpi_skip_timer_override")) acpi_skip_timer_override = 1; #endif #endif if (fullarg(from, "disable_timer_pin_1")) disable_timer_pin_1 = 1; if (fullarg(from, "enable_timer_pin_1")) disable_timer_pin_1 = -1; if (fullarg(from, "nolapic") || fullarg(from, "disableapic")) { clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability); disable_apic = 1; } if (fullarg(from, "noapic")) skip_ioapic_setup = 1; if (fullarg(from,"apic")) { skip_ioapic_setup = 0; ioapic_force = 1; } if (!memcmp(from, "mem=", 4)) parse_memopt(from+4, &from); if (!memcmp(from, "memmap=", 7)) { parse_memmapopt(from+7, &from); } if (!memcmp(from, "bootmem_debug", 13)) bootmem_debug = 1; #ifdef CONFIG_NUMA if (!memcmp(from, "numa=", 5)) numa_setup(from+5); #endif if (!memcmp(from,"iommu=",6)) { iommu_setup(from+6); } if (fullarg(from,"oops=panic")) panic_on_oops = 1; if (!memcmp(from, "noexec=", 7)) nonx_setup(from + 7); #ifdef CONFIG_KEXEC /* crashkernel=size@addr specifies the location to reserve for * a crash kernel. By reserving this memory we guarantee * that linux never set's it up as a DMA target. * Useful for holding code to do something appropriate * after a kernel panic. */ else if (!memcmp(from, "crashkernel=", 12)) { unsigned long size, base; size = memparse(from+12, &from); if (*from == '@') { base = memparse(from+1, &from); crashk_res.start = base; crashk_res.end = base + size - 1; } } #endif #ifdef CONFIG_PROC_VMCORE /* elfcorehdr= specifies the location of elf core header * stored by the crashed kernel. This option will be passed * by kexec loader to the capture kernel. */ else if(!memcmp(from, "elfcorehdr=", 11)) elfcorehdr_addr = memparse(from+11, &from); #endif #ifdef CONFIG_HOTPLUG_CPU else if (!memcmp(from, "additional_cpus=", 16)) setup_additional_cpus(from+16); #endif else if (!memcmp(from, "ipmi_dev_order=", 15)) ipmi_dev_order = simple_strtoul(from + 15, NULL, 0); else if (!memcmp(from, "nosmp", 5)) nosmp(NULL); next_char: c = *(from++); if (!c) break; if (COMMAND_LINE_SIZE <= ++len) break; *(to++) = c; } *to = '\0'; *cmdline_p = command_line; }
static int __init gpio_ir_timeout_setup(char *p) { gpio_ir_timeout = memparse(p, NULL); return 0; }
static int __init reserve_audio_size_setup(char *p) { reserve_audio_size = memparse(p, NULL); return 0; }
static int __init early_parse_mem(char *p) { memory_end = memparse(p, &p); memory_end_set = 1; return 0; }
static int __init pmem_audio_size_setup(char *p) { pmem_audio_size = memparse(p, NULL); return 0; }
static inline int parse_rd_cmdline(unsigned long* rd_start, unsigned long* rd_end) { /* * "rd_start=0xNNNNNNNN" defines the memory address of an initrd * "rd_size=0xNN" it's size */ unsigned long start = 0; unsigned long size = 0; unsigned long end; char cmd_line[CL_SIZE]; char *start_str; char *size_str; char *tmp; strcpy(cmd_line, command_line); *command_line = 0; tmp = cmd_line; /* Ignore "rd_start=" strings in other parameters. */ start_str = strstr(cmd_line, "rd_start="); if (start_str && start_str != cmd_line && *(start_str - 1) != ' ') start_str = strstr(start_str, " rd_start="); while (start_str) { if (start_str != cmd_line) strncat(command_line, tmp, start_str - tmp); start = memparse(start_str + 9, &start_str); tmp = start_str + 1; start_str = strstr(start_str, " rd_start="); } if (*tmp) strcat(command_line, tmp); strcpy(cmd_line, command_line); *command_line = 0; tmp = cmd_line; /* Ignore "rd_size" strings in other parameters. */ size_str = strstr(cmd_line, "rd_size="); if (size_str && size_str != cmd_line && *(size_str - 1) != ' ') size_str = strstr(size_str, " rd_size="); while (size_str) { if (size_str != cmd_line) strncat(command_line, tmp, size_str - tmp); size = memparse(size_str + 8, &size_str); tmp = size_str + 1; size_str = strstr(size_str, " rd_size="); } if (*tmp) strcat(command_line, tmp); #ifdef CONFIG_MIPS64 /* HACK: Guess if the sign extension was forgotten */ if (start > 0x0000000080000000 && start < 0x00000000ffffffff) start |= 0xffffffff00000000; #endif end = start + size; if (start && end) { *rd_start = start; *rd_end = end; return 1; } return 0; }
static int __init early_cma(char *p) { pr_debug("%s(%s)\n", __func__, p); size_cmdline = memparse(p, &p); return 0; }
static int __init tegra_max_cpu_current(char *options) { char *p = options; max_cpu_current = memparse(p, &p); return 1; }
fw_memblock_t * __init fw_getmdesc(int eva) { char *memsize_str, *ememsize_str = NULL, *ptr; unsigned long memsize = 0, ememsize = 0; static char cmdline[COMMAND_LINE_SIZE] __initdata; int tmp; /* otherwise look in the environment */ memsize_str = fw_getenv("memsize"); if (memsize_str) tmp = kstrtol(memsize_str, 0, &memsize); if (eva) { /* Look for ememsize for EVA */ ememsize_str = fw_getenv("ememsize"); if (ememsize_str) tmp = kstrtol(ememsize_str, 0, &ememsize); } if (!memsize && !ememsize) { pr_warn("memsize not set in YAMON, set to default (32Mb)\n"); physical_memsize = 0x02000000; } else { /* If ememsize is set, then set physical_memsize to that */ physical_memsize = ememsize ? : memsize; } #ifdef CONFIG_CPU_BIG_ENDIAN /* SOC-it swaps, or perhaps doesn't swap, when DMA'ing the last word of physical memory */ physical_memsize -= PAGE_SIZE; #endif /* Check the command line for a memsize directive that overrides the physical/default amount */ strcpy(cmdline, arcs_cmdline); ptr = strstr(cmdline, "memsize="); if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' ')) ptr = strstr(ptr, " memsize="); /* And now look for ememsize */ if (eva) { ptr = strstr(cmdline, "ememsize="); if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' ')) ptr = strstr(ptr, " ememsize="); } if (ptr) memsize = memparse(ptr + 8 + (eva ? 1 : 0), &ptr); else memsize = physical_memsize; /* Last 64K for HIGHMEM arithmetics */ if (memsize > 0x7fff0000) memsize = 0x7fff0000; memset(mdesc, 0, sizeof(mdesc)); mdesc[0].type = fw_dontuse; mdesc[0].base = PHYS_OFFSET; mdesc[0].size = 0x00001000; mdesc[1].type = fw_code; mdesc[1].base = mdesc[0].base + 0x00001000UL; mdesc[1].size = 0x000ef000; /* * The area 0x000f0000-0x000fffff is allocated for BIOS memory by the * south bridge and PCI access always forwarded to the ISA Bus and * BIOSCS# is always generated. * This mean that this area can't be used as DMA memory for PCI * devices. */ mdesc[2].type = fw_dontuse; mdesc[2].base = mdesc[0].base + 0x000f0000UL; mdesc[2].size = 0x00010000; mdesc[3].type = fw_dontuse; mdesc[3].base = mdesc[0].base + 0x00100000UL; mdesc[3].size = CPHYSADDR(PFN_ALIGN((unsigned long)&_end)) - 0x00100000UL; mdesc[4].type = fw_free; mdesc[4].base = mdesc[0].base + CPHYSADDR(PFN_ALIGN(&_end)); mdesc[4].size = memsize - CPHYSADDR(mdesc[4].base); return &mdesc[0]; }
static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, char **cmdline, struct meminfo *mi) { struct tag *t; struct tag *mem_tag = 0; int total_mem = SZ_1G; int left_mem = 0; int gpu_mem = SZ_128M; int fb_mem = SZ_32M; char *str; for_each_tag(mem_tag, tags) { if (mem_tag->hdr.tag == ATAG_MEM) { total_mem = mem_tag->u.mem.size; left_mem = total_mem - gpu_mem - fb_mem; break; } } for_each_tag(t, tags) { if (t->hdr.tag == ATAG_CMDLINE) { str = t->u.cmdline.cmdline; str = strstr(str, "mem="); if (str != NULL) { str += 4; left_mem = memparse(str, &str); if (left_mem == 0 || left_mem > total_mem) left_mem = total_mem - gpu_mem - fb_mem; } str = t->u.cmdline.cmdline; str = strstr(str, "gpu_memory="); if (str != NULL) { str += 11; gpu_mem = memparse(str, &str); } break; } } if (mem_tag) { fb_mem = total_mem - left_mem - gpu_mem; if (fb_mem < 0) { gpu_mem = total_mem - left_mem; fb_mem = 0; } mem_tag->u.mem.size = left_mem; /* reserve memory for gpu */ gpu_data.reserved_mem_base = mem_tag->u.mem.start + left_mem; gpu_data.reserved_mem_size = gpu_mem; /* reserver memory for fb */ loco_fb_di0_data.res_base = gpu_data.reserved_mem_base + gpu_data.reserved_mem_size; loco_fb_di0_data.res_size = fb_mem; loco_fb_di1_data.res_base = loco_fb_di0_data.res_base; loco_fb_di1_data.res_size = loco_fb_di0_data.res_size; } }
int main(int argc, char *argv[]) { int c; ourname = argv[0]; pagesize = getpagesize(); while ((c = getopt_long(argc, argv, "aAf:FPp:gqowRMm:n:t:ds:T:Sr:u:j:h", opts, NULL)) != -1) { switch (c) { case 'a': opt_malloc++; break; case 'u': unit = memparse(optarg, NULL); break; case 'j': step = memparse(optarg, NULL); break; case 'A': msync_mode = MS_ASYNC; break; case 'f': filename = optarg; map_shared = MAP_SHARED; break; case 'p': pid_filename = optarg; break; case 'g': do_getchar = 1; break; case 'm': /* kept for compatibility */ bytes = strtol(optarg, NULL, 10); bytes <<= 20; break; case 'n': nr_task = strtol(optarg, NULL, 10); break; case 't': nr_thread = strtol(optarg, NULL, 10); break; case 'P': prealloc++; break; case 'F': map_populate = MAP_POPULATE; break; case 'M': do_mlock = 1; break; case 'q': quiet = 1; break; case 's': sleep_secs = strtol(optarg, NULL, 10); break; case 'T': runtime_secs = strtol(optarg, NULL, 10); break; case 'd': opt_detach = 1; break; case 'r': reps = strtol(optarg, NULL, 10); break; case 'R': opt_randomise++; break; case 'S': msync_mode = MS_SYNC; break; case 'o': opt_readonly++; break; case 'w': opt_openrw++; break; case 'h': usage(0); break; default: usage(1); } } if (step < sizeof(long)) step = sizeof(long); if (optind != argc - 1) usage(0); if (pid_filename && nr_task) { fprintf(stderr, "%s: pid file is only for single process\n", ourname); exit(1); } if (runtime_secs) gettimeofday(&start_time, NULL); bytes = memparse(argv[optind], NULL); if (!opt_malloc) fd = open(filename, ((opt_readonly && !opt_openrw) ? O_RDONLY : O_RDWR) | O_CREAT, 0666); if (fd < 0) { fprintf(stderr, "%s: failed to open `%s': %s\n", ourname, filename, strerror(errno)); exit(1); } if (prealloc) prealloc = allocate(bytes); if (nr_task) return do_tasks(); return do_task(); }
static int __init bcm947xx_setup(char *str) { flash = memparse(str, &str); return 1; }
static int add_partition_from_environment(char *s, char **retptr) { unsigned long size; unsigned long offset = 0; char *name; int name_len; int delim; unsigned int flags; struct fastboot_ptentry part; size = memparse(s, &s); if (0 == size) { printf("Error:FASTBOOT size of parition is 0\n"); return 1; } /* fetch partition name and flags */ flags = 0; /* this is going to be a regular partition */ delim = 0; /* check for offset */ if (*s == '@') { s++; offset = memparse(s, &s); } else { printf("Error:FASTBOOT offset of parition is not given\n"); return 1; } /* now look for name */ if (*s == '(') delim = ')'; if (delim) { char *p; name = ++s; p = strchr((const char *)name, delim); if (!p) { printf("Error:FASTBOOT no closing %c found in partition name\n", delim); return 1; } name_len = p - name; s = p + 1; } else { printf("Error:FASTBOOT no partition name for \'%s\'\n", s); return 1; } /* test for options */ while (1) { if (strncmp(s, "i", 1) == 0) { flags |= FASTBOOT_PTENTRY_FLAGS_WRITE_I; s += 1; } else if (strncmp(s, "yaffs", 5) == 0) { /* yaffs */ flags |= FASTBOOT_PTENTRY_FLAGS_WRITE_YAFFS; s += 5; } else if (strncmp(s, "swecc", 5) == 0) { /* swecc */ flags |= FASTBOOT_PTENTRY_FLAGS_WRITE_SW_ECC; s += 5; } else if (strncmp(s, "hwecc", 5) == 0) { /* hwecc */ flags |= FASTBOOT_PTENTRY_FLAGS_WRITE_HW_ECC; s += 5; } else { break; } if (strncmp(s, "|", 1) == 0) s += 1; } /* enter this partition (offset will be calculated later if it is zero at this point) */ part.length = size; part.start = offset; part.flags = flags; if (name) { if (name_len >= sizeof(part.name)) { printf("Error:FASTBOOT partition name is too long\n"); return 1; } strncpy(&part.name[0], name, name_len); /* name is not null terminated */ part.name[name_len] = '\0'; } else { printf("Error:FASTBOOT no name\n"); return 1; } /* Check if this overlaps a static partition */ if (check_against_static_partition(&part)) { printf("Adding: %s, offset 0x%8.8x, size 0x%8.8x, flags 0x%8.8x\n", part.name, part.start, part.length, part.flags); fastboot_flash_add_ptn(&part); } /* return (updated) pointer command line string */ *retptr = s; /* return partition table */ return 0; }
int main(int argc, char *argv[]) { struct timeval start, stop, diff; char *end; int i; if (argv[1] && strcmp(argv[1], "-direct") == 0) { directio = 1; argc--; argv++; } if (argc != 4) { fprintf(stderr, usage); exit(1); } if ((threads = atoi(argv[1])) == 0) { fprintf(stderr, usage); exit(1); } chunk_size = align(memparse(argv[2], &end), PAGE_SIZE); if (*end) { fprintf(stderr, usage); exit(1); } data_size = align(memparse(argv[3], &end), PAGE_SIZE); if (*end) { fprintf(stderr, usage); exit(1); } /* retrieve group name */ mygroup = getenv("MYGROUP"); if (!mygroup) { fprintf(stderr, "ERROR: undefined environment variable MYGROUP\n"); exit(1); } children = malloc(sizeof(pid_t) * threads); if (!children) { fprintf(stderr, "ERROR: not enough memory\n"); exit(1); } /* handle user interrupt */ signal(SIGINT, signal_handler); /* handle kill from shell */ signal(SIGTERM, signal_handler); fprintf(stdout, "chunk_size %luKiB, data_size %luKiB\n", kb(chunk_size), kb(data_size)); fflush(stdout); gettimeofday(&start, NULL); for (i = 0; i < threads ; i++) spawn(i); for (i = 0; i < threads; i++) { int status; wait(&status); if (!WIFEXITED(status)) exit(1); } gettimeofday(&stop, NULL); timersub(&stop, &start, &diff); print_results(0, NUM_IOPS, data_size * threads * NUM_IOPS, &diff); fflush(stdout); free(children); exit(0); }
static void __init gpu_phys_size_setup(char **p) { gpu_phys_size = memparse(*p, p); }
/* * Parse one partition definition for an MTD. Since there can be many * comma separated partition definitions, this function calls itself * recursively until no more partition definitions are found. Nice side * effect: the memory to keep the mtd_partition structs and the names * is allocated upon the last definition being found. At that point the * syntax has been verified ok. */ static struct mtd_partition * newpart(char *s, char **retptr, int *num_parts, int this_part, unsigned char **extra_mem_ptr, int extra_mem_size) { struct mtd_partition *parts; unsigned long size; unsigned long offset = 0; char *name; int name_len; unsigned char *extra_mem; char delim; unsigned int mask_flags; /* fetch the partition size */ if (*s == '-') { /* assign all remaining space to this partition */ size = SIZE_REMAINING; s++; } else { size = memparse(s, &s); if (size < PAGE_SIZE) { printk(KERN_ERR ERRP "partition size too small (%lx)\n", size); return 0; } } /* fetch partition name and flags */ mask_flags = 0; /* this is going to be a regular partition */ delim = 0; /* check for offset */ if (*s == '@') { s++; offset = memparse(s, &s); } /* now look for name */ if (*s == '(') { delim = ')'; } if (delim) { char *p; name = ++s; if ((p = strchr(name, delim)) == 0) { printk(KERN_ERR ERRP "no closing %c found in partition name\n", delim); return 0; } name_len = p - name; s = p + 1; } else { name = NULL; name_len = 13; /* Partition_000 */ } /* record name length for memory allocation later */ extra_mem_size += name_len + 1; /* test for options */ if (strncmp(s, "ro", 2) == 0) { mask_flags |= MTD_WRITEABLE; s += 2; } /* test if more partitions are following */ if (*s == ',') { if (size == SIZE_REMAINING) { printk(KERN_ERR ERRP "no partitions allowed after a fill-up partition\n"); return 0; } /* more partitions follow, parse them */ if ((parts = newpart(s + 1, &s, num_parts, this_part + 1, &extra_mem, extra_mem_size)) == 0) return 0; } else { /* this is the last partition: allocate space for all */ int alloc_size; *num_parts = this_part + 1; alloc_size = *num_parts * sizeof(struct mtd_partition) + extra_mem_size; parts = kmalloc(alloc_size, GFP_KERNEL); if (!parts) { printk(KERN_ERR ERRP "out of memory\n"); return 0; } memset(parts, 0, alloc_size); extra_mem = (unsigned char *)(parts + *num_parts); } /* enter this partition (offset will be calculated later if it is zero at this point) */ parts[this_part].size = size; parts[this_part].offset = offset; parts[this_part].mask_flags = mask_flags; if (name) { strncpy(extra_mem, name, name_len); extra_mem[name_len] = 0; } else { sprintf(extra_mem, "Partition_%03d", this_part); } parts[this_part].name = extra_mem; extra_mem += name_len + 1; dbg(("partition %d: name <%s>, offset %x, size %x, mask flags %x\n", this_part, parts[this_part].name, parts[this_part].offset, parts[this_part].size, parts[this_part].mask_flags)); /* return (updated) pointer to extra_mem memory */ if (extra_mem_ptr) *extra_mem_ptr = extra_mem; /* return (updated) pointer command line string */ *retptr = s; /* return partition table */ return parts; }
static int __init rd_size_early(char *p) { initrd_end += memparse(p, &p); return 0; }
static int sony_ric_setup(char *s) { unsigned long res = memparse(s, NULL); security_state = !!res; return 0; }
static int __init fb_size_setup(char *p) { fb_size = memparse(p, NULL); return 0; }
/*! * Board specific fixup function. It is called by \b setup_arch() in * setup.c file very early on during kernel starts. It allows the user to * statically fill in the proper values for the passed-in parameters. None of * the parameters is used currently. * * @param desc pointer to \b struct \b machine_desc * @param tags pointer to \b struct \b tag * @param cmdline pointer to the command line * @param mi pointer to \b struct \b meminfo */ static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, char **cmdline, struct meminfo *mi) { struct tag *t; struct tag *mem_tag = 0; int total_mem = SZ_1G; int left_mem = 0; int gpu_mem = SZ_128M; int fb_mem = SZ_32M; char *str; mxc_set_cpu_type(MXC_CPU_MX53); for_each_tag(mem_tag, tags) { if (mem_tag->hdr.tag == ATAG_MEM) { total_mem = mem_tag->u.mem.size; break; } } for_each_tag(t, tags) { if (t->hdr.tag == ATAG_CMDLINE) { str = t->u.cmdline.cmdline; str = strstr(str, "mem="); if (str != NULL) { str += 4; left_mem = memparse(str, &str); } str = t->u.cmdline.cmdline; str = strstr(str, "gpu_nommu"); if (str != NULL) gpu_data.enable_mmu = 0; str = t->u.cmdline.cmdline; str = strstr(str, "gpu_memory="); if (str != NULL) { str += 11; gpu_mem = memparse(str, &str); } break; } } if (gpu_data.enable_mmu) gpu_mem = 0; if (left_mem == 0 || left_mem > total_mem) left_mem = total_mem - gpu_mem - fb_mem; if (mem_tag) { fb_mem = total_mem - left_mem - gpu_mem; if (fb_mem < 0) { gpu_mem = total_mem - left_mem; fb_mem = 0; } mem_tag->u.mem.size = left_mem; /*reserve memory for gpu*/ if (!gpu_data.enable_mmu) { gpu_device.resource[5].start = mem_tag->u.mem.start + left_mem; gpu_device.resource[5].end = gpu_device.resource[5].start + gpu_mem - 1; } #if defined(CONFIG_FB_MXC_SYNC_PANEL) || \ defined(CONFIG_FB_MXC_SYNC_PANEL_MODULE) if (fb_mem) { mxcfb_resources[0].start = gpu_data.enable_mmu ? mem_tag->u.mem.start + left_mem : gpu_device.resource[5].end + 1; mxcfb_resources[0].end = mxcfb_resources[0].start + fb_mem - 1; } else { mxcfb_resources[0].start = 0; mxcfb_resources[0].end = 0; } #endif } }
static void __init fixup_edm_cf_imx6_board(struct machine_desc *desc, struct tag *tags, char **cmdline, struct meminfo *mi) { char *str; struct tag *t; #if 0 int i = 0; struct ipuv3_fb_platform_data *pdata_fb = edm_cf_imx6_fb_pdata; #endif for_each_tag(t, tags) { if (t->hdr.tag == ATAG_CMDLINE) { #if 0 str = t->u.cmdline.cmdline; str = strstr(str, "fbmem="); if (str != NULL) { str += 6; pdata_fb[i++].res_size[0] = memparse(str, &str); while (*str == ',' && i < ARRAY_SIZE(edm_cf_imx6_fb_pdata)) { str++; pdata_fb[i++].res_size[0] = memparse(str, &str); } } #endif #if defined(CONFIG_ION) /* ION reserved memory */ str = t->u.cmdline.cmdline; str = strstr(str, "ionmem="); if (str != NULL) { str += strlen("ionmem="); edm_cf_imx6_ion_data.heaps[0].size = memparse(str, &str); } #endif #if 0 /* Primary framebuffer base address */ str = t->u.cmdline.cmdline; str = strstr(str, "fb0base="); if (str != NULL) { str += strlen("fb0base="); pdata_fb[0].res_base[0] = simple_strtol(str, &str, 16); } #endif /* GPU reserved memory */ str = t->u.cmdline.cmdline; str = strstr(str, "gpumem="); if (str != NULL) { str += strlen("gpumem="); edm_cf_imx6_gpu_pdata.reserved_mem_size = memparse(str, &str); } str = t->u.cmdline.cmdline; str = strstr(str, "fs_sdcard="); if (str != NULL) { str += strlen("fs_sdcard="); fs_in_sdcard = memparse(str, &str); } #if defined(CONFIG_EDM) str = t->u.cmdline.cmdline; str = strstr(str, "expansion="); if (str != NULL) { str += strlen("expansion="); edm_expansion = str; } str = t->u.cmdline.cmdline; str = strstr(str, "baseboard="); if (str != NULL) { str += strlen("baseboard="); edm_baseboard = str; } #endif break; } } }
static struct mtd_partition * newpart(char *s, char **retptr, int *num_parts, int this_part, unsigned char **extra_mem_ptr, int extra_mem_size) { struct mtd_partition *parts; unsigned long size; unsigned long offset = OFFSET_CONTINUOUS; char *name; int name_len; unsigned char *extra_mem; char delim; unsigned int mask_flags; /* fetch the partition size */ if (*s == '-') { /* assign all remaining space to this partition */ size = SIZE_REMAINING; s++; } else { size = memparse(s, &s); if (size < PAGE_SIZE) { printf("partition size too small (%lx)\n", size); return 0; } } /* fetch partition name and flags */ mask_flags = 0; /* this is going to be a regular partition */ delim = 0; /* check for offset */ if (*s == '@') { s++; offset = memparse(s, &s); } /* now look for name */ if (*s == '(') { delim = ')'; } if (delim) { char *p; name = ++s; p = strchr(name, delim); if (!p) { printf("no closing %c found in partition name\n", delim); return 0; } name_len = p - name; s = p + 1; } else { name = 0; name_len = 13; /* Partition_000 */ } /* record name length for memory allocation later */ extra_mem_size += name_len + 1; /* test for options */ if (strncmp(s, "ro", 2) == 0) { mask_flags |= MTD_WRITEABLE; s += 2; } /* if lk is found do NOT unlock the MTD partition*/ if (strncmp(s, "lk", 2) == 0) { mask_flags |= MTD_POWERUP_LOCK; s += 2; } /* test if more partitions are following */ if (*s == ',') { if (size == SIZE_REMAINING) { printf("no partitions allowed after a fill-up partition\n"); return 0; } /* more partitions follow, parse them */ parts = newpart(s + 1, &s, num_parts, this_part + 1, &extra_mem, extra_mem_size); if (!parts) return 0; } else { /* this is the last partition: allocate space for all */ int alloc_size; *num_parts = this_part + 1; alloc_size = *num_parts * sizeof(struct mtd_partition) + extra_mem_size; parts = (struct mtd_partition *)malloc(alloc_size); if (!parts) { printf("out of memory\n"); return 0; } extra_mem = (unsigned char *)(parts + *num_parts); } /* enter this partition (offset will be calculated later if it is zero at this point) */ parts[this_part].size = size; parts[this_part].offset = offset; parts[this_part].mask_flags = mask_flags; if (name) { strlcpy(extra_mem, name, name_len + 1); } else { sprintf(extra_mem, "Partition_%03d", this_part); } parts[this_part].name = extra_mem; extra_mem += name_len + 1; /*printf("partition %02d: name <%14s>, offset %08x, size %08x, mask flags %08x\n", this_part, parts[this_part].name, parts[this_part].offset, parts[this_part].size, parts[this_part].mask_flags);*/ if (current_part >= 0) { current_part --; memset(&(realpartname[current_part]), 0, 255); strcpy(realpartname[current_part], parts[this_part].name); realpart[current_part].name = realpartname[current_part]; //printf("realname = %14s partname = %14s\n", realpart[current_part].name, parts[this_part].name); realpart[current_part].offset = parts[this_part].offset; realpart[current_part].size = parts[this_part].size; } else printf("mtdparts partition is too much\n"); /* return (updated) pointer to extra_mem memory */ if (extra_mem_ptr) *extra_mem_ptr = extra_mem; /* return (updated) pointer command line string */ *retptr = s; /* return partition table */ return parts; }
static int __init early_coherent_pool(char *p) { coherent_pool_size = memparse(p, &p); return 0; }
static void __init pmem_kernel_ebi1_size_setup(char **p) { pmem_kernel_ebi1_size = memparse(*p, p); }
static int __init kernel_ebi1_mem_size_setup(char *p) { kernel_ebi1_mem_size = memparse(p, NULL); return 0; }
static void __init pmem_gpu1_size_setup(char **p) { pmem_gpu1_size = memparse(*p, p); }
static int __init reserve_kernel_ebi1_size_setup(char *p) { reserve_kernel_ebi1_size = memparse(p, NULL); return 0; }
static void __init fb_size_setup(char **p) { fb_size = memparse(*p, p); }
static __init int setup_lpm_boot_mode(char *opt) { sec_lpm_bootmode = (u32) memparse(opt, &opt); return 0; }
/*! * Board specific fixup function. It is called by \b setup_arch() in * setup.c file very early on during kernel starts. It allows the user to * statically fill in the proper values for the passed-in parameters. None of * the parameters is used currently. * * @param desc pointer to \b struct \b machine_desc * @param tags pointer to \b struct \b tag * @param cmdline pointer to the command line * @param mi pointer to \b struct \b meminfo */ static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags, char **cmdline, struct meminfo *mi) { char *str; struct tag *t; struct tag *mem_tag = 0; int total_mem = SZ_512M; int left_mem = 0; int gpu_mem = SZ_64M; int fb_mem = SZ_32M; mxc_set_cpu_type(MXC_CPU_MX51); get_cpu_wp = mx51_babbage_get_cpu_wp; set_num_cpu_wp = mx51_babbage_set_num_cpu_wp; get_dvfs_core_wp = mx51_babbage_get_dvfs_core_table; num_cpu_wp = ARRAY_SIZE(cpu_wp_auto); for_each_tag(mem_tag, tags) { if (mem_tag->hdr.tag == ATAG_MEM) { total_mem = mem_tag->u.mem.size; left_mem = total_mem - gpu_mem - fb_mem; break; } } for_each_tag(t, tags) { if (t->hdr.tag == ATAG_CMDLINE) { str = t->u.cmdline.cmdline; str = strstr(str, "mem="); if (str != NULL) { str += 4; left_mem = memparse(str, &str); if (left_mem == 0 || left_mem > total_mem) left_mem = total_mem - gpu_mem - fb_mem; } str = t->u.cmdline.cmdline; str = strstr(str, "gpu_memory="); if (str != NULL) { str += 11; gpu_mem = memparse(str, &str); } break; } } if (mem_tag) { fb_mem = total_mem - left_mem - gpu_mem; if (fb_mem < 0) { gpu_mem = total_mem - left_mem; fb_mem = 0; } mem_tag->u.mem.size = left_mem; /*reserve memory for gpu*/ gpu_device.resource[5].start = mem_tag->u.mem.start + left_mem; gpu_device.resource[5].end = gpu_device.resource[5].start + gpu_mem - 1; #if defined(CONFIG_FB_MXC_SYNC_PANEL) || \ defined(CONFIG_FB_MXC_SYNC_PANEL_MODULE) if (fb_mem) { mxcfb_resources[0].start = gpu_device.resource[5].end + 1; mxcfb_resources[0].end = mxcfb_resources[0].start + fb_mem - 1; } else { mxcfb_resources[0].start = 0; mxcfb_resources[0].end = 0; } #endif } }