#include <cbfs.h> #include <cbmem.h> #include <console/console.h> #include <fallback.h> #include <halt.h> #include <lib.h> #include <program_loading.h> #include <romstage_handoff.h> #include <rmodule.h> #include <rules.h> #include <stage_cache.h> #include <symbols.h> #include <timestamp.h> /* Only can represent up to 1 byte less than size_t. */ const struct mem_region_device addrspace_32bit = MEM_REGION_DEV_INIT(0, ~0UL); void run_romstage(void) { struct prog romstage = PROG_INIT(ASSET_ROMSTAGE, CONFIG_CBFS_PREFIX "/romstage"); if (prog_locate(&romstage)) goto fail; timestamp_add_now(TS_START_COPYROM); if (cbfs_prog_stage_load(&romstage)) goto fail; timestamp_add_now(TS_END_COPYROM);
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include <boot_device.h> #include <console/console.h> #include <cbfs.h> #include <endian.h> #include <stdlib.h> /* The ROM is memory mapped just below 4GiB. Form a pointer for the base. */ #define rom_base ((void *)(uintptr_t)(0x100000000ULL-CONFIG_ROM_SIZE)) static const struct mem_region_device boot_dev = MEM_REGION_DEV_INIT(rom_base, CONFIG_ROM_SIZE); const struct region_device *boot_device_ro(void) { return &boot_dev.rdev; } int cbfs_boot_region_properties(struct cbfs_props *props) { struct cbfs_header header; int32_t offset; const struct region_device *bdev; bdev = boot_device_ro(); rdev_readat(bdev, &offset, CONFIG_ROM_SIZE - sizeof(offset),
if (!first_run) return 0; if (!irom_load_sdmmc(1, count, _cbfs_cache)) { printk(BIOS_EMERG, "Unable to load CBFS image from SDMMC!\n"); return -1; } printk(BIOS_DEBUG, "SDMMC read successful, CBFS image should now be" " at %p\n", _cbfs_cache); first_run = 0; #endif return 0; } static struct mem_region_device alternate_rdev = MEM_REGION_DEV_INIT(NULL, 0); const struct region_device *boot_device_ro(void) { if (*iram_secondary_base == SECONDARY_BASE_BOOT_USB) return &alternate_rdev.rdev; switch (exynos_power->om_stat & OM_STAT_MASK) { case OM_STAT_SDMMC: return &alternate_rdev.rdev; case OM_STAT_SPI: return exynos_spi_boot_device(); default: printk(BIOS_EMERG, "Exynos OM_STAT value 0x%x not supported!\n", exynos_power->om_stat); return NULL;
* may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include <boot_device.h> #include <cbfs.h> #include <string.h> #include <symbols.h> #include <console/console.h> /* Maps directly to qemu memory mapped space of 0x10000 up to rom size. */ static const struct mem_region_device gboot_dev = MEM_REGION_DEV_INIT((void *)0x10000, CONFIG_ROM_SIZE); const struct region_device *boot_device_ro(void) { return &gboot_dev.rdev; } static int emu_rom_open(struct cbfs_media *media) { return 0; } static void *emu_rom_map(struct cbfs_media *media, size_t offset, size_t count) { const struct region_device *boot_dev; void *ptr;