event/octeontx: add vdev interface functions
[dpdk.git] / drivers / event / octeontx / ssovf_evdev.h
1 /*
2  *   BSD LICENSE
3  *
4  *   Copyright (C) Cavium networks Ltd. 2017.
5  *
6  *   Redistribution and use in source and binary forms, with or without
7  *   modification, are permitted provided that the following conditions
8  *   are met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above copyright
13  *       notice, this list of conditions and the following disclaimer in
14  *       the documentation and/or other materials provided with the
15  *       distribution.
16  *     * Neither the name of Cavium networks nor the names of its
17  *       contributors may be used to endorse or promote products derived
18  *       from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #ifndef __SSOVF_EVDEV_H__
34 #define __SSOVF_EVDEV_H__
35
36 #include <rte_config.h>
37 #include <rte_io.h>
38
39 #include "rte_pmd_octeontx_ssovf.h"
40
41 #define EVENTDEV_NAME_OCTEONTX_PMD event_octeontx
42
43 #ifdef RTE_LIBRTE_PMD_OCTEONTX_SSOVF_DEBUG
44 #define ssovf_log_info(fmt, args...) \
45         RTE_LOG(INFO, EVENTDEV, "[%s] %s() " fmt "\n", \
46                 RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args)
47 #define ssovf_log_dbg(fmt, args...) \
48         RTE_LOG(DEBUG, EVENTDEV, "[%s] %s() " fmt "\n", \
49                 RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args)
50 #else
51 #define ssovf_log_info(fmt, args...)
52 #define ssovf_log_dbg(fmt, args...)
53 #endif
54
55 #define ssovf_func_trace ssovf_log_dbg
56 #define ssovf_log_err(fmt, args...) \
57         RTE_LOG(ERR, EVENTDEV, "[%s] %s() " fmt "\n", \
58                 RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args)
59
60 #define PCI_VENDOR_ID_CAVIUM              0x177D
61 #define PCI_DEVICE_ID_OCTEONTX_SSOGRP_VF  0xA04B
62 #define PCI_DEVICE_ID_OCTEONTX_SSOWS_VF   0xA04D
63
64 #define SSO_MAX_VHGRP                     (64)
65 #define SSO_MAX_VHWS                      (32)
66
67 /* SSO VF register offsets */
68 #define SSO_VHGRP_QCTL                    (0x010ULL)
69 #define SSO_VHGRP_INT                     (0x100ULL)
70 #define SSO_VHGRP_INT_W1S                 (0x108ULL)
71 #define SSO_VHGRP_INT_ENA_W1S             (0x110ULL)
72 #define SSO_VHGRP_INT_ENA_W1C             (0x118ULL)
73 #define SSO_VHGRP_INT_THR                 (0x140ULL)
74 #define SSO_VHGRP_INT_CNT                 (0x180ULL)
75 #define SSO_VHGRP_XAQ_CNT                 (0x1B0ULL)
76 #define SSO_VHGRP_AQ_CNT                  (0x1C0ULL)
77 #define SSO_VHGRP_AQ_THR                  (0x1E0ULL)
78 #define SSO_VHGRP_PF_MBOX(x)              (0x200ULL | ((x) << 3))
79
80 /* BAR2 */
81 #define SSO_VHGRP_OP_ADD_WORK0            (0x00ULL)
82 #define SSO_VHGRP_OP_ADD_WORK1            (0x08ULL)
83
84 /* SSOW VF register offsets (BAR0) */
85 #define SSOW_VHWS_GRPMSK_CHGX(x)          (0x080ULL | ((x) << 3))
86 #define SSOW_VHWS_TAG                     (0x300ULL)
87 #define SSOW_VHWS_WQP                     (0x308ULL)
88 #define SSOW_VHWS_LINKS                   (0x310ULL)
89 #define SSOW_VHWS_PENDTAG                 (0x340ULL)
90 #define SSOW_VHWS_PENDWQP                 (0x348ULL)
91 #define SSOW_VHWS_SWTP                    (0x400ULL)
92 #define SSOW_VHWS_OP_ALLOC_WE             (0x410ULL)
93 #define SSOW_VHWS_OP_UPD_WQP_GRP0         (0x440ULL)
94 #define SSOW_VHWS_OP_UPD_WQP_GRP1         (0x448ULL)
95 #define SSOW_VHWS_OP_SWTAG_UNTAG          (0x490ULL)
96 #define SSOW_VHWS_OP_SWTAG_CLR            (0x820ULL)
97 #define SSOW_VHWS_OP_DESCHED              (0x860ULL)
98 #define SSOW_VHWS_OP_DESCHED_NOSCH        (0x870ULL)
99 #define SSOW_VHWS_OP_SWTAG_DESCHED        (0x8C0ULL)
100 #define SSOW_VHWS_OP_SWTAG_NOSCHED        (0x8D0ULL)
101 #define SSOW_VHWS_OP_SWTP_SET             (0xC20ULL)
102 #define SSOW_VHWS_OP_SWTAG_NORM           (0xC80ULL)
103 #define SSOW_VHWS_OP_SWTAG_FULL0          (0xCA0UL)
104 #define SSOW_VHWS_OP_SWTAG_FULL1          (0xCA8ULL)
105 #define SSOW_VHWS_OP_CLR_NSCHED           (0x10000ULL)
106 #define SSOW_VHWS_OP_GET_WORK0            (0x80000ULL)
107 #define SSOW_VHWS_OP_GET_WORK1            (0x80008ULL)
108
109 #define SSOW_BAR4_LEN                     (64 * 1024)
110
111 #endif /* __SSOVF_EVDEV_H__ */