All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 07/10] x86: Add a VESA video driver
Date: Mon, 29 Dec 2014 19:32:28 -0700	[thread overview]
Message-ID: <1419906751-29776-8-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1419906751-29776-1-git-send-email-sjg@chromium.org>

Add a driver intended to cope with any VESA-compatible x86 graphics
adapter. It will not support ROMs which use OpenFirmware (Forth) since
there is no support for that in U-Boot. This means that MAC OS cards
will not work.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/video/Makefile  |  1 +
 drivers/video/vesa_fb.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 drivers/video/vesa_fb.c

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 975d136..91c954f 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o
 obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o
 obj-$(CONFIG_VIDEO_TEGRA) += tegra.o
 obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o
+obj-$(CONFIG_VIDEO_VESA) += vesa_fb.o
 obj-$(CONFIG_VIDEO_X86) += x86_fb.o
 obj-$(CONFIG_FORMIKE) += formike.o
 obj-$(CONFIG_AM335X_LCD) += am335x-fb.o
diff --git a/drivers/video/vesa_fb.c b/drivers/video/vesa_fb.c
new file mode 100644
index 0000000..3dacafd
--- /dev/null
+++ b/drivers/video/vesa_fb.c
@@ -0,0 +1,64 @@
+/*
+ *
+ * Vesa frame buffer driver for x86
+ *
+ * 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;
+
+/* Devices to allow - only the last one works fully */
+struct pci_device_id vesa_video_ids[] = {
+	{ .vendor = 0x102b, .device = 0x0525 },
+	{ .vendor = 0x1002, .device = 0x5159 },
+	{ .vendor = 0x1002, .device = 0x4752 },
+	{ .vendor = 0x1002, .device = 0x5452 },
+	{},
+};
+
+void *video_hw_init(void)
+{
+	GraphicDevice *gdev = &ctfb;
+	int bits_per_pixel;
+	pci_dev_t dev;
+	int ret;
+
+	printf("Video: ");
+	if (vbe_get_video_info(gdev)) {
+		/* TODO: Should we look these up by class? */
+		dev = pci_find_devices(vesa_video_ids, 0);
+		if (dev == -1) {
+			printf("no card detected\n");
+			return NULL;
+		}
+		printf("bdf %x\n", dev);
+		ret = pci_run_vga_bios(dev, NULL, true);
+		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("Framex buffer at %x\n", gdev->pciBase);
+
+	return (void *)gdev;
+}
-- 
2.2.0.rc0.207.ga3a616c

  parent reply	other threads:[~2014-12-30  2:32 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-30  2:32 [U-Boot] [PATCH 0/10] x86: Add generic VESA video driver Simon Glass
2014-12-30  2:32 ` [U-Boot] [PATCH 01/10] bios_emulator: Fix an #ifdef typo in the header file Simon Glass
2015-01-04  5:10   ` Bin Meng
2015-01-15  4:23     ` Simon Glass
2014-12-30  2:32 ` [U-Boot] [PATCH 02/10] x86: Correct endianness isues in pci_rom Simon Glass
2015-01-04  5:43   ` Bin Meng
2015-01-15  4:23     ` Simon Glass
2014-12-30  2:32 ` [U-Boot] [PATCH 03/10] x86: Support ROMs on other archs Simon Glass
2015-01-04  5:43   ` Bin Meng
2015-01-15  4:23     ` Simon Glass
2014-12-30  2:32 ` [U-Boot] [PATCH 04/10] bios_emulator: Don't display error when emulator terminates Simon Glass
2015-01-15  4:23   ` Simon Glass
2014-12-30  2:32 ` [U-Boot] [PATCH 05/10] bios_emulator: Add some VESA interface debugging Simon Glass
2015-01-15  4:24   ` Simon Glass
2019-07-30 20:52   ` Heinrich Schuchardt
2019-08-01 16:51     ` Simon Glass
2014-12-30  2:32 ` [U-Boot] [PATCH 06/10] x86: pci: Don't stop when we get a vendor/device mismatch Simon Glass
2015-01-04  5:51   ` Bin Meng
2015-01-15  4:24     ` Simon Glass
2014-12-30  2:32 ` Simon Glass [this message]
2015-01-15  4:24   ` [U-Boot] [PATCH 07/10] x86: Add a VESA video driver Simon Glass
2014-12-30  2:32 ` [U-Boot] [PATCH 08/10] x86: Drop the x86_fb driver Simon Glass
2015-01-15  4:25   ` Simon Glass
2014-12-30  2:32 ` [U-Boot] [PATCH 09/10] x86: Access the VGA ROM when needed Simon Glass
2015-01-04  5:54   ` Bin Meng
2015-01-05  1:45     ` Simon Glass
2015-01-05 13:49       ` Bin Meng
2015-01-14 19:36         ` Simon Glass
2015-01-15  2:17           ` Bin Meng
2014-12-30  2:32 ` [U-Boot] [PATCH 10/10] RFC: Test code for glacier PCI video support Simon Glass
2015-01-08  4:46   ` Bin Meng
2015-01-08  6:18   ` Bin Meng
2015-01-08 15:06     ` Simon Glass
2015-01-09  1:34       ` Bin Meng
2015-01-09  3:35         ` Simon Glass
2015-01-09  5:23           ` Bin Meng
2015-01-09 19:02             ` Simon Glass
2015-01-10  3:52               ` Bin Meng
2015-01-10 16:08                 ` Simon Glass
2015-01-11  3:04                   ` Bin Meng
2015-01-11  3:42                     ` Simon Glass
2015-01-11  4:20                       ` Bin Meng
2015-01-13  1:11                         ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1419906751-29776-8-git-send-email-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.