Skip to content

Commit

Permalink
drm/nouveau/bios: fix shadowing of ACPI ROMs larger than 64KiB
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
  • Loading branch information
Ben Skeggs committed Oct 9, 2012
1 parent b9f1085 commit 9a334cd
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions drivers/gpu/drm/nouveau/core/subdev/bios/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,23 +185,22 @@ static void
nouveau_bios_shadow_acpi(struct nouveau_bios *bios)
{
struct pci_dev *pdev = nv_device(bios)->pdev;
int cnt = 65536 / 4096;
int ret;
int ret, cnt, i;
u8 data[3];

if (!nouveau_acpi_rom_supported(pdev))
return;

bios->data = kmalloc(65536, GFP_KERNEL);
bios->size = 0;
if (!bios->data)
return;

while (cnt--) {
ret = nouveau_acpi_get_bios_chunk(bios->data, bios->size, 4096);
if (ret != 4096)
return;
if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
bios->size = data[2] * 512;

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;
}
}

Expand Down

0 comments on commit 9a334cd

Please sign in to comment.