1e4b1edf4SYiPeng Chai /* 2e4b1edf4SYiPeng Chai * Copyright 2022 Advanced Micro Devices, Inc. 3e4b1edf4SYiPeng Chai * 4e4b1edf4SYiPeng Chai * Permission is hereby granted, free of charge, to any person obtaining a 5e4b1edf4SYiPeng Chai * copy of this software and associated documentation files (the "Software"), 6e4b1edf4SYiPeng Chai * to deal in the Software without restriction, including without limitation 7e4b1edf4SYiPeng Chai * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8e4b1edf4SYiPeng Chai * and/or sell copies of the Software, and to permit persons to whom the 9e4b1edf4SYiPeng Chai * Software is furnished to do so, subject to the following conditions: 10e4b1edf4SYiPeng Chai * 11e4b1edf4SYiPeng Chai * The above copyright notice and this permission notice shall be included in 12e4b1edf4SYiPeng Chai * all copies or substantial portions of the Software. 13e4b1edf4SYiPeng Chai * 14e4b1edf4SYiPeng Chai * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15e4b1edf4SYiPeng Chai * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16e4b1edf4SYiPeng Chai * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17e4b1edf4SYiPeng Chai * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18e4b1edf4SYiPeng Chai * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19e4b1edf4SYiPeng Chai * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20e4b1edf4SYiPeng Chai * OTHER DEALINGS IN THE SOFTWARE. 21e4b1edf4SYiPeng Chai * 22e4b1edf4SYiPeng Chai */ 23e4b1edf4SYiPeng Chai #ifndef __UMC_V8_10_H__ 24e4b1edf4SYiPeng Chai #define __UMC_V8_10_H__ 25e4b1edf4SYiPeng Chai 26e4b1edf4SYiPeng Chai #include "soc15_common.h" 27e4b1edf4SYiPeng Chai #include "amdgpu.h" 28e4b1edf4SYiPeng Chai 29e4b1edf4SYiPeng Chai /* number of umc channel instance with memory map register access */ 30e4b1edf4SYiPeng Chai #define UMC_V8_10_CHANNEL_INSTANCE_NUM 2 31e4b1edf4SYiPeng Chai /* number of umc instance with memory map register access */ 32e4b1edf4SYiPeng Chai #define UMC_V8_10_UMC_INSTANCE_NUM 2 33e4b1edf4SYiPeng Chai 3406630fb9SCandice Li /* Total channel instances for all available umc nodes */ 35e4b1edf4SYiPeng Chai #define UMC_V8_10_TOTAL_CHANNEL_NUM(adev) \ 36*bcd9a5f8SCandice Li (UMC_V8_10_CHANNEL_INSTANCE_NUM * UMC_V8_10_UMC_INSTANCE_NUM * \ 37*bcd9a5f8SCandice Li (adev)->gmc.num_umc - hweight32((adev)->gmc.m_half_use) * 2) 38e4b1edf4SYiPeng Chai 39e4b1edf4SYiPeng Chai /* UMC regiser per channel offset */ 40e4b1edf4SYiPeng Chai #define UMC_V8_10_PER_CHANNEL_OFFSET 0x400 41e4b1edf4SYiPeng Chai 42e4b1edf4SYiPeng Chai /* EccErrCnt max value */ 43e4b1edf4SYiPeng Chai #define UMC_V8_10_CE_CNT_MAX 0xffff 44e4b1edf4SYiPeng Chai /* umc ce interrupt threshold */ 45e4b1edf4SYiPeng Chai #define UUMC_V8_10_CE_INT_THRESHOLD 0xffff 46e4b1edf4SYiPeng Chai /* umc ce count initial value */ 47e4b1edf4SYiPeng Chai #define UMC_V8_10_CE_CNT_INIT (UMC_V8_10_CE_CNT_MAX - UUMC_V8_10_CE_INT_THRESHOLD) 48e4b1edf4SYiPeng Chai 49e4b1edf4SYiPeng Chai #define UMC_V8_10_NA_COL_2BITS_POWER_OF_2_NUM 4 50e4b1edf4SYiPeng Chai 51e4b1edf4SYiPeng Chai /* The C5 bit in NA address */ 52e4b1edf4SYiPeng Chai #define UMC_V8_10_NA_C5_BIT 14 53e4b1edf4SYiPeng Chai 54e4b1edf4SYiPeng Chai /* Map to swizzle mode address */ 55e4b1edf4SYiPeng Chai #define SWIZZLE_MODE_TMP_ADDR(na, ch_num, ch_idx) \ 56e4b1edf4SYiPeng Chai ((((na) >> 10) * (ch_num) + (ch_idx)) << 10) 57e4b1edf4SYiPeng Chai #define SWIZZLE_MODE_ADDR_HI(addr, col_bit) \ 58e4b1edf4SYiPeng Chai (((addr) >> ((col_bit) + 2)) << ((col_bit) + 2)) 59e4b1edf4SYiPeng Chai #define SWIZZLE_MODE_ADDR_MID(na, col_bit) ((((na) >> 8) & 0x3) << (col_bit)) 60e4b1edf4SYiPeng Chai #define SWIZZLE_MODE_ADDR_LOW(addr, col_bit) \ 61e4b1edf4SYiPeng Chai ((((addr) >> 10) & ((0x1ULL << (col_bit - 8)) - 1)) << 8) 62e4b1edf4SYiPeng Chai #define SWIZZLE_MODE_ADDR_LSB(na) ((na) & 0xFF) 63e4b1edf4SYiPeng Chai 64e4b1edf4SYiPeng Chai extern struct amdgpu_umc_ras umc_v8_10_ras; 65e4b1edf4SYiPeng Chai extern const uint32_t 66e4b1edf4SYiPeng Chai umc_v8_10_channel_idx_tbl[] 67e4b1edf4SYiPeng Chai [UMC_V8_10_UMC_INSTANCE_NUM] 68e4b1edf4SYiPeng Chai [UMC_V8_10_CHANNEL_INSTANCE_NUM]; 69e4b1edf4SYiPeng Chai 70b6da3c58SYiPeng Chai extern const uint32_t 71b6da3c58SYiPeng Chai umc_v8_10_channel_idx_tbl_ext0[] 72b6da3c58SYiPeng Chai [UMC_V8_10_UMC_INSTANCE_NUM] 73b6da3c58SYiPeng Chai [UMC_V8_10_CHANNEL_INSTANCE_NUM]; 74e4b1edf4SYiPeng Chai #endif 75e4b1edf4SYiPeng Chai 76