Commit 9a334cd0 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/bios: fix shadowing of ACPI ROMs larger than 64KiB

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent b9f10852
...@@ -185,23 +185,22 @@ static void ...@@ -185,23 +185,22 @@ static void
nouveau_bios_shadow_acpi(struct nouveau_bios *bios) nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
{ {
struct pci_dev *pdev = nv_device(bios)->pdev; struct pci_dev *pdev = nv_device(bios)->pdev;
int cnt = 65536 / 4096; int ret, cnt, i;
int ret; u8 data[3];
if (!nouveau_acpi_rom_supported(pdev)) if (!nouveau_acpi_rom_supported(pdev))
return; return;
bios->data = kmalloc(65536, GFP_KERNEL);
bios->size = 0; bios->size = 0;
if (!bios->data) if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
return; bios->size = data[2] * 512;
while (cnt--) {
ret = nouveau_acpi_get_bios_chunk(bios->data, bios->size, 4096);
if (ret != 4096)
return;
bios->size += 4096; bios->data = kmalloc(bios->size, GFP_KERNEL);
for (i = 0; bios->data && i < bios->size; i += cnt) {
cnt = min((bios->size - i), (u32)4096);
ret = nouveau_acpi_get_bios_chunk(bios->data, i, cnt);
if (ret != cnt)
break;
} }
} }
......
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