aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Meyer <sylvain.meyer@worldonline.fr>2005-08-15 09:27:13 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-15 12:53:34 -0400
commit6bd49341f2806168c877e12cefca77b93437bac2 (patch)
treef7cd5a855842f061b48dd42338a0ab7f61bc360f
parent89204c40a03346cd951e698d854105db4cfedc28 (diff)
[PATCH] intelfb: Do not ioremap entire graphics aperture
Reported by: Pavel Kysilka (Bugzilla Bug 4738) modprobe of intelfb results in the following error message: intelfb: Framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G chi intelfb: Version 0.9.2 ACPI: PCI Interrupt 0000:00:02.0[A] -> GSI 16 (level, low) -> IRQ 16 allocation failed: out of vmalloc space - use vmalloc=<size> to increase siz intelfb: Cannot remap FB region. This will fail if the graphics aperture size is greater than 128 MB. Fix is to ioremap only from the beginning of graphics aperture to the end of the used framebuffer memory. Signed-off-by: Sylvain Meyer <sylvain.meyer@worldonline.fr> Signed-off-by: Antonino Daplas <adaplas@pol.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/video/intelfb/intelfbdrv.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
index 298bc9cd99e7..a112a1786855 100644
--- a/drivers/video/intelfb/intelfbdrv.c
+++ b/drivers/video/intelfb/intelfbdrv.c
@@ -583,23 +583,6 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
583 return -ENODEV; 583 return -ENODEV;
584 } 584 }
585 585
586 /* Map the fb and MMIO regions */
587 dinfo->aperture.virtual = (u8 __iomem *)ioremap_nocache
588 (dinfo->aperture.physical, dinfo->aperture.size);
589 if (!dinfo->aperture.virtual) {
590 ERR_MSG("Cannot remap FB region.\n");
591 cleanup(dinfo);
592 return -ENODEV;
593 }
594 dinfo->mmio_base =
595 (u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys,
596 INTEL_REG_SIZE);
597 if (!dinfo->mmio_base) {
598 ERR_MSG("Cannot remap MMIO region.\n");
599 cleanup(dinfo);
600 return -ENODEV;
601 }
602
603 /* Get the chipset info. */ 586 /* Get the chipset info. */
604 dinfo->pci_chipset = pdev->device; 587 dinfo->pci_chipset = pdev->device;
605 588
@@ -630,9 +613,15 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
630 dinfo->accel = 0; 613 dinfo->accel = 0;
631 } 614 }
632 615
616 if (MB(voffset) < stolen_size)
617 offset = (stolen_size >> 12);
618 else
619 offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
620
633 /* Framebuffer parameters - Use all the stolen memory if >= vram */ 621 /* Framebuffer parameters - Use all the stolen memory if >= vram */
634 if (ROUND_UP_TO_PAGE(stolen_size) >= MB(vram)) { 622 if (ROUND_UP_TO_PAGE(stolen_size) >= ((offset << 12) + MB(vram))) {
635 dinfo->fb.size = ROUND_UP_TO_PAGE(stolen_size); 623 dinfo->fb.size = ROUND_UP_TO_PAGE(stolen_size);
624 dinfo->fb.offset = 0;
636 dinfo->fbmem_gart = 0; 625 dinfo->fbmem_gart = 0;
637 } else { 626 } else {
638 dinfo->fb.size = MB(vram); 627 dinfo->fb.size = MB(vram);
@@ -663,11 +652,6 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
663 return -ENODEV; 652 return -ENODEV;
664 } 653 }
665 654
666 if (MB(voffset) < stolen_size)
667 offset = (stolen_size >> 12);
668 else
669 offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
670
671 /* set the mem offsets - set them after the already used pages */ 655 /* set the mem offsets - set them after the already used pages */
672 if (dinfo->accel) { 656 if (dinfo->accel) {
673 dinfo->ring.offset = offset + gtt_info.current_memory; 657 dinfo->ring.offset = offset + gtt_info.current_memory;
@@ -682,6 +666,26 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
682 + (dinfo->cursor.size >> 12); 666 + (dinfo->cursor.size >> 12);
683 } 667 }
684 668
669 /* Map the fb and MMIO regions */
670 /* ioremap only up to the end of used aperture */
671 dinfo->aperture.virtual = (u8 __iomem *)ioremap_nocache
672 (dinfo->aperture.physical, (dinfo->fb.offset << 12)
673 + dinfo->fb.size);
674 if (!dinfo->aperture.virtual) {
675 ERR_MSG("Cannot remap FB region.\n");
676 cleanup(dinfo);
677 return -ENODEV;
678 }
679
680 dinfo->mmio_base =
681 (u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys,
682 INTEL_REG_SIZE);
683 if (!dinfo->mmio_base) {
684 ERR_MSG("Cannot remap MMIO region.\n");
685 cleanup(dinfo);
686 return -ENODEV;
687 }
688
685 /* Allocate memories (which aren't stolen) */ 689 /* Allocate memories (which aren't stolen) */
686 if (dinfo->accel) { 690 if (dinfo->accel) {
687 if (!(dinfo->gtt_ring_mem = 691 if (!(dinfo->gtt_ring_mem =