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/flcn.h>
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_civoid
2662306a36Sopenharmony_ciloader_config_dump(struct nvkm_subdev *subdev, const struct loader_config *hdr)
2762306a36Sopenharmony_ci{
2862306a36Sopenharmony_ci	nvkm_debug(subdev, "loaderConfig\n");
2962306a36Sopenharmony_ci	nvkm_debug(subdev, "\tdmaIdx        : %d\n", hdr->dma_idx);
3062306a36Sopenharmony_ci	nvkm_debug(subdev, "\tcodeDmaBase   : 0x%xx\n", hdr->code_dma_base);
3162306a36Sopenharmony_ci	nvkm_debug(subdev, "\tcodeSizeTotal : 0x%x\n", hdr->code_size_total);
3262306a36Sopenharmony_ci	nvkm_debug(subdev, "\tcodeSizeToLoad: 0x%x\n", hdr->code_size_to_load);
3362306a36Sopenharmony_ci	nvkm_debug(subdev, "\tcodeEntryPoint: 0x%x\n", hdr->code_entry_point);
3462306a36Sopenharmony_ci	nvkm_debug(subdev, "\tdataDmaBase   : 0x%x\n", hdr->data_dma_base);
3562306a36Sopenharmony_ci	nvkm_debug(subdev, "\tdataSize      : 0x%x\n", hdr->data_size);
3662306a36Sopenharmony_ci	nvkm_debug(subdev, "\toverlayDmaBase: 0x%x\n", hdr->overlay_dma_base);
3762306a36Sopenharmony_ci	nvkm_debug(subdev, "\targc          : 0x%08x\n", hdr->argc);
3862306a36Sopenharmony_ci	nvkm_debug(subdev, "\targv          : 0x%08x\n", hdr->argv);
3962306a36Sopenharmony_ci	nvkm_debug(subdev, "\tcodeDmaBase1  : 0x%x\n", hdr->code_dma_base1);
4062306a36Sopenharmony_ci	nvkm_debug(subdev, "\tdataDmaBase1  : 0x%x\n", hdr->data_dma_base1);
4162306a36Sopenharmony_ci	nvkm_debug(subdev, "\tovlyDmaBase1  : 0x%x\n", hdr->overlay_dma_base1);
4262306a36Sopenharmony_ci}
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_civoid
4562306a36Sopenharmony_ciloader_config_v1_dump(struct nvkm_subdev *subdev,
4662306a36Sopenharmony_ci		      const struct loader_config_v1 *hdr)
4762306a36Sopenharmony_ci{
4862306a36Sopenharmony_ci	nvkm_debug(subdev, "loaderConfig\n");
4962306a36Sopenharmony_ci	nvkm_debug(subdev, "\treserved      : 0x%08x\n", hdr->reserved);
5062306a36Sopenharmony_ci	nvkm_debug(subdev, "\tdmaIdx        : %d\n", hdr->dma_idx);
5162306a36Sopenharmony_ci	nvkm_debug(subdev, "\tcodeDmaBase   : 0x%llxx\n", hdr->code_dma_base);
5262306a36Sopenharmony_ci	nvkm_debug(subdev, "\tcodeSizeTotal : 0x%x\n", hdr->code_size_total);
5362306a36Sopenharmony_ci	nvkm_debug(subdev, "\tcodeSizeToLoad: 0x%x\n", hdr->code_size_to_load);
5462306a36Sopenharmony_ci	nvkm_debug(subdev, "\tcodeEntryPoint: 0x%x\n", hdr->code_entry_point);
5562306a36Sopenharmony_ci	nvkm_debug(subdev, "\tdataDmaBase   : 0x%llx\n", hdr->data_dma_base);
5662306a36Sopenharmony_ci	nvkm_debug(subdev, "\tdataSize      : 0x%x\n", hdr->data_size);
5762306a36Sopenharmony_ci	nvkm_debug(subdev, "\toverlayDmaBase: 0x%llx\n", hdr->overlay_dma_base);
5862306a36Sopenharmony_ci	nvkm_debug(subdev, "\targc          : 0x%08x\n", hdr->argc);
5962306a36Sopenharmony_ci	nvkm_debug(subdev, "\targv          : 0x%08x\n", hdr->argv);
6062306a36Sopenharmony_ci}
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_civoid
6362306a36Sopenharmony_ciflcn_bl_dmem_desc_dump(struct nvkm_subdev *subdev,
6462306a36Sopenharmony_ci		       const struct flcn_bl_dmem_desc *hdr)
6562306a36Sopenharmony_ci{
6662306a36Sopenharmony_ci	nvkm_debug(subdev, "flcnBlDmemDesc\n");
6762306a36Sopenharmony_ci	nvkm_debug(subdev, "\treserved      : 0x%08x 0x%08x 0x%08x 0x%08x\n",
6862306a36Sopenharmony_ci		   hdr->reserved[0], hdr->reserved[1], hdr->reserved[2],
6962306a36Sopenharmony_ci		   hdr->reserved[3]);
7062306a36Sopenharmony_ci	nvkm_debug(subdev, "\tsignature     : 0x%08x 0x%08x 0x%08x 0x%08x\n",
7162306a36Sopenharmony_ci		   hdr->signature[0], hdr->signature[1], hdr->signature[2],
7262306a36Sopenharmony_ci		   hdr->signature[3]);
7362306a36Sopenharmony_ci	nvkm_debug(subdev, "\tctxDma        : %d\n", hdr->ctx_dma);
7462306a36Sopenharmony_ci	nvkm_debug(subdev, "\tcodeDmaBase   : 0x%x\n", hdr->code_dma_base);
7562306a36Sopenharmony_ci	nvkm_debug(subdev, "\tnonSecCodeOff : 0x%x\n", hdr->non_sec_code_off);
7662306a36Sopenharmony_ci	nvkm_debug(subdev, "\tnonSecCodeSize: 0x%x\n", hdr->non_sec_code_size);
7762306a36Sopenharmony_ci	nvkm_debug(subdev, "\tsecCodeOff    : 0x%x\n", hdr->sec_code_off);
7862306a36Sopenharmony_ci	nvkm_debug(subdev, "\tsecCodeSize   : 0x%x\n", hdr->sec_code_size);
7962306a36Sopenharmony_ci	nvkm_debug(subdev, "\tcodeEntryPoint: 0x%x\n", hdr->code_entry_point);
8062306a36Sopenharmony_ci	nvkm_debug(subdev, "\tdataDmaBase   : 0x%x\n", hdr->data_dma_base);
8162306a36Sopenharmony_ci	nvkm_debug(subdev, "\tdataSize      : 0x%x\n", hdr->data_size);
8262306a36Sopenharmony_ci	nvkm_debug(subdev, "\tcodeDmaBase1  : 0x%x\n", hdr->code_dma_base1);
8362306a36Sopenharmony_ci	nvkm_debug(subdev, "\tdataDmaBase1  : 0x%x\n", hdr->data_dma_base1);
8462306a36Sopenharmony_ci}
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_civoid
8762306a36Sopenharmony_ciflcn_bl_dmem_desc_v1_dump(struct nvkm_subdev *subdev,
8862306a36Sopenharmony_ci			  const struct flcn_bl_dmem_desc_v1 *hdr)
8962306a36Sopenharmony_ci{
9062306a36Sopenharmony_ci	nvkm_debug(subdev, "flcnBlDmemDesc\n");
9162306a36Sopenharmony_ci	nvkm_debug(subdev, "\treserved      : 0x%08x 0x%08x 0x%08x 0x%08x\n",
9262306a36Sopenharmony_ci		   hdr->reserved[0], hdr->reserved[1], hdr->reserved[2],
9362306a36Sopenharmony_ci		   hdr->reserved[3]);
9462306a36Sopenharmony_ci	nvkm_debug(subdev, "\tsignature     : 0x%08x 0x%08x 0x%08x 0x%08x\n",
9562306a36Sopenharmony_ci		   hdr->signature[0], hdr->signature[1], hdr->signature[2],
9662306a36Sopenharmony_ci		   hdr->signature[3]);
9762306a36Sopenharmony_ci	nvkm_debug(subdev, "\tctxDma        : %d\n", hdr->ctx_dma);
9862306a36Sopenharmony_ci	nvkm_debug(subdev, "\tcodeDmaBase   : 0x%llx\n", hdr->code_dma_base);
9962306a36Sopenharmony_ci	nvkm_debug(subdev, "\tnonSecCodeOff : 0x%x\n", hdr->non_sec_code_off);
10062306a36Sopenharmony_ci	nvkm_debug(subdev, "\tnonSecCodeSize: 0x%x\n", hdr->non_sec_code_size);
10162306a36Sopenharmony_ci	nvkm_debug(subdev, "\tsecCodeOff    : 0x%x\n", hdr->sec_code_off);
10262306a36Sopenharmony_ci	nvkm_debug(subdev, "\tsecCodeSize   : 0x%x\n", hdr->sec_code_size);
10362306a36Sopenharmony_ci	nvkm_debug(subdev, "\tcodeEntryPoint: 0x%x\n", hdr->code_entry_point);
10462306a36Sopenharmony_ci	nvkm_debug(subdev, "\tdataDmaBase   : 0x%llx\n", hdr->data_dma_base);
10562306a36Sopenharmony_ci	nvkm_debug(subdev, "\tdataSize      : 0x%x\n", hdr->data_size);
10662306a36Sopenharmony_ci}
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_civoid
10962306a36Sopenharmony_ciflcn_bl_dmem_desc_v2_dump(struct nvkm_subdev *subdev,
11062306a36Sopenharmony_ci			  const struct flcn_bl_dmem_desc_v2 *hdr)
11162306a36Sopenharmony_ci{
11262306a36Sopenharmony_ci	flcn_bl_dmem_desc_v1_dump(subdev, (void *)hdr);
11362306a36Sopenharmony_ci	nvkm_debug(subdev, "\targc          : 0x%08x\n", hdr->argc);
11462306a36Sopenharmony_ci	nvkm_debug(subdev, "\targv          : 0x%08x\n", hdr->argv);
11562306a36Sopenharmony_ci}
116