Commit 14d7ec11 authored by Ben Skeggs's avatar Ben Skeggs Committed by Dave Airlie

drm/nouveau: fix pcirom vbios shadow breakage from acpi rom patch

On nv50 it became impossible to attempt a PCI ROM shadow of the VBIOS,
which will break some setups.

This patch also removes the different ordering of shadow methods for
pre-nv50 chipsets.  The reason for the different ordering was paranoia,
but it should hopefully be OK to try shadowing PRAMIN first.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 42f14c4b
...@@ -203,36 +203,26 @@ struct methods { ...@@ -203,36 +203,26 @@ struct methods {
const bool rw; const bool rw;
}; };
static struct methods nv04_methods[] = { static struct methods shadow_methods[] = {
{ "PROM", load_vbios_prom, false },
{ "PRAMIN", load_vbios_pramin, true },
{ "PCIROM", load_vbios_pci, true },
};
static struct methods nv50_methods[] = {
{ "ACPI", load_vbios_acpi, true },
{ "PRAMIN", load_vbios_pramin, true }, { "PRAMIN", load_vbios_pramin, true },
{ "PROM", load_vbios_prom, false }, { "PROM", load_vbios_prom, false },
{ "PCIROM", load_vbios_pci, true }, { "PCIROM", load_vbios_pci, true },
{ "ACPI", load_vbios_acpi, true },
}; };
#define METHODCNT 3
static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data)
{ {
struct drm_nouveau_private *dev_priv = dev->dev_private; const int nr_methods = ARRAY_SIZE(shadow_methods);
struct methods *methods; struct methods *methods = shadow_methods;
int i;
int testscore = 3; int testscore = 3;
int scores[METHODCNT]; int scores[nr_methods], i;
if (nouveau_vbios) { if (nouveau_vbios) {
methods = nv04_methods; for (i = 0; i < nr_methods; i++)
for (i = 0; i < METHODCNT; i++)
if (!strcasecmp(nouveau_vbios, methods[i].desc)) if (!strcasecmp(nouveau_vbios, methods[i].desc))
break; break;
if (i < METHODCNT) { if (i < nr_methods) {
NV_INFO(dev, "Attempting to use BIOS image from %s\n", NV_INFO(dev, "Attempting to use BIOS image from %s\n",
methods[i].desc); methods[i].desc);
...@@ -244,12 +234,7 @@ static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) ...@@ -244,12 +234,7 @@ static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data)
NV_ERROR(dev, "VBIOS source \'%s\' invalid\n", nouveau_vbios); NV_ERROR(dev, "VBIOS source \'%s\' invalid\n", nouveau_vbios);
} }
if (dev_priv->card_type < NV_50) for (i = 0; i < nr_methods; i++) {
methods = nv04_methods;
else
methods = nv50_methods;
for (i = 0; i < METHODCNT; i++) {
NV_TRACE(dev, "Attempting to load BIOS image from %s\n", NV_TRACE(dev, "Attempting to load BIOS image from %s\n",
methods[i].desc); methods[i].desc);
data[0] = data[1] = 0; /* avoid reuse of previous image */ data[0] = data[1] = 0; /* avoid reuse of previous image */
...@@ -260,7 +245,7 @@ static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) ...@@ -260,7 +245,7 @@ static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data)
} }
while (--testscore > 0) { while (--testscore > 0) {
for (i = 0; i < METHODCNT; i++) { for (i = 0; i < nr_methods; i++) {
if (scores[i] == testscore) { if (scores[i] == testscore) {
NV_TRACE(dev, "Using BIOS image from %s\n", NV_TRACE(dev, "Using BIOS image from %s\n",
methods[i].desc); methods[i].desc);
......
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