Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

microblaze_mmu_v2: mmu.h update

Signed-off-by: Michal Simek <monstr@monstr.eu>

+102 -2
+102 -2
arch/microblaze/include/asm/mmu.h
··· 1 1 /* 2 + * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu> 3 + * Copyright (C) 2008-2009 PetaLogix 2 4 * Copyright (C) 2006 Atmark Techno, Inc. 3 5 * 4 6 * This file is subject to the terms and conditions of the GNU General Public ··· 11 9 #ifndef _ASM_MICROBLAZE_MMU_H 12 10 #define _ASM_MICROBLAZE_MMU_H 13 11 14 - #ifndef __ASSEMBLY__ 12 + # ifndef CONFIG_MMU 13 + # ifndef __ASSEMBLY__ 15 14 typedef struct { 16 15 struct vm_list_struct *vmlist; 17 16 unsigned long end_brk; 18 17 } mm_context_t; 19 - #endif /* __ASSEMBLY__ */ 18 + # endif /* __ASSEMBLY__ */ 19 + # else /* CONFIG_MMU */ 20 + # ifdef __KERNEL__ 21 + # ifndef __ASSEMBLY__ 20 22 23 + /* Default "unsigned long" context */ 24 + typedef unsigned long mm_context_t; 25 + 26 + /* Hardware Page Table Entry */ 27 + typedef struct _PTE { 28 + unsigned long v:1; /* Entry is valid */ 29 + unsigned long vsid:24; /* Virtual segment identifier */ 30 + unsigned long h:1; /* Hash algorithm indicator */ 31 + unsigned long api:6; /* Abbreviated page index */ 32 + unsigned long rpn:20; /* Real (physical) page number */ 33 + unsigned long :3; /* Unused */ 34 + unsigned long r:1; /* Referenced */ 35 + unsigned long c:1; /* Changed */ 36 + unsigned long w:1; /* Write-thru cache mode */ 37 + unsigned long i:1; /* Cache inhibited */ 38 + unsigned long m:1; /* Memory coherence */ 39 + unsigned long g:1; /* Guarded */ 40 + unsigned long :1; /* Unused */ 41 + unsigned long pp:2; /* Page protection */ 42 + } PTE; 43 + 44 + /* Values for PP (assumes Ks=0, Kp=1) */ 45 + # define PP_RWXX 0 /* Supervisor read/write, User none */ 46 + # define PP_RWRX 1 /* Supervisor read/write, User read */ 47 + # define PP_RWRW 2 /* Supervisor read/write, User read/write */ 48 + # define PP_RXRX 3 /* Supervisor read, User read */ 49 + 50 + /* Segment Register */ 51 + typedef struct _SEGREG { 52 + unsigned long t:1; /* Normal or I/O type */ 53 + unsigned long ks:1; /* Supervisor 'key' (normally 0) */ 54 + unsigned long kp:1; /* User 'key' (normally 1) */ 55 + unsigned long n:1; /* No-execute */ 56 + unsigned long :4; /* Unused */ 57 + unsigned long vsid:24; /* Virtual Segment Identifier */ 58 + } SEGREG; 59 + 60 + extern void _tlbie(unsigned long va); /* invalidate a TLB entry */ 61 + extern void _tlbia(void); /* invalidate all TLB entries */ 62 + # endif /* __ASSEMBLY__ */ 63 + 64 + /* 65 + * The MicroBlaze processor has a TLB architecture identical to PPC-40x. The 66 + * instruction and data sides share a unified, 64-entry, semi-associative 67 + * TLB which is maintained totally under software control. In addition, the 68 + * instruction side has a hardware-managed, 2,4, or 8-entry, fully-associative 69 + * TLB which serves as a first level to the shared TLB. These two TLBs are 70 + * known as the UTLB and ITLB, respectively. 71 + */ 72 + 73 + # define MICROBLAZE_TLB_SIZE 64 74 + 75 + /* 76 + * TLB entries are defined by a "high" tag portion and a "low" data 77 + * portion. The data portion is 32-bits. 78 + * 79 + * TLB entries are managed entirely under software control by reading, 80 + * writing, and searching using the MTS and MFS instructions. 81 + */ 82 + 83 + # define TLB_LO 1 84 + # define TLB_HI 0 85 + # define TLB_DATA TLB_LO 86 + # define TLB_TAG TLB_HI 87 + 88 + /* Tag portion */ 89 + # define TLB_EPN_MASK 0xFFFFFC00 /* Effective Page Number */ 90 + # define TLB_PAGESZ_MASK 0x00000380 91 + # define TLB_PAGESZ(x) (((x) & 0x7) << 7) 92 + # define PAGESZ_1K 0 93 + # define PAGESZ_4K 1 94 + # define PAGESZ_16K 2 95 + # define PAGESZ_64K 3 96 + # define PAGESZ_256K 4 97 + # define PAGESZ_1M 5 98 + # define PAGESZ_4M 6 99 + # define PAGESZ_16M 7 100 + # define TLB_VALID 0x00000040 /* Entry is valid */ 101 + 102 + /* Data portion */ 103 + # define TLB_RPN_MASK 0xFFFFFC00 /* Real Page Number */ 104 + # define TLB_PERM_MASK 0x00000300 105 + # define TLB_EX 0x00000200 /* Instruction execution allowed */ 106 + # define TLB_WR 0x00000100 /* Writes permitted */ 107 + # define TLB_ZSEL_MASK 0x000000F0 108 + # define TLB_ZSEL(x) (((x) & 0xF) << 4) 109 + # define TLB_ATTR_MASK 0x0000000F 110 + # define TLB_W 0x00000008 /* Caching is write-through */ 111 + # define TLB_I 0x00000004 /* Caching is inhibited */ 112 + # define TLB_M 0x00000002 /* Memory is coherent */ 113 + # define TLB_G 0x00000001 /* Memory is guarded from prefetch */ 114 + 115 + # endif /* __KERNEL__ */ 116 + # endif /* CONFIG_MMU */ 21 117 #endif /* _ASM_MICROBLAZE_MMU_H */