Files
system76-coreboot/src/drivers/aspeed/ast2050/ast2050.c
Patrick Rudolph f1a4ae0a48 drivers/aspeed/common: Add support for high resolution framebuffer
* Implement reading EDID over software I2C.
* Fall back to VGA if no monitor connected for BMC KVM
* Copy the linux kernel code and add a bunch of wrapper structs to make it
  compile.
* Convert the EDID to a drm_display_mode, which is understood by the
  driver.
* Properly select HAVE_LINEAR_FRAMEBUFFER and HAVE_VGA_TEXT_FRAMEBUFFER

Tested on Supermicro X11SSH-TF using FullHD VGA monitor.
Initializes the graphics in about 1 second, which is twice as fast as the
VGA Option ROM.

The framebuffer is advertised and working in tianocore.

Change-Id: I7803566b64158405efc04a39f80a0ec98b44e646
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35726
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2019-12-12 12:49:01 +00:00

79 lines
2.3 KiB
C

/*
* This file is part of the coreboot project.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <stdlib.h>
#include <arch/io.h>
#include <edid.h>
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ids.h>
#include <pc80/vga.h>
#include "../common/aspeed_coreboot.h"
#include "../common/ast_drv.h"
static void aspeed_ast2050_set_resources(struct device *dev)
{
/* Reserve VGA regions */
mmio_resource(dev, 3, 0xa0000 >> 10, 0x1ffff >> 10);
/* Run standard resource set routine */
pci_dev_set_resources(dev);
}
static void aspeed_ast2050_init(struct device *dev)
{
struct drm_device drm_dev;
drm_dev.pdev = dev;
printk(BIOS_INFO, "ASpeed AST2050: initializing video device\n");
ast_driver_load(&drm_dev, 0);
/* Unlock extended configuration registers */
outb(0x80, 0x3d4); outb(0xa8, 0x3d5);
/* Set CRT Request Threshold */
outb(0xa6, 0x3d4); outb(0x2f, 0x3d5);
outb(0xa7, 0x3d4); outb(0x3f, 0x3d5);
if (CONFIG(VGA_TEXT_FRAMEBUFFER)) {
/* Initialize standard VGA text mode */
vga_io_init();
vga_textmode_init();
printk(BIOS_INFO, "ASpeed VGA text mode initialized\n");
/* if we don't have console, at least print something... */
vga_line_write(0, "ASpeed VGA text mode initialized");
} else if (CONFIG(GENERIC_LINEAR_FRAMEBUFFER)) {
ast_driver_framebuffer_init(&drm_dev, 0);
printk(BIOS_INFO, "ASpeed high resolution framebuffer initialized\n");
}
}
static struct device_operations aspeed_ast2050_ops = {
.read_resources = pci_dev_read_resources,
.set_resources = aspeed_ast2050_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = aspeed_ast2050_init,
.scan_bus = 0,
};
static const struct pci_driver aspeed_ast2050_driver __pci_driver = {
.ops = &aspeed_ast2050_ops,
.vendor = PCI_VENDOR_ID_ASPEED,
.device = PCI_DEVICE_ID_ASPEED_AST2050_VGA,
};