linux/drivers/accel/habanalabs/include/gaudi/gaudi_masks.h

/* SPDX-License-Identifier: GPL-2.0
 *
 * Copyright 2016-2020 HabanaLabs, Ltd.
 * All Rights Reserved.
 *
 */

#ifndef GAUDI_MASKS_H_
#define GAUDI_MASKS_H_

#include "asic_reg/gaudi_regs.h"

/* Useful masks for bits in various registers */
#define PCI_DMA_QMAN_ENABLE

#define QMAN_EXTERNAL_MAKE_TRUSTED

#define QMAN_INTERNAL_MAKE_TRUSTED

#define HBM_DMA_QMAN_ENABLE

#define QMAN_MME_ENABLE

#define QMAN_TPC_ENABLE

#define NIC_QMAN_ENABLE

#define QMAN_UPPER_CP_CGM_PWR_GATE_EN

#define QMAN_COMMON_CP_CGM_PWR_GATE_EN

#define PCI_DMA_QMAN_GLBL_ERR_CFG_MSG_EN_MASK

#define PCI_DMA_QMAN_GLBL_ERR_CFG_STOP_ON_ERR_EN_MASK

#define HBM_DMA_QMAN_GLBL_ERR_CFG_MSG_EN_MASK

#define HBM_DMA_QMAN_GLBL_ERR_CFG_STOP_ON_ERR_EN_MASK

#define TPC_QMAN_GLBL_ERR_CFG_MSG_EN_MASK

#define TPC_QMAN_GLBL_ERR_CFG_STOP_ON_ERR_EN_MASK

#define MME_QMAN_GLBL_ERR_CFG_MSG_EN_MASK

#define MME_QMAN_GLBL_ERR_CFG_STOP_ON_ERR_EN_MASK

#define NIC_QMAN_GLBL_ERR_CFG_MSG_EN_MASK

#define NIC_QMAN_GLBL_ERR_CFG_STOP_ON_ERR_EN_MASK

#define QMAN_CGM1_PWR_GATE_EN

/* RESET registers configuration */
#define CFG_RST_L_PSOC_MASK
#define CFG_RST_L_PCIE_MASK
#define CFG_RST_L_PCIE_IF_MASK
#define CFG_RST_L_HBM_S_PLL_MASK
#define CFG_RST_L_TPC_S_PLL_MASK
#define CFG_RST_L_MME_S_PLL_MASK
#define CFG_RST_L_CPU_PLL_MASK
#define CFG_RST_L_PCIE_PLL_MASK
#define CFG_RST_L_NIC_S_PLL_MASK
#define CFG_RST_L_HBM_N_PLL_MASK
#define CFG_RST_L_TPC_N_PLL_MASK
#define CFG_RST_L_MME_N_PLL_MASK
#define CFG_RST_L_NIC_N_PLL_MASK
#define CFG_RST_L_DMA_W_PLL_MASK
#define CFG_RST_L_SIF_W_PLL_MASK
#define CFG_RST_L_MESH_W_PLL_MASK
#define CFG_RST_L_SRAM_W_PLL_MASK
#define CFG_RST_L_DMA_E_PLL_MASK
#define CFG_RST_L_SIF_E_PLL_MASK
#define CFG_RST_L_MESH_E_PLL_MASK
#define CFG_RST_L_SRAM_E_PLL_MASK

#define CFG_RST_L_IF_1_MASK
#define CFG_RST_L_IF_0_MASK
#define CFG_RST_L_IF_2_MASK
#define CFG_RST_L_IF_3_MASK
#define CFG_RST_L_IF_MASK

#define CFG_RST_L_TPC_0_MASK
#define CFG_RST_L_TPC_1_MASK
#define CFG_RST_L_TPC_2_MASK
#define CFG_RST_L_TPC_3_MASK
#define CFG_RST_L_TPC_4_MASK
#define CFG_RST_L_TPC_5_MASK
#define CFG_RST_L_TPC_6_MASK
#define CFG_RST_L_TPC_MASK

#define CFG_RST_H_TPC_7_MASK

#define CFG_RST_H_MME_0_MASK
#define CFG_RST_H_MME_1_MASK
#define CFG_RST_H_MME_2_MASK
#define CFG_RST_H_MME_3_MASK
#define CFG_RST_H_MME_MASK

#define CFG_RST_H_HBM_0_MASK
#define CFG_RST_H_HBM_1_MASK
#define CFG_RST_H_HBM_2_MASK
#define CFG_RST_H_HBM_3_MASK
#define CFG_RST_H_HBM_MASK

