0a7632cecdb6bc2349d3d8a1c2e48b00a07d3d2b
[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
15 #define NUM_STATIC_ALLOC        4
16
17 char    gStaticAllocPages[NUM_STATIC_ALLOC][PAGE_SIZE] __attribute__ ((section(".padata")));
18 tPAddr  gaiStaticAllocPages[NUM_STATIC_ALLOC] = {
19         (tPAddr)(&gStaticAllocPages[0]) - KERNEL_BASE,
20         (tPAddr)(&gStaticAllocPages[1]) - KERNEL_BASE,
21         (tPAddr)(&gStaticAllocPages[2]) - KERNEL_BASE,
22         (tPAddr)(&gStaticAllocPages[3]) - KERNEL_BASE
23 };
24 extern char     gKernelEnd[];
25
26 #include <tpl_mm_phys_bitmap.h>
27
28 void MM_SetupPhys(void)
29 {
30         MM_Tpl_InitPhys( 16*1024*1024/0x1000, NULL );
31 }
32
33 int MM_int_GetMapEntry( void *Data, int Index, tPAddr *Start, tPAddr *Length )
34 {
35         switch(Index)
36         {
37         case 0:
38                 *Start = ((tVAddr)&gKernelEnd - KERNEL_BASE + 0xFFF) & ~0xFFF;
39                 *Length = 16*1024*1024 - *Start;
40                 return 1;
41         default:
42                 return 0;
43         }
44 }
45
46 /**
47  * \brief Takes a physical address and returns the ID of its range
48  * \param Addr  Physical address of page
49  * \return Range ID from eMMPhys_Ranges
50  */
51 int MM_int_GetRangeID( tPAddr Addr )
52 {
53         return MM_RANGE_MAX;    // ARM doesn't need ranges
54 }

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