lkml.org 
[lkml]   [2012]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[ 60/76] drm/nouveau/bios: fix shadowing of ACPI ROMs larger than 64KiB
Date
3.6-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ben Skeggs <bskeggs@redhat.com>

commit 9a334cd0de2f43b29c192548000692bad52edfc6 upstream.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
drivers/gpu/drm/nouveau/nouveau_bios.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)

--- a/drivers/gpu/drm/nouveau/nouveau_bios.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
@@ -196,24 +196,22 @@ static void
bios_shadow_acpi(struct nvbios *bios)
{
struct pci_dev *pdev = bios->dev->pdev;
- int cnt = 65536 / ROM_BIOS_PAGE;
- int ret;
+ int ret, cnt, i;
+ u8 data[3];

if (!nouveau_acpi_rom_supported(pdev))
return;

- bios->data = kmalloc(cnt * ROM_BIOS_PAGE, GFP_KERNEL);
- if (!bios->data)
- return;
-
bios->length = 0;
- while (cnt--) {
- ret = nouveau_acpi_get_bios_chunk(bios->data, bios->length,
- ROM_BIOS_PAGE);
- if (ret != ROM_BIOS_PAGE)
- return;
+ if (nouveau_acpi_get_bios_chunk(data, 0, 3) == 3)
+ bios->length = data[2] * 512;

- bios->length += ROM_BIOS_PAGE;
+ bios->data = kmalloc(bios->length, GFP_KERNEL);
+ for (i = 0; bios->data && i < bios->length; i += cnt) {
+ cnt = min((bios->length - i), (u32)4096);
+ ret = nouveau_acpi_get_bios_chunk(bios->data, i, cnt);
+ if (ret != cnt)
+ break;
}
}




\
 
 \ /
  Last update: 2012-10-19 05:41    [W:0.557 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site