1 /* SPDX-License-Identifier: BSD-2-Clause-NetBSD AND BSD-3-Clause */
2 /* $NetBSD: qat_c3xxxreg.h,v 1.1 2019/11/20 09:37:46 hikaru Exp $ */
5 * Copyright (c) 2019 Internet Initiative Japan, Inc.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
31 * Copyright(c) 2014 Intel Corporation.
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
36 * * Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * * Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in
40 * the documentation and/or other materials provided with the
42 * * Neither the name of Intel Corporation nor the names of its
43 * contributors may be used to endorse or promote products derived
44 * from this software without specific prior written permission.
46 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
47 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
48 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
49 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
50 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
51 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
52 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
53 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
54 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
55 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
56 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 #ifndef _DEV_PCI_QAT_C3XXXREG_H_
62 #define _DEV_PCI_QAT_C3XXXREG_H_
64 /* Max number of accelerators and engines */
65 #define MAX_ACCEL_C3XXX 3
66 #define MAX_AE_C3XXX 6
69 #define BAR_SRAM_ID_C3XXX NO_PCI_REG
70 #define BAR_PMISC_ID_C3XXX 0
71 #define BAR_ETR_ID_C3XXX 1
73 /* BAR PMISC sub-regions */
74 #define AE_OFFSET_C3XXX 0x20000
75 #define AE_LOCAL_OFFSET_C3XXX 0x20800
76 #define CAP_GLOBAL_OFFSET_C3XXX 0x30000
78 #define SOFTSTRAP_REG_C3XXX 0x2EC
79 #define SOFTSTRAP_SS_POWERGATE_CY_C3XXX __BIT(23)
80 #define SOFTSTRAP_SS_POWERGATE_PKE_C3XXX __BIT(24)
82 #define ACCEL_REG_OFFSET_C3XXX 16
83 #define ACCEL_MASK_C3XXX 0x7
84 #define AE_MASK_C3XXX 0x3F
86 #define SMIAPF0_C3XXX 0x3A028
87 #define SMIAPF1_C3XXX 0x3A030
88 #define SMIA0_MASK_C3XXX 0xFFFF
89 #define SMIA1_MASK_C3XXX 0x1
91 /* Error detection and correction */
92 #define AE_CTX_ENABLES_C3XXX(i) ((i) * 0x1000 + 0x20818)
93 #define AE_MISC_CONTROL_C3XXX(i) ((i) * 0x1000 + 0x20960)
94 #define ENABLE_AE_ECC_ERR_C3XXX __BIT(28)
95 #define ENABLE_AE_ECC_PARITY_CORR_C3XXX (__BIT(24) | __BIT(12))
96 #define ERRSSMSH_EN_C3XXX __BIT(3)
97 /* BIT(2) enables the logging of push/pull data errors. */
98 #define PPERR_EN_C3XXX (__BIT(2))
100 /* Mask for VF2PF interrupts */
101 #define VF2PF1_16_C3XXX (0xFFFF << 9)
102 #define ERRSOU3_VF2PF_C3XXX(errsou3) (((errsou3) & 0x01FFFE00) >> 9)
103 #define ERRMSK3_VF2PF_C3XXX(vf_mask) (((vf_mask) & 0xFFFF) << 9)
105 /* Masks for correctable error interrupts. */
106 #define ERRMSK0_CERR_C3XXX (__BIT(24) | __BIT(16) | __BIT(8) | __BIT(0))
107 #define ERRMSK1_CERR_C3XXX (__BIT(8) | __BIT(0))
108 #define ERRMSK5_CERR_C3XXX (0)
110 /* Masks for uncorrectable error interrupts. */
111 #define ERRMSK0_UERR_C3XXX (__BIT(25) | __BIT(17) | __BIT(9) | __BIT(1))
112 #define ERRMSK1_UERR_C3XXX (__BIT(9) | __BIT(1))
113 #define ERRMSK3_UERR_C3XXX (__BIT(6) | __BIT(5) | __BIT(4) | __BIT(3) | \
115 #define ERRMSK5_UERR_C3XXX (__BIT(16))
118 #define RICPPINTCTL_C3XXX (0x3A000 + 0x110)
120 * BIT(2) enables error detection and reporting on the RI Parity Error.
121 * BIT(1) enables error detection and reporting on the RI CPP Pull interface.
122 * BIT(0) enables error detection and reporting on the RI CPP Push interface.
124 #define RICPP_EN_C3XXX (__BIT(2) | __BIT(1) | __BIT(0))
127 #define TICPPINTCTL_C3XXX (0x3A400 + 0x138)
129 * BIT(3) enables error detection and reporting on the ETR Parity Error.
130 * BIT(2) enables error detection and reporting on the TI Parity Error.
131 * BIT(1) enables error detection and reporting on the TI CPP Pull interface.
132 * BIT(0) enables error detection and reporting on the TI CPP Push interface.
134 #define TICPP_EN_C3XXX \
135 (__BIT(3) | __BIT(2) | __BIT(1) | __BIT(0))
137 /* CFC Uncorrectable Errors */
138 #define CPP_CFC_ERR_CTRL_C3XXX (0x30000 + 0xC00)
140 * BIT(1) enables interrupt.
141 * BIT(0) enables detecting and logging of push/pull data errors.
143 #define CPP_CFC_UE_C3XXX (__BIT(1) | __BIT(0))
145 #define SLICEPWRDOWN_C3XXX(i) ((i) * 0x4000 + 0x2C)
146 /* Enabling PKE4-PKE0. */
147 #define MMP_PWR_UP_MSK_C3XXX \
148 (__BIT(20) | __BIT(19) | __BIT(18) | __BIT(17) | __BIT(16))
150 /* CPM Uncorrectable Errors */
151 #define INTMASKSSM_C3XXX(i) ((i) * 0x4000 + 0x0)
152 /* Disabling interrupts for correctable errors. */
153 #define INTMASKSSM_UERR_C3XXX \
154 (__BIT(11) | __BIT(9) | __BIT(7) | __BIT(5) | __BIT(3) | __BIT(1))
157 /* BIT(3) enables correction. */
158 #define CERRSSMMMP_EN_C3XXX (__BIT(3))
160 /* BIT(3) enables logging. */
161 #define UERRSSMMMP_EN_C3XXX (__BIT(3))
164 #define ETR_MAX_BANKS_C3XXX 16
165 #define ETR_TX_RX_GAP_C3XXX 8
166 #define ETR_TX_RINGS_MASK_C3XXX 0xFF
167 #define ETR_BUNDLE_SIZE_C3XXX 0x1000
170 #define AE_FW_PROD_TYPE_C3XXX 0x02000000
171 #define AE_FW_MOF_NAME_C3XXX "qat_c3xxxfw"
172 #define AE_FW_MMP_NAME_C3XXX "qat_c3xxx_mmp"
173 #define AE_FW_UOF_NAME_C3XXX "icp_qat_ae.suof"
175 /* Clock frequency */
176 #define CLOCK_PER_SEC_C3XXX (685 * 1000000 / 16)