#define CFG_RST_H_NIC_0_MASK
#define CFG_RST_H_NIC_1_MASK
#define CFG_RST_H_NIC_2_MASK
#define CFG_RST_H_NIC_3_MASK
#define CFG_RST_H_NIC_4_MASK
#define CFG_RST_H_NIC_MASK

#define CFG_RST_H_SM_0_MASK
#define CFG_RST_H_SM_1_MASK
#define CFG_RST_H_SM_2_MASK
#define CFG_RST_H_SM_3_MASK
#define CFG_RST_H_SM_MASK

#define CFG_RST_H_DMA_0_MASK
#define CFG_RST_H_DMA_1_MASK
#define CFG_RST_H_DMA_MASK

#define CFG_RST_H_CPU_MASK
#define CFG_RST_H_MMU_MASK

#define UNIT_RST_L_PSOC_SHIFT
#define UNIT_RST_L_PCIE_SHIFT
#define UNIT_RST_L_PCIE_IF_SHIFT
#define UNIT_RST_L_HBM_S_PLL_SHIFT
#define UNIT_RST_L_TPC_S_PLL_SHIFT
#define UNIT_RST_L_MME_S_PLL_SHIFT
#define UNIT_RST_L_CPU_PLL_SHIFT
#define UNIT_RST_L_PCIE_PLL_SHIFT
#define UNIT_RST_L_NIC_S_PLL_SHIFT
#define UNIT_RST_L_HBM_N_PLL_SHIFT
#define UNIT_RST_L_TPC_N_PLL_SHIFT
#define UNIT_RST_L_MME_N_PLL_SHIFT
#define UNIT_RST_L_NIC_N_PLL_SHIFT
#define UNIT_RST_L_DMA_W_PLL_SHIFT
#define UNIT_RST_L_SIF_W_PLL_SHIFT
#define UNIT_RST_L_MESH_W_PLL_SHIFT
#define UNIT_RST_L_SRAM_W_PLL_SHIFT
#define UNIT_RST_L_DMA_E_PLL_SHIFT
#define UNIT_RST_L_SIF_E_PLL_SHIFT
#define UNIT_RST_L_MESH_E_PLL_SHIFT
#define UNIT_RST_L_SRAM_E_PLL_SHIFT
#define UNIT_RST_L_TPC_0_SHIFT
#define UNIT_RST_L_TPC_1_SHIFT
#define UNIT_RST_L_TPC_2_SHIFT
#define UNIT_RST_L_TPC_3_SHIFT
#define UNIT_RST_L_TPC_4_SHIFT
#define UNIT_RST_L_TPC_5_SHIFT
#define UNIT_RST_L_TPC_6_SHIFT
#define UNIT_RST_L_TPC_7_SHIFT
#define UNIT_RST_L_MME_0_SHIFT
#define UNIT_RST_L_MME_1_SHIFT
#define UNIT_RST_L_MME_2_SHIFT

#define UNIT_RST_H_MME_3_SHIFT
#define UNIT_RST_H_HBM_0_SHIFT
#define UNIT_RST_H_HBM_1_SHIFT
#define UNIT_RST_H_HBM_2_SHIFT
#define UNIT_RST_H_HBM_3_SHIFT
#define UNIT_RST_H_NIC_0_SHIFT
#define UNIT_RST_H_NIC_1_SHIFT
#define UNIT_RST_H_NIC_2_SHIFT
#define UNIT_RST_H_NIC_3_SHIFT
#define UNIT_RST_H_NIC_4_SHIFT
#define UNIT_RST_H_SM_0_SHIFT
#define UNIT_RST_H_SM_1_SHIFT
#define UNIT_RST_H_SM_2_SHIFT
#define UNIT_RST_H_SM_3_SHIFT
#define UNIT_RST_H_IF_0_SHIFT
#define UNIT_RST_H_IF_1_SHIFT
#define UNIT_RST_H_IF_2_SHIFT
#define UNIT_RST_H_IF_3_SHIFT
#define UNIT_RST_H_DMA_0_SHIFT
#define UNIT_RST_H_DMA_1_SHIFT
#define UNIT_RST_H_CPU_SHIFT
#define UNIT_RST_H_MMU_SHIFT

#define UNIT_RST_H_HBM_MASK

#define UNIT_RST_H_NIC_MASK

#define UNIT_RST_H_SM_MASK

#define UNIT_RST_H_MME_MASK

