aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-03-29 23:14:45 -0400
committerBen Skeggs <bskeggs@redhat.com>2012-05-24 02:31:47 -0400
commit78339fb75c21403677f61a02e1839b626a79325b (patch)
tree597405086b8a29379f83ffe3713bfa6c55c493f1 /drivers/gpu/drm
parentc6b7e89582bdb028e1b1763197ff24c77a43e1b0 (diff)
drm/nouveau/bios: allow loading alternate vbios image as firmware
Useful for debugging different VBIOS versions. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bios.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c
index 0be4a815e706..524f283263a9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bios.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
@@ -30,6 +30,7 @@
30#include "nouveau_gpio.h" 30#include "nouveau_gpio.h"
31 31
32#include <linux/io-mapping.h> 32#include <linux/io-mapping.h>
33#include <linux/firmware.h>
33 34
34/* these defines are made up */ 35/* these defines are made up */
35#define NV_CIO_CRE_44_HEADA 0x0 36#define NV_CIO_CRE_44_HEADA 0x0
@@ -249,8 +250,12 @@ bios_shadow(struct drm_device *dev)
249 struct drm_nouveau_private *dev_priv = dev->dev_private; 250 struct drm_nouveau_private *dev_priv = dev->dev_private;
250 struct nvbios *bios = &dev_priv->vbios; 251 struct nvbios *bios = &dev_priv->vbios;
251 struct methods *mthd, *best; 252 struct methods *mthd, *best;
253 const struct firmware *fw;
254 char fname[32];
255 int ret;
252 256
253 if (nouveau_vbios) { 257 if (nouveau_vbios) {
258 /* try to match one of the built-in methods */
254 mthd = shadow_methods; 259 mthd = shadow_methods;
255 do { 260 do {
256 if (strcasecmp(nouveau_vbios, mthd->desc)) 261 if (strcasecmp(nouveau_vbios, mthd->desc))
@@ -263,6 +268,22 @@ bios_shadow(struct drm_device *dev)
263 return true; 268 return true;
264 } while ((++mthd)->shadow); 269 } while ((++mthd)->shadow);
265 270
271 /* attempt to load firmware image */
272 snprintf(fname, sizeof(fname), "nouveau/%s", nouveau_vbios);
273 ret = request_firmware(&fw, fname, &dev->pdev->dev);
274 if (ret == 0) {
275 bios->length = fw->size;
276 bios->data = kmemdup(fw->data, fw->size, GFP_KERNEL);
277 release_firmware(fw);
278
279 NV_INFO(dev, "VBIOS image: %s\n", nouveau_vbios);
280 if (score_vbios(bios, 1))
281 return true;
282
283 kfree(bios->data);
284 bios->data = NULL;
285 }
286
266 NV_ERROR(dev, "VBIOS source \'%s\' invalid\n", nouveau_vbios); 287 NV_ERROR(dev, "VBIOS source \'%s\' invalid\n", nouveau_vbios);
267 } 288 }
268 289