summaryrefslogtreecommitdiffstats
path: root/drivers/video/vesa_fb.c
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2015-01-26 17:44:49 -0500
committerTom Rini <trini@ti.com>2015-01-26 17:44:49 -0500
commitab92da9f47d51d363c7de42e2a7bd807e2c1bd54 (patch)
treedfabc29929e39a1ecc47edf5a4cf839ead062acd /drivers/video/vesa_fb.c
parentaed03faa064cca56847571b13cbd4c849c6116aa (diff)
parente43ade3749ff10bc313f33bf23705465e4163896 (diff)
downloadblackbird-obmc-uboot-ab92da9f47d51d363c7de42e2a7bd807e2c1bd54.tar.gz
blackbird-obmc-uboot-ab92da9f47d51d363c7de42e2a7bd807e2c1bd54.zip
Merge branch 'master' of git://git.denx.de/u-boot-x86
Diffstat (limited to 'drivers/video/vesa_fb.c')
-rw-r--r--drivers/video/vesa_fb.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/drivers/video/vesa_fb.c b/drivers/video/vesa_fb.c
new file mode 100644
index 0000000000..3dacafd6bf
--- /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;
+}
OpenPOWER on IntegriCloud