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: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>

authored by Ben Skeggs and committed by Dave Airlie 14d7ec11 42f14c4b

+9 -24
+9 -24
drivers/gpu/drm/nouveau/nouveau_bios.c
··· 203 const bool rw; 204 }; 205 206 - static struct methods nv04_methods[] = { 207 - { "PROM", load_vbios_prom, false }, 208 { "PRAMIN", load_vbios_pramin, true }, 209 { "PCIROM", load_vbios_pci, true }, 210 - }; 211 - 212 - static struct methods nv50_methods[] = { 213 { "ACPI", load_vbios_acpi, true }, 214 - { "PRAMIN", load_vbios_pramin, true }, 215 - { "PROM", load_vbios_prom, false }, 216 - { "PCIROM", load_vbios_pci, true }, 217 }; 218 - 219 - #define METHODCNT 3 220 221 static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) 222 { 223 - struct drm_nouveau_private *dev_priv = dev->dev_private; 224 - struct methods *methods; 225 - int i; 226 int testscore = 3; 227 - int scores[METHODCNT]; 228 229 if (nouveau_vbios) { 230 - methods = nv04_methods; 231 - for (i = 0; i < METHODCNT; i++) 232 if (!strcasecmp(nouveau_vbios, methods[i].desc)) 233 break; 234 235 - if (i < METHODCNT) { 236 NV_INFO(dev, "Attempting to use BIOS image from %s\n", 237 methods[i].desc); 238 ··· 234 NV_ERROR(dev, "VBIOS source \'%s\' invalid\n", nouveau_vbios); 235 } 236 237 - if (dev_priv->card_type < NV_50) 238 - methods = nv04_methods; 239 - else 240 - methods = nv50_methods; 241 - 242 - for (i = 0; i < METHODCNT; i++) { 243 NV_TRACE(dev, "Attempting to load BIOS image from %s\n", 244 methods[i].desc); 245 data[0] = data[1] = 0; /* avoid reuse of previous image */ ··· 245 } 246 247 while (--testscore > 0) { 248 - for (i = 0; i < METHODCNT; i++) { 249 if (scores[i] == testscore) { 250 NV_TRACE(dev, "Using BIOS image from %s\n", 251 methods[i].desc);
··· 203 const bool rw; 204 }; 205 206 + static struct methods shadow_methods[] = { 207 { "PRAMIN", load_vbios_pramin, true }, 208 + { "PROM", load_vbios_prom, false }, 209 { "PCIROM", load_vbios_pci, true }, 210 { "ACPI", load_vbios_acpi, true }, 211 }; 212 213 static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data) 214 { 215 + const int nr_methods = ARRAY_SIZE(shadow_methods); 216 + struct methods *methods = shadow_methods; 217 int testscore = 3; 218 + int scores[nr_methods], i; 219 220 if (nouveau_vbios) { 221 + for (i = 0; i < nr_methods; i++) 222 if (!strcasecmp(nouveau_vbios, methods[i].desc)) 223 break; 224 225 + if (i < nr_methods) { 226 NV_INFO(dev, "Attempting to use BIOS image from %s\n", 227 methods[i].desc); 228 ··· 244 NV_ERROR(dev, "VBIOS source \'%s\' invalid\n", nouveau_vbios); 245 } 246 247 + for (i = 0; i < nr_methods; i++) { 248 NV_TRACE(dev, "Attempting to load BIOS image from %s\n", 249 methods[i].desc); 250 data[0] = data[1] = 0; /* avoid reuse of previous image */ ··· 260 } 261 262 while (--testscore > 0) { 263 + for (i = 0; i < nr_methods; i++) { 264 if (scores[i] == testscore) { 265 NV_TRACE(dev, "Using BIOS image from %s\n", 266 methods[i].desc);