#define END_MEM (UL(CONFIG_DRAM_BASE) + CONFIG_DRAM_SIZE)
#endif
- ----#ifndef PAGE_OFFSET
- --- #define PAGE_OFFSET PLAT_PHYS_OFFSET
-#define PAGE_OFFSET (PHYS_OFFSET)
- ----#endif
- ----
/*
* The module can be at any place in ram in nommu mode.
*/
#else
+#define PHYS_OFFSET PLAT_PHYS_OFFSET
++ +++#define PHYS_PFN_OFFSET ((unsigned long)(PHYS_OFFSET >> PAGE_SHIFT))
+
static inline phys_addr_t __virt_to_phys(unsigned long x)
{
return (phys_addr_t)x - PAGE_OFFSET + PHYS_OFFSET;
return x - PHYS_OFFSET + PAGE_OFFSET;
}
-- ---#endif
-- ---#endif
-#endif /* __ASSEMBLY__ */
++ +++#define virt_to_pfn(kaddr) \
++ +++ ((((unsigned long)(kaddr) - PAGE_OFFSET) >> PAGE_SHIFT) + \
++ +++ PHYS_PFN_OFFSET)
-- -- /*
-- -- * PFNs are used to describe any physical page; this means
-- -- * PFN 0 == physical address 0.
-- -- *
-- -- * This is the PFN of the first RAM page in the kernel
-- -- * direct-mapped view. We assume this is the first page
-- -- * of RAM in the mem_map as well.
-- -- */
-- -- #define PHYS_PFN_OFFSET ((unsigned long)(PHYS_OFFSET >> PAGE_SHIFT))
-#ifndef PHYS_OFFSET
-#ifdef PLAT_PHYS_OFFSET
-#define PHYS_OFFSET PLAT_PHYS_OFFSET
-#else
-#define PHYS_OFFSET UL(CONFIG_PHYS_OFFSET)
-#endif
++ ++ #endif
-#ifndef __ASSEMBLY__
-
-/*
- * PFNs are used to describe any physical page; this means
- * PFN 0 == physical address 0.
- *
- * This is the PFN of the first RAM page in the kernel
- * direct-mapped view. We assume this is the first page
- * of RAM in the mem_map as well.
- */
-#define PHYS_PFN_OFFSET ((unsigned long)(PHYS_OFFSET >> PAGE_SHIFT))
-
/*
* These are *only* valid on the kernel direct mapped RAM memory.
* Note: Drivers should NOT use these. They are the wrong
*/
#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
-- ---#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
-#define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory)
++ +++#define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr))
+#define virt_addr_valid(kaddr) (((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) \
-- -- && pfn_valid(__pa(kaddr) >> PAGE_SHIFT) )
++ +++ && pfn_valid(virt_to_pfn(kaddr)))
#endif
kernel_data.end = virt_to_phys(_end - 1);
for_each_memblock(memory, region) {
- --- res = memblock_virt_alloc_low(sizeof(*res), 0);
- res = alloc_bootmem_low(sizeof(*res));
+ ++++ res = memblock_virt_alloc(sizeof(*res), 0);
res->name = "System RAM";
res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1;
cp = &cache_policies[cachepolicy];
vecs_pgprot = kern_pgprot = user_pgprot = cp->pte;
s2_pgprot = cp->pte_s2;
- ---- hyp_device_pgprot = s2_device_pgprot = mem_types[MT_DEVICE].prot_pte;
+ ++++ hyp_device_pgprot = mem_types[MT_DEVICE].prot_pte;
+ ++++ s2_device_pgprot = mem_types[MT_DEVICE].prot_pte_s2;
+ +++
++ +++ /*
++ +++ * We don't use domains on ARMv6 (since this causes problems with
++ +++ * v6/v7 kernels), so we must use a separate memory type for user
++ +++ * r/o, kernel r/w to map the vectors page.
++ +++ */
++ +++#ifndef CONFIG_ARM_LPAE
++ +++ if (cpu_arch == CPU_ARCH_ARMv6)
++ +++ vecs_pgprot |= L_PTE_MT_VECTORS;
++ +++#endif
+
/*
* ARMv6 and above have extended page tables.
*/