Skip to content

Commit e3271c9

Browse files
Ard BiesheuvelIngo Molnar
authored andcommitted
efi/arm*: Wire up 'struct screen_info' to efi-framebuffer platform device
This adds code to the ARM and arm64 EFI init routines to expose a platform device of type 'efi-framebuffer' if 'struct screen_info' has been populated appropriately from the GOP protocol by the stub. Since the framebuffer may potentially be located in system RAM, make sure that the region is reserved and marked MEMBLOCK_NOMAP. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk> Cc: Borislav Petkov <bp@alien8.de> Cc: David Herrmann <dh.herrmann@gmail.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Jones <pjones@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Will Deacon <will.deacon@arm.com> Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/1461614832-17633-24-git-send-email-matt@codeblueprint.co.uk Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent f0827e1 commit e3271c9

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/firmware/efi/arm-init.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/mm_types.h>
2020
#include <linux/of.h>
2121
#include <linux/of_fdt.h>
22+
#include <linux/platform_device.h>
2223
#include <linux/screen_info.h>
2324

2425
#include <asm/efi.h>
@@ -78,6 +79,10 @@ static void __init init_screen_info(void)
7879
screen_info.orig_video_cols = 80;
7980
screen_info.orig_video_lines = 25;
8081
}
82+
83+
if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI &&
84+
memblock_is_map_memory(screen_info.lfb_base))
85+
memblock_mark_nomap(screen_info.lfb_base, screen_info.lfb_size);
8186
}
8287

8388
static int __init uefi_init(void)
@@ -256,3 +261,16 @@ void __init efi_init(void)
256261

257262
init_screen_info();
258263
}
264+
265+
static int __init register_gop_device(void)
266+
{
267+
void *pd;
268+
269+
if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI)
270+
return 0;
271+
272+
pd = platform_device_register_data(NULL, "efi-framebuffer", 0,
273+
&screen_info, sizeof(screen_info));
274+
return PTR_ERR_OR_ZERO(pd);
275+
}
276+
subsys_initcall(register_gop_device);

0 commit comments

Comments
 (0)