x86: add coreboot framebuffer support
PATCH 1/1 x86: add coreboot framebuffer support
--- arch/x86/Kconfig | 12 +++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/coreboot.c | 232 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 245 insertions(+) create mode 100644 arch/x86/kernel/coreboot.c
arch/x86/Kconfig +12 -0
@@ -2372,6 +2372,18 @@ config X86_SYSFB If unsure, say Y. +config COREBOOT + bool "coreboot" + depends on X86_SYSFB + depends on FB_SIMPLE + help + Add coreboot framebuffer support to the linux kernel. Say Y here + if you want the linux kernel find and use the firmware framebuffer + initialized by coreboot. Useful when using the linux kernel as + coreboot payload. + + If unsure, or if you don't know what coreboot is, say N. + endmenu
arch/x86/kernel/Makefile +1 -0
@@ -103,6 +103,7 @@ obj-$(CONFIG_UPROBES) += uprobes.o obj-y += sysfb.o obj-$(CONFIG_X86_SYSFB) += sysfb_simplefb.o obj-$(CONFIG_EFI) += sysfb_efi.o +obj-$(CONFIG_COREBOOT) += coreboot.o obj-$(CONFIG_PERF_EVENTS) += perf_regs.o obj-$(CONFIG_TRACING) += tracepoint.o
arch/x86/kernel/coreboot.c new file +232 -0
232 lines not on this page · raw message
Signature · 1 line
1.8.3.1
H. Peter Anvin
reviewerQuoted 20 lines · Gerd Hoffmann
Signed-off-by Gerd Hoffmann <[email protected]>--- arch/x86/Kconfig | 12 +++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/coreboot.c | 232 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 245 insertions(+) create mode 100644 arch/x86/kernel/coreboot.carch/x86/Kconfig +4
-0@@ -2372,6 +2372,18 @@ config X86_SYSFB If unsure, say Y. +config COREBOOT + bool "coreboot" + depends on X86_SYSFB + depends on FB_SIMPLE
arch/x86/Kconfig config X86_SYSFB · line 2388
Quoted 10 lines
arch/x86/Kconfig +8
-0+ help + Add coreboot framebuffer support to the linux kernel. Say Y here + if you want the linux kernel find and use the firmware framebuffer + initialized by coreboot. Useful when using the linux kernel as + coreboot payload. + + If unsure, or if you don't know what coreboot is, say N. + endmenu
This should NOT be named CONFIG_COREBOOT. CONFIG_FB_COREBOOT perhaps.
Quoted 40 lines
arch/x86/Kconfig +40
-0+ +struct cb_header { + u32 signature; + u32 header_bytes; + u32 header_checksum; + u32 table_bytes; + u32 table_checksum; + u32 table_entries; +}; + +#define CB_TAG_MAINBOARD 0x0003 +#define CB_TAG_VERSION 0x0004 +#define CB_TAG_FORWARD 0x0011 +#define CB_TAG_FRAMEBUFFER 0x0012 + +struct cb_mainboard { + u8 vendor_idx; + u8 part_idx; + char strings[0]; +}; + +struct cb_framebuffer { + u64 physical_address; + u32 x_resolution; + u32 y_resolution; + u32 bytes_per_line; + u8 bits_per_pixel; + u8 red_mask_pos; + u8 red_mask_size; + u8 green_mask_pos; + u8 green_mask_size; + u8 blue_mask_pos; + u8 blue_mask_size; + u8 reserved_mask_pos; + u8 reserved_mask_size; +}; + +struct cb_entry { + u32 tag; + u32 size;
arch/x86/Kconfig config X86_SYSFB
Quoted 10 lines
arch/x86/Kconfig +10
-0+ union { + char string[0]; + u64 forward; + struct cb_mainboard mb; + struct cb_framebuffer fb; + } u; +}; + +#define CB_SIGNATURE 0x4f49424C /* "LBIO" */ +
This stuff belongs in a header file.
I'm not a fan of Coreboot having invented its own nonstandard hacks, but I guess it is pretty much unavoidable.
-hpa
Quoted 2 lines · H. Peter Anvin
I'm not a fan of Coreboot having invented its own nonstandard hacks, but I guess it is pretty much unavoidable.
I suspect this should not be architecture-dependent, since coreboot tables work across 3 coreboot architectures at present with more on the way.
Sometimes, something that spans more than an x86 can look like a non-standard hack. At other times, it might look portable. Depends on ones perspective I guess.
Gerd, I'll get back to you offline to show you what we did in Akaros.
ron
Quoted 3 lines
I'm not a fan of Coreboot having invented its own nonstandard hacks, but I guess it is pretty much unavoidable.
It's completely avoidable. The stub can copy this information to standard framebuffer info structure. The only missing thing is to apply patch by cjwatson or mjg59 (I'm not sure now who wrote it) for having an ID for linear framebuffer which implies no specific hardware (it can be any) or firmware (coreboot doesn't provide nay additional info or callback).
Please don't apply this patch it will break SeaBIOS booting with VGABIOS.
Vladimir can you point me to that patch? This sounds interesting.
ron
Quoted 2 lines · ron minnich
Vladimir can you point me to that patch? This sounds interesting.
https://lkml.org/lkml/2010/8/25/190
Quoted 2 lines
ron
H. Peter Anvin
reviewerQuoted 6 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 3 lines · ron minnich
Vladimir can you point me to that patch? This sounds interesting.
I believe *most* of this patch has already gotten merged as we now use simplefb on x86 as well. So all we need is probably the ID.
-hpa
Quoted 11 lines · H. Peter Anvin
Quoted 6 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 3 lines · ron minnich
Vladimir can you point me to that patch? This sounds interesting.
I believe *most* of this patch has already gotten merged as we now use simplefb on x86 as well. So all we need is probably the ID.
Yes, efifb has the same semantics. We just need some ID with clear documentation saying sth like "implies framebuffer without anything else" so that noone will get an idea to plug e.g. vga hooks into it.
Quoted 3 lines
-hpa
H. Peter Anvin
reviewerQuoted 10 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 9 lines · H. Peter Anvin
Quoted 6 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 3 lines · ron minnich
Vladimir can you point me to that patch? This sounds interesting.
Quoted 9 lines
Quoted 4 lines
I believe *most* of this patch has already gotten merged as we now use simplefb on x86 as well. So all we need is probably the ID.
Yes, efifb has the same semantics. We just need some ID with clear documentation saying sth like "implies framebuffer without anything else" so that noone will get an idea to plug e.g. vga hooks into it.
Want to make a patch?
-hpa
Hi,
Quoted 7 lines
Quoted 5 lines
Yes, efifb has the same semantics. We just need some ID with clear documentation saying sth like "implies framebuffer without anything else" so that noone will get an idea to plug e.g. vga hooks into it.
Want to make a patch?
Attached. Can someone test with the patched coreboot trampoline please?
cheers,
Gerd
Quoted 1 line
From
cadf8315cb5d76a89a1b84e7ea22565f6b1945dcMon Sep 17 00:00:00 2001
From: Gerd Hoffmann <[email protected]>
Date: Tue, 9 Sep 2014 08:10:09 +0200
Subject: [PATCH] Add VIDEO_TYPE_LINEAR
Add VIDEO_TYPE_LINEAR for a simple linear framebuffer, initialized by the firmware (for example coreboot).
Needs CONFIG_X86_SYSFB=y and CONFIG_FB_SIMPLE=y to work.
--- arch/x86/kernel/sysfb_simplefb.c | 4 +++- include/uapi/linux/screen_info.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-)
arch/x86/kernel/sysfb_simplefb.c +3 -1
@@ -36,7 +36,9 @@ __init bool parse_mode(const struct screen_info *si,unsigned int i; type = si->orig_video_isVGA; -if (type !=VIDEO_TYPE_VLFB && type !=VIDEO_TYPE_EFI ) +if (type !=VIDEO_TYPE_VLFB && + type !=VIDEO_TYPE_EFI && + type !=VIDEO_TYPE_LINEAR )return false;for (i =0 ; i <ARRAY_SIZE (formats); ++i) {
include/uapi/linux/screen_info.h +2 -0
@@ -66,6 +66,8 @@ struct screen_info {#define VIDEO_TYPE_EFI 0x70/* EFI graphic mode */ +#define VIDEO_TYPE_LINEAR 0x80/* simple linear framebuffer */ +#define VIDEO_FLAGS_NOCURSOR (1 << 0)/* The video mode has no cursor set */ #define VIDEO_CAPABILITY_SKIP_QUIRKS (1 << 0)
Signature · 1 line
1.8.3.1
H. Peter Anvin
reviewerQuoted 10 lines · Vladimir 'φ-coder/phcoder' Serbinenko
Quoted 3 lines
I'm not a fan of Coreboot having invented its own nonstandard hacks, but I guess it is pretty much unavoidable.
It's completely avoidable. The stub can copy this information to standard framebuffer info structure. The only missing thing is to apply patch by cjwatson or mjg59 (I'm not sure now who wrote it) for having an ID for linear framebuffer which implies no specific hardware (it can be any) or firmware (coreboot doesn't provide nay additional info or callback).
Quoted 3 lines
Please don't apply this patch it will break SeaBIOS booting with VGABIOS.
Thanks for the warning. Yes, this is the Right Thing.
-hpa