1*b61a5730SWarner Losh /* SPDX-License-Identifier: BSD-2-Clause AND BSD-3-Clause */ 2f4f56ff4SMark Johnston /* $NetBSD: qat_c2xxxreg.h,v 1.1 2019/11/20 09:37:46 hikaru Exp $ */ 3f4f56ff4SMark Johnston 4f4f56ff4SMark Johnston /* 5f4f56ff4SMark Johnston * Copyright (c) 2019 Internet Initiative Japan, Inc. 6f4f56ff4SMark Johnston * All rights reserved. 7f4f56ff4SMark Johnston * 8f4f56ff4SMark Johnston * Redistribution and use in source and binary forms, with or without 9f4f56ff4SMark Johnston * modification, are permitted provided that the following conditions 10f4f56ff4SMark Johnston * are met: 11f4f56ff4SMark Johnston * 1. Redistributions of source code must retain the above copyright 12f4f56ff4SMark Johnston * notice, this list of conditions and the following disclaimer. 13f4f56ff4SMark Johnston * 2. Redistributions in binary form must reproduce the above copyright 14f4f56ff4SMark Johnston * notice, this list of conditions and the following disclaimer in the 15f4f56ff4SMark Johnston * documentation and/or other materials provided with the distribution. 16f4f56ff4SMark Johnston * 17f4f56ff4SMark Johnston * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18f4f56ff4SMark Johnston * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19f4f56ff4SMark Johnston * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20f4f56ff4SMark Johnston * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21f4f56ff4SMark Johnston * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22f4f56ff4SMark Johnston * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23f4f56ff4SMark Johnston * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24f4f56ff4SMark Johnston * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25f4f56ff4SMark Johnston * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26f4f56ff4SMark Johnston * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27f4f56ff4SMark Johnston * POSSIBILITY OF SUCH DAMAGE. 28f4f56ff4SMark Johnston */ 29f4f56ff4SMark Johnston 30f4f56ff4SMark Johnston /* 31f4f56ff4SMark Johnston * Copyright(c) 2007-2013 Intel Corporation. All rights reserved. 32f4f56ff4SMark Johnston * 33f4f56ff4SMark Johnston * Redistribution and use in source and binary forms, with or without 34f4f56ff4SMark Johnston * modification, are permitted provided that the following conditions 35f4f56ff4SMark Johnston * are met: 36f4f56ff4SMark Johnston * 37f4f56ff4SMark Johnston * * Redistributions of source code must retain the above copyright 38f4f56ff4SMark Johnston * notice, this list of conditions and the following disclaimer. 39f4f56ff4SMark Johnston * * Redistributions in binary form must reproduce the above copyright 40f4f56ff4SMark Johnston * notice, this list of conditions and the following disclaimer in 41f4f56ff4SMark Johnston * the documentation and/or other materials provided with the 42f4f56ff4SMark Johnston * distribution. 43f4f56ff4SMark Johnston * * Neither the name of Intel Corporation nor the names of its 44f4f56ff4SMark Johnston * contributors may be used to endorse or promote products derived 45f4f56ff4SMark Johnston * from this software without specific prior written permission. 46f4f56ff4SMark Johnston * 47f4f56ff4SMark Johnston * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 48f4f56ff4SMark Johnston * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 49f4f56ff4SMark Johnston * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 50f4f56ff4SMark Johnston * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 51f4f56ff4SMark Johnston * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 52f4f56ff4SMark Johnston * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 53f4f56ff4SMark Johnston * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 54f4f56ff4SMark Johnston * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 55f4f56ff4SMark Johnston * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 56f4f56ff4SMark Johnston * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 57f4f56ff4SMark Johnston * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58f4f56ff4SMark Johnston */ 59f4f56ff4SMark Johnston 60f4f56ff4SMark Johnston 61f4f56ff4SMark Johnston #ifndef _DEV_PCI_QAT_C2XXXREG_H_ 62f4f56ff4SMark Johnston #define _DEV_PCI_QAT_C2XXXREG_H_ 63f4f56ff4SMark Johnston 64f4f56ff4SMark Johnston /* PCI revision IDs */ 65f4f56ff4SMark Johnston #define QAT_REVID_C2XXX_A0 0x00 66f4f56ff4SMark Johnston #define QAT_REVID_C2XXX_B0 0x02 67f4f56ff4SMark Johnston #define QAT_REVID_C2XXX_C0 0x03 68f4f56ff4SMark Johnston 69f4f56ff4SMark Johnston /* Max number of accelerators and engines */ 70f4f56ff4SMark Johnston #define MAX_ACCEL_C2XXX 1 71f4f56ff4SMark Johnston #define MAX_AE_C2XXX 2 72f4f56ff4SMark Johnston 73f4f56ff4SMark Johnston /* PCIe BAR index */ 74f4f56ff4SMark Johnston #define BAR_SRAM_ID_C2XXX NO_PCI_REG 75f4f56ff4SMark Johnston #define BAR_PMISC_ID_C2XXX 0 76f4f56ff4SMark Johnston #define BAR_ETR_ID_C2XXX 1 77f4f56ff4SMark Johnston 78f4f56ff4SMark Johnston #define ACCEL_MASK_C2XXX 0x1 79f4f56ff4SMark Johnston #define AE_MASK_C2XXX 0x3 80f4f56ff4SMark Johnston 81f4f56ff4SMark Johnston #define MSIX_AE_VEC_GAP_C2XXX 8 82f4f56ff4SMark Johnston 83f4f56ff4SMark Johnston /* PCIe configuration space registers */ 84f4f56ff4SMark Johnston /* PESRAM: 512K eSRAM */ 85f4f56ff4SMark Johnston #define BAR_PESRAM_C2XXX NO_PCI_REG 86f4f56ff4SMark Johnston #define BAR_PESRAM_SIZE_C2XXX 0 87f4f56ff4SMark Johnston 88f4f56ff4SMark Johnston /* 89f4f56ff4SMark Johnston * PMISC: 16K CAP, 16K Scratch, 32K SSU(QATs), 90f4f56ff4SMark Johnston * 32K AE CSRs and transfer registers, 8K CHAP/PMU, 91f4f56ff4SMark Johnston * 4K EP CSRs, 4K MSI-X Tables 92f4f56ff4SMark Johnston */ 93f4f56ff4SMark Johnston #define BAR_PMISC_C2XXX 0x18 94f4f56ff4SMark Johnston #define BAR_PMISC_SIZE_C2XXX 0x20000 /* 128K */ 95f4f56ff4SMark Johnston 96f4f56ff4SMark Johnston /* PETRINGCSR: 8K 16 bundles of ET Ring CSRs */ 97f4f56ff4SMark Johnston #define BAR_PETRINGCSR_C2XXX 0x20 98f4f56ff4SMark Johnston #define BAR_PETRINGCSR_SIZE_C2XXX 0x4000 /* 16K */ 99f4f56ff4SMark Johnston 100f4f56ff4SMark Johnston /* Fuse Control */ 101f4f56ff4SMark Johnston #define FUSECTL_C2XXX_PKE_DISABLE (1 << 6) 102f4f56ff4SMark Johnston #define FUSECTL_C2XXX_ATH_DISABLE (1 << 5) 103f4f56ff4SMark Johnston #define FUSECTL_C2XXX_CPH_DISABLE (1 << 4) 104f4f56ff4SMark Johnston #define FUSECTL_C2XXX_LOW_SKU (1 << 3) 105f4f56ff4SMark Johnston #define FUSECTL_C2XXX_MID_SKU (1 << 2) 106f4f56ff4SMark Johnston #define FUSECTL_C2XXX_AE1_DISABLE (1 << 1) 107f4f56ff4SMark Johnston 108f4f56ff4SMark Johnston /* SINT: Signal Target Raw Interrupt Register */ 109f4f56ff4SMark Johnston #define EP_SINTPF_C2XXX 0x1A024 110f4f56ff4SMark Johnston 111f4f56ff4SMark Johnston /* SMIA: Signal Target IA Mask Register */ 112f4f56ff4SMark Johnston #define EP_SMIA_C2XXX 0x1A028 113f4f56ff4SMark Johnston #define EP_SMIA_BUNDLES_IRQ_MASK_C2XXX 0xFF 114f4f56ff4SMark Johnston #define EP_SMIA_AE_IRQ_MASK_C2XXX 0x10000 115f4f56ff4SMark Johnston #define EP_SMIA_MASK_C2XXX \ 116f4f56ff4SMark Johnston (EP_SMIA_BUNDLES_IRQ_MASK_C2XXX | EP_SMIA_AE_IRQ_MASK_C2XXX) 117f4f56ff4SMark Johnston 118f4f56ff4SMark Johnston #define EP_RIMISCCTL_C2XXX 0x1A0C4 119f4f56ff4SMark Johnston #define EP_RIMISCCTL_MASK_C2XXX 0x40000000 120f4f56ff4SMark Johnston 121f4f56ff4SMark Johnston #define PFCGCIOSFPRIR_REG_C2XXX 0x2C0 122f4f56ff4SMark Johnston #define PFCGCIOSFPRIR_MASK_C2XXX 0XFFFF7FFF 123f4f56ff4SMark Johnston 124f4f56ff4SMark Johnston /* BAR sub-regions */ 125f4f56ff4SMark Johnston #define PESRAM_BAR_C2XXX NO_PCI_REG 126f4f56ff4SMark Johnston #define PESRAM_OFFSET_C2XXX 0x0 127f4f56ff4SMark Johnston #define PESRAM_SIZE_C2XXX 0x0 128f4f56ff4SMark Johnston #define CAP_GLOBAL_BAR_C2XXX BAR_PMISC_C2XXX 129f4f56ff4SMark Johnston #define CAP_GLOBAL_OFFSET_C2XXX 0x00000 130f4f56ff4SMark Johnston #define CAP_GLOBAL_SIZE_C2XXX 0x04000 131f4f56ff4SMark Johnston #define CAP_HASH_OFFSET 0x900 132f4f56ff4SMark Johnston #define SCRATCH_BAR_C2XXX NO_PCI_REG 133f4f56ff4SMark Johnston #define SCRATCH_OFFSET_C2XXX NO_REG_OFFSET 134f4f56ff4SMark Johnston #define SCRATCH_SIZE_C2XXX 0x0 135f4f56ff4SMark Johnston #define SSU_BAR_C2XXX BAR_PMISC_C2XXX 136f4f56ff4SMark Johnston #define SSU_OFFSET_C2XXX 0x08000 137f4f56ff4SMark Johnston #define SSU_SIZE_C2XXX 0x08000 138f4f56ff4SMark Johnston #define AE_BAR_C2XXX BAR_PMISC_C2XXX 139f4f56ff4SMark Johnston #define AE_OFFSET_C2XXX 0x10000 140f4f56ff4SMark Johnston #define AE_LOCAL_OFFSET_C2XXX 0x10800 141f4f56ff4SMark Johnston #define PMU_BAR_C2XXX NO_PCI_REG 142f4f56ff4SMark Johnston #define PMU_OFFSET_C2XXX NO_REG_OFFSET 143f4f56ff4SMark Johnston #define PMU_SIZE_C2XXX 0x0 144f4f56ff4SMark Johnston #define EP_BAR_C2XXX BAR_PMISC_C2XXX 145f4f56ff4SMark Johnston #define EP_OFFSET_C2XXX 0x1A000 146f4f56ff4SMark Johnston #define EP_SIZE_C2XXX 0x01000 147f4f56ff4SMark Johnston #define MSIX_TAB_BAR_C2XXX NO_PCI_REG /* mapped by pci(9) */ 148f4f56ff4SMark Johnston #define MSIX_TAB_OFFSET_C2XXX 0x1B000 149f4f56ff4SMark Johnston #define MSIX_TAB_SIZE_C2XXX 0x01000 150f4f56ff4SMark Johnston #define PETRINGCSR_BAR_C2XXX BAR_PETRINGCSR_C2XXX 151f4f56ff4SMark Johnston #define PETRINGCSR_OFFSET_C2XXX 0x0 152f4f56ff4SMark Johnston #define PETRINGCSR_SIZE_C2XXX 0x0 /* use size of BAR */ 153f4f56ff4SMark Johnston 154f4f56ff4SMark Johnston /* ETR */ 155f4f56ff4SMark Johnston #define ETR_MAX_BANKS_C2XXX 8 156f4f56ff4SMark Johnston #define ETR_MAX_ET_RINGS_C2XXX \ 157f4f56ff4SMark Johnston (ETR_MAX_BANKS_C2XXX * ETR_MAX_RINGS_PER_BANK_C2XXX) 158f4f56ff4SMark Johnston #define ETR_MAX_AP_BANKS_C2XXX 4 159f4f56ff4SMark Johnston 160f4f56ff4SMark Johnston #define ETR_TX_RX_GAP_C2XXX 1 161f4f56ff4SMark Johnston #define ETR_TX_RINGS_MASK_C2XXX 0x51 162f4f56ff4SMark Johnston 163f4f56ff4SMark Johnston #define ETR_BUNDLE_SIZE_C2XXX 0x0200 164f4f56ff4SMark Johnston 165f4f56ff4SMark Johnston /* Initial bank Interrupt Source mask */ 166f4f56ff4SMark Johnston #define ETR_INT_SRCSEL_MASK_0_C2XXX 0x4444444CUL 167f4f56ff4SMark Johnston #define ETR_INT_SRCSEL_MASK_X_C2XXX 0x44444444UL 168f4f56ff4SMark Johnston 169f4f56ff4SMark Johnston /* AE firmware */ 170f4f56ff4SMark Johnston #define AE_FW_PROD_TYPE_C2XXX 0x00800000 171f4f56ff4SMark Johnston #define AE_FW_MOF_NAME_C2XXX "qat_c2xxxfw" 172f4f56ff4SMark Johnston #define AE_FW_MMP_NAME_C2XXX "mmp_firmware_c2xxx" 173f4f56ff4SMark Johnston #define AE_FW_UOF_NAME_C2XXX_A0 "icp_qat_nae.uof" 174f4f56ff4SMark Johnston #define AE_FW_UOF_NAME_C2XXX_B0 "icp_qat_nae_b0.uof" 175f4f56ff4SMark Johnston 176f4f56ff4SMark Johnston #endif 177