cregit-Linux how code gets into the kernel

Release 4.7 arch/cris/kernel/setup.c

Directory: arch/cris/kernel
/*
 *
 *  linux/arch/cris/kernel/setup.c
 *
 *  Copyright (C) 1995  Linus Torvalds
 *  Copyright (c) 2001  Axis Communications AB
 */

/*
 * This file handles the architecture-dependent parts of initialization
 */

#include <linux/init.h>
#include <linux/mm.h>
#include <linux/bootmem.h>
#include <asm/pgtable.h>
#include <linux/seq_file.h>
#include <linux/screen_info.h>
#include <linux/utsname.h>
#include <linux/pfn.h>
#include <linux/cpu.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
#include <linux/of_platform.h>
#include <asm/setup.h>
#include <arch/system.h>

/*
 * Setup options
 */

struct screen_info screen_info;

extern int root_mountflags;
extern char _etext, _edata, _end;


char __initdata cris_command_line[COMMAND_LINE_SIZE] = { 0, };

extern const unsigned long text_start, edata; /* set by the linker script */
extern unsigned long dram_start, dram_end;

extern unsigned long romfs_start, romfs_length, romfs_in_flash; /* from head.S */


static struct cpu cpu_devices[NR_CPUS];

extern void show_etrax_copyright(void);		/* arch-vX/kernel/setup.c */

/* This mainly sets up the memory area, and can be really confusing.
 *
 * The physical DRAM is virtually mapped into dram_start to dram_end
 * (usually c0000000 to c0000000 + DRAM size). The physical address is
 * given by the macro __pa().
 *
 * In this DRAM, the kernel code and data is loaded, in the beginning.
 * It really starts at c0004000 to make room for some special pages -
 * the start address is text_start. The kernel data ends at _end. After
 * this the ROM filesystem is appended (if there is any).
 *
 * Between this address and dram_end, we have RAM pages usable to the
 * boot code and the system.
 *
 */


