参照元

説明

  • パス: linux-4.4.1/lib/swiotlb.c?
  • FIXME: これは何?
    • 説明

引数

返り値

参考

実装

/*
 * Map a single buffer of the indicated size for DMA in streaming mode.  The
 * physical address to use is returned.
 *
 * Once the device is given the dma address, the device owns this memory until
 * either swiotlb_unmap_page or swiotlb_dma_sync_single is performed.
 */
dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
                            unsigned long offset, size_t size,
                            enum dma_data_direction dir,
                            struct dma_attrs *attrs)
{
        phys_addr_t map, phys = page_to_phys(page) + offset;
        dma_addr_t dev_addr = phys_to_dma(dev, phys);
        BUG_ON(dir == DMA_NONE);
    • linux-4.4.1/BUG_ON()?
        /*
         * If the address happens to be in the device's DMA window,
         * we can safely return the device addr and not worry about bounce
         * buffering it.
         */
        if (dma_capable(dev, dev_addr, size) && !swiotlb_force)
                return dev_addr;
        trace_swiotlb_bounced(dev, dev_addr, size, swiotlb_force);
    • linux-4.4.1/trace_swiotlb_bounced()?
        /* Oh well, have to allocate and map a bounce buffer. */
        map = map_single(dev, phys, size, dir);
        if (map == SWIOTLB_MAP_ERROR) {
                swiotlb_full(dev, size, dir, 1);
                return phys_to_dma(dev, io_tlb_overflow_buffer);
        }
        dev_addr = phys_to_dma(dev, map);

        /* Ensure that the address returned is DMA'ble */
        if (!dma_capable(dev, dev_addr, size)) {
                swiotlb_tbl_unmap_single(dev, map, size, dir);
                return phys_to_dma(dev, io_tlb_overflow_buffer);
        }
    • linux-4.4.1/swiotlb_tbl_unmap_single()?
        return dev_addr;
}
EXPORT_SYMBOL_GPL(swiotlb_map_page);

コメント


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2016-06-30 (木) 18:40:47 (1474d)