예제 #1
0
파일: ioremap_64.c 프로젝트: mobilipia/iods
void onchip_unmap(unsigned long vaddr)
{
	struct resource *res;
	unsigned int psz;

	res = shmedia_find_resource(&shmedia_iomap, vaddr);
	if (!res) {
		printk(KERN_ERR "%s: Failed to free 0x%08lx\n",
		       __func__, vaddr);
		return;
	}

        psz = (res->end - res->start + (PAGE_SIZE - 1)) / PAGE_SIZE;

        printk(KERN_DEBUG "unmapioaddr: %6s  [%2d page%s] freed\n",
	       res->name, psz, psz == 1 ? " " : "s");

	shmedia_free_io(res);

	if ((char *)res >= (char *)xresv &&
	    (char *)res <  (char *)&xresv[XNRES]) {
		xres_free((struct xresource *)res);
	} else {
		kfree(res);
	}
}
예제 #2
0
			unsigned long flags)
{
	char name[14];

	sprintf(name, "phys_%08x", (u32)offset);
	return shmedia_alloc_io(offset, size, name, flags);
}
EXPORT_SYMBOL(__ioremap);

void __iounmap(void __iomem *virtual)
{
	unsigned long vaddr = (unsigned long)virtual & PAGE_MASK;
	struct resource *res;
	unsigned int psz;

	res = shmedia_find_resource(&shmedia_iomap, vaddr);
	if (!res) {
		printk(KERN_ERR "%s: Failed to free 0x%08lx\n",
		       __func__, vaddr);
		return;
	}

	psz = (res->end - res->start + (PAGE_SIZE - 1)) / PAGE_SIZE;

	shmedia_free_io(res);

	if ((char *)res >= (char *)xresv &&
	    (char *)res <  (char *)&xresv[XNRES]) {
		xres_free((struct xresource *)res);
	} else {
		kfree(res);