1*18eaea4bSHarry Wentland /* 2*18eaea4bSHarry Wentland * Copyright 2018 Advanced Micro Devices, Inc. 3*18eaea4bSHarry Wentland * 4*18eaea4bSHarry Wentland * Permission is hereby granted, free of charge, to any person obtaining a 5*18eaea4bSHarry Wentland * copy of this software and associated documentation files (the "Software"), 6*18eaea4bSHarry Wentland * to deal in the Software without restriction, including without limitation 7*18eaea4bSHarry Wentland * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8*18eaea4bSHarry Wentland * and/or sell copies of the Software, and to permit persons to whom the 9*18eaea4bSHarry Wentland * Software is furnished to do so, subject to the following conditions: 10*18eaea4bSHarry Wentland * 11*18eaea4bSHarry Wentland * The above copyright notice and this permission notice shall be included in 12*18eaea4bSHarry Wentland * all copies or substantial portions of the Software. 13*18eaea4bSHarry Wentland * 14*18eaea4bSHarry Wentland * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15*18eaea4bSHarry Wentland * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16*18eaea4bSHarry Wentland * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17*18eaea4bSHarry Wentland * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18*18eaea4bSHarry Wentland * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19*18eaea4bSHarry Wentland * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20*18eaea4bSHarry Wentland * OTHER DEALINGS IN THE SOFTWARE. 21*18eaea4bSHarry Wentland * 22*18eaea4bSHarry Wentland * Authors: AMD 23*18eaea4bSHarry Wentland * 24*18eaea4bSHarry Wentland */ 25*18eaea4bSHarry Wentland 26*18eaea4bSHarry Wentland #ifndef DAL_DC_DCN20_DCN20_VMID_H_ 27*18eaea4bSHarry Wentland #define DAL_DC_DCN20_DCN20_VMID_H_ 28*18eaea4bSHarry Wentland 29*18eaea4bSHarry Wentland #include "vmid.h" 30*18eaea4bSHarry Wentland 31*18eaea4bSHarry Wentland #define DCN20_VMID_REG_LIST(id)\ 32*18eaea4bSHarry Wentland SRI(CNTL, DCN_VM_CONTEXT, id),\ 33*18eaea4bSHarry Wentland SRI(PAGE_TABLE_BASE_ADDR_HI32, DCN_VM_CONTEXT, id),\ 34*18eaea4bSHarry Wentland SRI(PAGE_TABLE_BASE_ADDR_LO32, DCN_VM_CONTEXT, id),\ 35*18eaea4bSHarry Wentland SRI(PAGE_TABLE_START_ADDR_HI32, DCN_VM_CONTEXT, id),\ 36*18eaea4bSHarry Wentland SRI(PAGE_TABLE_START_ADDR_LO32, DCN_VM_CONTEXT, id),\ 37*18eaea4bSHarry Wentland SRI(PAGE_TABLE_END_ADDR_HI32, DCN_VM_CONTEXT, id),\ 38*18eaea4bSHarry Wentland SRI(PAGE_TABLE_END_ADDR_LO32, DCN_VM_CONTEXT, id) 39*18eaea4bSHarry Wentland 40*18eaea4bSHarry Wentland #define DCN20_VMID_MASK_SH_LIST(mask_sh)\ 41*18eaea4bSHarry Wentland SF(DCN_VM_CONTEXT0_CNTL, VM_CONTEXT0_PAGE_TABLE_DEPTH, mask_sh),\ 42*18eaea4bSHarry Wentland SF(DCN_VM_CONTEXT0_CNTL, VM_CONTEXT0_PAGE_TABLE_BLOCK_SIZE, mask_sh),\ 43*18eaea4bSHarry Wentland SF(DCN_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32, VM_CONTEXT0_PAGE_DIRECTORY_ENTRY_HI32, mask_sh),\ 44*18eaea4bSHarry Wentland SF(DCN_VM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32, VM_CONTEXT0_PAGE_DIRECTORY_ENTRY_LO32, mask_sh),\ 45*18eaea4bSHarry Wentland SF(DCN_VM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, VM_CONTEXT0_START_LOGICAL_PAGE_NUMBER_HI4, mask_sh),\ 46*18eaea4bSHarry Wentland SF(DCN_VM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, VM_CONTEXT0_START_LOGICAL_PAGE_NUMBER_LO32, mask_sh),\ 47*18eaea4bSHarry Wentland SF(DCN_VM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32, VM_CONTEXT0_END_LOGICAL_PAGE_NUMBER_HI4, mask_sh),\ 48*18eaea4bSHarry Wentland SF(DCN_VM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32, VM_CONTEXT0_END_LOGICAL_PAGE_NUMBER_LO32, mask_sh) 49*18eaea4bSHarry Wentland 50*18eaea4bSHarry Wentland #define DCN20_VMID_REG_FIELD_LIST(type)\ 51*18eaea4bSHarry Wentland type VM_CONTEXT0_PAGE_TABLE_DEPTH;\ 52*18eaea4bSHarry Wentland type VM_CONTEXT0_PAGE_TABLE_BLOCK_SIZE;\ 53*18eaea4bSHarry Wentland type VM_CONTEXT0_PAGE_DIRECTORY_ENTRY_HI32;\ 54*18eaea4bSHarry Wentland type VM_CONTEXT0_PAGE_DIRECTORY_ENTRY_LO32;\ 55*18eaea4bSHarry Wentland type VM_CONTEXT0_START_LOGICAL_PAGE_NUMBER_HI4;\ 56*18eaea4bSHarry Wentland type VM_CONTEXT0_START_LOGICAL_PAGE_NUMBER_LO32;\ 57*18eaea4bSHarry Wentland type VM_CONTEXT0_END_LOGICAL_PAGE_NUMBER_HI4;\ 58*18eaea4bSHarry Wentland type VM_CONTEXT0_END_LOGICAL_PAGE_NUMBER_LO32 59*18eaea4bSHarry Wentland 60*18eaea4bSHarry Wentland struct dcn20_vmid_shift { 61*18eaea4bSHarry Wentland DCN20_VMID_REG_FIELD_LIST(uint8_t); 62*18eaea4bSHarry Wentland }; 63*18eaea4bSHarry Wentland 64*18eaea4bSHarry Wentland struct dcn20_vmid_mask { 65*18eaea4bSHarry Wentland DCN20_VMID_REG_FIELD_LIST(uint32_t); 66*18eaea4bSHarry Wentland }; 67*18eaea4bSHarry Wentland 68*18eaea4bSHarry Wentland struct dcn20_vmid { 69*18eaea4bSHarry Wentland struct dc_context *ctx; 70*18eaea4bSHarry Wentland const struct dcn_vmid_registers *regs; 71*18eaea4bSHarry Wentland const struct dcn20_vmid_shift *shifts; 72*18eaea4bSHarry Wentland const struct dcn20_vmid_mask *masks; 73*18eaea4bSHarry Wentland }; 74*18eaea4bSHarry Wentland 75*18eaea4bSHarry Wentland void dcn20_vmid_setup(struct dcn20_vmid *vmid, const struct dcn_vmid_page_table_config *config); 76*18eaea4bSHarry Wentland 77*18eaea4bSHarry Wentland #endif /* DAL_DC_DCN20_DCN20_VMID_H_ */ 78