drivers/xgi: Fix legacy VGA text mode initialization

TEST: Booted KFSN4-DRE with on-board XGI Volari Z9s
Initial text from coreboot appeared, and the Linux
console was displayed immediately at the start of
kernel initialization.  After boot was complete
the text mode console continued to behave normally.

SeaBIOS does not currently make use of the legacy
VGA text-mode display.

Change-Id: I2177a1d00e6f07db661dd99fe0184e2c228404d1
Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
Reviewed-on: http://review.coreboot.org/8360
Tested-by: build bot (Jenkins)
Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
This commit is contained in:
Timothy Pearson 2015-02-05 01:02:57 -06:00 committed by Alexandru Gagniuc
parent 114baa0a0a
commit 08c15ed266
4 changed files with 36 additions and 10 deletions

View File

@ -1,8 +1,11 @@
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2015 Timothy Pearson <tpearson@raptorengineeringinc.com>, Raptor Engineering
*
* File taken from the Linux xgifb driver (v3.18.5)
* Coreboot-specific includes added at top
* XGINew_SetDRAMSize_340 slightly modified for coreboot text mode
*
* 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
@ -854,7 +857,8 @@ static void XGINew_SetDRAMSize_340(struct xgifb_video_info *xgifb_info,
pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
XGISetModeNew(xgifb_info, HwDeviceExtension, 0x2e);
if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT))
XGISetModeNew(xgifb_info, HwDeviceExtension, 0x2e);
data = xgifb_reg_get(pVBInfo->P3c4, 0x21);
/* disable read cache */

View File

@ -123,12 +123,14 @@ int xgifb_probe(struct pci_dev *pdev, struct xgifb_video_info *xgifb_info)
xgifb_info->video_size = video_size_max;
}
/* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE */
xgifb_reg_or(XGISR,
IND_SIS_PCI_ADDRESS_SET,
(SIS_PCI_ADDR_ENABLE | SIS_MEM_MAP_IO_ENABLE));
/* Enable 2D accelerator engine */
xgifb_reg_or(XGISR, IND_SIS_MODULE_ENABLE, SIS_ENABLE_2D);
if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) {
/* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE */
xgifb_reg_or(XGISR,
IND_SIS_PCI_ADDRESS_SET,
(SIS_PCI_ADDR_ENABLE | SIS_MEM_MAP_IO_ENABLE));
/* Enable 2D accelerator engine */
xgifb_reg_or(XGISR, IND_SIS_MODULE_ENABLE, SIS_ENABLE_2D);
}
hw_info->ulVideoMemorySize = xgifb_info->video_size;
@ -265,7 +267,10 @@ int xgifb_probe(struct pci_dev *pdev, struct xgifb_video_info *xgifb_info)
xgifb_info->mode_idx =
XGIfb_GetXG21DefaultLVDSModeIdx(xgifb_info);
else
xgifb_info->mode_idx = DEFAULT_MODE;
if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT))
xgifb_info->mode_idx = DEFAULT_MODE;
else
xgifb_info->mode_idx = DEFAULT_TEXT_MODE;
}
if (xgifb_info->mode_idx < 0) {
@ -406,10 +411,16 @@ int xgifb_modeset(struct pci_dev *pdev, struct xgifb_video_info *xgifb_info)
}
#else
/* FIXME
* Text mode does not work
* Text mode is slightly unstable/jittery (bad/incomplete DDR init?)
*/
/* Initialize standard VGA text mode */
vga_io_init();
vga_textmode_init();
printk(BIOS_INFO, "XGI VGA text mode initialized\n");
/* if we don't have console, at least print something... */
vga_line_write(0, "XGI VGA text mode initialized");
#endif
return 0;

View File

@ -208,6 +208,8 @@ enum _SIS_LCD_TYPE {
/* End code taken from Linux kernel 3.18.5 */
#define DEFAULT_TEXT_MODE 16 /* index for 800x600x8 */
/* coreboot <--> kernel code interface */
#define __iomem
#define SISIOMEMTYPE

View File

@ -31,6 +31,15 @@
#include "../common/xgi_coreboot.h"
#include "../common/XGIfb.h"
static void xgi_z9s_set_resources(device_t dev)
{
/* Reserve VGA regions */
mmio_resource(dev, 3, 0xa0000 >> 10, 0x1ffff >> 10);
/* Run standard resource set routine */
pci_dev_set_resources(dev);
}
static void xgi_z9s_init(struct device *dev)
{
u8 ret;
@ -46,7 +55,7 @@ static void xgi_z9s_init(struct device *dev)
static struct device_operations xgi_z9s_ops = {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,
.set_resources = xgi_z9s_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = xgi_z9s_init,
.scan_bus = 0,