1118616Snjl/* SPDX-License-Identifier: GPL-2.0-or-later */
2118616Snjl/*
3118616Snjl * OpenRISC Linux
4118616Snjl *
5118616Snjl * Linux architectural port borrowing liberally from similar works of
6118616Snjl * others.  All original copyrights apply as per the original source
7118616Snjl * declaration.
8118616Snjl *
9118616Snjl * OpenRISC implementation:
10118616Snjl * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
11118616Snjl * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
12118616Snjl * et al.
13118616Snjl */
14118616Snjl
15118616Snjl#ifndef __ASM_OPENRISC_FIXMAP_H
16118616Snjl#define __ASM_OPENRISC_FIXMAP_H
17118616Snjl
18118616Snjl/* Why exactly do we need 2 empty pages between the top of the fixed
19118616Snjl * addresses and the top of virtual memory?  Something is using that
20118616Snjl * memory space but not sure what right now... If you find it, leave
21118616Snjl * a comment here.
22118616Snjl */
23118616Snjl#define FIXADDR_TOP	((unsigned long) (-2*PAGE_SIZE))
24118616Snjl
25118616Snjl#include <linux/kernel.h>
26118616Snjl#include <linux/bug.h>
27118616Snjl#include <asm/page.h>
28118616Snjl
29118616Snjl/*
30118616Snjl * On OpenRISC we use these special fixed_addresses for doing ioremap
31118616Snjl * early in the boot process before memory initialization is complete.
32118616Snjl * This is used, in particular, by the early serial console code.
33118616Snjl *
34118616Snjl * It's not really 'fixmap', per se, but fits loosely into the same
35118616Snjl * paradigm.
36118616Snjl */
37118616Snjlenum fixed_addresses {
38118616Snjl	/*
39118616Snjl	 * FIX_IOREMAP entries are useful for mapping physical address
40118616Snjl	 * space before ioremap() is useable, e.g. really early in boot
41118616Snjl	 * before kmalloc() is working.
42118616Snjl	 */
43118616Snjl#define FIX_N_IOREMAPS  32
44118616Snjl	FIX_IOREMAP_BEGIN,
45118616Snjl	FIX_IOREMAP_END = FIX_IOREMAP_BEGIN + FIX_N_IOREMAPS - 1,
46118616Snjl	__end_of_fixed_addresses
47118616Snjl};
48118616Snjl
49118616Snjl#define FIXADDR_SIZE		(__end_of_fixed_addresses << PAGE_SHIFT)
50118616Snjl/* FIXADDR_BOTTOM might be a better name here... */
51118616Snjl#define FIXADDR_START		(FIXADDR_TOP - FIXADDR_SIZE)
52118616Snjl
53118616Snjl#include <asm-generic/fixmap.h>
54118616Snjl
55118616Snjl#endif
56118616Snjl