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>
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user