hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/drivers/ntb/hw/amd/ntb_hw_amd.h
....@@ -52,13 +52,9 @@
5252 #include <linux/ntb.h>
5353 #include <linux/pci.h>
5454
55
-#define PCI_DEVICE_ID_AMD_NTB 0x145B
5655 #define AMD_LINK_HB_TIMEOUT msecs_to_jiffies(1000)
57
-#define AMD_LINK_STATUS_OFFSET 0x68
58
-#define NTB_LIN_STA_ACTIVE_BIT 0x00000002
5956 #define NTB_LNK_STA_SPEED_MASK 0x000F0000
6057 #define NTB_LNK_STA_WIDTH_MASK 0x03F00000
61
-#define NTB_LNK_STA_ACTIVE(x) (!!((x) & NTB_LIN_STA_ACTIVE_BIT))
6258 #define NTB_LNK_STA_SPEED(x) (((x) & NTB_LNK_STA_SPEED_MASK) >> 16)
6359 #define NTB_LNK_STA_WIDTH(x) (((x) & NTB_LNK_STA_WIDTH_MASK) >> 20)
6460
....@@ -93,7 +89,6 @@
9389
9490 enum {
9591 /* AMD NTB Capability */
96
- AMD_MW_CNT = 3,
9792 AMD_DB_CNT = 16,
9893 AMD_MSIX_VECTOR_CNT = 24,
9994 AMD_SPADS_CNT = 16,
....@@ -170,6 +165,11 @@
170165 AMD_PEER_OFFSET = 0x400,
171166 };
172167
168
+struct ntb_dev_data {
169
+ const unsigned char mw_count;
170
+ const unsigned int mw_idx;
171
+};
172
+
173173 struct amd_ntb_dev;
174174
175175 struct amd_ntb_vec {
....@@ -185,6 +185,7 @@
185185 u32 cntl_sta;
186186 u32 peer_sta;
187187
188
+ struct ntb_dev_data *dev_data;
188189 unsigned char mw_count;
189190 unsigned char spad_count;
190191 unsigned char db_count;
....@@ -192,6 +193,7 @@
192193
193194 u64 db_valid_mask;
194195 u64 db_mask;
196
+ u64 db_last_bit;
195197 u32 int_mask;
196198
197199 struct msix_entry *msix;
....@@ -214,4 +216,8 @@
214216 #define ntb_ndev(__ntb) container_of(__ntb, struct amd_ntb_dev, ntb)
215217 #define hb_ndev(__work) container_of(__work, struct amd_ntb_dev, hb_timer.work)
216218
219
+static void amd_set_side_info_reg(struct amd_ntb_dev *ndev, bool peer);
220
+static void amd_clear_side_info_reg(struct amd_ntb_dev *ndev, bool peer);
221
+static int amd_poll_link(struct amd_ntb_dev *ndev);
222
+
217223 #endif