From 7a0d88076b9cd8ccc88d41383f92ac2494d4168e Mon Sep 17 00:00:00 2001 From: Nathan Barrett-Morrison Date: Wed, 2 Feb 2022 15:05:18 -0500 Subject: Add in the ability to load and boot an uncompressed kernel image during the Falcon Mode boot sequence. This is required for architectures which do not support compressed kernel images (i.e. ARM64). This is only used while not booting via FIT image. Signed-off-by: Nathan Barrett-Morrison Cc: Tom Rini Reviewed-by: Tom Rini --- common/spl/spl.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'common/spl') diff --git a/common/spl/spl.c b/common/spl/spl.c index 29e0898f03d..828f72f30b1 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -116,6 +116,11 @@ int __weak bootz_setup(ulong image, ulong *start, ulong *end) { return 1; } + +int __weak booti_setup(ulong image, ulong *relocated_addr, ulong *size, bool force_reloc) +{ + return 1; +} #endif /* Weak default function for arch/board-specific fixups to the spl_image_info */ @@ -391,6 +396,21 @@ int spl_parse_image_header(struct spl_image_info *spl_image, #endif #if CONFIG_IS_ENABLED(OS_BOOT) +#if defined(CMD_BOOTI) + ulong start, size; + + if (!booti_setup((ulong)header, &start, &size, 0)) { + spl_image->name = "Linux"; + spl_image->os = IH_OS_LINUX; + spl_image->load_addr = start; + spl_image->entry_point = start; + spl_image->size = size; + debug(SPL_TPL_PROMPT + "payload Image, load addr: 0x%lx size: %d\n", + spl_image->load_addr, spl_image->size); + return 0; + } +#elif defined(CMD_BOOTZ) ulong start, end; if (!bootz_setup((ulong)header, &start, &end)) { @@ -404,6 +424,7 @@ int spl_parse_image_header(struct spl_image_info *spl_image, spl_image->load_addr, spl_image->size); return 0; } +#endif #endif if (!spl_parse_board_header(spl_image, bootdev, (const void *)header, sizeof(*header))) -- cgit v1.2.3 From 77253c50ab5910bf72e1e868c86940c5a2bc7bb9 Mon Sep 17 00:00:00 2001 From: Stefan Herbrechtsmeier Date: Tue, 14 Jun 2022 16:12:00 +0200 Subject: spl: fit: Allocate buffers aligned to cache line size Allocate memory for buffers at a cache-line boundary to avoid misaligned buffer address for subsequent reads. This avoids an additional sector-based memory copy in the fat file system driver: FAT: Misaligned buffer address (...) Signed-off-by: Stefan Herbrechtsmeier --- common/spl/spl_fit.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'common/spl') diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index a35be529656..c1ed31e367c 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include @@ -429,7 +429,9 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, * depending on how the overlay is stored, so * don't fail yet if the allocation failed. */ - tmpbuffer = malloc(CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ); + size_t size = CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY_BUF_SZ; + + tmpbuffer = malloc_cache_aligned(size); if (!tmpbuffer) debug("%s: unable to allocate space for overlays\n", __func__); @@ -537,7 +539,7 @@ static void *spl_get_fit_load_buffer(size_t size) { void *buf; - buf = malloc(size); + buf = malloc_cache_aligned(size); if (!buf) { pr_err("Could not get FIT buffer of %lu bytes\n", (ulong)size); pr_err("\tcheck CONFIG_SYS_SPL_MALLOC_SIZE\n"); -- cgit v1.2.3