1a195fab0SMarcin Wojtas /*- 29eb1615fSMarcin Wojtas * SPDX-License-Identifier: BSD-3-Clause 3a195fab0SMarcin Wojtas * 4adfed2d8SArthur Kiyanovski * Copyright (c) 2015-2023 Amazon.com, Inc. or its affiliates. 5a195fab0SMarcin Wojtas * All rights reserved. 6a195fab0SMarcin Wojtas * 7a195fab0SMarcin Wojtas * Redistribution and use in source and binary forms, with or without 8a195fab0SMarcin Wojtas * modification, are permitted provided that the following conditions 9a195fab0SMarcin Wojtas * are met: 10a195fab0SMarcin Wojtas * 11a195fab0SMarcin Wojtas * * Redistributions of source code must retain the above copyright 12a195fab0SMarcin Wojtas * notice, this list of conditions and the following disclaimer. 13a195fab0SMarcin Wojtas * * Redistributions in binary form must reproduce the above copyright 14a195fab0SMarcin Wojtas * notice, this list of conditions and the following disclaimer in 15a195fab0SMarcin Wojtas * the documentation and/or other materials provided with the 16a195fab0SMarcin Wojtas * distribution. 17a195fab0SMarcin Wojtas * * Neither the name of copyright holder nor the names of its 18a195fab0SMarcin Wojtas * contributors may be used to endorse or promote products derived 19a195fab0SMarcin Wojtas * from this software without specific prior written permission. 20a195fab0SMarcin Wojtas * 21a195fab0SMarcin Wojtas * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22a195fab0SMarcin Wojtas * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23a195fab0SMarcin Wojtas * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24a195fab0SMarcin Wojtas * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25a195fab0SMarcin Wojtas * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26a195fab0SMarcin Wojtas * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27a195fab0SMarcin Wojtas * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28a195fab0SMarcin Wojtas * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29a195fab0SMarcin Wojtas * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30a195fab0SMarcin Wojtas * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31a195fab0SMarcin Wojtas * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32a195fab0SMarcin Wojtas */ 33adfed2d8SArthur Kiyanovski 34a195fab0SMarcin Wojtas #ifndef _ENA_REGS_H_ 35a195fab0SMarcin Wojtas #define _ENA_REGS_H_ 36a195fab0SMarcin Wojtas 37a195fab0SMarcin Wojtas enum ena_regs_reset_reason_types { 38a195fab0SMarcin Wojtas ENA_REGS_RESET_NORMAL = 0, 39a195fab0SMarcin Wojtas ENA_REGS_RESET_KEEP_ALIVE_TO = 1, 40a195fab0SMarcin Wojtas ENA_REGS_RESET_ADMIN_TO = 2, 41a195fab0SMarcin Wojtas ENA_REGS_RESET_MISS_TX_CMPL = 3, 42a195fab0SMarcin Wojtas ENA_REGS_RESET_INV_RX_REQ_ID = 4, 43a195fab0SMarcin Wojtas ENA_REGS_RESET_INV_TX_REQ_ID = 5, 44a195fab0SMarcin Wojtas ENA_REGS_RESET_TOO_MANY_RX_DESCS = 6, 45a195fab0SMarcin Wojtas ENA_REGS_RESET_INIT_ERR = 7, 46a195fab0SMarcin Wojtas ENA_REGS_RESET_DRIVER_INVALID_STATE = 8, 47a195fab0SMarcin Wojtas ENA_REGS_RESET_OS_TRIGGER = 9, 48a195fab0SMarcin Wojtas ENA_REGS_RESET_OS_NETDEV_WD = 10, 49a195fab0SMarcin Wojtas ENA_REGS_RESET_SHUTDOWN = 11, 50a195fab0SMarcin Wojtas ENA_REGS_RESET_USER_TRIGGER = 12, 51a195fab0SMarcin Wojtas ENA_REGS_RESET_GENERIC = 13, 5267ec48bbSMarcin Wojtas ENA_REGS_RESET_MISS_INTERRUPT = 14, 53adfed2d8SArthur Kiyanovski ENA_REGS_RESET_SUSPECTED_POLL_STARVATION = 15, 54adfed2d8SArthur Kiyanovski ENA_REGS_RESET_RX_DESCRIPTOR_MALFORMED = 16, 55*f5f8d7c9SOsama Abboud ENA_REGS_RESET_TX_DESCRIPTOR_MALFORMED = 17, 56*f5f8d7c9SOsama Abboud ENA_REGS_RESET_MISSING_ADMIN_INTERRUPT = 18, 57*f5f8d7c9SOsama Abboud ENA_REGS_RESET_DEVICE_REQUEST = 19, 588483b844SMarcin Wojtas ENA_REGS_RESET_LAST, 59a195fab0SMarcin Wojtas }; 60a195fab0SMarcin Wojtas 61a195fab0SMarcin Wojtas /* ena_registers offsets */ 6267ec48bbSMarcin Wojtas 6367ec48bbSMarcin Wojtas /* 0 base */ 64a195fab0SMarcin Wojtas #define ENA_REGS_VERSION_OFF 0x0 65a195fab0SMarcin Wojtas #define ENA_REGS_CONTROLLER_VERSION_OFF 0x4 66a195fab0SMarcin Wojtas #define ENA_REGS_CAPS_OFF 0x8 67a195fab0SMarcin Wojtas #define ENA_REGS_CAPS_EXT_OFF 0xc 68a195fab0SMarcin Wojtas #define ENA_REGS_AQ_BASE_LO_OFF 0x10 69a195fab0SMarcin Wojtas #define ENA_REGS_AQ_BASE_HI_OFF 0x14 70a195fab0SMarcin Wojtas #define ENA_REGS_AQ_CAPS_OFF 0x18 71a195fab0SMarcin Wojtas #define ENA_REGS_ACQ_BASE_LO_OFF 0x20 72a195fab0SMarcin Wojtas #define ENA_REGS_ACQ_BASE_HI_OFF 0x24 73a195fab0SMarcin Wojtas #define ENA_REGS_ACQ_CAPS_OFF 0x28 74a195fab0SMarcin Wojtas #define ENA_REGS_AQ_DB_OFF 0x2c 75a195fab0SMarcin Wojtas #define ENA_REGS_ACQ_TAIL_OFF 0x30 76a195fab0SMarcin Wojtas #define ENA_REGS_AENQ_CAPS_OFF 0x34 77a195fab0SMarcin Wojtas #define ENA_REGS_AENQ_BASE_LO_OFF 0x38 78a195fab0SMarcin Wojtas #define ENA_REGS_AENQ_BASE_HI_OFF 0x3c 79a195fab0SMarcin Wojtas #define ENA_REGS_AENQ_HEAD_DB_OFF 0x40 80a195fab0SMarcin Wojtas #define ENA_REGS_AENQ_TAIL_OFF 0x44 81a195fab0SMarcin Wojtas #define ENA_REGS_INTR_MASK_OFF 0x4c 82a195fab0SMarcin Wojtas #define ENA_REGS_DEV_CTL_OFF 0x54 83a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_OFF 0x58 84a195fab0SMarcin Wojtas #define ENA_REGS_MMIO_REG_READ_OFF 0x5c 85a195fab0SMarcin Wojtas #define ENA_REGS_MMIO_RESP_LO_OFF 0x60 86a195fab0SMarcin Wojtas #define ENA_REGS_MMIO_RESP_HI_OFF 0x64 87a195fab0SMarcin Wojtas #define ENA_REGS_RSS_IND_ENTRY_UPDATE_OFF 0x68 88a195fab0SMarcin Wojtas 89adfed2d8SArthur Kiyanovski /* phc_registers offsets */ 90adfed2d8SArthur Kiyanovski 91adfed2d8SArthur Kiyanovski /* 100 base */ 92adfed2d8SArthur Kiyanovski #define ENA_REGS_PHC_DB_OFF 0x100 93adfed2d8SArthur Kiyanovski 94a195fab0SMarcin Wojtas /* version register */ 95a195fab0SMarcin Wojtas #define ENA_REGS_VERSION_MINOR_VERSION_MASK 0xff 96a195fab0SMarcin Wojtas #define ENA_REGS_VERSION_MAJOR_VERSION_SHIFT 8 97a195fab0SMarcin Wojtas #define ENA_REGS_VERSION_MAJOR_VERSION_MASK 0xff00 98a195fab0SMarcin Wojtas 99a195fab0SMarcin Wojtas /* controller_version register */ 100a195fab0SMarcin Wojtas #define ENA_REGS_CONTROLLER_VERSION_SUBMINOR_VERSION_MASK 0xff 101a195fab0SMarcin Wojtas #define ENA_REGS_CONTROLLER_VERSION_MINOR_VERSION_SHIFT 8 102a195fab0SMarcin Wojtas #define ENA_REGS_CONTROLLER_VERSION_MINOR_VERSION_MASK 0xff00 103a195fab0SMarcin Wojtas #define ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_SHIFT 16 104a195fab0SMarcin Wojtas #define ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_MASK 0xff0000 105a195fab0SMarcin Wojtas #define ENA_REGS_CONTROLLER_VERSION_IMPL_ID_SHIFT 24 106a195fab0SMarcin Wojtas #define ENA_REGS_CONTROLLER_VERSION_IMPL_ID_MASK 0xff000000 107a195fab0SMarcin Wojtas 108a195fab0SMarcin Wojtas /* caps register */ 109a195fab0SMarcin Wojtas #define ENA_REGS_CAPS_CONTIGUOUS_QUEUE_REQUIRED_MASK 0x1 110a195fab0SMarcin Wojtas #define ENA_REGS_CAPS_RESET_TIMEOUT_SHIFT 1 111a195fab0SMarcin Wojtas #define ENA_REGS_CAPS_RESET_TIMEOUT_MASK 0x3e 112a195fab0SMarcin Wojtas #define ENA_REGS_CAPS_DMA_ADDR_WIDTH_SHIFT 8 113a195fab0SMarcin Wojtas #define ENA_REGS_CAPS_DMA_ADDR_WIDTH_MASK 0xff00 114a195fab0SMarcin Wojtas #define ENA_REGS_CAPS_ADMIN_CMD_TO_SHIFT 16 115a195fab0SMarcin Wojtas #define ENA_REGS_CAPS_ADMIN_CMD_TO_MASK 0xf0000 116a195fab0SMarcin Wojtas 117a195fab0SMarcin Wojtas /* aq_caps register */ 118a195fab0SMarcin Wojtas #define ENA_REGS_AQ_CAPS_AQ_DEPTH_MASK 0xffff 119a195fab0SMarcin Wojtas #define ENA_REGS_AQ_CAPS_AQ_ENTRY_SIZE_SHIFT 16 120a195fab0SMarcin Wojtas #define ENA_REGS_AQ_CAPS_AQ_ENTRY_SIZE_MASK 0xffff0000 121a195fab0SMarcin Wojtas 122a195fab0SMarcin Wojtas /* acq_caps register */ 123a195fab0SMarcin Wojtas #define ENA_REGS_ACQ_CAPS_ACQ_DEPTH_MASK 0xffff 124a195fab0SMarcin Wojtas #define ENA_REGS_ACQ_CAPS_ACQ_ENTRY_SIZE_SHIFT 16 125a195fab0SMarcin Wojtas #define ENA_REGS_ACQ_CAPS_ACQ_ENTRY_SIZE_MASK 0xffff0000 126a195fab0SMarcin Wojtas 127a195fab0SMarcin Wojtas /* aenq_caps register */ 128a195fab0SMarcin Wojtas #define ENA_REGS_AENQ_CAPS_AENQ_DEPTH_MASK 0xffff 129a195fab0SMarcin Wojtas #define ENA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_SHIFT 16 130a195fab0SMarcin Wojtas #define ENA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_MASK 0xffff0000 131a195fab0SMarcin Wojtas 132a195fab0SMarcin Wojtas /* dev_ctl register */ 133a195fab0SMarcin Wojtas #define ENA_REGS_DEV_CTL_DEV_RESET_MASK 0x1 134a195fab0SMarcin Wojtas #define ENA_REGS_DEV_CTL_AQ_RESTART_SHIFT 1 135a195fab0SMarcin Wojtas #define ENA_REGS_DEV_CTL_AQ_RESTART_MASK 0x2 136a195fab0SMarcin Wojtas #define ENA_REGS_DEV_CTL_QUIESCENT_SHIFT 2 137a195fab0SMarcin Wojtas #define ENA_REGS_DEV_CTL_QUIESCENT_MASK 0x4 138a195fab0SMarcin Wojtas #define ENA_REGS_DEV_CTL_IO_RESUME_SHIFT 3 139a195fab0SMarcin Wojtas #define ENA_REGS_DEV_CTL_IO_RESUME_MASK 0x8 140*f5f8d7c9SOsama Abboud #define ENA_REGS_DEV_CTL_RESET_REASON_EXT_SHIFT 24 141*f5f8d7c9SOsama Abboud #define ENA_REGS_DEV_CTL_RESET_REASON_EXT_MASK 0xf000000 142a195fab0SMarcin Wojtas #define ENA_REGS_DEV_CTL_RESET_REASON_SHIFT 28 143a195fab0SMarcin Wojtas #define ENA_REGS_DEV_CTL_RESET_REASON_MASK 0xf0000000 144a195fab0SMarcin Wojtas 145a195fab0SMarcin Wojtas /* dev_sts register */ 146a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_READY_MASK 0x1 147a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_AQ_RESTART_IN_PROGRESS_SHIFT 1 148a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_AQ_RESTART_IN_PROGRESS_MASK 0x2 149a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_AQ_RESTART_FINISHED_SHIFT 2 150a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_AQ_RESTART_FINISHED_MASK 0x4 151a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_RESET_IN_PROGRESS_SHIFT 3 152a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_RESET_IN_PROGRESS_MASK 0x8 153a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_RESET_FINISHED_SHIFT 4 154a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_RESET_FINISHED_MASK 0x10 155a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_FATAL_ERROR_SHIFT 5 156a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_FATAL_ERROR_MASK 0x20 157a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_QUIESCENT_STATE_IN_PROGRESS_SHIFT 6 158a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_QUIESCENT_STATE_IN_PROGRESS_MASK 0x40 159a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_QUIESCENT_STATE_ACHIEVED_SHIFT 7 160a195fab0SMarcin Wojtas #define ENA_REGS_DEV_STS_QUIESCENT_STATE_ACHIEVED_MASK 0x80 161a195fab0SMarcin Wojtas 162a195fab0SMarcin Wojtas /* mmio_reg_read register */ 163a195fab0SMarcin Wojtas #define ENA_REGS_MMIO_REG_READ_REQ_ID_MASK 0xffff 164a195fab0SMarcin Wojtas #define ENA_REGS_MMIO_REG_READ_REG_OFF_SHIFT 16 165a195fab0SMarcin Wojtas #define ENA_REGS_MMIO_REG_READ_REG_OFF_MASK 0xffff0000 166a195fab0SMarcin Wojtas 167a195fab0SMarcin Wojtas /* rss_ind_entry_update register */ 168a195fab0SMarcin Wojtas #define ENA_REGS_RSS_IND_ENTRY_UPDATE_INDEX_MASK 0xffff 169a195fab0SMarcin Wojtas #define ENA_REGS_RSS_IND_ENTRY_UPDATE_CQ_IDX_SHIFT 16 170a195fab0SMarcin Wojtas #define ENA_REGS_RSS_IND_ENTRY_UPDATE_CQ_IDX_MASK 0xffff0000 171a195fab0SMarcin Wojtas 172adfed2d8SArthur Kiyanovski /* phc_db_req_id register */ 173adfed2d8SArthur Kiyanovski #define ENA_REGS_PHC_DB_REQ_ID_MASK 0xffff 174adfed2d8SArthur Kiyanovski 175a195fab0SMarcin Wojtas #endif /* _ENA_REGS_H_ */ 176