diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug index b5e3163024f1..058f8cd628fd 100644 --- a/arch/mips/Kconfig.debug +++ b/arch/mips/Kconfig.debug @@ -42,6 +42,17 @@ config EARLY_PRINTK_8250 If you say Y here, it will be possible to use a 8250/16550 serial port as the boot console. +config EARLY_IMPACT_PRINTK + bool "Early Impact printk" if EXPERT + depends on (SGI_IP22 || SGI_IP26 || SGI_IP28 || SGI_IP30) && EARLY_PRINTK + select FB_IMPACT_EARLY + select FONT_SUPPORT + select FONT_8x16 + help + This options enables utilizing the Impact as an early boot console + for debugging purposes. It is fixed at 1280x1024 resolution and + overwrites top-to-bottom. A solid red line indicates the last line + of text written. endchoice config USE_GENERIC_EARLY_PRINTK_8250 diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 2c96c0c68116..d5b6c6816af5 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -53,6 +53,10 @@ EXPORT_SYMBOL(cpu_data); struct screen_info screen_info; #endif +#if defined(CONFIG_EARLY_IMPACT_PRINTK) + extern void setup_early_impact_printk(void); +#endif + /* * Setup information * @@ -1011,7 +1015,11 @@ void __init setup_arch(char **cmdline_p) setup_early_fdc_console(); #ifdef CONFIG_EARLY_PRINTK +#if defined(CONFIG_EARLY_IMPACT_PRINTK) + setup_early_impact_printk(); +#else setup_early_printk(); +#endif #endif cpu_report(); check_bugs_early(); diff --git a/arch/mips/sgi-common/Makefile b/arch/mips/sgi-common/Makefile index bb8e588093eb..ff862b0c7abd 100644 --- a/arch/mips/sgi-common/Makefile +++ b/arch/mips/sgi-common/Makefile @@ -1,3 +1,5 @@ # # Makefile for common bits shared by various SGI systems # + +obj-$(CONFIG_EARLY_IMPACT_PRINTK) += impact-earlycon.o diff --git a/arch/mips/sgi-common/impact-earlycon.c b/arch/mips/sgi-common/impact-earlycon.c new file mode 100644 index 000000000000..eb104736b1a5 --- /dev/null +++ b/arch/mips/sgi-common/impact-earlycon.c @@ -0,0 +1,45 @@ +/* + * Wrapper for an early console using the using the Impact Graphics Card + * as a debugging/early boot console. + * + * Copyright (c) 2004-2007 Stanislaw Skowronek + * Copyright (c) 2014-2015 Joshua Kinard + */ +#include +#include +#include +#include + +#include + +extern void impact_early_init(void); +extern void impact_early_char(u8 c, u32 f); +extern struct console *early_console; + +static void +early_impact_write(struct console *co, const char *s, u32 count) +{ + /* Do each character */ + while (count--) + impact_early_char(*s++, 0xa0a0a0); +} + +static struct console +early_impact_cons = { + .name = "early_impact", + .write = early_impact_write, + .flags = CON_PRINTBUFFER | CON_BOOT, + .index = -1, +}; + +void __init +setup_early_impact_printk(void) +{ + if (early_console) + return; + + impact_early_init(); + early_console = &early_impact_cons; + + register_console(&early_impact_cons); +} diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 0f28a5604867..85266f32a6ba 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -721,6 +721,10 @@ config FB_GBE_MEM This is the amount of memory reserved for the framebuffer, which can be any value between 1MB and 8MB. +config FB_IMPACT_EARLY + bool + depends on (SGI_IP22 || SGI_IP26 || SGI_IP27 || SGI_IP28 || SGI_IP30) + config FB_IMPACT tristate "SGI Impact graphics support" depends on FB && (SGI_IP22 || SGI_IP26 || SGI_IP27 || SGI_IP28 || SGI_IP30) diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile index 25e16a8be5aa..fe6e00846599 100644 --- a/drivers/video/fbdev/Makefile +++ b/drivers/video/fbdev/Makefile @@ -126,6 +126,7 @@ obj-$(CONFIG_FB_HYPERV) += hyperv_fb.o obj-$(CONFIG_FB_OPENCORES) += ocfb.o obj-$(CONFIG_FB_SM712) += sm712fb.o obj-$(CONFIG_FB_IMPACT) += impact.o +obj-$(CONFIG_FB_IMPACT_EARLY) += impact_early.o # Platform or fallback drivers go here obj-$(CONFIG_FB_UVESA) += uvesafb.o diff --git a/drivers/video/fbdev/impact_early.c b/drivers/video/fbdev/impact_early.c new file mode 100644 index 000000000000..0ab9c77b5245 --- /dev/null +++ b/drivers/video/fbdev/impact_early.c @@ -0,0 +1,197 @@ +/* + * linux/drivers/video/impact_early.c + * -- SGI Octane/Indigo2 MardiGras (IMPACT) graphics + * + * Copyright (c) 2004 by Stanislaw Skowronek + * Copyright (c) 2005 by Peter Fuerst (Indigo2 Support) + * Copyright (c) 2011-2014 by Joshua Kinard (Fixes, Maintenance) + * + * Separated from linux/drivers/video/fbdev/impact.c + * + * This driver provides direct access to the Impact hardware for + * early_console support. It can typically be initialized after the + * CPU(s) have been setup, but before anything else, like IRQs. Handy for + * debugging core startup code on a machine as difficult as Octane or the + * Indigo2 Impact R10000 (because of a non-coherent cache). + * + * When running, the driver will draw a solid red line across the screen + * to denote the current output line. It will scroll from top to the bottom + * of the screen and then begin overwriting from the top again. + */ + +#include +#include +#include +#include +#include +#include + +#include