参照元

説明

引数

返り値

参考

実装

static void __iomem *__ioremap_caller(phys_addr_t phys_addr, size_t size,
                                      pgprot_t prot, void *caller)
{
        unsigned long last_addr;
        unsigned long offset = phys_addr & ~PAGE_MASK;
        int err;
        unsigned long addr;
        struct vm_struct *area;
        /*
         * Page align the mapping address and size, taking account of any
         * offset.
         */
        phys_addr &= PAGE_MASK;
        size = PAGE_ALIGN(size + offset);
        /*
         * Don't allow wraparound, zero size or outside PHYS_MASK.
         */
        last_addr = phys_addr + size - 1;
        if (!size || last_addr < phys_addr || (last_addr & ~PHYS_MASK))
                return NULL;

        /*
         * Don't allow RAM to be mapped.
         */
        if (WARN_ON(pfn_valid(__phys_to_pfn(phys_addr))))
                return NULL;
        area = get_vm_area_caller(size, VM_IOREMAP, caller);
        if (!area)
                return NULL;
        addr = (unsigned long)area->addr;
        area->phys_addr = phys_addr;

        err = ioremap_page_range(addr, addr + size, phys_addr, prot);
        if (err) {
                vunmap((void *)addr);
                return NULL;
        }
        return (void __iomem *)(offset + addr);
}

コメント


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS