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/flcn.h>
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_civoid
268c2ecf20Sopenharmony_ciloader_config_dump(struct nvkm_subdev *subdev, const struct loader_config *hdr)
278c2ecf20Sopenharmony_ci{
288c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "loaderConfig\n");
298c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tdmaIdx        : %d\n", hdr->dma_idx);
308c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tcodeDmaBase   : 0x%xx\n", hdr->code_dma_base);
318c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tcodeSizeTotal : 0x%x\n", hdr->code_size_total);
328c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tcodeSizeToLoad: 0x%x\n", hdr->code_size_to_load);
338c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tcodeEntryPoint: 0x%x\n", hdr->code_entry_point);
348c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tdataDmaBase   : 0x%x\n", hdr->data_dma_base);
358c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tdataSize      : 0x%x\n", hdr->data_size);
368c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\toverlayDmaBase: 0x%x\n", hdr->overlay_dma_base);
378c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\targc          : 0x%08x\n", hdr->argc);
388c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\targv          : 0x%08x\n", hdr->argv);
398c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tcodeDmaBase1  : 0x%x\n", hdr->code_dma_base1);
408c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tdataDmaBase1  : 0x%x\n", hdr->data_dma_base1);
418c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tovlyDmaBase1  : 0x%x\n", hdr->overlay_dma_base1);
428c2ecf20Sopenharmony_ci}
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_civoid
458c2ecf20Sopenharmony_ciloader_config_v1_dump(struct nvkm_subdev *subdev,
468c2ecf20Sopenharmony_ci		      const struct loader_config_v1 *hdr)
478c2ecf20Sopenharmony_ci{
488c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "loaderConfig\n");
498c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\treserved      : 0x%08x\n", hdr->reserved);
508c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tdmaIdx        : %d\n", hdr->dma_idx);
518c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tcodeDmaBase   : 0x%llxx\n", hdr->code_dma_base);
528c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tcodeSizeTotal : 0x%x\n", hdr->code_size_total);
538c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tcodeSizeToLoad: 0x%x\n", hdr->code_size_to_load);
548c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tcodeEntryPoint: 0x%x\n", hdr->code_entry_point);
558c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tdataDmaBase   : 0x%llx\n", hdr->data_dma_base);
568c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tdataSize      : 0x%x\n", hdr->data_size);
578c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\toverlayDmaBase: 0x%llx\n", hdr->overlay_dma_base);
588c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\targc          : 0x%08x\n", hdr->argc);
598c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\targv          : 0x%08x\n", hdr->argv);
608c2ecf20Sopenharmony_ci}
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_civoid
638c2ecf20Sopenharmony_ciflcn_bl_dmem_desc_dump(struct nvkm_subdev *subdev,
648c2ecf20Sopenharmony_ci		       const struct flcn_bl_dmem_desc *hdr)
658c2ecf20Sopenharmony_ci{
668c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "flcnBlDmemDesc\n");
678c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\treserved      : 0x%08x 0x%08x 0x%08x 0x%08x\n",
688c2ecf20Sopenharmony_ci		   hdr->reserved[0], hdr->reserved[1], hdr->reserved[2],
698c2ecf20Sopenharmony_ci		   hdr->reserved[3]);
708c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tsignature     : 0x%08x 0x%08x 0x%08x 0x%08x\n",
718c2ecf20Sopenharmony_ci		   hdr->signature[0], hdr->signature[1], hdr->signature[2],
728c2ecf20Sopenharmony_ci		   hdr->signature[3]);
738c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tctxDma        : %d\n", hdr->ctx_dma);
748c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tcodeDmaBase   : 0x%x\n", hdr->code_dma_base);
758c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tnonSecCodeOff : 0x%x\n", hdr->non_sec_code_off);
768c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tnonSecCodeSize: 0x%x\n", hdr->non_sec_code_size);
778c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tsecCodeOff    : 0x%x\n", hdr->sec_code_off);
788c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tsecCodeSize   : 0x%x\n", hdr->sec_code_size);
798c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tcodeEntryPoint: 0x%x\n", hdr->code_entry_point);
808c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tdataDmaBase   : 0x%x\n", hdr->data_dma_base);
818c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tdataSize      : 0x%x\n", hdr->data_size);
828c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tcodeDmaBase1  : 0x%x\n", hdr->code_dma_base1);
838c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tdataDmaBase1  : 0x%x\n", hdr->data_dma_base1);
848c2ecf20Sopenharmony_ci}
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_civoid
878c2ecf20Sopenharmony_ciflcn_bl_dmem_desc_v1_dump(struct nvkm_subdev *subdev,
888c2ecf20Sopenharmony_ci			  const struct flcn_bl_dmem_desc_v1 *hdr)
898c2ecf20Sopenharmony_ci{
908c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "flcnBlDmemDesc\n");
918c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\treserved      : 0x%08x 0x%08x 0x%08x 0x%08x\n",
928c2ecf20Sopenharmony_ci		   hdr->reserved[0], hdr->reserved[1], hdr->reserved[2],
938c2ecf20Sopenharmony_ci		   hdr->reserved[3]);
948c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tsignature     : 0x%08x 0x%08x 0x%08x 0x%08x\n",
958c2ecf20Sopenharmony_ci		   hdr->signature[0], hdr->signature[1], hdr->signature[2],
968c2ecf20Sopenharmony_ci		   hdr->signature[3]);
978c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tctxDma        : %d\n", hdr->ctx_dma);
988c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tcodeDmaBase   : 0x%llx\n", hdr->code_dma_base);
998c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tnonSecCodeOff : 0x%x\n", hdr->non_sec_code_off);
1008c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tnonSecCodeSize: 0x%x\n", hdr->non_sec_code_size);
1018c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tsecCodeOff    : 0x%x\n", hdr->sec_code_off);
1028c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tsecCodeSize   : 0x%x\n", hdr->sec_code_size);
1038c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tcodeEntryPoint: 0x%x\n", hdr->code_entry_point);
1048c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tdataDmaBase   : 0x%llx\n", hdr->data_dma_base);
1058c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\tdataSize      : 0x%x\n", hdr->data_size);
1068c2ecf20Sopenharmony_ci}
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_civoid
1098c2ecf20Sopenharmony_ciflcn_bl_dmem_desc_v2_dump(struct nvkm_subdev *subdev,
1108c2ecf20Sopenharmony_ci			  const struct flcn_bl_dmem_desc_v2 *hdr)
1118c2ecf20Sopenharmony_ci{
1128c2ecf20Sopenharmony_ci	flcn_bl_dmem_desc_v1_dump(subdev, (void *)hdr);
1138c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\targc          : 0x%08x\n", hdr->argc);
1148c2ecf20Sopenharmony_ci	nvkm_debug(subdev, "\targv          : 0x%08x\n", hdr->argv);
1158c2ecf20Sopenharmony_ci}
116