| .. | .. |
|---|
| 33 | 33 | #ifndef _HNS_ROCE_COMMON_H |
|---|
| 34 | 34 | #define _HNS_ROCE_COMMON_H |
|---|
| 35 | 35 | |
|---|
| 36 | | -#ifndef assert |
|---|
| 37 | | -#define assert(cond) |
|---|
| 38 | | -#endif |
|---|
| 39 | | - |
|---|
| 40 | 36 | #define roce_write(dev, reg, val) writel((val), (dev)->reg_base + (reg)) |
|---|
| 41 | 37 | #define roce_read(dev, reg) readl((dev)->reg_base + (reg)) |
|---|
| 42 | 38 | #define roce_raw_write(value, addr) \ |
|---|
| .. | .. |
|---|
| 56 | 52 | |
|---|
| 57 | 53 | #define roce_set_bit(origin, shift, val) \ |
|---|
| 58 | 54 | roce_set_field((origin), (1ul << (shift)), (shift), (val)) |
|---|
| 59 | | - |
|---|
| 60 | | -/* |
|---|
| 61 | | - * roce_hw_index_cmp_lt - Compare two hardware index values in hisilicon |
|---|
| 62 | | - * SOC, check if a is less than b. |
|---|
| 63 | | - * @a: hardware index value |
|---|
| 64 | | - * @b: hardware index value |
|---|
| 65 | | - * @bits: the number of bits of a and b, range: 0~31. |
|---|
| 66 | | - * |
|---|
| 67 | | - * Hardware index increases continuously till max value, and then restart |
|---|
| 68 | | - * from zero, again and again. Because the bits of reg field is often |
|---|
| 69 | | - * limited, the reg field can only hold the low bits of the hardware index |
|---|
| 70 | | - * in hisilicon SOC. |
|---|
| 71 | | - * In some scenes we need to compare two values(a,b) getted from two reg |
|---|
| 72 | | - * fields in this driver, for example: |
|---|
| 73 | | - * If a equals 0xfffe, b equals 0x1 and bits equals 16, we think b has |
|---|
| 74 | | - * incresed from 0xffff to 0x1 and a is less than b. |
|---|
| 75 | | - * If a equals 0xfffe, b equals 0x0xf001 and bits equals 16, we think a |
|---|
| 76 | | - * is bigger than b. |
|---|
| 77 | | - * |
|---|
| 78 | | - * Return true on a less than b, otherwise false. |
|---|
| 79 | | - */ |
|---|
| 80 | | -#define roce_hw_index_mask(bits) ((1ul << (bits)) - 1) |
|---|
| 81 | | -#define roce_hw_index_shift(bits) (32 - (bits)) |
|---|
| 82 | | -#define roce_hw_index_cmp_lt(a, b, bits) \ |
|---|
| 83 | | - ((int)((((a) - (b)) & roce_hw_index_mask(bits)) << \ |
|---|
| 84 | | - roce_hw_index_shift(bits)) < 0) |
|---|
| 85 | 55 | |
|---|
| 86 | 56 | #define ROCEE_GLB_CFG_ROCEE_DB_SQ_MODE_S 3 |
|---|
| 87 | 57 | #define ROCEE_GLB_CFG_ROCEE_DB_OTH_MODE_S 4 |
|---|
| .. | .. |
|---|
| 271 | 241 | #define ROCEE_SDB_SEND_PTR_SDB_SEND_PTR_M \ |
|---|
| 272 | 242 | (((1UL << 28) - 1) << ROCEE_SDB_SEND_PTR_SDB_SEND_PTR_S) |
|---|
| 273 | 243 | |
|---|
| 274 | | -#define ROCEE_SDB_PTR_CMP_BITS 28 |
|---|
| 275 | | - |
|---|
| 276 | 244 | #define ROCEE_SDB_INV_CNT_SDB_INV_CNT_S 0 |
|---|
| 277 | 245 | #define ROCEE_SDB_INV_CNT_SDB_INV_CNT_M \ |
|---|
| 278 | 246 | (((1UL << 16) - 1) << ROCEE_SDB_INV_CNT_SDB_INV_CNT_S) |
|---|
| .. | .. |
|---|
| 353 | 321 | #define ROCEE_CAEP_AE_MASK_REG 0x6C8 |
|---|
| 354 | 322 | #define ROCEE_CAEP_AE_ST_REG 0x6CC |
|---|
| 355 | 323 | |
|---|
| 356 | | -#define ROCEE_SDB_ISSUE_PTR_REG 0x758 |
|---|
| 357 | | -#define ROCEE_SDB_SEND_PTR_REG 0x75C |
|---|
| 358 | 324 | #define ROCEE_CAEP_CQE_WCMD_EMPTY 0x850 |
|---|
| 359 | 325 | #define ROCEE_SCAEP_WR_CQE_CNT 0x8D0 |
|---|
| 360 | | -#define ROCEE_SDB_INV_CNT_REG 0x9A4 |
|---|
| 361 | | -#define ROCEE_SDB_RETRY_CNT_REG 0x9AC |
|---|
| 362 | | -#define ROCEE_TSP_BP_ST_REG 0x9EC |
|---|
| 363 | 326 | #define ROCEE_ECC_UCERR_ALM0_REG 0xB34 |
|---|
| 364 | 327 | #define ROCEE_ECC_CERR_ALM0_REG 0xB40 |
|---|
| 365 | 328 | |
|---|
| .. | .. |
|---|
| 375 | 338 | #define ROCEE_RX_CMQ_DEPTH_REG 0x07020 |
|---|
| 376 | 339 | #define ROCEE_RX_CMQ_TAIL_REG 0x07024 |
|---|
| 377 | 340 | #define ROCEE_RX_CMQ_HEAD_REG 0x07028 |
|---|
| 378 | | - |
|---|
| 379 | | -#define ROCEE_VF_MB_CFG0_REG 0x40 |
|---|
| 380 | | -#define ROCEE_VF_MB_STATUS_REG 0x58 |
|---|
| 381 | 341 | |
|---|
| 382 | 342 | #define ROCEE_VF_EQ_DB_CFG0_REG 0x238 |
|---|
| 383 | 343 | #define ROCEE_VF_EQ_DB_CFG1_REG 0x23C |
|---|