Commit f3ce44a0 authored by Lucas De Marchi's avatar Lucas De Marchi Committed by Rodrigo Vivi

drm/i915: merge gen checks to use range

Instead of using IS_GEN() for consecutive gen checks, let's pass the
range to IS_GEN_RANGE(). By code inspection these were the ranges deemed
necessary for spatch:

@@
expression e;
@@
(
- IS_GEN(e, 3) || IS_GEN(e, 2)
+ IS_GEN_RANGE(e, 2, 3)
|
- IS_GEN(e, 3) || IS_GEN(e, 4)
+ IS_GEN_RANGE(e, 3, 4)
|
- IS_GEN(e, 5) || IS_GEN(e, 6)
+ IS_GEN_RANGE(e, 5, 6)
|
- IS_GEN(e, 6) || IS_GEN(e, 7)
+ IS_GEN_RANGE(e, 6, 7)
|
- IS_GEN(e, 7) || IS_GEN(e, 8)
+ IS_GEN_RANGE(e, 7, 8)
|
- IS_GEN(e, 8) || IS_GEN(e, 9)
+ IS_GEN_RANGE(e, 8, 9)
|
- IS_GEN(e, 10) || IS_GEN(e, 9)
+ IS_GEN_RANGE(e, 9, 10)
|
- IS_GEN(e, 9) || IS_GEN(e, 10)
+ IS_GEN_RANGE(e, 9, 10)
)

