12246cbc2SShay Agroskin /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 21738cd3eSNetanel Belgazal /* 32246cbc2SShay Agroskin * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All rights reserved. 41738cd3eSNetanel Belgazal */ 51738cd3eSNetanel Belgazal #ifndef _ENA_REGS_H_ 61738cd3eSNetanel Belgazal #define _ENA_REGS_H_ 71738cd3eSNetanel Belgazal 8e2eed0e3SNetanel Belgazal enum ena_regs_reset_reason_types { 9e2eed0e3SNetanel Belgazal ENA_REGS_RESET_NORMAL = 0, 10e2eed0e3SNetanel Belgazal ENA_REGS_RESET_KEEP_ALIVE_TO = 1, 11e2eed0e3SNetanel Belgazal ENA_REGS_RESET_ADMIN_TO = 2, 12e2eed0e3SNetanel Belgazal ENA_REGS_RESET_MISS_TX_CMPL = 3, 13e2eed0e3SNetanel Belgazal ENA_REGS_RESET_INV_RX_REQ_ID = 4, 14e2eed0e3SNetanel Belgazal ENA_REGS_RESET_INV_TX_REQ_ID = 5, 15e2eed0e3SNetanel Belgazal ENA_REGS_RESET_TOO_MANY_RX_DESCS = 6, 16e2eed0e3SNetanel Belgazal ENA_REGS_RESET_INIT_ERR = 7, 17e2eed0e3SNetanel Belgazal ENA_REGS_RESET_DRIVER_INVALID_STATE = 8, 18e2eed0e3SNetanel Belgazal ENA_REGS_RESET_OS_TRIGGER = 9, 19e2eed0e3SNetanel Belgazal ENA_REGS_RESET_OS_NETDEV_WD = 10, 20e2eed0e3SNetanel Belgazal ENA_REGS_RESET_SHUTDOWN = 11, 21e2eed0e3SNetanel Belgazal ENA_REGS_RESET_USER_TRIGGER = 12, 22e2eed0e3SNetanel Belgazal ENA_REGS_RESET_GENERIC = 13, 238510e1a3SNetanel Belgazal ENA_REGS_RESET_MISS_INTERRUPT = 14, 24071271f3SDavid Arinzon ENA_REGS_RESET_SUSPECTED_POLL_STARVATION = 15, 25*b37b98a3SDavid Arinzon ENA_REGS_RESET_RX_DESCRIPTOR_MALFORMED = 16, 26e2eed0e3SNetanel Belgazal }; 27e2eed0e3SNetanel Belgazal 281738cd3eSNetanel Belgazal /* ena_registers offsets */ 29be26667cSArthur Kiyanovski 30be26667cSArthur Kiyanovski /* 0 base */ 311738cd3eSNetanel Belgazal #define ENA_REGS_VERSION_OFF 0x0 321738cd3eSNetanel Belgazal #define ENA_REGS_CONTROLLER_VERSION_OFF 0x4 331738cd3eSNetanel Belgazal #define ENA_REGS_CAPS_OFF 0x8 341738cd3eSNetanel Belgazal #define ENA_REGS_CAPS_EXT_OFF 0xc 351738cd3eSNetanel Belgazal #define ENA_REGS_AQ_BASE_LO_OFF 0x10 361738cd3eSNetanel Belgazal #define ENA_REGS_AQ_BASE_HI_OFF 0x14 371738cd3eSNetanel Belgazal #define ENA_REGS_AQ_CAPS_OFF 0x18 381738cd3eSNetanel Belgazal #define ENA_REGS_ACQ_BASE_LO_OFF 0x20 391738cd3eSNetanel Belgazal #define ENA_REGS_ACQ_BASE_HI_OFF 0x24 401738cd3eSNetanel Belgazal #define ENA_REGS_ACQ_CAPS_OFF 0x28 411738cd3eSNetanel Belgazal #define ENA_REGS_AQ_DB_OFF 0x2c 421738cd3eSNetanel Belgazal #define ENA_REGS_ACQ_TAIL_OFF 0x30 431738cd3eSNetanel Belgazal #define ENA_REGS_AENQ_CAPS_OFF 0x34 441738cd3eSNetanel Belgazal #define ENA_REGS_AENQ_BASE_LO_OFF 0x38 451738cd3eSNetanel Belgazal #define ENA_REGS_AENQ_BASE_HI_OFF 0x3c 461738cd3eSNetanel Belgazal #define ENA_REGS_AENQ_HEAD_DB_OFF 0x40 471738cd3eSNetanel Belgazal #define ENA_REGS_AENQ_TAIL_OFF 0x44 481738cd3eSNetanel Belgazal #define ENA_REGS_INTR_MASK_OFF 0x4c 491738cd3eSNetanel Belgazal #define ENA_REGS_DEV_CTL_OFF 0x54 501738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_OFF 0x58 511738cd3eSNetanel Belgazal #define ENA_REGS_MMIO_REG_READ_OFF 0x5c 521738cd3eSNetanel Belgazal #define ENA_REGS_MMIO_RESP_LO_OFF 0x60 531738cd3eSNetanel Belgazal #define ENA_REGS_MMIO_RESP_HI_OFF 0x64 541738cd3eSNetanel Belgazal #define ENA_REGS_RSS_IND_ENTRY_UPDATE_OFF 0x68 551738cd3eSNetanel Belgazal 561738cd3eSNetanel Belgazal /* version register */ 571738cd3eSNetanel Belgazal #define ENA_REGS_VERSION_MINOR_VERSION_MASK 0xff 581738cd3eSNetanel Belgazal #define ENA_REGS_VERSION_MAJOR_VERSION_SHIFT 8 591738cd3eSNetanel Belgazal #define ENA_REGS_VERSION_MAJOR_VERSION_MASK 0xff00 601738cd3eSNetanel Belgazal 611738cd3eSNetanel Belgazal /* controller_version register */ 621738cd3eSNetanel Belgazal #define ENA_REGS_CONTROLLER_VERSION_SUBMINOR_VERSION_MASK 0xff 631738cd3eSNetanel Belgazal #define ENA_REGS_CONTROLLER_VERSION_MINOR_VERSION_SHIFT 8 641738cd3eSNetanel Belgazal #define ENA_REGS_CONTROLLER_VERSION_MINOR_VERSION_MASK 0xff00 651738cd3eSNetanel Belgazal #define ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_SHIFT 16 661738cd3eSNetanel Belgazal #define ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_MASK 0xff0000 671738cd3eSNetanel Belgazal #define ENA_REGS_CONTROLLER_VERSION_IMPL_ID_SHIFT 24 681738cd3eSNetanel Belgazal #define ENA_REGS_CONTROLLER_VERSION_IMPL_ID_MASK 0xff000000 691738cd3eSNetanel Belgazal 701738cd3eSNetanel Belgazal /* caps register */ 711738cd3eSNetanel Belgazal #define ENA_REGS_CAPS_CONTIGUOUS_QUEUE_REQUIRED_MASK 0x1 721738cd3eSNetanel Belgazal #define ENA_REGS_CAPS_RESET_TIMEOUT_SHIFT 1 731738cd3eSNetanel Belgazal #define ENA_REGS_CAPS_RESET_TIMEOUT_MASK 0x3e 741738cd3eSNetanel Belgazal #define ENA_REGS_CAPS_DMA_ADDR_WIDTH_SHIFT 8 751738cd3eSNetanel Belgazal #define ENA_REGS_CAPS_DMA_ADDR_WIDTH_MASK 0xff00 7682ef30f1SNetanel Belgazal #define ENA_REGS_CAPS_ADMIN_CMD_TO_SHIFT 16 7782ef30f1SNetanel Belgazal #define ENA_REGS_CAPS_ADMIN_CMD_TO_MASK 0xf0000 781738cd3eSNetanel Belgazal 791738cd3eSNetanel Belgazal /* aq_caps register */ 801738cd3eSNetanel Belgazal #define ENA_REGS_AQ_CAPS_AQ_DEPTH_MASK 0xffff 811738cd3eSNetanel Belgazal #define ENA_REGS_AQ_CAPS_AQ_ENTRY_SIZE_SHIFT 16 821738cd3eSNetanel Belgazal #define ENA_REGS_AQ_CAPS_AQ_ENTRY_SIZE_MASK 0xffff0000 831738cd3eSNetanel Belgazal 841738cd3eSNetanel Belgazal /* acq_caps register */ 851738cd3eSNetanel Belgazal #define ENA_REGS_ACQ_CAPS_ACQ_DEPTH_MASK 0xffff 861738cd3eSNetanel Belgazal #define ENA_REGS_ACQ_CAPS_ACQ_ENTRY_SIZE_SHIFT 16 871738cd3eSNetanel Belgazal #define ENA_REGS_ACQ_CAPS_ACQ_ENTRY_SIZE_MASK 0xffff0000 881738cd3eSNetanel Belgazal 891738cd3eSNetanel Belgazal /* aenq_caps register */ 901738cd3eSNetanel Belgazal #define ENA_REGS_AENQ_CAPS_AENQ_DEPTH_MASK 0xffff 911738cd3eSNetanel Belgazal #define ENA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_SHIFT 16 921738cd3eSNetanel Belgazal #define ENA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_MASK 0xffff0000 931738cd3eSNetanel Belgazal 941738cd3eSNetanel Belgazal /* dev_ctl register */ 951738cd3eSNetanel Belgazal #define ENA_REGS_DEV_CTL_DEV_RESET_MASK 0x1 961738cd3eSNetanel Belgazal #define ENA_REGS_DEV_CTL_AQ_RESTART_SHIFT 1 971738cd3eSNetanel Belgazal #define ENA_REGS_DEV_CTL_AQ_RESTART_MASK 0x2 981738cd3eSNetanel Belgazal #define ENA_REGS_DEV_CTL_QUIESCENT_SHIFT 2 991738cd3eSNetanel Belgazal #define ENA_REGS_DEV_CTL_QUIESCENT_MASK 0x4 1001738cd3eSNetanel Belgazal #define ENA_REGS_DEV_CTL_IO_RESUME_SHIFT 3 1011738cd3eSNetanel Belgazal #define ENA_REGS_DEV_CTL_IO_RESUME_MASK 0x8 102e2eed0e3SNetanel Belgazal #define ENA_REGS_DEV_CTL_RESET_REASON_SHIFT 28 103e2eed0e3SNetanel Belgazal #define ENA_REGS_DEV_CTL_RESET_REASON_MASK 0xf0000000 1041738cd3eSNetanel Belgazal 1051738cd3eSNetanel Belgazal /* dev_sts register */ 1061738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_READY_MASK 0x1 1071738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_AQ_RESTART_IN_PROGRESS_SHIFT 1 1081738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_AQ_RESTART_IN_PROGRESS_MASK 0x2 1091738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_AQ_RESTART_FINISHED_SHIFT 2 1101738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_AQ_RESTART_FINISHED_MASK 0x4 1111738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_RESET_IN_PROGRESS_SHIFT 3 1121738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_RESET_IN_PROGRESS_MASK 0x8 1131738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_RESET_FINISHED_SHIFT 4 1141738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_RESET_FINISHED_MASK 0x10 1151738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_FATAL_ERROR_SHIFT 5 1161738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_FATAL_ERROR_MASK 0x20 1171738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_QUIESCENT_STATE_IN_PROGRESS_SHIFT 6 1181738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_QUIESCENT_STATE_IN_PROGRESS_MASK 0x40 1191738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_QUIESCENT_STATE_ACHIEVED_SHIFT 7 1201738cd3eSNetanel Belgazal #define ENA_REGS_DEV_STS_QUIESCENT_STATE_ACHIEVED_MASK 0x80 1211738cd3eSNetanel Belgazal 1221738cd3eSNetanel Belgazal /* mmio_reg_read register */ 1231738cd3eSNetanel Belgazal #define ENA_REGS_MMIO_REG_READ_REQ_ID_MASK 0xffff 1241738cd3eSNetanel Belgazal #define ENA_REGS_MMIO_REG_READ_REG_OFF_SHIFT 16 1251738cd3eSNetanel Belgazal #define ENA_REGS_MMIO_REG_READ_REG_OFF_MASK 0xffff0000 1261738cd3eSNetanel Belgazal 1271738cd3eSNetanel Belgazal /* rss_ind_entry_update register */ 1281738cd3eSNetanel Belgazal #define ENA_REGS_RSS_IND_ENTRY_UPDATE_INDEX_MASK 0xffff 1291738cd3eSNetanel Belgazal #define ENA_REGS_RSS_IND_ENTRY_UPDATE_CQ_IDX_SHIFT 16 1301738cd3eSNetanel Belgazal #define ENA_REGS_RSS_IND_ENTRY_UPDATE_CQ_IDX_MASK 0xffff0000 1311738cd3eSNetanel Belgazal 1321738cd3eSNetanel Belgazal #endif /* _ENA_REGS_H_ */ 133