[U-Boot] [PATCH 00/11] x86: dm: video: Convert to use DM video drivers on all x86 boards

This adds two new DM video drivers, one for VESA compatible device, the other one for coreboot framebuffer device. All x86 boards have been converted to use the new drivers.
Tested on Intel Crown Bay using an external graphics card, on QEMU using the on-board VGA with DM VESA driver. Tested on QEMU using the on-board VGA with DM coreboot framebuffer driver, U-Boot as coreboot payload.
This series is available at u-boot-x86/video-working.
Bin Meng (11): x86: doc: Document coreboot framebuffer driver issue on QEMU dm: video: Add driver for VESA compatible device dm: video: Output verbose information in vbe_setup_video() x86: Convert to use DM VESA video driver x86: doc: Correct qfw command example vbe: Make vbe_setup_video_priv() public dm: video: Add driver for coreboot framebuffer device dm: video: Don't do anything in alloc_fb() when plat->size is zero x86: coreboot: Convert to use DM coreboot video driver video: Remove legacy VESA and coreboot framebuffer drivers x86: Clean up unused macros in the configuration headers
arch/x86/cpu/coreboot/Kconfig | 4 - arch/x86/dts/bayleybay.dts | 1 + arch/x86/dts/broadwell_som-6896.dts | 1 + arch/x86/dts/chromebook_link.dts | 1 + arch/x86/dts/chromebook_samus.dts | 1 + arch/x86/dts/chromebox_panther.dts | 1 + arch/x86/dts/coreboot_fb.dtsi | 5 + arch/x86/dts/minnowmax.dts | 1 + configs/bayleybay_defconfig | 1 + configs/chromebox_panther_defconfig | 1 + ...conga-qeval20-qa3-e3845-internal-uart_defconfig | 1 + configs/conga-qeval20-qa3-e3845_defconfig | 1 + configs/coreboot-x86_defconfig | 2 + configs/crownbay_defconfig | 1 + configs/dfi-bt700-q7x-151_defconfig | 1 + configs/minnowmax_defconfig | 1 + configs/qemu-x86_defconfig | 1 + configs/qemu-x86_efi_payload32_defconfig | 1 + configs/qemu-x86_efi_payload64_defconfig | 1 + configs/som-db5800-som-6867_defconfig | 1 + configs/theadorable-x86-dfi-bt700_defconfig | 1 + doc/README.x86 | 9 +- drivers/pci/pci_rom.c | 15 ++- drivers/video/Kconfig | 9 ++ drivers/video/Makefile | 4 +- drivers/video/coreboot.c | 79 +++++++++++++++ drivers/video/coreboot_fb.c | 108 --------------------- drivers/video/vesa.c | 34 +++++++ drivers/video/vesa_fb.c | 63 ------------ drivers/video/video-uclass.c | 3 + include/configs/bayleybay.h | 6 +- include/configs/cougarcanyon2.h | 4 - include/configs/crownbay.h | 4 +- include/configs/efi-x86.h | 2 - include/configs/galileo.h | 4 - include/configs/minnowmax.h | 6 +- include/configs/qemu-x86.h | 4 +- include/configs/som-6896.h | 6 +- include/configs/som-db5800-som-6867.h | 6 +- include/configs/x86-chromebook.h | 12 +-- include/configs/x86-common.h | 7 -- include/vbe.h | 4 + 42 files changed, 194 insertions(+), 224 deletions(-) create mode 100644 arch/x86/dts/coreboot_fb.dtsi create mode 100644 drivers/video/coreboot.c delete mode 100644 drivers/video/coreboot_fb.c create mode 100644 drivers/video/vesa.c delete mode 100644 drivers/video/vesa_fb.c

For some unknown reason, coreboot framebuffer driver never works on QEMU since day 1. It seems the driver only works on real hardware. Document this issue.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
doc/README.x86 | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/doc/README.x86 b/doc/README.x86 index ba5bb99..437dc29 100644 --- a/doc/README.x86 +++ b/doc/README.x86 @@ -385,6 +385,9 @@ At present it seems that for Minnowboard Max, coreboot does not pass through the video information correctly (it always says the resolution is 0x0). This works correctly for link though.
+Note: coreboot framebuffer driver does not work on QEMU. The reason is unknown +at this point. Patches are welcome if you figure out anything wrong. + Test with QEMU for bare mode ---------------------------- QEMU is a fancy emulator that can enable us to test U-Boot without access to

On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
For some unknown reason, coreboot framebuffer driver never works on QEMU since day 1. It seems the driver only works on real hardware. Document this issue.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
doc/README.x86 | 3 +++ 1 file changed, 3 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

On Wed, Oct 12, 2016 at 8:06 AM, Simon Glass sjg@chromium.org wrote:
On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
For some unknown reason, coreboot framebuffer driver never works on QEMU since day 1. It seems the driver only works on real hardware. Document this issue.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
doc/README.x86 | 3 +++ 1 file changed, 3 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org
applied to u-boot-x86, thanks!

This adds a DM driver for VESA compatible device.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/video/vesa.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 drivers/video/vesa.c
diff --git a/drivers/video/vesa.c b/drivers/video/vesa.c new file mode 100644 index 0000000..ddf8df8 --- /dev/null +++ b/drivers/video/vesa.c @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2016, Bin Meng bmeng.cn@gmail.com + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <dm.h> +#include <pci.h> +#include <vbe.h> + +static int vesa_video_probe(struct udevice *dev) +{ + return vbe_setup_video(dev, NULL); +} + +static const struct udevice_id vesa_video_ids[] = { + { .compatible = "vesa-fb" }, + { } +}; + +U_BOOT_DRIVER(vesa_video) = { + .name = "vesa_video", + .id = UCLASS_VIDEO, + .of_match = vesa_video_ids, + .probe = vesa_video_probe, +}; + +static struct pci_device_id vesa_video_supported[] = { + { PCI_DEVICE_CLASS(PCI_CLASS_DISPLAY_VGA << 8, ~0) }, + { }, +}; + +U_BOOT_PCI_DEVICE(vesa_video, vesa_video_supported);

On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
This adds a DM driver for VESA compatible device.
nit: VESA-compatible
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/video/vesa.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 drivers/video/vesa.c
Reviewed-by: Simon Glass sjg@chromium.org

