xref: /openbmc/linux/drivers/gpu/drm/nouveau/nvkm/nvfw/hs.c (revision ee7da21a)
1 /*
2  * Copyright 2019 Red Hat Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  */
22 #include <core/subdev.h>
23 #include <nvfw/hs.h>
24 
25 const struct nvfw_hs_header *
26 nvfw_hs_header(struct nvkm_subdev *subdev, const void *data)
27 {
28 	const struct nvfw_hs_header *hdr = data;
29 	nvkm_debug(subdev, "hsHeader:\n");
30 	nvkm_debug(subdev, "\tsigDbgOffset     : 0x%x\n", hdr->sig_dbg_offset);
31 	nvkm_debug(subdev, "\tsigDbgSize       : 0x%x\n", hdr->sig_dbg_size);
32 	nvkm_debug(subdev, "\tsigProdOffset    : 0x%x\n", hdr->sig_prod_offset);
33 	nvkm_debug(subdev, "\tsigProdSize      : 0x%x\n", hdr->sig_prod_size);
34 	nvkm_debug(subdev, "\tpatchLoc         : 0x%x\n", hdr->patch_loc);
35 	nvkm_debug(subdev, "\tpatchSig         : 0x%x\n", hdr->patch_sig);
36 	nvkm_debug(subdev, "\thdrOffset        : 0x%x\n", hdr->hdr_offset);
37 	nvkm_debug(subdev, "\thdrSize          : 0x%x\n", hdr->hdr_size);
38 	return hdr;
39 }
40 
41 const struct nvfw_hs_load_header *
42 nvfw_hs_load_header(struct nvkm_subdev *subdev, const void *data)
43 {
44 	const struct nvfw_hs_load_header *hdr = data;
45 	int i;
46 
47 	nvkm_debug(subdev, "hsLoadHeader:\n");
48 	nvkm_debug(subdev, "\tnonSecCodeOff    : 0x%x\n",
49 			   hdr->non_sec_code_off);
50 	nvkm_debug(subdev, "\tnonSecCodeSize   : 0x%x\n",
51 			   hdr->non_sec_code_size);
52 	nvkm_debug(subdev, "\tdataDmaBase      : 0x%x\n", hdr->data_dma_base);
53 	nvkm_debug(subdev, "\tdataSize         : 0x%x\n", hdr->data_size);
54 	nvkm_debug(subdev, "\tnumApps          : 0x%x\n", hdr->num_apps);
55 	for (i = 0; i < hdr->num_apps; i++) {
56 		nvkm_debug(subdev,
57 			   "\tApp[%d]           : offset 0x%x size 0x%x\n", i,
58 			   hdr->apps[(i * 2) + 0], hdr->apps[(i * 2) + 1]);
59 	}
60 
61 	return hdr;
62 }
63