# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: architecture/mips64/package/*/4007_all-add-odyssey_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 14:00:28.346638990 +0200 +++ linux-6.11/arch/mips/sgi-ip30/Makefile 2024-10-15 14:01:34.736638546 +0200 @@ -7,4 +7,5 @@ obj-$(CONFIG_EARLY_PRINTK) += ip30-console.o obj-$(CONFIG_EARLY_IMPACT_PRINTK) += impact-earlycon.o +obj-$(CONFIG_EARLY_ODYSSEY_PRINTK) += odyssey-earlycon.o obj-$(CONFIG_SMP) += ip30-smp.o --- linux-6.11/arch/mips/Kconfig.debug.vanilla 2024-10-15 14:01:59.423305099 +0200 +++ linux-6.11/arch/mips/Kconfig.debug 2024-10-15 14:21:39.996630795 +0200 @@ -38,6 +38,18 @@ overwrites top-to-bottom. A solid red line indicates the last line of text written. +config EARLY_ODYSSEY_PRINTK + bool "Early Odyssey printk" if EXPERT + depends on (SGI_IP30 || SGI_IP35) && EARLY_PRINTK + select FB_ODYSSEY_EARLY + select FONT_SUPPORT + select FONT_8x16 + help + This options enables utilizing the Odyssey 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 d5b6c6816af5..d59bfab970a6 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -57,6 +57,10 @@ struct screen_info screen_info; extern void setup_early_impact_printk(void); #endif +#if defined(CONFIG_EARLY_ODYSSEY_PRINTK) + extern void setup_early_odyssey_printk(void); +#endif + /* * Setup information * @@ -1017,6 +1021,8 @@ void __init setup_arch(char **cmdline_p) #ifdef CONFIG_EARLY_PRINTK #if defined(CONFIG_EARLY_IMPACT_PRINTK) setup_early_impact_printk(); +#elif defined(CONFIG_EARLY_ODYSSEY_PRINTK) + setup_early_odyssey_printk(); #else setup_early_printk(); #endif diff --git a/arch/mips/sgi-common/odyssey-earlycon.c b/arch/mips/sgi-common/odyssey-earlycon.c new file mode 100644 index 000000000000..1267b430da97 --- /dev/null +++ b/arch/mips/sgi-ip30/odyssey-earlycon.c @@ -0,0 +1,45 @@ +/* + * Wrapper for an early console using the using the Odyssey Graphics Card + * as a debugging/early boot console. + * + * Copyright (c) 2004-2007 Stanislaw Skowronek + * Copyright (c) 2014 Joshua Kinard + */ +#include +#include +#include +#include + +#include + +extern void odyssey_earlyinit(void); +extern void odyssey_earlychar(u8 c, u32 f); +extern struct console *early_console; + +static void +early_odyssey_write(struct console *co, const char *s, u32 count) +{ + /* Do each character */ + while (count--) + odyssey_earlychar(*s++, 0xa0a0a0); +} + +static struct console +early_odyssey_cons = { + .name = "early_odyssey", + .write = early_odyssey_write, + .flags = CON_PRINTBUFFER | CON_BOOT, + .index = -1, +}; + +void __init +setup_early_odyssey_printk(void) +{ + if (early_console) + return; + + odyssey_earlyinit(); + early_console = &early_odyssey_cons; + + register_console(&early_odyssey_cons); +} diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index 7430a82492dc..34b155053e06 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -731,6 +731,10 @@ config FB_IMPACT help SGI Impact (MardiGras/MGRAS) graphics card support. +config FB_ODYSSEY_EARLY + bool + depends on (SGI_IP30 || SGI_IP35) + config FB_ODYSSEY tristate "SGI Odyssey graphics support" depends on FB && (SGI_IP30 || SGI_IP35) diff --git a/drivers/video/fbdev/Makefile b/drivers/video/fbdev/Makefile index 67fe1e90b9a3..0e09eb73b1a6 100644 --- a/drivers/video/fbdev/Makefile +++ b/drivers/video/fbdev/Makefile @@ -128,6 +128,7 @@ obj-$(CONFIG_FB_SM712) += sm712fb.o obj-$(CONFIG_FB_IMPACT) += impact.o obj-$(CONFIG_FB_IMPACT_EARLY) += impact_early.o obj-$(CONFIG_FB_ODYSSEY) += odyssey.o +obj-$(CONFIG_FB_ODYSSEY_EARLY) += odyssey_early.o # Platform or fallback drivers go here obj-$(CONFIG_FB_UVESA) += uvesafb.o diff --git a/drivers/video/fbdev/odyssey_early.c b/drivers/video/fbdev/odyssey_early.c new file mode 100644 index 000000000000..a209f2b0149a --- /dev/null +++ b/drivers/video/fbdev/odyssey_early.c @@ -0,0 +1,409 @@ +/* + * linux/drivers/video/odyssey_early.c + * -- SGI Octane Odyssey (VPro) graphics + * + * Copyright (c) 2004 by Stanislaw Skowronek + * Copyright (c) 2011-14 by Joshua Kinard (Fixes, Maintenance) + * + * Separated from linux/drivers/video/fbdev/odyssey.c + * + * This driver provides direct access to the Odyssey 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. + * + * 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