1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
26
27
28
29
30
31
32
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
45
46
47
48
49
50
51
52
53 struct dfl_afu_dma_region {
54 u64 user_addr;
55 u64 length;
56 u64 iova;
57 struct page **pages;
58 struct rb_node node;
59 bool in_use;
60 };
61
62
63
64
65
66
67
68
69
70
71
72 struct dfl_afu {
73 u64 region_cur_offset;
74 int num_regions;
75 u8 num_umsgs;
76 struct list_head regions;
77 struct rb_root dma_regions;
78
79 struct dfl_feature_platform_data *pdata;
80 };
81
82
83 void __afu_port_enable(struct platform_device *pdev);
84 int __afu_port_disable(struct platform_device *pdev);
85
86 void afu_mmio_region_init(struct dfl_feature_platform_data *pdata);
87 int afu_mmio_region_add(struct dfl_feature_platform_data *pdata,
88 u32 region_index, u64 region_size, u64 phys, u32 flags);
89 void afu_mmio_region_destroy(struct dfl_feature_platform_data *pdata);
90 int afu_mmio_region_get_by_index(struct dfl_feature_platform_data *pdata,
91 u32 region_index,
92 struct dfl_afu_mmio_region *pregion);
93 int afu_mmio_region_get_by_offset(struct dfl_feature_platform_data *pdata,
94 u64 offset, u64 size,
95 struct dfl_afu_mmio_region *pregion);
96 void afu_dma_region_init(struct dfl_feature_platform_data *pdata);
97 void afu_dma_region_destroy(struct dfl_feature_platform_data *pdata);
98 int afu_dma_map_region(struct dfl_feature_platform_data *pdata,
99 u64 user_addr, u64 length, u64 *iova);
100 int afu_dma_unmap_region(struct dfl_feature_platform_data *pdata, u64 iova);
101 struct dfl_afu_dma_region *
102 afu_dma_region_find(struct dfl_feature_platform_data *pdata,
103 u64 iova, u64 size);
104
105 extern const struct dfl_feature_ops port_err_ops;
106 extern const struct dfl_feature_id port_err_id_table[];
107 extern const struct attribute_group port_err_group;
108
109 #endif