]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
video: Skip framebuffer reservation if already reserved
authorDevarsh Thakkar <devarsht@ti.com>
Tue, 5 Dec 2023 15:55:20 +0000 (21:25 +0530)
committerTom Rini <trini@konsulko.com>
Mon, 29 Jan 2024 19:49:17 +0000 (14:49 -0500)
Skip framebufer reservation if it was already reserved from previous
stage and whose information was passed using a bloblist.

Return error in case framebuffer information received from bloblist is
invalid i.e NULL or empty.

While at it, improve the debug message to make it more clear that
address in discussion is of framebuffer and not bloblist and also match
it with printing scheme followed in video_reserve function.

Signed-off-by: Devarsh Thakkar <devarsht@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/board_f.c
drivers/video/video-uclass.c

index acf802c9cb330f6c15c20052252210ce2cc52d9d..442b8349d088f47f0dafd7724c64d8dbe07d9546 100644 (file)
@@ -407,11 +407,15 @@ 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);
+                       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))
index f743ed74c8182f3d47a4a254e18c1970036f98c3..d620a29c253787a6c06b5f77f971f751f671d8fc 100644 (file)
@@ -123,6 +123,9 @@ int video_reserve(ulong *addrp)
        struct udevice *dev;
        ulong size;
 
+       if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() == PHASE_BOARD_F)
+               return 0;
+
        gd->video_top = *addrp;
        for (uclass_find_first_device(UCLASS_VIDEO, &dev);
             dev;
@@ -208,11 +211,14 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend,
 
 int video_reserve_from_bloblist(struct video_handoff *ho)
 {
+       if (!ho->fb || ho->size == 0)
+               return -ENOENT;
+
        gd->video_bottom = ho->fb;
        gd->fb_base = ho->fb;
        gd->video_top = ho->fb + ho->size;
-       debug("Reserving %luk for video using blob at: %08x\n",
-             ((unsigned long)ho->size) >> 10, (u32)ho->fb);
+       debug("%s: Reserving %lx bytes at %08x as per bloblist received\n",
+             __func__, (unsigned long)ho->size, (u32)ho->fb);
 
        return 0;
 }