Commit 299bee10 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/bios: fix some shadowing issues, particularly acpi

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent f51ee65c
...@@ -196,35 +196,24 @@ static void ...@@ -196,35 +196,24 @@ static void
bios_shadow_acpi(struct nvbios *bios) bios_shadow_acpi(struct nvbios *bios)
{ {
struct pci_dev *pdev = bios->dev->pdev; struct pci_dev *pdev = bios->dev->pdev;
int ptr, len, ret; int cnt = 65536 / ROM_BIOS_PAGE;
u8 data[3]; int ret;
if (!nouveau_acpi_rom_supported(pdev)) if (!nouveau_acpi_rom_supported(pdev))
return; return;
ret = nouveau_acpi_get_bios_chunk(data, 0, sizeof(data)); bios->data = kmalloc(cnt * ROM_BIOS_PAGE, GFP_KERNEL);
if (ret != sizeof(data))
return;
bios->length = min(data[2] * 512, 65536);
bios->data = kmalloc(bios->length, GFP_KERNEL);
if (!bios->data) if (!bios->data)
return; return;
len = bios->length; bios->length = 0;
ptr = 0; while (cnt--) {
while (len) { ret = nouveau_acpi_get_bios_chunk(bios->data, bios->length,
int size = (len > ROM_BIOS_PAGE) ? ROM_BIOS_PAGE : len; ROM_BIOS_PAGE);
if (ret != ROM_BIOS_PAGE)
ret = nouveau_acpi_get_bios_chunk(bios->data, ptr, size);
if (ret != size) {
kfree(bios->data);
bios->data = NULL;
return; return;
}
len -= size; bios->length += ROM_BIOS_PAGE;
ptr += size;
} }
} }
...@@ -294,6 +283,7 @@ bios_shadow(struct drm_device *dev) ...@@ -294,6 +283,7 @@ bios_shadow(struct drm_device *dev)
mthd->score = score_vbios(bios, mthd->rw); mthd->score = score_vbios(bios, mthd->rw);
mthd->size = bios->length; mthd->size = bios->length;
mthd->data = bios->data; mthd->data = bios->data;
bios->data = NULL;
} while (mthd->score != 3 && (++mthd)->shadow); } while (mthd->score != 3 && (++mthd)->shadow);
mthd = shadow_methods; mthd = shadow_methods;
......
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