void __init setup_arch(char **cmdline_p) { extern void init_etrax_debug(void); unsigned long bootmap_size; unsigned long start_pfn, max_pfn; unsigned long memory_start; #ifdef CONFIG_OF early_init_dt_scan(__dtb_start); #endif /* register an initial console printing routine for printk's */ init_etrax_debug(); /* we should really poll for DRAM size! */ high_memory = &dram_end; if(romfs_in_flash || !romfs_length) { /* if we have the romfs in flash, or if there is no rom filesystem, * our free area starts directly after the BSS */ memory_start = (unsigned long) &_end; } else { /* otherwise the free area starts after the ROM filesystem */ printk("ROM fs in RAM, size %lu bytes\n", romfs_length); memory_start = romfs_start + romfs_length; } /* process 1's initial memory region is the kernel code/data */ init_mm.start_code = (unsigned long) &text_start; init_mm.end_code = (unsigned long) &_etext; init_mm.end_data = (unsigned long) &_edata; init_mm.brk = (unsigned long) &_end; /* min_low_pfn points to the start of DRAM, start_pfn points * to the first DRAM pages after the kernel, and max_low_pfn * to the end of DRAM. */ /* * partially used pages are not usable - thus * we are rounding upwards: */ start_pfn = PFN_UP(memory_start); /* usually c0000000 + kernel + romfs */ max_pfn = PFN_DOWN((unsigned long)high_memory); /* usually c0000000 + dram size */ /* * Initialize the boot-time allocator (start, end) * * We give it access to all our DRAM, but we could as well just have * given it a small slice. No point in doing that though, unless we * have non-contiguous memory and want the boot-stuff to be in, say, * the smallest area. * * It will put a bitmap of the allocated pages in the beginning * of the range we give it, but it won't mark the bitmaps pages * as reserved. We have to do that ourselves below. * * We need to use init_bootmem_node instead of init_bootmem * because our map starts at a quite high address (min_low_pfn). */ max_low_pfn = max_pfn; min_low_pfn = PAGE_OFFSET >> PAGE_SHIFT; bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn, min_low_pfn, max_low_pfn); /* And free all memory not belonging to the kernel (addr, size) */ free_bootmem(PFN_PHYS(start_pfn), PFN_PHYS(max_pfn - start_pfn)); /* * Reserve the bootmem bitmap itself as well. We do this in two * steps (first step was init_bootmem()) because this catches * the (very unlikely) case of us accidentally initializing the * bootmem allocator with an invalid RAM area. * * Arguments are start, size */ reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT); unflatten_and_copy_device_tree(); /* paging_init() sets up the MMU and marks all pages as reserved */ paging_init(); *cmdline_p = cris_command_line; #ifdef CONFIG_ETRAX_CMDLINE if (!strcmp(cris_command_line, "")) { strlcpy(cris_command_line, CONFIG_ETRAX_CMDLINE, COMMAND_LINE_SIZE); cris_command_line[COMMAND_LINE_SIZE - 1] = '\0'; } #endif /* Save command line for future references. */ memcpy(boot_command_line, cris_command_line, COMMAND_LINE_SIZE); boot_command_line[COMMAND_LINE_SIZE - 1] = '\0'; /* give credit for the CRIS port */ show_etrax_copyright(); /* Setup utsname */ strcpy(init_utsname()->machine, cris_machine_name); }

Contributors

PersonTokensPropCommitsCommitProp
linus torvaldslinus torvalds22075.34%433.33%
mikael starvikmikael starvik3612.33%216.67%
andrew mortonandrew morton144.79%18.33%
rabin vincentrabin vincent134.45%18.33%
serge hallynserge hallyn31.03%18.33%
alon bar-levalon bar-lev20.68%18.33%
ben collinsben collins20.68%18.33%
bernhard wallebernhard walle20.68%18.33%
Total292100.00%12100.00%

#ifdef CONFIG_PROC_FS
static void *c_start(struct seq_file *m, loff_t *pos) { return *pos < nr_cpu_ids ? (void *)(int)(*pos + 1) : NULL; }

Contributors

PersonTokensPropCommitsCommitProp
linus torvaldslinus torvalds2976.32%133.33%
mikael starvikmikael starvik821.05%133.33%
rusty russellrusty russell12.63%133.33%
Total38100.00%3100.00%


static void *c_next(struct seq_file *m, void *v, loff_t *pos) { ++*pos; return c_start(m, pos); }

Contributors

PersonTokensPropCommitsCommitProp
linus torvaldslinus torvalds2681.25%150.00%
mikael starvikmikael starvik618.75%150.00%
Total32100.00%2100.00%


static void c_stop(struct seq_file *m, void *v) { }

Contributors

PersonTokensPropCommitsCommitProp
linus torvaldslinus torvalds14100.00%1100.00%
Total14100.00%1100.00%

extern int show_cpuinfo(struct seq_file *m, void *v); const struct seq_operations cpuinfo_op = { .start = c_start, .next = c_next, .stop = c_stop, .show = show_cpuinfo, }; #endif /* CONFIG_PROC_FS */
static int __init topology_init(void) { int i; for_each_possible_cpu(i) { return register_cpu(&cpu_devices[i], i); } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
jesper nilssonjesper nilsson33100.00%1100.00%
Total33100.00%1100.00%

subsys_initcall(topology_init);
static int __init cris_of_init(void) { of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
rabin vincentrabin vincent23100.00%1100.00%
Total23100.00%1100.00%

core_initcall(cris_of_init);

Overall Contributors

PersonTokensPropCommitsCommitProp
linus torvaldslinus torvalds36860.93%420.00%
mikael starvikmikael starvik7712.75%210.00%
jesper nilssonjesper nilsson518.44%15.00%
rabin vincentrabin vincent508.28%15.00%
andrew mortonandrew morton233.81%15.00%
art haasart haas81.32%15.00%
geert uytterhoevengeert uytterhoeven60.99%15.00%
dave hansendave hansen30.50%15.00%
alon bar-levalon bar-lev30.50%15.00%
serge hallynserge hallyn30.50%15.00%
david howellsdavid howells30.50%15.00%
russell kingrussell king30.50%15.00%
ben collinsben collins20.33%15.00%
bernhard wallebernhard walle20.33%15.00%
jon smirljon smirl10.17%15.00%
rusty russellrusty russell10.17%15.00%
Total604100.00%20100.00%
Directory: arch/cris/kernel
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}