From 08c15ed266d8dec11de9b2eed097678b454ea7fc Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 5 Feb 2015 01:02:57 -0600 Subject: 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 Reviewed-on: http://review.coreboot.org/8360 Tested-by: build bot (Jenkins) Reviewed-by: Alexandru Gagniuc --- 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 | 11 ++++++++++- 4 files changed, 36 insertions(+), 10 deletions(-) (limited to 'src/drivers/xgi') diff --git a/src/drivers/xgi/common/vb_init.c b/src/drivers/xgi/common/vb_init.c index 2b81605752..a2fbc805b2 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 , 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 84ed81abd1..a4abe71fa0 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 524615ccaf..b616751c81 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 095489ed8c..eaf04df55a 100644 --- a/src/drivers/xgi/z9s/z9s.c +++ b/src/drivers/xgi/z9s/z9s.c @@ -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, -- cgit v1.2.3