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