From: John Hodge Date: Mon, 17 Oct 2011 02:28:38 +0000 (+0800) Subject: Kernel/armv7 - Bugfixing (PAddr != PAGE_SIZE) X-Git-Tag: rel0.13~52 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=30003ad470de879b53592b02a8f6f87d07077ece;p=tpg%2Facess2.git Kernel/armv7 - Bugfixing (PAddr != PAGE_SIZE) --- diff --git a/Kernel/arch/armv7/mm_phys.c b/Kernel/arch/armv7/mm_phys.c index 8a210aec..53c57315 100644 --- a/Kernel/arch/armv7/mm_phys.c +++ b/Kernel/arch/armv7/mm_phys.c @@ -24,11 +24,15 @@ tPAddr gaiStaticAllocPages[NUM_STATIC_ALLOC] = { }; extern char gKernelEnd[]; + #include +//#define REALVIEW_LOWRAM_SIZE 0x10000000 +#define REALVIEW_LOWRAM_SIZE (32*1024*1024) + void MM_SetupPhys(void) { - MM_Tpl_InitPhys( 16*1024*1024/0x1000, NULL ); + MM_Tpl_InitPhys( REALVIEW_LOWRAM_SIZE/0x1000, NULL ); } int MM_int_GetMapEntry( void *Data, int Index, tPAddr *Start, tPAddr *Length ) @@ -37,7 +41,7 @@ int MM_int_GetMapEntry( void *Data, int Index, tPAddr *Start, tPAddr *Length ) { case 0: *Start = ((tVAddr)&gKernelEnd - KERNEL_BASE + 0xFFF) & ~0xFFF; - *Length = 16*1024*1024 - *Start; + *Length = REALVIEW_LOWRAM_SIZE - *Start; return 1; default: return 0; diff --git a/Kernel/arch/armv7/mm_virt.c b/Kernel/arch/armv7/mm_virt.c index ea2c8461..887b10b8 100644 --- a/Kernel/arch/armv7/mm_virt.c +++ b/Kernel/arch/armv7/mm_virt.c @@ -9,6 +9,8 @@ #include #include +#define TRACE_MAPS 0 + #define AP_KRW_ONLY 1 // Kernel page #define AP_KRO_ONLY 5 // Kernel RO page #define AP_RW_BOTH 3 // Standard RW @@ -390,7 +392,9 @@ void MM_SetFlags(tVAddr VAddr, Uint Flags, Uint Mask) int MM_Map(tVAddr VAddr, tPAddr PAddr) { tMM_PageInfo pi = {0}; -// Log("MM_Map %P=>%p", PAddr, VAddr); + #if TRACE_MAPS + Log("MM_Map %P=>%p", PAddr, VAddr); + #endif pi.PhysAddr = PAddr; pi.Size = 12; @@ -682,7 +686,7 @@ tVAddr MM_MapHWPages(tPAddr PAddr, Uint NPages) // Map the pages for( i = 0; i < NPages; i ++ ) - MM_Map(ret+i*PAGE_SIZE, PAddr+i*PAddr); + MM_Map(ret+i*PAGE_SIZE, PAddr+i*PAGE_SIZE); // and return LEAVE('p', ret); return ret; @@ -698,7 +702,10 @@ tVAddr MM_AllocDMA(int Pages, int MaxBits, tPAddr *PAddr) tVAddr ret; phys = MM_AllocPhysRange(Pages, MaxBits); - if(!phys) return 0; + if(!phys) { + Log_Warning("MMVirt", "No space left for a %i page block (MM_AllocDMA)", Pages); + return 0; + } ret = MM_MapHWPages(phys, Pages); *PAddr = phys;