blob: ef0ae2a28f232638565519656f4f00bf3eb8cdd4 [file] [log] [blame]
Paul Mundt959f7d52007-11-10 20:35:53 +09001/*
2 * include/asm-sh/tlb_64.h
3 *
4 * Copyright (C) 2003 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_SH_TLB_64_H
11#define __ASM_SH_TLB_64_H
12
13/* ITLB defines */
14#define ITLB_FIXED 0x00000000 /* First fixed ITLB, see head.S */
15#define ITLB_LAST_VAR_UNRESTRICTED 0x000003F0 /* Last ITLB */
16
17/* DTLB defines */
18#define DTLB_FIXED 0x00800000 /* First fixed DTLB, see head.S */
19#define DTLB_LAST_VAR_UNRESTRICTED 0x008003F0 /* Last DTLB */
20
21#ifndef __ASSEMBLY__
22
23/**
Paul Mundt6a9545b2008-08-04 12:51:06 +090024 * for_each_dtlb_entry - Iterate over free (non-wired) DTLB entries
Paul Mundt959f7d52007-11-10 20:35:53 +090025 *
26 * @tlb: TLB entry
Paul Mundt959f7d52007-11-10 20:35:53 +090027 */
28#define for_each_dtlb_entry(tlb) \
29 for (tlb = cpu_data->dtlb.first; \
30 tlb <= cpu_data->dtlb.last; \
31 tlb += cpu_data->dtlb.step)
32
33/**
Paul Mundt6a9545b2008-08-04 12:51:06 +090034 * for_each_itlb_entry - Iterate over free (non-wired) ITLB entries
Paul Mundt959f7d52007-11-10 20:35:53 +090035 *
36 * @tlb: TLB entry
Paul Mundt959f7d52007-11-10 20:35:53 +090037 */
38#define for_each_itlb_entry(tlb) \
39 for (tlb = cpu_data->itlb.first; \
40 tlb <= cpu_data->itlb.last; \
41 tlb += cpu_data->itlb.step)
42
43/**
Paul Mundt6a9545b2008-08-04 12:51:06 +090044 * __flush_tlb_slot - Flushes TLB slot @slot.
Paul Mundt959f7d52007-11-10 20:35:53 +090045 *
46 * @slot: Address of TLB slot.
Paul Mundt959f7d52007-11-10 20:35:53 +090047 */
48static inline void __flush_tlb_slot(unsigned long long slot)
49{
50 __asm__ __volatile__ ("putcfg %0, 0, r63\n" : : "r" (slot));
51}
52
Paul Mundtccd80582008-04-25 12:58:40 +090053#ifdef CONFIG_MMU
Paul Mundt959f7d52007-11-10 20:35:53 +090054/* arch/sh64/mm/tlb.c */
55int sh64_tlb_init(void);
56unsigned long long sh64_next_free_dtlb_entry(void);
57unsigned long long sh64_get_wired_dtlb_entry(void);
58int sh64_put_wired_dtlb_entry(unsigned long long entry);
59void sh64_setup_tlb_slot(unsigned long long config_addr, unsigned long eaddr,
60 unsigned long asid, unsigned long paddr);
61void sh64_teardown_tlb_slot(unsigned long long config_addr);
Paul Mundtccd80582008-04-25 12:58:40 +090062#else
63#define sh64_tlb_init() do { } while (0)
64#define sh64_next_free_dtlb_entry() (0)
65#define sh64_get_wired_dtlb_entry() (0)
66#define sh64_put_wired_dtlb_entry(entry) do { } while (0)
67#define sh64_setup_tlb_slot(conf, virt, asid, phys) do { } while (0)
68#define sh64_teardown_tlb_slot(addr) do { } while (0)
69#endif /* CONFIG_MMU */
Paul Mundt959f7d52007-11-10 20:35:53 +090070#endif /* __ASSEMBLY__ */
71#endif /* __ASM_SH_TLB_64_H */