On Wed, Oct 12, 2016 at 8:06 AM, Simon Glass sjg@chromium.org wrote:
On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
This adds a DM driver for VESA compatible device.
nit: VESA-compatible
Fixed nits, and
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/video/vesa.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 drivers/video/vesa.c
Reviewed-by: Simon Glass sjg@chromium.org
applied to u-boot-x86, thanks!

With DM conversion, information like "Video: 1024x768x16" is not shown anymore. Now add these verbose output back.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/pci/pci_rom.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c index 21ed17c..5746c3d 100644 --- a/drivers/pci/pci_rom.c +++ b/drivers/pci/pci_rom.c @@ -382,9 +382,13 @@ int vbe_setup_video(struct udevice *dev, int (*int15_handler)(void)) struct video_priv *uc_priv = dev_get_uclass_priv(dev); int ret;
+ printf("Video: "); + /* If we are running from EFI or coreboot, this can't work */ - if (!ll_boot_init()) + if (!ll_boot_init()) { + printf("Not available (previous bootloader prevents it)\n"); return -EPERM; + } bootstage_start(BOOTSTAGE_ID_ACCUM_LCD, "vesa display"); ret = dm_pci_run_vga_bios(dev, int15_handler, PCI_ROM_USE_NATIVE | PCI_ROM_ALLOW_FALLBACK); @@ -400,6 +404,9 @@ int vbe_setup_video(struct udevice *dev, int (*int15_handler)(void)) return ret; }
+ printf("%dx%dx%d\n", uc_priv->xsize, uc_priv->ysize, + mode_info.vesa.bits_per_pixel); + return 0; } #endif

On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
With DM conversion, information like "Video: 1024x768x16" is not shown anymore. Now add these verbose output back.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/pci/pci_rom.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org
Although at some point I'd prefer that this is printed by board_init_r() somehow.

On Wed, Oct 12, 2016 at 8:06 AM, Simon Glass sjg@chromium.org wrote:
On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
With DM conversion, information like "Video: 1024x768x16" is not shown anymore. Now add these verbose output back.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/pci/pci_rom.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org
Although at some point I'd prefer that this is printed by board_init_r() somehow.
applied to u-boot-x86, thanks!

