diff options
author | Tom Rini <trini@konsulko.com> | 2023-08-15 10:39:41 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-08-15 10:39:41 -0400 |
commit | bdc682437a67b47a382edfa30f58f8271b8acfed (patch) | |
tree | a57e22d5bb8a7b789878f455397d9d76b6fdb170 /common/spl/spl_semihosting.c | |
parent | 51171cdd6dc9af8e74bbdb1f3e46c15187f7e979 (diff) | |
parent | aaf5b5923054efbf1244dc7fbae68d0bd2a03cf7 (diff) |
Merge branch '2023-08-14-assorted-general-updates' into next
- Assorted PCI-related fixes, add Apple Type-C PHY support, semihosting
updates, fix a FAT corner-case, update the help on the pxe cmd and
clean up the gpio uclass slightly.
Diffstat (limited to 'common/spl/spl_semihosting.c')
-rw-r--r-- | common/spl/spl_semihosting.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/common/spl/spl_semihosting.c b/common/spl/spl_semihosting.c index 5b5e842a11..f7dd289286 100644 --- a/common/spl/spl_semihosting.c +++ b/common/spl/spl_semihosting.c @@ -21,6 +21,23 @@ static int smh_read_full(long fd, void *memp, size_t len) return 0; } +static ulong smh_fit_read(struct spl_load_info *load, ulong file_offset, + ulong size, void *buf) +{ + long fd; + ulong ret; + + fd = smh_open(load->filename, MODE_READ | MODE_BINARY); + if (fd < 0) { + log_debug("could not open %s: %ld\n", load->filename, fd); + return 0; + } + ret = smh_read(fd, buf, size); + smh_close(fd); + + return ret; +} + static int spl_smh_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { @@ -49,6 +66,20 @@ static int spl_smh_load_image(struct spl_image_info *spl_image, goto out; } + if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) && + image_get_magic(header) == FDT_MAGIC) { + struct spl_load_info load; + + debug("Found FIT\n"); + load.read = smh_fit_read; + load.bl_len = 1; + load.filename = filename; + load.priv = NULL; + smh_close(fd); + + return spl_load_simple_fit(spl_image, &load, 0, header); + } + ret = spl_parse_image_header(spl_image, bootdev, header); if (ret) { log_debug("failed to parse image header: %d\n", ret); |