// SPDX-License-Identifier: GPL-2.0 /* * Driver for FPGA Accelerated Function Unit (AFU) MMIO Region Management * * Copyright (C) 2017-2018 Intel Corporation, Inc. * * Authors: * Wu Hao <[email protected]> * Xiao Guangrong <[email protected]> */ #include "dfl-afu.h" /** * afu_mmio_region_init - init function for afu mmio region support * @pdata: afu platform device's pdata. */ void afu_mmio_region_init(struct dfl_feature_platform_data *pdata) { … } #define for_each_region(region, afu) … static struct dfl_afu_mmio_region *get_region_by_index(struct dfl_afu *afu, u32 region_index) { … } /** * afu_mmio_region_add - add a mmio region to given feature dev. * * @pdata: afu platform device's pdata. * @region_index: region index. * @region_size: region size. * @phys: region's physical address of this region. * @flags: region flags (access permission). * * Return: 0 on success, negative error code otherwise. */ int afu_mmio_region_add(struct dfl_feature_platform_data *pdata, u32 region_index, u64 region_size, u64 phys, u32 flags) { … } /** * afu_mmio_region_destroy - destroy all mmio regions under given feature dev. * @pdata: afu platform device's pdata. */ void afu_mmio_region_destroy(struct dfl_feature_platform_data *pdata) { … } /** * afu_mmio_region_get_by_index - find an afu region by index. * @pdata: afu platform device's pdata. * @region_index: region index. * @pregion: ptr to region for result. * * Return: 0 on success, negative error code otherwise. */ int afu_mmio_region_get_by_index(struct dfl_feature_platform_data *pdata, u32 region_index, struct dfl_afu_mmio_region *pregion) { … } /** * afu_mmio_region_get_by_offset - find an afu mmio region by offset and size * * @pdata: afu platform device's pdata. * @offset: region offset from start of the device fd. * @size: region size. * @pregion: ptr to region for result. * * Find the region which fully contains the region described by input * parameters (offset and size) from the feature dev's region linked list. * * Return: 0 on success, negative error code otherwise. */ int afu_mmio_region_get_by_offset(struct dfl_feature_platform_data *pdata, u64 offset, u64 size, struct dfl_afu_mmio_region *pregion) { … }