diff options
author | Nico Huber <nico.h@gmx.de> | 2017-06-09 18:57:07 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2017-06-15 06:23:42 +0200 |
commit | a1f842d158dfd1fea833b8f290c6f11063a783c2 (patch) | |
tree | 5c3df56ca94217afa291aee4b0ff7c0e8042bec9 /src/drivers | |
parent | e8f6569ab3944a7d6645a38f03acaf38852612be (diff) |
drivers/xgi: Fix usage of NGI Kconfig options
This driver reinvented MAINBOARD_DO_NATIVE_VGA_INIT in a very special
way: If it wasn't set, perform native gfx init in textmode, if it was
set, perform native gfx init in linear framebuffer mode. Test for
LINEAR_FRAMEBUFFER instead and make the native gfx init optional.
Also, make Kconfig reflect the actual behaviour.
Change-Id: If20fd1f5b0f4127b426e8ff94acc61fcd4eb49af
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/20131
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/xgi/common/Kconfig | 3 | ||||
-rw-r--r-- | src/drivers/xgi/common/XGI_main.c | 4 | ||||
-rw-r--r-- | src/drivers/xgi/common/XGI_main.h | 4 | ||||
-rw-r--r-- | src/drivers/xgi/common/vb_init.c | 2 | ||||
-rw-r--r-- | src/drivers/xgi/common/xgi_coreboot.c | 163 | ||||
-rw-r--r-- | src/drivers/xgi/z9s/z9s.c | 14 |
6 files changed, 94 insertions, 96 deletions
diff --git a/src/drivers/xgi/common/Kconfig b/src/drivers/xgi/common/Kconfig index fdc2c3e1b9..767dd841ba 100644 --- a/src/drivers/xgi/common/Kconfig +++ b/src/drivers/xgi/common/Kconfig @@ -1,6 +1,7 @@ config DRIVERS_XGI_Z79_COMMON bool - select VGA + select VGA if VGA_TEXT_FRAMEBUFFER select NO_EDID_FILL_FB select MAINBOARD_HAS_NATIVE_VGA_INIT + select HAVE_LINEAR_FRAMEBUFFER if MAINBOARD_DO_NATIVE_VGA_INIT select HAVE_VGA_TEXT_FRAMEBUFFER if MAINBOARD_DO_NATIVE_VGA_INIT diff --git a/src/drivers/xgi/common/XGI_main.c b/src/drivers/xgi/common/XGI_main.c index 8978607d04..b0b92d9d9f 100644 --- a/src/drivers/xgi/common/XGI_main.c +++ b/src/drivers/xgi/common/XGI_main.c @@ -590,8 +590,6 @@ check_memory: /* --------------------- SetMode routines ------------------------- */ -#if IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) - static void XGIfb_pre_setmode(struct xgifb_video_info *xgifb_info) { u8 cr30 = 0, cr31 = 0; @@ -863,5 +861,3 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info) } } } - -#endif diff --git a/src/drivers/xgi/common/XGI_main.h b/src/drivers/xgi/common/XGI_main.h index 52421e9c27..08c0010719 100644 --- a/src/drivers/xgi/common/XGI_main.h +++ b/src/drivers/xgi/common/XGI_main.h @@ -65,9 +65,7 @@ static int XGIfb_crt1off; static int XGIfb_forcecrt1 = -1; /* global flags */ -#if IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) static int XGIfb_tvmode; -#endif static int enable_dstn; // static int XGIfb_ypan = -1; @@ -384,8 +382,6 @@ static const struct _XGI_TV_filter { {0xFF, 0xFF, 0xFF, 0xFF} } } }; -#if IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) static int filter = -1; -#endif #endif diff --git a/src/drivers/xgi/common/vb_init.c b/src/drivers/xgi/common/vb_init.c index bc66bda68a..e0524dde08 100644 --- a/src/drivers/xgi/common/vb_init.c +++ b/src/drivers/xgi/common/vb_init.c @@ -853,7 +853,7 @@ static void XGINew_SetDRAMSize_340(struct xgifb_video_info *xgifb_info, pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress; - if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) + if (IS_ENABLED(CONFIG_LINEAR_FRAMEBUFFER)) XGISetModeNew(xgifb_info, HwDeviceExtension, 0x2e); data = xgifb_reg_get(pVBInfo->P3c4, 0x21); diff --git a/src/drivers/xgi/common/xgi_coreboot.c b/src/drivers/xgi/common/xgi_coreboot.c index f7d81c86de..9cd634ce18 100644 --- a/src/drivers/xgi/common/xgi_coreboot.c +++ b/src/drivers/xgi/common/xgi_coreboot.c @@ -119,7 +119,7 @@ int xgifb_probe(struct pci_dev *pdev, struct xgifb_video_info *xgifb_info) xgifb_info->video_size = video_size_max; } - if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) { + if (IS_ENABLED(CONFIG_LINEAR_FRAMEBUFFER)) { /* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE */ xgifb_reg_or(XGISR, IND_SIS_PCI_ADDRESS_SET, @@ -263,7 +263,7 @@ int xgifb_probe(struct pci_dev *pdev, struct xgifb_video_info *xgifb_info) xgifb_info->mode_idx = XGIfb_GetXG21DefaultLVDSModeIdx(xgifb_info); else - if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) + if (IS_ENABLED(CONFIG_LINEAR_FRAMEBUFFER)) xgifb_info->mode_idx = DEFAULT_MODE; else xgifb_info->mode_idx = DEFAULT_TEXT_MODE; @@ -338,85 +338,88 @@ int xgifb_modeset(struct pci_dev *pdev, struct xgifb_video_info *xgifb_info) hw_info = &xgifb_info->hw_info; -#if IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) - /* Set mode */ - XGIfb_pre_setmode(xgifb_info); - if (XGISetModeNew(xgifb_info, hw_info, - XGIbios_mode[xgifb_info->mode_idx].mode_no) - == 0) { - pr_err("Setting mode[0x%x] failed\n", - XGIbios_mode[xgifb_info->mode_idx].mode_no); - return -22; - } - xgifb_info->video_linelength = - xgifb_info->video_width * - (xgifb_info->video_bpp >> 3); - - xgifb_reg_set(XGISR, IND_SIS_PASSWORD, SIS_PASSWORD); - - xgifb_reg_set(XGICR, 0x13, (xgifb_info->video_linelength & 0x00ff)); - xgifb_reg_set(XGISR, - 0x0E, - (xgifb_info->video_linelength & 0xff00) >> 8); - - XGIfb_post_setmode(xgifb_info); - - pr_debug("Set new mode: %dx%dx%d-%d\n", - XGIbios_mode[xgifb_info->mode_idx].xres, - XGIbios_mode[xgifb_info->mode_idx].yres, - XGIbios_mode[xgifb_info->mode_idx].bpp, - xgifb_info->refresh_rate); - - /* Set LinuxBIOS framebuffer information */ - xgi_vbe_valid = 1; - xgi_fb.physical_address = xgifb_info->video_base; - xgi_fb.x_resolution = xgifb_info->video_width; - xgi_fb.y_resolution = xgifb_info->video_height; - xgi_fb.bytes_per_line = xgifb_info->video_width * xgifb_info->video_bpp; - xgi_fb.bits_per_pixel = xgifb_info->video_bpp; - - xgi_fb.reserved_mask_pos = 0; - xgi_fb.reserved_mask_size = 0; - switch(xgifb_info->video_bpp){ - case 32: - case 24: - /* packed into 4-byte words */ - xgi_fb.reserved_mask_pos = 24; - xgi_fb.reserved_mask_size = 8; - xgi_fb.red_mask_pos = 16; - xgi_fb.red_mask_size = 8; - xgi_fb.green_mask_pos = 8; - xgi_fb.green_mask_size = 8; - xgi_fb.blue_mask_pos = 0; - xgi_fb.blue_mask_size = 8; - break; - case 16: - /* packed into 2-byte words */ - xgi_fb.red_mask_pos = 11; - xgi_fb.red_mask_size = 5; - xgi_fb.green_mask_pos = 5; - xgi_fb.green_mask_size = 6; - xgi_fb.blue_mask_pos = 0; - xgi_fb.blue_mask_size = 5; - break; - default: - printk(BIOS_SPEW, "%s: unsupported BPP %d\n", __func__, - xgifb_info->video_bpp); - xgi_vbe_valid = 0; + if (IS_ENABLED(CONFIG_LINEAR_FRAMEBUFFER)) { + /* Set mode */ + XGIfb_pre_setmode(xgifb_info); + if (XGISetModeNew(xgifb_info, hw_info, + XGIbios_mode[xgifb_info->mode_idx].mode_no) + == 0) { + pr_err("Setting mode[0x%x] failed\n", + XGIbios_mode[xgifb_info->mode_idx].mode_no); + return -22; + } + xgifb_info->video_linelength = + xgifb_info->video_width * + (xgifb_info->video_bpp >> 3); + + xgifb_reg_set(XGISR, IND_SIS_PASSWORD, SIS_PASSWORD); + + xgifb_reg_set(XGICR, 0x13, + (xgifb_info->video_linelength & 0x00ff)); + xgifb_reg_set(XGISR, 0x0e, + (xgifb_info->video_linelength & 0xff00) >> 8); + + XGIfb_post_setmode(xgifb_info); + + pr_debug("Set new mode: %dx%dx%d-%d\n", + XGIbios_mode[xgifb_info->mode_idx].xres, + XGIbios_mode[xgifb_info->mode_idx].yres, + XGIbios_mode[xgifb_info->mode_idx].bpp, + xgifb_info->refresh_rate); + + /* Set LinuxBIOS framebuffer information */ + xgi_vbe_valid = 1; + xgi_fb.physical_address = xgifb_info->video_base; + xgi_fb.x_resolution = xgifb_info->video_width; + xgi_fb.y_resolution = xgifb_info->video_height; + xgi_fb.bytes_per_line = + xgifb_info->video_width * xgifb_info->video_bpp; + xgi_fb.bits_per_pixel = xgifb_info->video_bpp; + + xgi_fb.reserved_mask_pos = 0; + xgi_fb.reserved_mask_size = 0; + switch(xgifb_info->video_bpp){ + case 32: + case 24: + /* packed into 4-byte words */ + xgi_fb.reserved_mask_pos = 24; + xgi_fb.reserved_mask_size = 8; + xgi_fb.red_mask_pos = 16; + xgi_fb.red_mask_size = 8; + xgi_fb.green_mask_pos = 8; + xgi_fb.green_mask_size = 8; + xgi_fb.blue_mask_pos = 0; + xgi_fb.blue_mask_size = 8; + break; + case 16: + /* packed into 2-byte words */ + xgi_fb.red_mask_pos = 11; + xgi_fb.red_mask_size = 5; + xgi_fb.green_mask_pos = 5; + xgi_fb.green_mask_size = 6; + xgi_fb.blue_mask_pos = 0; + xgi_fb.blue_mask_size = 5; + break; + default: + printk(BIOS_SPEW, "%s: unsupported BPP %d\n", __func__, + xgifb_info->video_bpp); + xgi_vbe_valid = 0; + } + } else { + /* + * FIXME + * 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"); } -#else - /* FIXME - * 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/z9s/z9s.c b/src/drivers/xgi/z9s/z9s.c index 86808fce11..4c1e44a828 100644 --- a/src/drivers/xgi/z9s/z9s.c +++ b/src/drivers/xgi/z9s/z9s.c @@ -40,12 +40,14 @@ static void xgi_z9s_init(struct device *dev) u8 ret; struct xgifb_video_info *xgifb_info; - printk(BIOS_INFO, "XGI Z9s: initializing video device\n"); - xgifb_info = malloc(sizeof(*xgifb_info)); - ret = xgifb_probe(dev, xgifb_info); - if (!ret) - xgifb_modeset(dev, xgifb_info); - free(xgifb_info); + if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) { + printk(BIOS_INFO, "XGI Z9s: initializing video device\n"); + xgifb_info = malloc(sizeof(*xgifb_info)); + ret = xgifb_probe(dev, xgifb_info); + if (!ret) + xgifb_modeset(dev, xgifb_info); + free(xgifb_info); + } } static struct device_operations xgi_z9s_ops = { |