drm/nouveau/core: remove previous versioned fw loader

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
Ben Skeggs 2020-01-15 06:34:22 +10:00
parent 9d350c5e51
commit edec7149cb
4 changed files with 16 additions and 32 deletions

View File

@ -4,10 +4,7 @@
#include <core/option.h>
#include <core/subdev.h>
int nvkm_firmware_get_version(const struct nvkm_subdev *, const char *fwname,
int min_version, int max_version,
const struct firmware **);
int nvkm_firmware_get(const struct nvkm_subdev *, const char *fwname,
int nvkm_firmware_get(const struct nvkm_subdev *, const char *fwname, int ver,
const struct firmware **);
void nvkm_firmware_put(const struct firmware *);

View File

@ -30,7 +30,7 @@ nvkm_firmware_load_name(const struct nvkm_subdev *subdev, const char *base,
int ret;
snprintf(path, sizeof(path), "%s%s", base, name);
ret = nvkm_firmware_get_version(subdev, path, ver, ver, pfw);
ret = nvkm_firmware_get(subdev, path, ver, pfw);
if (ret < 0)
return ret;
@ -66,9 +66,8 @@ nvkm_firmware_load_blob(const struct nvkm_subdev *subdev, const char *base,
* Firmware files released by NVIDIA will always follow this format.
*/
int
nvkm_firmware_get_version(const struct nvkm_subdev *subdev, const char *fwname,
int min_version, int max_version,
const struct firmware **fw)
nvkm_firmware_get(const struct nvkm_subdev *subdev, const char *fwname, int ver,
const struct firmware **fw)
{
struct nvkm_device *device = subdev->device;
char f[64];
@ -84,32 +83,21 @@ nvkm_firmware_get_version(const struct nvkm_subdev *subdev, const char *fwname,
cname[i] = tolower(cname[i]);
}
for (i = max_version; i >= min_version; i--) {
if (i != 0)
snprintf(f, sizeof(f), "nvidia/%s/%s-%d.bin", cname, fwname, i);
else
snprintf(f, sizeof(f), "nvidia/%s/%s.bin", cname, fwname);
if (ver != 0)
snprintf(f, sizeof(f), "nvidia/%s/%s-%d.bin", cname, fwname, ver);
else
snprintf(f, sizeof(f), "nvidia/%s/%s.bin", cname, fwname);
if (!firmware_request_nowarn(fw, f, device->dev)) {
nvkm_debug(subdev, "firmware \"%s\" loaded - "
"%zu byte(s)\n", f, (*fw)->size);
return i;
}
nvkm_debug(subdev, "firmware \"%s\" unavailable\n", f);
if (!firmware_request_nowarn(fw, f, device->dev)) {
nvkm_debug(subdev, "firmware \"%s\" loaded - %zu byte(s)\n",
f, (*fw)->size);
return 0;
}
nvkm_error(subdev, "failed to load firmware \"%s\"\n", fwname);
nvkm_debug(subdev, "firmware \"%s\" unavailable\n", f);
return -ENOENT;
}
int
nvkm_firmware_get(const struct nvkm_subdev *subdev, const char *fwname,
const struct firmware **fw)
{
return nvkm_firmware_get_version(subdev, fwname, 0, 0, fw);
}
/**
* nvkm_firmware_put - release firmware loaded with nvkm_firmware_get
*/

View File

@ -357,8 +357,7 @@ nvkm_acr_ctor_wpr(struct nvkm_acr *acr, int ver)
struct nvkm_device *device = subdev->device;
int ret;
ret = nvkm_firmware_get_version(subdev, "acr/wpr", ver, ver,
&acr->wpr_fw);
ret = nvkm_firmware_get(subdev, "acr/wpr", ver, &acr->wpr_fw);
if (ret < 0)
return ret;

View File

@ -58,7 +58,7 @@ nvkm_acr_hsfw_load_image(struct nvkm_acr *acr, const char *name, int ver,
u32 loc, sig;
int ret;
ret = nvkm_firmware_get_version(subdev, name, ver, ver, &fw);
ret = nvkm_firmware_get(subdev, name, ver, &fw);
if (ret < 0)
return ret;
@ -136,7 +136,7 @@ nvkm_acr_hsfw_load_bl(struct nvkm_acr *acr, const char *name, int ver,
u8 *data;
int ret;
ret = nvkm_firmware_get_version(subdev, name, ver, ver, &fw);
ret = nvkm_firmware_get(subdev, name, ver, &fw);
if (ret)
return ret;