blob: ebfd13dc9d19f1a8d437d12adb06269a385855b4 [file] [log] [blame]
Paul Mackerras14cf11a2005-09-26 16:04:21 +10001/*
2 * Declarations of procedures and variables shared between files
3 * in arch/ppc/mm/.
4 *
5 * Derived from arch/ppc/mm/init.c:
6 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
7 *
8 * Modifications by Paul Mackerras (PowerMac) (paulus@cs.anu.edu.au)
9 * and Cort Dougan (PReP) (cort@cs.nmt.edu)
10 * Copyright (C) 1996 Paul Mackerras
Paul Mackerras14cf11a2005-09-26 16:04:21 +100011 *
12 * Derived from "arch/i386/mm/init.c"
13 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 *
20 */
David Gibson62102302007-04-24 13:09:12 +100021#include <linux/mm.h>
Paul Mackerras14cf11a2005-09-26 16:04:21 +100022#include <asm/tlbflush.h>
23#include <asm/mmu.h>
24
Benjamin Herrenschmidtee4f2ea2007-04-12 15:30:22 +100025extern void hash_preload(struct mm_struct *mm, unsigned long ea,
26 unsigned long access, unsigned long trap);
27
28
Paul Mackerrasab1f9da2005-10-10 21:58:35 +100029#ifdef CONFIG_PPC32
Paul Mackerras14cf11a2005-09-26 16:04:21 +100030extern void mapin_ram(void);
31extern int map_page(unsigned long va, phys_addr_t pa, int flags);
32extern void setbat(int index, unsigned long virt, unsigned long phys,
33 unsigned int size, int flags);
Paul Mackerras14cf11a2005-09-26 16:04:21 +100034extern void settlbcam(int index, unsigned long virt, phys_addr_t phys,
35 unsigned int size, int flags, unsigned int pid);
36extern void invalidate_tlbcam_entry(int index);
37
38extern int __map_without_bats;
39extern unsigned long ioremap_base;
Paul Mackerras14cf11a2005-09-26 16:04:21 +100040extern unsigned int rtas_data, rtas_size;
41
David Gibson8e561e72007-06-13 14:52:56 +100042struct hash_pte;
43extern struct hash_pte *Hash, *Hash_end;
Paul Mackerras14cf11a2005-09-26 16:04:21 +100044extern unsigned long Hash_size, Hash_mask;
45
46extern unsigned int num_tlbcam_entries;
Paul Mackerrasab1f9da2005-10-10 21:58:35 +100047#endif
48
David Gibson800fc3e2005-11-16 15:43:48 +110049extern unsigned long ioremap_bot;
Paul Mackerrasab1f9da2005-10-10 21:58:35 +100050extern unsigned long __max_low_memory;
51extern unsigned long __initial_memory_limit;
52extern unsigned long total_memory;
53extern unsigned long total_lowmem;
Paul Mackerras14cf11a2005-09-26 16:04:21 +100054
55/* ...and now those things that may be slightly different between processor
56 * architectures. -- Dan
57 */
58#if defined(CONFIG_8xx)
Benjamin Herrenschmidt0b477592007-11-20 18:32:12 +110059#define flush_HPTE(X, va, pg) _tlbie(va, 0 /* 8xx doesn't care about PID */)
Paul Mackerras14cf11a2005-09-26 16:04:21 +100060#define MMU_init_hw() do { } while(0)
61#define mmu_mapin_ram() (0UL)
62
63#elif defined(CONFIG_4xx)
Benjamin Herrenschmidte701d262007-10-30 09:46:06 +110064#define flush_HPTE(pid, va, pg) _tlbie(va, pid)
Paul Mackerras14cf11a2005-09-26 16:04:21 +100065extern void MMU_init_hw(void);
66extern unsigned long mmu_mapin_ram(void);
67
68#elif defined(CONFIG_FSL_BOOKE)
Benjamin Herrenschmidte701d262007-10-30 09:46:06 +110069#define flush_HPTE(pid, va, pg) _tlbie(va, pid)
Paul Mackerras14cf11a2005-09-26 16:04:21 +100070extern void MMU_init_hw(void);
71extern unsigned long mmu_mapin_ram(void);
72extern void adjust_total_lowmem(void);
73
Paul Mackerrasab1f9da2005-10-10 21:58:35 +100074#elif defined(CONFIG_PPC32)
75/* anything 32-bit except 4xx or 8xx */
Paul Mackerras14cf11a2005-09-26 16:04:21 +100076extern void MMU_init_hw(void);
77extern unsigned long mmu_mapin_ram(void);
78
79/* Be careful....this needs to be updated if we ever encounter 603 SMPs,
80 * which includes all new 82xx processors. We need tlbie/tlbsync here
81 * in that case (I think). -- Dan.
82 */
83static inline void flush_HPTE(unsigned context, unsigned long va,
84 unsigned long pdval)
85{
86 if ((Hash != 0) &&
87 cpu_has_feature(CPU_FTR_HPTE_TABLE))
88 flush_hash_pages(0, va, pdval, 1);
89 else
90 _tlbie(va);
91}
Paul Mackerras14cf11a2005-09-26 16:04:21 +100092#endif