Пример #1
0
void board_init_r(gd_t *new_gd, ulong dest_addr)
{
#ifdef CONFIG_NEEDS_MANUAL_RELOC
	int i;
#endif

#ifdef CONFIG_AVR32
	mmu_init_r(dest_addr);
#endif

#if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
	gd = new_gd;
#endif

#ifdef CONFIG_NEEDS_MANUAL_RELOC
	for (i = 0; i < ARRAY_SIZE(init_sequence_r); i++)
		init_sequence_r[i] += gd->reloc_off;
#endif

	if (initcall_run_list(init_sequence_r))
		hang();

	/* NOTREACHED - run_main_loop() does not return */
	hang();
}
Пример #2
0
void board_init_f(ulong boot_flags)
{
#ifdef CONFIG_SYS_GENERIC_GLOBAL_DATA
	/*
	 * For some archtectures, global data is initialized and used before
	 * calling this function. The data should be preserved. For others,
	 * CONFIG_SYS_GENERIC_GLOBAL_DATA should be defined and use the stack
	 * here to host global data until relocation.
	 */
	gd_t data;

	gd = &data;

	/*
	 * Clear global data before it is accessed at debug print
	 * in initcall_run_list. Otherwise the debug print probably
	 * get the wrong vaule of gd->have_console.
	 */
	zero_global_data();
#endif

	gd->flags = boot_flags;
	gd->have_console = 0;

	if (initcall_run_list(init_sequence_f))
		hang();

#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX)
	/* NOTREACHED - jump_to_copy() does not return */
	hang();
#endif
}
Пример #3
0
void board_init_f(ulong boot_flags)
{
#ifndef CONFIG_X86
	gd_t data;

	gd = &data;
#endif

	/*
	 * Clear global data before it is accessed at debug print
	 * in initcall_run_list. Otherwise the debug print probably
	 * get the wrong vaule of gd->have_console.
	 */
#if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC512X) && \
		!defined(CONFIG_MPC83xx) && !defined(CONFIG_MPC85xx) && \
		!defined(CONFIG_MPC86xx) && !defined(CONFIG_X86)
	zero_global_data();
#endif

	gd->flags = boot_flags;
	gd->have_console = 0;

	if (initcall_run_list(init_sequence_f))
		hang();

#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX)
	/* NOTREACHED - jump_to_copy() does not return */
	hang();
#endif
}
Пример #4
0
void board_init_r(gd_t *new_gd, ulong dest_addr)
{
	/*
	 * Set up the new global data pointer. So far only x86 does this
	 * here.
	 * TODO([email protected]): Consider doing this for all archs, or
	 * dropping the new_gd parameter.
	 */
#if CONFIG_IS_ENABLED(X86_64)
	arch_setup_gd(new_gd);
#endif

#ifdef CONFIG_NEEDS_MANUAL_RELOC
	int i;
#endif

#if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
	gd = new_gd;
#endif
	gd->flags &= ~GD_FLG_LOG_READY;

#ifdef CONFIG_NEEDS_MANUAL_RELOC
	for (i = 0; i < ARRAY_SIZE(init_sequence_r); i++)
		init_sequence_r[i] += gd->reloc_off;
#endif

	if (initcall_run_list(init_sequence_r))
		hang();

	/* NOTREACHED - run_main_loop() does not return */
	hang();
}
Пример #5
0
void board_init_f_r(void)
{
	if (initcall_run_list(init_sequence_f_r))
		hang();

	/*
	 * The pre-relocation drivers may be using memory that has now gone
	 * away. Mark serial as unavailable - this will fall back to the debug
	 * UART if available.
	 */
	gd->flags &= ~GD_FLG_SERIAL_READY;
#ifdef CONFIG_TIMER
	gd->timer = NULL;
#endif

	/*
	 * U-Boot has been copied into SDRAM, the BSS has been cleared etc.
	 * Transfer execution from Flash to RAM by calculating the address
	 * of the in-RAM copy of board_init_r() and calling it
	 */
	(board_init_r + gd->reloc_off)((gd_t *)gd, gd->relocaddr);

	/* NOTREACHED - board_init_r() does not return */
	hang();
}
Пример #6
0
void board_init_f(ulong boot_flags)
{
	gd->flags = boot_flags;
	gd->have_console = 0;

	if (initcall_run_list(init_sequence_f))
		hang();

#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \
		!defined(CONFIG_EFI_APP) && !CONFIG_IS_ENABLED(X86_64)
	/* NOTREACHED - jump_to_copy() does not return */
	hang();
#endif
}
Пример #7
0
void board_init_f_r(void)
{
	if (initcall_run_list(init_sequence_f_r))
		hang();

	/*
	 * U-Boot has been copied into SDRAM, the BSS has been cleared etc.
	 * Transfer execution from Flash to RAM by calculating the address
	 * of the in-RAM copy of board_init_r() and calling it
	 */
	(board_init_r + gd->reloc_off)((gd_t *)gd, gd->relocaddr);

	/* NOTREACHED - board_init_r() does not return */
	hang();
}
Пример #8
0
int jz47xx_board_init_f(ulong api_addr, struct slpt_task *task)
{
	bd_t *bd;
	ulong addr, addr_malloc;

	/* compiler optimization barrier needed for GCC >= 3.4 */
	__asm__ __volatile__("" : : : "memory");

#ifndef CONFIG_SLPT
	/* unmap kuseg area */
	clear_c0_status(ST0_ERL);
	/* init BTB */
	__write_32bit_c0_register($16,7,0x10);
#endif

	/* Reserve memory for U-Boot code, data & bss
	 * round up to next 16 kB limit
	 */

	addr = bss_end();
	addr |= 16 * 1024 - 1;
	addr++;

	/* initialize the slpt task, and kernel api_addr
	 */
	uboot_slpt_task = task;
	slpt_kernel_get_api_val = (void *)api_addr;

	/*
	 * (permanently) allocate a Board Info struct
	 * and a permanent copy of the "global" data
	 */
	gd = (gd_t *)addr;
	memset((void *)gd, 0, sizeof(gd_t));
	if (initcall_run_list(init_sequence_f))
		hang();

	debug("Reserving %ldk for U-Boot: [%08x, %08lx)\n",
			(bss_end() - CONFIG_SYS_MONITOR_BASE) >> 10,
			CONFIG_SYS_MONITOR_BASE, bss_end());
	debug("Reserving %zu Bytes for Global Data: [%08lx, %08lx)\n",
			sizeof(gd_t), addr, addr + sizeof(gd_t));
	addr += sizeof(gd_t);

	bd = (bd_t *)addr;
	memset((void *)bd, 0, sizeof(bd_t));
	gd->bd = bd;
	debug("Reserving %zu Bytes for Board Info: [%08lx, %08lx)\n",
			sizeof(bd_t), addr, addr + sizeof(bd_t));
	addr += sizeof(bd_t);

	 /* Reserve memory for malloc() arena.
	 */
	debug("Reserving %dk for malloc(): [%08lx, %08lx)\n",
			misc_param.malloc_len >> 10, addr,
			addr + misc_param.malloc_len);
	addr_malloc = addr;
	addr += misc_param.malloc_len;

	/* Reserve memory for boot params.
	 */
	bd->bi_boot_params = addr;
	debug("Reserving %dk for boot params(): [%08lx, %08lx)\n",
			CONFIG_SYS_BOOTPARAMS_LEN >> 10,
			addr, addr + CONFIG_SYS_BOOTPARAMS_LEN);
	/* addr += CONFIG_SYS_BOOTPARAMS_LEN; */

	/*
	 * Finally, we set up a new (bigger) stack.
	 *
	 * Leave some safety gap for SP, force alignment on 16 byte boundary
	 * Clear initial stack frame
	 */
#if 0
	addr_sp -= 16;
	addr_sp &= ~0xF;
	s = (ulong *)addr_sp;
	*s-- = 0;
	*s-- = 0;
	addr_sp = (ulong)s;
#endif
	debug("Stack Pointer at: %08x\n",
			CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_INIT_SP_OFFSET);

	/*
	 * Save local variables to board info struct
	 */
	bd->bi_memstart	= CONFIG_SYS_SDRAM_BASE;	/* start of DRAM */
	bd->bi_memsize	= gd->ram_size;		/* size of DRAM in bytes */
	bd->bi_baudrate	= gd->baudrate;		/* Console Baudrate */

	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */

	serial_initialize();

	debug("Now running bottom half, api_addr: %lx\n", api_addr);

	gd->reloc_off = 0;

	monitor_flash_len = image_copy_end() - CONFIG_SYS_MONITOR_BASE;
	/* debug("image_copy_end: %08lx, monitor_flash_len: %08lx\n",
			image_copy_end(), monitor_flash_len); */

	mem_malloc_init(addr_malloc, misc_param.malloc_len);

//	run_initcall_level(init_sequence_r_stage0, (gd_t *)gd);
//	run_initcall_level(init_sequence_r_stage1, (gd_t *)gd);
	run_initcall_level(init_sequence_r_stage2, (gd_t *)gd);
	run_initcall_level(init_sequence_r_stage3, (gd_t *)gd);

	/* Initialize from environment */
	load_addr = getenv_ulong("loadaddr", 16, load_addr);
	debug("load_addr: %08lx\n", load_addr);

#ifndef CONFIG_JZ47XX_SLPT
	gd->have_console = 1;
	/* main_loop() can return to retry autoboot, if so just run it again. */
	for (;;)
		main_loop();
#else
	slpt_initcall_onetime();
#endif

#ifdef CONFIG_SLPT_DEBUG
	gd->have_console = 1;
#endif
	return 0;
	/* NOTREACHED - no way out of command loop except booting */
}