Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: fw: arc: workaround 64bit kernel/32bit ARC problems

Pointer arguments for 32bit ARC PROMs must reside in CKSEG0/1. While
the initial stack resides in CKSEG0 the first kernel thread stack
is already placed at a XKPHYS address, which ARC32 can't handle.
The workaround here is to use static variables, which are placed
into BSS and linked to a CKSEG0 address.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Signed-off-by: Paul Burton <paul.burton@mips.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

authored by

Thomas Bogendoerfer and committed by
Paul Burton
351889d3 39b2d756

+21 -4
+21 -4
arch/mips/fw/arc/promlib.c
··· 11 11 #include <asm/bcache.h> 12 12 #include <asm/setup.h> 13 13 14 + #if defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC32) 15 + /* 16 + * For 64bit kernels working with a 32bit ARC PROM pointer arguments 17 + * for ARC calls need to reside in CKEG0/1. But as soon as the kernel 18 + * switches to it's first kernel thread stack is set to an address in 19 + * XKPHYS, so anything on stack can't be used anymore. This is solved 20 + * by using a * static declartion variables are put into BSS, which is 21 + * linked to a CKSEG0 address. Since this is only used on UP platforms 22 + * there is not spinlock needed 23 + */ 24 + #define O32_STATIC static 25 + #else 26 + #define O32_STATIC 27 + #endif 28 + 14 29 /* 15 30 * IP22 boardcache is not compatible with board caches. Thus we disable it 16 31 * during romvec action. Since r4xx0.c is always compiled and linked with your ··· 38 23 39 24 void prom_putchar(char c) 40 25 { 41 - ULONG cnt; 42 - CHAR it = c; 26 + O32_STATIC ULONG cnt; 27 + O32_STATIC CHAR it; 28 + 29 + it = c; 43 30 44 31 bc_disable(); 45 32 ArcWrite(1, &it, 1, &cnt); ··· 50 33 51 34 char prom_getchar(void) 52 35 { 53 - ULONG cnt; 54 - CHAR c; 36 + O32_STATIC ULONG cnt; 37 + O32_STATIC CHAR c; 55 38 56 39 bc_disable(); 57 40 ArcRead(0, &c, 1, &cnt);