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 }; 20 21 void mlx5_sf_dev_table_create(struct mlx5_core_dev *dev); 22 void mlx5_sf_dev_table_destroy(struct mlx5_core_dev *dev); 23 24 int mlx5_sf_driver_register(void); 25 void mlx5_sf_driver_unregister(void); 26 27 bool mlx5_sf_dev_allocated(const struct mlx5_core_dev *dev); 28 29 #else 30 mlx5_sf_dev_table_create(struct mlx5_core_dev * dev)31static inline void mlx5_sf_dev_table_create(struct mlx5_core_dev *dev) 32 { 33 } 34 mlx5_sf_dev_table_destroy(struct mlx5_core_dev * dev)35static inline void mlx5_sf_dev_table_destroy(struct mlx5_core_dev *dev) 36 { 37 } 38 mlx5_sf_driver_register(void)39static inline int mlx5_sf_driver_register(void) 40 { 41 return 0; 42 } 43 mlx5_sf_driver_unregister(void)44static inline void mlx5_sf_driver_unregister(void) 45 { 46 } 47 mlx5_sf_dev_allocated(const struct mlx5_core_dev * dev)48static inline bool mlx5_sf_dev_allocated(const struct mlx5_core_dev *dev) 49 { 50 return false; 51 } 52 53 #endif 54 55 #endif 56