All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: add coreboot framebuffer support
@ 2014-09-04 10:25 Gerd Hoffmann
  2014-09-05 20:05 ` H. Peter Anvin
  0 siblings, 1 reply; 11+ messages in thread
From: Gerd Hoffmann @ 2014-09-04 10:25 UTC (permalink / raw)
  To: linux-kernel
  Cc: coreboot, Gerd Hoffmann, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, maintainer:X86 ARCHITECTURE...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 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

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 778178f..3aeb038 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -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
 
 
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index ada2e2d..4b30b0e 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -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
diff --git a/arch/x86/kernel/coreboot.c b/arch/x86/kernel/coreboot.c
new file mode 100644
index 0000000..44ed3fa
--- /dev/null
+++ b/arch/x86/kernel/coreboot.c
@@ -0,0 +1,232 @@
+/*
+ * Find and parse coreboot tables.  Register framebuffer if present.
+ * See src/include/boot/coreboot_tables.h in coreboot source tree.
+ */
+
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/mm.h>
+#include <linux/screen_info.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/simplefb.h>
+#include <video/vga.h>
+
+#include <asm/checksum.h>
+#include <asm/io.h>
+#include <asm/sysfb.h>
+
+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;
+	union {
+		char    string[0];
+		u64     forward;
+		struct cb_mainboard   mb;
+		struct cb_framebuffer fb;
+	} u;
+};
+
+#define CB_SIGNATURE 0x4f49424C  /* "LBIO" */
+
+/* Try to locate the coreboot header in a given address range. */
+static __init struct cb_header *coreboot_find_header(u32 addr, int len)
+{
+	struct cb_header *cbh, *copy;
+	int offset;
+	void *map;
+
+	map = ioremap(addr, len);
+	for (offset = 0; offset < len; offset += 16) {
+		cbh = map + offset;
+		if (!cbh)
+			continue;
+		if (cbh->signature != CB_SIGNATURE)
+			continue;
+		if (!cbh->table_bytes)
+			continue;
+		if (ip_compute_csum(cbh, sizeof(*cbh)) != 0)
+			continue;
+		if (ip_compute_csum(cbh + 1, cbh->table_bytes)
+		    != cbh->table_checksum)
+			continue;
+		pr_debug("coreboot: header found at 0x%x\n",
+			 addr + offset);
+		copy = kzalloc(sizeof(*cbh) + cbh->table_bytes, GFP_KERNEL);
+		memcpy(copy, cbh, sizeof(*cbh) + cbh->table_bytes);
+		iounmap(map);
+		return copy;
+	}
+	iounmap(map);
+	return NULL;
+}
+
+static __init bool check_vga_text_mode(void)
+{
+	uint8_t reg;
+
+	if (screen_info.orig_video_isVGA != 1)
+		return false;
+
+	reg = inb(VGA_GFX_I);
+	if (reg == 0xff)
+		/* no vga present */
+		return false;
+
+	outb(VGA_GFX_MISC, VGA_GFX_I);
+	reg = inb(VGA_GFX_D);
+	if (reg & 0x01)
+		/* vga is in gfx mode */
+		return false;
+
+	return true;
+}
+
+static __init void coreboot_fb_init(struct cb_framebuffer *fb)
+{
+	const char *reason = "";
+	struct simplefb_platform_data mode;
+	struct screen_info si;
+	struct resource res;
+
+	pr_info("coreboot: framebuffer: %dx%d, %d bpp, at %llx\n",
+		fb->x_resolution,
+		fb->y_resolution,
+		fb->bits_per_pixel,
+		fb->physical_address);
+
+	if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB) {
+		reason = "have vesa lfb";
+		goto skip;
+	}
+	if (screen_info.orig_video_isVGA == VIDEO_TYPE_EFI) {
+		reason = "have efi gop";
+		goto skip;
+	}
+	if (check_vga_text_mode()) {
+		reason = "vga is in text mode";
+		goto skip;
+	}
+
+	memset(&si, 0, sizeof(si));
+	si.orig_video_isVGA = VIDEO_TYPE_VLFB;
+	si.lfb_width        = fb->x_resolution;
+	si.lfb_height       = fb->y_resolution;
+	si.lfb_depth        = fb->bits_per_pixel;
+	si.lfb_base         = fb->physical_address;
+	si.lfb_linelength   = fb->bytes_per_line;
+	si.lfb_size         =
+		(fb->y_resolution * fb->bytes_per_line + 65535) / 65536;
+	si.pages            = 1;
+	si.red_size         = fb->red_mask_size;
+	si.red_pos          = fb->red_mask_pos;
+	si.green_size       = fb->green_mask_size;
+	si.green_pos        = fb->green_mask_pos;
+	si.blue_size        = fb->blue_mask_size;
+	si.blue_pos         = fb->blue_mask_pos;
+	si.rsvd_size        = fb->reserved_mask_size;
+	si.rsvd_pos         = fb->reserved_mask_pos;
+	if (!parse_mode(&si, &mode)) {
+		reason = "mode not compatible";
+		goto skip;
+	}
+
+	memset(&res, 0, sizeof(res));
+	res.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
+	res.name = "coreboot-fb";
+	res.start = si.lfb_base;
+	res.end = si.lfb_base + si.lfb_size * 65536 - 1;
+
+	pr_info("coreboot: setting up simplefb\n");
+	platform_device_register_resndata(NULL, "simple-framebuffer", 0,
+					  &res, 1, &mode, sizeof(mode));
+	return;
+
+skip:
+	pr_info("coreboot: skipping framebuffer setup (%s)\n", reason);
+	return;
+}
+
+static __init int coreboot_detect(void)
+{
+	struct cb_header *cbh;
+	struct cb_entry *cbe;
+	u64 addr = 0;
+	void *next;
+	int i;
+
+newheader:
+	cbh = coreboot_find_header(addr, 0x1000);
+	if (!cbh)
+		return 0;
+
+	next = cbh + 1;
+	for (i = 0; i < cbh->table_entries; i++) {
+		cbe = next;
+		next += cbe->size;
+		switch (cbe->tag) {
+		case CB_TAG_MAINBOARD:
+			pr_info("coreboot: mainboard: %s / %s\n",
+				cbe->u.mb.strings + cbe->u.mb.vendor_idx,
+				cbe->u.mb.strings + cbe->u.mb.part_idx);
+			break;
+		case CB_TAG_VERSION:
+			pr_info("coreboot: version: %s\n",
+				cbe->u.string);
+			break;
+		case CB_TAG_FORWARD:
+			pr_debug("coreboot: forward to 0x%llx\n",
+				 cbe->u.forward);
+			addr = cbe->u.forward;
+			kfree(cbh);
+			goto newheader;
+		case CB_TAG_FRAMEBUFFER:
+			coreboot_fb_init(&cbe->u.fb);
+			break;
+		default:
+			pr_debug("%s: unhandled tag 0x%x (size %d)\n",
+				 __func__, cbe->tag, cbe->size);
+			break;
+		}
+	}
+
+	kfree(cbh);
+	return 0;
+}
+
+device_initcall(coreboot_detect);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] x86: add coreboot framebuffer support
  2014-09-04 10:25 [PATCH] x86: add coreboot framebuffer support Gerd Hoffmann
@ 2014-09-05 20:05 ` H. Peter Anvin
  2014-09-05 20:55   ` [coreboot] " ron minnich
  2014-09-05 21:09   ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 2 replies; 11+ messages in thread
From: H. Peter Anvin @ 2014-09-05 20:05 UTC (permalink / raw)
  To: Gerd Hoffmann, linux-kernel
  Cc: coreboot, Thomas Gleixner, Ingo Molnar, maintainer:X86 ARCHITECTURE...

On 09/04/2014 03:25 AM, Gerd Hoffmann wrote:
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  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
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 778178f..3aeb038 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -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
>  

This should NOT be named CONFIG_COREBOOT.  CONFIG_FB_COREBOOT perhaps.

> +
> +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;
> +	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



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [coreboot] [PATCH] x86: add coreboot framebuffer support
  2014-09-05 20:05 ` H. Peter Anvin
