Skip to contentSkip to conversation

video: sunxi: de2: Reserve the fb region in the EFI memory map

PATCH New Emmanuel Vadot 2 participants 2 messages May 4, 2018 – May 10, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: sunxi: de2: Reserve the fb region in the EFI memory map

If compile with support for the efi loader we need to mark the pages allocated for the framebuffer as reserved so the kernel won't attempt to use them for other uses.

---
 drivers/video/sunxi/sunxi_de2.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/video/sunxi/sunxi_de2.c +8 -0
index 860187323c..563e4b583d 100644
@@ -10,6 +10,7 @@
 #include <display.h>
 #include <dm.h>
 #include <edid.h>
+#include <efi_loader.h>
 #include <fdtdec.h>
 #include <fdt_support.h>
 #include <video.h>
@@ -222,6 +223,13 @@ static int sunxi_de2_init(struct udevice *dev, ulong fbbase,
 	uc_priv->bpix = l2bpp;
 	debug("fb=%lx, size=%d %d\n", fbbase, uc_priv->xsize, uc_priv->ysize);
 
+#ifdef CONFIG_EFI_LOADER
+	efi_add_memory_map(fbbase,
+			   ALIGN(timing.hactive.typ * timing.vactive.typ *
+			   (1 << l2bpp) / 8, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT,
+			   EFI_RESERVED_MEMORY_TYPE, false);
+#endif
+
 	return 0;
 }
 
Signature · 1 line
2.16.3
#1 lore raw

PATCH 1/1 video: sunxi: de2: Reserve the fb region in the EFI memory map

Quoted 22 lines · Emmanuel Vadot

If compile with support for the efi loader we need to mark the pages allocated for the framebuffer as reserved so the kernel won't attempt to use them for other uses.

---
 drivers/video/sunxi/sunxi_de2.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/video/sunxi/sunxi_de2.c +1 -0
index 860187323c..563e4b583d 100644
@@ -10,6 +10,7 @@
 #include <display.h>
 #include <dm.h>
 #include <edid.h>
+#include <efi_loader.h>
 #include <fdtdec.h>
 #include <fdt_support.h>
 #include <video.h>

drivers/video/sunxi/sunxi_de2.c static int sunxi_de2_init(struct udevice *dev, ulong fbbase, · line 230

Quoted 8 lines
drivers/video/sunxi/sunxi_de2.c +5 -0
@@ -222,6 +223,13 @@ static int sunxi_de2_init(struct udevice *dev, ulong fbbase,
 	uc_priv->bpix = l2bpp;
 	debug("fb=%lx, size=%d %d\n", fbbase, uc_priv->xsize, uc_priv->ysize);
 
+#ifdef CONFIG_EFI_LOADER
+	efi_add_memory_map(fbbase,
+			   ALIGN(timing.hactive.typ * timing.vactive.typ *
+			   (1 << l2bpp) / 8, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT,
+			   EFI_RESERVED_MEMORY_TYPE, false);

Should fbbase not be EFI_PAGE_SIZE (4k) aligned you would have to round it down.

I wonder why below we use macro VNBYTES() but not here.

Otherwise

Quoted 6 lines
drivers/video/sunxi/sunxi_de2.c +2 -0
+#endif
+
 	return 0;
 }