[PATCH 39/67] upl: Update upl_add_graphics() to return framebuffer

Simon Glass sjg at chromium.org
Wed Jan 1 23:09:25 CET 2025


The framebuffer address and size will be needed for the reserved-memory
section, so return them to the caller.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 boot/upl_common.c    | 4 +++-
 common/spl/spl_upl.c | 3 ++-
 include/upl.h        | 7 ++++++-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/boot/upl_common.c b/boot/upl_common.c
index a0ed5568854..01301049341 100644
--- a/boot/upl_common.c
+++ b/boot/upl_common.c
@@ -87,7 +87,7 @@ int upl_add_serial(struct upl_serial *ser)
 	return 0;
 }
 
-int upl_add_graphics(struct upl_graphics *gra)
+int upl_add_graphics(struct upl_graphics *gra, ulong *basep, ulong *sizep)
 {
 	struct video_uc_plat *plat;
 	struct video_priv *priv;
@@ -101,6 +101,8 @@ int upl_add_graphics(struct upl_graphics *gra)
 	plat = dev_get_uclass_plat(dev);
 	region.base = plat->base;
 	region.size = plat->size;
+	*basep = plat->base;
+	*sizep = plat->size;
 	if (!alist_add(&gra->reg, region))
 		return log_msg_ret("reg", -ENOMEM);
 
diff --git a/common/spl/spl_upl.c b/common/spl/spl_upl.c
index 32c8ea62ef3..a78ae75e56c 100644
--- a/common/spl/spl_upl.c
+++ b/common/spl/spl_upl.c
@@ -54,6 +54,7 @@ int _upl_add_image(int node, ulong load_addr, ulong size, const char *desc)
 int spl_write_upl_handoff(void)
 {
 	struct upl *upl = &s_upl;
+	ulong addr, size;
 	struct abuf buf;
 	ofnode root;
 	void *ptr;
@@ -66,7 +67,7 @@ int spl_write_upl_handoff(void)
 	ret = upl_add_serial(&upl->serial);
 	if (ret)
 		return log_msg_ret("ser", ret);
-	ret = upl_add_graphics(&upl->graphics);
+	ret = upl_add_graphics(&upl->graphics, &addr, &size);
 	if (ret && ret != -ENOENT)
 		return log_msg_ret("gra", ret);
 
diff --git a/include/upl.h b/include/upl.h
index e415130d44f..edd333f648a 100644
--- a/include/upl.h
+++ b/include/upl.h
@@ -226,6 +226,8 @@ enum upl_graphics_format {
 };
 
 /**
+ * struct upl_graphics - Information about graphics display
+ *
  * @reg: List of base address and size of registers (struct memregion)
  * @width: Width of display in pixels
  * @height: Height of display in pixels
@@ -385,9 +387,12 @@ int upl_add_serial(struct upl_serial *ser);
  *
  * Writes details about the current video device to the UPL struct
  *
+ * @gra: Struct to fill in
+ * @basep: Returns base address of framebuffer
+ * @sizep: Returns size of framebuffer
  * Return: 0 if OK, -ve on error
  */
-int upl_add_graphics(struct upl_graphics *gra);
+int upl_add_graphics(struct upl_graphics *gra, ulong *basep, ulong *sizep);
 
 /** upl_init() - Set up a UPL struct */
 void upl_init(struct upl *upl);
-- 
2.43.0



More information about the U-Boot mailing list