#define UNIT_RST_L_MME_MASK

#define UNIT_RST_L_IF_MASK

#define UNIT_RST_L_TPC_MASK

/* CPU_CA53_CFG_ARM_RST_CONTROL */
#define CPU_CA53_CFG_ARM_RST_CONTROL_NCPUPORESET_SHIFT
#define CPU_CA53_CFG_ARM_RST_CONTROL_NCPUPORESET_MASK
#define CPU_CA53_CFG_ARM_RST_CONTROL_NCORERESET_SHIFT
#define CPU_CA53_CFG_ARM_RST_CONTROL_NCORERESET_MASK
#define CPU_CA53_CFG_ARM_RST_CONTROL_NL2RESET_SHIFT
#define CPU_CA53_CFG_ARM_RST_CONTROL_NL2RESET_MASK
#define CPU_CA53_CFG_ARM_RST_CONTROL_NPRESETDBG_SHIFT
#define CPU_CA53_CFG_ARM_RST_CONTROL_NPRESETDBG_MASK
#define CPU_CA53_CFG_ARM_RST_CONTROL_NMBISTRESET_SHIFT
#define CPU_CA53_CFG_ARM_RST_CONTROL_NMBISTRESET_MASK
#define CPU_CA53_CFG_ARM_RST_CONTROL_WARMRSTREQ_SHIFT
#define CPU_CA53_CFG_ARM_RST_CONTROL_WARMRSTREQ_MASK

#define CPU_RESET_ASSERT

#define CPU_RESET_CORE0_DEASSERT

/* QM_IDLE_MASK is valid for all engines QM idle check */
#define QM_IDLE_MASK

/* CGM_IDLE_MASK is valid for all engines CGM idle check */
#define CGM_IDLE_MASK

#define TPC_IDLE_MASK

#define MME0_CTRL_ARCH_STATUS_SB_A_EMPTY_MASK
#define MME0_CTRL_ARCH_STATUS_SB_B_EMPTY_MASK
#define MME0_CTRL_ARCH_STATUS_WBC_AXI_IDLE_MASK

#define MME_ARCH_IDLE_MASK

#define IS_QM_IDLE(qm_glbl_sts0, qm_cgm_sts)

#define IS_DMA_IDLE(dma_core_sts0)

#define IS_TPC_IDLE(tpc_cfg_sts)

#define IS_MME_IDLE(mme_arch_sts)

enum axi_id {};

/* RAZWI initiator ID is built from the location in the chip and the AXI ID */

#define RAZWI_INITIATOR_AXI_ID_SHIFT
#define RAZWI_INITIATOR_AXI_ID_MASK
#define RAZWI_INITIATOR_X_SHIFT
#define RAZWI_INITIATOR_X_MASK
#define RAZWI_INITIATOR_Y_SHIFT
#define RAZWI_INITIATOR_Y_MASK

#define RAZWI_INITIATOR_ID_AXI_ID(axi_id)

#define RAZWI_INITIATOR_ID_X_Y(x, y)

#define RAZWI_INITIATOR_ID_X_Y_TPC0_NIC0
#define RAZWI_INITIATOR_ID_X_Y_TPC1
#define RAZWI_INITIATOR_ID_X_Y_MME0_0
#define RAZWI_INITIATOR_ID_X_Y_MME0_1
#define RAZWI_INITIATOR_ID_X_Y_MME1_0
#define RAZWI_INITIATOR_ID_X_Y_MME1_1
#define RAZWI_INITIATOR_ID_X_Y_TPC2
#define RAZWI_INITIATOR_ID_X_Y_TPC3_PCI_CPU_PSOC
#define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_S_0
#define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_S_0
#define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_S_1
#define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_S_1
#define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_N_0
#define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_N_0
#define RAZWI_INITIATOR_ID_X_Y_DMA_IF_W_N_1
#define RAZWI_INITIATOR_ID_X_Y_DMA_IF_E_N_1
#define RAZWI_INITIATOR_ID_X_Y_TPC4_NIC1_NIC2
#define RAZWI_INITIATOR_ID_X_Y_TPC5
#define RAZWI_INITIATOR_ID_X_Y_MME2_0
#define RAZWI_INITIATOR_ID_X_Y_MME2_1
#define RAZWI_INITIATOR_ID_X_Y_MME3_0
#define RAZWI_INITIATOR_ID_X_Y_MME3_1
#define RAZWI_INITIATOR_ID_X_Y_TPC6
#define RAZWI_INITIATOR_ID_X_Y_TPC7_NIC4_NIC5

