mmu_decl.h 4.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
 * Declarations of procedures and variables shared between files
 * in arch/ppc/mm/.
 *
 *  Derived from arch/ppc/mm/init.c:
 *    Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
 *
 *  Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
 *  and Cort Dougan (PReP) (cort@cs.nmt.edu)
 *    Copyright (C) 1996 Paul Mackerras
 *
 *  Derived from "arch/i386/mm/init.c"
 *    Copyright (C) 1991, 1992, 1993, 1994  Linus Torvalds
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version
 *  2 of the License, or (at your option) any later version.
 *
 */
21
#include <linux/mm.h>
22 23 24
#include <asm/tlbflush.h>
#include <asm/mmu.h>

25 26 27 28 29 30 31 32
#ifdef CONFIG_PPC_MMU_NOHASH

/*
 * On 40x and 8xx, we directly inline tlbia and tlbivax
 */
#if defined(CONFIG_40x) || defined(CONFIG_8xx)
static inline void _tlbil_all(void)
{
33
	asm volatile ("sync; tlbia; isync" : : : "memory");
34 35 36
}
static inline void _tlbil_pid(unsigned int pid)
{
37
	asm volatile ("sync; tlbia; isync" : : : "memory");
38
}
39 40
#define _tlbil_pid_noind(pid)	_tlbil_pid(pid)

41 42 43
#else /* CONFIG_40x || CONFIG_8xx */
extern void _tlbil_all(void);
extern void _tlbil_pid(unsigned int pid);
44 45 46
#ifdef CONFIG_PPC_BOOK3E
extern void _tlbil_pid_noind(unsigned int pid);
#else
47
#define _tlbil_pid_noind(pid)	_tlbil_pid(pid)
48
#endif
49 50 51 52 53 54
#endif /* !(CONFIG_40x || CONFIG_8xx) */

/*
 * On 8xx, we directly inline tlbie, on others, it's extern
 */
#ifdef CONFIG_8xx
55 56
static inline void _tlbil_va(unsigned long address, unsigned int pid,
			     unsigned int tsize, unsigned int ind)
57
{
58
	asm volatile ("tlbie %0; sync" : : "r" (address) : "memory");
59
}
60 61 62 63
#elif defined(CONFIG_PPC_BOOK3E)
extern void _tlbil_va(unsigned long address, unsigned int pid,
		      unsigned int tsize, unsigned int ind);
#else
64 65 66 67 68 69
extern void __tlbil_va(unsigned long address, unsigned int pid);
static inline void _tlbil_va(unsigned long address, unsigned int pid,
			     unsigned int tsize, unsigned int ind)
{
	__tlbil_va(address, pid);
}
70 71 72 73 74 75 76
#endif /* CONIFG_8xx */

/*
 * As of today, we don't support tlbivax broadcast on any
 * implementation. When that becomes the case, this will be
 * an extern.
 */
77 78 79 80
#ifdef CONFIG_PPC_BOOK3E
extern void _tlbivax_bcast(unsigned long address, unsigned int pid,
			   unsigned int tsize, unsigned int ind);
#else
81 82
static inline void _tlbivax_bcast(unsigned long address, unsigned int pid,
				   unsigned int tsize, unsigned int ind)
83 84 85
{
	BUG();
}
86
#endif
87 88 89

#else /* CONFIG_PPC_MMU_NOHASH */

90 91 92 93
extern void hash_preload(struct mm_struct *mm, unsigned long ea,
			 unsigned long access, unsigned long trap);


94 95 96 97 98
extern void _tlbie(unsigned long address);
extern void _tlbia(void);

#endif /* CONFIG_PPC_MMU_NOHASH */

99
#ifdef CONFIG_PPC32
100 101 102 103 104 105 106 107 108

struct tlbcam {
	u32	MAS0;
	u32	MAS1;
	u32	MAS2;
	u32	MAS3;
	u32	MAS7;
};

109 110
extern void mapin_ram(void);
extern int map_page(unsigned long va, phys_addr_t pa, int flags);
111
extern void setbat(int index, unsigned long virt, phys_addr_t phys,
112 113 114 115 116 117 118 119 120
		   unsigned int size, int flags);
extern void settlbcam(int index, unsigned long virt, phys_addr_t phys,
		      unsigned int size, int flags, unsigned int pid);
extern void invalidate_tlbcam_entry(int index);

extern int __map_without_bats;
extern unsigned long ioremap_base;
extern unsigned int rtas_data, rtas_size;

121 122
struct hash_pte;
extern struct hash_pte *Hash, *Hash_end;
123
extern unsigned long Hash_size, Hash_mask;
124 125 126 127 128 129

#endif /* CONFIG_PPC32 */

#ifdef CONFIG_PPC64
extern int map_kernel_page(unsigned long ea, unsigned long pa, int flags);
#endif /* CONFIG_PPC64 */
130

D
David Gibson 已提交
131
extern unsigned long ioremap_bot;
132
extern unsigned long __max_low_memory;
133
extern phys_addr_t __initial_memory_limit_addr;
134 135
extern phys_addr_t total_memory;
extern phys_addr_t total_lowmem;
136
extern phys_addr_t memstart_addr;
137
extern phys_addr_t lowmem_end_addr;
138

139 140 141 142 143 144 145 146
#ifdef CONFIG_WII
extern unsigned long wii_hole_start;
extern unsigned long wii_hole_size;

extern unsigned long wii_mmu_mapin_mem2(unsigned long top);
extern void wii_memory_fixups(void);
#endif

147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
/* ...and now those things that may be slightly different between processor
 * architectures.  -- Dan
 */
#if defined(CONFIG_8xx)
#define MMU_init_hw()		do { } while(0)
#define mmu_mapin_ram()		(0UL)

#elif defined(CONFIG_4xx)
extern void MMU_init_hw(void);
extern unsigned long mmu_mapin_ram(void);

#elif defined(CONFIG_FSL_BOOKE)
extern void MMU_init_hw(void);
extern unsigned long mmu_mapin_ram(void);
extern void adjust_total_lowmem(void);

163 164
#elif defined(CONFIG_PPC32)
/* anything 32-bit except 4xx or 8xx */
165
extern void MMU_init_hw(void);
166
extern unsigned long mmu_mapin_ram(unsigned long top);
167
#endif