At present only chromebook boards are converted to DM video. Other x86 boards are still using the legacy cfb_console driver. This switches to use DM version drivers.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
configs/bayleybay_defconfig | 1 + configs/chromebox_panther_defconfig | 1 + configs/conga-qeval20-qa3-e3845-internal-uart_defconfig | 1 + configs/conga-qeval20-qa3-e3845_defconfig | 1 + configs/crownbay_defconfig | 1 + configs/dfi-bt700-q7x-151_defconfig | 1 + configs/minnowmax_defconfig | 1 + configs/qemu-x86_defconfig | 1 + configs/qemu-x86_efi_payload32_defconfig | 1 + configs/qemu-x86_efi_payload64_defconfig | 1 + configs/som-db5800-som-6867_defconfig | 1 + configs/theadorable-x86-dfi-bt700_defconfig | 1 + drivers/video/Makefile | 2 +- include/configs/bayleybay.h | 6 +++--- include/configs/crownbay.h | 4 ++-- include/configs/minnowmax.h | 6 +++--- include/configs/qemu-x86.h | 4 ++-- include/configs/som-db5800-som-6867.h | 6 +++--- 18 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/configs/bayleybay_defconfig b/configs/bayleybay_defconfig index 64e3d31..f8f5f5c 100644 --- a/configs/bayleybay_defconfig +++ b/configs/bayleybay_defconfig @@ -53,6 +53,7 @@ CONFIG_TIMER=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_VIDEO=y CONFIG_VIDEO_VESA=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_11A=y diff --git a/configs/chromebox_panther_defconfig b/configs/chromebox_panther_defconfig index 2557d35..6df4d4c 100644 --- a/configs/chromebox_panther_defconfig +++ b/configs/chromebox_panther_defconfig @@ -49,6 +49,7 @@ CONFIG_TPM_TIS_LPC=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_VIDEO=y CONFIG_VIDEO_VESA=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_11A=y diff --git a/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig b/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig index f0da176..6bee9c6 100644 --- a/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig +++ b/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig @@ -61,6 +61,7 @@ CONFIG_TIMER=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_VIDEO=y CONFIG_VIDEO_VESA=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_114=y diff --git a/configs/conga-qeval20-qa3-e3845_defconfig b/configs/conga-qeval20-qa3-e3845_defconfig index 63c2cbd..76ff904 100644 --- a/configs/conga-qeval20-qa3-e3845_defconfig +++ b/configs/conga-qeval20-qa3-e3845_defconfig @@ -60,6 +60,7 @@ CONFIG_TIMER=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_VIDEO=y CONFIG_VIDEO_VESA=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_114=y diff --git a/configs/crownbay_defconfig b/configs/crownbay_defconfig index d0cd9db..b37fce7 100644 --- a/configs/crownbay_defconfig +++ b/configs/crownbay_defconfig @@ -47,6 +47,7 @@ CONFIG_TIMER=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_VIDEO=y CONFIG_VIDEO_VESA=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_USE_PRIVATE_LIBGCC=y diff --git a/configs/dfi-bt700-q7x-151_defconfig b/configs/dfi-bt700-q7x-151_defconfig index 245d0c7..3931896 100644 --- a/configs/dfi-bt700-q7x-151_defconfig +++ b/configs/dfi-bt700-q7x-151_defconfig @@ -58,6 +58,7 @@ CONFIG_TIMER=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_VIDEO=y CONFIG_VIDEO_VESA=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_114=y diff --git a/configs/minnowmax_defconfig b/configs/minnowmax_defconfig index 3d3a30d..1446ab6 100644 --- a/configs/minnowmax_defconfig +++ b/configs/minnowmax_defconfig @@ -57,6 +57,7 @@ CONFIG_TIMER=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_VIDEO=y CONFIG_VIDEO_VESA=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_11A=y diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig index 769adf6..4cf0866 100644 --- a/configs/qemu-x86_defconfig +++ b/configs/qemu-x86_defconfig @@ -44,6 +44,7 @@ CONFIG_TIMER=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_VIDEO=y CONFIG_VIDEO_VESA=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_111=y diff --git a/configs/qemu-x86_efi_payload32_defconfig b/configs/qemu-x86_efi_payload32_defconfig index 75e7203..fd6afb8 100644 --- a/configs/qemu-x86_efi_payload32_defconfig +++ b/configs/qemu-x86_efi_payload32_defconfig @@ -41,6 +41,7 @@ CONFIG_TIMER=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_VIDEO=y CONFIG_VIDEO_VESA=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_111=y diff --git a/configs/qemu-x86_efi_payload64_defconfig b/configs/qemu-x86_efi_payload64_defconfig index 4bcd0dc..c6664b0 100644 --- a/configs/qemu-x86_efi_payload64_defconfig +++ b/configs/qemu-x86_efi_payload64_defconfig @@ -41,6 +41,7 @@ CONFIG_TIMER=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_VIDEO=y CONFIG_VIDEO_VESA=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_111=y diff --git a/configs/som-db5800-som-6867_defconfig b/configs/som-db5800-som-6867_defconfig index 4cfaeda..9fc169d 100644 --- a/configs/som-db5800-som-6867_defconfig +++ b/configs/som-db5800-som-6867_defconfig @@ -55,6 +55,7 @@ CONFIG_TIMER=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_VIDEO=y CONFIG_VIDEO_VESA=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_11A=y diff --git a/configs/theadorable-x86-dfi-bt700_defconfig b/configs/theadorable-x86-dfi-bt700_defconfig index cea91b6..43dc2fa 100644 --- a/configs/theadorable-x86-dfi-bt700_defconfig +++ b/configs/theadorable-x86-dfi-bt700_defconfig @@ -55,6 +55,7 @@ CONFIG_TIMER=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_VIDEO=y CONFIG_VIDEO_VESA=y CONFIG_FRAMEBUFFER_SET_VESA_MODE=y CONFIG_FRAMEBUFFER_VESA_MODE_114=y diff --git a/drivers/video/Makefile b/drivers/video/Makefile index b888e99..8a99d24 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -58,7 +58,7 @@ obj-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o videomodes.o obj-$(CONFIG_VIDEO_TEGRA20) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o -obj-$(CONFIG_VIDEO_VESA) += vesa_fb.o +obj-$(CONFIG_VIDEO_VESA) += vesa.o obj-$(CONFIG_FORMIKE) += formike.o obj-$(CONFIG_LG4573) += lg4573.o obj-$(CONFIG_AM335X_LCD) += am335x-fb.o diff --git a/include/configs/bayleybay.h b/include/configs/bayleybay.h index 8f31436..40b13d1 100644 --- a/include/configs/bayleybay.h +++ b/include/configs/bayleybay.h @@ -18,9 +18,9 @@
#define CONFIG_PCI_PNP
-#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,vga,usbkbd\0" \ - "stdout=serial,vga\0" \ - "stderr=serial,vga\0" +#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,usbkbd\0" \ + "stdout=serial,vidconsole\0" \ + "stderr=serial,vidconsole\0"
#define CONFIG_SCSI_DEV_LIST \ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_VALLEYVIEW_SATA}, \ diff --git a/include/configs/crownbay.h b/include/configs/crownbay.h index 49ed3ef..64ad736 100644 --- a/include/configs/crownbay.h +++ b/include/configs/crownbay.h @@ -22,8 +22,8 @@ #define CONFIG_PCI_PNP
#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,i8042-kbd,usbkbd\0" \ - "stdout=serial,vga\0" \ - "stderr=serial,vga\0" + "stdout=serial,vidconsole\0" \ + "stderr=serial,vidconsole\0"
#define CONFIG_SCSI_DEV_LIST \ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TCF_SATA} diff --git a/include/configs/minnowmax.h b/include/configs/minnowmax.h index 95ad128..935c88d 100644 --- a/include/configs/minnowmax.h +++ b/include/configs/minnowmax.h @@ -20,9 +20,9 @@ #define CONFIG_SMSC_LPC47M
#define CONFIG_PCI_PNP -#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,vga,serial\0" \ - "stdout=vga,serial\0" \ - "stderr=vga,serial\0" +#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,serial\0" \ + "stdout=vidconsole,serial\0" \ + "stderr=vidconsole,serial\0"
#define CONFIG_SCSI_DEV_LIST \ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_VALLEYVIEW_SATA}, \ diff --git a/include/configs/qemu-x86.h b/include/configs/qemu-x86.h index 476d37d..a2dd79b 100644 --- a/include/configs/qemu-x86.h +++ b/include/configs/qemu-x86.h @@ -19,8 +19,8 @@ #define CONFIG_PCI_PNP
#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,i8042-kbd\0" \ - "stdout=serial,vga\0" \ - "stderr=serial,vga\0" + "stdout=serial,vidconsole\0" \ + "stderr=serial,vidconsole\0"
/* * ATA/SATA support for QEMU x86 targets diff --git a/include/configs/som-db5800-som-6867.h b/include/configs/som-db5800-som-6867.h index a4b343e..a13be14 100644 --- a/include/configs/som-db5800-som-6867.h +++ b/include/configs/som-db5800-som-6867.h @@ -19,9 +19,9 @@ #define CONFIG_ARCH_MISC_INIT
#define CONFIG_PCI_PNP -#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,usbkbd,vga\0" \ - "stdout=serial,vga\0" \ - "stderr=serial,vga\0" +#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,usbkbd\0" \ + "stdout=serial,vidconsole\0" \ + "stderr=serial,vidconsole\0"
#define CONFIG_SCSI_DEV_LIST \ {PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_VALLEYVIEW_SATA}, \

On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
At present only chromebook boards are converted to DM video. Other x86 boards are still using the legacy cfb_console driver. This switches to use DM version drivers.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
configs/bayleybay_defconfig | 1 + configs/chromebox_panther_defconfig | 1 + configs/conga-qeval20-qa3-e3845-internal-uart_defconfig | 1 + configs/conga-qeval20-qa3-e3845_defconfig | 1 + configs/crownbay_defconfig | 1 + configs/dfi-bt700-q7x-151_defconfig | 1 + configs/minnowmax_defconfig | 1 + configs/qemu-x86_defconfig | 1 + configs/qemu-x86_efi_payload32_defconfig | 1 + configs/qemu-x86_efi_payload64_defconfig | 1 + configs/som-db5800-som-6867_defconfig | 1 + configs/theadorable-x86-dfi-bt700_defconfig | 1 + drivers/video/Makefile | 2 +- include/configs/bayleybay.h | 6 +++--- include/configs/crownbay.h | 4 ++-- include/configs/minnowmax.h | 6 +++--- include/configs/qemu-x86.h | 4 ++-- include/configs/som-db5800-som-6867.h | 6 +++--- 18 files changed, 26 insertions(+), 14 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Wed, Oct 12, 2016 at 8:06 AM, Simon Glass sjg@chromium.org wrote:
On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
At present only chromebook boards are converted to DM video. Other x86 boards are still using the legacy cfb_console driver. This switches to use DM version drivers.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
configs/bayleybay_defconfig | 1 + configs/chromebox_panther_defconfig | 1 + configs/conga-qeval20-qa3-e3845-internal-uart_defconfig | 1 + configs/conga-qeval20-qa3-e3845_defconfig | 1 + configs/crownbay_defconfig | 1 + configs/dfi-bt700-q7x-151_defconfig | 1 + configs/minnowmax_defconfig | 1 + configs/qemu-x86_defconfig | 1 + configs/qemu-x86_efi_payload32_defconfig | 1 + configs/qemu-x86_efi_payload64_defconfig | 1 + configs/som-db5800-som-6867_defconfig | 1 + configs/theadorable-x86-dfi-bt700_defconfig | 1 + drivers/video/Makefile | 2 +- include/configs/bayleybay.h | 6 +++--- include/configs/crownbay.h | 4 ++-- include/configs/minnowmax.h | 6 +++--- include/configs/qemu-x86.h | 4 ++-- include/configs/som-db5800-som-6867.h | 6 +++--- 18 files changed, 26 insertions(+), 14 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
applied to u-boot-x86, thanks!

The kernel load address for zboot should be 0x1000000.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
doc/README.x86 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/README.x86 b/doc/README.x86 index 437dc29..c34f455 100644 --- a/doc/README.x86 +++ b/doc/README.x86 @@ -449,7 +449,7 @@ loading kernel to address 01000000 size 5d9d30 initrd 04000000 size 1b1ab50 Here the kernel (bzImage) is loaded to 01000000 and initrd is to 04000000. Then, 'zboot' can be used to boot the kernel:
-=> zboot 02000000 - 04000000 1b1ab50 +=> zboot 01000000 - 04000000 1b1ab50
CPU Microcode -------------

On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
The kernel load address for zboot should be 0x1000000.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
doc/README.x86 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Wed, Oct 12, 2016 at 8:06 AM, Simon Glass sjg@chromium.org wrote:
On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
The kernel load address for zboot should be 0x1000000.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
doc/README.x86 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org
applied to u-boot-x86, thanks!

vbe_setup_video_priv() might be useful to other drivers.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/pci/pci_rom.c | 6 +++--- include/vbe.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c index 5746c3d..cd083f7 100644 --- a/drivers/pci/pci_rom.c +++ b/drivers/pci/pci_rom.c @@ -351,9 +351,9 @@ err: }
#ifdef CONFIG_DM_VIDEO -static int vbe_setup_video_priv(struct vesa_mode_info *vesa, - struct video_priv *uc_priv, - struct video_uc_platdata *plat) +int vbe_setup_video_priv(struct vesa_mode_info *vesa, + struct video_priv *uc_priv, + struct video_uc_platdata *plat) { if (!vesa->x_resolution) return -ENXIO; diff --git a/include/vbe.h b/include/vbe.h index a743892..16bb096 100644 --- a/include/vbe.h +++ b/include/vbe.h @@ -107,6 +107,10 @@ extern struct vbe_mode_info mode_info; struct graphic_device; int vbe_get_video_info(struct graphic_device *gdev); struct video_priv; +struct video_uc_platdata; +int vbe_setup_video_priv(struct vesa_mode_info *vesa, + struct video_priv *uc_priv, + struct video_uc_platdata *plat); int vbe_setup_video(struct udevice *dev, int (*int15_handler)(void));
#endif

On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
vbe_setup_video_priv() might be useful to other drivers.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/pci/pci_rom.c | 6 +++--- include/vbe.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Wed, Oct 12, 2016 at 8:06 AM, Simon Glass sjg@chromium.org wrote:
On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
vbe_setup_video_priv() might be useful to other drivers.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/pci/pci_rom.c | 6 +++--- include/vbe.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
applied to u-boot-x86, thanks!

This adds a DM driver for coreboot framebuffer device.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/video/Kconfig | 9 ++++++ drivers/video/coreboot.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 drivers/video/coreboot.c
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index fd26690..554a03f 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -101,6 +101,15 @@ config VIDCONSOLE_AS_LCD to update the environment, the breakage may be confusing for users. This option will be removed around the end of 2016.
+config VIDEO_COREBOOT + bool "Enable coreboot framebuffer driver support" + depends on X86 && SYS_COREBOOT + help + Turn on this option to enable a framebuffer driver when U-Boot is + loaded by coreboot where graphics device is configured by coreboot + already. This can in principle be used with any platform that + coreboot supports. + config VIDEO_VESA bool "Enable VESA video driver support" default n diff --git a/drivers/video/coreboot.c b/drivers/video/coreboot.c new file mode 100644 index 0000000..3a94aa1 --- /dev/null +++ b/drivers/video/coreboot.c @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2016, Bin Meng bmeng.cn@gmail.com + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <dm.h> +#include <vbe.h> +#include <video.h> +#include <asm/arch/sysinfo.h> + +static int save_vesa_mode(struct cb_framebuffer *fb, + struct vesa_mode_info *vesa) +{ + /* + * If there is no framebuffer structure, bail out and keep + * running on the serial console. + */ + if (!fb) + return -ENXIO; + + 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; + + return 0; +} + +static int coreboot_video_probe(struct udevice *dev) +{ + struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_priv *uc_priv = dev_get_uclass_priv(dev); + struct cb_framebuffer *fb = lib_sysinfo.framebuffer; + struct vesa_mode_info *vesa = &mode_info.vesa; + int ret; + + printf("Video: "); + + /* Initialize vesa_mode_info structure */ + ret = save_vesa_mode(fb, vesa); + if (ret) + goto err; + + ret = vbe_setup_video_priv(vesa, uc_priv, plat); + if (ret) + goto err; + + printf("%dx%dx%d\n", uc_priv->xsize, uc_priv->ysize, + vesa->bits_per_pixel); + + return 0; + +err: + printf("No video mode configured in coreboot!\n"); + return ret; +} + +static const struct udevice_id coreboot_video_ids[] = { + { .compatible = "coreboot-fb" }, + { } +}; + +U_BOOT_DRIVER(coreboot_video) = { + .name = "coreboot_video", + .id = UCLASS_VIDEO, + .of_match = coreboot_video_ids, + .probe = coreboot_video_probe, +};

