Commit 78339fb7 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/bios: allow loading alternate vbios image as firmware

Useful for debugging different VBIOS versions.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent c6b7e895
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "nouveau_gpio.h" #include "nouveau_gpio.h"
#include <linux/io-mapping.h> #include <linux/io-mapping.h>
#include <linux/firmware.h>
/* these defines are made up */ /* these defines are made up */
#define NV_CIO_CRE_44_HEADA 0x0 #define NV_CIO_CRE_44_HEADA 0x0
...@@ -249,8 +250,12 @@ bios_shadow(struct drm_device *dev) ...@@ -249,8 +250,12 @@ bios_shadow(struct drm_device *dev)
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
struct nvbios *bios = &dev_priv->vbios; struct nvbios *bios = &dev_priv->vbios;
struct methods *mthd, *best; struct methods *mthd, *best;
const struct firmware *fw;
char fname[32];
int ret;
if (nouveau_vbios) { if (nouveau_vbios) {
/* try to match one of the built-in methods */
mthd = shadow_methods; mthd = shadow_methods;
do { do {
if (strcasecmp(nouveau_vbios, mthd->desc)) if (strcasecmp(nouveau_vbios, mthd->desc))
...@@ -263,6 +268,22 @@ bios_shadow(struct drm_device *dev) ...@@ -263,6 +268,22 @@ bios_shadow(struct drm_device *dev)
return true; return true;
} while ((++mthd)->shadow); } while ((++mthd)->shadow);
/* attempt to load firmware image */
snprintf(fname, sizeof(fname), "nouveau/%s", nouveau_vbios);
ret = request_firmware(&fw, fname, &dev->pdev->dev);
if (ret == 0) {
bios->length = fw->size;
bios->data = kmemdup(fw->data, fw->size, GFP_KERNEL);
release_firmware(fw);
NV_INFO(dev, "VBIOS image: %s\n", nouveau_vbios);
if (score_vbios(bios, 1))
return true;
kfree(bios->data);
bios->data = NULL;
}
NV_ERROR(dev, "VBIOS source \'%s\' invalid\n", nouveau_vbios); NV_ERROR(dev, "VBIOS source \'%s\' invalid\n", nouveau_vbios);
} }
......
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