diff mbox series

[RFC,22/28] drm/i915: Use IS_GEN in stolen

Message ID 20210414115028.168504-23-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New
Headers show
Series Old platform/gen kconfig options series | expand

Commit Message

Tvrtko Ursulin April 14, 2021, 11:50 a.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_stolen.c | 36 ++++++++++----------------
 1 file changed, 14 insertions(+), 22 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c b/drivers/gpu/drm/i915/i915_gem_stolen.c
index 0afd50cf71de..4a9f545f0c4e 100644
--- a/drivers/gpu/drm/i915/i915_gem_stolen.c
+++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
@@ -356,34 +356,26 @@  int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
 	reserved_base = 0;
 	reserved_size = 0;
 
-	switch (INTEL_GEN(dev_priv)) {
-	case 2:
-	case 3:
-		break;
-	case 4:
-		if (!IS_G4X(dev_priv))
-			break;
-		/* fall through */
-	case 5:
-		g4x_get_stolen_reserved(dev_priv,
-					&reserved_base, &reserved_size);
-		break;
-	case 6:
-		gen6_get_stolen_reserved(dev_priv,
-					 &reserved_base, &reserved_size);
-		break;
-	case 7:
-		gen7_get_stolen_reserved(dev_priv,
-					 &reserved_base, &reserved_size);
-		break;
-	default:
+	if (IS_GEN(dev_priv, 8, GEN_FOREVER)) {
 		if (IS_LP(dev_priv))
 			chv_get_stolen_reserved(dev_priv,
 						&reserved_base, &reserved_size);
 		else
 			bdw_get_stolen_reserved(dev_priv,
 						&reserved_base, &reserved_size);
-		break;
+
+	} else if (IS_GEN(dev_priv, 7, GEN_FOREVER)) {
+		gen7_get_stolen_reserved(dev_priv,
+					&reserved_base, &reserved_size);
+	} else if (IS_GEN(dev_priv, 6, GEN_FOREVER)) {
+		gen6_get_stolen_reserved(dev_priv,
+					 &reserved_base, &reserved_size);
+	} else if (IS_GEN(dev_priv, 5, GEN_FOREVER)) {
+		g4x_get_stolen_reserved(dev_priv,
+					&reserved_base, &reserved_size);
+	} else if (IS_GEN(dev_priv, 4, GEN_FOREVER) && IS_G4X(dev_priv)) {
+		g4x_get_stolen_reserved(dev_priv,
+					&reserved_base, &reserved_size);
 	}
 
 	/* It is possible for the reserved base to be zero, but the register