diff options
Diffstat (limited to 'common')
| -rw-r--r-- | common/cmd_bootm.c | 9 | ||||
| -rw-r--r-- | common/cmd_dfu.c | 19 | ||||
| -rw-r--r-- | common/cmd_gpt.c | 4 | ||||
| -rw-r--r-- | common/cmd_mmc.c | 4 | ||||
| -rw-r--r-- | common/cmd_mtdparts.c | 2 | ||||
| -rw-r--r-- | common/cmd_pxe.c | 20 | ||||
| -rw-r--r-- | common/cmd_sf.c | 13 | ||||
| -rw-r--r-- | common/cmd_usb_mass_storage.c | 1 | ||||
| -rw-r--r-- | common/image-fdt.c | 2 | ||||
| -rw-r--r-- | common/image-fit.c | 8 | ||||
| -rw-r--r-- | common/image.c | 8 | ||||
| -rw-r--r-- | common/spl/spl_mmc.c | 17 |
12 files changed, 59 insertions, 48 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index b07b0f48b..166b901d7 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -558,6 +558,7 @@ static ulong bootm_disable_interrupts(void) #ifdef CONFIG_NETCONSOLE /* Stop the ethernet stack if NetConsole could have left it up */ eth_halt(); + eth_unregister(eth_get_dev()); #endif #if defined(CONFIG_CMD_USB) @@ -799,8 +800,12 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return do_bootm_states(cmdtp, flag, argc, argv, BOOTM_STATE_START | BOOTM_STATE_FINDOS | BOOTM_STATE_FINDOTHER | - BOOTM_STATE_LOADOS | BOOTM_STATE_OS_PREP | - BOOTM_STATE_OS_FAKE_GO | BOOTM_STATE_OS_GO, &images, 1); + BOOTM_STATE_LOADOS | +#if defined(CONFIG_PPC) || defined(CONFIG_MIPS) + BOOTM_STATE_OS_CMDLINE | +#endif + BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO | + BOOTM_STATE_OS_GO, &images, 1); } int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd) diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c index 793c42212..7ce92cec8 100644 --- a/common/cmd_dfu.c +++ b/common/cmd_dfu.c @@ -9,34 +9,20 @@ */ #include <common.h> -#include <command.h> -#include <malloc.h> #include <dfu.h> -#include <asm/errno.h> #include <g_dnl.h> static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - const char *str_env; char *s = "dfu"; int ret, i = 0; - char *env_bkp; if (argc < 3) return CMD_RET_USAGE; - str_env = getenv("dfu_alt_info"); - if (str_env == NULL) { - printf("%s: \"dfu_alt_info\" env variable not defined!\n", - __func__); - return CMD_RET_FAILURE; - } - - env_bkp = strdup(str_env); - ret = dfu_config_entities(env_bkp, argv[1], - (int)simple_strtoul(argv[2], NULL, 10)); + ret = dfu_init_env_entities(argv[1], simple_strtoul(argv[2], NULL, 10)); if (ret) - return CMD_RET_FAILURE; + return ret; if (argc > 3 && strcmp(argv[3], "list") == 0) { dfu_show_entities(); @@ -67,7 +53,6 @@ exit: g_dnl_unregister(); done: dfu_free_entities(); - free(env_bkp); if (dfu_reset()) run_command("reset", 0); diff --git a/common/cmd_gpt.c b/common/cmd_gpt.c index 06767aa5e..a46f5cc34 100644 --- a/common/cmd_gpt.c +++ b/common/cmd_gpt.c @@ -161,7 +161,7 @@ static int set_gpt_info(block_dev_desc_t *dev_desc, /* allocate memory for partitions */ parts = calloc(sizeof(disk_partition_t), p_count); - /* retrive partions data from string */ + /* retrieve partitions data from string */ for (i = 0; i < p_count; i++) { tok = strsep(&s, ";"); @@ -316,7 +316,7 @@ static int do_gpt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt, "GUID Partition Table", - "<command> <interface> <dev> <partions_list>\n" + "<command> <interface> <dev> <partitions_list>\n" " - GUID partition table restoration\n" " Restore GPT information on a device connected\n" " to interface\n" diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 1cdeb443f..67a94a746 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -260,7 +260,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (!ret) mmc->part_num = part; - printf("switch to partions #%d, %s\n", + printf("switch to partitions #%d, %s\n", part, (!ret) ? "OK" : "ERROR"); } } @@ -421,7 +421,7 @@ U_BOOT_CMD( "mmc close <dev> <boot_partition>\n" " - Enable boot_part for booting and disable access to boot_part\n" "mmc bootpart <device num> <boot part size MB> <RPMB part size MB>\n" - " - change sizes of boot and RPMB partions of specified device\n" + " - change sizes of boot and RPMB partitions of specified device\n" #endif ); #endif /* !CONFIG_GENERIC_MMC */ diff --git a/common/cmd_mtdparts.c b/common/cmd_mtdparts.c index 3023479d1..38a6e6d07 100644 --- a/common/cmd_mtdparts.c +++ b/common/cmd_mtdparts.c @@ -420,7 +420,7 @@ static int part_validate(struct mtdids *id, struct part_info *part) } /** - * Delete selected partition from the partion list of the specified device. + * Delete selected partition from the partition list of the specified device. * * @param dev device to delete partition from * @param part partition to delete diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c index a2fb50ab9..c5f4a221b 100644 --- a/common/cmd_pxe.c +++ b/common/cmd_pxe.c @@ -572,7 +572,7 @@ static int label_localboot(struct pxe_label *label) * If the label specifies an 'append' line, its contents will overwrite that * of the 'bootargs' environment variable. */ -static int label_boot(struct pxe_label *label) +static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label) { char *bootm_argv[] = { "bootm", NULL, NULL, NULL, NULL }; char initrd_str[22]; @@ -684,11 +684,11 @@ static int label_boot(struct pxe_label *label) if (bootm_argv[3]) bootm_argc = 4; - do_bootm(NULL, 0, bootm_argc, bootm_argv); + do_bootm(cmdtp, 0, bootm_argc, bootm_argv); #ifdef CONFIG_CMD_BOOTZ /* Try booting a zImage if do_bootm returns */ - do_bootz(NULL, 0, bootm_argc, bootm_argv); + do_bootz(cmdtp, 0, bootm_argc, bootm_argv); #endif return 1; } @@ -1355,7 +1355,7 @@ static struct menu *pxe_menu_to_menu(struct pxe_menu *cfg) /* * Try to boot any labels we have yet to attempt to boot. */ -static void boot_unattempted_labels(struct pxe_menu *cfg) +static void boot_unattempted_labels(cmd_tbl_t *cmdtp, struct pxe_menu *cfg) { struct list_head *pos; struct pxe_label *label; @@ -1364,7 +1364,7 @@ static void boot_unattempted_labels(struct pxe_menu *cfg) label = list_entry(pos, struct pxe_label, list); if (!label->attempted) - label_boot(label); + label_boot(cmdtp, label); } } @@ -1380,7 +1380,7 @@ static void boot_unattempted_labels(struct pxe_menu *cfg) * If this function returns, there weren't any labels that successfully * booted, or the user interrupted the menu selection via ctrl+c. */ -static void handle_pxe_menu(struct pxe_menu *cfg) +static void handle_pxe_menu(cmd_tbl_t *cmdtp, struct pxe_menu *cfg) { void *choice; struct menu *m; @@ -1406,14 +1406,14 @@ static void handle_pxe_menu(struct pxe_menu *cfg) */ if (err == 1) { - err = label_boot(choice); + err = label_boot(cmdtp, choice); if (!err) return; } else if (err != -ENOENT) { return; } - boot_unattempted_labels(cfg); + boot_unattempted_labels(cmdtp, cfg); } /* @@ -1453,7 +1453,7 @@ do_pxe_boot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return 1; } - handle_pxe_menu(cfg); + handle_pxe_menu(cmdtp, cfg); destroy_pxe_menu(cfg); @@ -1559,7 +1559,7 @@ int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (prompt) cfg->prompt = 1; - handle_pxe_menu(cfg); + handle_pxe_menu(cmdtp, cfg); destroy_pxe_menu(cfg); diff --git a/common/cmd_sf.c b/common/cmd_sf.c index 4af0f0af2..3f60979ae 100644 --- a/common/cmd_sf.c +++ b/common/cmd_sf.c @@ -152,8 +152,10 @@ static const char *spi_flash_update_block(struct spi_flash *flash, u32 offset, { debug("offset=%#x, sector_size=%#x, len=%#zx\n", offset, flash->sector_size, len); - if (spi_flash_read(flash, offset, len, cmp_buf)) + /* Read the entire sector so to allow for rewriting */ + if (spi_flash_read(flash, offset, flash->sector_size, cmp_buf)) return "read"; + /* Compare only what is meaningful (len) */ if (memcmp(cmp_buf, buf, len) == 0) { debug("Skip region %x size %zx: no change\n", offset, len); @@ -163,8 +165,17 @@ static const char *spi_flash_update_block(struct spi_flash *flash, u32 offset, /* Erase the entire sector */ if (spi_flash_erase(flash, offset, flash->sector_size)) return "erase"; + /* Write the initial part of the block from the source */ if (spi_flash_write(flash, offset, len, buf)) return "write"; + /* If it's a partial sector, rewrite the existing part */ + if (len != flash->sector_size) { + /* Rewrite the original data to the end of the sector */ + if (spi_flash_write(flash, offset + len, + flash->sector_size - len, &cmp_buf[len])) + return "write"; + } + return NULL; } diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c index 33a471500..ccf719594 100644 --- a/common/cmd_usb_mass_storage.c +++ b/common/cmd_usb_mass_storage.c @@ -5,7 +5,6 @@ * SPDX-License-Identifier: GPL-2.0+ */ -#include <errno.h> #include <common.h> #include <command.h> #include <g_dnl.h> diff --git a/common/image-fdt.c b/common/image-fdt.c index 2e22cca54..6f9ce7d37 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -55,7 +55,7 @@ static const image_header_t *image_get_fdt(ulong fdt_addr) fdt_error("uImage is compressed"); return NULL; } - if (fdt_check_header((char *)image_get_data(fdt_hdr)) != 0) { + if (fdt_check_header((void *)image_get_data(fdt_hdr)) != 0) { fdt_error("uImage data is not a fdt"); return NULL; } diff --git a/common/image-fit.c b/common/image-fit.c index 199b4ed16..cf4b67e3e 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -58,7 +58,7 @@ static int fit_parse_spec(const char *spec, char sepc, ulong addr_curr, * @conf_name double pointer to a char, will hold pointer to a configuration * unit name * - * fit_parse_conf() expects configuration spec in the for of [<addr>]#<conf>, + * fit_parse_conf() expects configuration spec in the form of [<addr>]#<conf>, * where <addr> is a FIT image address that contains configuration * with a <conf> unit name. * @@ -84,7 +84,7 @@ int fit_parse_conf(const char *spec, ulong addr_curr, * subimage * @image_name: double pointer to a char, will hold pointer to a subimage name * - * fit_parse_subimage() expects subimage spec in the for of + * fit_parse_subimage() expects subimage spec in the form of * [<addr>]:<subimage>, where <addr> is a FIT image address that contains * subimage with a <subimg> unit name. * @@ -1331,7 +1331,7 @@ int fit_conf_find_compat(const void *fit, const void *fdt) * * When NULL is provided in second argument fit_conf_get_node() will search * for a default configuration node instead. Default configuration node unit - * name is retrived from FIT_DEFAULT_PROP property of the '/configurations' + * name is retrieved from FIT_DEFAULT_PROP property of the '/configurations' * node. * * returns: @@ -1596,7 +1596,7 @@ int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr, len = (ulong)size; /* verify that image data is a proper FDT blob */ - if (image_type == IH_TYPE_FLATDT && fdt_check_header((char *)buf)) { + if (image_type == IH_TYPE_FLATDT && fdt_check_header(buf)) { puts("Subimage data is not a FDT"); return -ENOEXEC; } diff --git a/common/image.c b/common/image.c index 2c88091e6..b0ae58ff3 100644 --- a/common/image.c +++ b/common/image.c @@ -652,17 +652,13 @@ int genimg_get_format(const void *img_addr) { ulong format = IMAGE_FORMAT_INVALID; const image_header_t *hdr; -#if defined(CONFIG_FIT) || defined(CONFIG_OF_LIBFDT) - char *fit_hdr; -#endif hdr = (const image_header_t *)img_addr; if (image_check_magic(hdr)) format = IMAGE_FORMAT_LEGACY; #if defined(CONFIG_FIT) || defined(CONFIG_OF_LIBFDT) else { - fit_hdr = (char *)img_addr; - if (fdt_check_header(fit_hdr) == 0) + if (fdt_check_header(img_addr) == 0) format = IMAGE_FORMAT_FIT; } #endif @@ -965,7 +961,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images, * @initrd_end: pointer to a ulong variable, will hold final init ramdisk * end address (after possible relocation) * - * boot_ramdisk_high() takes a relocation hint from "initrd_high" environement + * boot_ramdisk_high() takes a relocation hint from "initrd_high" environment * variable and if requested ramdisk data is moved to a specified location. * * Initrd_start and initrd_end are set to final (after relocation) ramdisk diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index f27b4c277..fc2f2260f 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -9,7 +9,6 @@ #include <common.h> #include <spl.h> #include <asm/u-boot.h> -#include <asm/utils.h> #include <mmc.h> #include <fat.h> #include <version.h> @@ -45,8 +44,10 @@ static int mmc_load_image_raw(struct mmc *mmc, unsigned long sector) (void *)spl_image.load_addr); end: +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT if (err == 0) printf("spl: mmc blk read err - %lu\n", err); +#endif return (err == 0); } @@ -58,7 +59,9 @@ static int mmc_load_image_raw_os(struct mmc *mmc) CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR, CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS, (void *)CONFIG_SYS_SPL_ARGS_ADDR)) { +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("mmc args blk read error\n"); +#endif return -1; } @@ -84,9 +87,11 @@ static int mmc_load_image_fat(struct mmc *mmc, const char *filename) err = file_fat_read(filename, (u8 *)spl_image.load_addr, 0); end: +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT if (err <= 0) printf("spl: error reading image %s, err - %d\n", filename, err); +#endif return (err <= 0); } @@ -99,8 +104,10 @@ static int mmc_load_image_fat_os(struct mmc *mmc) err = file_fat_read(CONFIG_SPL_FAT_LOAD_ARGS_NAME, (void *)CONFIG_SYS_SPL_ARGS_ADDR, 0); if (err <= 0) { +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("spl: error reading image %s, err - %d\n", CONFIG_SPL_FAT_LOAD_ARGS_NAME, err); +#endif return -1; } @@ -120,13 +127,17 @@ void spl_mmc_load_image(void) /* We register only one device. So, the dev id is always 0 */ mmc = find_mmc_device(0); if (!mmc) { +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT puts("spl: mmc device not found!!\n"); +#endif hang(); } err = mmc_init(mmc); if (err) { +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("spl: mmc init failed: err - %d\n", err); +#endif hang(); } @@ -145,7 +156,9 @@ void spl_mmc_load_image(void) err = fat_register_device(&mmc->block_dev, CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION); if (err) { +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT printf("spl: fat register err - %d\n", err); +#endif hang(); } @@ -155,7 +168,9 @@ void spl_mmc_load_image(void) err = mmc_load_image_fat(mmc, CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME); #endif } else { +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT puts("spl: wrong MMC boot mode\n"); +#endif hang(); } |