2 Copyright © 2013-2015, The AROS Development Team. All rights reserved.
10 #include <hardware/bcm2708_boot.h>
18 static pde_t
*pde
= BOOTMEMADDR(bm_pde
);
21 for (i
= 0; i
< 4096; i
++)
25 pde
[i
].section
.type
= PDE_TYPE_SECTION
;
28 pde
[i
].section
.ap
= 3;
29 pde
[i
].section
.apx
= 0;
30 pde
[i
].section
.tex
= 1;
41 static pde_t
*pde
= BOOTMEMADDR(bm_pde
);
43 arm_flush_cache((uint32_t)pde
, 16384);
45 /* Write page_dir address to ttbr0 */
46 asm volatile ("mcr p15, 0, %0, c2, c0, 0"::"r"(pde
));
47 /* Write ttbr control N = 0 (use only ttbr0) */
48 asm volatile ("mcr p15, 0, %0, c2, c0, 2"::"r"(0));
50 /* Set domains - Dom0 is usable, rest is disabled */
51 asm volatile ("mrc p15, 0, %0, c3, c0, 0":"=r"(tmp
));
52 DMMU(kprintf("[BOOT] Domain access control register: %08x\n", tmp
));
53 asm volatile ("mcr p15, 0, %0, c3, c0, 0"::"r"(0x00000001));
55 asm volatile ("mrc p15, 0, %0, c1, c0, 0":"=r"(tmp
));
56 DMMU(kprintf("[BOOT] control register %08x\n", tmp
));
57 tmp
|= 1; /* Enable MMU */
58 tmp
|= 1 << 23; /* v6 page tables, subpages disabled */
59 asm volatile ("mcr p15, 0, %[r], c7, c10, 4" : : [r
] "r" (0)); /* dsb */
60 asm volatile ("mcr p15, 0, %0, c1, c0, 0"::"r"(tmp
));
61 asm volatile ("mcr p15, 0, %[r], c7, c5, 4" : : [r
] "r" (0)); /* isb */
64 void mmu_unmap_section(uint32_t virt
, uint32_t length
)
66 static pde_t
*pde
= BOOTMEMADDR(bm_pde
);
68 uint32_t start
= virt
& ~(1024*1024-1);
69 uint32_t end
= (start
+ length
) & ~(1024*1024-1);
81 void mmu_map_section(uint32_t phys
, uint32_t virt
, uint32_t length
, int b
, int c
, int ap
, int tex
)
83 static pde_t
*pde
= BOOTMEMADDR(bm_pde
);
85 uint32_t start
= virt
& ~(1024*1024-1);
86 uint32_t end
= (start
+ length
) & ~(1024*1024-1);
88 DMMU(kprintf("[BOOT] MMU map %p:%p->%p:%p, b=%d, c=%d, ap=%x, tex=%x\n",
89 phys
, phys
+length
-1, virt
, virt
+length
-1, b
, c
, ap
, tex
));
91 int count
= (end
- start
) >> 20;
99 s
.section
.type
= PDE_TYPE_SECTION
;
102 s
.section
.ap
= ap
& 3;
103 s
.section
.apx
= (ap
>> 2) & 1;
105 s
.section
.base_address
= phys
;