[Intel-gfx] [RFC 22/28] drm/i915: Use IS_GEN in stolen

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Wed Apr 14 11:50:22 UTC 2021


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

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

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
-- 
2.27.0



More information about the Intel-gfx mailing list