Commit a25c25c2 authored by Chris Wilson's avatar Chris Wilson

drm/i915: Allocate the PCI resource for the MCHBAR

We were failing when trying to allocate the resource for MMIO of the
MCHBAR because we forgot to specify what type of resource we wanted.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: stable@kernel.org
Reviewed-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 4f7f7b7e
...@@ -891,7 +891,7 @@ intel_alloc_mchbar_resource(struct drm_device *dev) ...@@ -891,7 +891,7 @@ intel_alloc_mchbar_resource(struct drm_device *dev)
int reg = IS_I965G(dev) ? MCHBAR_I965 : MCHBAR_I915; int reg = IS_I965G(dev) ? MCHBAR_I965 : MCHBAR_I915;
u32 temp_lo, temp_hi = 0; u32 temp_lo, temp_hi = 0;
u64 mchbar_addr; u64 mchbar_addr;
int ret = 0; int ret;
if (IS_I965G(dev)) if (IS_I965G(dev))
pci_read_config_dword(dev_priv->bridge_dev, reg + 4, &temp_hi); pci_read_config_dword(dev_priv->bridge_dev, reg + 4, &temp_hi);
...@@ -901,14 +901,15 @@ intel_alloc_mchbar_resource(struct drm_device *dev) ...@@ -901,14 +901,15 @@ intel_alloc_mchbar_resource(struct drm_device *dev)
/* If ACPI doesn't have it, assume we need to allocate it ourselves */ /* If ACPI doesn't have it, assume we need to allocate it ourselves */
#ifdef CONFIG_PNP #ifdef CONFIG_PNP
if (mchbar_addr && if (mchbar_addr &&
pnp_range_reserved(mchbar_addr, mchbar_addr + MCHBAR_SIZE)) { pnp_range_reserved(mchbar_addr, mchbar_addr + MCHBAR_SIZE))
ret = 0; return 0;
goto out;
}
#endif #endif
/* Get some space for it */ /* Get some space for it */
ret = pci_bus_alloc_resource(dev_priv->bridge_dev->bus, &dev_priv->mch_res, dev_priv->mch_res.name = "i915 MCHBAR";
dev_priv->mch_res.flags = IORESOURCE_MEM;
ret = pci_bus_alloc_resource(dev_priv->bridge_dev->bus,
&dev_priv->mch_res,
MCHBAR_SIZE, MCHBAR_SIZE, MCHBAR_SIZE, MCHBAR_SIZE,
PCIBIOS_MIN_MEM, PCIBIOS_MIN_MEM,
0, pcibios_align_resource, 0, pcibios_align_resource,
...@@ -916,7 +917,7 @@ intel_alloc_mchbar_resource(struct drm_device *dev) ...@@ -916,7 +917,7 @@ intel_alloc_mchbar_resource(struct drm_device *dev)
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("failed bus alloc: %d\n", ret); DRM_DEBUG_DRIVER("failed bus alloc: %d\n", ret);
dev_priv->mch_res.start = 0; dev_priv->mch_res.start = 0;
goto out; return ret;
} }
if (IS_I965G(dev)) if (IS_I965G(dev))
...@@ -925,8 +926,7 @@ intel_alloc_mchbar_resource(struct drm_device *dev) ...@@ -925,8 +926,7 @@ intel_alloc_mchbar_resource(struct drm_device *dev)
pci_write_config_dword(dev_priv->bridge_dev, reg, pci_write_config_dword(dev_priv->bridge_dev, reg,
lower_32_bits(dev_priv->mch_res.start)); lower_32_bits(dev_priv->mch_res.start));
out: return 0;
return ret;
} }
/* Setup MCHBAR if possible, return true if we should disable it again */ /* Setup MCHBAR if possible, return true if we should disable it again */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment