From: Devarsh Thakkar <devarsht@ti.com>
To: <u-boot@lists.denx.de>, <sjg@chromium.org>, <agust@denx.de>,
<trini@konsulko.com>, <bmeng.cn@gmail.com>, <msuchanek@suse.de>,
<rasmus.villemoes@prevas.dk>, <yangshiji66@outlook.com>
Cc: <praneeth@ti.com>, <nm@ti.com>, <vigneshr@ti.com>,
<a-bhatia1@ti.com>, <j-luthra@ti.com>, <nsekhar@ti.com>,
<n-jain1@ti.com>, <devarsht@ti.com>
Subject: [PATCH v4 5/8] video: Skip framebuffer reservation if already reserved
Date: Sat, 25 Nov 2023 21:57:02 +0530 [thread overview]
Message-ID: <20231125162705.1383401-6-devarsht@ti.com> (raw)
In-Reply-To: <20231125162705.1383401-1-devarsht@ti.com>
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>
---
V2:
- Add debug prints
- Fix commenting style
V3:
- Fix commenting style
V4:
- Remove extra checks on gd for video data in video_reserve
- Add check and return error if video handoff provided info is invalid
- Improve debug message
- Remove Reviewed-by due to additional changes per review comments
---
common/board_f.c | 8 ++++++--
drivers/video/video-uclass.c | 10 ++++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/common/board_f.c b/common/board_f.c
index acf802c9cb..442b8349d0 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -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))
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index f743ed74c8..378f01f3d7 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -123,6 +123,9 @@ int video_reserve(ulong *addrp)
struct udevice *dev;
ulong size;
+ if (IS_ENABLED(CONFIG_SPL_VIDEO_HANDOFF) && spl_phase() > PHASE_SPL)
+ 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;
}
--
2.34.1
next prev parent reply other threads:[~2023-11-25 16:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-25 16:26 [PATCH v4 0/8] Move framebuffer reservation for SPL to RAM end Devarsh Thakkar
2023-11-25 16:26 ` [PATCH v4 1/8] spl: Enforce framebuffer reservation from end of RAM Devarsh Thakkar
2023-12-02 21:16 ` Simon Glass
2023-11-25 16:26 ` [PATCH v4 2/8] arm: mach-k3: common: Reserve video memory from end of the RAM Devarsh Thakkar
2023-12-05 12:34 ` Nikhil Jain
2023-11-25 16:27 ` [PATCH v4 3/8] board: ti: am62x: evm: Remove video_setup from spl_board_init Devarsh Thakkar
2023-11-25 16:27 ` [PATCH v4 4/8] common/board_f: Catch bloblist before starting resevations Devarsh Thakkar
2023-11-25 16:27 ` Devarsh Thakkar [this message]
2023-12-02 18:26 ` [PATCH v4 5/8] video: Skip framebuffer reservation if already reserved Simon Glass
2023-11-25 16:27 ` [PATCH v4 6/8] video: Fill video handoff in video post probe Devarsh Thakkar
2023-11-25 16:27 ` [PATCH v4 7/8] doc: spl: Add info for missing Kconfigs Devarsh Thakkar
2023-12-02 18:28 ` Simon Glass
2023-11-25 16:27 ` [PATCH v4 8/8] doc: spl: Add info regarding memory reservation Devarsh Thakkar
2023-12-02 18:26 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231125162705.1383401-6-devarsht@ti.com \
--to=devarsht@ti.com \
--cc=a-bhatia1@ti.com \
--cc=agust@denx.de \
--cc=bmeng.cn@gmail.com \
--cc=j-luthra@ti.com \
--cc=msuchanek@suse.de \
--cc=n-jain1@ti.com \
--cc=nm@ti.com \
--cc=nsekhar@ti.com \
--cc=praneeth@ti.com \
--cc=rasmus.villemoes@prevas.dk \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=vigneshr@ti.com \
--cc=yangshiji66@outlook.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox