Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/*
2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _ASM_ARC_MMU_H
10#define _ASM_ARC_MMU_H
11
12#if defined(CONFIG_ARC_MMU_V1)
13#define CONFIG_ARC_MMU_VER 1
14#elif defined(CONFIG_ARC_MMU_V2)
15#define CONFIG_ARC_MMU_VER 2
16#elif defined(CONFIG_ARC_MMU_V3)
17#define CONFIG_ARC_MMU_VER 3
18#elif defined(CONFIG_ARC_MMU_V4)
19#define CONFIG_ARC_MMU_VER 4
20#endif
21
22/* MMU Management regs */
23#define ARC_REG_MMU_BCR 0x06f
24#if (CONFIG_ARC_MMU_VER < 4)
25#define ARC_REG_TLBPD0 0x405
26#define ARC_REG_TLBPD1 0x406
27#define ARC_REG_TLBINDEX 0x407
28#define ARC_REG_TLBCOMMAND 0x408
29#define ARC_REG_PID 0x409
30#define ARC_REG_SCRATCH_DATA0 0x418
31#else
32#define ARC_REG_TLBPD0 0x460
33#define ARC_REG_TLBPD1 0x461
34#define ARC_REG_TLBINDEX 0x464
35#define ARC_REG_TLBCOMMAND 0x465
36#define ARC_REG_PID 0x468
37#define ARC_REG_SCRATCH_DATA0 0x46c
38#endif
39
40/* Bits in MMU PID register */
41#define __TLB_ENABLE (1 << 31)
42#define __PROG_ENABLE (1 << 30)
43#define MMU_ENABLE (__TLB_ENABLE | __PROG_ENABLE)
44
45/* Error code if probe fails */
46#define TLB_LKUP_ERR 0x80000000
47
48#if (CONFIG_ARC_MMU_VER < 4)
49#define TLB_DUP_ERR (TLB_LKUP_ERR | 0x00000001)
50#else
51#define TLB_DUP_ERR (TLB_LKUP_ERR | 0x40000000)
52#endif
53
54/* TLB Commands */
55#define TLBWrite 0x1
56#define TLBRead 0x2
57#define TLBGetIndex 0x3
58#define TLBProbe 0x4
59
60#if (CONFIG_ARC_MMU_VER >= 2)
61#define TLBWriteNI 0x5 /* write JTLB without inv uTLBs */
62#define TLBIVUTLB 0x6 /* explicitly inv uTLBs */
63#endif
64
65#if (CONFIG_ARC_MMU_VER >= 4)
66#define TLBInsertEntry 0x7
67#define TLBDeleteEntry 0x8
68#endif
69
70#ifndef __ASSEMBLY__
71
72typedef struct {
73 unsigned long asid[NR_CPUS]; /* 8 bit MMU PID + Generation cycle */
74} mm_context_t;
75
76#ifdef CONFIG_ARC_DBG_TLB_PARANOIA
77void tlb_paranoid_check(unsigned int mm_asid, unsigned long address);
78#else
79#define tlb_paranoid_check(a, b)
80#endif
81
82void arc_mmu_init(void);
83extern char *arc_mmu_mumbojumbo(int cpu_id, char *buf, int len);
84void read_decode_mmu_bcr(void);
85
86#endif /* !__ASSEMBLY__ */
87
88#endif