Vladimir Serbinenko has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/81896?usp=email )
Change subject: multiboot: Support multiboot framebuffer info ......................................................................
multiboot: Support multiboot framebuffer info
This allows to quickly iterate prototype using modern video output
Change-Id: I5872abc612f3b3ad70bd83c621c1e63bc7a2816c --- M payloads/libpayload/arch/x86/head.S M payloads/libpayload/arch/x86/multiboot.c M payloads/libpayload/include/multiboot_tables.h 3 files changed, 53 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/96/81896/1
diff --git a/payloads/libpayload/arch/x86/head.S b/payloads/libpayload/arch/x86/head.S index 1e0e4a0..8a76728 100644 --- a/payloads/libpayload/arch/x86/head.S +++ b/payloads/libpayload/arch/x86/head.S @@ -43,7 +43,7 @@ .align 4
#define MB_MAGIC 0x1BADB002 -#define MB_FLAGS 0x00010003 +#define MB_FLAGS 0x00010007
mb_header: .long MB_MAGIC @@ -54,6 +54,7 @@ .long _edata .long _end .long _init + .long 0, 0, 0, 0
/* * This function saves off the previous stack and switches us to our diff --git a/payloads/libpayload/arch/x86/multiboot.c b/payloads/libpayload/arch/x86/multiboot.c index 26dc4f8..4aa3e01 100644 --- a/payloads/libpayload/arch/x86/multiboot.c +++ b/payloads/libpayload/arch/x86/multiboot.c @@ -104,6 +104,33 @@ } }
+static void mb_parse_framebuf(struct multiboot_header *table, struct sysinfo_t *info) +{ + if (table->framebuffer_type != MULTIBOOT_FRAMEBUFFER_TYPE_RGB) + return; + info->framebuffer.tag = CB_TAG_FRAMEBUFFER; + info->framebuffer.size = sizeof(info->framebuffer); + + info->framebuffer.physical_address = table->framebuffer_addr; + info->framebuffer.x_resolution = table->framebuffer_width; + info->framebuffer.y_resolution = table->framebuffer_height; + info->framebuffer.bytes_per_line = table->framebuffer_pitch; + info->framebuffer.bits_per_pixel = table->framebuffer_bpp; + info->framebuffer.red_mask_pos = table->framebuffer_red_field_position; + info->framebuffer.red_mask_size = table->framebuffer_red_mask_size; + info->framebuffer.green_mask_pos = table->framebuffer_green_field_position; + info->framebuffer.green_mask_size = table->framebuffer_green_mask_size; + info->framebuffer.blue_mask_pos = table->framebuffer_blue_field_position; + info->framebuffer.blue_mask_size = table->framebuffer_blue_mask_size; + info->framebuffer.reserved_mask_pos = 0; + info->framebuffer.reserved_mask_size = 0; + info->framebuffer.orientation = CB_FB_ORIENTATION_NORMAL; + info->framebuffer.flags.has_external_display = 0; + info->framebuffer.flags.reserved = 0; + info->framebuffer.pad = 0; + +} + int get_multiboot_info(struct sysinfo_t *info) { struct multiboot_header *table; @@ -123,5 +150,8 @@ if (table->flags & MULTIBOOT_FLAGS_CMDLINE) mb_parse_cmdline(table);
+ if (table->flags & MULTIBOOT_FLAGS_FRAMEBUFFER_INFO) + mb_parse_framebuf(table, info); + return 0; } diff --git a/payloads/libpayload/include/multiboot_tables.h b/payloads/libpayload/include/multiboot_tables.h index cad8034..03d8881 100644 --- a/payloads/libpayload/include/multiboot_tables.h +++ b/payloads/libpayload/include/multiboot_tables.h @@ -35,6 +35,7 @@ #define MULTIBOOT_FLAGS_MMAP (1 << 6) #define MULTIBOOT_FLAGS_CMDLINE (1 << 2) #define MULTIBOOT_FLAGS_MEMINFO (1 << 0) +#define MULTIBOOT_FLAGS_FRAMEBUFFER_INFO (1 << 12) struct multiboot_header { u32 flags; u32 mem_lower; @@ -60,10 +61,26 @@
u32 vbe_control_info; u32 vbe_mode_info; - u32 vbe_mode; - u32 vbe_interface_seg; - u32 vbe_interface_off; - u32 vbe_interface_len; + u16 vbe_mode; + u16 vbe_interface_seg; + u16 vbe_interface_off; + u16 vbe_interface_len; + + u64 framebuffer_addr; + u32 framebuffer_pitch; + u32 framebuffer_width; + u32 framebuffer_height; + u8 framebuffer_bpp; +#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0 +#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1 +#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2 + u8 framebuffer_type; + u8 framebuffer_red_field_position; + u8 framebuffer_red_mask_size; + u8 framebuffer_green_field_position; + u8 framebuffer_green_mask_size; + u8 framebuffer_blue_field_position; + u8 framebuffer_blue_mask_size; };
struct multiboot_mmap {