Function report |
Source Code:kernel\dma\swiotlb.c |
Create Date:2022-07-28 10:36:14 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:swiotlb_tbl_map_single
Proto:phys_addr_t swiotlb_tbl_map_single(struct device *hwdev, dma_addr_t tbl_dma_addr, phys_addr_t orig_addr, size_t mapping_size, size_t alloc_size, enum dma_data_direction dir, unsigned long attrs)
Type:phys_addr_t
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct device * | hwdev | |
| dma_addr_t | tbl_dma_addr | |
| phys_addr_t | orig_addr | |
| size_t | mapping_size | |
| size_t | alloc_size | |
| enum dma_data_direction | dir | |
| unsigned long | attrs |
| 462 | If no_iotlb_memory Then panic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns. |
| 465 | If mem_encrypt_active() Then pr_warn_once("Memory encryption is active and system is using DMA bounce buffers\n") |
| 468 | If mapping_size > alloc_size Then |
| 469 | dev_warn_once(hwdev, "Invalid sizes (mapping: %zd bytes, alloc: %zd bytes)", mapping_size, alloc_size) |
| 471 | Return DMA_MAPPING_ERROR |
| 474 | mask = dma_get_seg_boundary(hwdev) |
| 476 | tbl_dma_addr &= mask |
| 492 | If alloc_size >= PAGE_SIZE Then stride = 1 << PAGE_SHIFT determines the page size - log of the size of each IO TLB slab. The number of slabs is command line* controllable. |
| 494 | Else stride = 1 |
| 508 | index = @a is a power of 2 value (io_tlb_index, stride) |
| 509 | If index >= The number of IO TLB blocks (in groups of 64) between io_tlb_start and* io_tlb_end. This is command line adjustable via setup_io_tlb_npages. Then index = 0 |
| 513 | Do |
| 514 | When iommu_is_span_boundary(index, nslots, offset_slots, max_slots) cycle |
| 529 | count = 0 |
| 531 | When i < index + nslots cycle This is a free list describing the number of free entries available from* each index[i] = 0 |
| 544 | Go to found |
| 551 | not_found : |
| 555 | If Not (attrs & DMA_ATTR_NO_WARN: This tells the DMA-mapping subsystem to suppress* allocation failure reports (similarly to __GFP_NOWARN).) && printk_ratelimit() Then dev_warn(hwdev, "swiotlb buffer is full (sz: %zd bytes), total %lu (slots), used %lu (slots)\n", alloc_size, The number of IO TLB blocks (in groups of 64) between io_tlb_start and* io_tlb_end. This is command line adjustable via setup_io_tlb_npages., tmp_io_tlb_used) |
| 558 | Return DMA_MAPPING_ERROR |
| 559 | found : |
| 568 | When i < nslots cycle io_tlb_orig_addr[index + i] = orig_addr + (i << log of the size of each IO TLB slab. The number of slabs is command line* controllable.) |
| 574 | Return tlb_addr |
| Name | Describe |
|---|---|
| swiotlb_map | Create a swiotlb mapping for the buffer at @phys, and in case of DMAing* to the device copy the data into it as well. |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |