18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2016 Advanced Micro Devices, Inc. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation 78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice shall be included in 128c2ecf20Sopenharmony_ci * all copies or substantial portions of the Software. 138c2ecf20Sopenharmony_ci * 148c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 158c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 168c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 178c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 188c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 198c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 208c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci */ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci#ifndef __SOC15_H__ 258c2ecf20Sopenharmony_ci#define __SOC15_H__ 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#include "nbio_v6_1.h" 288c2ecf20Sopenharmony_ci#include "nbio_v7_0.h" 298c2ecf20Sopenharmony_ci#include "nbio_v7_4.h" 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#define SOC15_FLUSH_GPU_TLB_NUM_WREG 6 328c2ecf20Sopenharmony_ci#define SOC15_FLUSH_GPU_TLB_NUM_REG_WAIT 3 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ciextern const struct amd_ip_funcs soc15_common_ip_funcs; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_cistruct soc15_reg_golden { 378c2ecf20Sopenharmony_ci u32 hwip; 388c2ecf20Sopenharmony_ci u32 instance; 398c2ecf20Sopenharmony_ci u32 segment; 408c2ecf20Sopenharmony_ci u32 reg; 418c2ecf20Sopenharmony_ci u32 and_mask; 428c2ecf20Sopenharmony_ci u32 or_mask; 438c2ecf20Sopenharmony_ci}; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_cistruct soc15_reg_rlcg { 468c2ecf20Sopenharmony_ci u32 hwip; 478c2ecf20Sopenharmony_ci u32 instance; 488c2ecf20Sopenharmony_ci u32 segment; 498c2ecf20Sopenharmony_ci u32 reg; 508c2ecf20Sopenharmony_ci}; 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_cistruct soc15_reg_entry { 538c2ecf20Sopenharmony_ci uint32_t hwip; 548c2ecf20Sopenharmony_ci uint32_t inst; 558c2ecf20Sopenharmony_ci uint32_t seg; 568c2ecf20Sopenharmony_ci uint32_t reg_offset; 578c2ecf20Sopenharmony_ci uint32_t reg_value; 588c2ecf20Sopenharmony_ci uint32_t se_num; 598c2ecf20Sopenharmony_ci uint32_t instance; 608c2ecf20Sopenharmony_ci}; 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_cistruct soc15_allowed_register_entry { 638c2ecf20Sopenharmony_ci uint32_t hwip; 648c2ecf20Sopenharmony_ci uint32_t inst; 658c2ecf20Sopenharmony_ci uint32_t seg; 668c2ecf20Sopenharmony_ci uint32_t reg_offset; 678c2ecf20Sopenharmony_ci bool grbm_indexed; 688c2ecf20Sopenharmony_ci}; 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_cistruct soc15_ras_field_entry { 718c2ecf20Sopenharmony_ci const char *name; 728c2ecf20Sopenharmony_ci uint32_t hwip; 738c2ecf20Sopenharmony_ci uint32_t inst; 748c2ecf20Sopenharmony_ci uint32_t seg; 758c2ecf20Sopenharmony_ci uint32_t reg_offset; 768c2ecf20Sopenharmony_ci uint32_t sec_count_mask; 778c2ecf20Sopenharmony_ci uint32_t sec_count_shift; 788c2ecf20Sopenharmony_ci uint32_t ded_count_mask; 798c2ecf20Sopenharmony_ci uint32_t ded_count_shift; 808c2ecf20Sopenharmony_ci}; 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci#define SOC15_REG_ENTRY(ip, inst, reg) ip##_HWIP, inst, reg##_BASE_IDX, reg 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci#define SOC15_REG_ENTRY_OFFSET(entry) (adev->reg_offset[entry.hwip][entry.inst][entry.seg] + entry.reg_offset) 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci#define SOC15_REG_GOLDEN_VALUE(ip, inst, reg, and_mask, or_mask) \ 878c2ecf20Sopenharmony_ci { ip##_HWIP, inst, reg##_BASE_IDX, reg, and_mask, or_mask } 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci#define SOC15_REG_FIELD(reg, field) reg##__##field##_MASK, reg##__##field##__SHIFT 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_civoid soc15_grbm_select(struct amdgpu_device *adev, 928c2ecf20Sopenharmony_ci u32 me, u32 pipe, u32 queue, u32 vmid); 938c2ecf20Sopenharmony_civoid soc15_set_virt_ops(struct amdgpu_device *adev); 948c2ecf20Sopenharmony_ciint soc15_set_ip_blocks(struct amdgpu_device *adev); 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_civoid soc15_program_register_sequence(struct amdgpu_device *adev, 978c2ecf20Sopenharmony_ci const struct soc15_reg_golden *registers, 988c2ecf20Sopenharmony_ci const u32 array_size); 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ciint vega10_reg_base_init(struct amdgpu_device *adev); 1018c2ecf20Sopenharmony_ciint vega20_reg_base_init(struct amdgpu_device *adev); 1028c2ecf20Sopenharmony_ciint arct_reg_base_init(struct amdgpu_device *adev); 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_civoid vega10_doorbell_index_init(struct amdgpu_device *adev); 1058c2ecf20Sopenharmony_civoid vega20_doorbell_index_init(struct amdgpu_device *adev); 1068c2ecf20Sopenharmony_ci#endif 107