114cf11afSPaul Mackerras /* 214cf11afSPaul Mackerras * Declarations of procedures and variables shared between files 314cf11afSPaul Mackerras * in arch/ppc/mm/. 414cf11afSPaul Mackerras * 514cf11afSPaul Mackerras * Derived from arch/ppc/mm/init.c: 614cf11afSPaul Mackerras * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 714cf11afSPaul Mackerras * 814cf11afSPaul Mackerras * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au) 914cf11afSPaul Mackerras * and Cort Dougan (PReP) (cort@cs.nmt.edu) 1014cf11afSPaul Mackerras * Copyright (C) 1996 Paul Mackerras 1114cf11afSPaul Mackerras * 1214cf11afSPaul Mackerras * Derived from "arch/i386/mm/init.c" 1314cf11afSPaul Mackerras * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 1414cf11afSPaul Mackerras * 1514cf11afSPaul Mackerras * This program is free software; you can redistribute it and/or 1614cf11afSPaul Mackerras * modify it under the terms of the GNU General Public License 1714cf11afSPaul Mackerras * as published by the Free Software Foundation; either version 1814cf11afSPaul Mackerras * 2 of the License, or (at your option) any later version. 1914cf11afSPaul Mackerras * 2014cf11afSPaul Mackerras */ 2162102307SDavid Gibson #include <linux/mm.h> 2214cf11afSPaul Mackerras #include <asm/tlbflush.h> 2314cf11afSPaul Mackerras #include <asm/mmu.h> 2414cf11afSPaul Mackerras 25*2a4aca11SBenjamin Herrenschmidt #ifdef CONFIG_PPC_MMU_NOHASH 26*2a4aca11SBenjamin Herrenschmidt 27*2a4aca11SBenjamin Herrenschmidt /* 28*2a4aca11SBenjamin Herrenschmidt * On 40x and 8xx, we directly inline tlbia and tlbivax 29*2a4aca11SBenjamin Herrenschmidt */ 30*2a4aca11SBenjamin Herrenschmidt #if defined(CONFIG_40x) || defined(CONFIG_8xx) 31*2a4aca11SBenjamin Herrenschmidt static inline void _tlbil_all(void) 32*2a4aca11SBenjamin Herrenschmidt { 33*2a4aca11SBenjamin Herrenschmidt asm volatile ("sync; tlbia; isync" : : : "memory") 34*2a4aca11SBenjamin Herrenschmidt } 35*2a4aca11SBenjamin Herrenschmidt static inline void _tlbil_pid(unsigned int pid) 36*2a4aca11SBenjamin Herrenschmidt { 37*2a4aca11SBenjamin Herrenschmidt asm volatile ("sync; tlbia; isync" : : : "memory") 38*2a4aca11SBenjamin Herrenschmidt } 39*2a4aca11SBenjamin Herrenschmidt #else /* CONFIG_40x || CONFIG_8xx */ 40*2a4aca11SBenjamin Herrenschmidt extern void _tlbil_all(void); 41*2a4aca11SBenjamin Herrenschmidt extern void _tlbil_pid(unsigned int pid); 42*2a4aca11SBenjamin Herrenschmidt #endif /* !(CONFIG_40x || CONFIG_8xx) */ 43*2a4aca11SBenjamin Herrenschmidt 44*2a4aca11SBenjamin Herrenschmidt /* 45*2a4aca11SBenjamin Herrenschmidt * On 8xx, we directly inline tlbie, on others, it's extern 46*2a4aca11SBenjamin Herrenschmidt */ 47*2a4aca11SBenjamin Herrenschmidt #ifdef CONFIG_8xx 48*2a4aca11SBenjamin Herrenschmidt static inline void _tlbil_va(unsigned long address, unsigned int pid) 49*2a4aca11SBenjamin Herrenschmidt { 50*2a4aca11SBenjamin Herrenschmidt asm volatile ("tlbie %0; sync" : : "r" (address) : "memory") 51*2a4aca11SBenjamin Herrenschmidt } 52*2a4aca11SBenjamin Herrenschmidt #else /* CONFIG_8xx */ 53*2a4aca11SBenjamin Herrenschmidt extern void _tlbil_va(unsigned long address, unsigned int pid); 54*2a4aca11SBenjamin Herrenschmidt #endif /* CONIFG_8xx */ 55*2a4aca11SBenjamin Herrenschmidt 56*2a4aca11SBenjamin Herrenschmidt /* 57*2a4aca11SBenjamin Herrenschmidt * As of today, we don't support tlbivax broadcast on any 58*2a4aca11SBenjamin Herrenschmidt * implementation. When that becomes the case, this will be 59*2a4aca11SBenjamin Herrenschmidt * an extern. 60*2a4aca11SBenjamin Herrenschmidt */ 61*2a4aca11SBenjamin Herrenschmidt static inline void _tlbivax_bcast(unsigned long address, unsigned int pid) 62*2a4aca11SBenjamin Herrenschmidt { 63*2a4aca11SBenjamin Herrenschmidt BUG(); 64*2a4aca11SBenjamin Herrenschmidt } 65*2a4aca11SBenjamin Herrenschmidt 66*2a4aca11SBenjamin Herrenschmidt #else /* CONFIG_PPC_MMU_NOHASH */ 67*2a4aca11SBenjamin Herrenschmidt 68ee4f2ea4SBenjamin Herrenschmidt extern void hash_preload(struct mm_struct *mm, unsigned long ea, 69ee4f2ea4SBenjamin Herrenschmidt unsigned long access, unsigned long trap); 70ee4f2ea4SBenjamin Herrenschmidt 71ee4f2ea4SBenjamin Herrenschmidt 72*2a4aca11SBenjamin Herrenschmidt extern void _tlbie(unsigned long address); 73*2a4aca11SBenjamin Herrenschmidt extern void _tlbia(void); 74*2a4aca11SBenjamin Herrenschmidt 75*2a4aca11SBenjamin Herrenschmidt #endif /* CONFIG_PPC_MMU_NOHASH */ 76*2a4aca11SBenjamin Herrenschmidt 77ab1f9dacSPaul Mackerras #ifdef CONFIG_PPC32 7814cf11afSPaul Mackerras extern void mapin_ram(void); 7914cf11afSPaul Mackerras extern int map_page(unsigned long va, phys_addr_t pa, int flags); 807c5c4325SBecky Bruce extern void setbat(int index, unsigned long virt, phys_addr_t phys, 8114cf11afSPaul Mackerras unsigned int size, int flags); 8214cf11afSPaul Mackerras extern void settlbcam(int index, unsigned long virt, phys_addr_t phys, 8314cf11afSPaul Mackerras unsigned int size, int flags, unsigned int pid); 8414cf11afSPaul Mackerras extern void invalidate_tlbcam_entry(int index); 8514cf11afSPaul Mackerras 8614cf11afSPaul Mackerras extern int __map_without_bats; 8714cf11afSPaul Mackerras extern unsigned long ioremap_base; 8814cf11afSPaul Mackerras extern unsigned int rtas_data, rtas_size; 8914cf11afSPaul Mackerras 908e561e7eSDavid Gibson struct hash_pte; 918e561e7eSDavid Gibson extern struct hash_pte *Hash, *Hash_end; 9214cf11afSPaul Mackerras extern unsigned long Hash_size, Hash_mask; 9314cf11afSPaul Mackerras 9414cf11afSPaul Mackerras extern unsigned int num_tlbcam_entries; 95ab1f9dacSPaul Mackerras #endif 96ab1f9dacSPaul Mackerras 97800fc3eeSDavid Gibson extern unsigned long ioremap_bot; 98ab1f9dacSPaul Mackerras extern unsigned long __max_low_memory; 9909b5e63fSKumar Gala extern phys_addr_t __initial_memory_limit_addr; 1002bf3016fSStefan Roese extern phys_addr_t total_memory; 1012bf3016fSStefan Roese extern phys_addr_t total_lowmem; 10299c62dd7SKumar Gala extern phys_addr_t memstart_addr; 103d7917ba7SKumar Gala extern phys_addr_t lowmem_end_addr; 10414cf11afSPaul Mackerras 10514cf11afSPaul Mackerras /* ...and now those things that may be slightly different between processor 10614cf11afSPaul Mackerras * architectures. -- Dan 10714cf11afSPaul Mackerras */ 10814cf11afSPaul Mackerras #if defined(CONFIG_8xx) 10914cf11afSPaul Mackerras #define MMU_init_hw() do { } while(0) 11014cf11afSPaul Mackerras #define mmu_mapin_ram() (0UL) 11114cf11afSPaul Mackerras 11214cf11afSPaul Mackerras #elif defined(CONFIG_4xx) 11314cf11afSPaul Mackerras extern void MMU_init_hw(void); 11414cf11afSPaul Mackerras extern unsigned long mmu_mapin_ram(void); 11514cf11afSPaul Mackerras 11614cf11afSPaul Mackerras #elif defined(CONFIG_FSL_BOOKE) 11714cf11afSPaul Mackerras extern void MMU_init_hw(void); 11814cf11afSPaul Mackerras extern unsigned long mmu_mapin_ram(void); 11914cf11afSPaul Mackerras extern void adjust_total_lowmem(void); 12014cf11afSPaul Mackerras 121ab1f9dacSPaul Mackerras #elif defined(CONFIG_PPC32) 122ab1f9dacSPaul Mackerras /* anything 32-bit except 4xx or 8xx */ 12314cf11afSPaul Mackerras extern void MMU_init_hw(void); 12414cf11afSPaul Mackerras extern unsigned long mmu_mapin_ram(void); 12514cf11afSPaul Mackerras #endif 126