]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
treewide: Drop image_header_t typedef
authorSimon Glass <sjg@chromium.org>
Wed, 7 Sep 2022 02:26:52 +0000 (20:26 -0600)
committerTom Rini <trini@konsulko.com>
Thu, 29 Sep 2022 20:07:57 +0000 (16:07 -0400)
This is not needed and we should avoid typedefs. Use the struct instead
and rename it to indicate that it really is a legacy struct.

Signed-off-by: Simon Glass <sjg@chromium.org>
55 files changed:
arch/arm/mach-aspeed/ast2600/spl.c
arch/arm/mach-imx/hab.c
arch/arm/mach-imx/spl_imx_romapi.c
arch/arm/mach-k3/sysfw-loader.c
arch/arm/mach-keystone/cmd_mon.c
arch/arm/mach-sunxi/spl_spi_sunxi.c
arch/mips/mach-jz47xx/jz4780/jz4780.c
arch/mips/mach-mtmips/mt7621/spl/spl.c
arch/mips/mach-mtmips/mt7621/tpl/tpl.c
arch/x86/lib/bootm.c
board/ti/ks2_evm/board.c
boot/boot_fit.c
boot/bootm.c
boot/bootm_os.c
boot/image-android.c
boot/image-board.c
boot/image-fdt.c
boot/image.c
cmd/bootm.c
cmd/disk.c
cmd/fpga.c
cmd/nand.c
cmd/source.c
cmd/ximg.c
common/spl/spl.c
common/spl/spl_ext.c
common/spl/spl_fat.c
common/spl/spl_legacy.c
common/spl/spl_mmc.c
common/spl/spl_nand.c
common/spl/spl_net.c
common/spl/spl_nor.c
common/spl/spl_onenand.c
common/spl/spl_ram.c
common/spl/spl_sata.c
common/spl/spl_semihosting.c
common/spl/spl_spi.c
common/spl/spl_ubi.c
common/spl/spl_xip.c
common/spl/spl_ymodem.c
common/splash_source.c
doc/uImage.FIT/source_file_format.txt
drivers/fpga/socfpga_arria10.c
drivers/usb/gadget/f_sdp.c
include/configs/uniphier.h
include/image.h
include/spl.h
include/tee/optee.h
test/image/spl_load.c
tools/binman/ftest.py
tools/default_image.c
tools/fit_image.c
tools/imx8mimage.c
tools/mkimage.c
tools/mtk_image.c

index 53c8a15bf9c8400cde3722eb7e5cc36b39756038..0952e73a45729e18f0aea24edf24cb7cba57cf42 100644 (file)
@@ -56,9 +56,9 @@ out:
        return BOOT_DEVICE_RAM;
 }
 
-struct image_header *spl_get_load_buffer(ssize_t offset, size_t size)
+struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size)
 {
-       return (struct image_header *)(CONFIG_SYS_LOAD_ADDR);
+       return (struct legacy_img_hdr *)(CONFIG_SYS_LOAD_ADDR);
 }
 
 #ifdef CONFIG_SPL_OS_BOOT
