162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All rights reserved.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef _EFA_REGS_H_
762306a36Sopenharmony_ci#define _EFA_REGS_H_
862306a36Sopenharmony_ci
962306a36Sopenharmony_cienum efa_regs_reset_reason_types {
1062306a36Sopenharmony_ci	EFA_REGS_RESET_NORMAL                       = 0,
1162306a36Sopenharmony_ci	/* Keep alive timeout */
1262306a36Sopenharmony_ci	EFA_REGS_RESET_KEEP_ALIVE_TO                = 1,
1362306a36Sopenharmony_ci	EFA_REGS_RESET_ADMIN_TO                     = 2,
1462306a36Sopenharmony_ci	EFA_REGS_RESET_INIT_ERR                     = 3,
1562306a36Sopenharmony_ci	EFA_REGS_RESET_DRIVER_INVALID_STATE         = 4,
1662306a36Sopenharmony_ci	EFA_REGS_RESET_OS_TRIGGER                   = 5,
1762306a36Sopenharmony_ci	EFA_REGS_RESET_SHUTDOWN                     = 6,
1862306a36Sopenharmony_ci	EFA_REGS_RESET_USER_TRIGGER                 = 7,
1962306a36Sopenharmony_ci	EFA_REGS_RESET_GENERIC                      = 8,
2062306a36Sopenharmony_ci};
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci/* efa_registers offsets */
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci/* 0 base */
2562306a36Sopenharmony_ci#define EFA_REGS_VERSION_OFF                                0x0
2662306a36Sopenharmony_ci#define EFA_REGS_CONTROLLER_VERSION_OFF                     0x4
2762306a36Sopenharmony_ci#define EFA_REGS_CAPS_OFF                                   0x8
2862306a36Sopenharmony_ci#define EFA_REGS_AQ_BASE_LO_OFF                             0x10
2962306a36Sopenharmony_ci#define EFA_REGS_AQ_BASE_HI_OFF                             0x14
3062306a36Sopenharmony_ci#define EFA_REGS_AQ_CAPS_OFF                                0x18
3162306a36Sopenharmony_ci#define EFA_REGS_ACQ_BASE_LO_OFF                            0x20
3262306a36Sopenharmony_ci#define EFA_REGS_ACQ_BASE_HI_OFF                            0x24
3362306a36Sopenharmony_ci#define EFA_REGS_ACQ_CAPS_OFF                               0x28
3462306a36Sopenharmony_ci#define EFA_REGS_AQ_PROD_DB_OFF                             0x2c
3562306a36Sopenharmony_ci#define EFA_REGS_AENQ_CAPS_OFF                              0x34
3662306a36Sopenharmony_ci#define EFA_REGS_AENQ_BASE_LO_OFF                           0x38
3762306a36Sopenharmony_ci#define EFA_REGS_AENQ_BASE_HI_OFF                           0x3c
3862306a36Sopenharmony_ci#define EFA_REGS_AENQ_CONS_DB_OFF                           0x40
3962306a36Sopenharmony_ci#define EFA_REGS_INTR_MASK_OFF                              0x4c
4062306a36Sopenharmony_ci#define EFA_REGS_DEV_CTL_OFF                                0x54
4162306a36Sopenharmony_ci#define EFA_REGS_DEV_STS_OFF                                0x58
4262306a36Sopenharmony_ci#define EFA_REGS_MMIO_REG_READ_OFF                          0x5c
4362306a36Sopenharmony_ci#define EFA_REGS_MMIO_RESP_LO_OFF                           0x60
4462306a36Sopenharmony_ci#define EFA_REGS_MMIO_RESP_HI_OFF                           0x64
4562306a36Sopenharmony_ci#define EFA_REGS_EQ_DB_OFF                                  0x68
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/* version register */
4862306a36Sopenharmony_ci#define EFA_REGS_VERSION_MINOR_VERSION_MASK                 0xff
4962306a36Sopenharmony_ci#define EFA_REGS_VERSION_MAJOR_VERSION_MASK                 0xff00
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci/* controller_version register */
5262306a36Sopenharmony_ci#define EFA_REGS_CONTROLLER_VERSION_SUBMINOR_VERSION_MASK   0xff
5362306a36Sopenharmony_ci#define EFA_REGS_CONTROLLER_VERSION_MINOR_VERSION_MASK      0xff00
5462306a36Sopenharmony_ci#define EFA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_MASK      0xff0000
5562306a36Sopenharmony_ci#define EFA_REGS_CONTROLLER_VERSION_IMPL_ID_MASK            0xff000000
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci/* caps register */
5862306a36Sopenharmony_ci#define EFA_REGS_CAPS_CONTIGUOUS_QUEUE_REQUIRED_MASK        0x1
5962306a36Sopenharmony_ci#define EFA_REGS_CAPS_RESET_TIMEOUT_MASK                    0x3e
6062306a36Sopenharmony_ci#define EFA_REGS_CAPS_DMA_ADDR_WIDTH_MASK                   0xff00
6162306a36Sopenharmony_ci#define EFA_REGS_CAPS_ADMIN_CMD_TO_MASK                     0xf0000
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci/* aq_caps register */
6462306a36Sopenharmony_ci#define EFA_REGS_AQ_CAPS_AQ_DEPTH_MASK                      0xffff
6562306a36Sopenharmony_ci#define EFA_REGS_AQ_CAPS_AQ_ENTRY_SIZE_MASK                 0xffff0000
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci/* acq_caps register */
6862306a36Sopenharmony_ci#define EFA_REGS_ACQ_CAPS_ACQ_DEPTH_MASK                    0xffff
6962306a36Sopenharmony_ci#define EFA_REGS_ACQ_CAPS_ACQ_ENTRY_SIZE_MASK               0xff0000
7062306a36Sopenharmony_ci#define EFA_REGS_ACQ_CAPS_ACQ_MSIX_VECTOR_MASK              0xff000000
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci/* aenq_caps register */
7362306a36Sopenharmony_ci#define EFA_REGS_AENQ_CAPS_AENQ_DEPTH_MASK                  0xffff
7462306a36Sopenharmony_ci#define EFA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_MASK             0xff0000
7562306a36Sopenharmony_ci#define EFA_REGS_AENQ_CAPS_AENQ_MSIX_VECTOR_MASK            0xff000000
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci/* intr_mask register */
7862306a36Sopenharmony_ci#define EFA_REGS_INTR_MASK_EN_MASK                          0x1
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci/* dev_ctl register */
8162306a36Sopenharmony_ci#define EFA_REGS_DEV_CTL_DEV_RESET_MASK                     0x1
8262306a36Sopenharmony_ci#define EFA_REGS_DEV_CTL_AQ_RESTART_MASK                    0x2
8362306a36Sopenharmony_ci#define EFA_REGS_DEV_CTL_RESET_REASON_MASK                  0xf0000000
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci/* dev_sts register */
8662306a36Sopenharmony_ci#define EFA_REGS_DEV_STS_READY_MASK                         0x1
8762306a36Sopenharmony_ci#define EFA_REGS_DEV_STS_AQ_RESTART_IN_PROGRESS_MASK        0x2
8862306a36Sopenharmony_ci#define EFA_REGS_DEV_STS_AQ_RESTART_FINISHED_MASK           0x4
8962306a36Sopenharmony_ci#define EFA_REGS_DEV_STS_RESET_IN_PROGRESS_MASK             0x8
9062306a36Sopenharmony_ci#define EFA_REGS_DEV_STS_RESET_FINISHED_MASK                0x10
9162306a36Sopenharmony_ci#define EFA_REGS_DEV_STS_FATAL_ERROR_MASK                   0x20
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci/* mmio_reg_read register */
9462306a36Sopenharmony_ci#define EFA_REGS_MMIO_REG_READ_REQ_ID_MASK                  0xffff
9562306a36Sopenharmony_ci#define EFA_REGS_MMIO_REG_READ_REG_OFF_MASK                 0xffff0000
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci/* eq_db register */
9862306a36Sopenharmony_ci#define EFA_REGS_EQ_DB_EQN_MASK                             0xffff
9962306a36Sopenharmony_ci#define EFA_REGS_EQ_DB_ARM_MASK                             0x80000000
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci#endif /* _EFA_REGS_H_ */
102