162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci * 362306a36Sopenharmony_ci * Copyright 2020-2022 HabanaLabs, Ltd. 462306a36Sopenharmony_ci * All Rights Reserved. 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#ifndef GAUDI2P_H_ 962306a36Sopenharmony_ci#define GAUDI2P_H_ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <uapi/drm/habanalabs_accel.h> 1262306a36Sopenharmony_ci#include "../common/habanalabs.h" 1362306a36Sopenharmony_ci#include "../include/common/hl_boot_if.h" 1462306a36Sopenharmony_ci#include "../include/gaudi2/gaudi2.h" 1562306a36Sopenharmony_ci#include "../include/gaudi2/gaudi2_packets.h" 1662306a36Sopenharmony_ci#include "../include/gaudi2/gaudi2_fw_if.h" 1762306a36Sopenharmony_ci#include "../include/gaudi2/gaudi2_async_events.h" 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ci#define GAUDI2_LINUX_FW_FILE "habanalabs/gaudi2/gaudi2-fit.itb" 2062306a36Sopenharmony_ci#define GAUDI2_BOOT_FIT_FILE "habanalabs/gaudi2/gaudi2-boot-fit.itb" 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ci#define MMU_PAGE_TABLES_INITIAL_SIZE 0x10000000 /* 256MB */ 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#define GAUDI2_CPU_TIMEOUT_USEC 30000000 /* 30s */ 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci#define NUMBER_OF_PDMA_QUEUES 2 2762306a36Sopenharmony_ci#define NUMBER_OF_EDMA_QUEUES 8 2862306a36Sopenharmony_ci#define NUMBER_OF_MME_QUEUES 4 2962306a36Sopenharmony_ci#define NUMBER_OF_TPC_QUEUES 25 3062306a36Sopenharmony_ci#define NUMBER_OF_NIC_QUEUES 24 3162306a36Sopenharmony_ci#define NUMBER_OF_ROT_QUEUES 2 3262306a36Sopenharmony_ci#define NUMBER_OF_CPU_QUEUES 1 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci#define NUMBER_OF_HW_QUEUES ((NUMBER_OF_PDMA_QUEUES + \ 3562306a36Sopenharmony_ci NUMBER_OF_EDMA_QUEUES + \ 3662306a36Sopenharmony_ci NUMBER_OF_MME_QUEUES + \ 3762306a36Sopenharmony_ci NUMBER_OF_TPC_QUEUES + \ 3862306a36Sopenharmony_ci NUMBER_OF_NIC_QUEUES + \ 3962306a36Sopenharmony_ci NUMBER_OF_ROT_QUEUES + \ 4062306a36Sopenharmony_ci NUMBER_OF_CPU_QUEUES) * \ 4162306a36Sopenharmony_ci NUM_OF_PQ_PER_QMAN) 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci#define NUMBER_OF_QUEUES (NUMBER_OF_CPU_QUEUES + NUMBER_OF_HW_QUEUES) 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#define DCORE_NUM_OF_SOB \ 4662306a36Sopenharmony_ci (((mmDCORE0_SYNC_MNGR_OBJS_SOB_OBJ_8191 - \ 4762306a36Sopenharmony_ci mmDCORE0_SYNC_MNGR_OBJS_SOB_OBJ_0) + 4) >> 2) 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci#define DCORE_NUM_OF_MONITORS \ 5062306a36Sopenharmony_ci (((mmDCORE0_SYNC_MNGR_OBJS_MON_STATUS_2047 - \ 5162306a36Sopenharmony_ci mmDCORE0_SYNC_MNGR_OBJS_MON_STATUS_0) + 4) >> 2) 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci#define NUMBER_OF_DEC ((NUM_OF_DEC_PER_DCORE * NUM_OF_DCORES) + NUMBER_OF_PCIE_DEC) 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci/* Map all arcs dccm + arc schedulers acp blocks */ 5662306a36Sopenharmony_ci#define NUM_OF_USER_ACP_BLOCKS (NUM_OF_SCHEDULER_ARC + 2) 5762306a36Sopenharmony_ci#define NUM_OF_USER_NIC_UMR_BLOCKS 15 5862306a36Sopenharmony_ci#define NUM_OF_EXPOSED_SM_BLOCKS ((NUM_OF_DCORES - 1) * 2) 5962306a36Sopenharmony_ci#define NUM_USER_MAPPED_BLOCKS \ 6062306a36Sopenharmony_ci (NUM_ARC_CPUS + NUM_OF_USER_ACP_BLOCKS + NUMBER_OF_DEC + \ 6162306a36Sopenharmony_ci NUM_OF_EXPOSED_SM_BLOCKS + \ 6262306a36Sopenharmony_ci (NIC_NUMBER_OF_ENGINES * NUM_OF_USER_NIC_UMR_BLOCKS)) 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci/* Within the user mapped array, decoder entries start post all the ARC related 6562306a36Sopenharmony_ci * entries 6662306a36Sopenharmony_ci */ 6762306a36Sopenharmony_ci#define USR_MAPPED_BLK_DEC_START_IDX \ 6862306a36Sopenharmony_ci (NUM_ARC_CPUS + NUM_OF_USER_ACP_BLOCKS + \ 6962306a36Sopenharmony_ci (NIC_NUMBER_OF_ENGINES * NUM_OF_USER_NIC_UMR_BLOCKS)) 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci#define USR_MAPPED_BLK_SM_START_IDX \ 7262306a36Sopenharmony_ci (NUM_ARC_CPUS + NUM_OF_USER_ACP_BLOCKS + NUMBER_OF_DEC + \ 7362306a36Sopenharmony_ci (NIC_NUMBER_OF_ENGINES * NUM_OF_USER_NIC_UMR_BLOCKS)) 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci#define SM_OBJS_BLOCK_SIZE (mmDCORE0_SYNC_MNGR_OBJS_SM_SEC_0 - \ 7662306a36Sopenharmony_ci mmDCORE0_SYNC_MNGR_OBJS_SOB_OBJ_0) 7762306a36Sopenharmony_ci 7862306a36Sopenharmony_ci#define GAUDI2_MAX_PENDING_CS 64 7962306a36Sopenharmony_ci 8062306a36Sopenharmony_ci#if !IS_MAX_PENDING_CS_VALID(GAUDI2_MAX_PENDING_CS) 8162306a36Sopenharmony_ci#error "GAUDI2_MAX_PENDING_CS must be power of 2 and greater than 1" 8262306a36Sopenharmony_ci#endif 8362306a36Sopenharmony_ci 8462306a36Sopenharmony_ci#define CORESIGHT_TIMEOUT_USEC 100000 /* 100 ms */ 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci#define GAUDI2_PREBOOT_REQ_TIMEOUT_USEC 25000000 /* 25s */ 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci#define GAUDI2_BOOT_FIT_REQ_TIMEOUT_USEC 10000000 /* 10s */ 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ci#define GAUDI2_NIC_CLK_FREQ 450000000ull /* 450 MHz */ 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci#define DC_POWER_DEFAULT 60000 /* 60W */ 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ci#define GAUDI2_HBM_NUM 6 9562306a36Sopenharmony_ci 9662306a36Sopenharmony_ci#define DMA_MAX_TRANSFER_SIZE U32_MAX 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci#define GAUDI2_DEFAULT_CARD_NAME "HL225" 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci#define QMAN_STREAMS 4 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_ci#define NUM_OF_MME_SBTE_PORTS 5 10362306a36Sopenharmony_ci#define NUM_OF_MME_WB_PORTS 2 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci#define GAUDI2_ENGINE_ID_DCORE_OFFSET \ 10662306a36Sopenharmony_ci (GAUDI2_DCORE1_ENGINE_ID_EDMA_0 - GAUDI2_DCORE0_ENGINE_ID_EDMA_0) 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci/* DRAM Memory Map */ 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_ci#define CPU_FW_IMAGE_SIZE 0x10000000 /* 256MB */ 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci/* This define should be used only when working in a debug mode without dram. 11362306a36Sopenharmony_ci * When working with dram, the driver size will be calculated dynamically. 11462306a36Sopenharmony_ci */ 11562306a36Sopenharmony_ci#define NIC_DEFAULT_DRV_SIZE 0x20000000 /* 512MB */ 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci#define CPU_FW_IMAGE_ADDR DRAM_PHYS_BASE 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci#define NIC_NUMBER_OF_PORTS NIC_NUMBER_OF_ENGINES 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci#define NUMBER_OF_PCIE_DEC 2 12262306a36Sopenharmony_ci#define PCIE_DEC_SHIFT 8 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci#define SRAM_USER_BASE_OFFSET 0 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ci/* cluster binning */ 12762306a36Sopenharmony_ci#define MAX_FAULTY_HBMS 1 12862306a36Sopenharmony_ci#define GAUDI2_XBAR_EDGE_FULL_MASK 0xF 12962306a36Sopenharmony_ci#define GAUDI2_EDMA_FULL_MASK 0xFF 13062306a36Sopenharmony_ci#define GAUDI2_DRAM_FULL_MASK 0x3F 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci/* Host virtual address space. */ 13362306a36Sopenharmony_ci 13462306a36Sopenharmony_ci#define VA_HOST_SPACE_PAGE_START 0xFFF0000000000000ull 13562306a36Sopenharmony_ci#define VA_HOST_SPACE_PAGE_END 0xFFF0800000000000ull /* 140TB */ 13662306a36Sopenharmony_ci 13762306a36Sopenharmony_ci#define VA_HOST_SPACE_HPAGE_START 0xFFF0800000000000ull 13862306a36Sopenharmony_ci#define VA_HOST_SPACE_HPAGE_END 0xFFF1000000000000ull /* 140TB */ 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci/* 140TB */ 14162306a36Sopenharmony_ci#define VA_HOST_SPACE_PAGE_SIZE (VA_HOST_SPACE_PAGE_END - VA_HOST_SPACE_PAGE_START) 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_ci/* 140TB */ 14462306a36Sopenharmony_ci#define VA_HOST_SPACE_HPAGE_SIZE (VA_HOST_SPACE_HPAGE_END - VA_HOST_SPACE_HPAGE_START) 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci#define VA_HOST_SPACE_SIZE (VA_HOST_SPACE_PAGE_SIZE + VA_HOST_SPACE_HPAGE_SIZE) 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci#define HOST_SPACE_INTERNAL_CB_SZ SZ_2M 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci/* 15162306a36Sopenharmony_ci * HBM virtual address space 15262306a36Sopenharmony_ci * Gaudi2 has 6 HBM devices, each supporting 16GB total of 96GB at most. 15362306a36Sopenharmony_ci * No core separation is supported so we can have one chunk of virtual address 15462306a36Sopenharmony_ci * space just above the physical ones. 15562306a36Sopenharmony_ci * The virtual address space starts immediately after the end of the physical 15662306a36Sopenharmony_ci * address space which is determined at run-time. 15762306a36Sopenharmony_ci */ 15862306a36Sopenharmony_ci#define VA_HBM_SPACE_END 0x1002000000000000ull 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ci#define HW_CAP_PLL BIT_ULL(0) 16162306a36Sopenharmony_ci#define HW_CAP_DRAM BIT_ULL(1) 16262306a36Sopenharmony_ci#define HW_CAP_PMMU BIT_ULL(2) 16362306a36Sopenharmony_ci#define HW_CAP_CPU BIT_ULL(3) 16462306a36Sopenharmony_ci#define HW_CAP_MSIX BIT_ULL(4) 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ci#define HW_CAP_CPU_Q BIT_ULL(5) 16762306a36Sopenharmony_ci#define HW_CAP_CPU_Q_SHIFT 5 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci#define HW_CAP_CLK_GATE BIT_ULL(6) 17062306a36Sopenharmony_ci#define HW_CAP_KDMA BIT_ULL(7) 17162306a36Sopenharmony_ci#define HW_CAP_SRAM_SCRAMBLER BIT_ULL(8) 17262306a36Sopenharmony_ci 17362306a36Sopenharmony_ci#define HW_CAP_DCORE0_DMMU0 BIT_ULL(9) 17462306a36Sopenharmony_ci#define HW_CAP_DCORE0_DMMU1 BIT_ULL(10) 17562306a36Sopenharmony_ci#define HW_CAP_DCORE0_DMMU2 BIT_ULL(11) 17662306a36Sopenharmony_ci#define HW_CAP_DCORE0_DMMU3 BIT_ULL(12) 17762306a36Sopenharmony_ci#define HW_CAP_DCORE1_DMMU0 BIT_ULL(13) 17862306a36Sopenharmony_ci#define HW_CAP_DCORE1_DMMU1 BIT_ULL(14) 17962306a36Sopenharmony_ci#define HW_CAP_DCORE1_DMMU2 BIT_ULL(15) 18062306a36Sopenharmony_ci#define HW_CAP_DCORE1_DMMU3 BIT_ULL(16) 18162306a36Sopenharmony_ci#define HW_CAP_DCORE2_DMMU0 BIT_ULL(17) 18262306a36Sopenharmony_ci#define HW_CAP_DCORE2_DMMU1 BIT_ULL(18) 18362306a36Sopenharmony_ci#define HW_CAP_DCORE2_DMMU2 BIT_ULL(19) 18462306a36Sopenharmony_ci#define HW_CAP_DCORE2_DMMU3 BIT_ULL(20) 18562306a36Sopenharmony_ci#define HW_CAP_DCORE3_DMMU0 BIT_ULL(21) 18662306a36Sopenharmony_ci#define HW_CAP_DCORE3_DMMU1 BIT_ULL(22) 18762306a36Sopenharmony_ci#define HW_CAP_DCORE3_DMMU2 BIT_ULL(23) 18862306a36Sopenharmony_ci#define HW_CAP_DCORE3_DMMU3 BIT_ULL(24) 18962306a36Sopenharmony_ci#define HW_CAP_DMMU_MASK GENMASK_ULL(24, 9) 19062306a36Sopenharmony_ci#define HW_CAP_DMMU_SHIFT 9 19162306a36Sopenharmony_ci#define HW_CAP_PDMA_MASK BIT_ULL(26) 19262306a36Sopenharmony_ci#define HW_CAP_EDMA_MASK GENMASK_ULL(34, 27) 19362306a36Sopenharmony_ci#define HW_CAP_EDMA_SHIFT 27 19462306a36Sopenharmony_ci#define HW_CAP_MME_MASK GENMASK_ULL(38, 35) 19562306a36Sopenharmony_ci#define HW_CAP_MME_SHIFT 35 19662306a36Sopenharmony_ci#define HW_CAP_ROT_MASK GENMASK_ULL(40, 39) 19762306a36Sopenharmony_ci#define HW_CAP_ROT_SHIFT 39 19862306a36Sopenharmony_ci#define HW_CAP_HBM_SCRAMBLER_HW_RESET BIT_ULL(41) 19962306a36Sopenharmony_ci#define HW_CAP_HBM_SCRAMBLER_SW_RESET BIT_ULL(42) 20062306a36Sopenharmony_ci#define HW_CAP_HBM_SCRAMBLER_MASK (HW_CAP_HBM_SCRAMBLER_HW_RESET | \ 20162306a36Sopenharmony_ci HW_CAP_HBM_SCRAMBLER_SW_RESET) 20262306a36Sopenharmony_ci#define HW_CAP_HBM_SCRAMBLER_SHIFT 41 20362306a36Sopenharmony_ci#define HW_CAP_RESERVED BIT(43) 20462306a36Sopenharmony_ci#define HW_CAP_MMU_MASK (HW_CAP_PMMU | HW_CAP_DMMU_MASK) 20562306a36Sopenharmony_ci 20662306a36Sopenharmony_ci/* Range Registers */ 20762306a36Sopenharmony_ci#define RR_TYPE_SHORT 0 20862306a36Sopenharmony_ci#define RR_TYPE_LONG 1 20962306a36Sopenharmony_ci#define RR_TYPE_SHORT_PRIV 2 21062306a36Sopenharmony_ci#define RR_TYPE_LONG_PRIV 3 21162306a36Sopenharmony_ci#define NUM_SHORT_LBW_RR 14 21262306a36Sopenharmony_ci#define NUM_LONG_LBW_RR 4 21362306a36Sopenharmony_ci#define NUM_SHORT_HBW_RR 6 21462306a36Sopenharmony_ci#define NUM_LONG_HBW_RR 4 21562306a36Sopenharmony_ci 21662306a36Sopenharmony_ci/* RAZWI initiator coordinates- X- 5 bits, Y- 4 bits */ 21762306a36Sopenharmony_ci#define RAZWI_INITIATOR_X_SHIFT 0 21862306a36Sopenharmony_ci#define RAZWI_INITIATOR_X_MASK 0x1F 21962306a36Sopenharmony_ci#define RAZWI_INITIATOR_Y_SHIFT 5 22062306a36Sopenharmony_ci#define RAZWI_INITIATOR_Y_MASK 0xF 22162306a36Sopenharmony_ci 22262306a36Sopenharmony_ci#define RTR_ID_X_Y(x, y) \ 22362306a36Sopenharmony_ci ((((y) & RAZWI_INITIATOR_Y_MASK) << RAZWI_INITIATOR_Y_SHIFT) | \ 22462306a36Sopenharmony_ci (((x) & RAZWI_INITIATOR_X_MASK) << RAZWI_INITIATOR_X_SHIFT)) 22562306a36Sopenharmony_ci 22662306a36Sopenharmony_ci/* decoders have separate mask */ 22762306a36Sopenharmony_ci#define HW_CAP_DEC_SHIFT 0 22862306a36Sopenharmony_ci#define HW_CAP_DEC_MASK GENMASK_ULL(9, 0) 22962306a36Sopenharmony_ci 23062306a36Sopenharmony_ci/* TPCs have separate mask */ 23162306a36Sopenharmony_ci#define HW_CAP_TPC_SHIFT 0 23262306a36Sopenharmony_ci#define HW_CAP_TPC_MASK GENMASK_ULL(24, 0) 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_ci/* nics have separate mask */ 23562306a36Sopenharmony_ci#define HW_CAP_NIC_SHIFT 0 23662306a36Sopenharmony_ci#define HW_CAP_NIC_MASK GENMASK_ULL(NIC_NUMBER_OF_ENGINES - 1, 0) 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci#define GAUDI2_ARC_PCI_MSB_ADDR(addr) (((addr) & GENMASK_ULL(49, 28)) >> 28) 23962306a36Sopenharmony_ci 24062306a36Sopenharmony_ci#define GAUDI2_SOB_INCREMENT_BY_ONE (FIELD_PREP(DCORE0_SYNC_MNGR_OBJS_SOB_OBJ_VAL_MASK, 1) | \ 24162306a36Sopenharmony_ci FIELD_PREP(DCORE0_SYNC_MNGR_OBJS_SOB_OBJ_INC_MASK, 1)) 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_ci#define GAUDI2_NUM_TESTED_QS (GAUDI2_QUEUE_ID_CPU_PQ - GAUDI2_QUEUE_ID_PDMA_0_0) 24462306a36Sopenharmony_ci 24562306a36Sopenharmony_ci#define GAUDI2_NUM_OF_GLBL_ERR_CAUSE 8 24662306a36Sopenharmony_ci 24762306a36Sopenharmony_cienum gaudi2_reserved_sob_id { 24862306a36Sopenharmony_ci GAUDI2_RESERVED_SOB_CS_COMPLETION_FIRST, 24962306a36Sopenharmony_ci GAUDI2_RESERVED_SOB_CS_COMPLETION_LAST = 25062306a36Sopenharmony_ci GAUDI2_RESERVED_SOB_CS_COMPLETION_FIRST + GAUDI2_MAX_PENDING_CS - 1, 25162306a36Sopenharmony_ci GAUDI2_RESERVED_SOB_KDMA_COMPLETION, 25262306a36Sopenharmony_ci GAUDI2_RESERVED_SOB_DEC_NRM_FIRST, 25362306a36Sopenharmony_ci GAUDI2_RESERVED_SOB_DEC_NRM_LAST = 25462306a36Sopenharmony_ci GAUDI2_RESERVED_SOB_DEC_NRM_FIRST + NUMBER_OF_DEC - 1, 25562306a36Sopenharmony_ci GAUDI2_RESERVED_SOB_DEC_ABNRM_FIRST, 25662306a36Sopenharmony_ci GAUDI2_RESERVED_SOB_DEC_ABNRM_LAST = 25762306a36Sopenharmony_ci GAUDI2_RESERVED_SOB_DEC_ABNRM_FIRST + NUMBER_OF_DEC - 1, 25862306a36Sopenharmony_ci GAUDI2_RESERVED_SOB_NUMBER 25962306a36Sopenharmony_ci}; 26062306a36Sopenharmony_ci 26162306a36Sopenharmony_cienum gaudi2_reserved_mon_id { 26262306a36Sopenharmony_ci GAUDI2_RESERVED_MON_CS_COMPLETION_FIRST, 26362306a36Sopenharmony_ci GAUDI2_RESERVED_MON_CS_COMPLETION_LAST = 26462306a36Sopenharmony_ci GAUDI2_RESERVED_MON_CS_COMPLETION_FIRST + GAUDI2_MAX_PENDING_CS - 1, 26562306a36Sopenharmony_ci GAUDI2_RESERVED_MON_KDMA_COMPLETION, 26662306a36Sopenharmony_ci GAUDI2_RESERVED_MON_DEC_NRM_FIRST, 26762306a36Sopenharmony_ci GAUDI2_RESERVED_MON_DEC_NRM_LAST = 26862306a36Sopenharmony_ci GAUDI2_RESERVED_MON_DEC_NRM_FIRST + 3 * NUMBER_OF_DEC - 1, 26962306a36Sopenharmony_ci GAUDI2_RESERVED_MON_DEC_ABNRM_FIRST, 27062306a36Sopenharmony_ci GAUDI2_RESERVED_MON_DEC_ABNRM_LAST = 27162306a36Sopenharmony_ci GAUDI2_RESERVED_MON_DEC_ABNRM_FIRST + 3 * NUMBER_OF_DEC - 1, 27262306a36Sopenharmony_ci GAUDI2_RESERVED_MON_NUMBER 27362306a36Sopenharmony_ci}; 27462306a36Sopenharmony_ci 27562306a36Sopenharmony_cienum gaudi2_reserved_cq_id { 27662306a36Sopenharmony_ci GAUDI2_RESERVED_CQ_CS_COMPLETION, 27762306a36Sopenharmony_ci GAUDI2_RESERVED_CQ_KDMA_COMPLETION, 27862306a36Sopenharmony_ci GAUDI2_RESERVED_CQ_NUMBER 27962306a36Sopenharmony_ci}; 28062306a36Sopenharmony_ci 28162306a36Sopenharmony_ci/* 28262306a36Sopenharmony_ci * Gaudi2 subtitute TPCs Numbering 28362306a36Sopenharmony_ci * At most- two faulty TPCs are allowed 28462306a36Sopenharmony_ci * First replacement to a faulty TPC will be TPC24, second- TPC23 28562306a36Sopenharmony_ci */ 28662306a36Sopenharmony_cienum substitude_tpc { 28762306a36Sopenharmony_ci FAULTY_TPC_SUBTS_1_TPC_24, 28862306a36Sopenharmony_ci FAULTY_TPC_SUBTS_2_TPC_23, 28962306a36Sopenharmony_ci MAX_FAULTY_TPCS 29062306a36Sopenharmony_ci}; 29162306a36Sopenharmony_ci 29262306a36Sopenharmony_cienum gaudi2_dma_core_id { 29362306a36Sopenharmony_ci DMA_CORE_ID_PDMA0, /* Dcore 0 */ 29462306a36Sopenharmony_ci DMA_CORE_ID_PDMA1, /* Dcore 0 */ 29562306a36Sopenharmony_ci DMA_CORE_ID_EDMA0, /* Dcore 0 */ 29662306a36Sopenharmony_ci DMA_CORE_ID_EDMA1, /* Dcore 0 */ 29762306a36Sopenharmony_ci DMA_CORE_ID_EDMA2, /* Dcore 1 */ 29862306a36Sopenharmony_ci DMA_CORE_ID_EDMA3, /* Dcore 1 */ 29962306a36Sopenharmony_ci DMA_CORE_ID_EDMA4, /* Dcore 2 */ 30062306a36Sopenharmony_ci DMA_CORE_ID_EDMA5, /* Dcore 2 */ 30162306a36Sopenharmony_ci DMA_CORE_ID_EDMA6, /* Dcore 3 */ 30262306a36Sopenharmony_ci DMA_CORE_ID_EDMA7, /* Dcore 3 */ 30362306a36Sopenharmony_ci DMA_CORE_ID_KDMA, /* Dcore 0 */ 30462306a36Sopenharmony_ci DMA_CORE_ID_SIZE 30562306a36Sopenharmony_ci}; 30662306a36Sopenharmony_ci 30762306a36Sopenharmony_cienum gaudi2_rotator_id { 30862306a36Sopenharmony_ci ROTATOR_ID_0, 30962306a36Sopenharmony_ci ROTATOR_ID_1, 31062306a36Sopenharmony_ci ROTATOR_ID_SIZE, 31162306a36Sopenharmony_ci}; 31262306a36Sopenharmony_ci 31362306a36Sopenharmony_cienum gaudi2_mme_id { 31462306a36Sopenharmony_ci MME_ID_DCORE0, 31562306a36Sopenharmony_ci MME_ID_DCORE1, 31662306a36Sopenharmony_ci MME_ID_DCORE2, 31762306a36Sopenharmony_ci MME_ID_DCORE3, 31862306a36Sopenharmony_ci MME_ID_SIZE, 31962306a36Sopenharmony_ci}; 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_cienum gaudi2_tpc_id { 32262306a36Sopenharmony_ci TPC_ID_DCORE0_TPC0, 32362306a36Sopenharmony_ci TPC_ID_DCORE0_TPC1, 32462306a36Sopenharmony_ci TPC_ID_DCORE0_TPC2, 32562306a36Sopenharmony_ci TPC_ID_DCORE0_TPC3, 32662306a36Sopenharmony_ci TPC_ID_DCORE0_TPC4, 32762306a36Sopenharmony_ci TPC_ID_DCORE0_TPC5, 32862306a36Sopenharmony_ci TPC_ID_DCORE1_TPC0, 32962306a36Sopenharmony_ci TPC_ID_DCORE1_TPC1, 33062306a36Sopenharmony_ci TPC_ID_DCORE1_TPC2, 33162306a36Sopenharmony_ci TPC_ID_DCORE1_TPC3, 33262306a36Sopenharmony_ci TPC_ID_DCORE1_TPC4, 33362306a36Sopenharmony_ci TPC_ID_DCORE1_TPC5, 33462306a36Sopenharmony_ci TPC_ID_DCORE2_TPC0, 33562306a36Sopenharmony_ci TPC_ID_DCORE2_TPC1, 33662306a36Sopenharmony_ci TPC_ID_DCORE2_TPC2, 33762306a36Sopenharmony_ci TPC_ID_DCORE2_TPC3, 33862306a36Sopenharmony_ci TPC_ID_DCORE2_TPC4, 33962306a36Sopenharmony_ci TPC_ID_DCORE2_TPC5, 34062306a36Sopenharmony_ci TPC_ID_DCORE3_TPC0, 34162306a36Sopenharmony_ci TPC_ID_DCORE3_TPC1, 34262306a36Sopenharmony_ci TPC_ID_DCORE3_TPC2, 34362306a36Sopenharmony_ci TPC_ID_DCORE3_TPC3, 34462306a36Sopenharmony_ci TPC_ID_DCORE3_TPC4, 34562306a36Sopenharmony_ci TPC_ID_DCORE3_TPC5, 34662306a36Sopenharmony_ci /* the PCI TPC is placed last (mapped liked HW) */ 34762306a36Sopenharmony_ci TPC_ID_DCORE0_TPC6, 34862306a36Sopenharmony_ci TPC_ID_SIZE, 34962306a36Sopenharmony_ci}; 35062306a36Sopenharmony_ci 35162306a36Sopenharmony_cienum gaudi2_dec_id { 35262306a36Sopenharmony_ci DEC_ID_DCORE0_DEC0, 35362306a36Sopenharmony_ci DEC_ID_DCORE0_DEC1, 35462306a36Sopenharmony_ci DEC_ID_DCORE1_DEC0, 35562306a36Sopenharmony_ci DEC_ID_DCORE1_DEC1, 35662306a36Sopenharmony_ci DEC_ID_DCORE2_DEC0, 35762306a36Sopenharmony_ci DEC_ID_DCORE2_DEC1, 35862306a36Sopenharmony_ci DEC_ID_DCORE3_DEC0, 35962306a36Sopenharmony_ci DEC_ID_DCORE3_DEC1, 36062306a36Sopenharmony_ci DEC_ID_PCIE_VDEC0, 36162306a36Sopenharmony_ci DEC_ID_PCIE_VDEC1, 36262306a36Sopenharmony_ci DEC_ID_SIZE, 36362306a36Sopenharmony_ci}; 36462306a36Sopenharmony_ci 36562306a36Sopenharmony_cienum gaudi2_hbm_id { 36662306a36Sopenharmony_ci HBM_ID0, 36762306a36Sopenharmony_ci HBM_ID1, 36862306a36Sopenharmony_ci HBM_ID2, 36962306a36Sopenharmony_ci HBM_ID3, 37062306a36Sopenharmony_ci HBM_ID4, 37162306a36Sopenharmony_ci HBM_ID5, 37262306a36Sopenharmony_ci HBM_ID_SIZE, 37362306a36Sopenharmony_ci}; 37462306a36Sopenharmony_ci 37562306a36Sopenharmony_ci/* specific EDMA enumeration */ 37662306a36Sopenharmony_cienum gaudi2_edma_id { 37762306a36Sopenharmony_ci EDMA_ID_DCORE0_INSTANCE0, 37862306a36Sopenharmony_ci EDMA_ID_DCORE0_INSTANCE1, 37962306a36Sopenharmony_ci EDMA_ID_DCORE1_INSTANCE0, 38062306a36Sopenharmony_ci EDMA_ID_DCORE1_INSTANCE1, 38162306a36Sopenharmony_ci EDMA_ID_DCORE2_INSTANCE0, 38262306a36Sopenharmony_ci EDMA_ID_DCORE2_INSTANCE1, 38362306a36Sopenharmony_ci EDMA_ID_DCORE3_INSTANCE0, 38462306a36Sopenharmony_ci EDMA_ID_DCORE3_INSTANCE1, 38562306a36Sopenharmony_ci EDMA_ID_SIZE, 38662306a36Sopenharmony_ci}; 38762306a36Sopenharmony_ci 38862306a36Sopenharmony_ci/* User interrupt count is aligned with HW CQ count. 38962306a36Sopenharmony_ci * We have 64 CQ's per dcore, CQ0 in dcore 0 is reserved for legacy mode 39062306a36Sopenharmony_ci */ 39162306a36Sopenharmony_ci#define GAUDI2_NUM_USER_INTERRUPTS 255 39262306a36Sopenharmony_ci#define GAUDI2_NUM_RESERVED_INTERRUPTS 1 39362306a36Sopenharmony_ci#define GAUDI2_TOTAL_USER_INTERRUPTS (GAUDI2_NUM_USER_INTERRUPTS + GAUDI2_NUM_RESERVED_INTERRUPTS) 39462306a36Sopenharmony_ci 39562306a36Sopenharmony_cienum gaudi2_irq_num { 39662306a36Sopenharmony_ci GAUDI2_IRQ_NUM_EVENT_QUEUE = GAUDI2_EVENT_QUEUE_MSIX_IDX, 39762306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE0_DEC0_NRM, 39862306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE0_DEC0_ABNRM, 39962306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE0_DEC1_NRM, 40062306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE0_DEC1_ABNRM, 40162306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE1_DEC0_NRM, 40262306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE1_DEC0_ABNRM, 40362306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE1_DEC1_NRM, 40462306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE1_DEC1_ABNRM, 40562306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE2_DEC0_NRM, 40662306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE2_DEC0_ABNRM, 40762306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE2_DEC1_NRM, 40862306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE2_DEC1_ABNRM, 40962306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE3_DEC0_NRM, 41062306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE3_DEC0_ABNRM, 41162306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE3_DEC1_NRM, 41262306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DCORE3_DEC1_ABNRM, 41362306a36Sopenharmony_ci GAUDI2_IRQ_NUM_SHARED_DEC0_NRM, 41462306a36Sopenharmony_ci GAUDI2_IRQ_NUM_SHARED_DEC0_ABNRM, 41562306a36Sopenharmony_ci GAUDI2_IRQ_NUM_SHARED_DEC1_NRM, 41662306a36Sopenharmony_ci GAUDI2_IRQ_NUM_SHARED_DEC1_ABNRM, 41762306a36Sopenharmony_ci GAUDI2_IRQ_NUM_DEC_LAST = GAUDI2_IRQ_NUM_SHARED_DEC1_ABNRM, 41862306a36Sopenharmony_ci GAUDI2_IRQ_NUM_COMPLETION, 41962306a36Sopenharmony_ci GAUDI2_IRQ_NUM_NIC_PORT_FIRST, 42062306a36Sopenharmony_ci GAUDI2_IRQ_NUM_NIC_PORT_LAST = (GAUDI2_IRQ_NUM_NIC_PORT_FIRST + NIC_NUMBER_OF_PORTS - 1), 42162306a36Sopenharmony_ci GAUDI2_IRQ_NUM_TPC_ASSERT, 42262306a36Sopenharmony_ci GAUDI2_IRQ_NUM_RESERVED_FIRST, 42362306a36Sopenharmony_ci GAUDI2_IRQ_NUM_RESERVED_LAST = (GAUDI2_MSIX_ENTRIES - GAUDI2_TOTAL_USER_INTERRUPTS - 1), 42462306a36Sopenharmony_ci GAUDI2_IRQ_NUM_UNEXPECTED_ERROR = RESERVED_MSIX_UNEXPECTED_USER_ERROR_INTERRUPT, 42562306a36Sopenharmony_ci GAUDI2_IRQ_NUM_USER_FIRST = GAUDI2_IRQ_NUM_UNEXPECTED_ERROR + 1, 42662306a36Sopenharmony_ci GAUDI2_IRQ_NUM_USER_LAST = (GAUDI2_IRQ_NUM_USER_FIRST + GAUDI2_NUM_USER_INTERRUPTS - 1), 42762306a36Sopenharmony_ci GAUDI2_IRQ_NUM_LAST = (GAUDI2_MSIX_ENTRIES - 1) 42862306a36Sopenharmony_ci}; 42962306a36Sopenharmony_ci 43062306a36Sopenharmony_cistatic_assert(GAUDI2_IRQ_NUM_USER_FIRST > GAUDI2_IRQ_NUM_SHARED_DEC1_ABNRM); 43162306a36Sopenharmony_ci 43262306a36Sopenharmony_ci/** 43362306a36Sopenharmony_ci * struct dup_block_ctx - context to initialize unit instances across multiple 43462306a36Sopenharmony_ci * blocks where block can be either a dcore of duplicated 43562306a36Sopenharmony_ci * common module. this code relies on constant offsets 43662306a36Sopenharmony_ci * of blocks and unit instances in a block. 43762306a36Sopenharmony_ci * @instance_cfg_fn: instance specific configuration function. 43862306a36Sopenharmony_ci * @data: private configuration data. 43962306a36Sopenharmony_ci * @base: base address of the first instance in the first block. 44062306a36Sopenharmony_ci * @block_off: subsequent blocks address spacing. 44162306a36Sopenharmony_ci * @instance_off: subsequent block's instances address spacing. 44262306a36Sopenharmony_ci * @enabled_mask: mask of enabled instances (1- enabled, 0- disabled). 44362306a36Sopenharmony_ci * @blocks: number of blocks. 44462306a36Sopenharmony_ci * @instances: unit instances per block. 44562306a36Sopenharmony_ci */ 44662306a36Sopenharmony_cistruct dup_block_ctx { 44762306a36Sopenharmony_ci void (*instance_cfg_fn)(struct hl_device *hdev, u64 base, void *data); 44862306a36Sopenharmony_ci void *data; 44962306a36Sopenharmony_ci u64 base; 45062306a36Sopenharmony_ci u64 block_off; 45162306a36Sopenharmony_ci u64 instance_off; 45262306a36Sopenharmony_ci u64 enabled_mask; 45362306a36Sopenharmony_ci unsigned int blocks; 45462306a36Sopenharmony_ci unsigned int instances; 45562306a36Sopenharmony_ci}; 45662306a36Sopenharmony_ci 45762306a36Sopenharmony_ci/** 45862306a36Sopenharmony_ci * struct gaudi2_queues_test_info - Holds the address of a the messages used for testing the 45962306a36Sopenharmony_ci * device queues. 46062306a36Sopenharmony_ci * @dma_addr: the address used by the HW for accessing the message. 46162306a36Sopenharmony_ci * @kern_addr: The address used by the driver for accessing the message. 46262306a36Sopenharmony_ci */ 46362306a36Sopenharmony_cistruct gaudi2_queues_test_info { 46462306a36Sopenharmony_ci dma_addr_t dma_addr; 46562306a36Sopenharmony_ci void *kern_addr; 46662306a36Sopenharmony_ci}; 46762306a36Sopenharmony_ci 46862306a36Sopenharmony_ci/** 46962306a36Sopenharmony_ci * struct gaudi2_device - ASIC specific manage structure. 47062306a36Sopenharmony_ci * @cpucp_info_get: get information on device from CPU-CP 47162306a36Sopenharmony_ci * @mapped_blocks: array that holds the base address and size of all blocks 47262306a36Sopenharmony_ci * the user can map. 47362306a36Sopenharmony_ci * @lfsr_rand_seeds: array of MME ACC random seeds to set. 47462306a36Sopenharmony_ci * @hw_queues_lock: protects the H/W queues from concurrent access. 47562306a36Sopenharmony_ci * @scratchpad_kernel_address: general purpose PAGE_SIZE contiguous memory, 47662306a36Sopenharmony_ci * this memory region should be write-only. 47762306a36Sopenharmony_ci * currently used for HBW QMAN writes which is 47862306a36Sopenharmony_ci * redundant. 47962306a36Sopenharmony_ci * @scratchpad_bus_address: scratchpad bus address 48062306a36Sopenharmony_ci * @virt_msix_db_cpu_addr: host memory page for the virtual MSI-X doorbell. 48162306a36Sopenharmony_ci * @virt_msix_db_dma_addr: bus address of the page for the virtual MSI-X doorbell. 48262306a36Sopenharmony_ci * @dram_bar_cur_addr: current address of DRAM PCI bar. 48362306a36Sopenharmony_ci * @hw_cap_initialized: This field contains a bit per H/W engine. When that 48462306a36Sopenharmony_ci * engine is initialized, that bit is set by the driver to 48562306a36Sopenharmony_ci * signal we can use this engine in later code paths. 48662306a36Sopenharmony_ci * Each bit is cleared upon reset of its corresponding H/W 48762306a36Sopenharmony_ci * engine. 48862306a36Sopenharmony_ci * @active_hw_arc: This field contains a bit per ARC of an H/W engine with 48962306a36Sopenharmony_ci * exception of TPC and NIC engines. Once an engine arc is 49062306a36Sopenharmony_ci * initialized, its respective bit is set. Driver can uniquely 49162306a36Sopenharmony_ci * identify each initialized ARC and use this information in 49262306a36Sopenharmony_ci * later code paths. Each respective bit is cleared upon reset 49362306a36Sopenharmony_ci * of its corresponding ARC of the H/W engine. 49462306a36Sopenharmony_ci * @dec_hw_cap_initialized: This field contains a bit per decoder H/W engine. 49562306a36Sopenharmony_ci * When that engine is initialized, that bit is set by 49662306a36Sopenharmony_ci * the driver to signal we can use this engine in later 49762306a36Sopenharmony_ci * code paths. 49862306a36Sopenharmony_ci * Each bit is cleared upon reset of its corresponding H/W 49962306a36Sopenharmony_ci * engine. 50062306a36Sopenharmony_ci * @tpc_hw_cap_initialized: This field contains a bit per TPC H/W engine. 50162306a36Sopenharmony_ci * When that engine is initialized, that bit is set by 50262306a36Sopenharmony_ci * the driver to signal we can use this engine in later 50362306a36Sopenharmony_ci * code paths. 50462306a36Sopenharmony_ci * Each bit is cleared upon reset of its corresponding H/W 50562306a36Sopenharmony_ci * engine. 50662306a36Sopenharmony_ci * @active_tpc_arc: This field contains a bit per ARC of the TPC engines. 50762306a36Sopenharmony_ci * Once an engine arc is initialized, its respective bit is 50862306a36Sopenharmony_ci * set. Each respective bit is cleared upon reset of its 50962306a36Sopenharmony_ci * corresponding ARC of the TPC engine. 51062306a36Sopenharmony_ci * @nic_hw_cap_initialized: This field contains a bit per nic H/W engine. 51162306a36Sopenharmony_ci * @active_nic_arc: This field contains a bit per ARC of the NIC engines. 51262306a36Sopenharmony_ci * Once an engine arc is initialized, its respective bit is 51362306a36Sopenharmony_ci * set. Each respective bit is cleared upon reset of its 51462306a36Sopenharmony_ci * corresponding ARC of the NIC engine. 51562306a36Sopenharmony_ci * @hw_events: array that holds all H/W events that are defined valid. 51662306a36Sopenharmony_ci * @events_stat: array that holds histogram of all received events. 51762306a36Sopenharmony_ci * @events_stat_aggregate: same as events_stat but doesn't get cleared on reset. 51862306a36Sopenharmony_ci * @num_of_valid_hw_events: used to hold the number of valid H/W events. 51962306a36Sopenharmony_ci * @nic_ports: array that holds all NIC ports manage structures. 52062306a36Sopenharmony_ci * @nic_macros: array that holds all NIC macro manage structures. 52162306a36Sopenharmony_ci * @core_info: core info to be used by the Ethernet driver. 52262306a36Sopenharmony_ci * @aux_ops: functions for core <-> aux drivers communication. 52362306a36Sopenharmony_ci * @flush_db_fifo: flag to force flush DB FIFO after a write. 52462306a36Sopenharmony_ci * @hbm_cfg: HBM subsystem settings 52562306a36Sopenharmony_ci * @hw_queues_lock_mutex: used by simulator instead of hw_queues_lock. 52662306a36Sopenharmony_ci * @queues_test_info: information used by the driver when testing the HW queues. 52762306a36Sopenharmony_ci */ 52862306a36Sopenharmony_cistruct gaudi2_device { 52962306a36Sopenharmony_ci int (*cpucp_info_get)(struct hl_device *hdev); 53062306a36Sopenharmony_ci 53162306a36Sopenharmony_ci struct user_mapped_block mapped_blocks[NUM_USER_MAPPED_BLOCKS]; 53262306a36Sopenharmony_ci int lfsr_rand_seeds[MME_NUM_OF_LFSR_SEEDS]; 53362306a36Sopenharmony_ci 53462306a36Sopenharmony_ci spinlock_t hw_queues_lock; 53562306a36Sopenharmony_ci 53662306a36Sopenharmony_ci void *scratchpad_kernel_address; 53762306a36Sopenharmony_ci dma_addr_t scratchpad_bus_address; 53862306a36Sopenharmony_ci 53962306a36Sopenharmony_ci void *virt_msix_db_cpu_addr; 54062306a36Sopenharmony_ci dma_addr_t virt_msix_db_dma_addr; 54162306a36Sopenharmony_ci 54262306a36Sopenharmony_ci u64 dram_bar_cur_addr; 54362306a36Sopenharmony_ci u64 hw_cap_initialized; 54462306a36Sopenharmony_ci u64 active_hw_arc; 54562306a36Sopenharmony_ci u64 dec_hw_cap_initialized; 54662306a36Sopenharmony_ci u64 tpc_hw_cap_initialized; 54762306a36Sopenharmony_ci u64 active_tpc_arc; 54862306a36Sopenharmony_ci u64 nic_hw_cap_initialized; 54962306a36Sopenharmony_ci u64 active_nic_arc; 55062306a36Sopenharmony_ci u32 hw_events[GAUDI2_EVENT_SIZE]; 55162306a36Sopenharmony_ci u32 events_stat[GAUDI2_EVENT_SIZE]; 55262306a36Sopenharmony_ci u32 events_stat_aggregate[GAUDI2_EVENT_SIZE]; 55362306a36Sopenharmony_ci u32 num_of_valid_hw_events; 55462306a36Sopenharmony_ci 55562306a36Sopenharmony_ci /* Queue testing */ 55662306a36Sopenharmony_ci struct gaudi2_queues_test_info queues_test_info[GAUDI2_NUM_TESTED_QS]; 55762306a36Sopenharmony_ci}; 55862306a36Sopenharmony_ci 55962306a36Sopenharmony_ci/* 56062306a36Sopenharmony_ci * Types of the Gaudi2 IP blocks, used by special blocks iterator. 56162306a36Sopenharmony_ci * Required for scenarios where only particular block types can be 56262306a36Sopenharmony_ci * addressed (e.g., special PLDM images). 56362306a36Sopenharmony_ci */ 56462306a36Sopenharmony_cienum gaudi2_block_types { 56562306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_PLL, 56662306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_RTR, 56762306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_CPU, 56862306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_HIF, 56962306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_HBM, 57062306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_NIC, 57162306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_PCIE, 57262306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_PCIE_PMA, 57362306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_PDMA, 57462306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_EDMA, 57562306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_PMMU, 57662306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_PSOC, 57762306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_ROT, 57862306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_ARC_FARM, 57962306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_DEC, 58062306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_MME, 58162306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_EU_BIST, 58262306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_SYNC_MNGR, 58362306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_STLB, 58462306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_TPC, 58562306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_HMMU, 58662306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_SRAM, 58762306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_XBAR, 58862306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_KDMA, 58962306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_XDMA, 59062306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_XFT, 59162306a36Sopenharmony_ci GAUDI2_BLOCK_TYPE_MAX 59262306a36Sopenharmony_ci}; 59362306a36Sopenharmony_ci 59462306a36Sopenharmony_ciextern const u32 gaudi2_dma_core_blocks_bases[DMA_CORE_ID_SIZE]; 59562306a36Sopenharmony_ciextern const u32 gaudi2_qm_blocks_bases[GAUDI2_QUEUE_ID_SIZE]; 59662306a36Sopenharmony_ciextern const u32 gaudi2_mme_acc_blocks_bases[MME_ID_SIZE]; 59762306a36Sopenharmony_ciextern const u32 gaudi2_mme_ctrl_lo_blocks_bases[MME_ID_SIZE]; 59862306a36Sopenharmony_ciextern const u32 edma_stream_base[NUM_OF_EDMA_PER_DCORE * NUM_OF_DCORES]; 59962306a36Sopenharmony_ciextern const u32 gaudi2_rot_blocks_bases[ROTATOR_ID_SIZE]; 60062306a36Sopenharmony_ci 60162306a36Sopenharmony_civoid gaudi2_iterate_tpcs(struct hl_device *hdev, struct iterate_module_ctx *ctx); 60262306a36Sopenharmony_ciint gaudi2_coresight_init(struct hl_device *hdev); 60362306a36Sopenharmony_ciint gaudi2_debug_coresight(struct hl_device *hdev, struct hl_ctx *ctx, void *data); 60462306a36Sopenharmony_civoid gaudi2_halt_coresight(struct hl_device *hdev, struct hl_ctx *ctx); 60562306a36Sopenharmony_civoid gaudi2_init_blocks(struct hl_device *hdev, struct dup_block_ctx *cfg_ctx); 60662306a36Sopenharmony_cibool gaudi2_is_hmmu_enabled(struct hl_device *hdev, int dcore_id, int hmmu_id); 60762306a36Sopenharmony_civoid gaudi2_write_rr_to_all_lbw_rtrs(struct hl_device *hdev, u8 rr_type, u32 rr_index, u64 min_val, 60862306a36Sopenharmony_ci u64 max_val); 60962306a36Sopenharmony_civoid gaudi2_pb_print_security_errors(struct hl_device *hdev, u32 block_addr, u32 cause, 61062306a36Sopenharmony_ci u32 offended_addr); 61162306a36Sopenharmony_ciint gaudi2_init_security(struct hl_device *hdev); 61262306a36Sopenharmony_civoid gaudi2_ack_protection_bits_errors(struct hl_device *hdev); 61362306a36Sopenharmony_ciint gaudi2_send_device_activity(struct hl_device *hdev, bool open); 61462306a36Sopenharmony_ci 61562306a36Sopenharmony_ci#endif /* GAUDI2P_H_ */ 616