index 0d1a7766be8af04333c077669668344db41567eb..c6747b257c42b839a30b6c81e839f97e26edf8d3 100644 (file)
@@ -589,7 +589,7 @@ static ulong get_image_ivt_offset(ulong img_addr)
        switch (genimg_get_format(buf)) {
 #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
        case IMAGE_FORMAT_LEGACY:
-               return (image_get_image_size((image_header_t *)img_addr)
+               return (image_get_image_size((struct legacy_img_hdr *)img_addr)
                        + 0x1000 - 1)  & ~(0x1000 - 1);
 #endif
 #if CONFIG_IS_ENABLED(FIT)
index 07bf07beee74d3246fc4b4fe4144cf34919e8e1b..aa5d23a6fbee8c7ce4a0ec192126f18a49b2b572 100644 (file)
@@ -72,7 +72,7 @@ static int spl_romapi_load_image_seekable(struct spl_image_info *spl_image,
        int ret;
        u32 offset;
        u32 pagesize, size;
-       struct image_header *header;
+       struct legacy_img_hdr *header;
        u32 image_offset;
 
        ret = rom_api_query_boot_infor(QUERY_IVT_OFF, &offset);
@@ -84,14 +84,14 @@ static int spl_romapi_load_image_seekable(struct spl_image_info *spl_image,
                return -1;
        }
 
-       header = (struct image_header *)(CONFIG_SPL_IMX_ROMAPI_LOADADDR);
+       header = (struct legacy_img_hdr *)(CONFIG_SPL_IMX_ROMAPI_LOADADDR);
 
        printf("image offset 0x%x, pagesize 0x%x, ivt offset 0x%x\n",
               image_offset, pagesize, offset);
 
        offset = spl_romapi_get_uboot_base(image_offset, rom_bt_dev);
 
-       size = ALIGN(sizeof(struct image_header), pagesize);
+       size = ALIGN(sizeof(struct legacy_img_hdr), pagesize);
        ret = rom_api_download_image((u8 *)header, offset, size);
 
        if (ret != ROM_API_OKAY) {
index b3beeca9472edf18bcf2d7df8aeb1491704dbfc8..aea640b57007fd9532a5bf94c201ca57f5a4c650 100644 (file)
@@ -88,10 +88,10 @@ static void *sysfw_load_address;
  * Populate SPL hook to override the default load address used by the SPL
  * loader function with a custom address for SYSFW loading.
  */
-struct image_header *spl_get_load_buffer(ssize_t offset, size_t size)
+struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size)
 {
        if (sysfw_loaded)
-               return (struct image_header *)(CONFIG_SYS_TEXT_BASE + offset);
+               return (struct legacy_img_hdr *)(CONFIG_SYS_TEXT_BASE + offset);
        else if (sysfw_load_address)
                return sysfw_load_address;
        else
@@ -490,7 +490,7 @@ void k3_sysfw_loader(bool rom_loaded_sysfw,
        sysfw_loaded = true;
 
        /* Ensure the SYSFW image is in FIT format */
-       if (image_get_magic((const image_header_t *)sysfw_load_address) !=
+       if (image_get_magic((const struct legacy_img_hdr *)sysfw_load_address) !=
            FDT_MAGIC)
                panic("SYSFW image not in FIT format!\n");
 
index e26296b6da6492e496fcbb9cf6b5c6ff3efb23b7..4734e4c7143ba56ba7a4e85bef03ce037702893f 100644 (file)
@@ -17,7 +17,7 @@ static int do_mon_install(struct cmd_tbl *cmdtp, int flag, int argc,
 {
        u32 addr, dpsc_base = 0x1E80000, freq, load_addr, size;
        int     rcode = 0;
-       struct image_header *header;
+       struct legacy_img_hdr *header;
        u32 ecrypt_bm_addr = 0;
 
        if (argc < 2)
@@ -27,7 +27,7 @@ static int do_mon_install(struct cmd_tbl *cmdtp, int flag, int argc,
 
        addr = hextoul(argv[1], NULL);
 
-       header = (struct image_header *)addr;
+       header = (struct legacy_img_hdr *)addr;
 
        if (image_get_magic(header) != IH_MAGIC) {
                printf("## Please update monitor image\n");
@@ -36,7 +36,7 @@ static int do_mon_install(struct cmd_tbl *cmdtp, int flag, int argc,
 
        load_addr = image_get_load(header);
        size = image_get_data_size(header);
-       memcpy((void *)load_addr, (void *)(addr + sizeof(struct image_header)),
+       memcpy((void *)load_addr, (void *)(addr + sizeof(struct legacy_img_hdr)),
               size);
 
        if (argc >=  3)
index de9aa68c4ac2372fc852fbb0ac28ade031201992..925bf85f2d27a17a257c7d4cb1b4c21097ffcecc 100644 (file)
@@ -335,10 +335,10 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
                              struct spl_boot_device *bootdev)
 {
        int ret = 0;
-       struct image_header *header;
-       header = (struct image_header *)(CONFIG_SYS_TEXT_BASE);
+       struct legacy_img_hdr *header;
        uint32_t load_offset = sunxi_get_spl_size();
 
+       header = (struct legacy_img_hdr *)CONFIG_SYS_TEXT_BASE;
        load_offset = max_t(uint32_t, load_offset, CONFIG_SYS_SPI_U_BOOT_OFFS);
 
        spi0_init();
index a57ec7802bbfc2a23d35c9ddaa353ce22723f867..4c40bd86fd8077032e272105140f788b58c4bd3f 100644 (file)
@@ -30,7 +30,7 @@ void board_init_f(ulong dummy)
        typedef void __noreturn (*image_entry_noargs_t)(void);
        struct mmc *mmc;
        unsigned long count;
-       struct image_header *header;
+       struct legacy_img_hdr *header;
        int ret;
 
        /* Set global data pointer */
@@ -58,8 +58,8 @@ void board_init_f(ulong dummy)
        if (ret)
                hang();
 
-       header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
-                                        sizeof(struct image_header));
+       header = (struct legacy_img_hdr *)(CONFIG_SYS_TEXT_BASE -
+                                        sizeof(struct legacy_img_hdr));
 
        count = blk_dread(mmc_get_blk_desc(mmc),
                          CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR,
index 91eebc6c1fbd2c182d463af50ac6fb15ac19f588..aa5b267bb96908e2dd001e0f332976aa8cb01be9 100644 (file)
@@ -64,7 +64,7 @@ void board_boot_order(u32 *spl_boot_list)
 unsigned long spl_nor_get_uboot_base(void)
 {
        const struct tpl_info *tpli;
-       const image_header_t *hdr;
+       const struct legacy_img_hdr *hdr;
        u32 addr;
 
        addr = FLASH_MMAP_BASE + TPL_INFO_OFFSET;
@@ -72,7 +72,7 @@ unsigned long spl_nor_get_uboot_base(void)
 
        if (tpli->magic == TPL_INFO_MAGIC) {
                addr = FLASH_MMAP_BASE + tpli->size;
-               hdr = (const image_header_t *)KSEG1ADDR(addr);
+               hdr = (const struct legacy_img_hdr *)KSEG1ADDR(addr);
 
                if (image_get_magic(hdr) == IH_MAGIC) {
                        addr += sizeof(*hdr) + image_get_size(hdr);
index 2a828907a348b84cf612b89063472fe2a7ffc328..d77592da5febfa9f5efd2f0c02d4c5bec5ffb466 100644 (file)
@@ -116,7 +116,7 @@ static void mt7621_cache_init(void)
 
 void __noreturn tpl_main(void)
 {
-       const image_header_t *hdr = (const image_header_t *)__image_copy_end;
+       const struct legacy_img_hdr *hdr = (const struct legacy_img_hdr *)__image_copy_end;
        image_entry_noargs_t image_entry;
        u32 loadaddr, size;
        uintptr_t data;
@@ -132,7 +132,7 @@ void __noreturn tpl_main(void)
        image_entry = (image_entry_noargs_t)image_get_ep(hdr);
 
        /* Load TPL image to L2 cache */
-       data = (uintptr_t)__image_copy_end + sizeof(struct image_header);
+       data = (uintptr_t)__image_copy_end + sizeof(struct legacy_img_hdr);
        fill_lock_l2cache(data, loadaddr, size);
 
        /* Jump to SPL */
index 4fdf1b2365ab13656cdc8a262ef4f823ac166235..eafcddfa24b25a406c8e3a40f1d566dbe3c76af3 100644 (file)
@@ -72,7 +72,7 @@ int arch_fixup_memory_node(void *blob)
 static int boot_prep_linux(struct bootm_headers *images)
 {
        char *cmd_line_dest = NULL;
-       image_header_t *hdr;
+       struct legacy_img_hdr *hdr;
        int is_zimage = 0;
        void *data = NULL;
        size_t len;
index 0c5c2c9146fb91e5865d2b95b28173f6c33c49ec..5ba3aa35a9fad1fba7756d9f5ab5bc15c47556ee 100644 (file)
@@ -64,9 +64,9 @@ int dram_init(void)
        return 0;
 }
 
-struct image_header *spl_get_load_buffer(ssize_t offset, size_t size)
+struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size)
 {
-       return (struct image_header *)(CONFIG_SYS_TEXT_BASE);
+       return (struct legacy_img_hdr *)(CONFIG_SYS_TEXT_BASE);
 }
 
 int board_init(void)
index dfc2a3117d152efaebb8a744af0f2b140d090f37..4a493b368472a5bb6d2a2e282113c5afbea852ee 100644 (file)
@@ -57,14 +57,14 @@ static int fdt_offset(const void *fit)
 
 void *locate_dtb_in_fit(const void *fit)
 {
-       struct image_header *header;
+       struct legacy_img_hdr *header;
        int size;
        int ret;
 
        size = fdt_totalsize(fit);
        size = (size + 3) & ~3;
 
-       header = (struct image_header *)fit;
+       header = (struct legacy_img_hdr *)fit;
 
        if (image_get_magic(header) != FDT_MAGIC) {
                debug("No FIT image appended to U-boot\n");
index 2e41d783723049af7bdfbc37878f88efdf44a094..5b20b418dbae490739eed10ffd66e525890a0954 100644 (file)
@@ -825,9 +825,9 @@ err:
  *     pointer to a legacy image header if valid image was found
  *     otherwise return NULL
  */
-static image_header_t *image_get_kernel(ulong img_addr, int verify)
+static struct legacy_img_hdr *image_get_kernel(ulong img_addr, int verify)
 {
-       image_header_t *hdr = (image_header_t *)img_addr;
+       struct legacy_img_hdr *hdr = (struct legacy_img_hdr *)img_addr;
 
        if (!image_check_magic(hdr)) {
                puts("Bad Magic Number\n");
@@ -882,7 +882,7 @@ static const void *boot_get_kernel(struct cmd_tbl *cmdtp, int flag, int argc,
                                   ulong *os_data, ulong *os_len)
 {
 #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
-       image_header_t  *hdr;
+       struct legacy_img_hdr   *hdr;
 #endif
        ulong           img_addr;
        const void *buf;
@@ -940,7 +940,7 @@ static const void *boot_get_kernel(struct cmd_tbl *cmdtp, int flag, int argc,
                 * kernel decompression.
                 */
                memmove(&images->legacy_hdr_os_copy, hdr,
-                       sizeof(image_header_t));
+                       sizeof(struct legacy_img_hdr));
 
                /* save pointer to image header */
                images->legacy_hdr_os = hdr;
index 649f92a75bbd3fe082a80550bbebad67d45e2cac..99ff0e6c02d26b20b29c6f1fcee75aaa975216fe 100644 (file)
@@ -67,8 +67,9 @@ static void __maybe_unused fit_unsupported_reset(const char *msg)
 static int do_bootm_netbsd(int flag, int argc, char *const argv[],
                           struct bootm_headers *images)
 {
-       void (*loader)(struct bd_info *, image_header_t *, char *, char *);
-       image_header_t *os_hdr, *hdr;
+       void (*loader)(struct bd_info *bd, struct legacy_img_hdr *hdr,
+                      char *console, char *cmdline);
+       struct legacy_img_hdr *os_hdr, *hdr;
        ulong kernel_data, kernel_len;
        char *cmdline;
 
@@ -115,7 +116,7 @@ static int do_bootm_netbsd(int flag, int argc, char *const argv[],
                        cmdline = "";
        }
 
-       loader = (void (*)(struct bd_info *, image_header_t *, char *, char *))images->ep;
+       loader = (void (*)(struct bd_info *, struct legacy_img_hdr *, char *, char *))images->ep;
 
        printf("## Transferring control to NetBSD stage-2 loader (at address %08lx) ...\n",
               (ulong)loader);
index 1fbbbba1eb0e0707de9f4892b06fa4147913d40c..2628db374121cf96fd5c51f92329b54e2866912d 100644 (file)
@@ -63,7 +63,7 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
                             ulong *os_data, ulong *os_len)
 {
        u32 kernel_addr = android_image_get_kernel_addr(hdr);
-       const struct image_header *ihdr = (const struct image_header *)
+       const struct legacy_img_hdr *ihdr = (const struct legacy_img_hdr *)
                ((uintptr_t)hdr + hdr->page_size);
 
        /*
@@ -159,8 +159,8 @@ ulong android_image_get_kcomp(const struct andr_img_hdr *hdr)
 {
        const void *p = (void *)((uintptr_t)hdr + hdr->page_size);
 
-       if (image_get_magic((image_header_t *)p) == IH_MAGIC)
-               return image_get_comp((image_header_t *)p);
+       if (image_get_magic((struct legacy_img_hdr *)p) == IH_MAGIC)
+               return image_get_comp((struct legacy_img_hdr *)p);
        else if (get_unaligned_le32(p) == LZ4F_MAGIC)
                return IH_COMP_LZ4;
        else
index fe4455778a5d8985a4153c58a84917f5158eb33e..34d1e5f18befca3bcd52ba2be8fd68b1c918f79d 100644 (file)
@@ -40,10 +40,10 @@ DECLARE_GLOBAL_DATA_PTR;
  *     pointer to a ramdisk image header, if image was found and valid
  *     otherwise, return NULL
  */
-static const image_header_t *image_get_ramdisk(ulong rd_addr, u8 arch,
-                                              int verify)
+static const struct legacy_img_hdr *image_get_ramdisk(ulong rd_addr, u8 arch,
+                                                     int verify)
 {
-       const image_header_t *rd_hdr = (const image_header_t *)rd_addr;
+       const struct legacy_img_hdr *rd_hdr = (const struct legacy_img_hdr *)rd_addr;
 
        if (!image_check_magic(rd_hdr)) {
                puts("Bad Magic Number\n");
@@ -273,9 +273,9 @@ ulong genimg_get_kernel_addr(char * const img_addr)
 int genimg_get_format(const void *img_addr)
 {
        if (CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)) {
-               const image_header_t *hdr;
+               const struct legacy_img_hdr *hdr;
 
-               hdr = (const image_header_t *)img_addr;
+               hdr = (const struct legacy_img_hdr *)img_addr;
                if (image_check_magic(hdr))
                        return IMAGE_FORMAT_LEGACY;
        }
@@ -389,7 +389,7 @@ static int select_ramdisk(struct bootm_headers *images, const char *select, u8 a
        switch (genimg_get_format(buf)) {
        case IMAGE_FORMAT_LEGACY:
                if (CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)) {
-                       const image_header_t *rd_hdr;
+                       const struct legacy_img_hdr *rd_hdr;
 
                        printf("## Loading init Ramdisk from Legacy Image at %08lx ...\n",
                               rd_addr);
index 78417bd8898153735787ea381f8845411eb9ddcf..ca51796322ddd6c81b42fe13a3088a60ab8d4022 100644 (file)
@@ -37,9 +37,9 @@ static void fdt_error(const char *msg)
 }
 
 #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
-static const image_header_t *image_get_fdt(ulong fdt_addr)
+static const struct legacy_img_hdr *image_get_fdt(ulong fdt_addr)
 {
-       const image_header_t *fdt_hdr = map_sysmem(fdt_addr, 0);
+       const struct legacy_img_hdr *fdt_hdr = map_sysmem(fdt_addr, 0);
 
        image_print_contents(fdt_hdr);
 
@@ -358,7 +358,7 @@ static int select_fdt(struct bootm_headers *images, const char *select, u8 arch,
        switch (genimg_get_format(buf)) {
 #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
        case IMAGE_FORMAT_LEGACY: {
-                       const image_header_t *fdt_hdr;
+                       const struct legacy_img_hdr *fdt_hdr;
                        ulong load, load_end;
                        ulong image_start, image_data, image_end;
 
index a0d0cc2403d348329f6812908267c44aecab2080..9f95b3260a8071865e772adc0c47b749b6e57d00 100644 (file)
@@ -220,11 +220,11 @@ static const struct table_info table_info[IH_COUNT] = {
 /*****************************************************************************/
 /* Legacy format routines */
 /*****************************************************************************/
-int image_check_hcrc(const image_header_t *hdr)
+int image_check_hcrc(const struct legacy_img_hdr *hdr)
 {
        ulong hcrc;
        ulong len = image_get_header_size();
-       image_header_t header;
+       struct legacy_img_hdr header;
 
        /* Copy header so we can blank CRC field for re-calculation */
        memmove(&header, (char *)hdr, image_get_header_size());
@@ -235,7 +235,7 @@ int image_check_hcrc(const image_header_t *hdr)
        return (hcrc == image_get_hcrc(hdr));
 }
 
-int image_check_dcrc(const image_header_t *hdr)
+int image_check_dcrc(const struct legacy_img_hdr *hdr)
 {
        ulong data = image_get_data(hdr);
        ulong len = image_get_data_size(hdr);
@@ -257,7 +257,7 @@ int image_check_dcrc(const image_header_t *hdr)
  * returns:
  *     number of components
  */
-ulong image_multi_count(const image_header_t *hdr)
+ulong image_multi_count(const struct legacy_img_hdr *hdr)
 {
        ulong i, count = 0;
        uint32_t *size;
@@ -290,7 +290,7 @@ ulong image_multi_count(const image_header_t *hdr)
  *     data address and size of the component, if idx is valid
  *     0 in data and len, if idx is out of range
  */
-void image_multi_getimg(const image_header_t *hdr, ulong idx,
+void image_multi_getimg(const struct legacy_img_hdr *hdr, ulong idx,
                        ulong *data, ulong *len)
 {
        int i;
@@ -326,7 +326,7 @@ void image_multi_getimg(const image_header_t *hdr, ulong idx,
        }
 }
 
-static void image_print_type(const image_header_t *hdr)
+static void image_print_type(const struct legacy_img_hdr *hdr)
 {
        const char __maybe_unused *os, *arch, *type, *comp;
 
@@ -352,7 +352,7 @@ static void image_print_type(const image_header_t *hdr)
  */
 void image_print_contents(const void *ptr)
 {
-       const image_header_t *hdr = (const image_header_t *)ptr;
+       const struct legacy_img_hdr *hdr = (const struct legacy_img_hdr *)ptr;
        const char __maybe_unused *p;
 
        p = IMAGE_INDENT_STRING;
index 9fe8ce4a27cfca493874d3639ceacb619361d713..d764a27002d15de8d59b45597dab7682206b845d 100644 (file)
@@ -511,7 +511,7 @@ static int do_imls_nand(void)
                        continue;
 
                for (off = 0; off < mtd->size; off += mtd->erasesize) {
-                       const image_header_t *header;
+                       const struct legacy_img_hdr *header;
                        int ret;
 
                        if (nand_block_isbad(mtd, off))
@@ -529,7 +529,7 @@ static int do_imls_nand(void)
                        switch (genimg_get_format(buffer)) {
 #if defined(CONFIG_LEGACY_IMAGE_FORMAT)
                        case IMAGE_FORMAT_LEGACY:
-                               header = (const image_header_t *)buffer;
+                               header = (const struct legacy_img_hdr *)buffer;
 
                                len = image_get_image_size(header);
                                nand_imls_legacyimage(mtd, nand_dev, off, len);
index cb3b990ba3a567f0efa2b034ea2bf719400e0c4b..3d7bc2f60189d18f60242239a8019edcb2eebecd 100644 (file)
@@ -20,7 +20,7 @@ int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc,
        ulong cnt;
        struct disk_partition info;
 #if defined(CONFIG_LEGACY_IMAGE_FORMAT)
-       image_header_t *hdr;
+       struct legacy_img_hdr *hdr;
 #endif
        struct blk_desc *dev_desc;
 
@@ -68,7 +68,7 @@ int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc,
        switch (genimg_get_format((void *) addr)) {
 #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);
 
index 9cf7651d8c51e3d9cdd05ebc74416ac7d6c040d0..8c64e957db0fd5e5e3b5fa2be7e756c4714a5d6e 100644 (file)
@@ -288,7 +288,7 @@ static int do_fpga_loadmk(struct cmd_tbl *cmdtp, int flag, int argc,
 #if defined(CONFIG_LEGACY_IMAGE_FORMAT)
        case IMAGE_FORMAT_LEGACY:
        {
-               image_header_t *hdr = (image_header_t *)fpga_data;
+               struct legacy_img_hdr *hdr = (struct legacy_img_hdr *)fpga_data;
                ulong data;
                u8 comp;
 
index e730484d0b799920158fd4ec4966a07100131388..5bb43794e9014169df39b4a49b7c3a73b2b4921b 100644 (file)
@@ -975,7 +975,7 @@ static int nand_load_image(struct cmd_tbl *cmdtp, struct mtd_info *mtd,
        char *s;
        size_t cnt;
 #if defined(CONFIG_LEGACY_IMAGE_FORMAT)
-       image_header_t *hdr;
+       struct legacy_img_hdr *hdr;
 #endif
 #if defined(CONFIG_FIT)
        const void *fit_hdr = NULL;
@@ -1004,7 +1004,7 @@ static int nand_load_image(struct cmd_tbl *cmdtp, struct mtd_info *mtd,
        switch (genimg_get_format ((void *)addr)) {
 #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_NAND_TYPE);
                image_print_contents (hdr);
index 81e015b64efc50328e4c08eb660325537f0db096..698d9f86d9652f264c5e749ec616f25d9b90309d 100644 (file)
@@ -46,7 +46,7 @@ int image_source_script(ulong addr, const char *fit_uname)
 {
        ulong           len;
 #if defined(CONFIG_LEGACY_IMAGE_FORMAT)
-       const image_header_t *hdr;
+       const struct legacy_img_hdr *hdr;
 #endif
        u32             *data;
        int             verify;
index 63b200430c31b60b3539ab806e4084c859ce3fb9..1c40fd27a054e024313a7499ecf4529ec5209570 100644 (file)
@@ -42,7 +42,7 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
        int             part = 0;
 #if defined(CONFIG_LEGACY_IMAGE_FORMAT)
        ulong           count;
-       image_header_t  *hdr = NULL;
+       struct legacy_img_hdr   *hdr = NULL;
 #endif
 #if defined(CONFIG_FIT)
        const char      *uname = NULL;
@@ -78,7 +78,7 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
                printf("## Copying part %d from legacy image "
                        "at %08lx ...\n", part, addr);
 
-               hdr = (image_header_t *)addr;
+               hdr = (struct legacy_img_hdr *)addr;
                if (!image_check_magic(hdr)) {
                        printf("Bad Magic Number\n");
                        return 1;
index 1283f9ec372b7d7b15459ca30e2cf7317dd3a9c9..752b5b247cb8058f6956dacc1bb70548049a49fe 100644 (file)
@@ -227,7 +227,7 @@ __weak void spl_board_prepare_for_boot(void)
        /* Nothing to do! */
 }
 
-__weak struct image_header *spl_get_load_buffer(ssize_t offset, size_t size)
+__weak struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size)
 {
        return map_sysmem(CONFIG_SYS_TEXT_BASE + offset, 0);
 }
@@ -258,7 +258,7 @@ void spl_set_header_raw_uboot(struct spl_image_info *spl_image)
 #if CONFIG_IS_ENABLED(LOAD_FIT_FULL)
 /* Parse and load full fitImage in SPL */
 static int spl_load_fit_image(struct spl_image_info *spl_image,
-                             const struct image_header *header)
+                             const struct legacy_img_hdr *header)
 {
        struct bootm_headers images;
        const char *fit_uname_config = NULL;
@@ -359,7 +359,7 @@ __weak int spl_parse_board_header(struct spl_image_info *spl_image,
 }
 
 __weak int spl_parse_legacy_header(struct spl_image_info *spl_image,
-                                  const struct image_header *header)
+                                  const struct legacy_img_hdr *header)
 {
        /* LEGACY image not supported */
        debug("Legacy boot image support not enabled, proceeding to other boot methods\n");
@@ -368,7 +368,7 @@ __weak int spl_parse_legacy_header(struct spl_image_info *spl_image,
 
 int spl_parse_image_header(struct spl_image_info *spl_image,
                           const struct spl_boot_device *bootdev,
-                          const struct image_header *header)
+                          const struct legacy_img_hdr *header)
 {
 #if CONFIG_IS_ENABLED(LOAD_FIT_FULL)
        int ret = spl_load_fit_image(spl_image, header);
index ebd914c49267d3735a1210ad8248591b7798b4c4..f117c630bfe7188bfe40abcdd52a97dfffc2a89d 100644 (file)
@@ -15,7 +15,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image,
                       const char *filename)
 {
        s32 err;
-       struct image_header *header;
+       struct legacy_img_hdr *header;
        loff_t filelen, actlen;
        struct disk_partition part_info = {};
 
@@ -41,7 +41,7 @@ int spl_load_image_ext(struct spl_image_info *spl_image,
                puts("spl: ext4fs_open failed\n");
                goto end;
        }
-       err = ext4fs_read((char *)header, 0, sizeof(struct image_header), &actlen);
+       err = ext4fs_read((char *)header, 0, sizeof(struct legacy_img_hdr), &actlen);
        if (err < 0) {
                puts("spl: ext4fs_read failed\n");
                goto end;
index 5b270541fcc7f028d5387eebd80a2f90debd3b4c..f8a5b80a3bd2d16eda6c2e1ddf328fd974b041fa 100644 (file)
@@ -60,7 +60,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image,
                       const char *filename)
 {
        int err;
-       struct image_header *header;
+       struct legacy_img_hdr *header;
 
        err = spl_register_fat_device(block_dev, partition);
        if (err)
@@ -68,7 +68,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image,
 
        header = spl_get_load_buffer(-sizeof(*header), sizeof(*header));
 
-       err = file_fat_read(filename, header, sizeof(struct image_header));
+       err = file_fat_read(filename, header, sizeof(struct legacy_img_hdr));
        if (err <= 0)
                goto end;
 
@@ -78,7 +78,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image,
                if (err <= 0)
                        goto end;
                err = spl_parse_image_header(spl_image, bootdev,
-                               (struct image_header *)CONFIG_SYS_LOAD_ADDR);
+                               (struct legacy_img_hdr *)CONFIG_SYS_LOAD_ADDR);
                if (err == -EAGAIN)
                        return err;
                if (err == 0)
index ae8731c782a22110014aa0a6257ee50348bdd1b1..b3624dfbb773ae9c3279aec290e51ace25b2f665 100644 (file)
@@ -16,9 +16,9 @@
 #define LZMA_LEN       (1 << 20)
 
 int spl_parse_legacy_header(struct spl_image_info *spl_image,
-                           const struct image_header *header)
+                           const struct legacy_img_hdr *header)
 {
-       u32 header_size = sizeof(struct image_header);
+       u32 header_size = sizeof(struct legacy_img_hdr);
 
        /* check uImage header CRC */
        if (IS_ENABLED(CONFIG_SPL_LEGACY_IMAGE_CRC_CHECK) &&
@@ -67,7 +67,7 @@ int spl_parse_legacy_header(struct spl_image_info *spl_image,
  * following switch/case statement in spl_load_legacy_img() away due to
  * Dead Code Elimination.
  */
-static inline int spl_image_get_comp(const struct image_header *hdr)
+static inline int spl_image_get_comp(const struct legacy_img_hdr *hdr)
 {
        if (IS_ENABLED(CONFIG_SPL_LZMA))
                return image_get_comp(hdr);
@@ -81,7 +81,7 @@ int spl_load_legacy_img(struct spl_image_info *spl_image,
 {
        __maybe_unused SizeT lzma_len;
        __maybe_unused void *src;
-       struct image_header hdr;
+       struct legacy_img_hdr hdr;
        ulong dataptr;
        int ret;
 
index 23a395e63d4ef74d4a92655090a673c4a7150f4d..e4135b2048754fabca4d1406810958b2db18d499 100644 (file)
@@ -20,7 +20,7 @@
 static int mmc_load_legacy(struct spl_image_info *spl_image,
                           struct spl_boot_device *bootdev,
                           struct mmc *mmc,
-                          ulong sector, struct image_header *header)
+                          ulong sector, struct legacy_img_hdr *header)
 {
        u32 image_offset_sectors;
        u32 image_size_sectors;
@@ -83,7 +83,7 @@ int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
                              struct mmc *mmc, unsigned long sector)
 {
        unsigned long count;
-       struct image_header *header;
+       struct legacy_img_hdr *header;
        struct blk_desc *bd = mmc_get_blk_desc(mmc);
        int ret = 0;
 
index 7b7579a2df16d77beedf1bc10edcaee2e366e8c1..a16738818c1d0c94cdf092bcfb6170e25148c283 100644 (file)
@@ -78,7 +78,7 @@ struct mtd_info * __weak nand_get_mtd(void)
 
 static int spl_nand_load_element(struct spl_image_info *spl_image,
                                 struct spl_boot_device *bootdev,
-                                int offset, struct image_header *header)
+                                int offset, struct legacy_img_hdr *header)
 {
        struct mtd_info *mtd = nand_get_mtd();
        int bl_len = mtd ? mtd->writesize : 1;
@@ -133,7 +133,7 @@ static int spl_nand_load_image(struct spl_image_info *spl_image,
                               struct spl_boot_device *bootdev)
 {
        int err;
-       struct image_header *header;
+       struct legacy_img_hdr *header;
        int *src __attribute__((unused));
        int *dst __attribute__((unused));
 
index a853e6aead4036fbb8f80ebac93676def58fbb39..b2c901b554b81fa02cebd0f897af221782311700 100644 (file)
@@ -28,7 +28,7 @@ static ulong spl_net_load_read(struct spl_load_info *load, ulong sector,
 static int spl_net_load_image(struct spl_image_info *spl_image,
                              struct spl_boot_device *bootdev)
 {
-       struct image_header *header = (struct image_header *)image_load_addr;
+       struct legacy_img_hdr *header = (struct legacy_img_hdr *)image_load_addr;
        int rv;
 
        env_init();
index 7986e930d28b6343306cfd3a97e5d1df1b849f17..281c6136f54af9d1214dcfa1b932fa0eb0aec5ce 100644 (file)
@@ -26,7 +26,7 @@ unsigned long __weak spl_nor_get_uboot_base(void)
 static int spl_nor_load_image(struct spl_image_info *spl_image,
                              struct spl_boot_device *bootdev)
 {
-       __maybe_unused const struct image_header *header;
+       __maybe_unused const struct legacy_img_hdr *header;
        __maybe_unused struct spl_load_info load;
 
        /*
@@ -41,7 +41,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
                 * Load Linux from its location in NOR flash to its defined
                 * location in SDRAM
                 */
-               header = (const struct image_header *)CONFIG_SYS_OS_BASE;
+               header = (const struct legacy_img_hdr *)CONFIG_SYS_OS_BASE;
 #ifdef CONFIG_SPL_LOAD_FIT
                if (image_get_magic(header) == FDT_MAGIC) {
                        int ret;
@@ -72,7 +72,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
 
                        memcpy((void *)spl_image->load_addr,
                               (void *)(CONFIG_SYS_OS_BASE +
-                                       sizeof(struct image_header)),
+                                       sizeof(struct legacy_img_hdr)),
                               spl_image->size);
 #ifdef CONFIG_SYS_SPL_ARGS_ADDR
                        spl_image->arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
@@ -92,7 +92,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
         * defined location in SDRAM
         */
 #ifdef CONFIG_SPL_LOAD_FIT
-       header = (const struct image_header *)spl_nor_get_uboot_base();
+       header = (const struct legacy_img_hdr *)spl_nor_get_uboot_base();
        if (image_get_magic(header) == FDT_MAGIC) {
                debug("Found FIT format U-Boot\n");
                load.bl_len = 1;
index f80769a02770777968c96b16a76b5de9a8e178f6..53a8c6de89eb0f90bf26e7d0152b667e10e78c03 100644 (file)
@@ -18,7 +18,7 @@
 static int spl_onenand_load_image(struct spl_image_info *spl_image,
                                  struct spl_boot_device *bootdev)
 {
-       struct image_header *header;
+       struct legacy_img_hdr *header;
        int ret;
 
        debug("spl: onenand\n");
index d64710878cf25620f7c6350673e0e56c70dc8c5d..2b1ac191523a9bcd0010121c73c04dbcb124b5bc 100644 (file)
@@ -41,9 +41,9 @@ static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector,
 static int spl_ram_load_image(struct spl_image_info *spl_image,
                              struct spl_boot_device *bootdev)
 {
-       struct image_header *header;
+       struct legacy_img_hdr *header;
 
-       header = (struct image_header *)CONFIG_SPL_LOAD_FIT_ADDRESS;
+       header = (struct legacy_img_hdr *)CONFIG_SPL_LOAD_FIT_ADDRESS;
 
        if (CONFIG_IS_ENABLED(IMAGE_PRE_LOAD)) {
                unsigned long addr = (unsigned long)header;
@@ -53,7 +53,7 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
                        return ret;
 
                addr += image_load_offset;
-               header = (struct image_header *)addr;
+               header = (struct legacy_img_hdr *)addr;
        }
 
 #if CONFIG_IS_ENABLED(DFU)
@@ -87,7 +87,7 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
                        u_boot_pos = (ulong)spl_get_load_buffer(-sizeof(*header),
                                                                sizeof(*header));
                }
-               header = (struct image_header *)map_sysmem(u_boot_pos, 0);
+               header = (struct legacy_img_hdr *)map_sysmem(u_boot_pos, 0);
 
                spl_parse_image_header(spl_image, bootdev, header);
        }
index 6c36f2ca66f2fd71d04afbf75eac4a7ae72db282..9ae02730685aa0e4edf7db664b6f9589514c0786 100644 (file)
@@ -30,7 +30,7 @@ static int spl_sata_load_image_raw(struct spl_image_info *spl_image,
                struct spl_boot_device *bootdev,
                struct blk_desc *stor_dev, unsigned long sector)
 {
-       struct image_header *header;
+       struct legacy_img_hdr *header;
        unsigned long count;
        u32 image_size_sectors;
        u32 image_offset_sectors;
index df6aeb29512453b8553c3c4e638fa69dd537b469..5b5e842a11b1eb70169dd3b14d1b316bdbab170d 100644 (file)
@@ -27,7 +27,7 @@ static int spl_smh_load_image(struct spl_image_info *spl_image,
        const char *filename = CONFIG_SPL_FS_LOAD_PAYLOAD_NAME;
        int ret;
        long fd, len;
-       struct image_header *header =
+       struct legacy_img_hdr *header =
                spl_get_load_buffer(-sizeof(*header), sizeof(*header));
 
        fd = smh_open(filename, MODE_READ | MODE_BINARY);
@@ -43,7 +43,7 @@ static int spl_smh_load_image(struct spl_image_info *spl_image,
        }
        len = ret;
 
-       ret = smh_read_full(fd, header, sizeof(struct image_header));
+       ret = smh_read_full(fd, header, sizeof(struct legacy_img_hdr));
        if (ret) {
                log_debug("could not read image header: %d\n", ret);
                goto out;
index d959ad1145870d63168823f2461d63a048aeb8fc..da6742416ed9f7a8d5ce23b9c569c38946270c0a 100644 (file)
@@ -26,7 +26,7 @@
 static int spi_load_image_os(struct spl_image_info *spl_image,
                             struct spl_boot_device *bootdev,
                             struct spi_flash *flash,
-                            struct image_header *header)
+                            struct legacy_img_hdr *header)
 {
        int err;
 
@@ -92,7 +92,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
        int err = 0;
        unsigned int payload_offs;
        struct spi_flash *flash;
-       struct image_header *header;
+       struct legacy_img_hdr *header;
        unsigned int sf_bus = spl_spi_boot_bus();
        unsigned int sf_cs = spl_spi_boot_cs();
 
@@ -139,7 +139,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image,
                        if (err)
                                return err;
                        err = spl_parse_image_header(spl_image, bootdev,
-                                       (struct image_header *)CONFIG_SYS_LOAD_ADDR);
+                                       (struct legacy_img_hdr *)CONFIG_SYS_LOAD_ADDR);
                } else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
                           image_get_magic(header) == FDT_MAGIC) {
                        struct spl_load_info load;
index bdf5cc4c3833170545c7d2a132626c5662ff9f62..fb804f0208921b162e0116758099c19b9b0b75fb 100644 (file)
@@ -15,7 +15,7 @@
 int spl_ubi_load_image(struct spl_image_info *spl_image,
                       struct spl_boot_device *bootdev)
 {
-       struct image_header *header;
+       struct legacy_img_hdr *header;
        struct ubispl_info info;
        struct ubispl_load volumes[2];
        int ret = 1;
@@ -54,7 +54,7 @@ int spl_ubi_load_image(struct spl_image_info *spl_image,
 
                ret = ubispl_load_volumes(&info, volumes, 2);
                if (!ret) {
-                       header = (struct image_header *)volumes[0].load_addr;
+                       header = (struct legacy_img_hdr *)volumes[0].load_addr;
                        spl_parse_image_header(spl_image, bootdev, header);
                        puts("Linux loaded.\n");
                        goto out;
index e9a40b0ec7976d20dc113ba8f76300b0b3c57338..1258d85e63da199e458c59253d34b64ac861c6e3 100644 (file)
@@ -25,6 +25,6 @@ static int spl_xip(struct spl_image_info *spl_image,
        }
 #endif
        return(spl_parse_image_header(spl_image, bootdev,
-              (const struct image_header *)CONFIG_SYS_UBOOT_BASE));
+              (const struct legacy_img_hdr *)CONFIG_SYS_UBOOT_BASE));
 }
 SPL_LOAD_IMAGE_METHOD("XIP", 0, BOOT_DEVICE_XIP, spl_xip);
index fdd52610429f8ff597b22d650083eadfb3472a0e..038b44384571261667f6ab34cd8c84d03af21189 100644 (file)
@@ -96,7 +96,7 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image,
        int ret;
        connection_info_t info;
        char buf[BUF_SIZE];
-       struct image_header *ih = NULL;
+       struct legacy_img_hdr *ih = NULL;
        ulong addr = 0;
 
        info.mode = xyzModem_ymodem;
@@ -111,9 +111,9 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image,
                goto end_stream;
 
        if (IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL) &&
-           image_get_magic((struct image_header *)buf) == FDT_MAGIC) {
+           image_get_magic((struct legacy_img_hdr *)buf) == FDT_MAGIC) {
                addr = CONFIG_SYS_LOAD_ADDR;
-               ih = (struct image_header *)addr;
+               ih = (struct legacy_img_hdr *)addr;
 
                memcpy((void *)addr, buf, res);
                size += res;
@@ -129,7 +129,7 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image,
                if (ret)
                        return ret;
        } else if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
-           image_get_magic((struct image_header *)buf) == FDT_MAGIC) {
+           image_get_magic((struct legacy_img_hdr *)buf) == FDT_MAGIC) {
                struct spl_load_info load;
                struct ymodem_fit_info info;
 
@@ -147,7 +147,7 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image,
                while ((res = xyzModem_stream_read(buf, BUF_SIZE, &err)) > 0)
                        size += res;
        } else {
-               ih = (struct image_header *)buf;
+               ih = (struct legacy_img_hdr *)buf;
                ret = spl_parse_image_header(spl_image, bootdev, ih);
                if (ret)
                        goto end_stream;
@@ -158,7 +158,7 @@ int spl_ymodem_load_image(struct spl_image_info *spl_image,
 #endif
                        addr = spl_image->load_addr;
                memcpy((void *)addr, buf, res);
-               ih = (struct image_header *)addr;
+               ih = (struct legacy_img_hdr *)addr;
                size += res;
                addr += res;
 
@@ -177,7 +177,7 @@ end_stream:
 
 #ifdef CONFIG_SPL_GZIP
        if (!(IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
-             image_get_magic((struct image_header *)buf) == FDT_MAGIC) &&
+             image_get_magic((struct legacy_img_hdr *)buf) == FDT_MAGIC) &&
            (ih->ih_comp == IH_COMP_GZIP)) {
                if (gunzip((void *)(spl_image->load_addr + sizeof(*ih)),
                           CONFIG_SYS_BOOTM_LEN,
index 2c03cbdf928b30ba35f806a0f17239394542d029..87e55a54f8c6e7de4dea223017a0dbb0e6f6618e 100644 (file)
@@ -327,17 +327,17 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
        int external_splash_addr;
        int external_splash_size;
        bool is_splash_external = false;
-       struct image_header *img_header;
+       struct legacy_img_hdr *img_header;
        const u32 *fit_header;
        u32 fit_size;
-       const size_t header_size = sizeof(struct image_header);
+       const size_t header_size = sizeof(struct legacy_img_hdr);
 
        /* Read in image header */
        res = splash_storage_read_raw(location, bmp_load_addr, header_size);
        if (res < 0)
                return res;
 
-       img_header = (struct image_header *)bmp_load_addr;
+       img_header = (struct legacy_img_hdr *)bmp_load_addr;
        if (image_get_magic(img_header) != FDT_MAGIC) {
                printf("Could not find FDT magic\n");
                return -EINVAL;
index 68701118409d941e98ebcc77c26ec4e1e26972f8..0a03c942bda71a3b6178392679f7685713f0aafa 100644 (file)
@@ -23,7 +23,7 @@ in the system memory and passed to bootm as a arguments. Some of them may be
 missing: FDT is not present for legacy platforms, ramdisk is always optional.
 Additionally, old uImage format has been extended to support multi sub-images
 but the support is limited by simple format of the legacy uImage structure.
-Single binary header 'struct image_header' is not flexible enough to cover all
+Single binary header 'struct legacy_img_hdr' is not flexible enough to cover all
 possible scenarios.
 
 All those factors combined clearly show that there is a need for new, more
index e86e3b743171308dec3d4f6b04093a33dbcb9a79..3b785e67d0b2b5d1d2eaa0218645d74d7fdf269b 100644 (file)
@@ -555,14 +555,14 @@ static int first_loading_rbf_to_buffer(struct udevice *dev,
        /* Load image header into buffer */
        ret = request_firmware_into_buf(dev,
                                        fpga_loadfs->fpga_fsinfo->filename,
-                                       buffer_p, sizeof(struct image_header),
+                                       buffer_p, sizeof(struct legacy_img_hdr),
                                        0);
        if (ret < 0) {
                debug("FPGA: Failed to read image header from flash.\n");
                return -ENOENT;
        }
 
-       if (image_get_magic((struct image_header *)buffer_p) != FDT_MAGIC) {
+       if (image_get_magic((struct legacy_img_hdr *)buffer_p) != FDT_MAGIC) {
                debug("FPGA: No FDT magic was found.\n");
                return -EBADF;
        }
index 74548ab603bd9655a7a3bf754b30b47942ebd47c..af4b167e17a29fdaeabcf7835cd3753304d2baa5 100644 (file)
@@ -835,7 +835,7 @@ static int sdp_handle_in_ep(struct spl_image_info *spl_image,
 
                        printf("Found header at 0x%08x\n", sdp_func->jmp_address);
 
-                       image_header_t *header =
+                       struct legacy_img_hdr *header =
                                sdp_ptr(sdp_func->jmp_address);
 #ifdef CONFIG_SPL_LOAD_FIT
                        if (image_get_magic(header) == FDT_MAGIC) {
index 15ae0844c1a7ab86d5a2864da01bc2af8ddcf779..d9e95abcc121b198bf00e6e25034e42b7e0a6649 100644 (file)
 
 /* only for SPL */
 
-/* subtract sizeof(struct image_header) */
+/* subtract sizeof(struct legacy_img_hdr) */
 #define CONFIG_SYS_UBOOT_BASE                  (0x130000 - 0x40)
 
 #endif /* __CONFIG_UNIPHIER_H__ */
index b58550fd64452d691ca82e1ce8dc2a961841306a..eb2513c5b74b6da3e1146693a26ae7280990b11f 100644 (file)
@@ -263,7 +263,7 @@ enum {
  * Legacy format image header,
  * all data in network byte order (aka natural aka bigendian).
  */
-typedef struct image_header {
+struct legacy_img_hdr {
        uint32_t        ih_magic;       /* Image Header Magic Number    */
        uint32_t        ih_hcrc;        /* Image Header CRC Checksum    */
        uint32_t        ih_time;        /* Image Creation Timestamp     */
@@ -276,7 +276,7 @@ typedef struct image_header {
        uint8_t         ih_type;        /* Image Type                   */
        uint8_t         ih_comp;        /* Compression Type             */
        uint8_t         ih_name[IH_NMLEN];      /* Image Name           */
-} image_header_t;
+};
 
 struct image_info {
        ulong           start, end;             /* start/end of blob */
@@ -296,8 +296,8 @@ struct bootm_headers {
         * then boot_get_ramdisk() and get_fdt() will attempt to get
         * data from second and third component accordingly.
         */
-       image_header_t  *legacy_hdr_os;         /* image header pointer */
-       image_header_t  legacy_hdr_os_copy;     /* header copy */
+       struct legacy_img_hdr   *legacy_hdr_os;         /* image header pointer */
+       struct legacy_img_hdr   legacy_hdr_os_copy;     /* header copy */
        ulong           legacy_hdr_valid;
 
        /*
@@ -696,11 +696,11 @@ int boot_get_kbd(struct lmb *lmb, struct bd_info **kbd);
 /*******************************************************************/
 static inline uint32_t image_get_header_size(void)
 {
-       return (sizeof(image_header_t));
+       return sizeof(struct legacy_img_hdr);
 }
 
 #define image_get_hdr_l(f) \
-       static inline uint32_t image_get_##f(const image_header_t *hdr) \
+       static inline uint32_t image_get_##f(const struct legacy_img_hdr *hdr) \
        { \
                return uimage_to_cpu(hdr->ih_##f); \
        }
@@ -713,7 +713,7 @@ image_get_hdr_l(ep)         /* image_get_ep */
 image_get_hdr_l(dcrc)          /* image_get_dcrc */
 
 #define image_get_hdr_b(f) \
-       static inline uint8_t image_get_##f(const image_header_t *hdr) \
+       static inline uint8_t image_get_##f(const struct legacy_img_hdr *hdr) \
        { \
                return hdr->ih_##f; \
        }
@@ -722,12 +722,12 @@ image_get_hdr_b(arch)             /* image_get_arch */
 image_get_hdr_b(type)          /* image_get_type */
 image_get_hdr_b(comp)          /* image_get_comp */
 
-static inline char *image_get_name(const image_header_t *hdr)
+static inline char *image_get_name(const struct legacy_img_hdr *hdr)
 {
        return (char *)hdr->ih_name;
 }
 
-static inline uint32_t image_get_data_size(const image_header_t *hdr)
+static inline uint32_t image_get_data_size(const struct legacy_img_hdr *hdr)
 {
        return image_get_size(hdr);
 }
@@ -743,22 +743,23 @@ static inline uint32_t image_get_data_size(const image_header_t *hdr)
  * returns:
  *     image payload data start address
  */
-static inline ulong image_get_data(const image_header_t *hdr)
+static inline ulong image_get_data(const struct legacy_img_hdr *hdr)
 {
        return ((ulong)hdr + image_get_header_size());
 }
 
-static inline uint32_t image_get_image_size(const image_header_t *hdr)
+static inline uint32_t image_get_image_size(const struct legacy_img_hdr *hdr)
 {
        return (image_get_size(hdr) + image_get_header_size());
 }
-static inline ulong image_get_image_end(const image_header_t *hdr)
+
+static inline ulong image_get_image_end(const struct legacy_img_hdr *hdr)
 {
        return ((ulong)hdr + image_get_image_size(hdr));
 }
 
 #define image_set_hdr_l(f) \
-       static inline void image_set_##f(image_header_t *hdr, uint32_t val) \
+       static inline void image_set_##f(struct legacy_img_hdr *hdr, uint32_t val) \
        { \
                hdr->ih_##f = cpu_to_uimage(val); \
        }
@@ -771,7 +772,7 @@ image_set_hdr_l(ep)         /* image_set_ep */
 image_set_hdr_l(dcrc)          /* image_set_dcrc */
 
 #define image_set_hdr_b(f) \
-       static inline void image_set_##f(image_header_t *hdr, uint8_t val) \
+       static inline void image_set_##f(struct legacy_img_hdr *hdr, uint8_t val) \
        { \
                hdr->ih_##f = val; \
        }
@@ -780,13 +781,13 @@ image_set_hdr_b(arch)             /* image_set_arch */
 image_set_hdr_b(type)          /* image_set_type */
 image_set_hdr_b(comp)          /* image_set_comp */
 
-static inline void image_set_name(image_header_t *hdr, const char *name)
+static inline void image_set_name(struct legacy_img_hdr *hdr, const char *name)
 {
        strncpy(image_get_name(hdr), name, IH_NMLEN);
 }
 
-int image_check_hcrc(const image_header_t *hdr);
-int image_check_dcrc(const image_header_t *hdr);
+int image_check_hcrc(const struct legacy_img_hdr *hdr);
+int image_check_dcrc(const struct legacy_img_hdr *hdr);
 #ifndef USE_HOSTCC
 ulong env_get_bootm_low(void);
 phys_size_t env_get_bootm_size(void);
@@ -794,15 +795,17 @@ phys_size_t env_get_bootm_mapsize(void);
 #endif
 void memmove_wd(void *to, void *from, size_t len, ulong chunksz);
 
-static inline int image_check_magic(const image_header_t *hdr)
+static inline int image_check_magic(const struct legacy_img_hdr *hdr)
 {
        return (image_get_magic(hdr) == IH_MAGIC);
 }
-static inline int image_check_type(const image_header_t *hdr, uint8_t type)
+
+static inline int image_check_type(const struct legacy_img_hdr *hdr, uint8_t type)
 {
        return (image_get_type(hdr) == type);
 }
-static inline int image_check_arch(const image_header_t *hdr, uint8_t arch)
+
+static inline int image_check_arch(const struct legacy_img_hdr *hdr, uint8_t arch)
 {
        /* Let's assume that sandbox can load any architecture */
        if (!tools_build() && IS_ENABLED(CONFIG_SANDBOX))
@@ -810,19 +813,20 @@ static inline int image_check_arch(const image_header_t *hdr, uint8_t arch)
        return (image_get_arch(hdr) == arch) ||
                (image_get_arch(hdr) == IH_ARCH_ARM && arch == IH_ARCH_ARM64);
 }
-static inline int image_check_os(const image_header_t *hdr, uint8_t os)
+
+static inline int image_check_os(const struct legacy_img_hdr *hdr, uint8_t os)
 {
        return (image_get_os(hdr) == os);
 }
 
-ulong image_multi_count(const image_header_t *hdr);
-void image_multi_getimg(const image_header_t *hdr, ulong idx,
+ulong image_multi_count(const struct legacy_img_hdr *hdr);
+void image_multi_getimg(const struct legacy_img_hdr *hdr, ulong idx,
                        ulong *data, ulong *len);
 
 void image_print_contents(const void *hdr);
 
 #ifndef USE_HOSTCC
-static inline int image_check_target_arch(const image_header_t *hdr)
+static inline int image_check_target_arch(const struct legacy_img_hdr *hdr)
 {
 #ifndef IH_ARCH_DEFAULT
 # error "please define IH_ARCH_DEFAULT in your arch asm/u-boot.h"
index aac6648f94694a994bbdccd525f17d814947d01d..0fc3686bbcabb4df56f7402cb790f5d14dea60b5 100644 (file)
@@ -17,7 +17,7 @@
 #include <mmc.h>
 
 struct blk_desc;
-struct image_header;
+struct legacy_img_hdr;
 
 /* Value in r0 indicates we booted from U-Boot */
 #define UBOOT_NOT_LOADED_FROM_SPL      0x13578642
@@ -29,7 +29,7 @@ struct image_header;
 #define MMCSD_MODE_EMMCBOOT    3
 
 struct blk_desc;
-struct image_header;
+struct legacy_img_hdr;
 struct spl_boot_device;
 
 /*
@@ -476,7 +476,7 @@ void spl_set_header_raw_uboot(struct spl_image_info *spl_image);
  */
 int spl_parse_image_header(struct spl_image_info *spl_image,
                           const struct spl_boot_device *bootdev,
-                          const struct image_header *header);
+                          const struct legacy_img_hdr *header);
 
 void spl_board_prepare_for_linux(void);
 
@@ -865,7 +865,7 @@ void spl_perform_fixups(struct spl_image_info *spl_image);
  * Returns memory area which can be populated by partial image data,
  * ie. uImage or fitImage header.
  */
-struct image_header *spl_get_load_buffer(ssize_t offset, size_t size);
+struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size);
 
 void spl_save_restore_data(void);
 #endif
index 5412bc7386ec90f20f1b5dab1bb621673a5fa524..77729450bb6ba2c341cfd8b363d7ba796c5d5040 100644 (file)
@@ -30,7 +30,7 @@ struct optee_header {
 };
 
 static inline uint32_t
-optee_image_get_entry_point(const struct image_header *hdr)
+optee_image_get_entry_point(const struct legacy_img_hdr *hdr)
 {
        struct optee_header *optee_hdr = (struct optee_header *)(hdr + 1);
 
@@ -38,7 +38,7 @@ optee_image_get_entry_point(const struct image_header *hdr)
 }
 
 static inline uint32_t
-optee_image_get_load_addr(const struct image_header *hdr)
+optee_image_get_load_addr(const struct legacy_img_hdr *hdr)
 {
        return optee_image_get_entry_point(hdr) - sizeof(struct optee_header);
 }
index df389e26f902f8961055ae6be1053287c46d4823..4e27ff460ab4af6d5c4f686f7b753271cdb59cf9 100644 (file)
@@ -49,7 +49,7 @@ int board_fit_config_name_match(const char *name)
        return 0;
 }
 
-struct image_header *spl_get_load_buffer(ssize_t offset, size_t size)
+struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size)
 {
        return map_sysmem(0x100000, 0);
 }
@@ -57,7 +57,7 @@ struct image_header *spl_get_load_buffer(ssize_t offset, size_t size)
 static int spl_test_load(struct unit_test_state *uts)
 {
        struct spl_image_info image;
-       struct image_header *header;
+       struct legacy_img_hdr *header;
        struct text_ctx text_ctx;
        struct spl_load_info load;
        char fname[256];
index ecb35956031cbd0005182f0a4963244afc09f7da..261107b33542b3a33a4c3e26da434b84a08d7733 100644 (file)
@@ -5782,7 +5782,7 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
         # Check that the data appears in the file somewhere
         self.assertIn(U_BOOT_SPL_DATA, data)
 
-        # Get struct image_header -> ih_name
+        # Get struct legacy_img_hdr -> ih_name
         name = data[0x20:0x40]
 
         # Build the filename that we expect to be placed in there, by virtue of
@@ -5799,7 +5799,7 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
         # Check that the data appears in the file somewhere
         self.assertIn(U_BOOT_SPL_DATA, data)
 
-        # Get struct image_header -> ih_name
+        # Get struct legacy_img_hdr -> ih_name
         name = data[0x20:0x40]
 
         # Build the filename that we expect to be placed in there, by virtue of
index e164c0c27d1a757e32e0c877d2abbfed787f3ca4..4a067e65862efaf103387af0e22c06a0452ca879 100644 (file)
@@ -22,7 +22,7 @@
 #include <u-boot/crc.h>
 #include <imximage.h>
 
-static image_header_t header;
+static struct legacy_img_hdr header;
 
 static int image_check_image_types(uint8_t type)
 {
@@ -46,15 +46,15 @@ static int image_verify_header(unsigned char *ptr, int image_size,
        uint32_t len;
        const unsigned char *data;
        uint32_t checksum;
-       image_header_t header;
-       image_header_t *hdr = &header;
+       struct legacy_img_hdr header;
+       struct legacy_img_hdr *hdr = &header;
 
        /*
         * create copy of header so that we can blank out the
         * checksum field for checking - this can't be done
         * on the PROT_READ mapped data.
         */
-       memcpy(hdr, ptr, sizeof(image_header_t));
+       memcpy(hdr, ptr, sizeof(struct legacy_img_hdr));
 
        if (be32_to_cpu(hdr->ih_magic) != IH_MAGIC) {
                debug("%s: Bad Magic Number: \"%s\" is no valid image\n",
@@ -63,7 +63,7 @@ static int image_verify_header(unsigned char *ptr, int image_size,
        }
 
        data = (const unsigned char *)hdr;
-       len  = sizeof(image_header_t);
+       len  = sizeof(struct legacy_img_hdr);
 
        checksum = be32_to_cpu(hdr->ih_hcrc);
        hdr->ih_hcrc = cpu_to_be32(0);  /* clear for re-calculation */
@@ -74,8 +74,8 @@ static int image_verify_header(unsigned char *ptr, int image_size,
                return -FDT_ERR_BADSTATE;
        }
 
-       data = (const unsigned char *)ptr + sizeof(image_header_t);
-       len  = image_size - sizeof(image_header_t) ;
+       data = (const unsigned char *)ptr + sizeof(struct legacy_img_hdr);
+       len  = image_size - sizeof(struct legacy_img_hdr);
 
        checksum = be32_to_cpu(hdr->ih_dcrc);
        if (crc32(0, data, len) != checksum) {
@@ -94,13 +94,12 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd,
        uint32_t imagesize;
        uint32_t ep;
        uint32_t addr;
-
-       image_header_t * hdr = (image_header_t *)ptr;
+       struct legacy_img_hdr *hdr = (struct legacy_img_hdr *)ptr;
 
        checksum = crc32(0,
                        (const unsigned char *)(ptr +
-                               sizeof(image_header_t)),
-                       sbuf->st_size - sizeof(image_header_t));
+                               sizeof(struct legacy_img_hdr)),
+                       sbuf->st_size - sizeof(struct legacy_img_hdr));
 
        time = imagetool_get_source_date(params->cmdname, sbuf->st_mtime);
        ep = params->ep;
@@ -108,11 +107,11 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd,
 
        if (params->type == IH_TYPE_FIRMWARE_IVT)
                /* Add size of CSF minus IVT */
-               imagesize = sbuf->st_size - sizeof(image_header_t)
+               imagesize = sbuf->st_size - sizeof(struct legacy_img_hdr)
                            + 0x2060 - sizeof(flash_header_v2_t);
 
        else
-               imagesize = sbuf->st_size - sizeof(image_header_t);
+               imagesize = sbuf->st_size - sizeof(struct legacy_img_hdr);
 
        if (params->os == IH_OS_TEE) {
                addr = optee_image_get_load_addr(hdr);
@@ -134,14 +133,14 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd,
        image_set_name(hdr, params->imagename);
 
        checksum = crc32(0, (const unsigned char *)hdr,
-                               sizeof(image_header_t));
+                               sizeof(struct legacy_img_hdr));
 
        image_set_hcrc(hdr, checksum);
 }
 
 static int image_extract_subimage(void *ptr, struct image_tool_params *params)
 {
-       const image_header_t *hdr = (const image_header_t *)ptr;
+       const struct legacy_img_hdr *hdr = (const struct legacy_img_hdr *)ptr;
        ulong file_data;
        ulong file_len;
 
@@ -175,7 +174,7 @@ static int image_extract_subimage(void *ptr, struct image_tool_params *params)
 U_BOOT_IMAGE_TYPE(
        defimage,
        "Default Image support",
-       sizeof(image_header_t),
+       sizeof(struct legacy_img_hdr),
        (void *)&header,
        image_check_params,
        image_verify_header,
index 979f2411ee0e897138ff2d46d8f3befb5ab480da..923a9755b70993dfa6756b2464dbdf8a889fcad7 100644 (file)
@@ -22,7 +22,7 @@
 #include <version.h>
 #include <u-boot/crc.h>
 
-static image_header_t header;
+static struct legacy_img_hdr header;
 
 static int fit_add_file_data(struct image_tool_params *params, size_t size_inc,
                             const char *tmpfile)
@@ -915,7 +915,7 @@ static int fit_check_params(struct image_tool_params *params)
 U_BOOT_IMAGE_TYPE(
        fitimage,
        "FIT Image support",
-       sizeof(image_header_t),
+       sizeof(struct legacy_img_hdr),
        (void *)&header,
        fit_check_params,
        fit_verify_header,
index a4699decf921233df705720d60fc4efc243a545d..35d0a92bfdf028f96047e320349f0bc20cf38802 100644 (file)
@@ -318,7 +318,7 @@ err_mmap:
 static int generate_ivt_for_fit(int fd, int fit_offset, uint32_t ep,
                                uint32_t *fit_load_addr)
 {
-       image_header_t image_header;
+       struct legacy_img_hdr image_header;
        int ret;
 
        uint32_t fit_size, load_addr;
@@ -330,8 +330,8 @@ static int generate_ivt_for_fit(int fd, int fit_offset, uint32_t ep,
                exit(EXIT_FAILURE);
        }
 
-       if (read(fd, (char *)&image_header, sizeof(image_header_t)) !=
-           sizeof(image_header_t)) {
+       if (read(fd, (char *)&image_header, sizeof(struct legacy_img_hdr)) !=
+           sizeof(struct legacy_img_hdr)) {
                fprintf(stderr, "generate_ivt_for_fit read failed: %s\n",
                        strerror(errno));
                exit(EXIT_FAILURE);
@@ -600,7 +600,7 @@ void build_image(int ofd)
                        close(sld_fd);
 
                        file_off = sld_header_off;
-                       file_off += sbuf.st_size + sizeof(image_header_t);
+                       file_off += sbuf.st_size + sizeof(struct legacy_img_hdr);
                }
        }
 
index 597cb3a5cedd744bcb3b38199bf985b1dd221792..30c6df77081fd3c47e9ae863162f75eb4d6f6585 100644 (file)
@@ -845,7 +845,7 @@ copy_file (int ifd, const char *datafile, int pad)
        if (params.xflag) {
                unsigned char *p = NULL;
                /*
-                * XIP: do not append the image_header_t at the
+                * XIP: do not append the struct legacy_img_hdr at the
                 * beginning of the file, but consume the space
                 * reserved for it.
                 */
index 9b3136afa3b1f3262b1e30fe41157b6571359cea..5ef9334163deecd4ab9b43de3c2914d88f697a42 100644 (file)
@@ -427,10 +427,10 @@ static uint32_t crc32be_cal(const void *data, size_t length)
 
 static int mtk_image_verify_mt7621_header(const uint8_t *ptr, int print)
 {
-       const image_header_t *hdr = (const image_header_t *)ptr;
+       const struct legacy_img_hdr *hdr = (const struct legacy_img_hdr *)ptr;
        struct mt7621_nand_header *nhdr;
        uint32_t spl_size, crcval;
-       image_header_t header;
+       struct legacy_img_hdr header;
        int ret;
 
        spl_size = image_get_size(hdr);
@@ -490,7 +490,7 @@ static int mtk_image_verify_mt7621_header(const uint8_t *ptr, int print)
 static int mtk_image_verify_header(unsigned char *ptr, int image_size,
                                   struct image_tool_params *params)
 {
-       image_header_t *hdr = (image_header_t *)ptr;
+       struct legacy_img_hdr *hdr = (struct legacy_img_hdr *)ptr;
        union lk_hdr *lk = (union lk_hdr *)ptr;
 
        /* nothing to verify for LK image header */
@@ -512,7 +512,7 @@ static int mtk_image_verify_header(unsigned char *ptr, int image_size,
 
 static void mtk_image_print_header(const void *ptr)
 {
-       image_header_t *hdr = (image_header_t *)ptr;
+       struct legacy_img_hdr *hdr = (struct legacy_img_hdr *)ptr;
        union lk_hdr *lk = (union lk_hdr *)ptr;
 
        if (le32_to_cpu(lk->magic) == LK_PART_MAGIC) {
@@ -691,7 +691,7 @@ static void mtk_image_set_nand_header(void *ptr, off_t filesize,
 static void mtk_image_set_mt7621_header(void *ptr, off_t filesize,
                                        uint32_t loadaddr)
 {
-       image_header_t *hdr = (image_header_t *)ptr;
+       struct legacy_img_hdr *hdr = (struct legacy_img_hdr *)ptr;
        struct mt7621_stage1_header *shdr;
        struct mt7621_nand_header *nhdr;
        uint32_t datasize, crcval;