Esempio n. 1
0
void __init machine_early_init(const char *cmdline, unsigned int ram,
		unsigned int fdt)
{
	unsigned long *src, *dst = (unsigned long *)0x0;

/* clearing bss section */
	memset(__bss_start, 0, __bss_stop-__bss_start);
	memset(_ssbss, 0, _esbss-_ssbss);

	/*
	 * Copy command line passed from bootloader, or use default
	 * if none provided, or forced
	 */
#ifndef CONFIG_CMDLINE_BOOL
	if (cmdline && cmdline[0] != '\0')
		strlcpy(cmd_line, cmdline, COMMAND_LINE_SIZE);
#endif

/* initialize device tree for usage in early_printk */
	early_init_devtree((void *)_fdt_start);

#ifdef CONFIG_EARLY_PRINTK
	setup_early_printk(NULL);
#endif

	early_printk("Ramdisk addr 0x%08x, FDT 0x%08x\n", ram, fdt);
	printk(KERN_NOTICE "Found FDT at 0x%08x\n", fdt);

#ifdef CONFIG_MTD_UCLINUX
	{
		int size;
		unsigned int romfs_base;
		romfs_base = (ram ? ram : (unsigned int)&__init_end);
		/* if CONFIG_MTD_UCLINUX_EBSS is defined, assume ROMFS is at the
		 * end of kernel, which is ROMFS_LOCATION defined above. */
		size = PAGE_ALIGN(get_romfs_len((unsigned *)romfs_base));
		early_printk("Found romfs @ 0x%08x (0x%08x)\n",
				romfs_base, size);
		early_printk("#### klimit %p ####\n", klimit);
		BUG_ON(size < 0); /* What else can we do? */

		/* Use memmove to handle likely case of memory overlap */
		early_printk("Moving 0x%08x bytes from 0x%08x to 0x%08x\n",
			size, romfs_base, (unsigned)&_ebss);
		memmove(&_ebss, (int *)romfs_base, size);

		/* update klimit */
		klimit += PAGE_ALIGN(size);
		early_printk("New klimit: 0x%08x\n", (unsigned)klimit);
	}
#endif

	for (src = __ivt_start; src < __ivt_end; src++, dst++)
		*dst = *src;

	/* Initialize global data */
	per_cpu(KM, 0) = 0x1;	/* We start in kernel mode */
	per_cpu(CURRENT_SAVE, 0) = (unsigned long)current;
}
/* mach_early_init() is called very early, after the kernel stack and SDA 
   pointers are configured, but before BSS/SBSS are zeroed etc.  Be careful 
   what you do in here.  The bss and sbss sections are zeroed in here */
void __init mach_early_init (void)
{
	unsigned int *src, *dst;
	unsigned int len;

	extern unsigned char _ssbss, _esbss;
	extern unsigned int _intv_load_end, _intv_load_start;
	extern unsigned int _ramstart;

	/* Copy interrupt vectors from high memory down to where
	   they belong. */
	dst = (unsigned int *)0x0;		
	src = (unsigned int *)&_intv_load_start;

#if 1	/* JW don't overwrite reset vector */
	src++;
	src++;
	dst++;
	dst++;
#endif
	do {
		*(dst++) = *(src++);
	} while (src < &_intv_load_end);

#ifdef CONFIG_MODEL_RAM
	/* Copy ROMFS above bss */
	src=get_romfs_base();
	len=get_romfs_len(src);

	if(len)
	{
		/* Use memmove to handle likely case of memory overlap */
		memmove(__bss_stop,__bss_start,len);
	}

        _ramstart = (unsigned long)__bss_stop + len;
#endif

#ifdef CONFIG_MODEL_ROM
	_ramstart = (unsigned long)__bss_stop;
#endif

	/* Zero the BSS and SBSS sections */
	memset(__bss_start,0,__bss_stop-__bss_start);
	memset(&_ssbss,0,&_esbss-&_ssbss);
}
Esempio n. 3
0
void __init machine_early_init(const char *cmdline, unsigned int ram,
                               unsigned int fdt, unsigned int msr)
{
    unsigned long *src, *dst;
    unsigned int offset = 0;

    /* If CONFIG_MTD_UCLINUX is defined, assume ROMFS is at the
     * end of kernel. There are two position which we want to check.
     * The first is __init_end and the second __bss_start.
     */
#ifdef CONFIG_MTD_UCLINUX
    int romfs_size;
    unsigned int romfs_base;
    char *old_klimit = klimit;

    romfs_base = (ram ? ram : (unsigned int)&__init_end);
    romfs_size = PAGE_ALIGN(get_romfs_len((unsigned *)romfs_base));
    if (!romfs_size) {
        romfs_base = (unsigned int)&__bss_start;
        romfs_size = PAGE_ALIGN(get_romfs_len((unsigned *)romfs_base));
    }

    /* Move ROMFS out of BSS before clearing it */
    if (romfs_size > 0) {
        memmove(&_ebss, (int *)romfs_base, romfs_size);
        klimit += romfs_size;
    }
#endif

    /* clearing bss section */
    memset(__bss_start, 0, __bss_stop-__bss_start);
    memset(_ssbss, 0, _esbss-_ssbss);

    /* Copy command line passed from bootloader */
#ifndef CONFIG_CMDLINE_BOOL
    if (cmdline && cmdline[0] != '\0')
        strlcpy(cmd_line, cmdline, COMMAND_LINE_SIZE);
#endif

    lockdep_init();

    /* initialize device tree for usage in early_printk */
    early_init_devtree((void *)_fdt_start);

#ifdef CONFIG_EARLY_PRINTK
    setup_early_printk(NULL);
#endif

    eprintk("Ramdisk addr 0x%08x, ", ram);
    if (fdt)
        eprintk("FDT at 0x%08x\n", fdt);
    else
        eprintk("Compiled-in FDT at 0x%08x\n",
                (unsigned int)_fdt_start);

#ifdef CONFIG_MTD_UCLINUX
    eprintk("Found romfs @ 0x%08x (0x%08x)\n",
            romfs_base, romfs_size);
    eprintk("#### klimit %p ####\n", old_klimit);
    BUG_ON(romfs_size < 0); /* What else can we do? */

    eprintk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n",
            romfs_size, romfs_base, (unsigned)&_ebss);

    eprintk("New klimit: 0x%08x\n", (unsigned)klimit);
