162306a36Sopenharmony_ci// SPDX-License-Identifier: MIT
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright © 2020,2021 Intel Corporation
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#include "i915_drv.h"
762306a36Sopenharmony_ci#include "intel_step.h"
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci/*
1062306a36Sopenharmony_ci * Some platforms have unusual ways of mapping PCI revision ID to GT/display
1162306a36Sopenharmony_ci * steppings.  E.g., in some cases a higher PCI revision may translate to a
1262306a36Sopenharmony_ci * lower stepping of the GT and/or display IP.  This file provides lookup
1362306a36Sopenharmony_ci * tables to map the PCI revision into a standard set of stepping values that
1462306a36Sopenharmony_ci * can be compared numerically.
1562306a36Sopenharmony_ci *
1662306a36Sopenharmony_ci * Also note that some revisions/steppings may have been set aside as
1762306a36Sopenharmony_ci * placeholders but never materialized in real hardware; in those cases there
1862306a36Sopenharmony_ci * may be jumps in the revision IDs or stepping values in the tables below.
1962306a36Sopenharmony_ci */
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/*
2262306a36Sopenharmony_ci * Some platforms always have the same stepping value for GT and display;
2362306a36Sopenharmony_ci * use a macro to define these to make it easier to identify the platforms
2462306a36Sopenharmony_ci * where the two steppings can deviate.
2562306a36Sopenharmony_ci */
2662306a36Sopenharmony_ci#define COMMON_STEP(x)  .graphics_step = STEP_##x, .display_step = STEP_##x, .media_step = STEP_##x
2762306a36Sopenharmony_ci#define COMMON_GT_MEDIA_STEP(x)  .graphics_step = STEP_##x, .media_step = STEP_##x
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_cistatic const struct intel_step_info skl_revids[] = {
3062306a36Sopenharmony_ci	[0x6] = { COMMON_STEP(G0) },
3162306a36Sopenharmony_ci	[0x7] = { COMMON_STEP(H0) },
3262306a36Sopenharmony_ci	[0x9] = { COMMON_STEP(J0) },
3362306a36Sopenharmony_ci	[0xA] = { COMMON_STEP(I1) },
3462306a36Sopenharmony_ci};
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_cistatic const struct intel_step_info kbl_revids[] = {
3762306a36Sopenharmony_ci	[1] = { COMMON_GT_MEDIA_STEP(B0), .display_step = STEP_B0 },
3862306a36Sopenharmony_ci	[2] = { COMMON_GT_MEDIA_STEP(C0), .display_step = STEP_B0 },
3962306a36Sopenharmony_ci	[3] = { COMMON_GT_MEDIA_STEP(D0), .display_step = STEP_B0 },
4062306a36Sopenharmony_ci	[4] = { COMMON_GT_MEDIA_STEP(F0), .display_step = STEP_C0 },
4162306a36Sopenharmony_ci	[5] = { COMMON_GT_MEDIA_STEP(C0), .display_step = STEP_B1 },
4262306a36Sopenharmony_ci	[6] = { COMMON_GT_MEDIA_STEP(D1), .display_step = STEP_B1 },
4362306a36Sopenharmony_ci	[7] = { COMMON_GT_MEDIA_STEP(G0), .display_step = STEP_C0 },
4462306a36Sopenharmony_ci};
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_cistatic const struct intel_step_info bxt_revids[] = {
4762306a36Sopenharmony_ci	[0xA] = { COMMON_STEP(C0) },
4862306a36Sopenharmony_ci	[0xB] = { COMMON_STEP(C0) },
4962306a36Sopenharmony_ci	[0xC] = { COMMON_STEP(D0) },
5062306a36Sopenharmony_ci	[0xD] = { COMMON_STEP(E0) },
5162306a36Sopenharmony_ci};
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_cistatic const struct intel_step_info glk_revids[] = {
5462306a36Sopenharmony_ci	[3] = { COMMON_STEP(B0) },
5562306a36Sopenharmony_ci};
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_cistatic const struct intel_step_info icl_revids[] = {
5862306a36Sopenharmony_ci	[7] = { COMMON_STEP(D0) },
5962306a36Sopenharmony_ci};
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_cistatic const struct intel_step_info jsl_ehl_revids[] = {
6262306a36Sopenharmony_ci	[0] = { COMMON_STEP(A0) },
6362306a36Sopenharmony_ci	[1] = { COMMON_STEP(B0) },
6462306a36Sopenharmony_ci};
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_cistatic const struct intel_step_info tgl_uy_revids[] = {
6762306a36Sopenharmony_ci	[0] = { COMMON_GT_MEDIA_STEP(A0), .display_step = STEP_A0 },
6862306a36Sopenharmony_ci	[1] = { COMMON_GT_MEDIA_STEP(B0), .display_step = STEP_C0 },
6962306a36Sopenharmony_ci	[2] = { COMMON_GT_MEDIA_STEP(B1), .display_step = STEP_C0 },
7062306a36Sopenharmony_ci	[3] = { COMMON_GT_MEDIA_STEP(C0), .display_step = STEP_D0 },
7162306a36Sopenharmony_ci};
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci/* Same GT stepping between tgl_uy_revids and tgl_revids don't mean the same HW */
7462306a36Sopenharmony_cistatic const struct intel_step_info tgl_revids[] = {
7562306a36Sopenharmony_ci	[0] = { COMMON_GT_MEDIA_STEP(A0), .display_step = STEP_B0 },
7662306a36Sopenharmony_ci	[1] = { COMMON_GT_MEDIA_STEP(B0), .display_step = STEP_D0 },
7762306a36Sopenharmony_ci};
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_cistatic const struct intel_step_info rkl_revids[] = {
8062306a36Sopenharmony_ci	[0] = { COMMON_STEP(A0) },
8162306a36Sopenharmony_ci	[1] = { COMMON_STEP(B0) },
8262306a36Sopenharmony_ci	[4] = { COMMON_STEP(C0) },
8362306a36Sopenharmony_ci};
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_cistatic const struct intel_step_info dg1_revids[] = {
8662306a36Sopenharmony_ci	[0] = { COMMON_STEP(A0) },
8762306a36Sopenharmony_ci	[1] = { COMMON_STEP(B0) },
8862306a36Sopenharmony_ci};
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_cistatic const struct intel_step_info adls_revids[] = {
9162306a36Sopenharmony_ci	[0x0] = { COMMON_GT_MEDIA_STEP(A0), .display_step = STEP_A0 },
9262306a36Sopenharmony_ci	[0x1] = { COMMON_GT_MEDIA_STEP(A0), .display_step = STEP_A2 },
9362306a36Sopenharmony_ci	[0x4] = { COMMON_GT_MEDIA_STEP(B0), .display_step = STEP_B0 },
9462306a36Sopenharmony_ci	[0x8] = { COMMON_GT_MEDIA_STEP(C0), .display_step = STEP_B0 },
9562306a36Sopenharmony_ci	[0xC] = { COMMON_GT_MEDIA_STEP(D0), .display_step = STEP_C0 },
9662306a36Sopenharmony_ci};
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_cistatic const struct intel_step_info adlp_revids[] = {
9962306a36Sopenharmony_ci	[0x0] = { COMMON_GT_MEDIA_STEP(A0), .display_step = STEP_A0 },
10062306a36Sopenharmony_ci	[0x4] = { COMMON_GT_MEDIA_STEP(B0), .display_step = STEP_B0 },
10162306a36Sopenharmony_ci	[0x8] = { COMMON_GT_MEDIA_STEP(C0), .display_step = STEP_C0 },
10262306a36Sopenharmony_ci	[0xC] = { COMMON_GT_MEDIA_STEP(C0), .display_step = STEP_D0 },
10362306a36Sopenharmony_ci};
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_cistatic const struct intel_step_info xehpsdv_revids[] = {
10662306a36Sopenharmony_ci	[0x0] = { COMMON_GT_MEDIA_STEP(A0) },
10762306a36Sopenharmony_ci	[0x1] = { COMMON_GT_MEDIA_STEP(A1) },
10862306a36Sopenharmony_ci	[0x4] = { COMMON_GT_MEDIA_STEP(B0) },
10962306a36Sopenharmony_ci	[0x8] = { COMMON_GT_MEDIA_STEP(C0) },
11062306a36Sopenharmony_ci};
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_cistatic const struct intel_step_info dg2_g10_revid_step_tbl[] = {
11362306a36Sopenharmony_ci	[0x0] = { COMMON_GT_MEDIA_STEP(A0), .display_step = STEP_A0 },
11462306a36Sopenharmony_ci	[0x1] = { COMMON_GT_MEDIA_STEP(A1), .display_step = STEP_A0 },
11562306a36Sopenharmony_ci	[0x4] = { COMMON_GT_MEDIA_STEP(B0), .display_step = STEP_B0 },
11662306a36Sopenharmony_ci	[0x8] = { COMMON_GT_MEDIA_STEP(C0), .display_step = STEP_C0 },
11762306a36Sopenharmony_ci};
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_cistatic const struct intel_step_info dg2_g11_revid_step_tbl[] = {
12062306a36Sopenharmony_ci	[0x0] = { COMMON_GT_MEDIA_STEP(A0), .display_step = STEP_B0 },
12162306a36Sopenharmony_ci	[0x4] = { COMMON_GT_MEDIA_STEP(B0), .display_step = STEP_C0 },
12262306a36Sopenharmony_ci	[0x5] = { COMMON_GT_MEDIA_STEP(B1), .display_step = STEP_C0 },
12362306a36Sopenharmony_ci};
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_cistatic const struct intel_step_info dg2_g12_revid_step_tbl[] = {
12662306a36Sopenharmony_ci	[0x0] = { COMMON_GT_MEDIA_STEP(A0), .display_step = STEP_C0 },
12762306a36Sopenharmony_ci};
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_cistatic const struct intel_step_info adls_rpls_revids[] = {
13062306a36Sopenharmony_ci	[0x4] = { COMMON_GT_MEDIA_STEP(D0), .display_step = STEP_D0 },
13162306a36Sopenharmony_ci	[0xC] = { COMMON_GT_MEDIA_STEP(D0), .display_step = STEP_C0 },
13262306a36Sopenharmony_ci};
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_cistatic const struct intel_step_info adlp_rplp_revids[] = {
13562306a36Sopenharmony_ci	[0x4] = { COMMON_GT_MEDIA_STEP(C0), .display_step = STEP_E0 },
13662306a36Sopenharmony_ci};
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_cistatic const struct intel_step_info adlp_n_revids[] = {
13962306a36Sopenharmony_ci	[0x0] = { COMMON_GT_MEDIA_STEP(A0), .display_step = STEP_D0 },
14062306a36Sopenharmony_ci};
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_cistatic u8 gmd_to_intel_step(struct drm_i915_private *i915,
14362306a36Sopenharmony_ci			    struct intel_ip_version *gmd)
14462306a36Sopenharmony_ci{
14562306a36Sopenharmony_ci	u8 step = gmd->step + STEP_A0;
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci	if (step >= STEP_FUTURE) {
14862306a36Sopenharmony_ci		drm_dbg(&i915->drm, "Using future steppings\n");
14962306a36Sopenharmony_ci		return STEP_FUTURE;
15062306a36Sopenharmony_ci	}
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci	return step;
15362306a36Sopenharmony_ci}
15462306a36Sopenharmony_ci
15562306a36Sopenharmony_cistatic void pvc_step_init(struct drm_i915_private *i915, int pci_revid);
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_civoid intel_step_init(struct drm_i915_private *i915)
15862306a36Sopenharmony_ci{
15962306a36Sopenharmony_ci	const struct intel_step_info *revids = NULL;
16062306a36Sopenharmony_ci	int size = 0;
16162306a36Sopenharmony_ci	int revid = INTEL_REVID(i915);
16262306a36Sopenharmony_ci	struct intel_step_info step = {};
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci	if (HAS_GMD_ID(i915)) {
16562306a36Sopenharmony_ci		step.graphics_step = gmd_to_intel_step(i915,
16662306a36Sopenharmony_ci						       &RUNTIME_INFO(i915)->graphics.ip);
16762306a36Sopenharmony_ci		step.media_step = gmd_to_intel_step(i915,
16862306a36Sopenharmony_ci						    &RUNTIME_INFO(i915)->media.ip);
16962306a36Sopenharmony_ci		step.display_step = STEP_A0 + DISPLAY_RUNTIME_INFO(i915)->ip.step;
17062306a36Sopenharmony_ci		if (step.display_step >= STEP_FUTURE) {
17162306a36Sopenharmony_ci			drm_dbg(&i915->drm, "Using future display steppings\n");
17262306a36Sopenharmony_ci			step.display_step = STEP_FUTURE;
17362306a36Sopenharmony_ci		}
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci		RUNTIME_INFO(i915)->step = step;
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci		return;
17862306a36Sopenharmony_ci	}
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci	if (IS_PONTEVECCHIO(i915)) {
18162306a36Sopenharmony_ci		pvc_step_init(i915, revid);
18262306a36Sopenharmony_ci		return;
18362306a36Sopenharmony_ci	} else if (IS_DG2_G10(i915)) {
18462306a36Sopenharmony_ci		revids = dg2_g10_revid_step_tbl;
18562306a36Sopenharmony_ci		size = ARRAY_SIZE(dg2_g10_revid_step_tbl);
18662306a36Sopenharmony_ci	} else if (IS_DG2_G11(i915)) {
18762306a36Sopenharmony_ci		revids = dg2_g11_revid_step_tbl;
18862306a36Sopenharmony_ci		size = ARRAY_SIZE(dg2_g11_revid_step_tbl);
18962306a36Sopenharmony_ci	} else if (IS_DG2_G12(i915)) {
19062306a36Sopenharmony_ci		revids = dg2_g12_revid_step_tbl;
19162306a36Sopenharmony_ci		size = ARRAY_SIZE(dg2_g12_revid_step_tbl);
19262306a36Sopenharmony_ci	} else if (IS_XEHPSDV(i915)) {
19362306a36Sopenharmony_ci		revids = xehpsdv_revids;
19462306a36Sopenharmony_ci		size = ARRAY_SIZE(xehpsdv_revids);
19562306a36Sopenharmony_ci	} else if (IS_ALDERLAKE_P_N(i915)) {
19662306a36Sopenharmony_ci		revids = adlp_n_revids;
19762306a36Sopenharmony_ci		size = ARRAY_SIZE(adlp_n_revids);
19862306a36Sopenharmony_ci	} else if (IS_RAPTORLAKE_P(i915)) {
19962306a36Sopenharmony_ci		revids = adlp_rplp_revids;
20062306a36Sopenharmony_ci		size = ARRAY_SIZE(adlp_rplp_revids);
20162306a36Sopenharmony_ci	} else if (IS_ALDERLAKE_P(i915)) {
20262306a36Sopenharmony_ci		revids = adlp_revids;
20362306a36Sopenharmony_ci		size = ARRAY_SIZE(adlp_revids);
20462306a36Sopenharmony_ci	} else if (IS_RAPTORLAKE_S(i915)) {
20562306a36Sopenharmony_ci		revids = adls_rpls_revids;
20662306a36Sopenharmony_ci		size = ARRAY_SIZE(adls_rpls_revids);
20762306a36Sopenharmony_ci	} else if (IS_ALDERLAKE_S(i915)) {
20862306a36Sopenharmony_ci		revids = adls_revids;
20962306a36Sopenharmony_ci		size = ARRAY_SIZE(adls_revids);
21062306a36Sopenharmony_ci	} else if (IS_DG1(i915)) {
21162306a36Sopenharmony_ci		revids = dg1_revids;
21262306a36Sopenharmony_ci		size = ARRAY_SIZE(dg1_revids);
21362306a36Sopenharmony_ci	} else if (IS_ROCKETLAKE(i915)) {
21462306a36Sopenharmony_ci		revids = rkl_revids;
21562306a36Sopenharmony_ci		size = ARRAY_SIZE(rkl_revids);
21662306a36Sopenharmony_ci	} else if (IS_TIGERLAKE_UY(i915)) {
21762306a36Sopenharmony_ci		revids = tgl_uy_revids;
21862306a36Sopenharmony_ci		size = ARRAY_SIZE(tgl_uy_revids);
21962306a36Sopenharmony_ci	} else if (IS_TIGERLAKE(i915)) {
22062306a36Sopenharmony_ci		revids = tgl_revids;
22162306a36Sopenharmony_ci		size = ARRAY_SIZE(tgl_revids);
22262306a36Sopenharmony_ci	} else if (IS_JASPERLAKE(i915) || IS_ELKHARTLAKE(i915)) {
22362306a36Sopenharmony_ci		revids = jsl_ehl_revids;
22462306a36Sopenharmony_ci		size = ARRAY_SIZE(jsl_ehl_revids);
22562306a36Sopenharmony_ci	} else if (IS_ICELAKE(i915)) {
22662306a36Sopenharmony_ci		revids = icl_revids;
22762306a36Sopenharmony_ci		size = ARRAY_SIZE(icl_revids);
22862306a36Sopenharmony_ci	} else if (IS_GEMINILAKE(i915)) {
22962306a36Sopenharmony_ci		revids = glk_revids;
23062306a36Sopenharmony_ci		size = ARRAY_SIZE(glk_revids);
23162306a36Sopenharmony_ci	} else if (IS_BROXTON(i915)) {
23262306a36Sopenharmony_ci		revids = bxt_revids;
23362306a36Sopenharmony_ci		size = ARRAY_SIZE(bxt_revids);
23462306a36Sopenharmony_ci	} else if (IS_KABYLAKE(i915)) {
23562306a36Sopenharmony_ci		revids = kbl_revids;
23662306a36Sopenharmony_ci		size = ARRAY_SIZE(kbl_revids);
23762306a36Sopenharmony_ci	} else if (IS_SKYLAKE(i915)) {
23862306a36Sopenharmony_ci		revids = skl_revids;
23962306a36Sopenharmony_ci		size = ARRAY_SIZE(skl_revids);
24062306a36Sopenharmony_ci	}
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_ci	/* Not using the stepping scheme for the platform yet. */
24362306a36Sopenharmony_ci	if (!revids)
24462306a36Sopenharmony_ci		return;
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci	if (revid < size && revids[revid].graphics_step != STEP_NONE) {
24762306a36Sopenharmony_ci		step = revids[revid];
24862306a36Sopenharmony_ci	} else {
24962306a36Sopenharmony_ci		drm_warn(&i915->drm, "Unknown revid 0x%02x\n", revid);
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci		/*
25262306a36Sopenharmony_ci		 * If we hit a gap in the revid array, use the information for
25362306a36Sopenharmony_ci		 * the next revid.
25462306a36Sopenharmony_ci		 *
25562306a36Sopenharmony_ci		 * This may be wrong in all sorts of ways, especially if the
25662306a36Sopenharmony_ci		 * steppings in the array are not monotonically increasing, but
25762306a36Sopenharmony_ci		 * it's better than defaulting to 0.
25862306a36Sopenharmony_ci		 */
25962306a36Sopenharmony_ci		while (revid < size && revids[revid].graphics_step == STEP_NONE)
26062306a36Sopenharmony_ci			revid++;
26162306a36Sopenharmony_ci
26262306a36Sopenharmony_ci		if (revid < size) {
26362306a36Sopenharmony_ci			drm_dbg(&i915->drm, "Using steppings for revid 0x%02x\n",
26462306a36Sopenharmony_ci				revid);
26562306a36Sopenharmony_ci			step = revids[revid];
26662306a36Sopenharmony_ci		} else {
26762306a36Sopenharmony_ci			drm_dbg(&i915->drm, "Using future steppings\n");
26862306a36Sopenharmony_ci			step.graphics_step = STEP_FUTURE;
26962306a36Sopenharmony_ci			step.display_step = STEP_FUTURE;
27062306a36Sopenharmony_ci		}
27162306a36Sopenharmony_ci	}
27262306a36Sopenharmony_ci
27362306a36Sopenharmony_ci	if (drm_WARN_ON(&i915->drm, step.graphics_step == STEP_NONE))
27462306a36Sopenharmony_ci		return;
27562306a36Sopenharmony_ci
27662306a36Sopenharmony_ci	RUNTIME_INFO(i915)->step = step;
27762306a36Sopenharmony_ci}
27862306a36Sopenharmony_ci
27962306a36Sopenharmony_ci#define PVC_BD_REVID	GENMASK(5, 3)
28062306a36Sopenharmony_ci#define PVC_CT_REVID	GENMASK(2, 0)
28162306a36Sopenharmony_ci
28262306a36Sopenharmony_cistatic const int pvc_bd_subids[] = {
28362306a36Sopenharmony_ci	[0x0] = STEP_A0,
28462306a36Sopenharmony_ci	[0x3] = STEP_B0,
28562306a36Sopenharmony_ci	[0x4] = STEP_B1,
28662306a36Sopenharmony_ci	[0x5] = STEP_B3,
28762306a36Sopenharmony_ci};
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_cistatic const int pvc_ct_subids[] = {
29062306a36Sopenharmony_ci	[0x3] = STEP_A0,
29162306a36Sopenharmony_ci	[0x5] = STEP_B0,
29262306a36Sopenharmony_ci	[0x6] = STEP_B1,
29362306a36Sopenharmony_ci	[0x7] = STEP_C0,
29462306a36Sopenharmony_ci};
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_cistatic int
29762306a36Sopenharmony_cipvc_step_lookup(struct drm_i915_private *i915, const char *type,
29862306a36Sopenharmony_ci		const int *table, int size, int subid)
29962306a36Sopenharmony_ci{
30062306a36Sopenharmony_ci	if (subid < size && table[subid] != STEP_NONE)
30162306a36Sopenharmony_ci		return table[subid];
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_ci	drm_warn(&i915->drm, "Unknown %s id 0x%02x\n", type, subid);
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ci	/*
30662306a36Sopenharmony_ci	 * As on other platforms, try to use the next higher ID if we land on a
30762306a36Sopenharmony_ci	 * gap in the table.
30862306a36Sopenharmony_ci	 */
30962306a36Sopenharmony_ci	while (subid < size && table[subid] == STEP_NONE)
31062306a36Sopenharmony_ci		subid++;
31162306a36Sopenharmony_ci
31262306a36Sopenharmony_ci	if (subid < size) {
31362306a36Sopenharmony_ci		drm_dbg(&i915->drm, "Using steppings for %s id 0x%02x\n",
31462306a36Sopenharmony_ci			type, subid);
31562306a36Sopenharmony_ci		return table[subid];
31662306a36Sopenharmony_ci	}
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ci	drm_dbg(&i915->drm, "Using future steppings\n");
31962306a36Sopenharmony_ci	return STEP_FUTURE;
32062306a36Sopenharmony_ci}
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_ci/*
32362306a36Sopenharmony_ci * PVC needs special handling since we don't lookup the
32462306a36Sopenharmony_ci * revid in a table, but rather specific bitfields within
32562306a36Sopenharmony_ci * the revid for various components.
32662306a36Sopenharmony_ci */
32762306a36Sopenharmony_cistatic void pvc_step_init(struct drm_i915_private *i915, int pci_revid)
32862306a36Sopenharmony_ci{
32962306a36Sopenharmony_ci	int ct_subid, bd_subid;
33062306a36Sopenharmony_ci
33162306a36Sopenharmony_ci	bd_subid = FIELD_GET(PVC_BD_REVID, pci_revid);
33262306a36Sopenharmony_ci	ct_subid = FIELD_GET(PVC_CT_REVID, pci_revid);
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ci	RUNTIME_INFO(i915)->step.basedie_step =
33562306a36Sopenharmony_ci		pvc_step_lookup(i915, "Base Die", pvc_bd_subids,
33662306a36Sopenharmony_ci				ARRAY_SIZE(pvc_bd_subids), bd_subid);
33762306a36Sopenharmony_ci	RUNTIME_INFO(i915)->step.graphics_step =
33862306a36Sopenharmony_ci		pvc_step_lookup(i915, "Compute Tile", pvc_ct_subids,
33962306a36Sopenharmony_ci				ARRAY_SIZE(pvc_ct_subids), ct_subid);
34062306a36Sopenharmony_ci}
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_ci#define STEP_NAME_CASE(name)	\
34362306a36Sopenharmony_ci	case STEP_##name:	\
34462306a36Sopenharmony_ci		return #name;
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ciconst char *intel_step_name(enum intel_step step)
34762306a36Sopenharmony_ci{
34862306a36Sopenharmony_ci	switch (step) {
34962306a36Sopenharmony_ci	STEP_NAME_LIST(STEP_NAME_CASE);
35062306a36Sopenharmony_ci
35162306a36Sopenharmony_ci	default:
35262306a36Sopenharmony_ci		return "**";
35362306a36Sopenharmony_ci	}
35462306a36Sopenharmony_ci}
355