-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
drm/nouveau/acr: add loaders for currently available LS firmware images
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
- Loading branch information
Ben Skeggs
committed
Jan 15, 2020
1 parent
67e7c6c
commit c63fe2e
Showing
13 changed files
with
598 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* SPDX-License-Identifier: MIT */ | ||
#ifndef __NVFW_FW_H__ | ||
#define __NVFW_FW_H__ | ||
#include <core/os.h> | ||
struct nvkm_subdev; | ||
|
||
struct nvfw_bin_hdr { | ||
u32 bin_magic; | ||
u32 bin_ver; | ||
u32 bin_size; | ||
u32 header_offset; | ||
u32 data_offset; | ||
u32 data_size; | ||
}; | ||
|
||
const struct nvfw_bin_hdr *nvfw_bin_hdr(struct nvkm_subdev *, const void *); | ||
|
||
struct nvfw_bl_desc { | ||
u32 start_tag; | ||
u32 dmem_load_off; | ||
u32 code_off; | ||
u32 code_size; | ||
u32 data_off; | ||
u32 data_size; | ||
}; | ||
|
||
const struct nvfw_bl_desc *nvfw_bl_desc(struct nvkm_subdev *, const void *); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* SPDX-License-Identifier: MIT */ | ||
#ifndef __NVFW_LS_H__ | ||
#define __NVFW_LS_H__ | ||
#include <core/os.h> | ||
struct nvkm_subdev; | ||
|
||
struct nvfw_ls_desc_head { | ||
u32 descriptor_size; | ||
u32 image_size; | ||
u32 tools_version; | ||
u32 app_version; | ||
char date[64]; | ||
u32 bootloader_start_offset; | ||
u32 bootloader_size; | ||
u32 bootloader_imem_offset; | ||
u32 bootloader_entry_point; | ||
u32 app_start_offset; | ||
u32 app_size; | ||
u32 app_imem_offset; | ||
u32 app_imem_entry; | ||
u32 app_dmem_offset; | ||
u32 app_resident_code_offset; | ||
u32 app_resident_code_size; | ||
u32 app_resident_data_offset; | ||
u32 app_resident_data_size; | ||
}; | ||
|
||
struct nvfw_ls_desc { | ||
struct nvfw_ls_desc_head head; | ||
u32 nb_overlays; | ||
struct { | ||
u32 start; | ||
u32 size; | ||
} load_ovl[64]; | ||
u32 compressed; | ||
}; | ||
|
||
const struct nvfw_ls_desc *nvfw_ls_desc(struct nvkm_subdev *, const void *); | ||
|
||
struct nvfw_ls_desc_v1 { | ||
struct nvfw_ls_desc_head head; | ||
u32 nb_imem_overlays; | ||
u32 nb_dmem_overlays; | ||
struct { | ||
u32 start; | ||
u32 size; | ||
} load_ovl[64]; | ||
u32 compressed; | ||
}; | ||
|
||
const struct nvfw_ls_desc_v1 * | ||
nvfw_ls_desc_v1(struct nvkm_subdev *, const void *); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# SPDX-License-Identifier: MIT | ||
include $(src)/nvkm/core/Kbuild | ||
include $(src)/nvkm/nvfw/Kbuild | ||
include $(src)/nvkm/falcon/Kbuild | ||
include $(src)/nvkm/subdev/Kbuild | ||
include $(src)/nvkm/engine/Kbuild |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# SPDX-License-Identifier: MIT | ||
nvkm-y += nvkm/nvfw/fw.o | ||
nvkm-y += nvkm/nvfw/ls.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* 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/fw.h> | ||
|
||
const struct nvfw_bin_hdr * | ||
nvfw_bin_hdr(struct nvkm_subdev *subdev, const void *data) | ||
{ | ||
const struct nvfw_bin_hdr *hdr = data; | ||
nvkm_debug(subdev, "binHdr:\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); | ||
nvkm_debug(subdev, "\tdataOffset : 0x%x\n", hdr->data_offset); | ||
nvkm_debug(subdev, "\tdataSize : 0x%x\n", hdr->data_size); | ||
return hdr; | ||
} | ||
|
||
const struct nvfw_bl_desc * | ||
nvfw_bl_desc(struct nvkm_subdev *subdev, const void *data) | ||
{ | ||
const struct nvfw_bl_desc *hdr = data; | ||
nvkm_debug(subdev, "blDesc\n"); | ||
nvkm_debug(subdev, "\tstartTag : 0x%x\n", hdr->start_tag); | ||
nvkm_debug(subdev, "\tdmemLoadOff : 0x%x\n", hdr->dmem_load_off); | ||
nvkm_debug(subdev, "\tcodeOff : 0x%x\n", hdr->code_off); | ||
nvkm_debug(subdev, "\tcodeSize : 0x%x\n", hdr->code_size); | ||
nvkm_debug(subdev, "\tdataOff : 0x%x\n", hdr->data_off); | ||
nvkm_debug(subdev, "\tdataSize : 0x%x\n", hdr->data_size); | ||
return hdr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/* | ||
* 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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.