On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
This adds a DM driver for coreboot framebuffer device.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/video/Kconfig | 9 ++++++ drivers/video/coreboot.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 drivers/video/coreboot.c
Reviewed-by: Simon Glass sjg@chromium.org
Nice!
Nits below
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index fd26690..554a03f 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -101,6 +101,15 @@ config VIDCONSOLE_AS_LCD to update the environment, the breakage may be confusing for users. This option will be removed around the end of 2016.
+config VIDEO_COREBOOT
bool "Enable coreboot framebuffer driver support"
depends on X86 && SYS_COREBOOT
help
Turn on this option to enable a framebuffer driver when U-Boot is
loaded by coreboot where graphics device is configured by coreboot
where the graphics device
already. This can in principle be used with any platform that
coreboot supports.
config VIDEO_VESA bool "Enable VESA video driver support" default n diff --git a/drivers/video/coreboot.c b/drivers/video/coreboot.c new file mode 100644 index 0000000..3a94aa1 --- /dev/null +++ b/drivers/video/coreboot.c @@ -0,0 +1,79 @@ +/*
- Copyright (C) 2016, Bin Meng bmeng.cn@gmail.com
- SPDX-License-Identifier: GPL-2.0+
- */
+#include <common.h> +#include <dm.h> +#include <vbe.h> +#include <video.h> +#include <asm/arch/sysinfo.h>
+static int save_vesa_mode(struct cb_framebuffer *fb,
struct vesa_mode_info *vesa)
+{
/*
* If there is no framebuffer structure, bail out and keep
* running on the serial console.
*/
if (!fb)
return -ENXIO;
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;
return 0;
+}
+static int coreboot_video_probe(struct udevice *dev) +{
struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
struct video_priv *uc_priv = dev_get_uclass_priv(dev);
struct cb_framebuffer *fb = lib_sysinfo.framebuffer;
struct vesa_mode_info *vesa = &mode_info.vesa;
int ret;
printf("Video: ");
/* Initialize vesa_mode_info structure */
ret = save_vesa_mode(fb, vesa);
if (ret)
goto err;
ret = vbe_setup_video_priv(vesa, uc_priv, plat);
if (ret)
goto err;
printf("%dx%dx%d\n", uc_priv->xsize, uc_priv->ysize,
vesa->bits_per_pixel);
Again at some point (later) it would be good to avoid printing info in drivers.
return 0;
+err:
printf("No video mode configured in coreboot!\n");
return ret;
+}
+static const struct udevice_id coreboot_video_ids[] = {
{ .compatible = "coreboot-fb" },
{ }
+};
+U_BOOT_DRIVER(coreboot_video) = {
.name = "coreboot_video",
.id = UCLASS_VIDEO,
.of_match = coreboot_video_ids,
.probe = coreboot_video_probe,
+};
2.9.2
Regards, Simon

