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

P
Paul Mundt 已提交
4 5
/* Default "unsigned long" context */
typedef unsigned long mm_context_id_t[NR_CPUS];
L
Linus Torvalds 已提交
6 7

typedef struct {
P
Paul Mundt 已提交
8 9 10 11
#ifdef CONFIG_MMU
	mm_context_id_t		id;
	void			*vdso;
#else
L
Linus Torvalds 已提交
12
	unsigned long		end_brk;
P
Paul Mundt 已提交
13
#endif
P
Paul Mundt 已提交
14 15 16 17
#ifdef CONFIG_BINFMT_ELF_FDPIC
	unsigned long		exec_fdpic_loadmap;
	unsigned long		interp_fdpic_loadmap;
#endif
L
Linus Torvalds 已提交
18 19
} mm_context_t;

20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
/*
 * Privileged Space Mapping Buffer (PMB) definitions
 */
#define PMB_PASCR		0xff000070
#define PMB_IRMCR		0xff000078

#define PMB_ADDR		0xf6100000
#define PMB_DATA		0xf7100000
#define PMB_ENTRY_MAX		16
#define PMB_E_MASK		0x0000000f
#define PMB_E_SHIFT		8

#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
#define PMB_V			0x00000100

#define PMB_NO_ENTRY		(-1)

P
Paul Mundt 已提交
44 45
struct pmb_entry;

46 47 48 49 50 51 52 53 54 55
struct pmb_entry {
	unsigned long vpn;
	unsigned long ppn;
	unsigned long flags;

	/*
	 * 0 .. NR_PMB_ENTRIES for specific entry selection, or
	 * PMB_NO_ENTRY to search for a free one
	 */
	int entry;
P
Paul Mundt 已提交
56 57 58 59

	struct pmb_entry *next;
	/* Adjacent entry link for contiguous multi-entry mappings */
	struct pmb_entry *link;
60 61 62 63 64
};

/* arch/sh/mm/pmb.c */
int __set_pmb_entry(unsigned long vpn, unsigned long ppn,
		    unsigned long flags, int *entry);
P
Paul Mundt 已提交
65
int set_pmb_entry(struct pmb_entry *pmbe);
66 67 68 69
void clear_pmb_entry(struct pmb_entry *pmbe);
struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
			    unsigned long flags);
void pmb_free(struct pmb_entry *pmbe);
P
Paul Mundt 已提交
70 71 72
long pmb_remap(unsigned long virt, unsigned long phys,
	       unsigned long size, unsigned long flags);
void pmb_unmap(unsigned long addr);
73 74

#endif /* __MMU_H */
L
Linus Torvalds 已提交
75