1 /*
2  * CRIS MMU constants and PTE layout
3  */
4 
5 #ifndef _CRIS_MMU_H
6 #define _CRIS_MMU_H
7 
8 /* type used in struct mm to couple an MMU context to an active mm */
9 
10 typedef unsigned int mm_context_t;
11 
12 /* kernel memory segments */
13 
14 #define KSEG_F 0xf0000000UL
15 #define KSEG_E 0xe0000000UL
16 #define KSEG_D 0xd0000000UL
17 #define KSEG_C 0xc0000000UL
18 #define KSEG_B 0xb0000000UL
19 #define KSEG_A 0xa0000000UL
20 #define KSEG_9 0x90000000UL
21 #define KSEG_8 0x80000000UL
22 #define KSEG_7 0x70000000UL
23 #define KSEG_6 0x60000000UL
24 #define KSEG_5 0x50000000UL
25 #define KSEG_4 0x40000000UL
26 #define KSEG_3 0x30000000UL
27 #define KSEG_2 0x20000000UL
28 #define KSEG_1 0x10000000UL
29 #define KSEG_0 0x00000000UL
30 
31 /* CRIS PTE bits (see R_TLB_LO in the register description)
32  *
33  *   Bit:  31-13 12-------4    3        2       1       0
34  *         ________________________________________________
35  *        | pfn | reserved | global | valid | kernel | we  |
36  *        |_____|__________|________|_______|________|_____|
37  *
38  * (pfn = physical frame number)
39  */
40 
41 /* Real HW-based PTE bits. We use some synonym names so that
42  * things become less confusing in combination with the SW-based
43  * bits further below.
44  *
45  */
46 
47 #define _PAGE_WE	   (1<<0) /* page is write-enabled */
48 #define _PAGE_SILENT_WRITE (1<<0) /* synonym */
49 #define _PAGE_KERNEL	   (1<<1) /* page is kernel only */
50 #define _PAGE_VALID	   (1<<2) /* page is valid */
51 #define _PAGE_SILENT_READ  (1<<2) /* synonym */
52 #define _PAGE_GLOBAL       (1<<3) /* global page - context is ignored */
53 
54 /* Bits the HW doesn't care about but the kernel uses them in SW */
55 
56 #define _PAGE_PRESENT   (1<<4)  /* page present in memory */
57 #define _PAGE_ACCESSED	(1<<5)  /* simulated in software using valid bit */
58 #define _PAGE_MODIFIED	(1<<6)  /* simulated in software using we bit */
59 #define _PAGE_READ      (1<<7)  /* read-enabled */
60 #define _PAGE_WRITE     (1<<8)  /* write-enabled */
61 
62 #endif
63