|
23 | 23 | dsrl \res, NSRI_NODEID_SHFT |
24 | 24 | .endm |
25 | 25 |
|
| 26 | +/* |
| 27 | + * TLB bits |
| 28 | + */ |
| 29 | +#define PAGE_GLOBAL (1 << 6) |
| 30 | +#define PAGE_VALID (1 << 7) |
| 31 | +#define PAGE_DIRTY (1 << 8) |
| 32 | +#define CACHE_CACHABLE_COW (5 << 9) |
| 33 | + |
| 34 | + /* |
| 35 | + * inputs are the text nasid in t1, data nasid in t2. |
| 36 | + */ |
| 37 | + .macro MAPPED_KERNEL_SETUP_TLB |
| 38 | +#ifdef CONFIG_MAPPED_KERNEL |
| 39 | + /* |
| 40 | + * This needs to read the nasid - assume 0 for now. |
| 41 | + * Drop in 0xffffffffc0000000 in tlbhi, 0+VG in tlblo_0, |
| 42 | + * 0+DVG in tlblo_1. |
| 43 | + */ |
| 44 | + dli t0, 0xffffffffc0000000 |
| 45 | + dmtc0 t0, CP0_ENTRYHI |
| 46 | + li t0, 0x1c000 # Offset of text into node memory |
| 47 | + dsll t1, NASID_SHFT # Shift text nasid into place |
| 48 | + dsll t2, NASID_SHFT # Same for data nasid |
| 49 | + or t1, t1, t0 # Physical load address of kernel text |
| 50 | + or t2, t2, t0 # Physical load address of kernel data |
| 51 | + dsrl t1, 12 # 4K pfn |
| 52 | + dsrl t2, 12 # 4K pfn |
| 53 | + dsll t1, 6 # Get pfn into place |
| 54 | + dsll t2, 6 # Get pfn into place |
| 55 | + li t0, ((PAGE_GLOBAL | PAGE_VALID | CACHE_CACHABLE_COW) >> 6) |
| 56 | + or t0, t0, t1 |
| 57 | + mtc0 t0, CP0_ENTRYLO0 # physaddr, VG, cach exlwr |
| 58 | + li t0, ((PAGE_GLOBAL | PAGE_VALID | PAGE_DIRTY | CACHE_CACHABLE_COW) >> 6) |
| 59 | + or t0, t0, t2 |
| 60 | + mtc0 t0, CP0_ENTRYLO1 # physaddr, DVG, cach exlwr |
| 61 | + li t0, 0x1ffe000 # MAPPED_KERN_TLBMASK, TLBPGMASK_16M |
| 62 | + mtc0 t0, CP0_PAGEMASK |
| 63 | + li t0, 0 # KMAP_INX |
| 64 | + mtc0 t0, CP0_INDEX |
| 65 | + li t0, 1 |
| 66 | + mtc0 t0, CP0_WIRED |
| 67 | + tlbwi |
| 68 | +#else |
| 69 | + mtc0 zero, CP0_WIRED |
| 70 | +#endif |
| 71 | + .endm |
| 72 | + |
26 | 73 | /* |
27 | 74 | * Intentionally empty macro, used in head.S. Override in |
28 | 75 | * arch/mips/mach-xxx/kernel-entry-init.h when necessary. |
|
0 commit comments