Vineet Gupta | f1f3347 | 2013-01-18 15:12:19 +0530 | [diff] [blame] | 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 | |
Vineet Gupta | 8235703 | 2013-06-01 12:55:42 +0530 | [diff] [blame] | 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 | #endif |
| 19 | |
Vineet Gupta | da1677b | 2013-05-14 13:28:17 +0530 | [diff] [blame] | 20 | /* MMU Management regs */ |
| 21 | #define ARC_REG_MMU_BCR 0x06f |
| 22 | #define ARC_REG_TLBPD0 0x405 |
| 23 | #define ARC_REG_TLBPD1 0x406 |
| 24 | #define ARC_REG_TLBINDEX 0x407 |
| 25 | #define ARC_REG_TLBCOMMAND 0x408 |
| 26 | #define ARC_REG_PID 0x409 |
| 27 | #define ARC_REG_SCRATCH_DATA0 0x418 |
| 28 | |
| 29 | /* Bits in MMU PID register */ |
| 30 | #define MMU_ENABLE (1 << 31) /* Enable MMU for process */ |
| 31 | |
| 32 | /* Error code if probe fails */ |
| 33 | #define TLB_LKUP_ERR 0x80000000 |
| 34 | |
Vineet Gupta | 483e9bcb | 2013-07-01 18:12:28 +0530 | [diff] [blame] | 35 | #define TLB_DUP_ERR (TLB_LKUP_ERR | 0x00000001) |
| 36 | |
Vineet Gupta | da1677b | 2013-05-14 13:28:17 +0530 | [diff] [blame] | 37 | /* TLB Commands */ |
| 38 | #define TLBWrite 0x1 |
| 39 | #define TLBRead 0x2 |
| 40 | #define TLBGetIndex 0x3 |
| 41 | #define TLBProbe 0x4 |
| 42 | |
| 43 | #if (CONFIG_ARC_MMU_VER >= 2) |
| 44 | #define TLBWriteNI 0x5 /* write JTLB without inv uTLBs */ |
| 45 | #define TLBIVUTLB 0x6 /* explicitly inv uTLBs */ |
| 46 | #endif |
| 47 | |
Vineet Gupta | f1f3347 | 2013-01-18 15:12:19 +0530 | [diff] [blame] | 48 | #ifndef __ASSEMBLY__ |
| 49 | |
| 50 | typedef struct { |
Vineet Gupta | 63eca94 | 2013-08-23 19:16:34 +0530 | [diff] [blame] | 51 | unsigned long asid[NR_CPUS]; /* 8 bit MMU PID + Generation cycle */ |
Vineet Gupta | f1f3347 | 2013-01-18 15:12:19 +0530 | [diff] [blame] | 52 | } mm_context_t; |
| 53 | |
Vineet Gupta | da1677b | 2013-05-14 13:28:17 +0530 | [diff] [blame] | 54 | #ifdef CONFIG_ARC_DBG_TLB_PARANOIA |
Vineet Gupta | 5bd87ad | 2013-08-23 17:37:18 +0530 | [diff] [blame] | 55 | void tlb_paranoid_check(unsigned int mm_asid, unsigned long address); |
Vineet Gupta | da1677b | 2013-05-14 13:28:17 +0530 | [diff] [blame] | 56 | #else |
| 57 | #define tlb_paranoid_check(a, b) |
Vineet Gupta | f1f3347 | 2013-01-18 15:12:19 +0530 | [diff] [blame] | 58 | #endif |
| 59 | |
Vineet Gupta | da1677b | 2013-05-14 13:28:17 +0530 | [diff] [blame] | 60 | void arc_mmu_init(void); |
| 61 | extern char *arc_mmu_mumbojumbo(int cpu_id, char *buf, int len); |
Vineet Gupta | 07b9b65 | 2013-09-05 19:19:06 +0530 | [diff] [blame] | 62 | void read_decode_mmu_bcr(void); |
Vineet Gupta | da1677b | 2013-05-14 13:28:17 +0530 | [diff] [blame] | 63 | |
| 64 | #endif /* !__ASSEMBLY__ */ |
| 65 | |
Vineet Gupta | f1f3347 | 2013-01-18 15:12:19 +0530 | [diff] [blame] | 66 | #endif |