--- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -7,6 +7,8 @@ * Based vaguely on the Linux code */ +#define DEBUG + #include #include #include @@ -3105,11 +3107,14 @@ int mmc_init_device(int num) struct udevice *dev; struct mmc *m; int ret; - + debug("mmc_init_device: num: %d\n", num); if (uclass_get_device_by_seq(UCLASS_MMC, num, &dev)) { + debug("mmc_init_device: uclass_get_device_by_seq\n"); ret = uclass_get_device(UCLASS_MMC, num, &dev); - if (ret) + if (ret) { + debug("mmc_init_device: uclass_get_device ret : %d\n", ret); return ret; + } } m = mmc_get_mmc_dev(dev); --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -5,6 +5,9 @@ * * Aneesh V */ + +#define DEBUG + #include #include #include @@ -155,6 +158,7 @@ static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device) int err, mmc_dev; mmc_dev = spl_mmc_get_device_index(boot_device); + printf("spl: mmc get device index : %d\n", mmc_dev); if (mmc_dev < 0) return mmc_dev; @@ -305,6 +309,7 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, #endif #ifdef CONFIG_SPL_FS_FAT + debug("spl: spl_start_uboot ...\n"); if (!spl_start_uboot()) { err = spl_load_image_fat_os(spl_image, bootdev, mmc_get_blk_desc(mmc), partition); @@ -312,6 +317,7 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, return err; } #ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME + debug("spl: spl_load_image_fat (%s)...\n", filename); err = spl_load_image_fat(spl_image, bootdev, mmc_get_blk_desc(mmc), partition, filename); @@ -423,10 +429,13 @@ int spl_mmc_load(struct spl_image_info *spl_image, /* Perform peripheral init only once for an mmc device */ mmc_dev = spl_mmc_get_device_index(bootdev->boot_device); + printf("spl: mmc_dev: %d\n", mmc_dev); if (!mmc || spl_mmc_get_mmc_devnum(mmc) != mmc_dev) { err = spl_mmc_find_device(&mmc, bootdev->boot_device); - if (err) + if (err) { + printf("spl: mmc find device failed: %d\n", err); return err; + } err = mmc_init(mmc); if (err) { --- a/common/spl/spl_fat.c +++ b/common/spl/spl_fat.c @@ -8,6 +8,8 @@ * FAT Image Functions copied from spl_mmc.c */ +#define DEBUG + #include #include #include @@ -62,18 +64,22 @@ int spl_load_image_fat(struct spl_image_info *spl_image, int err; struct legacy_img_hdr *header; + debug("spl: spl_register_fat_device ...\n"); err = spl_register_fat_device(block_dev, partition); if (err) goto end; + debug("spl: spl_get_load_buffer ...\n"); header = spl_get_load_buffer(-sizeof(*header), sizeof(*header)); + debug("spl: file_fat_read ...\n"); err = file_fat_read(filename, header, sizeof(struct legacy_img_hdr)); if (err <= 0) goto end; if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) && image_get_magic(header) == FDT_MAGIC) { + debug("spl: Load FIT Full ... filename: %s\n", filename); err = file_fat_read(filename, (void *)CONFIG_SYS_LOAD_ADDR, 0); if (err <= 0) goto end; @@ -87,14 +93,16 @@ int spl_load_image_fat(struct spl_image_info *spl_image, image_get_magic(header) == FDT_MAGIC) { struct spl_load_info load; - debug("Found FIT\n"); + debug("spl: Found FIT - filename: %s\n", filename); load.read = spl_fit_read; load.bl_len = 1; load.filename = (void *)filename; load.priv = NULL; + debug("spl: spl_load_simple_fit ...\n"); return spl_load_simple_fit(spl_image, &load, 0, header); } else { + debug("spl_parse_image_header ...\n"); err = spl_parse_image_header(spl_image, bootdev, header); if (err) goto end; --- a/boot/image-fit-sig.c +++ b/boot/image-fit-sig.c @@ -3,6 +3,8 @@ * Copyright (c) 2013, Google Inc. */ +#define DEBUG + #ifdef USE_HOSTCC #include "mkimage.h" #include --- a/boot/image-fit.c +++ b/boot/image-fit.c @@ -8,6 +8,8 @@ * Wolfgang Denk, DENX Software Engineering, wd@denx.de. */ +#define DEBUG + #define LOG_CATEGORY LOGC_BOOT #ifdef USE_HOSTCC @@ -380,8 +382,8 @@ void fit_print_contents(const void *fit) const char *p; time_t timestamp; - if (!CONFIG_IS_ENABLED(FIT_PRINT)) - return; +// if (!CONFIG_IS_ENABLED(FIT_PRINT)) +// return; /* Indent string is defined in header image.h */ p = IMAGE_INDENT_STRING; @@ -485,8 +487,8 @@ void fit_image_print(const void *fit, int image_noffset, const char *p) int ndepth; int ret; - if (!CONFIG_IS_ENABLED(FIT_PRINT)) - return; +// if (!CONFIG_IS_ENABLED(FIT_PRINT)) +// return; /* Mandatory properties */ ret = fit_get_desc(fit, image_noffset, &desc); @@ -601,6 +603,7 @@ int fit_get_desc(const void *fit, int noffset, char **desc) *desc = (char *)fdt_getprop(fit, noffset, FIT_DESC_PROP, &len); if (*desc == NULL) { + printf("fit_get_desc error\n"); fit_get_debug(fit, noffset, FIT_DESC_PROP, len); return -1; } @@ -630,6 +633,7 @@ int fit_get_timestamp(const void *fit, int noffset, time_t *timestamp) data = fdt_getprop(fit, noffset, FIT_TIMESTAMP_PROP, &len); if (data == NULL) { + printf("fit_get_timestamp error\n"); fit_get_debug(fit, noffset, FIT_TIMESTAMP_PROP, len); return -1; } @@ -659,6 +663,7 @@ int fit_image_get_node(const void *fit, const char *image_uname) { int noffset, images_noffset; + printf("fit_image_get_node ... starts (image_uname: %s)\n", image_uname); images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH); if (images_noffset < 0) { debug("Can't find images parent node '%s' (%s)\n", @@ -699,9 +704,11 @@ int fit_image_get_os(const void *fit, int noffset, uint8_t *os) if (data == NULL) { fit_get_debug(fit, noffset, FIT_OS_PROP, len); *os = -1; + printf("fit_image_get_os - os = -1\n"); return -1; } + printf("fit_image_get_os - os:%d\n", *os); /* Translate OS name to id */ *os = genimg_get_os_id(data); return 0; @@ -729,6 +736,7 @@ int fit_image_get_arch(const void *fit, int noffset, uint8_t *arch) /* Get architecture name from property data */ data = fdt_getprop(fit, noffset, FIT_ARCH_PROP, &len); if (data == NULL) { + printf("fit_image_get_arch error\n"); fit_get_debug(fit, noffset, FIT_ARCH_PROP, len); *arch = -1; return -1; @@ -761,11 +769,13 @@ int fit_image_get_type(const void *fit, int noffset, uint8_t *type) /* Get image type name from property data */ data = fdt_getprop(fit, noffset, FIT_TYPE_PROP, &len); if (data == NULL) { + printf("fit_image_get_type error\n"); fit_get_debug(fit, noffset, FIT_TYPE_PROP, len); *type = -1; return -1; } + printf("fit_image_get_type: %d\n", *type); /* Translate image type name to id */ *type = genimg_get_type_id(data); return 0; @@ -793,6 +803,7 @@ int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp) /* Get compression name from property data */ data = fdt_getprop(fit, noffset, FIT_COMP_PROP, &len); if (data == NULL) { + printf("fit_image_get_comp error\n"); fit_get_debug(fit, noffset, FIT_COMP_PROP, len); return -1; } @@ -822,6 +833,7 @@ int fit_image_get_phase(const void *fit, int offset, enum image_phase_t *phasep) /* Get phase name from property data */ data = fdt_getprop(fit, offset, FIT_PHASE_PROP, &len); if (!data) { + printf("fit_image_get_phase error\n"); fit_get_debug(fit, offset, FIT_PHASE_PROP, len); *phasep = 0; return -ENOENT; @@ -845,6 +857,7 @@ static int fit_image_get_address(const void *fit, int noffset, char *name, cell = fdt_getprop(fit, noffset, name, &len); if (cell == NULL) { + printf("fit_image_get_address error\n"); fit_get_debug(fit, noffset, name, len); return -1; } @@ -927,6 +940,7 @@ int fit_image_get_data(const void *fit, int noffset, *data = fdt_getprop(fit, noffset, FIT_DATA_PROP, &len); if (*data == NULL) { + printf("fit_image_get_data error\n"); fit_get_debug(fit, noffset, FIT_DATA_PROP, len); *size = 0; return -1; @@ -1103,6 +1117,7 @@ int fit_image_hash_get_algo(const void *fit, int noffset, const char **algo) *algo = (const char *)fdt_getprop(fit, noffset, FIT_ALGO_PROP, &len); if (*algo == NULL) { + printf("fit_image_hash_get_algo error\n"); fit_get_debug(fit, noffset, FIT_ALGO_PROP, len); return -1; } @@ -1132,6 +1147,7 @@ int fit_image_hash_get_value(const void *fit, int noffset, uint8_t **value, *value = (uint8_t *)fdt_getprop(fit, noffset, FIT_VALUE_PROP, &len); if (*value == NULL) { + printf("fit_image_hash_get_value error\n"); fit_get_debug(fit, noffset, FIT_VALUE_PROP, len); *value_len = 0; return -1; @@ -1189,6 +1205,7 @@ int fit_image_cipher_get_algo(const void *fit, int noffset, char **algo) *algo = (char *)fdt_getprop(fit, noffset, FIT_ALGO_PROP, &len); if (!*algo) { + printf("fit_image_cipher_get_algo error\n"); fit_get_debug(fit, noffset, FIT_ALGO_PROP, len); return -1; } @@ -1540,7 +1557,7 @@ static int fit_image_uncipher(const void *fit, int image_noffset, int fit_image_check_os(const void *fit, int noffset, uint8_t os) { uint8_t image_os; - + printf("fit_image_check_os ... os: %d\n", os); if (fit_image_get_os(fit, noffset, &image_os)) return 0; return (os == image_os); @@ -1596,6 +1613,7 @@ int fit_image_check_type(const void *fit, int noffset, uint8_t type) { uint8_t image_type; + printf("fit_image_check_type ... type: %d\n", type); if (fit_image_get_type(fit, noffset, &image_type)) return 0; return (type == image_type); @@ -1829,6 +1847,7 @@ int fit_conf_get_node(const void *fit, const char *conf_uname) const char *s; char *conf_uname_copy = NULL; + debug("fit_conf_get_node ... starts\n"); confs_noffset = fdt_path_offset(fit, FIT_CONFS_PATH); if (confs_noffset < 0) { debug("Can't find configurations parent node '%s' (%s)\n", @@ -1848,6 +1867,7 @@ int fit_conf_get_node(const void *fit, const char *conf_uname) conf_uname = (char *)fdt_getprop(fit, confs_noffset, FIT_DEFAULT_PROP, &len); if (conf_uname == NULL) { + printf("fit_conf_get_node error\n"); fit_get_debug(fit, confs_noffset, FIT_DEFAULT_PROP, len); return len; @@ -1876,6 +1896,7 @@ int fit_conf_get_node(const void *fit, const char *conf_uname) conf_uname, fdt_strerror(noffset)); } + debug("fit_conf_get_node ... noffset: %d\n", noffset); free(conf_uname_copy); return noffset; @@ -1894,10 +1915,12 @@ int fit_conf_get_prop_node_index(const void *fit, int noffset, int len; /* get kernel image unit name from configuration kernel property */ + printf("attributes => noffset: %d - index: %d - prop_name: %s\n", noffset, index, prop_name); uname = fdt_stringlist_get(fit, noffset, prop_name, index, &len); if (uname == NULL) return len; + printf("ret uname: %s\n", uname); return fit_image_get_node(fit, uname); } @@ -1905,22 +1928,28 @@ int fit_conf_get_prop_node(const void *fit, int noffset, const char *prop_name, enum image_phase_t sel_phase) { int i, count; - - if (sel_phase == IH_PHASE_NONE) + printf("fit_conf_get_prop_node ... starts\n"); + if (sel_phase == IH_PHASE_NONE) { + printf("fit_conf_get_prop_node ... sel_phase: %d\n", sel_phase); return fit_conf_get_prop_node_index(fit, noffset, prop_name, 0); + } count = fit_conf_get_prop_node_count(fit, noffset, prop_name); - if (count < 0) + if (count < 0) { + printf("fit_conf_get_prop_node ... count: %d\n", count); return count; - + } + printf("fit_conf_get_prop_node - noffset: %d - count: %d - prop_name: %s\n", noffset, count, prop_name); /* check each image in the list */ for (i = 0; i < count; i++) { enum image_phase_t phase; int ret, node; + printf("fit_conf_get_prop_node_index ... starts\n"); node = fit_conf_get_prop_node_index(fit, noffset, prop_name, i); + printf("fit_conf_get_prop_node_index ... ends && fit_conf_get_phase ... starts\n"); ret = fit_image_get_phase(fit, node, &phase); - + printf("fit_image_get_phase ... ends && node: %d - ret: %d\n", node, ret); /* if the image is for any phase, let's use it */ if (ret == -ENOENT) return node; @@ -2071,6 +2100,7 @@ int fit_image_load(struct bootm_headers *images, ulong addr, const char *prop_name; int ret; + printf("fit_image_load (ph_type: %d - image_type: %d)...\n", ph_type, image_type); fit = map_sysmem(addr, 0); fit_uname = fit_unamep ? *fit_unamep : NULL; fit_uname_config = fit_uname_configp ? *fit_uname_configp : NULL; @@ -2104,6 +2134,7 @@ int fit_image_load(struct bootm_headers *images, ulong addr, } else { cfg_noffset = fit_conf_get_node(fit, fit_uname_config); } + printf("cfg_noffset : %d\n", cfg_noffset); if (cfg_noffset < 0) { puts("Could not find configuration node\n"); bootstage_error(bootstage_id + @@ -2130,13 +2161,16 @@ int fit_image_load(struct bootm_headers *images, ulong addr, bootstage_mark(BOOTSTAGE_ID_FIT_CONFIG); + printf("attributes => cfg_noffset: %d - prop_name: %s\n", cfg_noffset, prop_name); noffset = fit_conf_get_prop_node(fit, cfg_noffset, prop_name, image_ph_phase(ph_type)); + printf("attributes => noffset: %d\n", noffset); fit_uname = fit_get_name(fit, noffset, NULL); } if (noffset < 0) { printf("Could not find subimage node type '%s'\n", prop_name); bootstage_error(bootstage_id + BOOTSTAGE_SUB_SUBNODE); + fit_print_contents(fit); return -ENOENT; } @@ -2182,6 +2216,7 @@ int fit_image_load(struct bootm_headers *images, ulong addr, fit_image_check_os(fit, noffset, IH_OS_EFI) || fit_image_check_os(fit, noffset, IH_OS_VXWORKS); + printf("=> type_ok: %d - os_ok: %d\n", type_ok, os_ok); /* * If either of the checks fail, we should report an error, but * if the image type is coming from the "loadables" field, we --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -6,6 +6,8 @@ * Aneesh V */ +#define DEBUG + #include #include #include @@ -272,6 +274,8 @@ static int spl_load_fit_image(struct spl_image_info *spl_image, int idx, conf_noffset; int ret; + printf("spl_load_fit_image ... starts\n"); + #ifdef CONFIG_SPL_FIT_SIGNATURE images.verify = 1; #endif @@ -299,6 +303,7 @@ static int spl_load_fit_image(struct spl_image_info *spl_image, if (ret < 0) return ret; + printf("spl_load_fit_image ... continues\n"); spl_image->size = fw_len; spl_image->entry_point = fw_data; spl_image->load_addr = fw_data; @@ -373,6 +378,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image, const struct spl_boot_device *bootdev, const struct legacy_img_hdr *header) { + debug("spl_parse_image_header ...\n"); #if CONFIG_IS_ENABLED(LOAD_FIT_FULL) int ret = spl_load_fit_image(spl_image, header); @@ -679,6 +685,7 @@ static int spl_load_image(struct spl_image_info *spl_image, static int boot_from_devices(struct spl_image_info *spl_image, u32 spl_boot_list[], int count) { + debug("boot_from_devices ...\n"); struct spl_image_loader *drv = ll_entry_start(struct spl_image_loader, spl_image_loader); const int n_ents = @@ -687,6 +694,7 @@ static int boot_from_devices(struct spl_image_info *spl_image, int i; for (i = 0; i < count && spl_boot_list[i] != BOOT_DEVICE_NONE; i++) { + debug("spl_boot_list: %d\n", i); struct spl_image_loader *loader; int bootdev = spl_boot_list[i]; @@ -750,11 +758,13 @@ void board_init_r(gd_t *dummy1, ulong dummy2) debug(">>" SPL_TPL_PROMPT "board_init_r()\n"); + debug("boot_init_r\n"); spl_set_bd(); #if defined(CONFIG_SYS_SPL_MALLOC) mem_malloc_init(SYS_SPL_MALLOC_START, CONFIG_SYS_SPL_MALLOC_SIZE); gd->flags |= GD_FLG_FULL_MALLOC_INIT; + debug("boot_init_r: SYS_SPL_MALLOC\n"); #endif if (!(gd->flags & GD_FLG_SPL_INIT)) { if (spl_init()) @@ -885,6 +895,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2) gd->malloc_ptr / 1024); #endif bootstage_mark_name(get_bootstage_id(false), "end phase"); + debug("spl: scle1\n"); #ifdef CONFIG_BOOTSTAGE_STASH ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR, CONFIG_BOOTSTAGE_STASH_SIZE); @@ -892,8 +903,12 @@ void board_init_r(gd_t *dummy1, ulong dummy2) debug("Failed to stash bootstage: err=%d\n", ret); #endif + debug("spl: scle2\n"); spl_board_prepare_for_boot(); + debug("spl: scle3\n"); + debug("image entry point: 0x%lx\n", spl_image.entry_point); jump_to_image_no_args(&spl_image); + debug("spl: scle4\n"); } /*