diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2020-01-15 06:34:21 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2020-01-15 10:50:26 +1000 |
commit | c63fe2e704e2c1fa9a4614f31a567925d00503f1 (patch) | |
tree | badc764416bd8726166e9dfa4a10c49e53ce7004 /drivers/gpu/drm/nouveau/nvkm/core | |
parent | 67e7c6cf8f521463ca8c6f37098dcaf9e391b080 (diff) | |
download | lwn-c63fe2e704e2c1fa9a4614f31a567925d00503f1.tar.gz lwn-c63fe2e704e2c1fa9a4614f31a567925d00503f1.zip |
drm/nouveau/acr: add loaders for currently available LS firmware images
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/core')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/firmware.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/firmware.c b/drivers/gpu/drm/nouveau/nvkm/core/firmware.c index 50f2c3449afd..1c2909566b2a 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/firmware.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/firmware.c @@ -22,6 +22,40 @@ #include <core/device.h> #include <core/firmware.h> +int +nvkm_firmware_load_name(const struct nvkm_subdev *subdev, const char *base, + const char *name, int ver, const struct firmware **pfw) +{ + char path[64]; + int ret; + + snprintf(path, sizeof(path), "%s%s", base, name); + ret = nvkm_firmware_get_version(subdev, path, ver, ver, pfw); + if (ret < 0) + return ret; + + return 0; +} + +int +nvkm_firmware_load_blob(const struct nvkm_subdev *subdev, const char *base, + const char *name, int ver, struct nvkm_blob *blob) +{ + const struct firmware *fw; + int ret; + + ret = nvkm_firmware_load_name(subdev, base, name, ver, &fw); + if (ret == 0) { + blob->data = kmemdup(fw->data, fw->size, GFP_KERNEL); + blob->size = fw->size; + nvkm_firmware_put(fw); + if (!blob->data) + return -ENOMEM; + } + + return ret; +} + /** * nvkm_firmware_get - load firmware from the official nvidia/chip/ directory * @subdev subdevice that will use that firmware |