[coreboot-gerrit] Patch set updated for coreboot: 75aedec drivers/xgi: Fix legacy VGA text mode initialization
Timothy Pearson (tpearson@raptorengineeringinc.com)
gerrit at coreboot.org
Fri Feb 6 01:08:41 CET 2015
Timothy Pearson (tpearson at raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8360
-gerrit
commit 75aedeca4c1fafb0967ff08110351c83465f18bf
Author: Timothy Pearson <tpearson at raptorengineeringinc.com>
Date: Thu Feb 5 01:02:57 2015 -0600
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 at raptorengineeringinc.com>
---
src/drivers/xgi/common/vb_init.c | 6 +++++-
src/drivers/xgi/common/xgi_coreboot.c | 27 +++++++++++++++++++--------
src/drivers/xgi/common/xgi_coreboot.h | 2 ++
src/drivers/xgi/z9s/z9s.c | 15 ++++++++++++++-
4 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/src/drivers/xgi/common/vb_init.c b/src/drivers/xgi/common/vb_init.c
index 2b81605..a2fbc80 100644
--- a/src/drivers/xgi/common/vb_init.c
+++ b/src/drivers/xgi/common/vb_init.c
@@ -1,8 +1,11 @@
/*
* This file is part of the coreboot project.
*
+ * Copyright (C) 2015 Timothy Pearson <tpearson at 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 */
diff --git a/src/drivers/xgi/common/xgi_coreboot.c b/src/drivers/xgi/common/xgi_coreboot.c
index 84ed81a..a4abe71 100755
--- a/src/drivers/xgi/common/xgi_coreboot.c
+++ b/src/drivers/xgi/common/xgi_coreboot.c
@@ -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;
diff --git a/src/drivers/xgi/common/xgi_coreboot.h b/src/drivers/xgi/common/xgi_coreboot.h
index 524615c..b616751 100644
--- a/src/drivers/xgi/common/xgi_coreboot.h
+++ b/src/drivers/xgi/common/xgi_coreboot.h
@@ -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
diff --git a/src/drivers/xgi/z9s/z9s.c b/src/drivers/xgi/z9s/z9s.c
index 095489e..04c4563 100644
--- a/src/drivers/xgi/z9s/z9s.c
+++ b/src/drivers/xgi/z9s/z9s.c
@@ -31,6 +31,19 @@
#include "../common/xgi_coreboot.h"
#include "../common/XGIfb.h"
+static void xgi_z9s_set_resources(device_t dev)
+{
+ /* Reserve standard VGA regions */
+ mmio_resource(dev, 3, 0xa0000 >> 10, 0xffff >> 10);
+ mmio_resource(dev, 4, 0xb8000 >> 10, 0x7fff >> 10);
+
+ /* Reserve non-standard VGA regions */
+ mmio_resource(dev, 5, 0xb0000 >> 10, 0x7fff >> 10);
+
+ /* Run standard resource set routine */
+ pci_dev_set_resources(dev);
+}
+
static void xgi_z9s_init(struct device *dev)
{
u8 ret;
@@ -46,7 +59,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,
More information about the coreboot-gerrit
mailing list