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.
42 * @region_index: region index.
43 * @region_size: region size.
44 * @phys: region's physical address of this region.
45 * @flags: region flags (access permission).
52 struct dfl_afu_mmio_region *region; in afu_mmio_region_add() local
56 region = devm_kzalloc(&pdata->dev->dev, sizeof(*region), GFP_KERNEL); in afu_mmio_region_add()
57 if (!region) in afu_mmio_region_add()
60 region->index = region_index; in afu_mmio_region_add()
61 region->size = region_size; in afu_mmio_region_add()
62 region->phys = phys; in afu_mmio_region_add()
63 region->flags = flags; in afu_mmio_region_add()
77 region->offset = afu->region_cur_offset; in afu_mmio_region_add()
78 list_add(®ion->node, &afu->regions); in afu_mmio_region_add()
87 devm_kfree(&pdata->dev->dev, region); in afu_mmio_region_add()
98 struct dfl_afu_mmio_region *tmp, *region; in afu_mmio_region_destroy() local
100 list_for_each_entry_safe(region, tmp, &afu->regions, node) in afu_mmio_region_destroy()
101 devm_kfree(&pdata->dev->dev, region); in afu_mmio_region_destroy()
105 * afu_mmio_region_get_by_index - find an afu region by index.
107 * @region_index: region index.
108 * @pregion: ptr to region for result.
116 struct dfl_afu_mmio_region *region; in afu_mmio_region_get_by_index() local
122 region = get_region_by_index(afu, region_index); in afu_mmio_region_get_by_index()
123 if (!region) { in afu_mmio_region_get_by_index()
127 *pregion = *region; in afu_mmio_region_get_by_index()
134 * afu_mmio_region_get_by_offset - find an afu mmio region by offset and size
137 * @offset: region offset from start of the device fd.
138 * @size: region size.
139 * @pregion: ptr to region for result.
141 * Find the region which fully contains the region described by input
142 * parameters (offset and size) from the feature dev's region linked list.
150 struct dfl_afu_mmio_region *region; in afu_mmio_region_get_by_offset() local
156 for_each_region(region, afu) in afu_mmio_region_get_by_offset()
157 if (region->offset <= offset && in afu_mmio_region_get_by_offset()
158 region->offset + region->size >= offset + size) { in afu_mmio_region_get_by_offset()
159 *pregion = *region; in afu_mmio_region_get_by_offset()