Jani Nikula | 7eb186b | 2021-03-26 15:21:32 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: MIT |
| 2 | /* |
| 3 | * Copyright © 2020,2021 Intel Corporation |
| 4 | */ |
| 5 | |
| 6 | #include "i915_drv.h" |
| 7 | #include "intel_step.h" |
| 8 | |
| 9 | /* |
| 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. |
| 14 | */ |
| 15 | |
Jani Nikula | ef47b7a | 2021-03-26 15:21:34 +0200 | [diff] [blame] | 16 | |
| 17 | /* FIXME: what about REVID_E0 */ |
Jani Nikula | 5644dc0 | 2021-03-26 15:21:38 +0200 | [diff] [blame] | 18 | static const struct intel_step_info kbl_revids[] = { |
Jani Nikula | 26475ca | 2021-03-26 15:21:37 +0200 | [diff] [blame] | 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 }, |
Jani Nikula | 7eb186b | 2021-03-26 15:21:32 +0200 | [diff] [blame] | 27 | }; |
| 28 | |
Jani Nikula | 5644dc0 | 2021-03-26 15:21:38 +0200 | [diff] [blame] | 29 | static const struct intel_step_info tgl_uy_revid_step_tbl[] = { |
Jani Nikula | 26475ca | 2021-03-26 15:21:37 +0200 | [diff] [blame] | 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 }, |
Jani Nikula | 7eb186b | 2021-03-26 15:21:32 +0200 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | /* Same GT stepping between tgl_uy_revids and tgl_revids don't mean the same HW */ |
Jani Nikula | 5644dc0 | 2021-03-26 15:21:38 +0200 | [diff] [blame] | 37 | static const struct intel_step_info tgl_revid_step_tbl[] = { |
Jani Nikula | 26475ca | 2021-03-26 15:21:37 +0200 | [diff] [blame] | 38 | [0] = { .gt_step = STEP_A0, .display_step = STEP_B0 }, |
| 39 | [1] = { .gt_step = STEP_B0, .display_step = STEP_D0 }, |
Jani Nikula | 7eb186b | 2021-03-26 15:21:32 +0200 | [diff] [blame] | 40 | }; |
| 41 | |
Jani Nikula | 5644dc0 | 2021-03-26 15:21:38 +0200 | [diff] [blame] | 42 | static const struct intel_step_info adls_revid_step_tbl[] = { |
Jani Nikula | 26475ca | 2021-03-26 15:21:37 +0200 | [diff] [blame] | 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 }, |
Jani Nikula | 7eb186b | 2021-03-26 15:21:32 +0200 | [diff] [blame] | 48 | }; |
Jani Nikula | ef47b7a | 2021-03-26 15:21:34 +0200 | [diff] [blame] | 49 | |
José Roberto de Souza | b2c6eaf | 2021-05-14 08:37:08 -0700 | [diff] [blame] | 50 | static const struct intel_step_info adlp_revid_step_tbl[] = { |
| 51 | [0x0] = { .gt_step = STEP_A0, .display_step = STEP_A0 }, |
| 52 | [0x4] = { .gt_step = STEP_B0, .display_step = STEP_B0 }, |
| 53 | [0x8] = { .gt_step = STEP_C0, .display_step = STEP_C0 }, |
| 54 | [0xC] = { .gt_step = STEP_C0, .display_step = STEP_D0 }, |
| 55 | }; |
| 56 | |
Jani Nikula | ef47b7a | 2021-03-26 15:21:34 +0200 | [diff] [blame] | 57 | void intel_step_init(struct drm_i915_private *i915) |
| 58 | { |
Jani Nikula | 5644dc0 | 2021-03-26 15:21:38 +0200 | [diff] [blame] | 59 | const struct intel_step_info *revids = NULL; |
Jani Nikula | ef47b7a | 2021-03-26 15:21:34 +0200 | [diff] [blame] | 60 | int size = 0; |
| 61 | int revid = INTEL_REVID(i915); |
Jani Nikula | 5644dc0 | 2021-03-26 15:21:38 +0200 | [diff] [blame] | 62 | struct intel_step_info step = {}; |
Jani Nikula | ef47b7a | 2021-03-26 15:21:34 +0200 | [diff] [blame] | 63 | |
José Roberto de Souza | b2c6eaf | 2021-05-14 08:37:08 -0700 | [diff] [blame] | 64 | if (IS_ALDERLAKE_P(i915)) { |
| 65 | revids = adlp_revid_step_tbl; |
| 66 | size = ARRAY_SIZE(adlp_revid_step_tbl); |
| 67 | } else if (IS_ALDERLAKE_S(i915)) { |
Jani Nikula | 34b7e27 | 2021-03-26 15:21:35 +0200 | [diff] [blame] | 68 | revids = adls_revid_step_tbl; |
| 69 | size = ARRAY_SIZE(adls_revid_step_tbl); |
| 70 | } else if (IS_TGL_U(i915) || IS_TGL_Y(i915)) { |
| 71 | revids = tgl_uy_revid_step_tbl; |
| 72 | size = ARRAY_SIZE(tgl_uy_revid_step_tbl); |
| 73 | } else if (IS_TIGERLAKE(i915)) { |
| 74 | revids = tgl_revid_step_tbl; |
| 75 | size = ARRAY_SIZE(tgl_revid_step_tbl); |
| 76 | } else if (IS_KABYLAKE(i915)) { |
Jani Nikula | ef47b7a | 2021-03-26 15:21:34 +0200 | [diff] [blame] | 77 | revids = kbl_revids; |
| 78 | size = ARRAY_SIZE(kbl_revids); |
| 79 | } |
| 80 | |
| 81 | /* Not using the stepping scheme for the platform yet. */ |
| 82 | if (!revids) |
| 83 | return; |
| 84 | |
Jani Nikula | 26475ca | 2021-03-26 15:21:37 +0200 | [diff] [blame] | 85 | if (revid < size && revids[revid].gt_step != STEP_NONE) { |
Jani Nikula | ef47b7a | 2021-03-26 15:21:34 +0200 | [diff] [blame] | 86 | step = revids[revid]; |
| 87 | } else { |
| 88 | drm_warn(&i915->drm, "Unknown revid 0x%02x\n", revid); |
| 89 | |
| 90 | /* |
| 91 | * If we hit a gap in the revid array, use the information for |
| 92 | * the next revid. |
| 93 | * |
| 94 | * This may be wrong in all sorts of ways, especially if the |
| 95 | * steppings in the array are not monotonically increasing, but |
| 96 | * it's better than defaulting to 0. |
| 97 | */ |
Jani Nikula | 26475ca | 2021-03-26 15:21:37 +0200 | [diff] [blame] | 98 | while (revid < size && revids[revid].gt_step == STEP_NONE) |
Jani Nikula | ef47b7a | 2021-03-26 15:21:34 +0200 | [diff] [blame] | 99 | revid++; |
| 100 | |
| 101 | if (revid < size) { |
| 102 | drm_dbg(&i915->drm, "Using steppings for revid 0x%02x\n", |
| 103 | revid); |
| 104 | step = revids[revid]; |
| 105 | } else { |
| 106 | drm_dbg(&i915->drm, "Using future steppings\n"); |
Jani Nikula | 26475ca | 2021-03-26 15:21:37 +0200 | [diff] [blame] | 107 | step.gt_step = STEP_FUTURE; |
| 108 | step.display_step = STEP_FUTURE; |
Jani Nikula | ef47b7a | 2021-03-26 15:21:34 +0200 | [diff] [blame] | 109 | } |
| 110 | } |
| 111 | |
Jani Nikula | 26475ca | 2021-03-26 15:21:37 +0200 | [diff] [blame] | 112 | if (drm_WARN_ON(&i915->drm, step.gt_step == STEP_NONE)) |
Jani Nikula | ef47b7a | 2021-03-26 15:21:34 +0200 | [diff] [blame] | 113 | return; |
| 114 | |
| 115 | RUNTIME_INFO(i915)->step = step; |
| 116 | } |