@ 2014-09-05 20:55   ` ron minnich
  2014-09-05 21:09   ` Vladimir 'φ-coder/phcoder' Serbinenko
  1 sibling, 0 replies; 11+ messages in thread
From: ron minnich @ 2014-09-05 20:55 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Gerd Hoffmann, lkml - Kernel Mailing List, Thomas Gleixner,
	Ingo Molnar, maintainer:X86 ARCHITECTURE...,
	coreboot

On Fri, Sep 5, 2014 at 1:05 PM, H. Peter Anvin <hpa@zytor.com> wrote:

> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [coreboot] [PATCH] x86: add coreboot framebuffer support
  2014-09-05 20:05 ` H. Peter Anvin
  2014-09-05 20:55   ` [coreboot] " ron minnich
@ 2014-09-05 21:09   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2014-09-05 21:18     ` ron minnich
  2014-09-05 21:20     ` H. Peter Anvin
  1 sibling, 2 replies; 11+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2014-09-05 21:09 UTC (permalink / raw)
  To: H. Peter Anvin, Gerd Hoffmann, linux-kernel
  Cc: Thomas Gleixner, Ingo Molnar, maintainer:X86 ARCHITECTURE..., coreboot

[-- Attachment #1: Type: text/plain, Size: 563 bytes --]


> 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.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 213 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [coreboot] [PATCH] x86: add coreboot framebuffer support
  2014-09-05 21:09   ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2014-09-05 21:18     ` ron minnich
  2014-09-05 21:23       ` Vladimir 'φ-coder/phcoder' Serbinenko
  2014-09-05 21:20     ` H. Peter Anvin
  1 sibling, 1 reply; 11+ messages in thread
From: ron minnich @ 2014-09-05 21:18 UTC (permalink / raw)
  To: Vladimir 'φ-coder/phcoder' Serbinenko
  Cc: H. Peter Anvin, Gerd Hoffmann, lkml - Kernel Mailing List,
	Thomas Gleixner, Ingo Molnar, maintainer:X86 ARCHITECTURE...,
	coreboot

Vladimir can you point me to that patch? This sounds interesting.

ron

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [coreboot] [PATCH] x86: add coreboot framebuffer support
  2014-09-05 21:09   ` Vladimir 'φ-coder/phcoder' Serbinenko
  2014-09-05 21:18     ` ron minnich
@ 2014-09-05 21:20     ` H. Peter Anvin
  1 sibling, 0 replies; 11+ messages in thread
From: H. Peter Anvin @ 2014-09-05 21:20 UTC (permalink / raw)
  To: Vladimir 'φ-coder/phcoder' Serbinenko,
	Gerd Hoffmann, linux-kernel
  Cc: Thomas Gleixner, Ingo Molnar, maintainer:X86 ARCHITECTURE..., coreboot

On 09/05/2014 02:09 PM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> 
>> 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.
> 

Thanks for the warning.  Yes, this is the Right Thing.

	-hpa


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [coreboot] [PATCH] x86: add coreboot framebuffer support
  2014-09-05 21:18     ` ron minnich
@ 2014-09-05 21:23       ` Vladimir 'φ-coder/phcoder' Serbinenko
  2014-09-05 21:31         ` H. Peter Anvin
  0 siblings, 1 reply; 11+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2014-09-05 21:23 UTC (permalink / raw)
  To: ron minnich
  Cc: H. Peter Anvin, Gerd Hoffmann, lkml - Kernel Mailing List,
	Thomas Gleixner, Ingo Molnar, maintainer:X86 ARCHITECTURE...,
	coreboot

[-- Attachment #1: Type: text/plain, Size: 168 bytes --]

On 06.09.2014 00:18, ron minnich wrote:
> Vladimir can you point me to that patch? This sounds interesting.
> 
https://lkml.org/lkml/2010/8/25/190

> ron
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 213 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [coreboot] [PATCH] x86: add coreboot framebuffer support
  2014-09-05 21:23       ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2014-09-05 21:31         ` H. Peter Anvin
  2014-09-05 21:40           ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 11+ messages in thread
From: H. Peter Anvin @ 2014-09-05 21:31 UTC (permalink / raw)
  To: Vladimir 'φ-coder/phcoder' Serbinenko, ron minnich
  Cc: Gerd Hoffmann, lkml - Kernel Mailing List, Thomas Gleixner,
	Ingo Molnar, maintainer:X86 ARCHITECTURE...,
	coreboot

On 09/05/2014 02:23 PM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> On 06.09.2014 00:18, ron minnich wrote:
>> Vladimir can you point me to that patch? This sounds
>> interesting.
>> 
> https://lkml.org/lkml/2010/8/25/190
> 

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [coreboot] [PATCH] x86: add coreboot framebuffer support
  2014-09-05 21:31         ` H. Peter Anvin
@ 2014-09-05 21:40           ` Vladimir 'φ-coder/phcoder' Serbinenko
  2014-09-05 21:48             ` H. Peter Anvin
  0 siblings, 1 reply; 11+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2014-09-05 21:40 UTC (permalink / raw)
  To: H. Peter Anvin, ron minnich
  Cc: Gerd Hoffmann, lkml - Kernel Mailing List, Thomas Gleixner,
	Ingo Molnar, maintainer:X86 ARCHITECTURE...,
	coreboot

[-- Attachment #1: Type: text/plain, Size: 661 bytes --]

On 06.09.2014 00:31, H. Peter Anvin wrote:
> On 09/05/2014 02:23 PM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
>> On 06.09.2014 00:18, ron minnich wrote:
>>> Vladimir can you point me to that patch? This sounds
>>> interesting.
>>>
>> https://lkml.org/lkml/2010/8/25/190
>>
> 
> 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.

> 	-hpa
> 
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 213 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [coreboot] [PATCH] x86: add coreboot framebuffer support
  2014-09-05 21:40           ` Vladimir 'φ-coder/phcoder' Serbinenko
@ 2014-09-05 21:48             ` H. Peter Anvin
  2014-09-09  6:15               ` Gerd Hoffmann
  0 siblings, 1 reply; 11+ messages in thread
From: H. Peter Anvin @ 2014-09-05 21:48 UTC (permalink / raw)
  To: Vladimir 'φ-coder/phcoder' Serbinenko, ron minnich
  Cc: Gerd Hoffmann, lkml - Kernel Mailing List, Thomas Gleixner,
	Ingo Molnar, maintainer:X86 ARCHITECTURE...,
	coreboot

On 09/05/2014 02:40 PM, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> On 06.09.2014 00:31, H. Peter Anvin wrote:
>> On 09/05/2014 02:23 PM, Vladimir 'φ-coder/phcoder' Serbinenko
>> wrote:
>>> On 06.09.2014 00:18, ron minnich wrote:
>>>> Vladimir can you point me to that patch? This sounds 
>>>> interesting.
>>>> 
>>> https://lkml.org/lkml/2010/8/25/190
>>> 
>> 
>> 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



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [coreboot] [PATCH] x86: add coreboot framebuffer support
  2014-09-05 21:48             ` H. Peter Anvin
@ 2014-09-09  6:15               ` Gerd Hoffmann
  0 siblings, 0 replies; 11+ messages in thread
From: Gerd Hoffmann @ 2014-09-09  6:15 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Vladimir 'φ-coder/phcoder' Serbinenko, ron minnich,
	coreboot, maintainer:X86 ARCHITECTURE...,
	lkml - Kernel Mailing List, Ingo Molnar, Thomas Gleixner

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

  Hi,

> > 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


[-- Attachment #2: 0001-Add-VIDEO_TYPE_LINEAR.patch --]
[-- Type: text/x-patch, Size: 1565 bytes --]

>From cadf8315cb5d76a89a1b84e7ea22565f6b1945dc Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
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.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 arch/x86/kernel/sysfb_simplefb.c | 4 +++-
 include/uapi/linux/screen_info.h | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/sysfb_simplefb.c b/arch/x86/kernel/sysfb_simplefb.c
index 86179d4..0742c82 100644
--- a/arch/x86/kernel/sysfb_simplefb.c
+++ b/arch/x86/kernel/sysfb_simplefb.c
@@ -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) {
diff --git a/include/uapi/linux/screen_info.h b/include/uapi/linux/screen_info.h
index 7530e74..d27126d 100644
--- a/include/uapi/linux/screen_info.h
+++ b/include/uapi/linux/screen_info.h
@@ -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)
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-09-09  6:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-04 10:25 [PATCH] x86: add coreboot framebuffer support Gerd Hoffmann
2014-09-05 20:05 ` H. Peter Anvin
2014-09-05 20:55   ` [coreboot] " ron minnich
2014-09-05 21:09   ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-09-05 21:18     ` ron minnich
2014-09-05 21:23       ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-09-05 21:31         ` H. Peter Anvin
2014-09-05 21:40           ` Vladimir 'φ-coder/phcoder' Serbinenko
2014-09-05 21:48             ` H. Peter Anvin
2014-09-09  6:15               ` Gerd Hoffmann
2014-09-05 21:20     ` H. Peter Anvin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.