// 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 <hao.wu@intel.com> * Xiao Guangrong <guangrong.xiao@linux.intel.com>
*/ #include"dfl-afu.h"
/** * afu_mmio_region_init - init function for afu mmio region support * @fdata: afu feature dev data
*/ void afu_mmio_region_init(struct dfl_feature_dev_data *fdata)
{ struct dfl_afu *afu = dfl_fpga_fdata_get_private(fdata);
/** * afu_mmio_region_get_by_index - find an afu region by index. * @fdata: afu feature dev data * @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_dev_data *fdata,
u32 region_index, struct dfl_afu_mmio_region *pregion)
{ struct dfl_afu_mmio_region *region; struct dfl_afu *afu; int ret = 0;
mutex_lock(&fdata->lock);
afu = dfl_fpga_fdata_get_private(fdata);
region = get_region_by_index(afu, region_index); if (!region) {
ret = -EINVAL; gotoexit;
}
*pregion = *region; exit:
mutex_unlock(&fdata->lock); return ret;
}
/** * afu_mmio_region_get_by_offset - find an afu mmio region by offset and size * * @fdata: afu feature dev data * @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_dev_data *fdata,
u64 offset, u64 size, struct dfl_afu_mmio_region *pregion)
{ struct dfl_afu_mmio_region *region; struct dfl_afu *afu; int ret = 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.