Skip to content

Commit 41090eb

Browse files
author
Ben Skeggs
committed
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>
1 parent dad9acf commit 41090eb

1 file changed

Lines changed: 9 additions & 24 deletions

File tree

‎drivers/gpu/drm/nouveau/nouveau_bios.c‎

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -203,36 +203,26 @@ struct methods {
203203
const bool rw;
204204
};
205205

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 },
206+
static struct methods shadow_methods[] = {
214207
{ "PRAMIN", load_vbios_pramin, true },
215208
{ "PROM", load_vbios_prom, false },
216209
{ "PCIROM", load_vbios_pci, true },
210+
{ "ACPI", load_vbios_acpi, true },
217211
};
218212

219-
#define METHODCNT 3
220-
221213
static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data)
222214
{
223-
struct drm_nouveau_private *dev_priv = dev->dev_private;
224-
struct methods *methods;
225-
int i;
215+
const int nr_methods = ARRAY_SIZE(shadow_methods);
216+
struct methods *methods = shadow_methods;
226217
int testscore = 3;
227-
int scores[METHODCNT];
218+
int scores[nr_methods], i;
228219

229220
if (nouveau_vbios) {
230-
methods = nv04_methods;
231-
for (i = 0; i < METHODCNT; i++)
221+
for (i = 0; i < nr_methods; i++)
232222
if (!strcasecmp(nouveau_vbios, methods[i].desc))
233223
break;
234224

235-
if (i < METHODCNT) {
225+
if (i < nr_methods) {
236226
NV_INFO(dev, "Attempting to use BIOS image from %s\n",
237227
methods[i].desc);
238228

@@ -244,12 +234,7 @@ static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data)
244234
NV_ERROR(dev, "VBIOS source \'%s\' invalid\n", nouveau_vbios);
245235
}
246236

247-
if (dev_priv->card_type < NV_50)
248-
methods = nv04_methods;
249-
else
250-
methods = nv50_methods;
251-
252-
for (i = 0; i < METHODCNT; i++) {
237+
for (i = 0; i < nr_methods; i++) {
253238
NV_TRACE(dev, "Attempting to load BIOS image from %s\n",
254239
methods[i].desc);
255240
data[0] = data[1] = 0; /* avoid reuse of previous image */
@@ -260,7 +245,7 @@ static bool NVShadowVBIOS(struct drm_device *dev, uint8_t *data)
260245
}
261246

262247
while (--testscore > 0) {
263-
for (i = 0; i < METHODCNT; i++) {
248+
for (i = 0; i < nr_methods; i++) {
264249
if (scores[i] == testscore) {
265250
NV_TRACE(dev, "Using BIOS image from %s\n",
266251
methods[i].desc);

0 commit comments

Comments
 (0)