Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | /* * Copyright 2019 Red Hat Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ #include <core/subdev.h> #include <nvfw/ls.h> static void nvfw_ls_desc_head(struct nvkm_subdev *subdev, const struct nvfw_ls_desc_head *hdr) { char *date; nvkm_debug(subdev, "lsUcodeImgDesc:\n"); nvkm_debug(subdev, "\tdescriptorSize : %d\n", hdr->descriptor_size); nvkm_debug(subdev, "\timageSize : %d\n", hdr->image_size); nvkm_debug(subdev, "\ttoolsVersion : 0x%x\n", hdr->tools_version); nvkm_debug(subdev, "\tappVersion : 0x%x\n", hdr->app_version); date = kstrndup(hdr->date, sizeof(hdr->date), GFP_KERNEL); nvkm_debug(subdev, "\tdate : %s\n", date); kfree(date); nvkm_debug(subdev, "\tbootloaderStartOffset: 0x%x\n", hdr->bootloader_start_offset); nvkm_debug(subdev, "\tbootloaderSize : 0x%x\n", hdr->bootloader_size); nvkm_debug(subdev, "\tbootloaderImemOffset : 0x%x\n", hdr->bootloader_imem_offset); nvkm_debug(subdev, "\tbootloaderEntryPoint : 0x%x\n", hdr->bootloader_entry_point); nvkm_debug(subdev, "\tappStartOffset : 0x%x\n", hdr->app_start_offset); nvkm_debug(subdev, "\tappSize : 0x%x\n", hdr->app_size); nvkm_debug(subdev, "\tappImemOffset : 0x%x\n", hdr->app_imem_offset); nvkm_debug(subdev, "\tappImemEntry : 0x%x\n", hdr->app_imem_entry); nvkm_debug(subdev, "\tappDmemOffset : 0x%x\n", hdr->app_dmem_offset); nvkm_debug(subdev, "\tappResidentCodeOffset: 0x%x\n", hdr->app_resident_code_offset); nvkm_debug(subdev, "\tappResidentCodeSize : 0x%x\n", hdr->app_resident_code_size); nvkm_debug(subdev, "\tappResidentDataOffset: 0x%x\n", hdr->app_resident_data_offset); nvkm_debug(subdev, "\tappResidentDataSize : 0x%x\n", hdr->app_resident_data_size); } const struct nvfw_ls_desc * nvfw_ls_desc(struct nvkm_subdev *subdev, const void *data) { const struct nvfw_ls_desc *hdr = data; int i; nvfw_ls_desc_head(subdev, &hdr->head); nvkm_debug(subdev, "\tnbOverlays : %d\n", hdr->nb_overlays); for (i = 0; i < ARRAY_SIZE(hdr->load_ovl); i++) { nvkm_debug(subdev, "\tloadOvl[%d] : 0x%x %d\n", i, hdr->load_ovl[i].start, hdr->load_ovl[i].size); } nvkm_debug(subdev, "\tcompressed : %d\n", hdr->compressed); return hdr; } const struct nvfw_ls_desc_v1 * nvfw_ls_desc_v1(struct nvkm_subdev *subdev, const void *data) { const struct nvfw_ls_desc_v1 *hdr = data; int i; nvfw_ls_desc_head(subdev, &hdr->head); nvkm_debug(subdev, "\tnbImemOverlays : %d\n", hdr->nb_imem_overlays); nvkm_debug(subdev, "\tnbDmemOverlays : %d\n", hdr->nb_imem_overlays); for (i = 0; i < ARRAY_SIZE(hdr->load_ovl); i++) { nvkm_debug(subdev, "\tloadOvl[%2d] : 0x%x %d\n", i, hdr->load_ovl[i].start, hdr->load_ovl[i].size); } nvkm_debug(subdev, "\tcompressed : %d\n", hdr->compressed); return hdr; } const struct nvfw_ls_desc_v2 * nvfw_ls_desc_v2(struct nvkm_subdev *subdev, const void *data) { const struct nvfw_ls_desc_v2 *hdr = data; char *date; int i; nvkm_debug(subdev, "lsUcodeImgDesc:\n"); nvkm_debug(subdev, "\tdescriptorSize : %d\n", hdr->descriptor_size); nvkm_debug(subdev, "\timageSize : %d\n", hdr->image_size); nvkm_debug(subdev, "\ttoolsVersion : 0x%x\n", hdr->tools_version); nvkm_debug(subdev, "\tappVersion : 0x%x\n", hdr->app_version); date = kstrndup(hdr->date, sizeof(hdr->date), GFP_KERNEL); nvkm_debug(subdev, "\tdate : %s\n", date); kfree(date); nvkm_debug(subdev, "\tsecureBootloader : 0x%x\n", hdr->secure_bootloader); nvkm_debug(subdev, "\tbootloaderStartOffset: 0x%x\n", hdr->bootloader_start_offset); nvkm_debug(subdev, "\tbootloaderSize : 0x%x\n", hdr->bootloader_size); nvkm_debug(subdev, "\tbootloaderImemOffset : 0x%x\n", hdr->bootloader_imem_offset); nvkm_debug(subdev, "\tbootloaderEntryPoint : 0x%x\n", hdr->bootloader_entry_point); nvkm_debug(subdev, "\tappStartOffset : 0x%x\n", hdr->app_start_offset); nvkm_debug(subdev, "\tappSize : 0x%x\n", hdr->app_size); nvkm_debug(subdev, "\tappImemOffset : 0x%x\n", hdr->app_imem_offset); nvkm_debug(subdev, "\tappImemEntry : 0x%x\n", hdr->app_imem_entry); nvkm_debug(subdev, "\tappDmemOffset : 0x%x\n", hdr->app_dmem_offset); nvkm_debug(subdev, "\tappResidentCodeOffset: 0x%x\n", hdr->app_resident_code_offset); nvkm_debug(subdev, "\tappResidentCodeSize : 0x%x\n", hdr->app_resident_code_size); nvkm_debug(subdev, "\tappResidentDataOffset: 0x%x\n", hdr->app_resident_data_offset); nvkm_debug(subdev, "\tappResidentDataSize : 0x%x\n", hdr->app_resident_data_size); nvkm_debug(subdev, "\tnbImemOverlays : %d\n", hdr->nb_imem_overlays); nvkm_debug(subdev, "\tnbDmemOverlays : %d\n", hdr->nb_dmem_overlays); for (i = 0; i < ARRAY_SIZE(hdr->load_ovl); i++) { nvkm_debug(subdev, "\tloadOvl[%d] : 0x%x %d\n", i, hdr->load_ovl[i].start, hdr->load_ovl[i].size); } return hdr; } const struct nvfw_ls_hsbl_bin_hdr * nvfw_ls_hsbl_bin_hdr(struct nvkm_subdev *subdev, const void *data) { const struct nvfw_ls_hsbl_bin_hdr *hdr = data; nvkm_debug(subdev, "lsHsblBinHdr:\n"); nvkm_debug(subdev, "\tbinMagic : 0x%08x\n", hdr->bin_magic); nvkm_debug(subdev, "\tbinVer : %d\n", hdr->bin_ver); nvkm_debug(subdev, "\tbinSize : %d\n", hdr->bin_size); nvkm_debug(subdev, "\theaderOffset : 0x%x\n", hdr->header_offset); return hdr; } const struct nvfw_ls_hsbl_hdr * nvfw_ls_hsbl_hdr(struct nvkm_subdev *subdev, const void *data) { const struct nvfw_ls_hsbl_hdr *hdr = data; nvkm_debug(subdev, "lsHsblHdr:\n"); nvkm_debug(subdev, "\tsigProdOffset : 0x%x\n", hdr->sig_prod_offset); nvkm_debug(subdev, "\tsigProdSize : 0x%x\n", hdr->sig_prod_size); nvkm_debug(subdev, "\tpatchLoc : 0x%x\n", hdr->patch_loc); nvkm_debug(subdev, "\tpatchSig : 0x%x\n", hdr->patch_sig); nvkm_debug(subdev, "\tmetadataOffset : 0x%x\n", hdr->meta_data_offset); nvkm_debug(subdev, "\tmetadataSize : 0x%x\n", hdr->meta_data_size); nvkm_debug(subdev, "\tnumSig : 0x%x\n", hdr->num_sig); return hdr; } |