diff options
author | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2011-04-25 16:01:46 -0400 |
---|---|---|
committer | Florian Tobias Schandinat <FlorianSchandinat@gmx.de> | 2011-04-25 16:01:46 -0400 |
commit | 9d5f96f61837b1242dd8c576c6110593475fcf86 (patch) | |
tree | b5fe5a3b71be2ca239aeb404bc3b92c4da16c703 /drivers/video/via | |
parent | cace71b318aa0126e7cfe49fe5e9133e0395c478 (diff) |
viafb: try to map less memory in case of failure
The current code might result in trying to remap 512MB video ram on
a 32 bit system which is quite likely to fail.
This patch tries to map less of it down to 8MB as this should still
be enough to get a reasonably well working framebuffer. This should
make viafb work for many people without requiring them to manually
allocate more space.
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Diffstat (limited to 'drivers/video/via')
-rw-r--r-- | drivers/video/via/via-core.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/video/via/via-core.c b/drivers/video/via/via-core.c index 5b0129b42d8a..eb112b621735 100644 --- a/drivers/video/via/via-core.c +++ b/drivers/video/via/via-core.c | |||
@@ -505,7 +505,14 @@ static int __devinit via_pci_setup_mmio(struct viafb_dev *vdev) | |||
505 | ret = vdev->fbmem_len = viafb_get_fb_size_from_pci(vdev->chip_type); | 505 | ret = vdev->fbmem_len = viafb_get_fb_size_from_pci(vdev->chip_type); |
506 | if (ret < 0) | 506 | if (ret < 0) |
507 | goto out_unmap; | 507 | goto out_unmap; |
508 | vdev->fbmem = ioremap_wc(vdev->fbmem_start, vdev->fbmem_len); | 508 | |
509 | /* try to map less memory on failure, 8 MB should be still enough */ | ||
510 | for (; vdev->fbmem_len >= 8 << 20; vdev->fbmem_len /= 2) { | ||
511 | vdev->fbmem = ioremap_wc(vdev->fbmem_start, vdev->fbmem_len); | ||
512 | if (vdev->fbmem) | ||
513 | break; | ||
514 | } | ||
515 | |||
509 | if (vdev->fbmem == NULL) { | 516 | if (vdev->fbmem == NULL) { |
510 | ret = -ENOMEM; | 517 | ret = -ENOMEM; |
511 | goto out_unmap; | 518 | goto out_unmap; |