3 * Vesa frame buffer driver for x86
5 * Copyright (C) 2014 Google, Inc
7 * SPDX-License-Identifier: GPL-2.0+
20 /* Devices to allow - only the last one works fully */
21 struct pci_device_id vesa_video_ids[] = {
22 { .vendor = 0x102b, .device = 0x0525 },
23 { .vendor = 0x1002, .device = 0x5159 },
24 { .vendor = 0x1002, .device = 0x4752 },
25 { .vendor = 0x1002, .device = 0x5452 },
26 { .vendor = 0x8086, .device = 0x0f31 },
30 void *video_hw_init(void)
32 GraphicDevice *gdev = &ctfb;
38 if (vbe_get_video_info(gdev)) {
39 /* TODO: Should we look these up by class? */
40 dev = pci_find_devices(vesa_video_ids, 0);
42 printf("no card detected\n");
45 bootstage_start(BOOTSTAGE_ID_ACCUM_LCD, "vesa display");
46 ret = pci_run_vga_bios(dev, NULL, PCI_ROM_USE_NATIVE |
47 PCI_ROM_ALLOW_FALLBACK);
48 bootstage_accum(BOOTSTAGE_ID_ACCUM_LCD);
50 printf("failed to run video BIOS: %d\n", ret);
55 if (vbe_get_video_info(gdev)) {
56 printf("No video mode configured\n");
60 bits_per_pixel = gdev->gdfBytesPP * 8;
61 sprintf(gdev->modeIdent, "%dx%dx%d", gdev->winSizeX, gdev->winSizeY,
63 printf("%s\n", gdev->modeIdent);
64 debug("Frame buffer at %x\n", gdev->pciBase);