Lines Matching full:region
3 * Driver for FPGA Accelerated Function Unit (AFU) MMIO Region Management
14 * afu_mmio_region_init - init function for afu mmio region support
24 #define for_each_region(region, afu) \ argument
25 list_for_each_entry((region), &(afu)->regions, node)
30 struct dfl_afu_mmio_region *region; in get_region_by_index() local
32 for_each_region(region, afu) in get_region_by_index()
33 if (region->index == region_index) in get_region_by_index()
34 return region; in get_region_by_index()
40 * afu_mmio_region_add - add a mmio region to given feature dev.
43 * @region_index: region index.
44 * @region_size: region size.
45 * @phys: region's physical address of this region.
46 * @flags: region flags (access permission).
53 struct dfl_afu_mmio_region *region; in afu_mmio_region_add() local
57 region = devm_kzalloc(&pdata->dev->dev, sizeof(*region), GFP_KERNEL); in afu_mmio_region_add()
58 if (!region) in afu_mmio_region_add()
61 region->index = region_index; in afu_mmio_region_add()
62 region->size = region_size; in afu_mmio_region_add()
63 region->phys = phys; in afu_mmio_region_add()
64 region->flags = flags; in afu_mmio_region_add()
78 region->offset = afu->region_cur_offset; in afu_mmio_region_add()
79 list_add(®ion->node, &afu->regions); in afu_mmio_region_add()
88 devm_kfree(&pdata->dev->dev, region); in afu_mmio_region_add()
99 struct dfl_afu_mmio_region *tmp, *region; in afu_mmio_region_destroy() local
101 list_for_each_entry_safe(region, tmp, &afu->regions, node) in afu_mmio_region_destroy()
102 devm_kfree(&pdata->dev->dev, region); in afu_mmio_region_destroy()
106 * afu_mmio_region_get_by_index - find an afu region by index.
108 * @region_index: region index.
109 * @pregion: ptr to region for result.
117 struct dfl_afu_mmio_region *region; in afu_mmio_region_get_by_index() local
123 region = get_region_by_index(afu, region_index); in afu_mmio_region_get_by_index()
124 if (!region) { in afu_mmio_region_get_by_index()
128 *pregion = *region; in afu_mmio_region_get_by_index()
135 * afu_mmio_region_get_by_offset - find an afu mmio region by offset and size
138 * @offset: region offset from start of the device fd.
139 * @size: region size.
140 * @pregion: ptr to region for result.
142 * Find the region which fully contains the region described by input
143 * parameters (offset and size) from the feature dev's region linked list.
151 struct dfl_afu_mmio_region *region; in afu_mmio_region_get_by_offset() local
157 for_each_region(region, afu) in afu_mmio_region_get_by_offset()
158 if (region->offset <= offset && in afu_mmio_region_get_by_offset()
159 region->offset + region->size >= offset + size) { in afu_mmio_region_get_by_offset()
160 *pregion = *region; in afu_mmio_region_get_by_offset()