After conversion, checking we don't have any missing IS_GEN_RANGE() ||
IS_GEN() was also done.
Signed-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181212181044.15886-3-lucas.demarchi@intel.com
parent cf819eff
...@@ -2040,7 +2040,7 @@ static int i915_swizzle_info(struct seq_file *m, void *data) ...@@ -2040,7 +2040,7 @@ static int i915_swizzle_info(struct seq_file *m, void *data)
seq_printf(m, "bit6 swizzle for Y-tiling = %s\n", seq_printf(m, "bit6 swizzle for Y-tiling = %s\n",
swizzle_string(dev_priv->mm.bit_6_swizzle_y)); swizzle_string(dev_priv->mm.bit_6_swizzle_y));
if (IS_GEN(dev_priv, 3) || IS_GEN(dev_priv, 4)) { if (IS_GEN_RANGE(dev_priv, 3, 4)) {
seq_printf(m, "DDC = 0x%08x\n", seq_printf(m, "DDC = 0x%08x\n",
I915_READ(DCC)); I915_READ(DCC));
seq_printf(m, "DDC2 = 0x%08x\n", seq_printf(m, "DDC2 = 0x%08x\n",
...@@ -4274,7 +4274,7 @@ i915_cache_sharing_get(void *data, u64 *val) ...@@ -4274,7 +4274,7 @@ i915_cache_sharing_get(void *data, u64 *val)
struct drm_i915_private *dev_priv = data; struct drm_i915_private *dev_priv = data;
u32 snpcr; u32 snpcr;
if (!(IS_GEN(dev_priv, 6) || IS_GEN(dev_priv, 7))) if (!(IS_GEN_RANGE(dev_priv, 6, 7)))
return -ENODEV; return -ENODEV;
intel_runtime_pm_get(dev_priv); intel_runtime_pm_get(dev_priv);
...@@ -4294,7 +4294,7 @@ i915_cache_sharing_set(void *data, u64 val) ...@@ -4294,7 +4294,7 @@ i915_cache_sharing_set(void *data, u64 val)
struct drm_i915_private *dev_priv = data; struct drm_i915_private *dev_priv = data;
u32 snpcr; u32 snpcr;
if (!(IS_GEN(dev_priv, 6) || IS_GEN(dev_priv, 7))) if (!(IS_GEN_RANGE(dev_priv, 6, 7)))
return -ENODEV; return -ENODEV;
if (val > 3) if (val > 3)
......
...@@ -1753,7 +1753,7 @@ static void capture_reg_state(struct i915_gpu_state *error) ...@@ -1753,7 +1753,7 @@ static void capture_reg_state(struct i915_gpu_state *error)
error->ccid = I915_READ(CCID); error->ccid = I915_READ(CCID);
/* 3: Feature specific registers */ /* 3: Feature specific registers */
if (IS_GEN(dev_priv, 6) || IS_GEN(dev_priv, 7)) { if (IS_GEN_RANGE(dev_priv, 6, 7)) {
error->gam_ecochk = I915_READ(GAM_ECOCHK); error->gam_ecochk = I915_READ(GAM_ECOCHK);
error->gac_eco = I915_READ(GAC_ECO_BITS); error->gac_eco = I915_READ(GAC_ECO_BITS);
} }
......
...@@ -3415,7 +3415,7 @@ void i915_perf_init(struct drm_i915_private *dev_priv) ...@@ -3415,7 +3415,7 @@ void i915_perf_init(struct drm_i915_private *dev_priv)
dev_priv->perf.oa.ops.read = gen8_oa_read; dev_priv->perf.oa.ops.read = gen8_oa_read;
dev_priv->perf.oa.ops.oa_hw_tail_read = gen8_oa_hw_tail_read; dev_priv->perf.oa.ops.oa_hw_tail_read = gen8_oa_hw_tail_read;
if (IS_GEN(dev_priv, 8) || IS_GEN(dev_priv, 9)) { if (IS_GEN_RANGE(dev_priv, 8, 9)) {
dev_priv->perf.oa.ops.is_valid_b_counter_reg = dev_priv->perf.oa.ops.is_valid_b_counter_reg =
gen7_is_valid_b_counter_addr; gen7_is_valid_b_counter_addr;
dev_priv->perf.oa.ops.is_valid_mux_reg = dev_priv->perf.oa.ops.is_valid_mux_reg =
......
...@@ -322,7 +322,7 @@ intel_crt_mode_valid(struct drm_connector *connector, ...@@ -322,7 +322,7 @@ intel_crt_mode_valid(struct drm_connector *connector,
* DAC limit supposedly 355 MHz. * DAC limit supposedly 355 MHz.
*/ */
max_clock = 270000; max_clock = 270000;
else if (IS_GEN(dev_priv, 3) || IS_GEN(dev_priv, 4)) else if (IS_GEN_RANGE(dev_priv, 3, 4))
max_clock = 400000; max_clock = 400000;
else else
max_clock = 350000; max_clock = 350000;
......
...@@ -787,7 +787,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info) ...@@ -787,7 +787,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
DRM_INFO("Display disabled (module parameter)\n"); DRM_INFO("Display disabled (module parameter)\n");
info->num_pipes = 0; info->num_pipes = 0;
} else if (HAS_DISPLAY(dev_priv) && } else if (HAS_DISPLAY(dev_priv) &&
(IS_GEN(dev_priv, 7) || IS_GEN(dev_priv, 8)) && (IS_GEN_RANGE(dev_priv, 7, 8)) &&
HAS_PCH_SPLIT(dev_priv)) { HAS_PCH_SPLIT(dev_priv)) {
u32 fuse_strap = I915_READ(FUSE_STRAP); u32 fuse_strap = I915_READ(FUSE_STRAP);
u32 sfuse_strap = I915_READ(SFUSE_STRAP); u32 sfuse_strap = I915_READ(SFUSE_STRAP);
......
...@@ -10815,7 +10815,7 @@ int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_stat ...@@ -10815,7 +10815,7 @@ int intel_plane_atomic_calc_changes(const struct intel_crtc_state *old_crtc_stat
* the w/a on all three platforms. * the w/a on all three platforms.
*/ */
if (plane->id == PLANE_SPRITE0 && if (plane->id == PLANE_SPRITE0 &&
(IS_GEN(dev_priv, 5) || IS_GEN(dev_priv, 6) || (IS_GEN_RANGE(dev_priv, 5, 6) ||
IS_IVYBRIDGE(dev_priv)) && IS_IVYBRIDGE(dev_priv)) &&
(turn_on || (!needs_scaling(old_plane_state) && (turn_on || (!needs_scaling(old_plane_state) &&
needs_scaling(to_intel_plane_state(plane_state))))) needs_scaling(to_intel_plane_state(plane_state)))))
......
...@@ -438,7 +438,7 @@ void intel_engine_init_global_seqno(struct intel_engine_cs *engine, u32 seqno) ...@@ -438,7 +438,7 @@ void intel_engine_init_global_seqno(struct intel_engine_cs *engine, u32 seqno)
* the semaphore value, then when the seqno moves backwards all * the semaphore value, then when the seqno moves backwards all
* future waits will complete instantly (causing rendering corruption). * future waits will complete instantly (causing rendering corruption).
*/ */
if (IS_GEN(dev_priv, 6) || IS_GEN(dev_priv, 7)) { if (IS_GEN_RANGE(dev_priv, 6, 7)) {
I915_WRITE(RING_SYNC_0(engine->mmio_base), 0); I915_WRITE(RING_SYNC_0(engine->mmio_base), 0);
I915_WRITE(RING_SYNC_1(engine->mmio_base), 0); I915_WRITE(RING_SYNC_1(engine->mmio_base), 0);
if (HAS_VEBOX(dev_priv)) if (HAS_VEBOX(dev_priv))
......
...@@ -260,7 +260,7 @@ static bool __intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev, ...@@ -260,7 +260,7 @@ static bool __intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev,
if (HAS_GMCH_DISPLAY(dev_priv)) if (HAS_GMCH_DISPLAY(dev_priv))
i9xx_set_fifo_underrun_reporting(dev, pipe, enable, old); i9xx_set_fifo_underrun_reporting(dev, pipe, enable, old);
else if (IS_GEN(dev_priv, 5) || IS_GEN(dev_priv, 6)) else if (IS_GEN_RANGE(dev_priv, 5, 6))
ironlake_set_fifo_underrun_reporting(dev, pipe, enable); ironlake_set_fifo_underrun_reporting(dev, pipe, enable);
else if (IS_GEN(dev_priv, 7)) else if (IS_GEN(dev_priv, 7))
ivybridge_set_fifo_underrun_reporting(dev, pipe, enable, old); ivybridge_set_fifo_underrun_reporting(dev, pipe, enable, old);
......
...@@ -433,7 +433,7 @@ static int get_new_crc_ctl_reg(struct drm_i915_private *dev_priv, ...@@ -433,7 +433,7 @@ static int get_new_crc_ctl_reg(struct drm_i915_private *dev_priv,
return i9xx_pipe_crc_ctl_reg(dev_priv, pipe, source, val); return i9xx_pipe_crc_ctl_reg(dev_priv, pipe, source, val);
else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
return vlv_pipe_crc_ctl_reg(dev_priv, pipe, source, val); return vlv_pipe_crc_ctl_reg(dev_priv, pipe, source, val);
else if (IS_GEN(dev_priv, 5) || IS_GEN(dev_priv, 6)) else if (IS_GEN_RANGE(dev_priv, 5, 6))
return ilk_pipe_crc_ctl_reg(source, val); return ilk_pipe_crc_ctl_reg(source, val);
else else
return ivb_pipe_crc_ctl_reg(dev_priv, pipe, source, val, set_wa); return ivb_pipe_crc_ctl_reg(dev_priv, pipe, source, val, set_wa);
...@@ -550,7 +550,7 @@ intel_is_valid_crc_source(struct drm_i915_private *dev_priv, ...@@ -550,7 +550,7 @@ intel_is_valid_crc_source(struct drm_i915_private *dev_priv,
return i9xx_crc_source_valid(dev_priv, source); return i9xx_crc_source_valid(dev_priv, source);
else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
return vlv_crc_source_valid(dev_priv, source); return vlv_crc_source_valid(dev_priv, source);
else if (IS_GEN(dev_priv, 5) || IS_GEN(dev_priv, 6)) else if (IS_GEN_RANGE(dev_priv, 5, 6))
return ilk_crc_source_valid(dev_priv, source); return ilk_crc_source_valid(dev_priv, source);
else else
return ivb_crc_source_valid(dev_priv, source); return ivb_crc_source_valid(dev_priv, source);
......
...@@ -528,7 +528,7 @@ check_for_unclaimed_mmio(struct drm_i915_private *dev_priv) ...@@ -528,7 +528,7 @@ check_for_unclaimed_mmio(struct drm_i915_private *dev_priv)
if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
ret |= vlv_check_for_unclaimed_mmio(dev_priv); ret |= vlv_check_for_unclaimed_mmio(dev_priv);
if (IS_GEN(dev_priv, 6) || IS_GEN(dev_priv, 7)) if (IS_GEN_RANGE(dev_priv, 6, 7))
ret |= gen6_check_for_fifo_debug(dev_priv); ret |= gen6_check_for_fifo_debug(dev_priv);
return ret; return ret;
...@@ -556,7 +556,7 @@ static void __intel_uncore_early_sanitize(struct drm_i915_private *dev_priv, ...@@ -556,7 +556,7 @@ static void __intel_uncore_early_sanitize(struct drm_i915_private *dev_priv,
dev_priv->uncore.funcs.force_wake_get(dev_priv, dev_priv->uncore.funcs.force_wake_get(dev_priv,
restore_forcewake); restore_forcewake);
if (IS_GEN(dev_priv, 6) || IS_GEN(dev_priv, 7)) if (IS_GEN_RANGE(dev_priv, 6, 7))
dev_priv->uncore.fifo_count = dev_priv->uncore.fifo_count =
fifo_free_entries(dev_priv); fifo_free_entries(dev_priv);
spin_unlock_irq(&dev_priv->uncore.lock); spin_unlock_irq(&dev_priv->uncore.lock);
...@@ -1437,7 +1437,7 @@ static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv) ...@@ -1437,7 +1437,7 @@ static void intel_uncore_fw_domains_init(struct drm_i915_private *dev_priv)
FORCEWAKE_MEDIA_VEBOX_GEN11(i), FORCEWAKE_MEDIA_VEBOX_GEN11(i),
FORCEWAKE_ACK_MEDIA_VEBOX_GEN11(i)); FORCEWAKE_ACK_MEDIA_VEBOX_GEN11(i));
} }
} else if (IS_GEN(dev_priv, 10) || IS_GEN(dev_priv, 9)) { } else if (IS_GEN_RANGE(dev_priv, 9, 10)) {
dev_priv->uncore.funcs.force_wake_get = dev_priv->uncore.funcs.force_wake_get =
fw_domains_get_with_fallback; fw_domains_get_with_fallback;
dev_priv->uncore.funcs.force_wake_put = fw_domains_put; dev_priv->uncore.funcs.force_wake_put = fw_domains_put;
......
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