aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx5/core/lib/pci_vsc.h
blob: 64272a6d7754ac271e802f19757fe15b1d24bba5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
/* Copyright (c) 2019 Mellanox Technologies */

#ifndef __MLX5_PCI_VSC_H__
#define __MLX5_PCI_VSC_H__

enum mlx5_vsc_state {
	MLX5_VSC_UNLOCK,
	MLX5_VSC_LOCK,
};

enum {
	MLX5_VSC_SPACE_SCAN_CRSPACE = 0x7,
};

void mlx5_pci_vsc_init(struct mlx5_core_dev *dev);
int mlx5_vsc_gw_lock(struct mlx5_core_dev *dev);
int mlx5_vsc_gw_unlock(struct mlx5_core_dev *dev);
int mlx5_vsc_gw_set_space(struct mlx5_core_dev *dev, u16 space,
			  u32 *ret_space_size);
int mlx5_vsc_gw_read_block_fast(struct mlx5_core_dev *dev, u32 *data,
				int length);

static inline bool mlx5_vsc_accessible(struct mlx5_core_dev *dev)
{
	return !!dev->vsc_addr;
}

int mlx5_vsc_sem_set_space(struct mlx5_core_dev *dev, u16 space,
			   enum mlx5_vsc_state state);

#endif /* __MLX5_PCI_VSC_H__ */