8a210aecb50b702ee80fb6591c422cee39cef2e2
[tpg/acess2.git] / Kernel / arch / armv7 / mm_phys.c
1 /*
2  * Acess2
3  *
4  * ARM7 Physical Memory Manager
5  * arch/arm7/mm_phys.c
6  */
7 #define DEBUG   0
8
9 #include <acess.h>
10 #include <mm_virt.h>
11
12 #define MM_NUM_RANGES   1       // Single range
13 #define MM_RANGE_MAX    0
14 #define TRACE_ALLOCS    0
15
16 #define NUM_STATIC_ALLOC        4
17
18 char    gStaticAllocPages[NUM_STATIC_ALLOC][PAGE_SIZE] __attribute__ ((section(".padata")));
19 tPAddr  gaiStaticAllocPages[NUM_STATIC_ALLOC] = {
20         (tPAddr)(&gStaticAllocPages[0]) - KERNEL_BASE,
21         (tPAddr)(&gStaticAllocPages[1]) - KERNEL_BASE,
22         (tPAddr)(&gStaticAllocPages[2]) - KERNEL_BASE,
23         (tPAddr)(&gStaticAllocPages[3]) - KERNEL_BASE
24 };
25 extern char     gKernelEnd[];
26
27 #include <tpl_mm_phys_bitmap.h>
28
29 void MM_SetupPhys(void)
30 {
31         MM_Tpl_InitPhys( 16*1024*1024/0x1000, NULL );
32 }
33
34 int MM_int_GetMapEntry( void *Data, int Index, tPAddr *Start, tPAddr *Length )
35 {
36         switch(Index)
37         {
38         case 0:
39                 *Start = ((tVAddr)&gKernelEnd - KERNEL_BASE + 0xFFF) & ~0xFFF;
40                 *Length = 16*1024*1024 - *Start;
41                 return 1;
42         default:
43                 return 0;
44         }
45 }
46
47 /**
48  * \brief Takes a physical address and returns the ID of its range
49  * \param Addr  Physical address of page
50  * \return Range ID from eMMPhys_Ranges
51  */
52 int MM_int_GetRangeID( tPAddr Addr )
53 {
54         return MM_RANGE_MAX;    // ARM doesn't need ranges
55 }

UCC git Repository :: git.ucc.asn.au