Add support for running uClinux under UAE, the Ubiquitous Amiga Emulator. --- Kconfig | 26 +++++++++++++++++++++++++ amiga/config.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ kernel/head.S | 3 ++ 3 files changed, 88 insertions(+) --- linux-m68k-2.6.8.1+uc0/arch/m68k/Kconfig 2004-08-14 15:35:36.000000000 +0200 +++ uClinux-amiga-2.6.8.1/arch/m68k/Kconfig 2004-06-26 17:17:34.000000000 +0200 @@ -380,6 +421,32 @@ config AMIGA_PCMCIA Include support in the kernel for pcmcia on Amiga 1200 and Amiga 600. If you intend to use pcmcia cards say Y; otherwise say N. +config AMIGA_UAE + bool "Ubiquitous Amiga Emulator support" + depends on AMIGA && !MMU + help + Include support for running uClinux under UAE, the Ubiquitous Amiga + Emulator. If you intend to run uClinux under UAE, say Y here. + +config AMIGA_UAE_DEBUG + bool "UAE debug console" + depends on AMIGA_UAE + help + Include debug support for the Ubiquitous Amiga Emulator console. + Say Y here if you intend to run uClinux under UAE and want to be able + to redirect all kernel messages to the UAE console using the + "debug=uae" kernel argument. + +config AMIGA_UAE_DEBUG_SYNC + bool "Synchronous UAE debug console" + depends on AMIGA_UAE_DEBUG + help + The UAE console can print complete lines (incl. terminating line + feed) only. This means that the most recent incomplete line in the + kernel output may get stuck in a buffer until it is completed later. + Say Y here to print incomplete lines synchronously, at the expense + of additional line feeds in the output. + config STRAM_SWAP bool "Support for ST-RAM as swap space" depends on ATARI && BROKEN --- linux-m68k-2.6.8.1+uc0/arch/m68k/amiga/config.c 2004-05-24 11:13:22.000000000 +0200 +++ uClinux-amiga-2.6.8.1/arch/m68k/amiga/config.c 2004-10-08 21:16:01.000000000 +0200 @@ -833,8 +833,11 @@ static void amiga_savekmsg_init(void) static void amiga_serial_putc(char c) { custom.serdat = (unsigned char)c | 0x100; +#ifndef CONFIG_AMIGA_UAE + /* UAE hangs while polling the serial port */ while (!(custom.serdatr & 0x2000)) ; +#endif /* CONFIG_AMIGA_UAE */ } void amiga_serial_console_write(struct console *co, const char *s, @@ -902,6 +907,56 @@ void amiga_serial_gets(struct console *c } #endif +#ifdef CONFIG_AMIGA_UAE_DEBUG + +#define RTAREA_BASE 0xF00000 + + /* + * Print a string to the UAE console. UAE will add a line feed. + */ + +static inline void uae_puts(const char *s) +{ + register const char *a0 __asm("a0") = s; + register unsigned long a1 __asm("a1") = RTAREA_BASE + 0xFF10; + + __asm __volatile ("jsr %%a1@" + : /* no output */ + : "r" (a0), "r" (a1) + : "memory"); +} + +static void amiga_uae_console_write(struct console *co, const char *s, + unsigned int count) +{ + static char buf[1024]; + static unsigned int n = 0; + char c; + + while (count-- > 0) { + c = *s++; + if (c == '\n') { + buf[n] = '\0'; + uae_puts(buf); + n = 0; + } else { + buf[n++] = c; + if (n == sizeof(buf)-1) { + uae_puts(buf); + n = 0; + } + } + } +#ifdef CONFIG_AMIGA_UAE_DEBUG_SYNC + if (n > 0) { + buf[n] = '\0'; + uae_puts(buf); + n = 0; + } +#endif /* CONFIG_AMIGA_UAE_DEBUG_SYNC */ +} +#endif /* CONFIG_AMIGA_UAE_DEBUG */ + static void __init amiga_debug_init(void) { if (!strcmp( m68k_debug_device, "ser" )) { @@ -909,6 +964,12 @@ static void __init amiga_debug_init(void amiga_console_driver.write = amiga_serial_console_write; register_console(&amiga_console_driver); } +#ifdef CONFIG_AMIGA_UAE_DEBUG + else if (!strcmp(m68k_debug_device, "uae")) { + amiga_console_driver.write = amiga_uae_console_write; + register_console(&amiga_console_driver); + } +#endif /* CONFIG_AMIGA_UAE_DEBUG */ } #ifdef CONFIG_HEARTBEAT --- linux-m68k-2.6.8.1+uc0/arch/m68k/kernel/head.S 2004-08-14 15:35:36.000000000 +0200 +++ uClinux-amiga-2.6.8.1/arch/m68k/kernel/head.S 2004-11-04 19:57:12.000000000 +0100 @@ -3028,7 +3028,10 @@ func_start serial_putc,%d0/%d1/%a0/%a1 1: movew %a0@(CUSTOMBASE+C_SERDATR),%d0 #endif /* 68020 or higher */ andw #0x2000,%d0 +#ifndef CONFIG_AMIGA_UAE + /* UAE hangs while polling the serial port */ jeq 1b +#endif /* CONFIG_AMIGA_UAE */ jra L(serial_putc_done) 2: #endif