Exemplo n.º 1
0
static void __init sti_smp_prepare_cpus(unsigned int max_cpus)
{
    struct device_node *np;
    void __iomem *scu_base;
    u32 __iomem *cpu_strt_ptr;
    u32 release_phys;
    int cpu;
    unsigned long entry_pa = virt_to_phys(sti_secondary_startup);

    np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");

    if (np) {
        scu_base = of_iomap(np, 0);
        scu_enable(scu_base);
        of_node_put(np);
    }

    if (max_cpus <= 1)
        return;

    for_each_possible_cpu(cpu) {

        np = of_get_cpu_node(cpu, NULL);

        if (!np)
            continue;

        if (of_property_read_u32(np, "cpu-release-addr",
                                 &release_phys)) {
            pr_err("CPU %d: missing or invalid cpu-release-addr "
                   "property\n", cpu);
            continue;
        }

        /*
         * holding pen is usually configured in SBC DMEM but can also be
         * in RAM.
         */

        if (!memblock_is_memory(release_phys))
            cpu_strt_ptr =
                ioremap(release_phys, sizeof(release_phys));
        else
            cpu_strt_ptr =
                (u32 __iomem *)phys_to_virt(release_phys);

        __raw_writel(entry_pa, cpu_strt_ptr);

        /*
         * wmb so that data is actually written
         * before cache flush is done
         */
        smp_wmb();
        sync_cache_w(cpu_strt_ptr);

        if (!memblock_is_memory(release_phys))
            iounmap(cpu_strt_ptr);
    }
}
void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
	unsigned long offset, size_t size, unsigned int mtype, void *caller)
{
	const struct mem_type *type;
	int err;
	unsigned long addr;
 	struct vm_struct * area;

	/*
	 * High mappings must be supersection aligned
	 */
	if (pfn >= 0x100000 && (__pfn_to_phys(pfn) & ~SUPERSECTION_MASK))
		return NULL;

	/*
	 * Don't allow RAM to be mapped - this causes problems with ARMv6+
	 */
	if (WARN_ON(memblock_is_memory(pfn << PAGE_SHIFT)))
		return NULL;

	type = get_mem_type(mtype);
	if (!type)
		return NULL;

	/*
	 * Page align the mapping size, taking account of any offset.
	 */
	size = PAGE_ALIGN(offset + size);

	area = get_vm_area_caller(size, VM_IOREMAP, caller);
 	if (!area)
 		return NULL;
 	addr = (unsigned long)area->addr;

#ifndef CONFIG_SMP
	if (DOMAIN_IO == 0 &&
	    (((cpu_architecture() >= CPU_ARCH_ARMv6) && (get_cr() & CR_XP)) ||
	       cpu_is_xsc3()) && pfn >= 0x100000 &&
	       !((__pfn_to_phys(pfn) | size | addr) & ~SUPERSECTION_MASK)) {
		area->flags |= VM_ARM_SECTION_MAPPING;
		err = remap_area_supersections(addr, pfn, size, type);
	} else if (!((__pfn_to_phys(pfn) | size | addr) & ~PMD_MASK)) {
		area->flags |= VM_ARM_SECTION_MAPPING;
		err = remap_area_sections(addr, pfn, size, type);
	} else
#endif
		err = ioremap_page_range(addr, addr + size, __pfn_to_phys(pfn),
					 __pgprot(type->prot_pte));

	if (err) {
 		vunmap((void *)addr);
 		return NULL;
 	}

	flush_cache_vmap(addr, addr + size);
	return (void __iomem *) (offset + addr);
}
Exemplo n.º 3
0
int exynos_sysmmu_enable(struct device *dev, phys_addr_t pgtable)
{
    BUG_ON(!memblock_is_memory(pgtable));

    return __exynos_sysmmu_enable(dev, pgtable, NULL);
}
Exemplo n.º 4
0
int page_is_ram(unsigned long pfn)
{
	return memblock_is_memory(__pfn_to_phys(pfn));
}