2 * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
23 #ifndef __NVKM_SECBOOT_LS_UCODE_H__
24 #define __NVKM_SECBOOT_LS_UCODE_H__
27 #include <core/subdev.h>
28 #include <subdev/secboot.h>
33 * struct ls_ucode_img_desc - descriptor of firmware image
34 * @descriptor_size: size of this descriptor
35 * @image_size: size of the whole image
36 * @bootloader_start_offset: start offset of the bootloader in ucode image
37 * @bootloader_size: size of the bootloader
38 * @bootloader_imem_offset: start off set of the bootloader in IMEM
39 * @bootloader_entry_point: entry point of the bootloader in IMEM
40 * @app_start_offset: start offset of the LS firmware
41 * @app_size: size of the LS firmware's code and data
42 * @app_imem_offset: offset of the app in IMEM
43 * @app_imem_entry: entry point of the app in IMEM
44 * @app_dmem_offset: offset of the data in DMEM
45 * @app_resident_code_offset: offset of app code from app_start_offset
46 * @app_resident_code_size: size of the code
47 * @app_resident_data_offset: offset of data from app_start_offset
48 * @app_resident_data_size: size of data
50 * A firmware image contains the code, data, and bootloader of a given LS
51 * falcon in a single blob. This structure describes where everything is.
53 * This can be generated from a (bootloader, code, data) set if they have
54 * been loaded separately, or come directly from a file.
56 struct ls_ucode_img_desc {
62 u32 bootloader_start_offset;
64 u32 bootloader_imem_offset;
65 u32 bootloader_entry_point;
71 u32 app_resident_code_offset;
72 u32 app_resident_code_size;
73 u32 app_resident_data_offset;
74 u32 app_resident_data_size;
76 struct {u32 start; u32 size; } load_ovl[64];
81 * struct ls_ucode_img - temporary storage for loaded LS firmwares
82 * @node: to link within lsf_ucode_mgr
83 * @falcon_id: ID of the falcon this LS firmware is for
84 * @ucode_desc: loaded or generated map of ucode_data
85 * @ucode_data: firmware payload (code and data)
86 * @ucode_size: size in bytes of data in ucode_data
87 * @ucode_off: offset of the ucode in ucode_data
88 * @sig: signature for this firmware
89 * @sig:size: size of the signature in bytes
91 * Preparing the WPR LS blob requires information about all the LS firmwares
92 * (size, etc) to be known. This structure contains all the data of one LS
96 struct list_head node;
97 enum nvkm_secboot_falcon falcon_id;
99 struct ls_ucode_img_desc ucode_desc;
109 * struct fw_bin_header - header of firmware files
110 * @bin_magic: always 0x3b1d14f0
111 * @bin_ver: version of the bin format
112 * @bin_size: entire image size including this header
113 * @header_offset: offset of the firmware/bootloader header in the file
114 * @data_offset: offset of the firmware/bootloader payload in the file
115 * @data_size: size of the payload
117 * This header is located at the beginning of the HS firmware and HS bootloader
118 * files, to describe where the headers and data can be found.
120 struct fw_bin_header {
130 * struct fw_bl_desc - firmware bootloader descriptor
131 * @start_tag: starting tag of bootloader
132 * @desc_dmem_load_off: DMEM offset of flcn_bl_dmem_desc
133 * @code_off: offset of code section
134 * @code_size: size of code section
135 * @data_off: offset of data section
136 * @data_size: size of data section
138 * This structure is embedded in bootloader firmware files at to describe the
139 * IMEM and DMEM layout expected by the bootloader.
150 int acr_ls_ucode_load_fecs(const struct nvkm_secboot *, struct ls_ucode_img *);
151 int acr_ls_ucode_load_gpccs(const struct nvkm_secboot *, struct ls_ucode_img *);
152 int acr_ls_ucode_load_pmu(const struct nvkm_secboot *, struct ls_ucode_img *);
153 int acr_ls_pmu_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);
154 int acr_ls_ucode_load_sec2(const struct nvkm_secboot *, struct ls_ucode_img *);
155 int acr_ls_sec2_post_run(const struct nvkm_acr *, const struct nvkm_secboot *);