diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-09-11 07:28:08 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-09-19 08:41:19 -0400 |
commit | 40bae736116233a7e46711a9d28fc72d0e7d33eb (patch) | |
tree | 1ed20b361de2f5ca90d33aa836fcbea08d602a02 /drivers/gpu | |
parent | 4144f9b5e003e65b7e4be6abfff133bc83e73fec (diff) |
drm/i915: Extend BIOS stolen mem handling to all platform
Based upon a patch from Deepak, but reworked to only apply on gen7+
and with the logic a bit clarified.
v2: Fix s/SHIFT/MASK/ fumble that Ville spotted.
Cc: Deepak S <deepak.s@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_stolen.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_reg.h | 8 |
2 files changed, 19 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c index 21c025a209c0..85fda6b803e4 100644 --- a/drivers/gpu/drm/i915/i915_gem_stolen.c +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c | |||
@@ -289,6 +289,7 @@ void i915_gem_cleanup_stolen(struct drm_device *dev) | |||
289 | int i915_gem_init_stolen(struct drm_device *dev) | 289 | int i915_gem_init_stolen(struct drm_device *dev) |
290 | { | 290 | { |
291 | struct drm_i915_private *dev_priv = dev->dev_private; | 291 | struct drm_i915_private *dev_priv = dev->dev_private; |
292 | u32 tmp; | ||
292 | int bios_reserved = 0; | 293 | int bios_reserved = 0; |
293 | 294 | ||
294 | #ifdef CONFIG_INTEL_IOMMU | 295 | #ifdef CONFIG_INTEL_IOMMU |
@@ -308,8 +309,16 @@ int i915_gem_init_stolen(struct drm_device *dev) | |||
308 | DRM_DEBUG_KMS("found %zd bytes of stolen memory at %08lx\n", | 309 | DRM_DEBUG_KMS("found %zd bytes of stolen memory at %08lx\n", |
309 | dev_priv->gtt.stolen_size, dev_priv->mm.stolen_base); | 310 | dev_priv->gtt.stolen_size, dev_priv->mm.stolen_base); |
310 | 311 | ||
311 | if (IS_VALLEYVIEW(dev)) | 312 | if (INTEL_INFO(dev)->gen >= 8) { |
312 | bios_reserved = 1024*1024; /* top 1M on VLV/BYT */ | 313 | tmp = I915_READ(GEN7_BIOS_RESERVED); |
314 | tmp >>= GEN8_BIOS_RESERVED_SHIFT; | ||
315 | tmp &= GEN8_BIOS_RESERVED_MASK; | ||
316 | bios_reserved = (1024*1024) << tmp; | ||
317 | } else if (IS_GEN7(dev)) { | ||
318 | tmp = I915_READ(GEN7_BIOS_RESERVED); | ||
319 | bios_reserved = tmp & GEN7_BIOS_RESERVED_256K ? | ||
320 | 256*1024 : 1024*1024; | ||
321 | } | ||
313 | 322 | ||
314 | if (WARN_ON(bios_reserved > dev_priv->gtt.stolen_size)) | 323 | if (WARN_ON(bios_reserved > dev_priv->gtt.stolen_size)) |
315 | return 0; | 324 | return 0; |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index b65bdfc23ccb..ad8179b40d19 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -143,6 +143,14 @@ | |||
143 | #define GAB_CTL 0x24000 | 143 | #define GAB_CTL 0x24000 |
144 | #define GAB_CTL_CONT_AFTER_PAGEFAULT (1<<8) | 144 | #define GAB_CTL_CONT_AFTER_PAGEFAULT (1<<8) |
145 | 145 | ||
146 | #define GEN7_BIOS_RESERVED 0x1082C0 | ||
147 | #define GEN7_BIOS_RESERVED_1M (0 << 5) | ||
148 | #define GEN7_BIOS_RESERVED_256K (1 << 5) | ||
149 | #define GEN8_BIOS_RESERVED_SHIFT 7 | ||
150 | #define GEN7_BIOS_RESERVED_MASK 0x1 | ||
151 | #define GEN8_BIOS_RESERVED_MASK 0x3 | ||
152 | |||
153 | |||
146 | /* VGA stuff */ | 154 | /* VGA stuff */ |
147 | 155 | ||
148 | #define VGA_ST01_MDA 0x3ba | 156 | #define VGA_ST01_MDA 0x3ba |