1 // SPDX-License-Identifier: MIT
3 * Copyright © 2020,2021 Intel Corporation
7 #include "intel_step.h"
10 * KBL revision ID ordering is bizarre; higher revision ID's map to lower
11 * steppings in some cases. So rather than test against the revision ID
12 * directly, let's map that into our own range of increasing ID's that we
13 * can test against in a regular manner.
17 /* FIXME: what about REVID_E0 */
18 static const struct intel_step_info kbl_revids[] = {
19 [0] = { .gt_step = STEP_A0, .display_step = STEP_A0 },
20 [1] = { .gt_step = STEP_B0, .display_step = STEP_B0 },
21 [2] = { .gt_step = STEP_C0, .display_step = STEP_B0 },
22 [3] = { .gt_step = STEP_D0, .display_step = STEP_B0 },
23 [4] = { .gt_step = STEP_F0, .display_step = STEP_C0 },
24 [5] = { .gt_step = STEP_C0, .display_step = STEP_B1 },
25 [6] = { .gt_step = STEP_D1, .display_step = STEP_B1 },
26 [7] = { .gt_step = STEP_G0, .display_step = STEP_C0 },
29 static const struct intel_step_info tgl_uy_revid_step_tbl[] = {
30 [0] = { .gt_step = STEP_A0, .display_step = STEP_A0 },
31 [1] = { .gt_step = STEP_B0, .display_step = STEP_C0 },
32 [2] = { .gt_step = STEP_B1, .display_step = STEP_C0 },
33 [3] = { .gt_step = STEP_C0, .display_step = STEP_D0 },
36 /* Same GT stepping between tgl_uy_revids and tgl_revids don't mean the same HW */
37 static const struct intel_step_info tgl_revid_step_tbl[] = {
38 [0] = { .gt_step = STEP_A0, .display_step = STEP_B0 },
39 [1] = { .gt_step = STEP_B0, .display_step = STEP_D0 },
42 static const struct intel_step_info adls_revid_step_tbl[] = {
43 [0x0] = { .gt_step = STEP_A0, .display_step = STEP_A0 },
44 [0x1] = { .gt_step = STEP_A0, .display_step = STEP_A2 },
45 [0x4] = { .gt_step = STEP_B0, .display_step = STEP_B0 },
46 [0x8] = { .gt_step = STEP_C0, .display_step = STEP_B0 },
47 [0xC] = { .gt_step = STEP_D0, .display_step = STEP_C0 },
50 void intel_step_init(struct drm_i915_private *i915)
52 const struct intel_step_info *revids = NULL;
54 int revid = INTEL_REVID(i915);
55 struct intel_step_info step = {};
57 if (IS_ALDERLAKE_S(i915)) {
58 revids = adls_revid_step_tbl;
59 size = ARRAY_SIZE(adls_revid_step_tbl);
60 } else if (IS_TGL_U(i915) || IS_TGL_Y(i915)) {
61 revids = tgl_uy_revid_step_tbl;
62 size = ARRAY_SIZE(tgl_uy_revid_step_tbl);
63 } else if (IS_TIGERLAKE(i915)) {
64 revids = tgl_revid_step_tbl;
65 size = ARRAY_SIZE(tgl_revid_step_tbl);
66 } else if (IS_KABYLAKE(i915)) {
68 size = ARRAY_SIZE(kbl_revids);
71 /* Not using the stepping scheme for the platform yet. */
75 if (revid < size && revids[revid].gt_step != STEP_NONE) {
78 drm_warn(&i915->drm, "Unknown revid 0x%02x\n", revid);
81 * If we hit a gap in the revid array, use the information for
84 * This may be wrong in all sorts of ways, especially if the
85 * steppings in the array are not monotonically increasing, but
86 * it's better than defaulting to 0.
88 while (revid < size && revids[revid].gt_step == STEP_NONE)
92 drm_dbg(&i915->drm, "Using steppings for revid 0x%02x\n",
96 drm_dbg(&i915->drm, "Using future steppings\n");
97 step.gt_step = STEP_FUTURE;
98 step.display_step = STEP_FUTURE;
102 if (drm_WARN_ON(&i915->drm, step.gt_step == STEP_NONE))
105 RUNTIME_INFO(i915)->step = step;