diff mbox

[U-Boot,10/11] video: coreboot: Save VESA mode for future use

Message ID 1439450957-23197-11-git-send-email-bmeng.cn@gmail.com
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Bin Meng Aug. 13, 2015, 7:29 a.m. UTC
When booting as a coreboot payload, the framebuffer details are
passed from coreboot via configuration tables. We save these
information into vesa_mode_info structure for future use.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/pci/pci_rom.c       |  2 +-
 drivers/video/coreboot_fb.c | 24 ++++++++++++++++++++++++
 include/vbe.h               |  2 ++
 3 files changed, 27 insertions(+), 1 deletion(-)

Comments

Simon Glass Aug. 16, 2015, 9:27 p.m. UTC | #1
On 13 August 2015 at 01:29, Bin Meng <bmeng.cn@gmail.com> wrote:
> When booting as a coreboot payload, the framebuffer details are
> passed from coreboot via configuration tables. We save these
> information into vesa_mode_info structure for future use.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  drivers/pci/pci_rom.c       |  2 +-
>  drivers/video/coreboot_fb.c | 24 ++++++++++++++++++++++++
>  include/vbe.h               |  2 ++
>  3 files changed, 27 insertions(+), 1 deletion(-)

Acked-by: Simon Glass <sjg@chromium.org>
Simon Glass Aug. 17, 2015, 10:15 p.m. UTC | #2
On 16 August 2015 at 15:27, Simon Glass <sjg@chromium.org> wrote:
> On 13 August 2015 at 01:29, Bin Meng <bmeng.cn@gmail.com> wrote:
>> When booting as a coreboot payload, the framebuffer details are
>> passed from coreboot via configuration tables. We save these
>> information into vesa_mode_info structure for future use.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>>  drivers/pci/pci_rom.c       |  2 +-
>>  drivers/video/coreboot_fb.c | 24 ++++++++++++++++++++++++
>>  include/vbe.h               |  2 ++
>>  3 files changed, 27 insertions(+), 1 deletion(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Applied to u-boot-x86, thanks!
diff mbox

Patch

diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c
index 26db3ca..b9a3990 100644
--- a/drivers/pci/pci_rom.c
+++ b/drivers/pci/pci_rom.c
@@ -187,7 +187,7 @@  int pci_rom_load(struct pci_rom_header *rom_header,
 	return 0;
 }
 
-static struct vbe_mode_info mode_info;
+struct vbe_mode_info mode_info;
 
 int vbe_get_video_info(struct graphic_device *gdev)
 {
diff --git a/drivers/video/coreboot_fb.c b/drivers/video/coreboot_fb.c
index 56c35c1..4790ef1 100644
--- a/drivers/video/coreboot_fb.c
+++ b/drivers/video/coreboot_fb.c
@@ -9,6 +9,7 @@ 
 #include <common.h>
 #include <asm/arch/tables.h>
 #include <asm/arch/sysinfo.h>
+#include <vbe.h>
 #include <video_fb.h>
 #include "videomodes.h"
 
@@ -17,6 +18,26 @@ 
  */
 GraphicDevice ctfb;
 
+static void save_vesa_mode(void)
+{
+	struct vesa_mode_info *vesa = &mode_info.vesa;
+	struct cb_framebuffer *fb = lib_sysinfo.framebuffer;
+
+	vesa->x_resolution = fb->x_resolution;
+	vesa->y_resolution = fb->y_resolution;
+	vesa->bits_per_pixel = fb->bits_per_pixel;
+	vesa->bytes_per_scanline = fb->bytes_per_line;
+	vesa->phys_base_ptr = fb->physical_address;
+	vesa->red_mask_size = fb->red_mask_size;
+	vesa->red_mask_pos = fb->red_mask_pos;
+	vesa->green_mask_size = fb->green_mask_size;
+	vesa->green_mask_pos = fb->green_mask_pos;
+	vesa->blue_mask_size = fb->blue_mask_size;
+	vesa->blue_mask_pos = fb->blue_mask_pos;
+	vesa->reserved_mask_size = fb->reserved_mask_size;
+	vesa->reserved_mask_pos = fb->reserved_mask_pos;
+}
+
 static int parse_coreboot_table_fb(GraphicDevice *gdev)
 {
 	struct cb_framebuffer *fb = lib_sysinfo.framebuffer;
@@ -81,5 +102,8 @@  void *video_hw_init(void)
 	memset((void *)gdev->pciBase, 0,
 		gdev->winSizeX * gdev->winSizeY * gdev->gdfBytesPP);
 
+	/* Initialize vesa_mode_info structure */
+	save_vesa_mode();
+
 	return (void *)gdev;
 }
diff --git a/include/vbe.h b/include/vbe.h
index 1a86db8..164ccae 100644
--- a/include/vbe.h
+++ b/include/vbe.h
@@ -102,6 +102,8 @@  struct vbe_ddc_info {
 #define VESA_SET_MODE		0x4f02
 #define VESA_GET_CUR_MODE	0x4f03
 
+extern struct vbe_mode_info mode_info;
+
 struct graphic_device;
 int vbe_get_video_info(struct graphic_device *gdev);