diff options
author | Tom Rini | 2024-01-29 14:49:25 -0500 |
---|---|---|
committer | Tom Rini | 2024-01-29 14:49:25 -0500 |
commit | 073f4f10b9941c7b3cec7db41c82ac00b811eaba (patch) | |
tree | d738f7aac345d7c1cfdd9a5d22c7211156d202ce /common | |
parent | 7af90646df59dd7a4e0809c67ded6df835fd4808 (diff) | |
parent | aaeb330cac116a1a41c97c8e7a8349b8aea914c2 (diff) |
Merge patch series "Move framebuffer reservation for SPL to RAM end"
Devarsh Thakkar <devarsht@ti.com> says:
Move video memory reservation for SPL at end of RAM so that it does
not interefere with reservations for next stage so that the next stage
need not have holes in between for passed regions and instead it can
maintain continuity in reservations.
Also catch the bloblist before starting reservations to avoid the same
problem.
While at it, also fill missing fields in video handoff struct before
passing it to next stage.
This is as per discussions at :
For moving SPL framebuffer reservation at end of RAM:
https://lore.kernel.org/all/CAPnjgZ3xSoe_G3yrqwuAvoiVjUfZ+YQgkOR0ZTVXGT9VK8TwJg@mail.gmail.com/
For filling missing video handoff fields :
https://lore.kernel.org/all/CAPnjgZ1Hs0rNf0JDirp6YPsOQ5=QqQSP9g9qRwLoOASUV8a4cw@mail.gmail.com/
Diffstat (limited to 'common')
-rw-r--r-- | common/board_f.c | 41 | ||||
-rw-r--r-- | common/spl/spl.c | 19 |
2 files changed, 55 insertions, 5 deletions
diff --git a/common/board_f.c b/common/board_f.c index d4d7d01f8f6..442b8349d08 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -403,17 +403,47 @@ __weak int arch_reserve_mmu(void) return 0; } -static int reserve_video(void) +static int reserve_video_from_videoblob(void) { if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() > PHASE_SPL) { struct video_handoff *ho; + int ret = 0; ho = bloblist_find(BLOBLISTT_U_BOOT_VIDEO, sizeof(*ho)); if (!ho) - return log_msg_ret("blf", -ENOENT); - video_reserve_from_bloblist(ho); - gd->relocaddr = ho->fb; - } else if (CONFIG_IS_ENABLED(VIDEO)) { + return log_msg_ret("Missing video bloblist", -ENOENT); + + ret = video_reserve_from_bloblist(ho); + if (ret) + return log_msg_ret("Invalid Video handoff info", ret); + + /* Sanity check fb from blob is before current relocaddr */ + if (likely(gd->relocaddr > (unsigned long)ho->fb)) + gd->relocaddr = ho->fb; + } + + return 0; +} + +/* + * Check if any bloblist received specifying reserved areas from previous stage and adjust + * gd->relocaddr accordingly, so that we start reserving after pre-reserved areas + * from previous stage. + * + * NOTE: + * IT is recommended that all bloblists from previous stage are reserved from ram_top + * as next stage will simply start reserving further regions after them. + */ +static int setup_relocaddr_from_bloblist(void) +{ + reserve_video_from_videoblob(); + + return 0; +} + +static int reserve_video(void) +{ + if (CONFIG_IS_ENABLED(VIDEO)) { ulong addr; int ret; @@ -923,6 +953,7 @@ static const init_fnc_t init_sequence_f[] = { reserve_pram, #endif reserve_round_4k, + setup_relocaddr_from_bloblist, arch_reserve_mmu, reserve_video, reserve_trace, diff --git a/common/spl/spl.c b/common/spl/spl.c index 3ce5bfeec8b..b65c439e7aa 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -42,6 +42,7 @@ #include <fdt_support.h> #include <bootcount.h> #include <wdt.h> +#include <video.h> DECLARE_GLOBAL_DATA_PTR; DECLARE_BINMAN_MAGIC_SYM; @@ -152,6 +153,24 @@ void spl_fixup_fdt(void *fdt_blob) #endif } +int spl_reserve_video_from_ram_top(void) +{ + if (CONFIG_IS_ENABLED(VIDEO)) { + ulong addr; + int ret; + + addr = gd->ram_top; + ret = video_reserve(&addr); + if (ret) + return ret; + debug("Reserving %luk for video at: %08lx\n", + ((unsigned long)gd->relocaddr - addr) >> 10, addr); + gd->relocaddr = addr; + } + + return 0; +} + ulong spl_get_image_pos(void) { if (!CONFIG_IS_ENABLED(BINMAN_UBOOT_SYMBOLS)) |