1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2022 Intel Corporation
16 #include <rte_spinlock.h>
17 #include <rte_bus_ifpga.h>
18 #include <rte_rawdev.h>
20 #include "ifpga_rawdev.h"
22 #define AFU_RAWDEV_MAX_DRVS 32
27 int (*init)(struct afu_rawdev *dev);
28 int (*config)(struct afu_rawdev *dev, void *config,
30 int (*start)(struct afu_rawdev *dev);
31 int (*stop)(struct afu_rawdev *dev);
32 int (*test)(struct afu_rawdev *dev);
33 int (*close)(struct afu_rawdev *dev);
34 int (*reset)(struct afu_rawdev *dev);
35 int (*dump)(struct afu_rawdev *dev, FILE *f);
38 struct afu_shared_data {
39 rte_spinlock_t lock; /* lock for multi-process access */
42 struct afu_rawdev_drv {
43 TAILQ_ENTRY(afu_rawdev_drv) next;
44 struct rte_afu_uuid uuid;
49 struct rte_rawdev *rawdev; /* point to parent raw device */
50 struct afu_shared_data *sd; /* shared data for multi-process */
51 struct afu_ops *ops; /* device operation functions */
52 int port; /* index of port the AFU attached */
53 void *addr; /* base address of AFU registers */
54 void *priv; /* private driver data */
57 static inline struct afu_rawdev *
58 afu_rawdev_get_priv(const struct rte_rawdev *rawdev)
60 return rawdev ? (struct afu_rawdev *)rawdev->dev_private : NULL;
63 void afu_pmd_register(struct afu_rawdev_drv *driver);
64 void afu_pmd_unregister(struct afu_rawdev_drv *driver);
66 #define AFU_PMD_REGISTER(drv)\
67 RTE_INIT(afupmdinitfunc_ ##drv)\
69 afu_pmd_register(&drv);\
76 #endif /* AFU_PMD_CORE_H */