mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-25 06:46:00 +00:00
spl: Convert net to spl_load
This converts the net load method to use spl_load. As a result, it also adds support for LOAD_FIT_FULL and IMX images. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
11f834614e
commit
2e5476b5a7
3 changed files with 8 additions and 24 deletions
|
@ -11,8 +11,8 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <log.h>
|
#include <log.h>
|
||||||
#include <mapmem.h>
|
|
||||||
#include <spl.h>
|
#include <spl.h>
|
||||||
|
#include <spl_load.h>
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
#include <linux/libfdt.h>
|
#include <linux/libfdt.h>
|
||||||
|
|
||||||
|
@ -29,8 +29,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,
|
static int spl_net_load_image(struct spl_image_info *spl_image,
|
||||||
struct spl_boot_device *bootdev)
|
struct spl_boot_device *bootdev)
|
||||||
{
|
{
|
||||||
struct legacy_img_hdr *header = map_sysmem(image_load_addr,
|
struct spl_load_info load;
|
||||||
sizeof(*header));
|
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
env_init();
|
env_init();
|
||||||
|
@ -49,27 +48,9 @@ static int spl_net_load_image(struct spl_image_info *spl_image,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
|
|
||||||
image_get_magic(header) == FDT_MAGIC) {
|
|
||||||
struct spl_load_info load;
|
|
||||||
|
|
||||||
debug("Found FIT\n");
|
|
||||||
spl_set_bl_len(&load, 1);
|
spl_set_bl_len(&load, 1);
|
||||||
load.read = spl_net_load_read;
|
load.read = spl_net_load_read;
|
||||||
rv = spl_load_simple_fit(spl_image, &load, 0, header);
|
return spl_load(spl_image, bootdev, &load, 0, 0);
|
||||||
} else {
|
|
||||||
debug("Legacy image\n");
|
|
||||||
|
|
||||||
rv = spl_parse_image_header(spl_image, bootdev, header);
|
|
||||||
if (rv)
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
memcpy(map_sysmem(spl_image->load_addr, spl_image->size),
|
|
||||||
map_sysmem(image_load_addr, spl_image->size),
|
|
||||||
spl_image->size);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ static inline int _spl_load(struct spl_image_info *spl_image,
|
||||||
IS_ENABLED(CONFIG_SPL_FS_FAT) + \
|
IS_ENABLED(CONFIG_SPL_FS_FAT) + \
|
||||||
IS_ENABLED(CONFIG_SPL_SYS_MMCSD_RAW_MODE) + \
|
IS_ENABLED(CONFIG_SPL_SYS_MMCSD_RAW_MODE) + \
|
||||||
(IS_ENABLED(CONFIG_SPL_NAND_SUPPORT) && !IS_ENABLED(CONFIG_SPL_UBI)) + \
|
(IS_ENABLED(CONFIG_SPL_NAND_SUPPORT) && !IS_ENABLED(CONFIG_SPL_UBI)) + \
|
||||||
|
IS_ENABLED(CONFIG_SPL_NET) + \
|
||||||
0
|
0
|
||||||
|
|
||||||
#if SPL_LOAD_USERS > 1
|
#if SPL_LOAD_USERS > 1
|
||||||
|
|
|
@ -248,5 +248,7 @@ static int spl_test_net(struct unit_test_state *uts, const char *test_name,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
SPL_IMG_TEST(spl_test_net, LEGACY, DM_FLAGS);
|
SPL_IMG_TEST(spl_test_net, LEGACY, DM_FLAGS);
|
||||||
|
SPL_IMG_TEST(spl_test_net, LEGACY_LZMA, DM_FLAGS);
|
||||||
|
SPL_IMG_TEST(spl_test_net, IMX8, DM_FLAGS);
|
||||||
SPL_IMG_TEST(spl_test_net, FIT_INTERNAL, DM_FLAGS);
|
SPL_IMG_TEST(spl_test_net, FIT_INTERNAL, DM_FLAGS);
|
||||||
SPL_IMG_TEST(spl_test_net, FIT_EXTERNAL, DM_FLAGS);
|
SPL_IMG_TEST(spl_test_net, FIT_EXTERNAL, DM_FLAGS);
|
||||||
|
|
Loading…
Add table
Reference in a new issue