函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\amd_gart_64.c Create Date:2022-07-27 09:51:46
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:DMA map all entries in a scatterlist.* Merge chunks that have page aligned sizes into a continuous mapping.

函数原型:static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, enum dma_data_direction dir, unsigned long attrs)

返回类型:int

参数:

类型参数名称
struct device *dev
struct scatterlist *sg
intnents
enum dma_data_directiondir
unsigned longattrs
384  need等于0
385  pages等于0
389  如果nents恒等于0则返回:0
392  out等于0
393  start等于0
394  start_sg等于sg
395  sgmap等于sg
396  seg_size等于0
397  max_seg_size等于dma_get_max_seg_size(dev)
398  ps = NULL
401  addr等于返回SG物理地址入口
403  dma_address等于addr
404  BUG_ON(length == 0)
406  nextneed等于need_iommu(dev, addr, length)
409  如果i大于start
415  如果非iommu_merge或非nextneed或非needoffsetlengthseg_size大于max_seg_sizeoffsetlength的和取模PAGE_SIZE
418  如果dma_map_cont(dev, start_sg, i - start, sgmap, pages, need)小于0则转到:error
421  out自加
423  seg_size等于0
425  pages等于0
426  start等于i
427  start_sg等于s
431  seg_size加等于length
432  need等于nextneed
433  pages加等于iommu_num_pages(offset, length, PAGE_SIZE)
434  ps等于s
436  如果dma_map_cont(dev, start_sg, i - start, sgmap, pages, need)小于0则转到:error
438  out自加
439  Use global flush state to avoid races with multiple flushers.
440  如果out小于nents
441  sgmap等于 返回下一个散列表的条目
442  dma_length等于0
444  返回:out
446  error :
447  Use global flush state to avoid races with multiple flushers.
448  Wrapper for pci_unmap_single working with scatterlists.
451  如果force_iommuiommu_merge
452  out等于Fallback for dma_map_sg in case of overflow
453  如果out大于0则返回:out
456  如果panic_on_overflowpanic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns.
459  iommu_full(dev, pages << PAGE_SHIFT determines the page size , dir)
460  Loop over each sg element, following the pointer to a new list if necessary(sg, s, nents, i)
461  dma_address等于DMA_MAPPING_ERROR
462  返回:0