On Wed, Oct 12, 2016 at 8:06 AM, Simon Glass sjg@chromium.org wrote:
On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
This adds a DM driver for coreboot framebuffer device.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/video/Kconfig | 9 ++++++ drivers/video/coreboot.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 drivers/video/coreboot.c
Reviewed-by: Simon Glass sjg@chromium.org
Nice!
Nits below
Fixed nits and applied to u-boot-x86, thanks!

With DM VESA driver on x86 boards, plat->base/size/align are all zeroes and starting address passed to alloc_fb() happens to be 1MB aligned, so this routine does not trigger any issue. On QEMU with U-Boot as coreboot payload, the starting address is within 1MB range (eg: 0x7fb0000), thus causes failure in video_post_bind().
Actually if plat->size is zero, it makes no sense to do anything in this routine. Add such check there.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/video/video-uclass.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index b6dd0f5..11ca793 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -54,6 +54,9 @@ static ulong alloc_fb(struct udevice *dev, ulong *addrp) struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); ulong base, align, size;
+ if (!plat->size) + return 0; + align = plat->align ? plat->align : 1 << 20; base = *addrp - plat->size; base &= ~(align - 1);

On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
With DM VESA driver on x86 boards, plat->base/size/align are all zeroes and starting address passed to alloc_fb() happens to be 1MB aligned, so this routine does not trigger any issue. On QEMU with U-Boot as coreboot payload, the starting address is within 1MB range (eg: 0x7fb0000), thus causes failure in video_post_bind().
Actually if plat->size is zero, it makes no sense to do anything in this routine. Add such check there.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/video/video-uclass.c | 3 +++ 1 file changed, 3 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

On Wed, Oct 12, 2016 at 8:06 AM, Simon Glass sjg@chromium.org wrote:
On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
With DM VESA driver on x86 boards, plat->base/size/align are all zeroes and starting address passed to alloc_fb() happens to be 1MB aligned, so this routine does not trigger any issue. On QEMU with U-Boot as coreboot payload, the starting address is within 1MB range (eg: 0x7fb0000), thus causes failure in video_post_bind().
Actually if plat->size is zero, it makes no sense to do anything in this routine. Add such check there.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/video/video-uclass.c | 3 +++ 1 file changed, 3 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org
applied to u-boot-x86, thanks!

