[PATCH 8/9] video: Add generic fixup handler to reserve fb memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When a framebuffer is kept enabled when Linux starts its framebuffer
memory should be reserved. Otherwise Linux may overwrite its contents.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/video/fb.c | 21 +++++++++++++++++++++
 include/fb.h       |  1 +
 2 files changed, 22 insertions(+)

diff --git a/drivers/video/fb.c b/drivers/video/fb.c
index e30ab59..931c99c 100644
--- a/drivers/video/fb.c
+++ b/drivers/video/fb.c
@@ -103,6 +103,27 @@ static int fb_setup_mode(struct fb_info *info)
 	return 0;
 }
 
+static int fb_of_reserve_fixup(struct device_node *root, void *context)
+{
+	struct fb_info *info = context;
+
+	if (!info->enabled)
+		return 0;
+
+	of_add_reserve_entry((unsigned long)info->screen_base,
+			(unsigned long)info->screen_base + info->screen_size);
+
+	return 0;
+}
+
+void fb_of_reserve_add_fixup(struct fb_info *info)
+{
+	if (!IS_ENABLED(CONFIG_OFDEVICE))
+		return;
+
+	of_register_fixup(fb_of_reserve_fixup, info);
+}
+
 static int fb_set_modename(struct param_d *param, void *priv)
 {
 	struct fb_info *info = priv;
diff --git a/include/fb.h b/include/fb.h
index 2db6ad6..a693f4b 100644
--- a/include/fb.h
+++ b/include/fb.h
@@ -159,5 +159,6 @@ int fb_register_simplefb(struct fb_info *info);
 int edid_to_display_timings(struct display_timings *, unsigned char *edid);
 void *edid_read_i2c(struct i2c_adapter *adapter);
 void fb_edid_add_modes(struct fb_info *info);
+void fb_of_reserve_add_fixup(struct fb_info *info);
 
 #endif /* __FB_H */
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux