diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-10-08 22:21:36 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-10-08 22:21:36 -0400 |
commit | 9a334cd0de2f43b29c192548000692bad52edfc6 (patch) | |
tree | 65efb161974816d1112a4dec38984e346323df09 /drivers/gpu/drm/nouveau | |
parent | b9f10852fcb1f09369d931dcbfbaad89ad1da4ad (diff) |
drm/nouveau/bios: fix shadowing of ACPI ROMs larger than 64KiB
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/bios/base.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c index 2fbb6df697cd..dcb5c2befc92 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c | |||
@@ -185,23 +185,22 @@ static void | |||
185 | nouveau_bios_shadow_acpi(struct nouveau_bios *bios) | 185 | nouveau_bios_shadow_acpi(struct nouveau_bios *bios) |
186 | { | 186 | { |
187 | struct pci_dev *pdev = nv_device(bios)->pdev; | 187 | struct pci_dev *pdev = nv_device(bios)->pdev; |
188 | int cnt = 65536 / 4096; | 188 | int ret, cnt, i; |
189 | int ret; | 189 | u8 data[3]; |
190 | 190 | ||
191 | if (!nouveau_acpi_rom_supported(pdev)) | 191 | if (!nouveau_acpi_rom_supported(pdev)) |
192 | return; | 192 | return; |
193 | 193 | ||
194 | bios->data = kmalloc(65536, GFP_KERNEL); | ||
195 | bios->size = 0; | 194 | bios->size = 0; |
196 | if (!bios->data) | 195 | if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3) |
197 | return; | 196 | bios->size = data[2] * 512; |
198 | |||
199 | while (cnt--) { | ||
200 | ret = nouveau_acpi_get_bios_chunk(bios->data, bios->size, 4096); | ||
201 | if (ret != 4096) | ||
202 | return; | ||
203 | 197 | ||
204 | bios->size += 4096; | 198 | bios->data = kmalloc(bios->size, GFP_KERNEL); |
199 | for (i = 0; bios->data && i < bios->size; i += cnt) { | ||
200 | cnt = min((bios->size - i), (u32)4096); | ||
201 | ret = nouveau_acpi_get_bios_chunk(bios->data, i, cnt); | ||
202 | if (ret != cnt) | ||
203 | break; | ||
205 | } | 204 | } |
206 | } | 205 | } |
207 | 206 | ||