| .. | .. |
|---|
| 52 | 52 | #include <linux/ntb.h> |
|---|
| 53 | 53 | #include <linux/pci.h> |
|---|
| 54 | 54 | |
|---|
| 55 | | -#define PCI_DEVICE_ID_AMD_NTB 0x145B |
|---|
| 56 | 55 | #define AMD_LINK_HB_TIMEOUT msecs_to_jiffies(1000) |
|---|
| 57 | | -#define AMD_LINK_STATUS_OFFSET 0x68 |
|---|
| 58 | | -#define NTB_LIN_STA_ACTIVE_BIT 0x00000002 |
|---|
| 59 | 56 | #define NTB_LNK_STA_SPEED_MASK 0x000F0000 |
|---|
| 60 | 57 | #define NTB_LNK_STA_WIDTH_MASK 0x03F00000 |
|---|
| 61 | | -#define NTB_LNK_STA_ACTIVE(x) (!!((x) & NTB_LIN_STA_ACTIVE_BIT)) |
|---|
| 62 | 58 | #define NTB_LNK_STA_SPEED(x) (((x) & NTB_LNK_STA_SPEED_MASK) >> 16) |
|---|
| 63 | 59 | #define NTB_LNK_STA_WIDTH(x) (((x) & NTB_LNK_STA_WIDTH_MASK) >> 20) |
|---|
| 64 | 60 | |
|---|
| .. | .. |
|---|
| 93 | 89 | |
|---|
| 94 | 90 | enum { |
|---|
| 95 | 91 | /* AMD NTB Capability */ |
|---|
| 96 | | - AMD_MW_CNT = 3, |
|---|
| 97 | 92 | AMD_DB_CNT = 16, |
|---|
| 98 | 93 | AMD_MSIX_VECTOR_CNT = 24, |
|---|
| 99 | 94 | AMD_SPADS_CNT = 16, |
|---|
| .. | .. |
|---|
| 170 | 165 | AMD_PEER_OFFSET = 0x400, |
|---|
| 171 | 166 | }; |
|---|
| 172 | 167 | |
|---|
| 168 | +struct ntb_dev_data { |
|---|
| 169 | + const unsigned char mw_count; |
|---|
| 170 | + const unsigned int mw_idx; |
|---|
| 171 | +}; |
|---|
| 172 | + |
|---|
| 173 | 173 | struct amd_ntb_dev; |
|---|
| 174 | 174 | |
|---|
| 175 | 175 | struct amd_ntb_vec { |
|---|
| .. | .. |
|---|
| 185 | 185 | u32 cntl_sta; |
|---|
| 186 | 186 | u32 peer_sta; |
|---|
| 187 | 187 | |
|---|
| 188 | + struct ntb_dev_data *dev_data; |
|---|
| 188 | 189 | unsigned char mw_count; |
|---|
| 189 | 190 | unsigned char spad_count; |
|---|
| 190 | 191 | unsigned char db_count; |
|---|
| .. | .. |
|---|
| 192 | 193 | |
|---|
| 193 | 194 | u64 db_valid_mask; |
|---|
| 194 | 195 | u64 db_mask; |
|---|
| 196 | + u64 db_last_bit; |
|---|
| 195 | 197 | u32 int_mask; |
|---|
| 196 | 198 | |
|---|
| 197 | 199 | struct msix_entry *msix; |
|---|
| .. | .. |
|---|
| 214 | 216 | #define ntb_ndev(__ntb) container_of(__ntb, struct amd_ntb_dev, ntb) |
|---|
| 215 | 217 | #define hb_ndev(__work) container_of(__work, struct amd_ntb_dev, hb_timer.work) |
|---|
| 216 | 218 | |
|---|
| 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 | + |
|---|
| 217 | 223 | #endif |
|---|