18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2019 Red Hat 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#include <core/subdev.h> 238c2ecf20Sopenharmony_ci#include <nvfw/acr.h> 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_civoid 268c2ecf20Sopenharmony_ciwpr_header_dump(struct nvkm_subdev *subdev, const struct wpr_header *hdr) 278c2ecf20Sopenharmony_ci{ 288c2ecf20Sopenharmony_ci nvkm_debug(subdev, "wprHeader\n"); 298c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tfalconID : %d\n", hdr->falcon_id); 308c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tlsbOffset : 0x%x\n", hdr->lsb_offset); 318c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tbootstrapOwner: %d\n", hdr->bootstrap_owner); 328c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tlazyBootstrap : %d\n", hdr->lazy_bootstrap); 338c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tstatus : %d\n", hdr->status); 348c2ecf20Sopenharmony_ci} 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_civoid 378c2ecf20Sopenharmony_ciwpr_header_v1_dump(struct nvkm_subdev *subdev, const struct wpr_header_v1 *hdr) 388c2ecf20Sopenharmony_ci{ 398c2ecf20Sopenharmony_ci nvkm_debug(subdev, "wprHeader\n"); 408c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tfalconID : %d\n", hdr->falcon_id); 418c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tlsbOffset : 0x%x\n", hdr->lsb_offset); 428c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tbootstrapOwner: %d\n", hdr->bootstrap_owner); 438c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tlazyBootstrap : %d\n", hdr->lazy_bootstrap); 448c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tbinVersion : %d\n", hdr->bin_version); 458c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tstatus : %d\n", hdr->status); 468c2ecf20Sopenharmony_ci} 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_cistatic void 498c2ecf20Sopenharmony_cilsb_header_tail_dump(struct nvkm_subdev *subdev, struct lsb_header_tail *hdr) 508c2ecf20Sopenharmony_ci{ 518c2ecf20Sopenharmony_ci nvkm_debug(subdev, "lsbHeader\n"); 528c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tucodeOff : 0x%x\n", hdr->ucode_off); 538c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tucodeSize : 0x%x\n", hdr->ucode_size); 548c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tdataSize : 0x%x\n", hdr->data_size); 558c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tblCodeSize : 0x%x\n", hdr->bl_code_size); 568c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tblImemOff : 0x%x\n", hdr->bl_imem_off); 578c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tblDataOff : 0x%x\n", hdr->bl_data_off); 588c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tblDataSize : 0x%x\n", hdr->bl_data_size); 598c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tappCodeOff : 0x%x\n", hdr->app_code_off); 608c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tappCodeSize : 0x%x\n", hdr->app_code_size); 618c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tappDataOff : 0x%x\n", hdr->app_data_off); 628c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tappDataSize : 0x%x\n", hdr->app_data_size); 638c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tflags : 0x%x\n", hdr->flags); 648c2ecf20Sopenharmony_ci} 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_civoid 678c2ecf20Sopenharmony_cilsb_header_dump(struct nvkm_subdev *subdev, struct lsb_header *hdr) 688c2ecf20Sopenharmony_ci{ 698c2ecf20Sopenharmony_ci lsb_header_tail_dump(subdev, &hdr->tail); 708c2ecf20Sopenharmony_ci} 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_civoid 738c2ecf20Sopenharmony_cilsb_header_v1_dump(struct nvkm_subdev *subdev, struct lsb_header_v1 *hdr) 748c2ecf20Sopenharmony_ci{ 758c2ecf20Sopenharmony_ci lsb_header_tail_dump(subdev, &hdr->tail); 768c2ecf20Sopenharmony_ci} 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_civoid 798c2ecf20Sopenharmony_ciflcn_acr_desc_dump(struct nvkm_subdev *subdev, struct flcn_acr_desc *hdr) 808c2ecf20Sopenharmony_ci{ 818c2ecf20Sopenharmony_ci int i; 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci nvkm_debug(subdev, "acrDesc\n"); 848c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\twprRegionId : %d\n", hdr->wpr_region_id); 858c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\twprOffset : 0x%x\n", hdr->wpr_offset); 868c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tmmuMemRange : 0x%x\n", 878c2ecf20Sopenharmony_ci hdr->mmu_mem_range); 888c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tnoRegions : %d\n", 898c2ecf20Sopenharmony_ci hdr->regions.no_regions); 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(hdr->regions.region_props); i++) { 928c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tregion[%d] :\n", i); 938c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\t startAddr : 0x%x\n", 948c2ecf20Sopenharmony_ci hdr->regions.region_props[i].start_addr); 958c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\t endAddr : 0x%x\n", 968c2ecf20Sopenharmony_ci hdr->regions.region_props[i].end_addr); 978c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\t regionId : %d\n", 988c2ecf20Sopenharmony_ci hdr->regions.region_props[i].region_id); 998c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\t readMask : 0x%x\n", 1008c2ecf20Sopenharmony_ci hdr->regions.region_props[i].read_mask); 1018c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\t writeMask : 0x%x\n", 1028c2ecf20Sopenharmony_ci hdr->regions.region_props[i].write_mask); 1038c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\t clientMask : 0x%x\n", 1048c2ecf20Sopenharmony_ci hdr->regions.region_props[i].client_mask); 1058c2ecf20Sopenharmony_ci } 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tucodeBlobSize: %d\n", 1088c2ecf20Sopenharmony_ci hdr->ucode_blob_size); 1098c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tucodeBlobBase: 0x%llx\n", 1108c2ecf20Sopenharmony_ci hdr->ucode_blob_base); 1118c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tvprEnabled : %d\n", 1128c2ecf20Sopenharmony_ci hdr->vpr_desc.vpr_enabled); 1138c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tvprStart : 0x%x\n", 1148c2ecf20Sopenharmony_ci hdr->vpr_desc.vpr_start); 1158c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tvprEnd : 0x%x\n", 1168c2ecf20Sopenharmony_ci hdr->vpr_desc.vpr_end); 1178c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\thdcpPolicies : 0x%x\n", 1188c2ecf20Sopenharmony_ci hdr->vpr_desc.hdcp_policies); 1198c2ecf20Sopenharmony_ci} 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_civoid 1228c2ecf20Sopenharmony_ciflcn_acr_desc_v1_dump(struct nvkm_subdev *subdev, struct flcn_acr_desc_v1 *hdr) 1238c2ecf20Sopenharmony_ci{ 1248c2ecf20Sopenharmony_ci int i; 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci nvkm_debug(subdev, "acrDesc\n"); 1278c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\twprRegionId : %d\n", hdr->wpr_region_id); 1288c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\twprOffset : 0x%x\n", hdr->wpr_offset); 1298c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tmmuMemoryRange : 0x%x\n", 1308c2ecf20Sopenharmony_ci hdr->mmu_memory_range); 1318c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tnoRegions : %d\n", 1328c2ecf20Sopenharmony_ci hdr->regions.no_regions); 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(hdr->regions.region_props); i++) { 1358c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tregion[%d] :\n", i); 1368c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\t startAddr : 0x%x\n", 1378c2ecf20Sopenharmony_ci hdr->regions.region_props[i].start_addr); 1388c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\t endAddr : 0x%x\n", 1398c2ecf20Sopenharmony_ci hdr->regions.region_props[i].end_addr); 1408c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\t regionId : %d\n", 1418c2ecf20Sopenharmony_ci hdr->regions.region_props[i].region_id); 1428c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\t readMask : 0x%x\n", 1438c2ecf20Sopenharmony_ci hdr->regions.region_props[i].read_mask); 1448c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\t writeMask : 0x%x\n", 1458c2ecf20Sopenharmony_ci hdr->regions.region_props[i].write_mask); 1468c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\t clientMask : 0x%x\n", 1478c2ecf20Sopenharmony_ci hdr->regions.region_props[i].client_mask); 1488c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\t shadowMemStartAddr: 0x%x\n", 1498c2ecf20Sopenharmony_ci hdr->regions.region_props[i].shadow_mem_start_addr); 1508c2ecf20Sopenharmony_ci } 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tucodeBlobSize : %d\n", 1538c2ecf20Sopenharmony_ci hdr->ucode_blob_size); 1548c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tucodeBlobBase : 0x%llx\n", 1558c2ecf20Sopenharmony_ci hdr->ucode_blob_base); 1568c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tvprEnabled : %d\n", 1578c2ecf20Sopenharmony_ci hdr->vpr_desc.vpr_enabled); 1588c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tvprStart : 0x%x\n", 1598c2ecf20Sopenharmony_ci hdr->vpr_desc.vpr_start); 1608c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\tvprEnd : 0x%x\n", 1618c2ecf20Sopenharmony_ci hdr->vpr_desc.vpr_end); 1628c2ecf20Sopenharmony_ci nvkm_debug(subdev, "\thdcpPolicies : 0x%x\n", 1638c2ecf20Sopenharmony_ci hdr->vpr_desc.hdcp_policies); 1648c2ecf20Sopenharmony_ci} 165