#endif

#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
    if (msr)
        eprintk("!!!Your kernel has setup MSR instruction but "
                "CPU don't have it %x\n", msr);
#else
    if (!msr)
        eprintk("!!!Your kernel not setup MSR instruction but "
                "CPU have it %x\n", msr);
#endif

    /* Do not copy reset vectors. offset = 0x2 means skip the first
     * two instructions. dst is pointer to MB vectors which are placed
     * in block ram. If you want to copy reset vector setup offset to 0x0 */
#if !CONFIG_MANUAL_RESET_VECTOR
    offset = 0x2;
#endif
    dst = (unsigned long *) (offset * sizeof(u32));
    for (src = __ivt_start + offset; src < __ivt_end; src++, dst++)
        *dst = *src;

    /* Initialize global data */
    per_cpu(KM, 0) = 0x1;	/* We start in kernel mode */
    per_cpu(CURRENT_SAVE, 0) = (unsigned long)current;
}
Esempio n. 4
0
void __init machine_early_init(const char *cmdline, unsigned int ram,
		unsigned int fdt, unsigned int msr, unsigned int tlb0,
		unsigned int tlb1)
{
	unsigned long *src, *dst;
	unsigned int offset = 0;

	/*                                                         
                                                                 
                                                       
  */
#ifdef CONFIG_MTD_UCLINUX
	int romfs_size;
	unsigned int romfs_base;
	char *old_klimit = klimit;

	romfs_base = (ram ? ram : (unsigned int)&__init_end);
	romfs_size = PAGE_ALIGN(get_romfs_len((unsigned *)romfs_base));
	if (!romfs_size) {
		romfs_base = (unsigned int)&__bss_start;
		romfs_size = PAGE_ALIGN(get_romfs_len((unsigned *)romfs_base));
	}

	/*                                          */
	if (romfs_size > 0) {
		memmove(&_ebss, (int *)romfs_base, romfs_size);
		klimit += romfs_size;
	}
#endif

/*                      */
	memset(__bss_start, 0, __bss_stop-__bss_start);
	memset(_ssbss, 0, _esbss-_ssbss);

	/*                                          */
#ifndef CONFIG_CMDLINE_BOOL
	if (cmdline && cmdline[0] != '\0')
		strlcpy(cmd_line, cmdline, COMMAND_LINE_SIZE);
#endif

	lockdep_init();

/*                                                  */
	early_init_devtree((void *)_fdt_start);

#ifdef CONFIG_EARLY_PRINTK
	setup_early_printk(NULL);
#endif

	/*                                    
                                    */
	kernel_tlb = tlb0 + tlb1;
	/*                                                     
                          */

	printk("Ramdisk addr 0x%08x, ", ram);
	if (fdt)
		printk("FDT at 0x%08x\n", fdt);
	else
		printk("Compiled-in FDT at 0x%08x\n",
					(unsigned int)_fdt_start);

#ifdef CONFIG_MTD_UCLINUX
	printk("Found romfs @ 0x%08x (0x%08x)\n",
			romfs_base, romfs_size);
	printk("#### klimit %p ####\n", old_klimit);
	BUG_ON(romfs_size < 0); /*                      */

	printk("Moved 0x%08x bytes from 0x%08x to 0x%08x\n",
			romfs_size, romfs_base, (unsigned)&_ebss);

	printk("New klimit: 0x%08x\n", (unsigned)klimit);
#endif

#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
	if (msr)
		printk("!!!Your kernel has setup MSR instruction but "
				"CPU don't have it %x\n", msr);
#else
	if (!msr)
		printk("!!!Your kernel not setup MSR instruction but "
				"CPU have it %x\n", msr);
#endif

	/*                                                             
                                                                   
                                                                       */
#if !CONFIG_MANUAL_RESET_VECTOR
	offset = 0x2;
#endif
	dst = (unsigned long *) (offset * sizeof(u32));
	for (src = __ivt_start + offset; src < __ivt_end; src++, dst++)
		*dst = *src;

	/*                        */
	per_cpu(KM, 0) = 0x1;	/*                         */
	per_cpu(CURRENT_SAVE, 0) = (unsigned long)current;
}