提交 6bd49341 编写于 作者: S Sylvain Meyer 提交者: Linus Torvalds

[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: NSylvain Meyer <sylvain.meyer@worldonline.fr>
Signed-off-by: NAntonino Daplas <adaplas@pol.net>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 89204c40
...@@ -583,23 +583,6 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -583,23 +583,6 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
return -ENODEV; return -ENODEV;
} }
/* Map the fb and MMIO regions */
dinfo->aperture.virtual = (u8 __iomem *)ioremap_nocache
(dinfo->aperture.physical, dinfo->aperture.size);
if (!dinfo->aperture.virtual) {
ERR_MSG("Cannot remap FB region.\n");
cleanup(dinfo);
return -ENODEV;
}
dinfo->mmio_base =
(u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys,
INTEL_REG_SIZE);
if (!dinfo->mmio_base) {
ERR_MSG("Cannot remap MMIO region.\n");
cleanup(dinfo);
return -ENODEV;
}
/* Get the chipset info. */ /* Get the chipset info. */
dinfo->pci_chipset = pdev->device; dinfo->pci_chipset = pdev->device;
...@@ -630,9 +613,15 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -630,9 +613,15 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
dinfo->accel = 0; dinfo->accel = 0;
} }
if (MB(voffset) < stolen_size)
offset = (stolen_size >> 12);
else
offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
/* Framebuffer parameters - Use all the stolen memory if >= vram */ /* Framebuffer parameters - Use all the stolen memory if >= vram */
if (ROUND_UP_TO_PAGE(stolen_size) >= MB(vram)) { if (ROUND_UP_TO_PAGE(stolen_size) >= ((offset << 12) + MB(vram))) {
dinfo->fb.size = ROUND_UP_TO_PAGE(stolen_size); dinfo->fb.size = ROUND_UP_TO_PAGE(stolen_size);
dinfo->fb.offset = 0;
dinfo->fbmem_gart = 0; dinfo->fbmem_gart = 0;
} else { } else {
dinfo->fb.size = MB(vram); dinfo->fb.size = MB(vram);
...@@ -663,11 +652,6 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -663,11 +652,6 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
return -ENODEV; return -ENODEV;
} }
if (MB(voffset) < stolen_size)
offset = (stolen_size >> 12);
else
offset = ROUND_UP_TO_PAGE(MB(voffset))/GTT_PAGE_SIZE;
/* set the mem offsets - set them after the already used pages */ /* set the mem offsets - set them after the already used pages */
if (dinfo->accel) { if (dinfo->accel) {
dinfo->ring.offset = offset + gtt_info.current_memory; 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,6 +666,26 @@ intelfb_pci_register(struct pci_dev *pdev, const struct pci_device_id *ent)
+ (dinfo->cursor.size >> 12); + (dinfo->cursor.size >> 12);
} }
/* Map the fb and MMIO regions */
/* ioremap only up to the end of used aperture */
dinfo->aperture.virtual = (u8 __iomem *)ioremap_nocache
(dinfo->aperture.physical, (dinfo->fb.offset << 12)
+ dinfo->fb.size);
if (!dinfo->aperture.virtual) {
ERR_MSG("Cannot remap FB region.\n");
cleanup(dinfo);
return -ENODEV;
}
dinfo->mmio_base =
(u8 __iomem *)ioremap_nocache(dinfo->mmio_base_phys,
INTEL_REG_SIZE);
if (!dinfo->mmio_base) {
ERR_MSG("Cannot remap MMIO region.\n");
cleanup(dinfo);
return -ENODEV;
}
/* Allocate memories (which aren't stolen) */ /* Allocate memories (which aren't stolen) */
if (dinfo->accel) { if (dinfo->accel) {
if (!(dinfo->gtt_ring_mem = if (!(dinfo->gtt_ring_mem =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册