import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / mm / init.c
index 0ecc43fd622971c05a9ce876cffc11b3e6889b14..4117a6edb857fda3429646c309a92f76f81b76ca 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
+#include <mach/mtk_memcfg.h>
 
 #include "mm.h"
 
@@ -206,7 +207,7 @@ static void __init arm_bootmem_init(unsigned long start_pfn,
 
 #ifdef CONFIG_ZONE_DMA
 
-unsigned long arm_dma_zone_size __read_mostly;
+phys_addr_t arm_dma_zone_size __read_mostly;
 EXPORT_SYMBOL(arm_dma_zone_size);
 
 /*
@@ -327,13 +328,22 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
 
        BUG_ON(!arm_memblock_steal_permitted);
 
-       phys = memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE);
+       phys = memblock_alloc_base(size, align, MEMBLOCK_ALLOC_NOPASR);
        memblock_free(phys, size);
        memblock_remove(phys, size);
+       if (phys) {
+               MTK_MEMCFG_LOG_AND_PRINTK(KERN_ALERT"[PHY layout]%ps   :   0x%08llx - 0x%08llx (0x%08llx)\n",
+                       __builtin_return_address(0), (unsigned long long)phys, 
+               (unsigned long long)phys + size - 1,
+               (unsigned long long)size);
+       }
 
        return phys;
 }
 
+__attribute__((weak)) extern struct ion_platform_data ion_drv_platform_data;
+__attribute__((weak)) extern void __init ion_reserve(struct ion_platform_data *data);
+
 void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
 {
        int i;
@@ -376,6 +386,11 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
        if (mdesc->reserve)
                mdesc->reserve();
 
+       early_init_fdt_scan_reserved_mem();
+
+    //reserve for ion_carveout_heap
+    if(ion_reserve && (&ion_drv_platform_data))
+        ion_reserve(&ion_drv_platform_data);
        /*
         * reserve memory for DMA contigouos allocations,
         * must come from DMA area inside low memory
@@ -651,7 +666,7 @@ void __init mem_init(void)
 #define MLM(b, t) b, t, ((t) - (b)) >> 20
 #define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), SZ_1K)
 
-       printk(KERN_NOTICE "Virtual kernel memory layout:\n"
+       MTK_MEMCFG_LOG_AND_PRINTK(KERN_NOTICE "Virtual kernel memory layout:\n"
                        "    vector  : 0x%08lx - 0x%08lx   (%4ld kB)\n"
 #ifdef CONFIG_HAVE_TCM
                        "    DTCM    : 0x%08lx - 0x%08lx   (%4ld kB)\n"