2005-09-26 02:04:21 -04:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
2007-04-23 23:09:12 -04:00
|
|
|
#include <linux/mm.h>
|
2005-09-26 02:04:21 -04:00
|
|
|
#include <asm/tlbflush.h>
|
|
|
|
#include <asm/mmu.h>
|
|
|
|
|
2008-12-18 14:13:42 -05:00
|
|
|
#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)
|
|
|
|
{
|
2009-01-06 12:56:51 -05:00
|
|
|
asm volatile ("sync; tlbia; isync" : : : "memory");
|
2008-12-18 14:13:42 -05:00
|
|
|
}
|
|
|
|
static inline void _tlbil_pid(unsigned int pid)
|
|
|
|
{
|
2009-01-06 12:56:51 -05:00
|
|
|
asm volatile ("sync; tlbia; isync" : : : "memory");
|
2008-12-18 14:13:42 -05:00
|
|
|
}
|
2009-07-23 19:15:24 -04:00
|
|
|
#define _tlbil_pid_noind(pid) _tlbil_pid(pid)
|
|
|
|
|
2008-12-18 14:13:42 -05:00
|
|
|
#else /* CONFIG_40x || CONFIG_8xx */
|
|
|
|
extern void _tlbil_all(void);
|
|
|
|
extern void _tlbil_pid(unsigned int pid);
|
2009-07-23 19:15:47 -04:00
|
|
|
#ifdef CONFIG_PPC_BOOK3E
|
|
|
|
extern void _tlbil_pid_noind(unsigned int pid);
|
|
|
|
#else
|
2009-07-23 19:15:24 -04:00
|
|
|
#define _tlbil_pid_noind(pid) _tlbil_pid(pid)
|
2009-07-23 19:15:47 -04:00
|
|
|
#endif
|
2008-12-18 14:13:42 -05:00
|
|
|
#endif /* !(CONFIG_40x || CONFIG_8xx) */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* On 8xx, we directly inline tlbie, on others, it's extern
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_8xx
|
2009-07-23 19:15:24 -04:00
|
|
|
static inline void _tlbil_va(unsigned long address, unsigned int pid,
|
|
|
|
unsigned int tsize, unsigned int ind)
|
2008-12-18 14:13:42 -05:00
|
|
|
{
|
2009-01-06 12:56:51 -05:00
|
|
|
asm volatile ("tlbie %0; sync" : : "r" (address) : "memory");
|
2008-12-18 14:13:42 -05:00
|
|
|
}
|
2009-07-23 19:15:47 -04:00
|
|
|
#elif defined(CONFIG_PPC_BOOK3E)
|
|
|
|
extern void _tlbil_va(unsigned long address, unsigned int pid,
|
|
|
|
unsigned int tsize, unsigned int ind);
|
|
|
|
#else
|
2009-07-23 19:15:24 -04:00
|
|
|
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);
|
|
|
|
}
|
2008-12-18 14:13:42 -05:00
|
|
|
#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.
|
|
|
|
*/
|
2009-07-23 19:15:47 -04:00
|
|
|
#ifdef CONFIG_PPC_BOOK3E
|
|
|
|
extern void _tlbivax_bcast(unsigned long address, unsigned int pid,
|
|
|
|
unsigned int tsize, unsigned int ind);
|
|
|
|
#else
|
2009-07-23 19:15:24 -04:00
|
|
|
static inline void _tlbivax_bcast(unsigned long address, unsigned int pid,
|
|
|
|
unsigned int tsize, unsigned int ind)
|
2008-12-18 14:13:42 -05:00
|
|
|
{
|
|
|
|
BUG();
|
|
|
|
}
|
2009-07-23 19:15:47 -04:00
|
|
|
#endif
|
2008-12-18 14:13:42 -05:00
|
|
|
|
|
|
|
#else /* CONFIG_PPC_MMU_NOHASH */
|
|
|
|
|
2007-04-12 01:30:22 -04:00
|
|
|
extern void hash_preload(struct mm_struct *mm, unsigned long ea,
|
|
|
|
unsigned long access, unsigned long trap);
|
|
|
|
|
|
|
|
|
2008-12-18 14:13:42 -05:00
|
|
|
extern void _tlbie(unsigned long address);
|
|
|
|
extern void _tlbia(void);
|
|
|
|
|
|
|
|
#endif /* CONFIG_PPC_MMU_NOHASH */
|
|
|
|
|
2005-10-10 07:58:35 -04:00
|
|
|
#ifdef CONFIG_PPC32
|
2008-12-08 22:34:55 -05:00
|
|
|
|
2005-09-26 02:04:21 -04:00
|
|
|
extern void mapin_ram(void);
|
|
|
|
extern int map_page(unsigned long va, phys_addr_t pa, int flags);
|
2008-06-13 19:41:42 -04:00
|
|
|
extern void setbat(int index, unsigned long virt, phys_addr_t phys,
|
2005-09-26 02:04:21 -04:00
|
|
|
unsigned int size, int flags);
|
|
|
|
|
|
|
|
extern int __map_without_bats;
|
2009-12-12 01:31:54 -05:00
|
|
|
extern int __allow_ioremap_reserved;
|
2005-09-26 02:04:21 -04:00
|
|
|
extern unsigned long ioremap_base;
|
|
|
|
extern unsigned int rtas_data, rtas_size;
|
|
|
|
|
2007-06-13 00:52:56 -04:00
|
|
|
struct hash_pte;
|
|
|
|
extern struct hash_pte *Hash, *Hash_end;
|
2005-09-26 02:04:21 -04:00
|
|
|
extern unsigned long Hash_size, Hash_mask;
|
2009-07-23 19:15:58 -04:00
|
|
|
|
|
|
|
#endif /* CONFIG_PPC32 */
|
|
|
|
|
|
|
|
#ifdef CONFIG_PPC64
|
|
|
|
extern int map_kernel_page(unsigned long ea, unsigned long pa, int flags);
|
|
|
|
#endif /* CONFIG_PPC64 */
|
2005-10-10 07:58:35 -04:00
|
|
|
|
2005-11-15 23:43:48 -05:00
|
|
|
extern unsigned long ioremap_bot;
|
2005-10-10 07:58:35 -04:00
|
|
|
extern unsigned long __max_low_memory;
|
2008-04-15 15:52:25 -04:00
|
|
|
extern phys_addr_t __initial_memory_limit_addr;
|
2008-07-09 11:09:23 -04:00
|
|
|
extern phys_addr_t total_memory;
|
|
|
|
extern phys_addr_t total_lowmem;
|
2008-04-15 15:52:21 -04:00
|
|
|
extern phys_addr_t memstart_addr;
|
2008-04-15 15:52:22 -04:00
|
|
|
extern phys_addr_t lowmem_end_addr;
|
2005-09-26 02:04:21 -04:00
|
|
|
|
2009-12-12 01:31:53 -05:00
|
|
|
#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
|
|
|
|
|
2005-09-26 02:04:21 -04:00
|
|
|
/* ...and now those things that may be slightly different between processor
|
|
|
|
* architectures. -- Dan
|
|
|
|
*/
|
|
|
|
#if defined(CONFIG_8xx)
|
|
|
|
#define MMU_init_hw() do { } while(0)
|
2009-12-14 11:04:24 -05:00
|
|
|
#define mmu_mapin_ram(top) (0UL)
|
2005-09-26 02:04:21 -04:00
|
|
|
|
|
|
|
#elif defined(CONFIG_4xx)
|
|
|
|
extern void MMU_init_hw(void);
|
2009-12-14 11:04:24 -05:00
|
|
|
extern unsigned long mmu_mapin_ram(unsigned long top);
|
2005-09-26 02:04:21 -04:00
|
|
|
|
|
|
|
#elif defined(CONFIG_FSL_BOOKE)
|
|
|
|
extern void MMU_init_hw(void);
|
2009-12-14 11:04:24 -05:00
|
|
|
extern unsigned long mmu_mapin_ram(unsigned long top);
|
2005-09-26 02:04:21 -04:00
|
|
|
extern void adjust_total_lowmem(void);
|
|
|
|
|
2005-10-10 07:58:35 -04:00
|
|
|
#elif defined(CONFIG_PPC32)
|
|
|
|
/* anything 32-bit except 4xx or 8xx */
|
2005-09-26 02:04:21 -04:00
|
|
|
extern void MMU_init_hw(void);
|
2009-12-12 01:31:53 -05:00
|
|
|
extern unsigned long mmu_mapin_ram(unsigned long top);
|
2005-09-26 02:04:21 -04:00
|
|
|
#endif
|