5e4a2428b96d08efbe72b655bbe16e6594d8b9a1
[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
28 #include <tpl_mm_phys_bitmap.h>
29
30 //#define REALVIEW_LOWRAM_SIZE  0x10000000
31 #define REALVIEW_LOWRAM_SIZE    (32*1024*1024)
32
33 void MM_SetupPhys(void)
34 {
35         LogF("MM_SetupPhys: ()\n");
36         MM_Tpl_InitPhys( REALVIEW_LOWRAM_SIZE/0x1000, NULL );
37 }
38
39 int MM_int_GetMapEntry( void *Data, int Index, tPAddr *Start, tPAddr *Length )
40 {
41         switch(Index)
42         {
43         case 0:
44                 *Start = ((tVAddr)&gKernelEnd - KERNEL_BASE + 0xFFF) & ~0xFFF;
45                 *Length = REALVIEW_LOWRAM_SIZE - *Start;
46                 return 1;
47         default:
48                 return 0;
49         }
50 }
51
52 /**
53  * \brief Takes a physical address and returns the ID of its range
54  * \param Addr  Physical address of page
55  * \return Range ID from eMMPhys_Ranges
56  */
57 int MM_int_GetRangeID( tPAddr Addr )
58 {
59         return MM_RANGE_MAX;    // ARM doesn't need ranges
60 }

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