Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2019 Red Hat Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  */
0022 #include <core/subdev.h>
0023 #include <nvfw/ls.h>
0024 
0025 static void
0026 nvfw_ls_desc_head(struct nvkm_subdev *subdev,
0027           const struct nvfw_ls_desc_head *hdr)
0028 {
0029     char *date;
0030 
0031     nvkm_debug(subdev, "lsUcodeImgDesc:\n");
0032     nvkm_debug(subdev, "\tdescriptorSize       : %d\n",
0033                hdr->descriptor_size);
0034     nvkm_debug(subdev, "\timageSize            : %d\n", hdr->image_size);
0035     nvkm_debug(subdev, "\ttoolsVersion         : 0x%x\n",
0036                hdr->tools_version);
0037     nvkm_debug(subdev, "\tappVersion           : 0x%x\n", hdr->app_version);
0038 
0039     date = kstrndup(hdr->date, sizeof(hdr->date), GFP_KERNEL);
0040     nvkm_debug(subdev, "\tdate                 : %s\n", date);
0041     kfree(date);
0042 
0043     nvkm_debug(subdev, "\tbootloaderStartOffset: 0x%x\n",
0044                hdr->bootloader_start_offset);
0045     nvkm_debug(subdev, "\tbootloaderSize       : 0x%x\n",
0046                hdr->bootloader_size);
0047     nvkm_debug(subdev, "\tbootloaderImemOffset : 0x%x\n",
0048                hdr->bootloader_imem_offset);
0049     nvkm_debug(subdev, "\tbootloaderEntryPoint : 0x%x\n",
0050                hdr->bootloader_entry_point);
0051 
0052     nvkm_debug(subdev, "\tappStartOffset       : 0x%x\n",
0053                hdr->app_start_offset);
0054     nvkm_debug(subdev, "\tappSize              : 0x%x\n", hdr->app_size);
0055     nvkm_debug(subdev, "\tappImemOffset        : 0x%x\n",
0056                hdr->app_imem_offset);
0057     nvkm_debug(subdev, "\tappImemEntry         : 0x%x\n",
0058                hdr->app_imem_entry);
0059     nvkm_debug(subdev, "\tappDmemOffset        : 0x%x\n",
0060                hdr->app_dmem_offset);
0061     nvkm_debug(subdev, "\tappResidentCodeOffset: 0x%x\n",
0062                hdr->app_resident_code_offset);
0063     nvkm_debug(subdev, "\tappResidentCodeSize  : 0x%x\n",
0064                hdr->app_resident_code_size);
0065     nvkm_debug(subdev, "\tappResidentDataOffset: 0x%x\n",
0066                hdr->app_resident_data_offset);
0067     nvkm_debug(subdev, "\tappResidentDataSize  : 0x%x\n",
0068                hdr->app_resident_data_size);
0069 }
0070 
0071 const struct nvfw_ls_desc *
0072 nvfw_ls_desc(struct nvkm_subdev *subdev, const void *data)
0073 {
0074     const struct nvfw_ls_desc *hdr = data;
0075     int i;
0076 
0077     nvfw_ls_desc_head(subdev, &hdr->head);
0078 
0079     nvkm_debug(subdev, "\tnbOverlays           : %d\n", hdr->nb_overlays);
0080     for (i = 0; i < ARRAY_SIZE(hdr->load_ovl); i++) {
0081         nvkm_debug(subdev, "\tloadOvl[%d]          : 0x%x %d\n", i,
0082                hdr->load_ovl[i].start, hdr->load_ovl[i].size);
0083     }
0084     nvkm_debug(subdev, "\tcompressed           : %d\n", hdr->compressed);
0085 
0086     return hdr;
0087 }
0088 
0089 const struct nvfw_ls_desc_v1 *
0090 nvfw_ls_desc_v1(struct nvkm_subdev *subdev, const void *data)
0091 {
0092     const struct nvfw_ls_desc_v1 *hdr = data;
0093     int i;
0094 
0095     nvfw_ls_desc_head(subdev, &hdr->head);
0096 
0097     nvkm_debug(subdev, "\tnbImemOverlays       : %d\n",
0098                hdr->nb_imem_overlays);
0099     nvkm_debug(subdev, "\tnbDmemOverlays       : %d\n",
0100                hdr->nb_imem_overlays);
0101     for (i = 0; i < ARRAY_SIZE(hdr->load_ovl); i++) {
0102         nvkm_debug(subdev, "\tloadOvl[%2d]          : 0x%x %d\n", i,
0103                hdr->load_ovl[i].start, hdr->load_ovl[i].size);
0104     }
0105     nvkm_debug(subdev, "\tcompressed           : %d\n", hdr->compressed);
0106 
0107     return hdr;
0108 }