1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#ifndef _FM10K_COMMON_H_
22#define _FM10K_COMMON_H_
23
24#include "fm10k_type.h"
25
26#define FM10K_REMOVED(hw_addr) unlikely(!(hw_addr))
27
28
29u16 fm10k_read_pci_cfg_word(struct fm10k_hw *hw, u32 reg);
30
31
32u32 fm10k_read_reg(struct fm10k_hw *hw, int reg);
33
34
35#define fm10k_write_reg(hw, reg, val) \
36do { \
37 u32 __iomem *hw_addr = READ_ONCE((hw)->hw_addr); \
38 if (!FM10K_REMOVED(hw_addr)) \
39 writel((val), &hw_addr[(reg)]); \
40} while (0)
41
42
43#define fm10k_write_sw_reg(hw, reg, val) \
44do { \
45 u32 __iomem *sw_addr = READ_ONCE((hw)->sw_addr); \
46 if (!FM10K_REMOVED(sw_addr)) \
47 writel((val), &sw_addr[(reg)]); \
48} while (0)
49
50
51#define fm10k_write_flush(hw) fm10k_read_reg((hw), FM10K_CTRL)
52s32 fm10k_get_bus_info_generic(struct fm10k_hw *hw);
53s32 fm10k_get_invariants_generic(struct fm10k_hw *hw);
54s32 fm10k_disable_queues_generic(struct fm10k_hw *hw, u16 q_cnt);
55s32 fm10k_start_hw_generic(struct fm10k_hw *hw);
56s32 fm10k_stop_hw_generic(struct fm10k_hw *hw);
57u32 fm10k_read_hw_stats_32b(struct fm10k_hw *hw, u32 addr,
58 struct fm10k_hw_stat *stat);
59#define fm10k_update_hw_base_32b(stat, delta) ((stat)->base_l += (delta))
60void fm10k_update_hw_stats_q(struct fm10k_hw *hw, struct fm10k_hw_stats_q *q,
61 u32 idx, u32 count);
62#define fm10k_unbind_hw_stats_32b(s) ((s)->base_h = 0)
63void fm10k_unbind_hw_stats_q(struct fm10k_hw_stats_q *q, u32 idx, u32 count);
64s32 fm10k_get_host_state_generic(struct fm10k_hw *hw, bool *host_ready);
65#endif
66