aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorSimon Glass2022-09-06 20:26:52 -0600
committerTom Rini2022-09-29 16:07:57 -0400
commitf3543e69442ca393e52df253d9c5d45bc189d471 (patch)
tree99423df56b15a01188099161332c6c8aed301972 /common
parentda79b2f25e5352a8e09b96ecef56df009f03c0b5 (diff)
treewide: Drop image_header_t typedef
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>
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl.c8
-rw-r--r--common/spl/spl_ext.c4
-rw-r--r--common/spl/spl_fat.c6
-rw-r--r--common/spl/spl_legacy.c8
-rw-r--r--common/spl/spl_mmc.c4
-rw-r--r--common/spl/spl_nand.c4
-rw-r--r--common/spl/spl_net.c2
-rw-r--r--common/spl/spl_nor.c8
-rw-r--r--common/spl/spl_onenand.c2
-rw-r--r--common/spl/spl_ram.c8
-rw-r--r--common/spl/spl_sata.c2
-rw-r--r--common/spl/spl_semihosting.c4
-rw-r--r--common/spl/spl_spi.c6
-rw-r--r--common/spl/spl_ubi.c4
-rw-r--r--common/spl/spl_xip.c2
-rw-r--r--common/spl/spl_ymodem.c14
-rw-r--r--common/splash_source.c6
17 files changed, 46 insertions, 46 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 1283f9ec372..752b5b247cb 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -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);
diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c
index ebd914c4926..f117c630bfe 100644
--- a/common/spl/spl_ext.c
+++ b/common/spl/spl_ext.c
@@ -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;
diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
index 5b270541fcc..f8a5b80a3bd 100644
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -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)
diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c
index ae8731c782a..b3624dfbb77 100644
--- a/common/spl/spl_legacy.c
+++ b/common/spl/spl_legacy.c
@@ -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;
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 23a395e63d4..e4135b20487 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -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;
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index 7b7579a2df1..a16738818c1 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -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));
diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
index a853e6aead4..b2c901b554b 100644
--- a/common/spl/spl_net.c
+++ b/common/spl/spl_net.c
@@ -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();
diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
index 7986e930d28..281c6136f54 100644
--- a/common/spl/spl_nor.c
+++ b/common/spl/spl_nor.c
@@ -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;
diff --git a/common/spl/spl_onenand.c b/common/spl/spl_onenand.c
index f80769a0277..53a8c6de89e 100644
--- a/common/spl/spl_onenand.c
+++ b/common/spl/spl_onenand.c
@@ -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");
diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c
index d64710878cf..2b1ac191523 100644
--- a/common/spl/spl_ram.c
+++ b/common/spl/spl_ram.c
@@ -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);
}
diff --git a/common/spl/spl_sata.c b/common/spl/spl_sata.c
index 6c36f2ca66f..9ae02730685 100644
--- a/common/spl/spl_sata.c
+++ b/common/spl/spl_sata.c
@@ -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;
diff --git a/common/spl/spl_semihosting.c b/common/spl/spl_semihosting.c
index df6aeb29512..5b5e842a11b 100644
--- a/common/spl/spl_semihosting.c
+++ b/common/spl/spl_semihosting.c
@@ -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;
diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index d959ad11458..da6742416ed 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -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;
diff --git a/common/spl/spl_ubi.c b/common/spl/spl_ubi.c
index bdf5cc4c383..fb804f02089 100644
--- a/common/spl/spl_ubi.c
+++ b/common/spl/spl_ubi.c
@@ -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;
diff --git a/common/spl/spl_xip.c b/common/spl/spl_xip.c
index e9a40b0ec79..1258d85e63d 100644
--- a/common/spl/spl_xip.c
+++ b/common/spl/spl_xip.c
@@ -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);
diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c
index fdd52610429..038b4438457 100644
--- a/common/spl/spl_ymodem.c
+++ b/common/spl/spl_ymodem.c
@@ -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,
diff --git a/common/splash_source.c b/common/splash_source.c
index 2c03cbdf928..87e55a54f8c 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -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;