2 * VESA frame buffer driver
4 * Copyright (C) 2014 Google, Inc
6 * SPDX-License-Identifier: GPL-2.0+
19 void *video_hw_init(void)
21 GraphicDevice *gdev = &ctfb;
27 if (!ll_boot_init()) {
29 * If we are running from EFI or coreboot, this driver can't
32 printf("Not available (previous bootloader prevents it)\n");
35 if (vbe_get_video_info(gdev)) {
36 ret = dm_pci_find_class(PCI_CLASS_DISPLAY_VGA << 8, 0, &dev);
38 printf("no card detected\n");
41 bootstage_start(BOOTSTAGE_ID_ACCUM_LCD, "vesa display");
42 ret = dm_pci_run_vga_bios(dev, NULL, PCI_ROM_USE_NATIVE |
43 PCI_ROM_ALLOW_FALLBACK);
44 bootstage_accum(BOOTSTAGE_ID_ACCUM_LCD);
46 printf("failed to run video BIOS: %d\n", ret);
51 if (vbe_get_video_info(gdev)) {
52 printf("No video mode configured\n");
56 bits_per_pixel = gdev->gdfBytesPP * 8;
57 sprintf(gdev->modeIdent, "%dx%dx%d", gdev->winSizeX, gdev->winSizeY,
59 printf("%s\n", gdev->modeIdent);
60 debug("Frame buffer at %x\n", gdev->pciBase);