1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2020 Mellanox Technologies Ltd */
3 
4 #ifndef __MLX5_SF_DEV_H__
5 #define __MLX5_SF_DEV_H__
6 
7 #ifdef CONFIG_MLX5_SF
8 
9 #include <linux/auxiliary_bus.h>
10 
11 #define MLX5_SF_DEV_ID_NAME "sf"
12 
13 struct mlx5_sf_dev {
14 	struct auxiliary_device adev;
15 	struct mlx5_core_dev *parent_mdev;
16 	struct mlx5_core_dev *mdev;
17 	phys_addr_t bar_base_addr;
18 	u32 sfnum;
19 	u16 fn_id;
20 };
21 
22 void mlx5_sf_dev_table_create(struct mlx5_core_dev *dev);
23 void mlx5_sf_dev_table_destroy(struct mlx5_core_dev *dev);
24 
25 int mlx5_sf_driver_register(void);
26 void mlx5_sf_driver_unregister(void);
27 
28 bool mlx5_sf_dev_allocated(const struct mlx5_core_dev *dev);
29 
30 #else
31 
mlx5_sf_dev_table_create(struct mlx5_core_dev * dev)32 static inline void mlx5_sf_dev_table_create(struct mlx5_core_dev *dev)
33 {
34 }
35 
mlx5_sf_dev_table_destroy(struct mlx5_core_dev * dev)36 static inline void mlx5_sf_dev_table_destroy(struct mlx5_core_dev *dev)
37 {
38 }
39 
mlx5_sf_driver_register(void)40 static inline int mlx5_sf_driver_register(void)
41 {
42 	return 0;
43 }
44 
mlx5_sf_driver_unregister(void)45 static inline void mlx5_sf_driver_unregister(void)
46 {
47 }
48 
mlx5_sf_dev_allocated(const struct mlx5_core_dev * dev)49 static inline bool mlx5_sf_dev_allocated(const struct mlx5_core_dev *dev)
50 {
51 	return false;
52 }
53 
54 #endif
55 
56 #endif
57