This converts coreboot to use DM framebuffer driver.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
arch/x86/cpu/coreboot/Kconfig | 4 ---- arch/x86/dts/bayleybay.dts | 1 + arch/x86/dts/broadwell_som-6896.dts | 1 + arch/x86/dts/chromebook_link.dts | 1 + arch/x86/dts/chromebook_samus.dts | 1 + arch/x86/dts/chromebox_panther.dts | 1 + arch/x86/dts/coreboot_fb.dtsi | 5 +++++ arch/x86/dts/minnowmax.dts | 1 + configs/coreboot-x86_defconfig | 2 ++ doc/README.x86 | 4 ++++ drivers/video/Makefile | 2 +- include/configs/som-6896.h | 6 +++--- 12 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 arch/x86/dts/coreboot_fb.dtsi
diff --git a/arch/x86/cpu/coreboot/Kconfig b/arch/x86/cpu/coreboot/Kconfig index e0e3c64..4b3601f 100644 --- a/arch/x86/cpu/coreboot/Kconfig +++ b/arch/x86/cpu/coreboot/Kconfig @@ -8,8 +8,4 @@ config CBMEM_CONSOLE bool default y
-config VIDEO_COREBOOT - bool - default y - endif diff --git a/arch/x86/dts/bayleybay.dts b/arch/x86/dts/bayleybay.dts index c8907ce..18b310d 100644 --- a/arch/x86/dts/bayleybay.dts +++ b/arch/x86/dts/bayleybay.dts @@ -14,6 +14,7 @@ /include/ "serial.dtsi" /include/ "rtc.dtsi" /include/ "tsc_timer.dtsi" +/include/ "coreboot_fb.dtsi"
/ { model = "Intel Bayley Bay"; diff --git a/arch/x86/dts/broadwell_som-6896.dts b/arch/x86/dts/broadwell_som-6896.dts index 4bb0a34..3966199 100644 --- a/arch/x86/dts/broadwell_som-6896.dts +++ b/arch/x86/dts/broadwell_som-6896.dts @@ -4,6 +4,7 @@ /include/ "serial.dtsi" /include/ "rtc.dtsi" /include/ "tsc_timer.dtsi" +/include/ "coreboot_fb.dtsi"
/ { model = "Advantech SOM-6896"; diff --git a/arch/x86/dts/chromebook_link.dts b/arch/x86/dts/chromebook_link.dts index fb1b31d..b932340 100644 --- a/arch/x86/dts/chromebook_link.dts +++ b/arch/x86/dts/chromebook_link.dts @@ -7,6 +7,7 @@ /include/ "serial.dtsi" /include/ "rtc.dtsi" /include/ "tsc_timer.dtsi" +/include/ "coreboot_fb.dtsi"
/ { model = "Google Link"; diff --git a/arch/x86/dts/chromebook_samus.dts b/arch/x86/dts/chromebook_samus.dts index 5dd3e57..52a9ea6 100644 --- a/arch/x86/dts/chromebook_samus.dts +++ b/arch/x86/dts/chromebook_samus.dts @@ -7,6 +7,7 @@ /include/ "serial.dtsi" /include/ "rtc.dtsi" /include/ "tsc_timer.dtsi" +/include/ "coreboot_fb.dtsi"
/ { model = "Google Samus"; diff --git a/arch/x86/dts/chromebox_panther.dts b/arch/x86/dts/chromebox_panther.dts index 480b366..b25c919 100644 --- a/arch/x86/dts/chromebox_panther.dts +++ b/arch/x86/dts/chromebox_panther.dts @@ -4,6 +4,7 @@ /include/ "serial.dtsi" /include/ "rtc.dtsi" /include/ "tsc_timer.dtsi" +/include/ "coreboot_fb.dtsi"
/ { model = "Google Panther"; diff --git a/arch/x86/dts/coreboot_fb.dtsi b/arch/x86/dts/coreboot_fb.dtsi new file mode 100644 index 0000000..7d72f18 --- /dev/null +++ b/arch/x86/dts/coreboot_fb.dtsi @@ -0,0 +1,5 @@ +/ { + coreboot-fb { + compatible = "coreboot-fb"; + }; +}; diff --git a/arch/x86/dts/minnowmax.dts b/arch/x86/dts/minnowmax.dts index 1a8a8cc..d51318b 100644 --- a/arch/x86/dts/minnowmax.dts +++ b/arch/x86/dts/minnowmax.dts @@ -13,6 +13,7 @@ /include/ "serial.dtsi" /include/ "rtc.dtsi" /include/ "tsc_timer.dtsi" +/include/ "coreboot_fb.dtsi"
/ { model = "Intel Minnowboard Max"; diff --git a/configs/coreboot-x86_defconfig b/configs/coreboot-x86_defconfig index 378d75f..b33c5c4 100644 --- a/configs/coreboot-x86_defconfig +++ b/configs/coreboot-x86_defconfig @@ -40,5 +40,7 @@ CONFIG_TPM_TIS_LPC=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_VIDEO=y +CONFIG_VIDEO_COREBOOT=y CONFIG_USE_PRIVATE_LIBGCC=y CONFIG_TPM=y diff --git a/doc/README.x86 b/doc/README.x86 index c34f455..6799559 100644 --- a/doc/README.x86 +++ b/doc/README.x86 @@ -381,6 +381,10 @@ To enable video you must enable these options in coreboot: - Set framebuffer graphics resolution (1280x1024 32k-color (1:5:5)) - Keep VESA framebuffer
+And include coreboot_fb.dtsi in your board's device tree source file, like: + + /include/ "coreboot_fb.dtsi" + At present it seems that for Minnowboard Max, coreboot does not pass through the video information correctly (it always says the resolution is 0x0). This works correctly for link though. diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 8a99d24..4a42417 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -37,7 +37,7 @@ obj-$(CONFIG_S6E63D6) += s6e63d6.o obj-$(CONFIG_LD9040) += ld9040.o obj-$(CONFIG_SED156X) += sed156x.o obj-$(CONFIG_VIDEO_BCM2835) += bcm2835.o -obj-$(CONFIG_VIDEO_COREBOOT) += coreboot_fb.o +obj-$(CONFIG_VIDEO_COREBOOT) += coreboot.o obj-$(CONFIG_VIDEO_CT69000) += ct69000.o videomodes.o obj-$(CONFIG_VIDEO_DA8XX) += da8xx-fb.o videomodes.o obj-$(CONFIG_VIDEO_IMX25LCDC) += imx25lcdc.o videomodes.o diff --git a/include/configs/som-6896.h b/include/configs/som-6896.h index 43a9623..d058603 100644 --- a/include/configs/som-6896.h +++ b/include/configs/som-6896.h @@ -27,9 +27,9 @@
#define CONFIG_ARCH_EARLY_INIT_R
-#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,vga,usbkbd\0" \ - "stdout=serial,vga\0" \ - "stderr=serial,vga\0" +#define CONFIG_STD_DEVICES_SETTINGS "stdin=serial,usbkbd\0" \ + "stdout=serial,vidconsole\0" \ + "stderr=serial,vidconsole\0"
#define CONFIG_ENV_SECT_SIZE 0x1000 #define CONFIG_ENV_OFFSET 0x00ff0000

On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
This converts coreboot to use DM framebuffer driver.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
arch/x86/cpu/coreboot/Kconfig | 4 ---- arch/x86/dts/bayleybay.dts | 1 + arch/x86/dts/broadwell_som-6896.dts | 1 + arch/x86/dts/chromebook_link.dts | 1 + arch/x86/dts/chromebook_samus.dts | 1 + arch/x86/dts/chromebox_panther.dts | 1 + arch/x86/dts/coreboot_fb.dtsi | 5 +++++ arch/x86/dts/minnowmax.dts | 1 + configs/coreboot-x86_defconfig | 2 ++ doc/README.x86 | 4 ++++ drivers/video/Makefile | 2 +- include/configs/som-6896.h | 6 +++--- 12 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 arch/x86/dts/coreboot_fb.dtsi
Reviewed-by: Simon Glass sjg@chromium.org

On Wed, Oct 12, 2016 at 8:06 AM, Simon Glass sjg@chromium.org wrote:
On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
This converts coreboot to use DM framebuffer driver.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
arch/x86/cpu/coreboot/Kconfig | 4 ---- arch/x86/dts/bayleybay.dts | 1 + arch/x86/dts/broadwell_som-6896.dts | 1 + arch/x86/dts/chromebook_link.dts | 1 + arch/x86/dts/chromebook_samus.dts | 1 + arch/x86/dts/chromebox_panther.dts | 1 + arch/x86/dts/coreboot_fb.dtsi | 5 +++++ arch/x86/dts/minnowmax.dts | 1 + configs/coreboot-x86_defconfig | 2 ++ doc/README.x86 | 4 ++++ drivers/video/Makefile | 2 +- include/configs/som-6896.h | 6 +++--- 12 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 arch/x86/dts/coreboot_fb.dtsi
Reviewed-by: Simon Glass sjg@chromium.org
applied to u-boot-x86, thanks!

Now that all x86 boards have been converted to DM video, drop the legacy drivers.
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/video/coreboot_fb.c | 108 -------------------------------------------- drivers/video/vesa_fb.c | 63 -------------------------- 2 files changed, 171 deletions(-) delete mode 100644 drivers/video/coreboot_fb.c delete mode 100644 drivers/video/vesa_fb.c
diff --git a/drivers/video/coreboot_fb.c b/drivers/video/coreboot_fb.c deleted file mode 100644 index feb5463..0000000 --- a/drivers/video/coreboot_fb.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * coreboot Framebuffer driver. - * - * Copyright (C) 2011 The Chromium OS authors - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <asm/arch/sysinfo.h> -#include <vbe.h> -#include <video_fb.h> -#include "videomodes.h" - -/* - * The Graphic Device - */ -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; - - /* If there is no framebuffer structure, bail out and keep - * running on the serial console. - */ - if (!fb) - return 0; - - gdev->winSizeX = fb->x_resolution; - gdev->winSizeY = fb->y_resolution; - - gdev->plnSizeX = fb->x_resolution; - gdev->plnSizeY = fb->y_resolution; - - gdev->gdfBytesPP = fb->bits_per_pixel / 8; - - switch (fb->bits_per_pixel) { - case 24: - gdev->gdfIndex = GDF_32BIT_X888RGB; - break; - case 16: - gdev->gdfIndex = GDF_16BIT_565RGB; - break; - default: - gdev->gdfIndex = GDF__8BIT_INDEX; - break; - } - - gdev->isaBase = CONFIG_SYS_ISA_IO_BASE_ADDRESS; - gdev->pciBase = (unsigned int)fb->physical_address; - - gdev->frameAdrs = (unsigned int)fb->physical_address; - gdev->memSize = fb->bytes_per_line * fb->y_resolution; - - gdev->vprBase = (unsigned int)fb->physical_address; - gdev->cprBase = (unsigned int)fb->physical_address; - - return 1; -} - -void *video_hw_init(void) -{ - GraphicDevice *gdev = &ctfb; - int bits_per_pixel; - - printf("Video: "); - - if (!parse_coreboot_table_fb(gdev)) { - printf("No video mode configured in coreboot!\n"); - return NULL; - } - - bits_per_pixel = gdev->gdfBytesPP * 8; - - /* fill in Graphic device struct */ - sprintf(gdev->modeIdent, "%dx%dx%d", gdev->winSizeX, gdev->winSizeY, - bits_per_pixel); - printf("%s\n", gdev->modeIdent); - - 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/drivers/video/vesa_fb.c b/drivers/video/vesa_fb.c deleted file mode 100644 index 021c1d6..0000000 --- a/drivers/video/vesa_fb.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * VESA frame buffer driver - * - * Copyright (C) 2014 Google, Inc - * - * SPDX-License-Identifier: GPL-2.0+ - */ - -#include <common.h> -#include <pci_rom.h> -#include <video_fb.h> -#include <vbe.h> - -/* - * The Graphic Device - */ -GraphicDevice ctfb; - -void *video_hw_init(void) -{ - GraphicDevice *gdev = &ctfb; - struct udevice *dev; - int bits_per_pixel; - int ret; - - printf("Video: "); - if (!ll_boot_init()) { - /* - * If we are running from EFI or coreboot, this driver can't - * work. - */ - printf("Not available (previous bootloader prevents it)\n"); - return NULL; - } - if (vbe_get_video_info(gdev)) { - ret = dm_pci_find_class(PCI_CLASS_DISPLAY_VGA << 8, 0, &dev); - if (ret) { - printf("no card detected\n"); - return NULL; - } - bootstage_start(BOOTSTAGE_ID_ACCUM_LCD, "vesa display"); - ret = dm_pci_run_vga_bios(dev, NULL, PCI_ROM_USE_NATIVE | - PCI_ROM_ALLOW_FALLBACK); - bootstage_accum(BOOTSTAGE_ID_ACCUM_LCD); - if (ret) { - printf("failed to run video BIOS: %d\n", ret); - return NULL; - } - } - - if (vbe_get_video_info(gdev)) { - printf("No video mode configured\n"); - return NULL; - } - - bits_per_pixel = gdev->gdfBytesPP * 8; - sprintf(gdev->modeIdent, "%dx%dx%d", gdev->winSizeX, gdev->winSizeY, - bits_per_pixel); - printf("%s\n", gdev->modeIdent); - debug("Frame buffer at %x\n", gdev->pciBase); - - return (void *)gdev; -}

On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
Now that all x86 boards have been converted to DM video, drop the legacy drivers.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/video/coreboot_fb.c | 108 -------------------------------------------- drivers/video/vesa_fb.c | 63 -------------------------- 2 files changed, 171 deletions(-) delete mode 100644 drivers/video/coreboot_fb.c delete mode 100644 drivers/video/vesa_fb.c
Reviewed-by: Simon Glass sjg@chromium.org
This is great!

On Wed, Oct 12, 2016 at 8:06 AM, Simon Glass sjg@chromium.org wrote:
On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
Now that all x86 boards have been converted to DM video, drop the legacy drivers.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/video/coreboot_fb.c | 108 -------------------------------------------- drivers/video/vesa_fb.c | 63 -------------------------- 2 files changed, 171 deletions(-) delete mode 100644 drivers/video/coreboot_fb.c delete mode 100644 drivers/video/vesa_fb.c
Reviewed-by: Simon Glass sjg@chromium.org
This is great!
applied to u-boot-x86, thanks!

Legacy video driver macros are not needed. Clean them up.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
---
include/configs/cougarcanyon2.h | 4 ---- include/configs/efi-x86.h | 2 -- include/configs/galileo.h | 4 ---- include/configs/x86-chromebook.h | 12 +++--------- include/configs/x86-common.h | 7 ------- 5 files changed, 3 insertions(+), 26 deletions(-)
diff --git a/include/configs/cougarcanyon2.h b/include/configs/cougarcanyon2.h index 88845dc..d20ad96 100644 --- a/include/configs/cougarcanyon2.h +++ b/include/configs/cougarcanyon2.h @@ -27,8 +27,4 @@ #define CONFIG_ENV_SECT_SIZE 0x1000 #define CONFIG_ENV_OFFSET 0x5ff000
-/* Video is not supported for now */ -#undef CONFIG_VIDEO -#undef CONFIG_CFB_CONSOLE - #endif /* __CONFIG_H */ diff --git a/include/configs/efi-x86.h b/include/configs/efi-x86.h index 95e46c5..5626061 100644 --- a/include/configs/efi-x86.h +++ b/include/configs/efi-x86.h @@ -15,8 +15,6 @@
#undef CONFIG_ENV_IS_IN_SPI_FLASH #define CONFIG_ENV_IS_NOWHERE -#undef CONFIG_VIDEO -#undef CONFIG_CFB_CONSOLE #undef CONFIG_SCSI_AHCI #undef CONFIG_SCSI #undef CONFIG_INTEL_ICH6_GPIO diff --git a/include/configs/galileo.h b/include/configs/galileo.h index 40f7fba..034142c 100644 --- a/include/configs/galileo.h +++ b/include/configs/galileo.h @@ -31,10 +31,6 @@ #undef CONFIG_SCSI_AHCI #undef CONFIG_SCSI
-/* Video is not supported in Quark SoC */ -#undef CONFIG_VIDEO -#undef CONFIG_CFB_CONSOLE - /* SD/MMC support */ #define CONFIG_MMC #define CONFIG_SDHCI diff --git a/include/configs/x86-chromebook.h b/include/configs/x86-chromebook.h index 7fba716..4bcebfc 100644 --- a/include/configs/x86-chromebook.h +++ b/include/configs/x86-chromebook.h @@ -53,14 +53,8 @@
#define CONFIG_SYS_WHITE_ON_BLACK
-#ifdef CONFIG_DM_VIDEO -#define VIDEO_DEV "vidconsole" -#else -#define VIDEO_DEV "vga" -#endif - -#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,i8042-kbd,serial\0" \ - "stdout=" VIDEO_DEV ",serial\0" \ - "stderr=" VIDEO_DEV ",serial\0" +#define CONFIG_STD_DEVICES_SETTINGS "stdin=usbkbd,i8042-kbd,serial\0" \ + "stdout=vidconsole,serial\0" \ + "stderr=vidconsole,serial\0"
#endif diff --git a/include/configs/x86-common.h b/include/configs/x86-common.h index 96c53b8..3926541 100644 --- a/include/configs/x86-common.h +++ b/include/configs/x86-common.h @@ -131,13 +131,6 @@ /*----------------------------------------------------------------------- * Video Configuration */ -#ifndef CONFIG_DM_VIDEO -#define CONFIG_VIDEO -#define CONFIG_VIDEO_SW_CURSOR -#define VIDEO_FB_16BPP_WORD_SWAP -#define CONFIG_VGA_AS_SINGLE_DEVICE -#define CONFIG_CFB_CONSOLE -#endif #define CONFIG_CONSOLE_SCROLL_LINES 5
/*-----------------------------------------------------------------------

On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
Legacy video driver macros are not needed. Clean them up.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
include/configs/cougarcanyon2.h | 4 ---- include/configs/efi-x86.h | 2 -- include/configs/galileo.h | 4 ---- include/configs/x86-chromebook.h | 12 +++--------- include/configs/x86-common.h | 7 ------- 5 files changed, 3 insertions(+), 26 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Wed, Oct 12, 2016 at 8:06 AM, Simon Glass sjg@chromium.org wrote:
On 9 October 2016 at 05:14, Bin Meng bmeng.cn@gmail.com wrote:
Legacy video driver macros are not needed. Clean them up.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
include/configs/cougarcanyon2.h | 4 ---- include/configs/efi-x86.h | 2 -- include/configs/galileo.h | 4 ---- include/configs/x86-chromebook.h | 12 +++--------- include/configs/x86-common.h | 7 ------- 5 files changed, 3 insertions(+), 26 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
applied to u-boot-x86, thanks!
participants (2)
-
Bin Meng
-
Simon Glass