xref: /spdk/include/spdk/vfio_user_pci.h (revision a6dbe3721eb3b5990707fc3e378c95e505dd8ab5)
1 /*   SPDX-License-Identifier: BSD-3-Clause
2  *   Copyright (C) 2020 Intel Corporation. All rights reserved.
3  */
4 
5 #ifndef _SPDK_VFIO_USER_PCI_H
6 #define _SPDK_VFIO_USER_PCI_H
7 
8 #include "spdk/stdinc.h"
9 #include "spdk/vfio_user_spec.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 struct vfio_device;
16 
17 int spdk_vfio_user_pci_bar_access(struct vfio_device *dev, uint32_t index,
18 				  uint64_t offset, size_t len, void *buf,
19 				  bool is_write);
20 
21 void *spdk_vfio_user_get_bar_addr(struct vfio_device *dev, uint32_t index,
22 				  uint64_t offset, uint32_t len);
23 
24 struct vfio_device *spdk_vfio_user_setup(const char *path);
25 
26 void spdk_vfio_user_release(struct vfio_device *dev);
27 
28 /* For fuzzing only */
29 int spdk_vfio_user_dev_send_request(struct vfio_device *dev, enum vfio_user_command command,
30 				    void *arg, size_t arg_len, size_t buf_len, int *fds,
31 				    int max_fds);
32 
33 #ifdef __cplusplus
34 }
35 #endif
36 
37 #endif
38