示例#1
0
void main(void)
{
	struct mem_timings *mem;
	void *entry;
	int is_resume = (get_wakeup_state() != IS_NOT_WAKEUP);

	/* Clock must be initialized before console_init, otherwise you may need
	 * to re-initialize serial console drivers again. */
	mem = setup_clock();

	console_init();

	setup_power(is_resume);
	setup_memory(mem, is_resume);

	if (is_resume) {
		wakeup();
	}

	setup_storage();
	setup_gpio();
	setup_graphics();

	/* Set SPI (primary CBFS media) clock to 50MHz and configure pinmux. */
	exynos_pinmux_spi1();
	clock_set_rate(PERIPH_ID_SPI1, 50000000);

	cbmem_initialize_empty();

	entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/ramstage");
	stage_exit(entry);
}
示例#2
0
void romstage_init(void)
{
	void *entry;	
#if CONFIG_COLLECT_TIMESTAMPS
	uint64_t start_romstage_time;
	uint64_t before_dram_time;
	uint64_t after_dram_time;
	uint64_t base_time = timestamp_get();
	start_romstage_time = timestamp_get();
#endif
	rkclk_set_pll();
	console_init();
#if CONFIG_COLLECT_TIMESTAMPS
	before_dram_time = timestamp_get();
#endif
	dram_main();
#if CONFIG_COLLECT_TIMESTAMPS
	after_dram_time = timestamp_get();
#endif
	udelay(100);
	cbmem_initialize_empty();
#if CONFIG_COLLECT_TIMESTAMPS
	timestamp_init(base_time);
	timestamp_add(TS_START_ROMSTAGE, start_romstage_time );
	timestamp_add(TS_BEFORE_INITRAM, before_dram_time );
	timestamp_add(TS_AFTER_INITRAM, after_dram_time );
#endif
	entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/coreboot_ram");
#if CONFIG_COLLECT_TIMESTAMPS
	timestamp_add_now(TS_END_ROMSTAGE);
#endif
	stage_exit(entry);
}
示例#3
0
void main(void)
{

	extern struct mem_timings mem_timings;
	void *entry;
	int is_resume = (get_wakeup_state() != IS_NOT_WAKEUP);

	/* Clock must be initialized before console_init, otherwise you may need
	 * to re-initialize serial console drivers again. */
	system_clock_init();

	console_init();

	setup_power(is_resume);
	setup_memory(&mem_timings, is_resume);

	primitive_mem_test();

	if (is_resume) {
		wakeup();
	}

	setup_storage();
	setup_gpio();
	setup_ec();

	simple_spi_test();
	/* Set SPI (primary CBFS media) clock to 50MHz. */
	/* if this is uncommented SPI will not work correctly. */
	clock_set_rate(PERIPH_ID_SPI1, 50000000);
	simple_spi_test();
	entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/coreboot_ram");
	simple_spi_test();
	stage_exit(entry);
}
示例#4
0
void main(void)
{
	struct mem_timings *mem;
	struct arm_clk_ratios *arm_ratios;
	int ret;
	void *entry;

	clock_set_rate(PERIPH_ID_SPI1, 50000000); /* set spi clock to 50Mhz */

	/* Clock must be initialized before console_init, otherwise you may need
	 * to re-initialize serial console drivers again. */
	mem = get_mem_timings();
	arm_ratios = get_arm_clk_ratios();
	system_clock_init(mem, arm_ratios);

	console_init();
	/*
	 * FIXME: Do necessary I2C init so low-level PMIC code doesn't need to.
	 * Also, we should only call power_init() on cold boot.
	 */
	power_init();

	if (!mem) {
		printk(BIOS_CRIT, "Unable to auto-detect memory timings\n");
		while(1);
	}
	printk(BIOS_SPEW, "man: 0x%x type: 0x%x, div: 0x%x, mhz: 0x%x\n",
		mem->mem_manuf,
		mem->mem_type,
		mem->mpll_mdiv,
		mem->frequency_mhz);

	ret = ddr3_mem_ctrl_init(mem, DMC_INTERLEAVE_SIZE);
	if (ret) {
		printk(BIOS_ERR, "Memory controller init failed, err: %x\n",
		ret);
		while(1);
	}

	/* Set up MMU and caches */
	mmu_setup_by_mva(CONFIG_SYS_SDRAM_BASE, CONFIG_DRAM_SIZE_MB);

	initialize_s5p_mshc();

	graphics();

	entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, "fallback/coreboot_ram");
	printk(BIOS_INFO, "entry is 0x%p, leaving romstage.\n", entry);

	stage_exit(entry);
}
示例#5
0
void main(void)
{
	void *entry;

	console_init();
	exception_init();

	entry = vboot2_verify_firmware();

	if (entry != (void *)-1)
		stage_exit(entry);

	hlt();
}
示例#6
0
void main(void)
{
#if CONFIG_COLLECT_TIMESTAMPS
	uint64_t start_romstage_time;
	uint64_t before_dram_time;
	uint64_t after_dram_time;
	uint64_t base_time = timestamp_get();
	start_romstage_time = timestamp_get();
#endif

	console_init();
	configure_l2ctlr();
	tsadc_init();

	/* vdd_log 1200mv is enough for ddr run 666Mhz */
	regulate_vdd_log(1200);
#if CONFIG_COLLECT_TIMESTAMPS
	before_dram_time = timestamp_get();
#endif
	sdram_init(get_sdram_config());
#if CONFIG_COLLECT_TIMESTAMPS
	after_dram_time = timestamp_get();
#endif

	/* Now that DRAM is up, add mappings for it and DMA coherency buffer. */
	mmu_config_range((uintptr_t)_dram/MiB,
			 sdram_size_mb(), DCACHE_WRITEBACK);
	mmu_config_range((uintptr_t)_dma_coherent/MiB,
			 _dma_coherent_size/MiB, DCACHE_OFF);

	cbmem_initialize_empty();

#if CONFIG_COLLECT_TIMESTAMPS
	timestamp_init(base_time);
	timestamp_add(TS_START_ROMSTAGE, start_romstage_time);
	timestamp_add(TS_BEFORE_INITRAM, before_dram_time);
	timestamp_add(TS_AFTER_INITRAM, after_dram_time);
	timestamp_add_now(TS_END_ROMSTAGE);
#endif

#if IS_ENABLED(CONFIG_VBOOT_VERIFY_FIRMWARE)
	void *entry = vboot2_load_ramstage();
	if (entry != NULL)
		stage_exit(entry);
#endif

	run_ramstage();
}
示例#7
0
void main(void)
{
	const char *stage_name = "fallback/romstage";
	void *entry;

	bootblock_cpu_init();
	bootblock_mainboard_init();

	if (CONFIG_BOOTBLOCK_CONSOLE) {
		console_init();
		exception_init();
	}

	entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, stage_name);

	if (entry) stage_exit(entry);
	hlt();
}
void main(void)
{
	const char *stage_name = "fallback/romstage";
	void *entry;

	if (boot_cpu()) {
		bootblock_cpu_init();
		bootblock_mainboard_init();
	}

	console_init();
	printk(BIOS_INFO, "hello from bootblock\n");
	printk(BIOS_INFO, "bootblock main(): loading romstage\n");
	entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, stage_name);

	printk(BIOS_INFO, "bootblock main(): jumping to romstage\n");
	if (entry) stage_exit(entry);
	hlt();
}
示例#9
0
void main(void)
{
    const char *stage_name = "fallback/romstage";
    void *entry;
    uint32_t sctlr;

    /* Globally disable MMU, caches, and branch prediction (these should
     * be disabled by default on reset) */
    sctlr = read_sctlr();
    sctlr &= ~(SCTLR_M | SCTLR_C | SCTLR_Z | SCTLR_I);
    write_sctlr(sctlr);

    armv7_invalidate_caches();

    /*
     * Re-enable caches and branch prediction. MMU will be set up later.
     * Note: If booting from USB, we need to disable branch prediction
     * before copying from USB into RAM (FIXME: why?)
     */
    sctlr = read_sctlr();
    sctlr |= SCTLR_C | SCTLR_Z | SCTLR_I;
    write_sctlr(sctlr);

    if (boot_cpu()) {
        bootblock_cpu_init();
        bootblock_mainboard_init();
    }

    console_init();
    printk(BIOS_INFO, "hello from bootblock\n");
    printk(BIOS_INFO, "bootblock main(): loading romstage\n");
    entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA, stage_name);

    printk(BIOS_INFO, "bootblock main(): jumping to romstage\n");
    if (entry) stage_exit(entry);
    hlt();
}
示例#10
0
void jmp_to_elf_entry(void *entry, unsigned long buffer, unsigned long size)
{
    extern unsigned char _ram_seg, _eram_seg;
    unsigned long lb_start, lb_size;
    unsigned long adjust, adjusted_boot_notes;

    elf_boot_notes.hdr.b_checksum =
        compute_ip_checksum(&elf_boot_notes, sizeof(elf_boot_notes));

    lb_start = (unsigned long)&_ram_seg;
    lb_size = (unsigned long)(&_eram_seg - &_ram_seg);
    adjust = buffer +  size - lb_start;

    adjusted_boot_notes = (unsigned long)&elf_boot_notes;
    adjusted_boot_notes += adjust;

    printk(BIOS_SPEW, "entry    = 0x%08lx\n", (unsigned long)entry);
    printk(BIOS_SPEW, "lb_start = 0x%08lx\n", lb_start);
    printk(BIOS_SPEW, "lb_size  = 0x%08lx\n", lb_size);
    printk(BIOS_SPEW, "adjust   = 0x%08lx\n", adjust);
    printk(BIOS_SPEW, "buffer   = 0x%08lx\n", buffer);
    printk(BIOS_SPEW, "     elf_boot_notes = 0x%08lx\n", (unsigned long)&elf_boot_notes);
    printk(BIOS_SPEW, "adjusted_boot_notes = 0x%08lx\n", adjusted_boot_notes);

    stage_exit(entry);
#if 0
    /* FIXME: do we need any of this? */
    /* Jump to kernel */
    __asm__ __volatile__(
        "	cld	\n\t"
        /* Save the callee save registers... */
        "	pushl	%%esi\n\t"
        "	pushl	%%edi\n\t"
        "	pushl	%%ebx\n\t"
        /* Save the parameters I was passed */
        "	pushl	$0\n\t" /* 20 adjust */
        "	pushl	%0\n\t" /* 16 lb_start */
        "	pushl	%1\n\t" /* 12 buffer */
        "	pushl	%2\n\t" /*  8 lb_size */
        "	pushl	%3\n\t" /*  4 entry */
        "	pushl	%4\n\t" /*  0 elf_boot_notes */
        /* Compute the adjustment */
        "	xorl	%%eax, %%eax\n\t"
        "	subl	16(%%esp), %%eax\n\t"
        "	addl	12(%%esp), %%eax\n\t"
        "	addl	 8(%%esp), %%eax\n\t"
        "	movl	%%eax, 20(%%esp)\n\t"
        /* Place a copy of coreboot in its new location */
        /* Move ``longs'' the coreboot size is 4 byte aligned */
        "	movl	12(%%esp), %%edi\n\t"
        "	addl	 8(%%esp), %%edi\n\t"
        "	movl	16(%%esp), %%esi\n\t"
        "	movl	 8(%%esp), %%ecx\n\n"
        "	shrl	$2, %%ecx\n\t"
        "	rep	movsl\n\t"

        /* Adjust the stack pointer to point into the new coreboot image */
        "	addl	20(%%esp), %%esp\n\t"
        /* Adjust the instruction pointer to point into the new coreboot image */
        "	movl	$1f, %%eax\n\t"
        "	addl	20(%%esp), %%eax\n\t"
        "	jmp	*%%eax\n\t"
        "1:	\n\t"

        /* Copy the coreboot bounce buffer over coreboot */
        /* Move ``longs'' the coreboot size is 4 byte aligned */
        "	movl	16(%%esp), %%edi\n\t"
        "	movl	12(%%esp), %%esi\n\t"
        "	movl	 8(%%esp), %%ecx\n\t"
        "	shrl	$2, %%ecx\n\t"
        "	rep	movsl\n\t"

        /* Now jump to the loaded image */
        "	movl	%5, %%eax\n\t"
        "	movl	 0(%%esp), %%ebx\n\t"
        "	call	*4(%%esp)\n\t"

        /* The loaded image returned? */
        "	cli	\n\t"
        "	cld	\n\t"

        /* Copy the saved copy of coreboot where coreboot runs */
        /* Move ``longs'' the coreboot size is 4 byte aligned */
        "	movl	16(%%esp), %%edi\n\t"
        "	movl	12(%%esp), %%esi\n\t"
        "	addl	 8(%%esp), %%esi\n\t"
        "	movl	 8(%%esp), %%ecx\n\t"
        "	shrl	$2, %%ecx\n\t"
        "	rep	movsl\n\t"

        /* Adjust the stack pointer to point into the old coreboot image */
        "	subl	20(%%esp), %%esp\n\t"

        /* Adjust the instruction pointer to point into the old coreboot image */
        "	movl	$1f, %%eax\n\t"
        "	subl	20(%%esp), %%eax\n\t"
        "	jmp	*%%eax\n\t"
        "1:	\n\t"

        /* Drop the parameters I was passed */
        "	addl	$24, %%esp\n\t"

        /* Restore the callee save registers */
        "	popl	%%ebx\n\t"
        "	popl	%%edi\n\t"
        "	popl	%%esi\n\t"

        ::
        "ri" (lb_start), "ri" (buffer), "ri" (lb_size),
        "ri" (entry),
#if CONFIG_MULTIBOOT
        "ri"(mbi), "ri" (MB_MAGIC2)
#else
        "ri"(adjusted_boot_notes), "ri" (0x0E1FB007)
#endif
    );
#endif
}
示例#11
0
void arch_prog_run(struct prog *prog)
{
	stage_exit(prog_entry(prog));
}
示例#12
0
void jmp_to_elf_entry(void *entry, unsigned long buffer, unsigned long size)
{
	printk(BIOS_SPEW, "entry    = %p\n", entry);
	stage_exit(entry);
}