diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-10-21 20:08:19 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-10-21 23:39:38 -0400 |
commit | d1626a965141b1e600efad29947b6c36dab183c3 (patch) | |
tree | ca7fb5ae9b716f6d87af3a8890d9de47b338d006 /drivers | |
parent | 00e4845bad84689fbaacc86bc54a0b99d5d3c1fc (diff) |
drm/nouveau/bios: fetch full 4KiB block to determine ACPI ROM image size
Buggy firmware leads to bad things happening otherwise..
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/nouveau/core/subdev/bios/base.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c index 3a84ad4f171a..70ca7d5a1aa1 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/bios/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/base.c | |||
@@ -192,7 +192,6 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios) | |||
192 | { | 192 | { |
193 | struct pci_dev *pdev = nv_device(bios)->pdev; | 193 | struct pci_dev *pdev = nv_device(bios)->pdev; |
194 | int ret, cnt, i; | 194 | int ret, cnt, i; |
195 | u8 data[3]; | ||
196 | 195 | ||
197 | if (!nouveau_acpi_rom_supported(pdev)) { | 196 | if (!nouveau_acpi_rom_supported(pdev)) { |
198 | bios->data = NULL; | 197 | bios->data = NULL; |
@@ -200,8 +199,13 @@ nouveau_bios_shadow_acpi(struct nouveau_bios *bios) | |||
200 | } | 199 | } |
201 | 200 | ||
202 | bios->size = 0; | 201 | bios->size = 0; |
203 | if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3) | 202 | bios->data = kmalloc(4096, GFP_KERNEL); |
204 | bios->size = data[2] * 512; | 203 | if (bios->data) { |
204 | if (nouveau_acpi_get_bios_chunk(bios->data, 0, 4096) == 4096) | ||
205 | bios->size = bios->data[2] * 512; | ||
206 | kfree(bios->data); | ||
207 | } | ||
208 | |||
205 | if (!bios->size) | 209 | if (!bios->size) |
206 | return; | 210 | return; |
207 | 211 | ||