mmu.h 2.1 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3
#ifndef __MMU_H
#define __MMU_H

4 5 6 7 8 9
/*
 * Privileged Space Mapping Buffer (PMB) definitions
 */
#define PMB_PASCR		0xff000070
#define PMB_IRMCR		0xff000078

M
Matt Fleming 已提交
10 11
#define PASCR_SE		0x80000000

12 13
#define PMB_ADDR		0xf6100000
#define PMB_DATA		0xf7100000
P
Paul Mundt 已提交
14 15 16

#define NR_PMB_ENTRIES		16

17 18 19
#define PMB_E_MASK		0x0000000f
#define PMB_E_SHIFT		8

20 21
#define PMB_PFN_MASK		0xff000000

22 23 24 25 26 27 28 29
#define PMB_SZ_16M		0x00000000
#define PMB_SZ_64M		0x00000010
#define PMB_SZ_128M		0x00000080
#define PMB_SZ_512M		0x00000090
#define PMB_SZ_MASK		PMB_SZ_512M
#define PMB_C			0x00000008
#define PMB_WT			0x00000001
#define PMB_UB			0x00000200
30
#define PMB_CACHE_MASK		(PMB_C | PMB_WT | PMB_UB)
31 32 33 34
#define PMB_V			0x00000100

#define PMB_NO_ENTRY		(-1)

35
#ifndef __ASSEMBLY__
M
Matt Fleming 已提交
36
#include <linux/errno.h>
37
#include <linux/threads.h>
38
#include <asm/page.h>
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

/* Default "unsigned long" context */
typedef unsigned long mm_context_id_t[NR_CPUS];

typedef struct {
#ifdef CONFIG_MMU
	mm_context_id_t		id;
	void			*vdso;
#else
	unsigned long		end_brk;
#endif
#ifdef CONFIG_BINFMT_ELF_FDPIC
	unsigned long		exec_fdpic_loadmap;
	unsigned long		interp_fdpic_loadmap;
#endif
} mm_context_t;

P
Paul Mundt 已提交
56 57
struct pmb_entry;

58 59 60 61
struct pmb_entry {
	unsigned long vpn;
	unsigned long ppn;
	unsigned long flags;
62
	unsigned long size;
63 64 65 66 67 68

	/*
	 * 0 .. NR_PMB_ENTRIES for specific entry selection, or
	 * PMB_NO_ENTRY to search for a free one
	 */
	int entry;
P
Paul Mundt 已提交
69 70 71

	/* Adjacent entry link for contiguous multi-entry mappings */
	struct pmb_entry *link;
72 73
};

P
Paul Mundt 已提交
74
#ifdef CONFIG_PMB
75
/* arch/sh/mm/pmb.c */
P
Paul Mundt 已提交
76
long pmb_remap(unsigned long virt, unsigned long phys,
77
	       unsigned long size, pgprot_t prot);
P
Paul Mundt 已提交
78
void pmb_unmap(unsigned long addr);
M
Matt Fleming 已提交
79
int pmb_init(void);
80
bool __in_29bit_mode(void);
P
Paul Mundt 已提交
81 82
#else
static inline long pmb_remap(unsigned long virt, unsigned long phys,
83
			     unsigned long size, pgprot_t prot)
P
Paul Mundt 已提交
84
{
M
Matt Fleming 已提交
85
	return -EINVAL;
P
Paul Mundt 已提交
86 87 88 89 90 91 92 93 94 95 96
}

static inline void pmb_unmap(unsigned long addr)
{
}

static inline int pmb_init(void)
{
	return -ENODEV;
}

97 98 99 100 101 102 103
#ifdef CONFIG_29BIT
#define __in_29bit_mode()	(1)
#else
#define __in_29bit_mode()	(0)
#endif

#endif /* CONFIG_PMB */
104
#endif /* __ASSEMBLY__ */
105 106

#endif /* __MMU_H */