# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: architecture/mips64/package/*/4005_all-add-impact_early.patch # Copyright (C) 2024 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-END --- --- linux-6.11/arch/mips/sgi-ip30/Makefile.vanilla 2024-10-15 13:55:59.093307362 +0200 +++ linux-6.11/arch/mips/sgi-ip30/Makefile 2024-10-15 13:56:10.136640640 +0200 @@ -6,4 +6,5 @@ obj-y := ip30-irq.o ip30-power.o ip30-setup.o ip30-timer.o ip30-xtalk.o obj-$(CONFIG_EARLY_PRINTK) += ip30-console.o +obj-$(CONFIG_EARLY_IMPACT_PRINTK) += impact-earlycon.o obj-$(CONFIG_SMP) += ip30-smp.o --- linux-6.11/arch/mips/Kconfig.debug.vanilla 2024-10-15 13:56:22.499973905 +0200 +++ linux-6.11/arch/mips/Kconfig.debug 2024-10-15 13:57:34.216640097 +0200 @@ -26,6 +26,18 @@ config USE_GENERIC_EARLY_PRINTK_8250 bool +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. + config CMDLINE_BOOL bool "Built-in kernel command line" help 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/impact-earlycon.c b/arch/mips/sgi-common/impact-earlycon.c new file mode 100644 index 000000000000..eb104736b1a5 --- /dev/null +++ b/arch/mips/sgi-ip30/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