summaryrefslogtreecommitdiff
path: root/src/device/oprom
diff options
context:
space:
mode:
authorRonald G. Minnich <rminnich@google.com>2013-04-23 10:59:11 -0700
committerStefan Reinauer <stefan.reinauer@coreboot.org>2013-07-10 02:39:28 +0200
commitb2893a0169ce603926bf13465432a15c4526de97 (patch)
tree6c5bd8c303154406da53fd76a24aff081ac52694 /src/device/oprom
parent3fb30eeb147fecb4124b63c353a7b8aac61d4c2a (diff)
downloadcoreboot-b2893a0169ce603926bf13465432a15c4526de97.tar.xz
Provide support for setting up the framebuffer from EDID
Add three functions to edid.c: void set_vbe_mode_info_valid(struct edid *edid, uintptr_t fb_addr) takes an edid and uintptr_t, and fills in a static lb_framebuffer struct as well as setting the static vbe_valid to 1 unless some problem is found in the edid. The intent here is that this could be called from the native graphics setup code on both ARM and x86. int vbe_mode_info_valid(void) returns value of the static vbe_valid. void fill_lb_framebuffer(struct lb_framebuffer *framebuffer) copies the static edid_fb to lb_framebuffer. There is now a common vbe.h in src/include, removed the two special ones. In general, graphics in coreboot is a mess, but graphics is always a mess. We don't have a clean way to try two different ways to turn on a device and use the one that works. One battle at a time. Overall, things are much better. The best part: this code would also work for ARM, which also uses EDID. Change-Id: Id23eb61498b331d44ab064b8fb4cb10f07cff7f3 Signed-off-by: Ronald G. Minnich <rminnich@google.com> Signed-off-by: Gabe Black <gabeblack@chromium.org> Reviewed-on: http://review.coreboot.org/3636 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/device/oprom')
-rw-r--r--src/device/oprom/include/vbe.h117
-rw-r--r--src/device/oprom/realmode/x86.c2
-rw-r--r--src/device/oprom/yabel/compat/functions.c2
-rw-r--r--src/device/oprom/yabel/vbe.h23
4 files changed, 2 insertions, 142 deletions
diff --git a/src/device/oprom/include/vbe.h b/src/device/oprom/include/vbe.h
deleted file mode 100644
index ab26d59bf6..0000000000
--- a/src/device/oprom/include/vbe.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation
- * Copyright (c) 2009 Pattrick Hueper <phueper@hueper.net>
- * All rights reserved.
- * This program and the accompanying materials
- * are made available under the terms of the BSD License
- * which accompanies this distribution, and is available at
- * http://www.opensource.org/licenses/bsd-license.php
- *
- * Contributors:
- * IBM Corporation - initial implementation
- *****************************************************************************/
-
-// these structs are for input from and output to OF
-typedef struct {
- u8 display_type; // 0=NONE, 1= analog, 2=digital
- u16 screen_width;
- u16 screen_height;
- u16 screen_linebytes; // bytes per line in framebuffer, may be more than screen_width
- u8 color_depth; // color depth in bpp
- u32 framebuffer_address;
- u8 edid_block_zero[128];
-} __attribute__ ((__packed__)) screen_info_t;
-
-typedef struct {
- u8 signature[4];
- u16 size_reserved;
- u8 monitor_number;
- u16 max_screen_width;
- u8 color_depth;
-} __attribute__ ((__packed__)) screen_info_input_t;
-
-// these structs only store a subset of the VBE defined fields
-// only those needed.
-typedef struct {
- char signature[4];
- u16 version;
- u8 *oem_string_ptr;
- u32 capabilities;
- u16 video_mode_list[256]; // lets hope we never have more than 256 video modes...
- u16 total_memory;
-} vbe_info_t;
-
-typedef struct {
- u16 mode_attributes; // 00
- u8 win_a_attributes; // 02
- u8 win_b_attributes; // 03
- u16 win_granularity; // 04
- u16 win_size; // 06
- u16 win_a_segment; // 08
- u16 win_b_segment; // 0a
- u32 win_func_ptr; // 0c
- u16 bytes_per_scanline; // 10
- u16 x_resolution; // 12
- u16 y_resolution; // 14
- u8 x_charsize; // 16
- u8 y_charsize; // 17
- u8 number_of_planes; // 18
- u8 bits_per_pixel; // 19
- u8 number_of_banks; // 20
- u8 memory_model; // 21
- u8 bank_size; // 22
- u8 number_of_image_pages; // 23
- u8 reserved_page;
- u8 red_mask_size;
- u8 red_mask_pos;
- u8 green_mask_size;
- u8 green_mask_pos;
- u8 blue_mask_size;
- u8 blue_mask_pos;
- u8 reserved_mask_size;
- u8 reserved_mask_pos;
- u8 direct_color_mode_info;
- u32 phys_base_ptr;
- u32 offscreen_mem_offset;
- u16 offscreen_mem_size;
- u8 reserved[206];
-} __attribute__ ((__packed__)) vesa_mode_info_t;
-
-typedef struct {
- u16 video_mode;
- union {
- vesa_mode_info_t vesa;
- u8 mode_info_block[256];
- };
- // our crap
- //u16 attributes;
- //u16 linebytes;
- //u16 x_resolution;
- //u16 y_resolution;
- //u8 x_charsize;
- //u8 y_charsize;
- //u8 bits_per_pixel;
- //u8 memory_model;
- //u32 framebuffer_address;
-} vbe_mode_info_t;
-
-typedef struct {
- u8 port_number; // i.e. monitor number
- u8 edid_transfer_time;
- u8 ddc_level;
- u8 edid_block_zero[128];
-} vbe_ddc_info_t;
-
-struct lb_framebuffer;
-
-void vbe_set_graphics(void);
-// A way to check if mode information collected by vbe_set_graphics is valid
-// and fill_lb_framebuffer will have real information to use.
-int vbe_mode_info_valid(void);
-void vbe_textmode_console(void);
-void fill_lb_framebuffer(struct lb_framebuffer *framebuffer);
-
-#define VESA_GET_INFO 0x4f00
-#define VESA_GET_MODE_INFO 0x4f01
-#define VESA_SET_MODE 0x4f02
-
diff --git a/src/device/oprom/realmode/x86.c b/src/device/oprom/realmode/x86.c
index 94b65e1abc..338294df25 100644
--- a/src/device/oprom/realmode/x86.c
+++ b/src/device/oprom/realmode/x86.c
@@ -29,7 +29,7 @@
#include <delay.h>
#include <pc80/i8259.h>
#include "x86.h"
-#include "vbe.h"
+#include <vbe.h>
#include <lib/jpeg.h>
/* we use x86emu's register file representation */
#include <x86emu/regs.h>
diff --git a/src/device/oprom/yabel/compat/functions.c b/src/device/oprom/yabel/compat/functions.c
index f693d7bae9..f0160ed52a 100644
--- a/src/device/oprom/yabel/compat/functions.c
+++ b/src/device/oprom/yabel/compat/functions.c
@@ -18,7 +18,7 @@
#include <device/device.h>
#include "../debug.h"
#include "../biosemu.h"
-#include "../vbe.h"
+#include <vbe.h>
#include "../compat/time.h"
#define VMEM_SIZE (1024 * 1024) /* 1 MB */
diff --git a/src/device/oprom/yabel/vbe.h b/src/device/oprom/yabel/vbe.h
deleted file mode 100644
index bf286bc12c..0000000000
--- a/src/device/oprom/yabel/vbe.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation
- * All rights reserved.
- * This program and the accompanying materials
- * are made available under the terms of the BSD License
- * which accompanies this distribution, and is available at
- * http://www.opensource.org/licenses/bsd-license.php
- *
- * Contributors:
- * IBM Corporation - initial implementation
- *****************************************************************************/
-
-#ifndef _BIOSEMU_VBE_H_
-#define _BIOSEMU_VBE_H_
-
-struct lb_framebuffer;
-
-void vbe_set_graphics(void);
-int vbe_mode_info_valid(void);
-void fill_lb_framebuffer(struct lb_framebuffer *framebuffer);
-void vbe_textmode_console(void);
-
-#endif