Commit 8854eed1 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/core: pass subdev into nvkm_firmware_get, rather than device

It'd be nice to have FW loading debug messages to appear for the relevant
subsystem, when enabled.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent c4a52d66
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: GPL-2.0 */
#ifndef __NVKM_FIRMWARE_H__ #ifndef __NVKM_FIRMWARE_H__
#define __NVKM_FIRMWARE_H__ #define __NVKM_FIRMWARE_H__
#include <core/subdev.h>
#include <core/device.h> int nvkm_firmware_get(const struct nvkm_subdev *, const char *fwname,
int nvkm_firmware_get(struct nvkm_device *device, const char *fwname,
const struct firmware **fw); const struct firmware **fw);
void nvkm_firmware_put(const struct firmware *fw); void nvkm_firmware_put(const struct firmware *fw);
#endif #endif
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
/** /**
* nvkm_firmware_get - load firmware from the official nvidia/chip/ directory * nvkm_firmware_get - load firmware from the official nvidia/chip/ directory
* @device device that will use that firmware * @subdev subdevice that will use that firmware
* @fwname name of firmware file to load * @fwname name of firmware file to load
* @fw firmware structure to load to * @fw firmware structure to load to
* *
...@@ -32,9 +32,10 @@ ...@@ -32,9 +32,10 @@
* Firmware files released by NVIDIA will always follow this format. * Firmware files released by NVIDIA will always follow this format.
*/ */
int int
nvkm_firmware_get(struct nvkm_device *device, const char *fwname, nvkm_firmware_get(const struct nvkm_subdev *subdev, const char *fwname,
const struct firmware **fw) const struct firmware **fw)
{ {
struct nvkm_device *device = subdev->device;
char f[64]; char f[64];
char cname[16]; char cname[16];
int i; int i;
......
...@@ -2115,12 +2115,10 @@ int ...@@ -2115,12 +2115,10 @@ int
gf100_gr_ctor_fw(struct gf100_gr *gr, const char *fwname, gf100_gr_ctor_fw(struct gf100_gr *gr, const char *fwname,
struct gf100_gr_fuc *fuc) struct gf100_gr_fuc *fuc)
{ {
struct nvkm_subdev *subdev = &gr->base.engine.subdev;
struct nvkm_device *device = subdev->device;
const struct firmware *fw; const struct firmware *fw;
int ret; int ret;
ret = nvkm_firmware_get(device, fwname, &fw); ret = nvkm_firmware_get(&gr->base.engine.subdev, fwname, &fw);
if (ret) { if (ret) {
ret = gf100_gr_ctor_fw_legacy(gr, fwname, fuc, ret); ret = gf100_gr_ctor_fw_legacy(gr, fwname, fuc, ret);
if (ret) if (ret)
......
...@@ -36,7 +36,7 @@ nvkm_acr_load_firmware(const struct nvkm_subdev *subdev, const char *name, ...@@ -36,7 +36,7 @@ nvkm_acr_load_firmware(const struct nvkm_subdev *subdev, const char *name,
void *blob; void *blob;
int ret; int ret;
ret = nvkm_firmware_get(subdev->device, name, &fw); ret = nvkm_firmware_get(subdev, name, &fw);
if (ret) if (ret)
return ERR_PTR(ret); return ERR_PTR(ret);
if (fw->size < min_size) { if (fw->size < min_size) {
......
...@@ -98,22 +98,22 @@ ls_ucode_img_load_gr(const struct nvkm_subdev *subdev, struct ls_ucode_img *img, ...@@ -98,22 +98,22 @@ ls_ucode_img_load_gr(const struct nvkm_subdev *subdev, struct ls_ucode_img *img,
int ret; int ret;
snprintf(f, sizeof(f), "gr/%s_bl", falcon_name); snprintf(f, sizeof(f), "gr/%s_bl", falcon_name);
ret = nvkm_firmware_get(subdev->device, f, &bl); ret = nvkm_firmware_get(subdev, f, &bl);
if (ret) if (ret)
goto error; goto error;
snprintf(f, sizeof(f), "gr/%s_inst", falcon_name); snprintf(f, sizeof(f), "gr/%s_inst", falcon_name);
ret = nvkm_firmware_get(subdev->device, f, &code); ret = nvkm_firmware_get(subdev, f, &code);
if (ret) if (ret)
goto free_bl; goto free_bl;
snprintf(f, sizeof(f), "gr/%s_data", falcon_name); snprintf(f, sizeof(f), "gr/%s_data", falcon_name);
ret = nvkm_firmware_get(subdev->device, f, &data); ret = nvkm_firmware_get(subdev, f, &data);
if (ret) if (ret)
goto free_inst; goto free_inst;
snprintf(f, sizeof(f), "gr/%s_sig", falcon_name); snprintf(f, sizeof(f), "gr/%s_sig", falcon_name);
ret = nvkm_firmware_get(subdev->device, f, &sig); ret = nvkm_firmware_get(subdev, f, &sig);
if (ret) if (ret)
goto free_data; goto free_data;
......
...@@ -46,7 +46,7 @@ acr_ls_ucode_load_msgqueue(const struct nvkm_subdev *subdev, const char *name, ...@@ -46,7 +46,7 @@ acr_ls_ucode_load_msgqueue(const struct nvkm_subdev *subdev, const char *name,
int ret; int ret;
snprintf(f, sizeof(f), "%s/image", name); snprintf(f, sizeof(f), "%s/image", name);
ret = nvkm_firmware_get(subdev->device, f, &image); ret = nvkm_firmware_get(subdev, f, &image);
if (ret) if (ret)
return ret; return ret;
img->ucode_data = kmemdup(image->data, image->size, GFP_KERNEL); img->ucode_data = kmemdup(image->data, image->size, GFP_KERNEL);
...@@ -55,7 +55,7 @@ acr_ls_ucode_load_msgqueue(const struct nvkm_subdev *subdev, const char *name, ...@@ -55,7 +55,7 @@ acr_ls_ucode_load_msgqueue(const struct nvkm_subdev *subdev, const char *name,
return -ENOMEM; return -ENOMEM;
snprintf(f, sizeof(f), "%s/desc", name); snprintf(f, sizeof(f), "%s/desc", name);
ret = nvkm_firmware_get(subdev->device, f, &desc); ret = nvkm_firmware_get(subdev, f, &desc);
if (ret) if (ret)
return ret; return ret;
memcpy(&img->ucode_desc, desc->data, sizeof(img->ucode_desc)); memcpy(&img->ucode_desc, desc->data, sizeof(img->ucode_desc));
...@@ -63,7 +63,7 @@ acr_ls_ucode_load_msgqueue(const struct nvkm_subdev *subdev, const char *name, ...@@ -63,7 +63,7 @@ acr_ls_ucode_load_msgqueue(const struct nvkm_subdev *subdev, const char *name,
nvkm_firmware_put(desc); nvkm_firmware_put(desc);
snprintf(f, sizeof(f), "%s/sig", name); snprintf(f, sizeof(f), "%s/sig", name);
ret = nvkm_firmware_get(subdev->device, f, &sig); ret = nvkm_firmware_get(subdev, f, &sig);
if (ret) if (ret)
return ret; return ret;
img->sig_size = sig->size; img->sig_size = sig->size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment