+// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2000-2011
- *
- * SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
+#include <bootstage.h>
#include <command.h>
+#include <cpu_func.h>
+#include <image.h>
+#include <log.h>
#include <part.h>
-#if defined(CONFIG_CMD_IDE) || defined(CONFIG_SCSI) || \
- defined(CONFIG_USB_STORAGE)
-int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
+int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc,
char *const argv[])
{
__maybe_unused int dev;
int part;
ulong addr = CONFIG_SYS_LOAD_ADDR;
ulong cnt;
- disk_partition_t info;
-#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
- image_header_t *hdr;
+ struct disk_partition info;
+#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
+ struct legacy_img_hdr *hdr;
#endif
struct blk_desc *dev_desc;
bootstage_mark(BOOTSTAGE_ID_IDE_ADDR);
if (argc > 1)
- addr = simple_strtoul(argv[1], NULL, 16);
+ addr = hextoul(argv[1], NULL);
bootstage_mark(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
bootstage_mark(BOOTSTAGE_ID_IDE_PART_READ);
switch (genimg_get_format((void *) addr)) {
-#if defined(CONFIG_IMAGE_FORMAT_LEGACY)
+#if defined(CONFIG_LEGACY_IMAGE_FORMAT)
case IMAGE_FORMAT_LEGACY:
- hdr = (image_header_t *) addr;
+ hdr = (struct legacy_img_hdr *)addr;
bootstage_mark(BOOTSTAGE_ID_IDE_FORMAT);
/* This cannot be done earlier,
* we need complete FIT image in RAM first */
if (genimg_get_format((void *) addr) == IMAGE_FORMAT_FIT) {
- if (!fit_check_format(fit_hdr)) {
+ if (fit_check_format(fit_hdr, IMAGE_SIZE_INVAL)) {
bootstage_error(BOOTSTAGE_ID_IDE_FIT_READ);
puts("** Bad FIT image format\n");
return 1;
}
bootstage_mark(BOOTSTAGE_ID_IDE_FIT_READ_OK);
- fit_print_contents(fit_hdr);
}
#endif
flush_cache(addr, (cnt+1)*info.blksz);
/* Loading ok, update default load address */
- load_addr = addr;
+ image_load_addr = addr;
return bootm_maybe_autostart(cmdtp, argv[0]);
}
-#endif