Xiao Guangrong | 857a262 | 2018-06-30 08:53:34 +0800 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
| 3 | * Header file for FPGA Accelerated Function Unit (AFU) Driver |
| 4 | * |
| 5 | * Copyright (C) 2017-2018 Intel Corporation, Inc. |
| 6 | * |
| 7 | * Authors: |
| 8 | * Wu Hao <hao.wu@intel.com> |
| 9 | * Xiao Guangrong <guangrong.xiao@linux.intel.com> |
| 10 | * Joseph Grecco <joe.grecco@intel.com> |
| 11 | * Enno Luebbers <enno.luebbers@intel.com> |
| 12 | * Tim Whisonant <tim.whisonant@intel.com> |
| 13 | * Ananda Ravuri <ananda.ravuri@intel.com> |
| 14 | * Henry Mitchel <henry.mitchel@intel.com> |
| 15 | */ |
| 16 | |
| 17 | #ifndef __DFL_AFU_H |
| 18 | #define __DFL_AFU_H |
| 19 | |
| 20 | #include <linux/mm.h> |
| 21 | |
| 22 | #include "dfl.h" |
| 23 | |
| 24 | /** |
| 25 | * struct dfl_afu_mmio_region - afu mmio region data structure |
| 26 | * |
| 27 | * @index: region index. |
| 28 | * @flags: region flags (access permission). |
| 29 | * @size: region size. |
| 30 | * @offset: region offset from start of the device fd. |
| 31 | * @phys: region's physical address. |
| 32 | * @node: node to add to afu feature dev's region list. |
| 33 | */ |
| 34 | struct dfl_afu_mmio_region { |
| 35 | u32 index; |
| 36 | u32 flags; |
| 37 | u64 size; |
| 38 | u64 offset; |
| 39 | u64 phys; |
| 40 | struct list_head node; |
| 41 | }; |
| 42 | |
| 43 | /** |
| 44 | * struct dfl_afu - afu device data structure |
| 45 | * |
| 46 | * @region_cur_offset: current region offset from start to the device fd. |
| 47 | * @num_regions: num of mmio regions. |
| 48 | * @regions: the mmio region linked list of this afu feature device. |
| 49 | * @num_umsgs: num of umsgs. |
| 50 | * @pdata: afu platform device's pdata. |
| 51 | */ |
| 52 | struct dfl_afu { |
| 53 | u64 region_cur_offset; |
| 54 | int num_regions; |
| 55 | u8 num_umsgs; |
| 56 | struct list_head regions; |
| 57 | |
| 58 | struct dfl_feature_platform_data *pdata; |
| 59 | }; |
| 60 | |
| 61 | void afu_mmio_region_init(struct dfl_feature_platform_data *pdata); |
| 62 | int afu_mmio_region_add(struct dfl_feature_platform_data *pdata, |
| 63 | u32 region_index, u64 region_size, u64 phys, u32 flags); |
| 64 | void afu_mmio_region_destroy(struct dfl_feature_platform_data *pdata); |
| 65 | int afu_mmio_region_get_by_index(struct dfl_feature_platform_data *pdata, |
| 66 | u32 region_index, |
| 67 | struct dfl_afu_mmio_region *pregion); |
| 68 | int afu_mmio_region_get_by_offset(struct dfl_feature_platform_data *pdata, |
| 69 | u64 offset, u64 size, |
| 70 | struct dfl_afu_mmio_region *pregion); |
| 71 | #endif |