Esempio n. 1
0
/*
 * Add an entry to the internal "akva" static devmap table using the given
 * physical address and size and a virtual address allocated from the top of
 * kva.  This automatically registers the akva table on the first call, so all a
 * platform has to do is call this routine to install as many mappings as it
 * needs and when initarm() calls arm_devmap_bootstrap() it will pick up all the
 * entries in the akva table automatically.
 */
void
arm_devmap_add_entry(vm_paddr_t pa, vm_size_t sz)
{
	struct arm_devmap_entry *m;

	if (devmap_bootstrap_done)
		panic("arm_devmap_add_entry() after arm_devmap_bootstrap()");

	if (akva_devmap_idx == (AKVA_DEVMAP_MAX_ENTRIES - 1))
		panic("AKVA_DEVMAP_MAX_ENTRIES is too small");

	if (akva_devmap_idx == 0)
		arm_devmap_register_table(akva_devmap_entries);

	/*
	 * Allocate virtual address space from the top of kva downwards.  If the
	 * range being mapped is aligned and sized to 1MB boundaries then also
	 * align the virtual address to the next-lower 1MB boundary so that we
	 * end up with a nice efficient section mapping.
	 */
#ifdef __arm__
	if ((pa & 0x000fffff) == 0 && (sz & 0x000fffff) == 0) {
		akva_devmap_vaddr = trunc_1mpage(akva_devmap_vaddr - sz);
	} else
#endif
	{
		akva_devmap_vaddr = trunc_page(akva_devmap_vaddr - sz);
	}
	m = &akva_devmap_entries[akva_devmap_idx++];
	m->pd_va    = akva_devmap_vaddr;
	m->pd_pa    = pa;
	m->pd_size  = sz;
}
Esempio n. 2
0
int
platform_devmap_init(void)
{

//	arm_devmap_add_entry(0xfff00000, 0x00100000); /* 1MB - uart, aic and timers*/

	arm_devmap_register_table(at91_devmap);

	return (0);
}
Esempio n. 3
0
/*
 * Construct pmap_devmap[] with DT-derived config data.
 */
int
initarm_devmap_init(void)
{
    int i = 0;
    fdt_devmap[i].pd_va = 0xf0100000;
    fdt_devmap[i].pd_pa = 0x10100000;
    fdt_devmap[i].pd_size = 0x01000000;       /* 1 MB */
    fdt_devmap[i].pd_prot = VM_PROT_READ | VM_PROT_WRITE;
    fdt_devmap[i].pd_cache = PTE_DEVICE;

    arm_devmap_register_table(&fdt_devmap[0]);
    return (0);
}