fixup i915 compat resource allocation

main
Dave Airlie 2008-01-14 19:36:10 +10:00
parent 269d518008
commit 62df4f0a48
1 changed files with 10 additions and 4 deletions

View File

@ -21,6 +21,7 @@
static struct _i9xx_private_compat {
void __iomem *flush_page;
int resource_valid;
struct resource ifp_resource;
} i9xx_private;
@ -57,16 +58,17 @@ static void intel_i915_setup_chipset_flush(struct pci_dev *pdev)
pci_read_config_dword(pdev, I915_IFPADDR, &temp);
if (!(temp & 0x1)) {
intel_alloc_chipset_flush_resource(pdev);
i9xx_private.resource_valid = 1;
pci_write_config_dword(pdev, I915_IFPADDR, (i9xx_private.ifp_resource.start & 0xffffffff) | 0x1);
} else {
temp &= ~1;
i9xx_private.resource_valid = 1;
i9xx_private.ifp_resource.start = temp;
i9xx_private.ifp_resource.end = temp + PAGE_SIZE;
ret = request_resource(&iomem_resource, &i9xx_private.ifp_resource);
if (ret) {
i9xx_private.ifp_resource.start = 0;
i9xx_private.resource_valid = 0;
printk("Failed inserting resource into tree\n");
}
}
@ -84,6 +86,7 @@ static void intel_i965_g33_setup_chipset_flush(struct pci_dev *pdev)
intel_alloc_chipset_flush_resource(pdev);
i9xx_private.resource_valid = 1;
pci_write_config_dword(pdev, I965_IFPADDR + 4,
upper_32_bits(i9xx_private.ifp_resource.start));
pci_write_config_dword(pdev, I965_IFPADDR, (i9xx_private.ifp_resource.start & 0xffffffff) | 0x1);
@ -93,11 +96,12 @@ static void intel_i965_g33_setup_chipset_flush(struct pci_dev *pdev)
temp_lo &= ~0x1;
l64 = ((u64)temp_hi << 32) | temp_lo;
i9xx_private.resource_valid = 1;
i9xx_private.ifp_resource.start = l64;
i9xx_private.ifp_resource.end = l64 + PAGE_SIZE;
ret = request_resource(&iomem_resource, &i9xx_private.ifp_resource);
if (!ret) {
i9xx_private.ifp_resource.start = 0;
i9xx_private.resource_valid = 0;
printk("Failed inserting resource into tree\n");
}
}
@ -167,7 +171,9 @@ static void intel_i9xx_setup_flush(struct drm_device *dev)
static void intel_i9xx_fini_flush(struct drm_device *dev)
{
iounmap(i9xx_private.flush_page);
release_resource(&i9xx_private.ifp_resource);
if (i9xx_private.resource_valid)
release_resource(&i9xx_private.ifp_resource);
i9xx_private.resource_valid = 0;
}
static void intel_i9xx_flush_page(struct drm_device *dev)