162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright 2019 Red Hat Inc. 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 562306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 662306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation 762306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 862306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 962306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in 1262306a36Sopenharmony_ci * all copies or substantial portions of the Software. 1362306a36Sopenharmony_ci * 1462306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1562306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1662306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1762306a36Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 1862306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1962306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2062306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 2162306a36Sopenharmony_ci */ 2262306a36Sopenharmony_ci#include <core/subdev.h> 2362306a36Sopenharmony_ci#include <nvfw/acr.h> 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_civoid 2662306a36Sopenharmony_ciwpr_header_dump(struct nvkm_subdev *subdev, const struct wpr_header *hdr) 2762306a36Sopenharmony_ci{ 2862306a36Sopenharmony_ci nvkm_debug(subdev, "wprHeader\n"); 2962306a36Sopenharmony_ci nvkm_debug(subdev, "\tfalconID : %d\n", hdr->falcon_id); 3062306a36Sopenharmony_ci nvkm_debug(subdev, "\tlsbOffset : 0x%x\n", hdr->lsb_offset); 3162306a36Sopenharmony_ci nvkm_debug(subdev, "\tbootstrapOwner: %d\n", hdr->bootstrap_owner); 3262306a36Sopenharmony_ci nvkm_debug(subdev, "\tlazyBootstrap : %d\n", hdr->lazy_bootstrap); 3362306a36Sopenharmony_ci nvkm_debug(subdev, "\tstatus : %d\n", hdr->status); 3462306a36Sopenharmony_ci} 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_civoid 3762306a36Sopenharmony_ciwpr_header_v1_dump(struct nvkm_subdev *subdev, const struct wpr_header_v1 *hdr) 3862306a36Sopenharmony_ci{ 3962306a36Sopenharmony_ci nvkm_debug(subdev, "wprHeader\n"); 4062306a36Sopenharmony_ci nvkm_debug(subdev, "\tfalconID : %d\n", hdr->falcon_id); 4162306a36Sopenharmony_ci nvkm_debug(subdev, "\tlsbOffset : 0x%x\n", hdr->lsb_offset); 4262306a36Sopenharmony_ci nvkm_debug(subdev, "\tbootstrapOwner: %d\n", hdr->bootstrap_owner); 4362306a36Sopenharmony_ci nvkm_debug(subdev, "\tlazyBootstrap : %d\n", hdr->lazy_bootstrap); 4462306a36Sopenharmony_ci nvkm_debug(subdev, "\tbinVersion : %d\n", hdr->bin_version); 4562306a36Sopenharmony_ci nvkm_debug(subdev, "\tstatus : %d\n", hdr->status); 4662306a36Sopenharmony_ci} 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_cistatic void 4962306a36Sopenharmony_ciwpr_generic_header_dump(struct nvkm_subdev *subdev, const struct wpr_generic_header *hdr) 5062306a36Sopenharmony_ci{ 5162306a36Sopenharmony_ci nvkm_debug(subdev, "wprGenericHeader\n"); 5262306a36Sopenharmony_ci nvkm_debug(subdev, "\tidentifier : %04x\n", hdr->identifier); 5362306a36Sopenharmony_ci nvkm_debug(subdev, "\tversion : %04x\n", hdr->version); 5462306a36Sopenharmony_ci nvkm_debug(subdev, "\tsize : %08x\n", hdr->size); 5562306a36Sopenharmony_ci} 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_civoid 5862306a36Sopenharmony_ciwpr_header_v2_dump(struct nvkm_subdev *subdev, const struct wpr_header_v2 *hdr) 5962306a36Sopenharmony_ci{ 6062306a36Sopenharmony_ci wpr_generic_header_dump(subdev, &hdr->hdr); 6162306a36Sopenharmony_ci wpr_header_v1_dump(subdev, &hdr->wpr); 6262306a36Sopenharmony_ci} 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_civoid 6562306a36Sopenharmony_cilsb_header_v2_dump(struct nvkm_subdev *subdev, struct lsb_header_v2 *hdr) 6662306a36Sopenharmony_ci{ 6762306a36Sopenharmony_ci wpr_generic_header_dump(subdev, &hdr->hdr); 6862306a36Sopenharmony_ci nvkm_debug(subdev, "lsbHeader\n"); 6962306a36Sopenharmony_ci nvkm_debug(subdev, "\tucodeOff : 0x%x\n", hdr->ucode_off); 7062306a36Sopenharmony_ci nvkm_debug(subdev, "\tucodeSize : 0x%x\n", hdr->ucode_size); 7162306a36Sopenharmony_ci nvkm_debug(subdev, "\tdataSize : 0x%x\n", hdr->data_size); 7262306a36Sopenharmony_ci nvkm_debug(subdev, "\tblCodeSize : 0x%x\n", hdr->bl_code_size); 7362306a36Sopenharmony_ci nvkm_debug(subdev, "\tblImemOff : 0x%x\n", hdr->bl_imem_off); 7462306a36Sopenharmony_ci nvkm_debug(subdev, "\tblDataOff : 0x%x\n", hdr->bl_data_off); 7562306a36Sopenharmony_ci nvkm_debug(subdev, "\tblDataSize : 0x%x\n", hdr->bl_data_size); 7662306a36Sopenharmony_ci nvkm_debug(subdev, "\treserved0 : %08x\n", hdr->rsvd0); 7762306a36Sopenharmony_ci nvkm_debug(subdev, "\tappCodeOff : 0x%x\n", hdr->app_code_off); 7862306a36Sopenharmony_ci nvkm_debug(subdev, "\tappCodeSize : 0x%x\n", hdr->app_code_size); 7962306a36Sopenharmony_ci nvkm_debug(subdev, "\tappDataOff : 0x%x\n", hdr->app_data_off); 8062306a36Sopenharmony_ci nvkm_debug(subdev, "\tappDataSize : 0x%x\n", hdr->app_data_size); 8162306a36Sopenharmony_ci nvkm_debug(subdev, "\tappImemOffset : 0x%x\n", hdr->app_imem_offset); 8262306a36Sopenharmony_ci nvkm_debug(subdev, "\tappDmemOffset : 0x%x\n", hdr->app_dmem_offset); 8362306a36Sopenharmony_ci nvkm_debug(subdev, "\tflags : 0x%x\n", hdr->flags); 8462306a36Sopenharmony_ci nvkm_debug(subdev, "\tmonitorCodeOff: 0x%x\n", hdr->monitor_code_offset); 8562306a36Sopenharmony_ci nvkm_debug(subdev, "\tmonitorDataOff: 0x%x\n", hdr->monitor_data_offset); 8662306a36Sopenharmony_ci nvkm_debug(subdev, "\tmanifestOffset: 0x%x\n", hdr->manifest_offset); 8762306a36Sopenharmony_ci} 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_cistatic void 9062306a36Sopenharmony_cilsb_header_tail_dump(struct nvkm_subdev *subdev, struct lsb_header_tail *hdr) 9162306a36Sopenharmony_ci{ 9262306a36Sopenharmony_ci nvkm_debug(subdev, "lsbHeader\n"); 9362306a36Sopenharmony_ci nvkm_debug(subdev, "\tucodeOff : 0x%x\n", hdr->ucode_off); 9462306a36Sopenharmony_ci nvkm_debug(subdev, "\tucodeSize : 0x%x\n", hdr->ucode_size); 9562306a36Sopenharmony_ci nvkm_debug(subdev, "\tdataSize : 0x%x\n", hdr->data_size); 9662306a36Sopenharmony_ci nvkm_debug(subdev, "\tblCodeSize : 0x%x\n", hdr->bl_code_size); 9762306a36Sopenharmony_ci nvkm_debug(subdev, "\tblImemOff : 0x%x\n", hdr->bl_imem_off); 9862306a36Sopenharmony_ci nvkm_debug(subdev, "\tblDataOff : 0x%x\n", hdr->bl_data_off); 9962306a36Sopenharmony_ci nvkm_debug(subdev, "\tblDataSize : 0x%x\n", hdr->bl_data_size); 10062306a36Sopenharmony_ci nvkm_debug(subdev, "\tappCodeOff : 0x%x\n", hdr->app_code_off); 10162306a36Sopenharmony_ci nvkm_debug(subdev, "\tappCodeSize : 0x%x\n", hdr->app_code_size); 10262306a36Sopenharmony_ci nvkm_debug(subdev, "\tappDataOff : 0x%x\n", hdr->app_data_off); 10362306a36Sopenharmony_ci nvkm_debug(subdev, "\tappDataSize : 0x%x\n", hdr->app_data_size); 10462306a36Sopenharmony_ci nvkm_debug(subdev, "\tflags : 0x%x\n", hdr->flags); 10562306a36Sopenharmony_ci} 10662306a36Sopenharmony_ci 10762306a36Sopenharmony_civoid 10862306a36Sopenharmony_cilsb_header_dump(struct nvkm_subdev *subdev, struct lsb_header *hdr) 10962306a36Sopenharmony_ci{ 11062306a36Sopenharmony_ci lsb_header_tail_dump(subdev, &hdr->tail); 11162306a36Sopenharmony_ci} 11262306a36Sopenharmony_ci 11362306a36Sopenharmony_civoid 11462306a36Sopenharmony_cilsb_header_v1_dump(struct nvkm_subdev *subdev, struct lsb_header_v1 *hdr) 11562306a36Sopenharmony_ci{ 11662306a36Sopenharmony_ci lsb_header_tail_dump(subdev, &hdr->tail); 11762306a36Sopenharmony_ci} 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_civoid 12062306a36Sopenharmony_ciflcn_acr_desc_dump(struct nvkm_subdev *subdev, struct flcn_acr_desc *hdr) 12162306a36Sopenharmony_ci{ 12262306a36Sopenharmony_ci int i; 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci nvkm_debug(subdev, "acrDesc\n"); 12562306a36Sopenharmony_ci nvkm_debug(subdev, "\twprRegionId : %d\n", hdr->wpr_region_id); 12662306a36Sopenharmony_ci nvkm_debug(subdev, "\twprOffset : 0x%x\n", hdr->wpr_offset); 12762306a36Sopenharmony_ci nvkm_debug(subdev, "\tmmuMemRange : 0x%x\n", 12862306a36Sopenharmony_ci hdr->mmu_mem_range); 12962306a36Sopenharmony_ci nvkm_debug(subdev, "\tnoRegions : %d\n", 13062306a36Sopenharmony_ci hdr->regions.no_regions); 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(hdr->regions.region_props); i++) { 13362306a36Sopenharmony_ci nvkm_debug(subdev, "\tregion[%d] :\n", i); 13462306a36Sopenharmony_ci nvkm_debug(subdev, "\t startAddr : 0x%x\n", 13562306a36Sopenharmony_ci hdr->regions.region_props[i].start_addr); 13662306a36Sopenharmony_ci nvkm_debug(subdev, "\t endAddr : 0x%x\n", 13762306a36Sopenharmony_ci hdr->regions.region_props[i].end_addr); 13862306a36Sopenharmony_ci nvkm_debug(subdev, "\t regionId : %d\n", 13962306a36Sopenharmony_ci hdr->regions.region_props[i].region_id); 14062306a36Sopenharmony_ci nvkm_debug(subdev, "\t readMask : 0x%x\n", 14162306a36Sopenharmony_ci hdr->regions.region_props[i].read_mask); 14262306a36Sopenharmony_ci nvkm_debug(subdev, "\t writeMask : 0x%x\n", 14362306a36Sopenharmony_ci hdr->regions.region_props[i].write_mask); 14462306a36Sopenharmony_ci nvkm_debug(subdev, "\t clientMask : 0x%x\n", 14562306a36Sopenharmony_ci hdr->regions.region_props[i].client_mask); 14662306a36Sopenharmony_ci } 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci nvkm_debug(subdev, "\tucodeBlobSize: %d\n", 14962306a36Sopenharmony_ci hdr->ucode_blob_size); 15062306a36Sopenharmony_ci nvkm_debug(subdev, "\tucodeBlobBase: 0x%llx\n", 15162306a36Sopenharmony_ci hdr->ucode_blob_base); 15262306a36Sopenharmony_ci nvkm_debug(subdev, "\tvprEnabled : %d\n", 15362306a36Sopenharmony_ci hdr->vpr_desc.vpr_enabled); 15462306a36Sopenharmony_ci nvkm_debug(subdev, "\tvprStart : 0x%x\n", 15562306a36Sopenharmony_ci hdr->vpr_desc.vpr_start); 15662306a36Sopenharmony_ci nvkm_debug(subdev, "\tvprEnd : 0x%x\n", 15762306a36Sopenharmony_ci hdr->vpr_desc.vpr_end); 15862306a36Sopenharmony_ci nvkm_debug(subdev, "\thdcpPolicies : 0x%x\n", 15962306a36Sopenharmony_ci hdr->vpr_desc.hdcp_policies); 16062306a36Sopenharmony_ci} 16162306a36Sopenharmony_ci 16262306a36Sopenharmony_civoid 16362306a36Sopenharmony_ciflcn_acr_desc_v1_dump(struct nvkm_subdev *subdev, struct flcn_acr_desc_v1 *hdr) 16462306a36Sopenharmony_ci{ 16562306a36Sopenharmony_ci int i; 16662306a36Sopenharmony_ci 16762306a36Sopenharmony_ci nvkm_debug(subdev, "acrDesc\n"); 16862306a36Sopenharmony_ci nvkm_debug(subdev, "\twprRegionId : %d\n", hdr->wpr_region_id); 16962306a36Sopenharmony_ci nvkm_debug(subdev, "\twprOffset : 0x%x\n", hdr->wpr_offset); 17062306a36Sopenharmony_ci nvkm_debug(subdev, "\tmmuMemoryRange : 0x%x\n", 17162306a36Sopenharmony_ci hdr->mmu_memory_range); 17262306a36Sopenharmony_ci nvkm_debug(subdev, "\tnoRegions : %d\n", 17362306a36Sopenharmony_ci hdr->regions.no_regions); 17462306a36Sopenharmony_ci 17562306a36Sopenharmony_ci for (i = 0; i < ARRAY_SIZE(hdr->regions.region_props); i++) { 17662306a36Sopenharmony_ci nvkm_debug(subdev, "\tregion[%d] :\n", i); 17762306a36Sopenharmony_ci nvkm_debug(subdev, "\t startAddr : 0x%x\n", 17862306a36Sopenharmony_ci hdr->regions.region_props[i].start_addr); 17962306a36Sopenharmony_ci nvkm_debug(subdev, "\t endAddr : 0x%x\n", 18062306a36Sopenharmony_ci hdr->regions.region_props[i].end_addr); 18162306a36Sopenharmony_ci nvkm_debug(subdev, "\t regionId : %d\n", 18262306a36Sopenharmony_ci hdr->regions.region_props[i].region_id); 18362306a36Sopenharmony_ci nvkm_debug(subdev, "\t readMask : 0x%x\n", 18462306a36Sopenharmony_ci hdr->regions.region_props[i].read_mask); 18562306a36Sopenharmony_ci nvkm_debug(subdev, "\t writeMask : 0x%x\n", 18662306a36Sopenharmony_ci hdr->regions.region_props[i].write_mask); 18762306a36Sopenharmony_ci nvkm_debug(subdev, "\t clientMask : 0x%x\n", 18862306a36Sopenharmony_ci hdr->regions.region_props[i].client_mask); 18962306a36Sopenharmony_ci nvkm_debug(subdev, "\t shadowMemStartAddr: 0x%x\n", 19062306a36Sopenharmony_ci hdr->regions.region_props[i].shadow_mem_start_addr); 19162306a36Sopenharmony_ci } 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_ci nvkm_debug(subdev, "\tucodeBlobSize : %d\n", 19462306a36Sopenharmony_ci hdr->ucode_blob_size); 19562306a36Sopenharmony_ci nvkm_debug(subdev, "\tucodeBlobBase : 0x%llx\n", 19662306a36Sopenharmony_ci hdr->ucode_blob_base); 19762306a36Sopenharmony_ci nvkm_debug(subdev, "\tvprEnabled : %d\n", 19862306a36Sopenharmony_ci hdr->vpr_desc.vpr_enabled); 19962306a36Sopenharmony_ci nvkm_debug(subdev, "\tvprStart : 0x%x\n", 20062306a36Sopenharmony_ci hdr->vpr_desc.vpr_start); 20162306a36Sopenharmony_ci nvkm_debug(subdev, "\tvprEnd : 0x%x\n", 20262306a36Sopenharmony_ci hdr->vpr_desc.vpr_end); 20362306a36Sopenharmony_ci nvkm_debug(subdev, "\thdcpPolicies : 0x%x\n", 20462306a36Sopenharmony_ci hdr->vpr_desc.hdcp_policies); 20562306a36Sopenharmony_ci} 206