162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
362306a36Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
462306a36Sopenharmony_ci * for more details.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Copyright (C) 1996 David S. Miller (dm@sgi.com)
762306a36Sopenharmony_ci * Compatibility with board caches, Ulf Carlsson
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci#include <linux/kernel.h>
1062306a36Sopenharmony_ci#include <asm/sgialib.h>
1162306a36Sopenharmony_ci#include <asm/bcache.h>
1262306a36Sopenharmony_ci#include <asm/setup.h>
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#if defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC32)
1562306a36Sopenharmony_ci/*
1662306a36Sopenharmony_ci * For 64bit kernels working with a 32bit ARC PROM pointer arguments
1762306a36Sopenharmony_ci * for ARC calls need to reside in CKEG0/1. But as soon as the kernel
1862306a36Sopenharmony_ci * switches to it's first kernel thread stack is set to an address in
1962306a36Sopenharmony_ci * XKPHYS, so anything on stack can't be used anymore. This is solved
2062306a36Sopenharmony_ci * by using a * static declartion variables are put into BSS, which is
2162306a36Sopenharmony_ci * linked to a CKSEG0 address. Since this is only used on UP platforms
2262306a36Sopenharmony_ci * there is not spinlock needed
2362306a36Sopenharmony_ci */
2462306a36Sopenharmony_ci#define O32_STATIC	static
2562306a36Sopenharmony_ci#else
2662306a36Sopenharmony_ci#define O32_STATIC
2762306a36Sopenharmony_ci#endif
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci/*
3062306a36Sopenharmony_ci * IP22 boardcache is not compatible with board caches.	 Thus we disable it
3162306a36Sopenharmony_ci * during romvec action.  Since r4xx0.c is always compiled and linked with your
3262306a36Sopenharmony_ci * kernel, this shouldn't cause any harm regardless what MIPS processor you
3362306a36Sopenharmony_ci * have.
3462306a36Sopenharmony_ci *
3562306a36Sopenharmony_ci * The ARC write and read functions seem to interfere with the serial lines
3662306a36Sopenharmony_ci * in some way. You should be careful with them.
3762306a36Sopenharmony_ci */
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_civoid prom_putchar(char c)
4062306a36Sopenharmony_ci{
4162306a36Sopenharmony_ci	O32_STATIC ULONG cnt;
4262306a36Sopenharmony_ci	O32_STATIC CHAR it;
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci	it = c;
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci	bc_disable();
4762306a36Sopenharmony_ci	ArcWrite(1, &it, 1, &cnt);
4862306a36Sopenharmony_ci	bc_enable();
4962306a36Sopenharmony_ci}
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_cichar prom_getchar(void)
5262306a36Sopenharmony_ci{
5362306a36Sopenharmony_ci	O32_STATIC ULONG cnt;
5462306a36Sopenharmony_ci	O32_STATIC CHAR c;
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci	bc_disable();
5762306a36Sopenharmony_ci	ArcRead(0, &c, 1, &cnt);
5862306a36Sopenharmony_ci	bc_enable();
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci	return c;
6162306a36Sopenharmony_ci}
62