12025cf9eSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 251ba902aSAviad Krawczyk /* 351ba902aSAviad Krawczyk * Huawei HiNIC PCI Express Linux driver 451ba902aSAviad Krawczyk * Copyright(c) 2017 Huawei Technologies Co., Ltd 551ba902aSAviad Krawczyk */ 651ba902aSAviad Krawczyk 751ba902aSAviad Krawczyk #ifndef HINIC_HW_CSR_H 851ba902aSAviad Krawczyk #define HINIC_HW_CSR_H 951ba902aSAviad Krawczyk 1051ba902aSAviad Krawczyk /* HW interface registers */ 1151ba902aSAviad Krawczyk #define HINIC_CSR_FUNC_ATTR0_ADDR 0x0 1251ba902aSAviad Krawczyk #define HINIC_CSR_FUNC_ATTR1_ADDR 0x4 13*a425b6e1SLuo bin #define HINIC_CSR_FUNC_ATTR2_ADDR 0x8 14e2585ea7SAviad Krawczyk #define HINIC_CSR_FUNC_ATTR4_ADDR 0x10 15c4d06d2dSAviad Krawczyk #define HINIC_CSR_FUNC_ATTR5_ADDR 0x14 16c4d06d2dSAviad Krawczyk 1751ba902aSAviad Krawczyk #define HINIC_DMA_ATTR_BASE 0xC80 1851ba902aSAviad Krawczyk #define HINIC_ELECTION_BASE 0x4200 1951ba902aSAviad Krawczyk 2051ba902aSAviad Krawczyk #define HINIC_DMA_ATTR_STRIDE 0x4 2151ba902aSAviad Krawczyk #define HINIC_CSR_DMA_ATTR_ADDR(idx) \ 2251ba902aSAviad Krawczyk (HINIC_DMA_ATTR_BASE + (idx) * HINIC_DMA_ATTR_STRIDE) 2351ba902aSAviad Krawczyk 2451ba902aSAviad Krawczyk #define HINIC_PPF_ELECTION_STRIDE 0x4 2551ba902aSAviad Krawczyk 2651ba902aSAviad Krawczyk #define HINIC_CSR_PPF_ELECTION_ADDR(idx) \ 2751ba902aSAviad Krawczyk (HINIC_ELECTION_BASE + (idx) * HINIC_PPF_ELECTION_STRIDE) 2851ba902aSAviad Krawczyk 293dcea321SAviad Krawczyk /* API CMD registers */ 303dcea321SAviad Krawczyk #define HINIC_CSR_API_CMD_BASE 0xF000 313dcea321SAviad Krawczyk 323dcea321SAviad Krawczyk #define HINIC_CSR_API_CMD_STRIDE 0x100 333dcea321SAviad Krawczyk 343dcea321SAviad Krawczyk #define HINIC_CSR_API_CMD_CHAIN_HEAD_HI_ADDR(idx) \ 353dcea321SAviad Krawczyk (HINIC_CSR_API_CMD_BASE + 0x0 + (idx) * HINIC_CSR_API_CMD_STRIDE) 363dcea321SAviad Krawczyk 373dcea321SAviad Krawczyk #define HINIC_CSR_API_CMD_CHAIN_HEAD_LO_ADDR(idx) \ 383dcea321SAviad Krawczyk (HINIC_CSR_API_CMD_BASE + 0x4 + (idx) * HINIC_CSR_API_CMD_STRIDE) 393dcea321SAviad Krawczyk 403dcea321SAviad Krawczyk #define HINIC_CSR_API_CMD_STATUS_HI_ADDR(idx) \ 413dcea321SAviad Krawczyk (HINIC_CSR_API_CMD_BASE + 0x8 + (idx) * HINIC_CSR_API_CMD_STRIDE) 423dcea321SAviad Krawczyk 433dcea321SAviad Krawczyk #define HINIC_CSR_API_CMD_STATUS_LO_ADDR(idx) \ 443dcea321SAviad Krawczyk (HINIC_CSR_API_CMD_BASE + 0xC + (idx) * HINIC_CSR_API_CMD_STRIDE) 453dcea321SAviad Krawczyk 463dcea321SAviad Krawczyk #define HINIC_CSR_API_CMD_CHAIN_NUM_CELLS_ADDR(idx) \ 473dcea321SAviad Krawczyk (HINIC_CSR_API_CMD_BASE + 0x10 + (idx) * HINIC_CSR_API_CMD_STRIDE) 483dcea321SAviad Krawczyk 493dcea321SAviad Krawczyk #define HINIC_CSR_API_CMD_CHAIN_CTRL_ADDR(idx) \ 503dcea321SAviad Krawczyk (HINIC_CSR_API_CMD_BASE + 0x14 + (idx) * HINIC_CSR_API_CMD_STRIDE) 513dcea321SAviad Krawczyk 520ac599c7SAviad Krawczyk #define HINIC_CSR_API_CMD_CHAIN_PI_ADDR(idx) \ 530ac599c7SAviad Krawczyk (HINIC_CSR_API_CMD_BASE + 0x1C + (idx) * HINIC_CSR_API_CMD_STRIDE) 540ac599c7SAviad Krawczyk 553dcea321SAviad Krawczyk #define HINIC_CSR_API_CMD_CHAIN_REQ_ADDR(idx) \ 563dcea321SAviad Krawczyk (HINIC_CSR_API_CMD_BASE + 0x20 + (idx) * HINIC_CSR_API_CMD_STRIDE) 573dcea321SAviad Krawczyk 580ac599c7SAviad Krawczyk #define HINIC_CSR_API_CMD_STATUS_ADDR(idx) \ 590ac599c7SAviad Krawczyk (HINIC_CSR_API_CMD_BASE + 0x30 + (idx) * HINIC_CSR_API_CMD_STRIDE) 600ac599c7SAviad Krawczyk 61f00fe738SAviad Krawczyk /* MSI-X registers */ 62f00fe738SAviad Krawczyk #define HINIC_CSR_MSIX_CTRL_BASE 0x2000 63f00fe738SAviad Krawczyk #define HINIC_CSR_MSIX_CNT_BASE 0x2004 64f00fe738SAviad Krawczyk 65f00fe738SAviad Krawczyk #define HINIC_CSR_MSIX_STRIDE 0x8 66f00fe738SAviad Krawczyk 67f00fe738SAviad Krawczyk #define HINIC_CSR_MSIX_CTRL_ADDR(idx) \ 68f00fe738SAviad Krawczyk (HINIC_CSR_MSIX_CTRL_BASE + (idx) * HINIC_CSR_MSIX_STRIDE) 69f00fe738SAviad Krawczyk 70f00fe738SAviad Krawczyk #define HINIC_CSR_MSIX_CNT_ADDR(idx) \ 71f00fe738SAviad Krawczyk (HINIC_CSR_MSIX_CNT_BASE + (idx) * HINIC_CSR_MSIX_STRIDE) 72f00fe738SAviad Krawczyk 73f00fe738SAviad Krawczyk /* EQ registers */ 74f00fe738SAviad Krawczyk #define HINIC_AEQ_MTT_OFF_BASE_ADDR 0x200 75fc9319e4SAviad Krawczyk #define HINIC_CEQ_MTT_OFF_BASE_ADDR 0x400 76f00fe738SAviad Krawczyk 77f00fe738SAviad Krawczyk #define HINIC_EQ_MTT_OFF_STRIDE 0x40 78f00fe738SAviad Krawczyk 79f00fe738SAviad Krawczyk #define HINIC_CSR_AEQ_MTT_OFF(id) \ 80f00fe738SAviad Krawczyk (HINIC_AEQ_MTT_OFF_BASE_ADDR + (id) * HINIC_EQ_MTT_OFF_STRIDE) 81f00fe738SAviad Krawczyk 82fc9319e4SAviad Krawczyk #define HINIC_CSR_CEQ_MTT_OFF(id) \ 83fc9319e4SAviad Krawczyk (HINIC_CEQ_MTT_OFF_BASE_ADDR + (id) * HINIC_EQ_MTT_OFF_STRIDE) 84fc9319e4SAviad Krawczyk 85f00fe738SAviad Krawczyk #define HINIC_CSR_EQ_PAGE_OFF_STRIDE 8 86f00fe738SAviad Krawczyk 87f00fe738SAviad Krawczyk #define HINIC_CSR_AEQ_HI_PHYS_ADDR_REG(q_id, pg_num) \ 88f00fe738SAviad Krawczyk (HINIC_CSR_AEQ_MTT_OFF(q_id) + \ 89f00fe738SAviad Krawczyk (pg_num) * HINIC_CSR_EQ_PAGE_OFF_STRIDE) 90f00fe738SAviad Krawczyk 91fc9319e4SAviad Krawczyk #define HINIC_CSR_CEQ_HI_PHYS_ADDR_REG(q_id, pg_num) \ 92fc9319e4SAviad Krawczyk (HINIC_CSR_CEQ_MTT_OFF(q_id) + \ 93fc9319e4SAviad Krawczyk (pg_num) * HINIC_CSR_EQ_PAGE_OFF_STRIDE) 94fc9319e4SAviad Krawczyk 95f00fe738SAviad Krawczyk #define HINIC_CSR_AEQ_LO_PHYS_ADDR_REG(q_id, pg_num) \ 96f00fe738SAviad Krawczyk (HINIC_CSR_AEQ_MTT_OFF(q_id) + \ 97f00fe738SAviad Krawczyk (pg_num) * HINIC_CSR_EQ_PAGE_OFF_STRIDE + 4) 98f00fe738SAviad Krawczyk 99fc9319e4SAviad Krawczyk #define HINIC_CSR_CEQ_LO_PHYS_ADDR_REG(q_id, pg_num) \ 100fc9319e4SAviad Krawczyk (HINIC_CSR_CEQ_MTT_OFF(q_id) + \ 101fc9319e4SAviad Krawczyk (pg_num) * HINIC_CSR_EQ_PAGE_OFF_STRIDE + 4) 102fc9319e4SAviad Krawczyk 103f00fe738SAviad Krawczyk #define HINIC_AEQ_CTRL_0_ADDR_BASE 0xE00 104f00fe738SAviad Krawczyk #define HINIC_AEQ_CTRL_1_ADDR_BASE 0xE04 105f00fe738SAviad Krawczyk #define HINIC_AEQ_CONS_IDX_ADDR_BASE 0xE08 106f00fe738SAviad Krawczyk #define HINIC_AEQ_PROD_IDX_ADDR_BASE 0xE0C 107f00fe738SAviad Krawczyk 108fc9319e4SAviad Krawczyk #define HINIC_CEQ_CTRL_0_ADDR_BASE 0x1000 109fc9319e4SAviad Krawczyk #define HINIC_CEQ_CTRL_1_ADDR_BASE 0x1004 110fc9319e4SAviad Krawczyk #define HINIC_CEQ_CONS_IDX_ADDR_BASE 0x1008 111fc9319e4SAviad Krawczyk #define HINIC_CEQ_PROD_IDX_ADDR_BASE 0x100C 112fc9319e4SAviad Krawczyk 113f00fe738SAviad Krawczyk #define HINIC_EQ_OFF_STRIDE 0x80 114f00fe738SAviad Krawczyk 115f00fe738SAviad Krawczyk #define HINIC_CSR_AEQ_CTRL_0_ADDR(idx) \ 116f00fe738SAviad Krawczyk (HINIC_AEQ_CTRL_0_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE) 117f00fe738SAviad Krawczyk 118f00fe738SAviad Krawczyk #define HINIC_CSR_AEQ_CTRL_1_ADDR(idx) \ 119f00fe738SAviad Krawczyk (HINIC_AEQ_CTRL_1_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE) 120f00fe738SAviad Krawczyk 121f00fe738SAviad Krawczyk #define HINIC_CSR_AEQ_CONS_IDX_ADDR(idx) \ 122f00fe738SAviad Krawczyk (HINIC_AEQ_CONS_IDX_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE) 123f00fe738SAviad Krawczyk 124f00fe738SAviad Krawczyk #define HINIC_CSR_AEQ_PROD_IDX_ADDR(idx) \ 125f00fe738SAviad Krawczyk (HINIC_AEQ_PROD_IDX_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE) 126f00fe738SAviad Krawczyk 127fc9319e4SAviad Krawczyk #define HINIC_CSR_CEQ_CTRL_0_ADDR(idx) \ 128fc9319e4SAviad Krawczyk (HINIC_CEQ_CTRL_0_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE) 129fc9319e4SAviad Krawczyk 130fc9319e4SAviad Krawczyk #define HINIC_CSR_CEQ_CTRL_1_ADDR(idx) \ 131fc9319e4SAviad Krawczyk (HINIC_CEQ_CTRL_1_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE) 132fc9319e4SAviad Krawczyk 133fc9319e4SAviad Krawczyk #define HINIC_CSR_CEQ_CONS_IDX_ADDR(idx) \ 134fc9319e4SAviad Krawczyk (HINIC_CEQ_CONS_IDX_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE) 135fc9319e4SAviad Krawczyk 136fc9319e4SAviad Krawczyk #define HINIC_CSR_CEQ_PROD_IDX_ADDR(idx) \ 137fc9319e4SAviad Krawczyk (HINIC_CEQ_PROD_IDX_ADDR_BASE + (idx) * HINIC_EQ_OFF_STRIDE) 138fc9319e4SAviad Krawczyk 13951ba902aSAviad Krawczyk #endif 140