.. | .. |
---|
53 | 53 | |
---|
54 | 54 | #include <linux/ntb.h> |
---|
55 | 55 | #include <linux/pci.h> |
---|
| 56 | +#include <linux/io-64-nonatomic-lo-hi.h> |
---|
56 | 57 | |
---|
57 | 58 | /* PCI device IDs */ |
---|
58 | 59 | #define PCI_DEVICE_ID_INTEL_NTB_B2B_JSF 0x3725 |
---|
.. | .. |
---|
71 | 72 | #define PCI_DEVICE_ID_INTEL_NTB_PS_BDX 0x6F0E |
---|
72 | 73 | #define PCI_DEVICE_ID_INTEL_NTB_SS_BDX 0x6F0F |
---|
73 | 74 | #define PCI_DEVICE_ID_INTEL_NTB_B2B_SKX 0x201C |
---|
| 75 | +#define PCI_DEVICE_ID_INTEL_NTB_B2B_ICX 0x347e |
---|
74 | 76 | |
---|
75 | 77 | /* Ntb control and link status */ |
---|
76 | 78 | #define NTB_CTL_CFG_LOCK BIT(0) |
---|
.. | .. |
---|
101 | 103 | struct intel_ntb_reg { |
---|
102 | 104 | int (*poll_link)(struct intel_ntb_dev *ndev); |
---|
103 | 105 | int (*link_is_up)(struct intel_ntb_dev *ndev); |
---|
104 | | - u64 (*db_ioread)(void __iomem *mmio); |
---|
| 106 | + u64 (*db_ioread)(const void __iomem *mmio); |
---|
105 | 107 | void (*db_iowrite)(u64 db_bits, void __iomem *mmio); |
---|
106 | 108 | unsigned long ntb_ctl; |
---|
107 | 109 | resource_size_t db_size; |
---|
.. | .. |
---|
119 | 121 | unsigned long bar0_base; |
---|
120 | 122 | unsigned long bar2_xlat; |
---|
121 | 123 | unsigned long bar2_limit; |
---|
| 124 | + unsigned short bar2_idx; |
---|
122 | 125 | }; |
---|
123 | 126 | |
---|
124 | 127 | struct intel_b2b_addr { |
---|
.. | .. |
---|
181 | 184 | |
---|
182 | 185 | struct dentry *debugfs_dir; |
---|
183 | 186 | struct dentry *debugfs_info; |
---|
| 187 | + |
---|
| 188 | + /* gen4 entries */ |
---|
| 189 | + int dev_up; |
---|
184 | 190 | }; |
---|
185 | 191 | |
---|
186 | 192 | #define ntb_ndev(__ntb) container_of(__ntb, struct intel_ntb_dev, ntb) |
---|
.. | .. |
---|
218 | 224 | return 0; |
---|
219 | 225 | } |
---|
220 | 226 | |
---|
221 | | -#ifndef ioread64 |
---|
222 | | -#ifdef readq |
---|
223 | | -#define ioread64 readq |
---|
224 | | -#else |
---|
225 | | -#define ioread64 _ioread64 |
---|
226 | | -static inline u64 _ioread64(void __iomem *mmio) |
---|
| 227 | +static inline int pdev_is_gen4(struct pci_dev *pdev) |
---|
227 | 228 | { |
---|
228 | | - u64 low, high; |
---|
| 229 | + if (pdev->device == PCI_DEVICE_ID_INTEL_NTB_B2B_ICX) |
---|
| 230 | + return 1; |
---|
229 | 231 | |
---|
230 | | - low = ioread32(mmio); |
---|
231 | | - high = ioread32(mmio + sizeof(u32)); |
---|
232 | | - return low | (high << 32); |
---|
| 232 | + return 0; |
---|
233 | 233 | } |
---|
234 | | -#endif |
---|
235 | | -#endif |
---|
236 | | - |
---|
237 | | -#ifndef iowrite64 |
---|
238 | | -#ifdef writeq |
---|
239 | | -#define iowrite64 writeq |
---|
240 | | -#else |
---|
241 | | -#define iowrite64 _iowrite64 |
---|
242 | | -static inline void _iowrite64(u64 val, void __iomem *mmio) |
---|
243 | | -{ |
---|
244 | | - iowrite32(val, mmio); |
---|
245 | | - iowrite32(val >> 32, mmio + sizeof(u32)); |
---|
246 | | -} |
---|
247 | | -#endif |
---|
248 | | -#endif |
---|
249 | | - |
---|
250 | 234 | #endif |
---|