#define PSOC_ETR_AXICTL_PROTCTRLBIT1_SHIFT
#define PSOC_ETR_AXICTL_PROTCTRLBIT0_MASK
#define PSOC_ETR_AXICTL_PROTCTRLBIT1_MASK
#define PSOC_ETR_AXICTL_WRBURSTLEN_MASK

/* STLB_CACHE_INV */
#define STLB_CACHE_INV_PRODUCER_INDEX_SHIFT
#define STLB_CACHE_INV_PRODUCER_INDEX_MASK
#define STLB_CACHE_INV_INDEX_MASK_SHIFT
#define STLB_CACHE_INV_INDEX_MASK_MASK

#define MME_ACC_ACC_STALL_R_SHIFT
#define MME_SBAB_SB_STALL_R_SHIFT

#define PCIE_WRAP_LBW_PROT_OVR_RD_EN_MASK
#define PCIE_WRAP_LBW_PROT_OVR_WR_EN_MASK

#define PCIE_WRAP_LBW_DRAIN_CFG_EN_SHIFT
#define PCIE_WRAP_HBW_DRAIN_CFG_EN_SHIFT

/* DMA_IF_HBM_CRED_EN */
#define DMA_IF_HBM_CRED_EN_READ_CREDIT_EN_SHIFT
#define DMA_IF_HBM_CRED_EN_READ_CREDIT_EN_MASK
#define DMA_IF_HBM_CRED_EN_WRITE_CREDIT_EN_SHIFT
#define DMA_IF_HBM_CRED_EN_WRITE_CREDIT_EN_MASK

#define DMA_IF_DOWN_CHX_SCRAM_SRAM_EN_VAL_SHIFT
#define DMA_IF_DOWN_CHX_SCRAM_HBM_EN_VAL_SHIFT
#define DMA_IF_DOWN_CHX_E2E_HBM_EN_VAL_SHIFT
#define DMA_IF_DOWN_CHX_E2E_PCI_EN_VAL_SHIFT

#define IF_RTR_CTRL_SCRAM_SRAM_EN_VAL_SHIFT
#define IF_RTR_CTRL_SCRAM_HBM_EN_VAL_SHIFT

#define IF_RTR_CTRL_E2E_HBM_EN_VAL_SHIFT
#define IF_RTR_CTRL_E2E_PCI_EN_VAL_SHIFT

/* MMU_UP_PAGE_ERROR_CAPTURE */
#define MMU_UP_PAGE_ERROR_CAPTURE_VA_49_32_MASK
#define MMU_UP_PAGE_ERROR_CAPTURE_ENTRY_VALID_MASK

/* MMU_UP_ACCESS_ERROR_CAPTURE */
#define MMU_UP_ACCESS_ERROR_CAPTURE_VA_49_32_MASK
#define MMU_UP_ACCESS_ERROR_CAPTURE_ENTRY_VALID_MASK

#define QM_ARB_ERR_MSG_EN_CHOISE_OVF_MASK
#define QM_ARB_ERR_MSG_EN_CHOISE_WDT_MASK
#define QM_ARB_ERR_MSG_EN_AXI_LBW_ERR_MASK

#define QM_ARB_ERR_MSG_EN_MASK

#define PCIE_AUX_FLR_CTRL_HW_CTRL_MASK
#define PCIE_AUX_FLR_CTRL_INT_MASK_MASK

#define SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_STATUS_0_VALID_SHIFT
#define SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_STATUS_0_VALID_MASK
#define SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_STATUS_0_PENDING_SHIFT
#define SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_STATUS_0_PENDING_MASK
#define SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_ARM_0_SID_SHIFT
#define SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_ARM_0_SID_MASK
#define SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_ARM_0_MASK_SHIFT
#define SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_ARM_0_MASK_MASK
#define SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_ARM_0_SOP_SHIFT
#define SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_ARM_0_SOP_MASK
#define SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_ARM_0_SOD_SHIFT
#define SYNC_MNGR_W_S_SYNC_MNGR_OBJS_MON_ARM_0_SOD_MASK
#define TPC0_QM_CP_STS_0_FENCE_ID_SHIFT
#define TPC0_QM_CP_STS_0_FENCE_ID_MASK
#define TPC0_QM_CP_STS_0_FENCE_IN_PROGRESS_SHIFT
#define TPC0_QM_CP_STS_0_FENCE_IN_PROGRESS_MASK

#endif /* GAUDI_MASKS_H_ */